Package step.resources
Class ResourceManagerImpl
java.lang.Object
step.resources.ResourceManagerImpl
- All Implemented Interfaces:
ResourceManager
- Direct Known Subclasses:
LocalResourceManagerImpl
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.slf4j.Logger
protected final ResourceAccessor
protected final ResourceRevisionAccessor
protected final File
protected final Map<String,
ResourceType> 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
ConstructorDescriptionResourceManagerImpl
(File resourceRootFolder, ResourceAccessor resourceAccessor, ResourceRevisionAccessor resourceRevisionAccessor) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
closeResourceContainer
(Resource resource, ResourceRevision resourceRevision, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) protected void
closeResourceRevisionContent
(Resource resource) createResource
(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 revisionsfindManyByCriteria
(Map<String, String> attributes) getResource
(String resourceId) getResourceContent
(String resourceId) Get the content of an existingResource
getResourceFile
(String resourceId) getResourceRevision
(String resourceRevisionId) getResourceRevisionContent
(String resourceRevisionId) protected File
getResourceRevisionFile
(Resource resource, ResourceRevision revision) void
registerResourceType
(String name, ResourceType resourceType) 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)
-
Field Details
-
resourceRootFolder
-
resourceAccessor
-
resourceRevisionAccessor
-
resourceTypes
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
ResourceManagerImpl
public ResourceManagerImpl(File resourceRootFolder, ResourceAccessor resourceAccessor, ResourceRevisionAccessor resourceRevisionAccessor)
-
-
Method Details
-
registerResourceType
-
createResourceContainer
public ResourceRevisionContainer createResourceContainer(String resourceType, String resourceFileName) throws IOException - Specified by:
createResourceContainer
in interfaceResourceManager
- Throws:
IOException
-
createResource
public Resource createResource(String resourceType, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) throws IOException, SimilarResourceExistingException, InvalidResourceFormatException - 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 existInvalidResourceFormatException
-
createResource
public Resource createResource(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) throws IOException, SimilarResourceExistingException, InvalidResourceFormatException - Specified by:
createResource
in interfaceResourceManager
- Throws:
IOException
SimilarResourceExistingException
InvalidResourceFormatException
-
createResource
public Resource createResource(String resourceType, boolean isDirectory, InputStream resourceStream, String resourceFileName, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher, String trackingAttribute) throws IOException, SimilarResourceExistingException, InvalidResourceFormatException - Specified by:
createResource
in interfaceResourceManager
- Throws:
IOException
SimilarResourceExistingException
InvalidResourceFormatException
-
closeResourceContainer
protected void closeResourceContainer(Resource resource, ResourceRevision resourceRevision, boolean checkForDuplicates, step.core.objectenricher.ObjectEnricher objectEnricher) throws IOException, SimilarResourceExistingException, InvalidResourceFormatException -
saveResourceContent
public Resource saveResourceContent(String resourceId, InputStream resourceStream, String resourceFileName) throws IOException, InvalidResourceFormatException 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 callInvalidResourceFormatException
-
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
-
closeResourceRevisionContent
-
getResourceRevisionContent
public ResourceRevisionContentImpl getResourceRevisionContent(String resourceRevisionId) throws IOException - Specified by:
getResourceRevisionContent
in interfaceResourceManager
- Throws:
IOException
-
getResourceFile
- Specified by:
getResourceFile
in interfaceResourceManager
-
getResource
- Specified by:
getResource
in interfaceResourceManager
-
getResourceRevision
- Specified by:
getResourceRevision
in interfaceResourceManager
-
getResourceRevisionFile
-
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
-
saveResourceRevision
- Specified by:
saveResourceRevision
in interfaceResourceManager
- Throws:
IOException
-
getResourcesRootPath
- Specified by:
getResourcesRootPath
in interfaceResourceManager
-