Class ResourceManagerImpl

    • Field Detail

      • resourceRootFolder

        protected final java.io.File resourceRootFolder
      • resourceTypes

        protected final java.util.Map<java.lang.String,​step.resources.ResourceType> resourceTypes
      • logger

        protected static final org.slf4j.Logger logger
    • Method Detail

      • registerResourceType

        public void registerResourceType​(java.lang.String name,
                                         step.resources.ResourceType resourceType)
      • createResource

        public step.resources.Resource createResource​(java.lang.String resourceType,
                                                      java.io.InputStream resourceStream,
                                                      java.lang.String resourceFileName,
                                                      boolean checkForDuplicates,
                                                      ObjectEnricher objectEnricher)
                                               throws java.io.IOException,
                                                      SimilarResourceExistingException
        Specified by:
        createResource in interface ResourceManager
        Parameters:
        resourceType - the type of the resource
        resourceStream - the stream of the resource to be saved
        resourceFileName - the name of the resource (filename)
        checkForDuplicates - is duplicate should be checked
        objectEnricher - the ObjectEnricher of the context
        Returns:
        the created Resource
        Throws:
        java.io.IOException - an IOException occurs during the call
        SimilarResourceExistingException - a similar resource exist
      • saveResourceContent

        public step.resources.Resource saveResourceContent​(java.lang.String resourceId,
                                                           java.io.InputStream resourceStream,
                                                           java.lang.String resourceFileName)
                                                    throws java.io.IOException
        Description copied from interface: ResourceManager
        Save the content provided as stream to an existing resource. This creates a new ResourceRevision for the Resource and saves the content provided as stream under this revision.
        Specified by:
        saveResourceContent in interface ResourceManager
        Parameters:
        resourceId - the id of the resource to be updated
        resourceStream - the stream of the resource to be saved
        resourceFileName - the name of the resource (filename)
        Returns:
        the updated Resource
        Throws:
        java.io.IOException - an IOException occurs during the call
      • updateResourceContent

        public step.resources.Resource updateResourceContent​(step.resources.Resource resource,
                                                             java.io.InputStream resourceStream,
                                                             java.lang.String resourceFileName,
                                                             step.resources.ResourceRevision revision)
                                                      throws java.io.IOException
        Specified by:
        updateResourceContent in interface ResourceManager
        Throws:
        java.io.IOException
      • deleteResource

        public void deleteResource​(java.lang.String resourceId)
        Description copied from interface: ResourceManager
        Delete the resource and all its revisions
        Specified by:
        deleteResource in interface ResourceManager
        Parameters:
        resourceId - the id of the Resource to be deleted
      • getResourceContent

        public ResourceRevisionContent getResourceContent​(java.lang.String resourceId)
                                                   throws java.io.IOException
        Description copied from interface: ResourceManager
        Get the content of an existing Resource
        Specified by:
        getResourceContent in interface ResourceManager
        Parameters:
        resourceId - the id of the Resource to be deleted
        Returns:
        the content of the resource as stream
        Throws:
        java.io.IOException - an IOException occurs during the call
      • closeResourceRevisionContent

        protected void closeResourceRevisionContent​(step.resources.Resource resource)
      • getResource

        public step.resources.Resource getResource​(java.lang.String resourceId)
        Specified by:
        getResource in interface ResourceManager
      • lookupResourceByName

        public step.resources.Resource lookupResourceByName​(java.lang.String resourceName)
        Specified by:
        lookupResourceByName in interface ResourceManager
      • resourceExists

        public boolean resourceExists​(java.lang.String resourceId)
        Description copied from interface: ResourceManager
        Test if a given resource id exists
        Specified by:
        resourceExists in interface ResourceManager
        Parameters:
        resourceId - the id of the resource to test
        Returns:
        true if the resource exists
      • saveResource

        public step.resources.Resource saveResource​(step.resources.Resource resource)
                                             throws java.io.IOException
        Description copied from interface: ResourceManager
        Saved the resource object only
        Specified by:
        saveResource in interface ResourceManager
        Parameters:
        resource - the resource to be saved
        Returns:
        the updated Resource
        Throws:
        java.io.IOException - an IOException occurs during the call
      • saveResourceRevision

        public step.resources.ResourceRevision saveResourceRevision​(step.resources.ResourceRevision resourceRevision)
                                                             throws java.io.IOException
        Specified by:
        saveResourceRevision in interface ResourceManager
        Throws:
        java.io.IOException