Class XmpFilterBlackWhite

  • All Implemented Interfaces:
    XmpFilter

    @Service
    public class XmpFilterBlackWhite
    extends java.lang.Object
    implements XmpFilter
    The XmpFilter class is used to reduce Extensible Metadata Platform (XMP) properties to a desired subset using various configuration options such as white- and blacklists.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ALLOWLIST  
      static java.lang.String APPLY_ALLOWLIST  
      static java.lang.String APPLY_BLOCKLIST  
      static java.lang.String ApplyBlackList  
      static java.lang.String ApplyWhiteList  
      static java.lang.String BlackList  
      static java.lang.String BLOCKLIST
      CQ-4326783: two more default xmpfilter (xmpMM:Pantry and xmpMM:History) were added to avoid the following two issues 1.
      static java.lang.String WhiteList  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream filter​(java.io.InputStream xmpIS)
      Filter XMP properties from an XML inputstream and return the filtered XML in a new inputstream.
      boolean isActive()  
      void setConfig​(java.util.Dictionary cfg)  
      java.io.InputStream sieve​(java.io.InputStream xmpIS)
      Sieve XMP properties from an XML inputstream and return the properties hold back during filtering in a new XMP document.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • APPLY_ALLOWLIST

        @Property(boolValue=false,
                  label="Apply AllowList to XMP Properties",
                  description="Only let the allowed xmp properties through, applied before any blocklist")
        public static final java.lang.String APPLY_ALLOWLIST
        See Also:
        Constant Field Values
      • ALLOWLIST

        @Property(value="",
                  label="Allowed XML Names for XMP filtering",
                  description="XML Names, such as \'{namespace-uri}name\', \'{namespace-uri}*\', \'prefix:name\' and \'prefix:*\', passed on during XMP filtering. Use \'[>n]\' or \'[<n]\' to limit the values accepted for multi-valued XMP properties. Example: \'history[<100]\' will only let the first 99 values through",
                  cardinality=2147483647)
        public static final java.lang.String ALLOWLIST
        See Also:
        Constant Field Values
      • APPLY_BLOCKLIST

        @Property(boolValue=true,
                  label="Apply Blocklist to XMP Properties",
                  description="Filter out the blocked xmp properties, applied after any allowlisting")
        public static final java.lang.String APPLY_BLOCKLIST
        See Also:
        Constant Field Values
      • BLOCKLIST

        @Property(value={"{http://ns.adobe.com/photoshop/1.0/}DocumentAncestors[>100]","xmpMM:Pantry","xmpMM:History"},
                  label="Blocklisted XML Names for XMP filtering",
                  description="XML Names, such as \'{namespace-uri}name\', \'{namespace-uri}*\', \'prefix:name\' and \'prefix:*\', filtered out during XMP processing. Use \'[>n]\' or \'[<n]\' to limit the values removed for multi-valued XMP properties. Example: \'history[>100]\' discards the 101st and following values.",
                  cardinality=2147483647)
        public static final java.lang.String BLOCKLIST
        CQ-4326783: two more default xmpfilter (xmpMM:Pantry and xmpMM:History) were added to avoid the following two issues 1. a slow UI performance 2. a customer's environment crashed during metadata extraction
        See Also:
        Constant Field Values
    • Constructor Detail

      • XmpFilterBlackWhite

        public XmpFilterBlackWhite()
    • Method Detail

      • setConfig

        public void setConfig​(java.util.Dictionary cfg)
      • isActive

        public boolean isActive()
        Specified by:
        isActive in interface XmpFilter
      • filter

        public java.io.InputStream filter​(java.io.InputStream xmpIS)
                                   throws java.io.IOException
        Description copied from interface: XmpFilter
        Filter XMP properties from an XML inputstream and return the filtered XML in a new inputstream.
        Specified by:
        filter in interface XmpFilter
        Parameters:
        xmpIS - the XML for filtering
        Returns:
        the filtered XML in utf-8 encoding
        Throws:
        java.io.IOException
      • sieve

        public java.io.InputStream sieve​(java.io.InputStream xmpIS)
                                  throws java.io.IOException
        Description copied from interface: XmpFilter
        Sieve XMP properties from an XML inputstream and return the properties hold back during filtering in a new XMP document. Sieving is the opposite of filtering in regard to XMP XMP elements with one exception: sieve will never return partial properties. This means, XmpFilter.filter(InputStream) may return the partial contents of an array XMP property (e.g. the first 10 entries). XmpFilter.sieve(InputStream) will either report the complete array or ignore the property. Example: during ingestion, all but the first entry in xmpMM:History is filtered. The reported metadata contains just this one entry. If this metadata was written back to the document, all existing subsequent xmpMM:History entries would be overwritten and lost. The XmpFilter.sieve(InputStream), called on the original data, will return such a property in full, e.g. the complete xmpMM:History. This allows the caller to merge changes as it desires.
        Specified by:
        sieve in interface XmpFilter
        Parameters:
        xmpIS - the XML for sieving
        Returns:
        the filtered XML in utf-8 encoding
        Throws:
        java.io.IOException