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, credentials
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptioncreateResource
(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) createResource
(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher, String trackingAttribute) createResource
(String resourceType, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) createResourceContainer
(String resourceType, String resourceFileName) void
deleteResource
(String resourceId) Delete the resource and all its revisionsstep.grid.io.Attachment
Download a resource based on its idfindManyByCriteria
(Map<String, String> criteria) getResource
(String resourceId) getResourceContent
(String resourceId) Get the content of an existingResource
getResourceFile
(String resourceId) getResourceRevision
(String resourceRevisionId) getResourceRevisionContent
(String resourceRevisionId) boolean
resourceExists
(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 ResourceUploadResponse
upload
(org.glassfish.jersey.media.multipart.FormDataBodyPart bodyPart) protected ResourceUploadResponse
upload
(org.glassfish.jersey.media.multipart.FormDataBodyPart bodyPart, String type, boolean isDirectory, boolean checkForDuplicates, String trackingAttribute) 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
ResourceUploadResponse
containing 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
ResourceUploadResponse
containing 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, String trackingAttribute) -
download
Download a resource based on its id- Parameters:
resourceId
- the id of the resource to be downloaded- Returns:
- the
Response
containing 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:
createResource
in 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
- theObjectEnricher
of 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) - Specified by:
createResource
in interfaceResourceManager
-
createResource
public Resource createResource(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher, String trackingAttribute) - Specified by:
createResource
in interfaceResourceManager
-
saveResourceContent
public Resource saveResourceContent(String resourceId, InputStream resourceStream, String resourceFileName) throws IOException Description copied from interface:ResourceManager
Save the content provided as stream to an existing resource. This creates a newResourceRevision
for theResource
and saves the content provided as stream under this revision.- Specified by:
saveResourceContent
in 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:ResourceManager
Delete the resource and all its revisions- Specified by:
deleteResource
in interfaceResourceManager
- Parameters:
resourceId
- the id of theResource
to be deleted
-
findManyByCriteria
- Specified by:
findManyByCriteria
in interfaceResourceManager
-
getResourceContent
Description copied from interface:ResourceManager
Get the content of an existingResource
- Specified by:
getResourceContent
in interfaceResourceManager
- Parameters:
resourceId
- the id of theResource
to be deleted- Returns:
- the content of the resource as stream
- Throws:
IOException
- an IOException occurs during the call
-
getResource
- Specified by:
getResource
in interfaceResourceManager
-
getResourceFile
- Specified by:
getResourceFile
in interfaceResourceManager
-
getResourceRevisionContent
public ResourceRevisionContentImpl getResourceRevisionContent(String resourceRevisionId) throws IOException - Specified by:
getResourceRevisionContent
in interfaceResourceManager
- Throws:
IOException
-
getResourceRevision
- Specified by:
getResourceRevision
in interfaceResourceManager
-
createResourceContainer
public ResourceRevisionContainer createResourceContainer(String resourceType, String resourceFileName) throws IOException - Specified by:
createResourceContainer
in interfaceResourceManager
- Throws:
IOException
-
resourceExists
Description copied from interface:ResourceManager
Test if a given resource id exists- Specified by:
resourceExists
in interfaceResourceManager
- Parameters:
resourceId
- the id of the resource to test- Returns:
- true if the resource exists
-
saveResource
Description copied from interface:ResourceManager
Saved the resource object only- Specified by:
saveResource
in interfaceResourceManager
- Parameters:
resource
- the resource to be saved- Returns:
- the updated
Resource
- Throws:
IOException
- an IOException occurs during the call
-
getResourcesRootPath
- Specified by:
getResourcesRootPath
in interfaceResourceManager
-
saveResourceRevision
- Specified by:
saveResourceRevision
in interfaceResourceManager
- Throws:
IOException
-