Class FilesRESTServices
java.lang.Object
org.odpi.openmetadata.accessservices.datamanager.server.FilesRESTServices
FilesRESTServices provides the server-side implementation for managing files and folder assets in a
file system. Notice that the integrator identifiers are not specified for the file system because the files can be
changed by so many processes. If the files are being controlled by an application then use the ContentManagerRESTServices
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDataFileToCatalog
(String serverName, String userId, DataFileRequestBody requestBody) Add a simple asset description linked to a connection object for a file and to the folder structure implied in the path name.addDataFileToCatalogFromTemplate
(String serverName, String userId, String templateGUID, TemplateRequestBody requestBody) Add an asset description a file based on the content of a template object.addDataFolderAssetToCatalog
(String serverName, String userId, DataFolderRequestBody requestBody) Creates a new folder asset that is identified as a data asset.addDataFolderToCatalogFromTemplate
(String serverName, String userId, String templateGUID, TemplateRequestBody requestBody) Creates a new folder asset that is identified as a data asset using a template.archiveDataFileInCatalog
(String serverName, String userId, String dataFileGUID, ArchiveRequestBody requestBody) Mark the file asset description in the catalog as archived.archiveDataFolderInCatalog
(String serverName, String userId, String dataFolderGUID, ArchiveRequestBody requestBody) Mark the data folder asset description in the catalog as archived.attachDataFileAssetToFolder
(String serverName, String userId, String folderGUID, String fileGUID, MetadataSourceRequestBody requestBody) Link an existing file asset to a folder.attachFolderToFileSystem
(String serverName, String userId, String fileSystemGUID, String folderGUID, ExternalSourceRequestBody requestBody) Links a folder to a file system.createFolderStructureInCatalog
(String serverName, String userId, String parentGUID, PathNameRequestBody requestBody) Creates a new folder asset for each element in the pathName that is linked from the parent entity.deleteDataFileFromCatalog
(String serverName, String userId, String dataFileGUID, PathNameRequestBody requestBody) Remove the file asset description from the catalog.deleteDataFolderFromCatalog
(String serverName, String userId, String dataFolderGUID, PathNameRequestBody requestBody) Remove the data folder asset description from the catalog.detachDataFileAssetFromFolder
(String serverName, String userId, String folderGUID, String fileGUID, MetadataSourceRequestBody requestBody) Remove a link between a file asset and a folder.detachFolderFromFileSystem
(String serverName, String userId, String fileSystemGUID, String folderGUID, MetadataSourceRequestBody requestBody) Removed the link between a folder and a file system.findDataFilesByPathName
(String serverName, String userId, int startingFrom, int maxPageSize, PathNameRequestBody requestBody) Retrieve data files by the supplied wildcard name.getDataFileByGUID
(String serverName, String userId, String fileGUID) Retrieve a data file asset by its unique identifier (GUID).getDataFileByPathName
(String serverName, String userId, PathNameRequestBody requestBody) Retrieve a data file asset by its fully qualified path name.getDataFilesByPathName
(String serverName, String userId, int startingFrom, int maxPageSize, PathNameRequestBody requestBody) Find data file by a full or partial path name.getFileSystemByGUID
(String serverName, String userId, String fileSystemGUID) Retrieve a FileSystemProperties asset by its unique identifier (GUID).getFileSystemByUniqueName
(String serverName, String userId, String uniqueName) Retrieve a FileSystemProperties asset by its unique name.getFileSystems
(String serverName, String userId, int startingFrom, int maxPageSize) Retrieve a list of defined FileSystems assets.getFolderByGUID
(String serverName, String userId, String folderGUID) Retrieve a FileFolderProperties asset by its unique identifier (GUID).getFolderByPathName
(String serverName, String userId, PathNameRequestBody requestBody) Retrieve a folder by its fully qualified path name.getFolderFiles
(String serverName, String userId, String folderGUID, int startingFrom, int maxPageSize) Get the files inside a folder - both those that are nested and those that are linked.getNestedFolders
(String serverName, String userId, String parentFolderGUID, int startingFrom, int maxPageSize) Return the list of folders nested inside a folder.getTopLevelFolders
(String serverName, String userId, String fileSystemGUID, int startingFrom, int maxPageSize) Return the list of folders nested inside a filesystem.moveDataFileInCatalog
(String serverName, String userId, String folderGUID, String fileGUID, MetadataSourceRequestBody requestBody) Move a data file from its current parent folder to a new parent folder - this changes the file's qualified name but not its unique identifier (guid).moveDataFolderInCatalog
(String serverName, String userId, String newParentFolderGUID, String movingFolderGUID, MetadataSourceRequestBody requestBody) Move a data folder from its current parent folder to a new parent folder - this changes the folder's qualified name but not its unique identifier (guid).updateDataFileInCatalog
(String serverName, String userId, String dataFileGUID, boolean isMergeUpdate, DataFileRequestBody requestBody) Update the file asset description in the catalog.updateDataFolderInCatalog
(String serverName, String userId, String dataFolderGUID, boolean isMergeUpdate, DataFolderRequestBody requestBody) Update the DataFolder asset description in the catalog.
-
Constructor Details
-
FilesRESTServices
public FilesRESTServices()Default constructor
-
-
Method Details
-
createFolderStructureInCatalog
public GUIDListResponse createFolderStructureInCatalog(String serverName, String userId, String parentGUID, PathNameRequestBody requestBody) Creates a new folder asset for each element in the pathName that is linked from the parent entity. For example, a pathName of "one/two/three" creates 3 new folder assets, one called "one", the next called "one/two" and the last one called "one/two/three".- Parameters:
serverName
- name of calling serveruserId
- calling userparentGUID
- root object to connect the folder torequestBody
- pathname of the folder (or folders)- Returns:
- list of GUIDs from the top level to the leaf of the supplied pathname or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
attachFolderToFileSystem
public VoidResponse attachFolderToFileSystem(String serverName, String userId, String fileSystemGUID, String folderGUID, ExternalSourceRequestBody requestBody) Links a folder to a file system. The folder is not changed.- Parameters:
serverName
- name of calling serveruserId
- calling userfileSystemGUID
- unique identifier of the file system in the catalogfolderGUID
- unique identifier of the folder in the catalogrequestBody
- external source identifiers - or null for local- Returns:
- void or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
detachFolderFromFileSystem
public VoidResponse detachFolderFromFileSystem(String serverName, String userId, String fileSystemGUID, String folderGUID, MetadataSourceRequestBody requestBody) Removed the link between a folder and a file system.- Parameters:
serverName
- name of calling serveruserId
- calling userfileSystemGUID
- unique identifier of the file system in the catalogfolderGUID
- unique identifier of the folder in the catalogrequestBody
- external source identifiers - or null for local- Returns:
- void or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
addDataFileToCatalog
public GUIDListResponse addDataFileToCatalog(String serverName, String userId, DataFileRequestBody requestBody) Add a simple asset description linked to a connection object for a file and to the folder structure implied in the path name. If the folder structure is not catalogued already, this is created automatically using the createFolderStructureInCatalog() method. For example, a pathName of "one/two/three/MyFile.txt" potentially creates 3 new folder assets, one called "one", the next called "one/two" and the last one called "one/two/three" plus a file asset called "one/two/three/MyFile.txt".- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)requestBody
- properties for the asset- Returns:
- list of GUIDs from the top level to the root of the pathname or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
addDataFileToCatalogFromTemplate
public GUIDListResponse addDataFileToCatalogFromTemplate(String serverName, String userId, String templateGUID, TemplateRequestBody requestBody) Add an asset description a file based on the content of a template object. Link this new asset to the folder structure implied in the path name. If the folder structure is not catalogued already, this is created automatically using the createFolderStructureInCatalog() method. For example, a pathName of "one/two/three/MyFile.txt" potentially creates 3 new folder assets, one called "one", the next called "one/two" and the last one called "one/two/three" plus a file asset called "one/two/three/MyFile.txt".- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)templateGUID
- unique identifier of the file asset to copyrequestBody
- override properties for the asset- Returns:
- list of GUIDs from the top level to the root of the pathname or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
updateDataFileInCatalog
public VoidResponse updateDataFileInCatalog(String serverName, String userId, String dataFileGUID, boolean isMergeUpdate, DataFileRequestBody requestBody) Update the file asset description in the catalog.- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)dataFileGUID
- unique identifier of the data file assetisMergeUpdate
- should the supplied properties completely override the existing properties or augment them?requestBody
- properties for the asset- Returns:
- void or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
archiveDataFileInCatalog
public VoidResponse archiveDataFileInCatalog(String serverName, String userId, String dataFileGUID, ArchiveRequestBody requestBody) Mark the file asset description in the catalog as archived.- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)dataFileGUID
- unique identifier of the data file assetrequestBody
- properties to help locate the archive copy- Returns:
- void or InvalidParameterException one of the parameters is null or invalid PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
deleteDataFileFromCatalog
public VoidResponse deleteDataFileFromCatalog(String serverName, String userId, String dataFileGUID, PathNameRequestBody requestBody) Remove the file asset description from the catalog.- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)dataFileGUID
- unique identifier of the data file assetrequestBody
- full pathname for the asset- Returns:
- void or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
addDataFolderAssetToCatalog
public GUIDListResponse addDataFolderAssetToCatalog(String serverName, String userId, DataFolderRequestBody requestBody) Creates a new folder asset that is identified as a data asset. This means the files and sub-folders within it collectively make up the contents of the data asset. As with other types of file-based asset, links are made to the folder structure implied in the path name. If the folder structure is not catalogued already, this is created automatically using the createFolderStructureInCatalog() method. For example, a pathName of "one/two/three/MyDataFolder" potentially creates 3 new folder assets, one called "one", the next called "one/two" and the last one called "one/two/three" plus a DataFolder asset called "one/two/three/MyDataFolder".- Parameters:
serverName
- name of calling serveruserId
- calling userrequestBody
- pathname of the file- Returns:
- list of GUIDs from the top level to the root of the pathname or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
addDataFolderToCatalogFromTemplate
public GUIDListResponse addDataFolderToCatalogFromTemplate(String serverName, String userId, String templateGUID, TemplateRequestBody requestBody) Creates a new folder asset that is identified as a data asset using a template. This means the files and sub-folders within it collectively make up the contents of the data asset. As with other types of file-based asset, links are made to the folder structure implied in the path name. If the folder structure is not catalogued already, this is created automatically using the createFolderStructureInCatalog() method. For example, a pathName of "one/two/three/MyDataFolder" potentially creates 3 new folder assets, one called "one", the next called "one/two" and the last one called "one/two/three" plus a DataFolder asset called "one/two/three/MyDataFolder".- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)templateGUID
- unique identifier of the file asset to copyrequestBody
- override properties for the asset- Returns:
- list of GUIDs from the top level to the root of the pathname or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
updateDataFolderInCatalog
public VoidResponse updateDataFolderInCatalog(String serverName, String userId, String dataFolderGUID, boolean isMergeUpdate, DataFolderRequestBody requestBody) Update the DataFolder asset description in the catalog.- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)dataFolderGUID
- unique identifier of the data folder assetisMergeUpdate
- should the supplied properties completely override the existing properties or augment them?requestBody
- properties for the asset- Returns:
- void or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
archiveDataFolderInCatalog
public VoidResponse archiveDataFolderInCatalog(String serverName, String userId, String dataFolderGUID, ArchiveRequestBody requestBody) Mark the data folder asset description in the catalog as archived.- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)dataFolderGUID
- unique identifier of the data file assetrequestBody
- properties to help locate the archive copy- Returns:
- void or InvalidParameterException one of the parameters is null or invalid PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
deleteDataFolderFromCatalog
public VoidResponse deleteDataFolderFromCatalog(String serverName, String userId, String dataFolderGUID, PathNameRequestBody requestBody) Remove the data folder asset description from the catalog.- Parameters:
serverName
- name of calling serveruserId
- calling user (assumed to be the owner)dataFolderGUID
- unique identifier of the data file assetrequestBody
- full pathname for the asset- Returns:
- void or InvalidParameterException full path or userId is null PropertyServerException problem accessing property server UserNotAuthorizedException security access problem
-
attachDataFileAssetToFolder
public VoidResponse attachDataFileAssetToFolder(String serverName, String userId, String folderGUID, String fileGUID, MetadataSourceRequestBody requestBody) Link an existing file asset to a folder. The file is not changed as this is used to create a logical link to the folder.- Parameters:
serverName
- name of calling serveruserId
- calling userfolderGUID
- unique identifier of the folderfileGUID
- unique identifier of the filerequestBody
- external source identifiers - or null for local- Returns:
- void or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
detachDataFileAssetFromFolder
public VoidResponse detachDataFileAssetFromFolder(String serverName, String userId, String folderGUID, String fileGUID, MetadataSourceRequestBody requestBody) Remove a link between a file asset and a folder. The file is not changed. Use moveDataFileInCatalog to record the fact that the physical file has moved. Use attachDataFileAssetToFolder to create logical link to a new folder.- Parameters:
serverName
- name of calling serveruserId
- calling userfolderGUID
- unique identifier of the folderfileGUID
- unique identifier of the filerequestBody
- external source identifiers - or null for local- Returns:
- void or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
moveDataFileInCatalog
public VoidResponse moveDataFileInCatalog(String serverName, String userId, String folderGUID, String fileGUID, MetadataSourceRequestBody requestBody) Move a data file from its current parent folder to a new parent folder - this changes the file's qualified name but not its unique identifier (guid). Similarly to the endpoint in the connection object.- Parameters:
serverName
- name of calling serveruserId
- calling userfolderGUID
- new parent folderfileGUID
- unique identifier of the file to moverequestBody
- request body- Returns:
- void or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
moveDataFolderInCatalog
public VoidResponse moveDataFolderInCatalog(String serverName, String userId, String newParentFolderGUID, String movingFolderGUID, MetadataSourceRequestBody requestBody) Move a data folder from its current parent folder to a new parent folder - this changes the folder's qualified name but not its unique identifier (guid). Similarly to the endpoint in the connection object.- Parameters:
serverName
- name of calling serveruserId
- calling usernewParentFolderGUID
- new parent foldermovingFolderGUID
- unique identifier of the file to moverequestBody
- external source identifiers - or null for local- Returns:
- void or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getFileSystemByGUID
public FileSystemResponse getFileSystemByGUID(String serverName, String userId, String fileSystemGUID) Retrieve a FileSystemProperties asset by its unique identifier (GUID).- Parameters:
serverName
- name of calling serveruserId
- calling userfileSystemGUID
- unique identifier used to locate the file system- Returns:
- FileSystemProperties properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getFileSystemByUniqueName
public FileSystemResponse getFileSystemByUniqueName(String serverName, String userId, String uniqueName) Retrieve a FileSystemProperties asset by its unique name.- Parameters:
serverName
- name of calling serveruserId
- calling useruniqueName
- unique name used to locate the file system- Returns:
- Filesystem properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getFileSystems
public GUIDListResponse getFileSystems(String serverName, String userId, int startingFrom, int maxPageSize) Retrieve a list of defined FileSystems assets.- Parameters:
serverName
- name of calling serveruserId
- calling userstartingFrom
- starting point in the listmaxPageSize
- maximum number of results- Returns:
- List of Filesystem unique identifiers or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getFolderByGUID
Retrieve a FileFolderProperties asset by its unique identifier (GUID).- Parameters:
serverName
- name of calling serveruserId
- calling userfolderGUID
- unique identifier used to locate the folder- Returns:
- FileFolderProperties properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getFolderByPathName
public FileFolderResponse getFolderByPathName(String serverName, String userId, PathNameRequestBody requestBody) Retrieve a folder by its fully qualified path name.- Parameters:
serverName
- name of calling serveruserId
- calling userrequestBody
- path name- Returns:
- FileFolderProperties properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getTopLevelFolders
public GUIDListResponse getTopLevelFolders(String serverName, String userId, String fileSystemGUID, int startingFrom, int maxPageSize) Return the list of folders nested inside a filesystem.- Parameters:
serverName
- name of calling serveruserId
- calling userfileSystemGUID
- unique identifier of the Filesystem to querystartingFrom
- starting point in the listmaxPageSize
- maximum number of results- Returns:
- list of folder unique identifiers (null means 'no nested folders') or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getNestedFolders
public GUIDListResponse getNestedFolders(String serverName, String userId, String parentFolderGUID, int startingFrom, int maxPageSize) Return the list of folders nested inside a folder.- Parameters:
serverName
- name of calling serveruserId
- calling userparentFolderGUID
- unique identifier of the folder to querystartingFrom
- starting point in the listmaxPageSize
- maximum number of results- Returns:
- list of folder unique identifiers (null means "no nested folders") or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getFolderFiles
public DataFilesResponse getFolderFiles(String serverName, String userId, String folderGUID, int startingFrom, int maxPageSize) Get the files inside a folder - both those that are nested and those that are linked.- Parameters:
serverName
- name of calling serveruserId
- calling userfolderGUID
- unique identifier of the folder to querystartingFrom
- starting point in the listmaxPageSize
- maximum number of results- Returns:
- list of file assets or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getDataFileByGUID
Retrieve a data file asset by its unique identifier (GUID).- Parameters:
serverName
- name of calling serveruserId
- calling userfileGUID
- unique identifier used to locate the file- Returns:
- data file properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getDataFileByPathName
public DataFileResponse getDataFileByPathName(String serverName, String userId, PathNameRequestBody requestBody) Retrieve a data file asset by its fully qualified path name.- Parameters:
serverName
- name of calling serveruserId
- calling userrequestBody
- path name- Returns:
- data file properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
getDataFilesByPathName
public DataFilesResponse getDataFilesByPathName(String serverName, String userId, int startingFrom, int maxPageSize, PathNameRequestBody requestBody) Find data file by a full or partial path name. The wildcard is specified using regular expressions (RegEx) and the method matches on the pathName property.- Parameters:
serverName
- name of calling serveruserId
- calling userstartingFrom
- starting point in the listmaxPageSize
- maximum number of resultsrequestBody
- path name- Returns:
- data file properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-
findDataFilesByPathName
public DataFilesResponse findDataFilesByPathName(String serverName, String userId, int startingFrom, int maxPageSize, PathNameRequestBody requestBody) Retrieve data files by the supplied wildcard name. The wildcard is specified using regular expressions (RegEx).- Parameters:
serverName
- name of calling serveruserId
- calling userstartingFrom
- starting point in the listmaxPageSize
- maximum number of resultsrequestBody
- path name- Returns:
- data file properties or InvalidParameterException one of the parameters is null or invalid or PropertyServerException problem accessing property server or UserNotAuthorizedException security access problem.
-