Class AbstractContentTransformer2

    • Constructor Detail

      • AbstractContentTransformer2

        protected AbstractContentTransformer2()
        Deprecated.
        All transformers start with an average transformation time of 0.0 ms, unless there is an Alfresco global property <beanName>.time. May also be set for given combinations of source and target mimetypes.
    • Method Detail

      • setRegistry

        public void setRegistry​(ContentTransformerRegistry registry)
        Deprecated.
        The registry to auto-register with
        Parameters:
        registry - the transformer registry
      • setRegisterTransformer

        public void setRegisterTransformer​(boolean registerTransformer)
        Deprecated.
        Parameters:
        registerTransformer - as been available for selection. If false this indicates that the transformer may only be used as part of another transformer.
      • checkTransformable

        protected void checkTransformable​(org.alfresco.service.cmr.repository.ContentReader reader,
                                          org.alfresco.service.cmr.repository.ContentWriter writer,
                                          TransformationOptions options)
        Deprecated.
        Convenience method to check the transformability of a transformation
        Parameters:
        reader - content reader
        writer - content writer
        options - transformation options
        Throws:
        org.alfresco.error.AlfrescoRuntimeException - if the the transformation isn't supported
      • transformInternal

        protected abstract void transformInternal​(org.alfresco.service.cmr.repository.ContentReader reader,
                                                  org.alfresco.service.cmr.repository.ContentWriter writer,
                                                  TransformationOptions options)
                                           throws java.lang.Exception
        Deprecated.
        Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.
        Parameters:
        reader - the source of the content to transform
        writer - the target to which to write the transformed content
        options - a map of options to use when performing the transformation. The map will never be null.
        Throws:
        java.lang.Exception - exceptions will be handled by this class - subclasses can throw anything
      • transform

        public final void transform​(org.alfresco.service.cmr.repository.ContentReader reader,
                                    org.alfresco.service.cmr.repository.ContentWriter writer,
                                    java.util.Map<java.lang.String,​java.lang.Object> options)
                             throws org.alfresco.service.cmr.repository.ContentIOException
        Deprecated.
        Description copied from interface: ContentTransformer
        Transforms the content provided by the reader and source mimetype to the writer and target mimetype.

        The source and target mimetypes must be available on the ContentAccessor.getMimetype() methods of both the reader and the writer.

        Both reader and writer will be closed after the transformation completes.

        Parameters:
        reader - the source of the content
        writer - the destination of the transformed content
        options - options to pass to the transformer. These are transformer dependent and may be null.
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException - if an IO exception occurs
      • getTransformationTime

        public long getTransformationTime()
        Deprecated.
        Returns:
        Returns the calculated running average of the current transformations
      • getTransformationTime

        public long getTransformationTime​(java.lang.String sourceMimetype,
                                          java.lang.String targetMimetype)
        Deprecated.
        Description copied from interface: ContentTransformer
        Provides an estimate, usually a worst case guess, of how long a transformation will take. Null mimetype values provide the overall value for the transformer.

        This method is used to determine, up front, which of a set of equally reliant transformers will be used for a specific transformation.

        Parameters:
        sourceMimetype - the source mimetype
        targetMimetype - the target mimetype
        Returns:
        Returns the calculated running average of the current transformations
      • recordTime

        protected final void recordTime​(long transformationTime)
        Deprecated.
        use method with mimetypes.
      • recordTime

        protected final void recordTime​(java.lang.String sourceMimetype,
                                        java.lang.String targetMimetype,
                                        long transformationTime)
        Deprecated.
        Records and updates the average transformation time for this transformer.

        Subclasses should call this after every transformation in order to keep the running average of the transformation times up to date.

        This method is thread-safe. The time spent in this method is negligible so the impact will be minor.

        Parameters:
        sourceMimetype - String
        targetMimetype - String
        transformationTime - the time it took to perform the transformation.
      • getExecutorService

        protected java.util.concurrent.ExecutorService getExecutorService()
        Deprecated.
        Gets the ExecutorService to be used for timeout-aware extraction.

        If no ExecutorService has been defined a default of Executors.newCachedThreadPool() is used during AbstractMappingMetadataExtracter.init().

        Returns:
        the defined or default ExecutorService
      • setExecutorService

        public void setExecutorService​(java.util.concurrent.ExecutorService executorService)
        Deprecated.
        Sets the ExecutorService to be used for timeout-aware transformation.
        Parameters:
        executorService - - ExecutorService instance for timeouts
      • setUseTimeoutThread

        public void setUseTimeoutThread​(java.lang.Boolean useTimeoutThread)
        Deprecated.
        Parameters:
        useTimeoutThread - - Boolean value which specifies timeout limiting mechanism for the current transformer
        See Also:
        useTimeoutThread
      • setAdditionalThreadTimout

        public void setAdditionalThreadTimout​(long additionalThreadTimout)
        Deprecated.
      • isTransformationLimitedInternally

        public java.lang.Boolean isTransformationLimitedInternally()
        Deprecated.
      • recordError

        protected final void recordError​(java.lang.String sourceMimetype,
                                         java.lang.String targetMimetype,
                                         long transformationTime)
        Deprecated.
        Records an error and updates the average time as if the transformation took a long time, so that it is less likely to be called again.
        Parameters:
        sourceMimetype - String
        targetMimetype - String
        transformationTime - the time it took to perform the transformation.
      • getRetryTransformOnDifferentMimeType

        public java.lang.Object getRetryTransformOnDifferentMimeType()
        Deprecated.
      • setRetryTransformOnDifferentMimeType

        public void setRetryTransformOnDifferentMimeType​(boolean retryTransformOnDifferentMimeType)
        Deprecated.
      • getStrictMimeTypeCheck

        public boolean getStrictMimeTypeCheck()
        Deprecated.
      • setStrictMimeTypeCheck

        public void setStrictMimeTypeCheck​(boolean strictMimeTypeCheck)
        Deprecated.