java.lang.Object
org.odpi.openmetadata.frameworks.governanceaction.fileclassifier.FileClassifier

public class FileClassifier extends Object
Manages different types of classifications for files. It retrieves file reference data from the open metadata store and maintains a cache.
  • Constructor Details

    • FileClassifier

      public FileClassifier(OpenMetadataStore openMetadataStore)
      Use the valid values to classify files on request.
      Parameters:
      openMetadataStore - open metadata where the valid values are stored.
  • Method Details

    • classifyFile

      public FileClassification classifyFile(String pathName) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException, org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException, IOException
      Classify the properties of the file represented by the path name.
      Parameters:
      pathName - name of the file
      Returns:
      file classification
      Throws:
      org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException - invalid parameter
      org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException - problem connecting to the open metadata repositories
      org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException - insufficient access
      IOException - unable to access the attributes of the file
    • classifyFile

      public FileClassification classifyFile(File file) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException, org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException, IOException
      Classify the properties of the file represented by the Java File object.
      Parameters:
      file - details of the file
      Returns:
      file classification
      Throws:
      org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException - invalid parameter
      org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException - problem connecting to the open metadata repositories
      org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException - insufficient access
      IOException
    • getFileExtension

      public String getFileExtension(String fileName)
      Retrieves the extension from a file name. For example, if the file name is "three.txt", the method returns "txt". If the path name has multiple extensions, such as "my-jar.jar.gz", the final extension is returned (ie "gz"). Null is returned if there is no file extension in the file name.
      Parameters:
      fileName - short name
      Returns:
      file extension