Package step.client.resources
Class RemoteResourceManager
java.lang.Object
step.client.AbstractRemoteClient
step.client.resources.RemoteResourceManager
- All Implemented Interfaces:
Closeable,AutoCloseable,ResourceManager
This class provides an API to upload resources (compiled code of a keyword, etc) to the controller
-
Field Summary
Fields inherited from class step.client.AbstractRemoteClient
client, cookies, credentialsFields inherited from interface step.resources.ResourceManager
RESOURCE_TYPE_ATTACHMENT, RESOURCE_TYPE_DATASOURCE, RESOURCE_TYPE_FUNCTIONS, RESOURCE_TYPE_PDF_TEST_SCENARIO_FILE, RESOURCE_TYPE_SECRET, RESOURCE_TYPE_STAGING_CONTEXT_FILES, RESOURCE_TYPE_TEMP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateResource(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) createResource(String resourceType, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) createResourceContainer(String resourceType, String resourceFileName) voiddeleteResource(String resourceId) Delete the resource and all its revisionsstep.grid.io.AttachmentDownload a resource based on its idgetResource(String resourceId) getResourceContent(String resourceId) Get the content of an existingResourcegetResourceFile(String resourceId) getResourceRevision(String resourceRevisionId) getResourceRevisionContent(String resourceRevisionId) booleanresourceExists(String resourceId) Test if a given resource id existssaveResource(Resource resource) Saved the resource object onlysaveResourceContent(String resourceId, InputStream resourceStream, String resourceFileName) Save the content provided as stream to an existing resource.saveResourceRevision(ResourceRevision resourceRevision) Upload the local file provided as argument to the controllerupload(String filename, InputStream stream) Upload the local file provided as argument to the controllerprotected ResourceUploadResponseupload(org.glassfish.jersey.media.multipart.FormDataBodyPart bodyPart) protected ResourceUploadResponseupload(org.glassfish.jersey.media.multipart.FormDataBodyPart bodyPart, String type, boolean isDirectory, boolean checkForDuplicates) Methods inherited from class step.client.AbstractRemoteClient
close, executeRequest, notImplemented, requestBuilder, requestBuilder
-
Constructor Details
-
RemoteResourceManager
public RemoteResourceManager() -
RemoteResourceManager
-
-
Method Details
-
upload
Upload the local file provided as argument to the controller- Parameters:
file- the local file to be uploaded- Returns:
- the
ResourceUploadResponsecontaining an handle to the uploaded file
-
upload
Upload the local file provided as argument to the controller- Parameters:
filename- the path to the local file to be uploaded- Returns:
- the
ResourceUploadResponsecontaining an handle to the uploaded file
-
upload
protected ResourceUploadResponse upload(org.glassfish.jersey.media.multipart.FormDataBodyPart bodyPart) -
upload
protected ResourceUploadResponse upload(org.glassfish.jersey.media.multipart.FormDataBodyPart bodyPart, String type, boolean isDirectory, boolean checkForDuplicates) -
download
Download a resource based on its id- Parameters:
resourceId- the id of the resource to be downloaded- Returns:
- the
Responsecontaining an handle to the uploaded file
-
createResource
public Resource createResource(String resourceType, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) throws IOException, SimilarResourceExistingException - Specified by:
createResourcein interfaceResourceManager- Parameters:
resourceType- the type of the resourceresourceStream- the stream of the resource to be savedresourceFileName- the name of the resource (filename)checkForDuplicates- is duplicate should be checkedobjectEnricher- theObjectEnricherof the context- Returns:
- the created
Resource - Throws:
IOException- an IOException occurs during the callSimilarResourceExistingException- a similar resource exist
-
createResource
public Resource createResource(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) throws IOException, SimilarResourceExistingException - Specified by:
createResourcein interfaceResourceManager- Throws:
IOExceptionSimilarResourceExistingException
-
saveResourceContent
public Resource saveResourceContent(String resourceId, InputStream resourceStream, String resourceFileName) throws IOException Description copied from interface:ResourceManagerSave the content provided as stream to an existing resource. This creates a newResourceRevisionfor theResourceand saves the content provided as stream under this revision.- Specified by:
saveResourceContentin interfaceResourceManager- Parameters:
resourceId- the id of the resource to be updatedresourceStream- the stream of the resource to be savedresourceFileName- the name of the resource (filename)- Returns:
- the updated
Resource - Throws:
IOException- an IOException occurs during the call
-
deleteResource
Description copied from interface:ResourceManagerDelete the resource and all its revisions- Specified by:
deleteResourcein interfaceResourceManager- Parameters:
resourceId- the id of theResourceto be deleted
-
getResourceContent
Description copied from interface:ResourceManagerGet the content of an existingResource- Specified by:
getResourceContentin interfaceResourceManager- Parameters:
resourceId- the id of theResourceto be deleted- Returns:
- the content of the resource as stream
- Throws:
IOException- an IOException occurs during the call
-
getResource
- Specified by:
getResourcein interfaceResourceManager
-
getResourceFile
- Specified by:
getResourceFilein interfaceResourceManager
-
getResourceRevisionContent
public ResourceRevisionContentImpl getResourceRevisionContent(String resourceRevisionId) throws IOException - Specified by:
getResourceRevisionContentin interfaceResourceManager- Throws:
IOException
-
getResourceRevision
- Specified by:
getResourceRevisionin interfaceResourceManager
-
createResourceContainer
public ResourceRevisionContainer createResourceContainer(String resourceType, String resourceFileName) throws IOException - Specified by:
createResourceContainerin interfaceResourceManager- Throws:
IOException
-
resourceExists
Description copied from interface:ResourceManagerTest if a given resource id exists- Specified by:
resourceExistsin interfaceResourceManager- Parameters:
resourceId- the id of the resource to test- Returns:
- true if the resource exists
-
saveResource
Description copied from interface:ResourceManagerSaved the resource object only- Specified by:
saveResourcein interfaceResourceManager- Parameters:
resource- the resource to be saved- Returns:
- the updated
Resource - Throws:
IOException- an IOException occurs during the call
-
getResourcesRootPath
- Specified by:
getResourcesRootPathin interfaceResourceManager
-
saveResourceRevision
- Specified by:
saveResourceRevisionin interfaceResourceManager- Throws:
IOException
-