Class ObfuscationPropertiesDecorator

  • All Implemented Interfaces:
    ObfuscationProperties, org.refcodes.configuration.Properties, org.refcodes.mixin.DecryptPrefixAccessor, org.refcodes.mixin.DelimiterAccessor, org.refcodes.mixin.Dumpable, org.refcodes.mixin.EncryptPrefixAccessor, org.refcodes.mixin.TypeAccessor<java.lang.String>, org.refcodes.structure.CanonicalMap, org.refcodes.structure.Containable, org.refcodes.structure.Dictionary<java.lang.String,T>, org.refcodes.structure.Keys<java.lang.String,T>, org.refcodes.structure.PathMap<java.lang.String>, org.refcodes.structure.PropertiesAccessorMixin


    public class ObfuscationPropertiesDecorator
    extends AbstractObfuscationPropertiesDecorator
    implements ObfuscationProperties
    The ObfuscationPropertiesDecorator represents a decorator for Properties instances by implementing the ObfuscationProperties interface. Properties marked in the resource as "to be decrypted" are decrypted (e.g. with a host individual key). Those encrypted properties are decrypted "on-the-fly" (in memory only) upon accessing the according property. Retrieving a value via AbstractObfuscationPropertiesDecorator.get(Object) (or the like), which is prefixed with "decrypt:" (default), will be decrypted accordingly before passed back to the caller. The prefix may be changed by invoking the according implementaion's constructor. Properties marked in the resource as "to be encrypted" are not modified and returned without the prefix when being queried via AbstractObfuscationPropertiesDecorator.get(Object) (or the like), as the Properties are immutable. By default (if not configured otherwise) the prefix Prefix.DECRYPT is used as decrypt prefix (as of Prefix.getPrefix()). Also by default (if not configured otherwise) the prefix Prefix.ENCRYPT is used as encrypt prefix (as of Prefix.getPrefix()).
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.structure.CanonicalMap

        org.refcodes.structure.CanonicalMap.CanonicalMapBuilder, org.refcodes.structure.CanonicalMap.MutableCanonicalMap
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.DecryptPrefixAccessor

        org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixBuilder<B extends org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixBuilder<B>>, org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixMutator, org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor

        org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
      • Nested classes/interfaces inherited from interface org.refcodes.structure.Dictionary

        org.refcodes.structure.Dictionary.MutableDictionary<K extends java.lang.Object,V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.EncryptPrefixAccessor

        org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixBuilder<B extends org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixBuilder<B>>, org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixMutator, org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixProperty
      • Nested classes/interfaces inherited from interface org.refcodes.structure.Keys

        org.refcodes.structure.Keys.MutableKeys<K extends java.lang.Object,V extends java.lang.Object>, org.refcodes.structure.Keys.MutableValues<K extends java.lang.Object,V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface org.refcodes.structure.PathMap

        org.refcodes.structure.PathMap.MutablePathMap<T extends java.lang.Object>, org.refcodes.structure.PathMap.PathMapBuilder<T extends java.lang.Object>
      • Nested classes/interfaces inherited from interface org.refcodes.configuration.Properties

        org.refcodes.configuration.Properties.MutableProperties, org.refcodes.configuration.Properties.PropertiesBuilder
      • Nested classes/interfaces inherited from interface org.refcodes.structure.PropertiesAccessorMixin

        org.refcodes.structure.PropertiesAccessorMixin.PropertiesBuilderMixin<T extends java.lang.Object>, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMixin, org.refcodes.structure.PropertiesAccessorMixin.PropertiesMutatorMixin
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor

        org.refcodes.mixin.TypeAccessor.TypeMutator<T extends java.lang.Object>, org.refcodes.mixin.TypeAccessor.TypeProperty<T extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties)
      Decorates the provided Properties with additional ObfuscationProperties behavior or functionality.
      ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties, java.lang.String aSecret)
      Decorates the provided Properties with additional ObfuscationProperties behavior or functionality.
      ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties, java.lang.String aDecryptPrefix, java.lang.String aEncryptPrefix)
      Decorates the provided Properties with additional ObfuscationProperties behavior or functionality.
      ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties, java.lang.String aDecryptPrefix, java.lang.String aEncryptPrefix, java.lang.String aSecret)
      Decorates the provided Properties with additional ObfuscationProperties behavior or functionality.
      ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties, java.lang.String aDecryptPrefix, java.lang.String aEncryptPrefix, org.refcodes.runtime.SystemContext aObfuscationMode)
      Decorates the provided Properties with additional ObfuscationProperties behavior or functionality.
      ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties, org.refcodes.runtime.SystemContext aObfuscationMode)
      Decorates the provided Properties with additional ObfuscationProperties behavior or functionality.
    • Method Summary

      • Methods inherited from class org.refcodes.configuration.AbstractPropertiesDecorator

        containsKey, getDelimiter, getProperties, isEmpty, keySet, retrieveFrom, retrieveTo, setProperties, size, toDataStructure, values
      • Methods inherited from interface org.refcodes.structure.CanonicalMap

        getBoolean, getBoolean, getBooleanOr, getBooleanOr, getByte, getByte, getByteOr, getByteOr, getCharacter, getCharacter, getCharacterOr, getCharacterOr, getDouble, getDouble, getDoubleOr, getDoubleOr, getFloat, getFloat, getFloatOr, getFloatOr, getInteger, getInteger, getIntegerOr, getIntegerOr, getLong, getLong, getLongOr, getLongOr, getShort, getShort, getShortOr, getShortOr, toInstance, toInstance, toMap, toProperties, toType, toType
      • Methods inherited from interface org.refcodes.structure.Containable

        isEmpty, size
      • Methods inherited from interface org.refcodes.mixin.DecryptPrefixAccessor

        getDecryptPrefix
      • Methods inherited from interface org.refcodes.mixin.Dumpable

        toDump, toDump, toPrintable
      • Methods inherited from interface org.refcodes.mixin.EncryptPrefixAccessor

        getEncryptPrefix
      • Methods inherited from interface org.refcodes.structure.Keys

        containsKey, get, getOr, keySet, use, values
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.refcodes.structure.PathMap

        children, children, children, children, children, children, containsKey, containsKey, containsKey, dirs, dirs, dirs, dirs, dirs, dirs, findPaths, fromExternalPath, get, get, get, getArray, getArray, getArray, getArray, getArray, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getDirAt, getDirAt, getDirAt, getDirAt, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getRootPath, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, hasChildren, hasChildren, hasChildren, hasChildren, hasChildren, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasParentPath, hasPath, hasPath, hasPath, hasPath, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, isArray, isArray, isArray, isArray, isArray, isArray, isArrayIndex, isArrayIndex, isArrayIndex, isArrayIndex, isArrayIndex, isArrayIndex, isChild, isChild, isChild, isChild, isDir, isDir, isDir, isDir, isDir, isDirIndex, isDirIndex, isDirIndex, isDirIndex, isDirIndex, isLeaf, isLeaf, isLeaf, isLeaf, isLeaf, isRootPath, keySet, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, leaves, leaves, leaves, leaves, leaves, leaves, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, paths, paths, paths, paths, paths, paths, queryPaths, queryPaths, queryPaths, queryPaths, queryPaths, sortedKeys, toDataStructure, toDataStructure, toExternalPath, toLeaf, toMap, toNormalizedPath, toParentPath, toPath, toPath, toPath, toPathElements, toPathList, toPathStack, toPropertyPath
      • Methods inherited from interface org.refcodes.configuration.Properties

        containsValue, getDelimiter, getDirAt, getDirAt, getType, query, query, query, query, queryBetween, queryBetween, queryBetween, queryBetween, queryBetween, queryFrom, queryFrom, queryFrom, queryFrom, queryFrom, queryTo, queryTo, queryTo, queryTo, queryTo, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveFrom, retrieveFrom, retrieveFrom, retrieveFrom, retrieveFrom, retrieveTo, retrieveTo, retrieveTo, retrieveTo, retrieveTo
      • Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin

        asArray, asArray, asArray, asArray, asBooleanArray, asBooleanArray, asBooleanArray, asBooleanArray, asByteArray, asByteArray, asByteArray, asByteArray, asCharacterArray, asCharacterArray, asCharacterArray, asCharacterArray, asDoubleArray, asDoubleArray, asDoubleArray, asDoubleArray, asFloatArray, asFloatArray, asFloatArray, asFloatArray, asIntegerArray, asIntegerArray, asIntegerArray, asIntegerArray, asLongArray, asLongArray, asLongArray, asLongArray, asShortArray, asShortArray, asShortArray, asShortArray, getBoolean, getBoolean, getBooleanOr, getBooleanOr, getByte, getByte, getByteOr, getByteOr, getCharacter, getCharacter, getCharacterOr, getCharacterOr, getDouble, getDouble, getDoubleOr, getDoubleOr, getFloat, getFloat, getFloatOr, getFloatOr, getInteger, getInteger, getIntegerOr, getIntegerOr, getLong, getLong, getLongOr, getLongOr, getShort, getShort, getShortOr, getShortOr
    • Constructor Detail

      • ObfuscationPropertiesDecorator

        public ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties)
        Decorates the provided Properties with additional ObfuscationProperties behavior or functionality. Changes applied to the provided Properties affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
        Parameters:
        aProperties - The Properties to be decorated.
      • ObfuscationPropertiesDecorator

        public ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties,
                                              java.lang.String aDecryptPrefix,
                                              java.lang.String aEncryptPrefix)
        Decorates the provided Properties with additional ObfuscationProperties behavior or functionality. Changes applied to the provided Properties affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
        Parameters:
        aProperties - The Properties to be decorated.
        aDecryptPrefix - The decrypt prefix to be used for values which are to be decrypted, e.g. "decrypt:".
        aEncryptPrefix - The decrypt prefix to be used. for values which are to be encrypted, e.g. "encrypt:".
      • ObfuscationPropertiesDecorator

        public ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties,
                                              java.lang.String aDecryptPrefix,
                                              java.lang.String aEncryptPrefix,
                                              org.refcodes.runtime.SystemContext aObfuscationMode)
        Decorates the provided Properties with additional ObfuscationProperties behavior or functionality. Changes applied to the provided Properties affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
        Parameters:
        aProperties - The Properties to be decorated.
        aDecryptPrefix - The decrypt prefix to be used for values which are to be decrypted, e.g. "decrypt:".
        aEncryptPrefix - The decrypt prefix to be used. for values which are to be encrypted, e.g. "encrypt:".
        aObfuscationMode - The SystemContext specifies which level of obfuscation is to be used when encountering upon obfuscated properties: E.g. obfuscation may be bound to the host, the "secret" used for obfuscation being the same for all applications on the same host or obfuscation may be bound to the application, being different for different applications on the same host.
      • ObfuscationPropertiesDecorator

        public ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties,
                                              java.lang.String aDecryptPrefix,
                                              java.lang.String aEncryptPrefix,
                                              java.lang.String aSecret)
        Decorates the provided Properties with additional ObfuscationProperties behavior or functionality. Changes applied to the provided Properties affect the decorator. The given secret is used to encrypt and decrypt the according properties.
        Parameters:
        aProperties - The Properties to be decorated.
        aDecryptPrefix - The decrypt prefix to be used for values which are to be decrypted, e.g. "decrypt:".
        aEncryptPrefix - The decrypt prefix to be used. for values which are to be encrypted, e.g. "encrypt:".
        aSecret - The secret to use when encrypting and decrypting the according properties.
      • ObfuscationPropertiesDecorator

        public ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties,
                                              org.refcodes.runtime.SystemContext aObfuscationMode)
        Decorates the provided Properties with additional ObfuscationProperties behavior or functionality. Changes applied to the provided Properties affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
        Parameters:
        aProperties - The Properties to be decorated.
        aObfuscationMode - The SystemContext specifies which level of obfuscation is to be used when encountering upon obfuscated properties: E.g. obfuscation may be bound to the host, the "secret" used for obfuscation being the same for all applications on the same host or obfuscation may be bound to the application, being different for different applications on the same host.
      • ObfuscationPropertiesDecorator

        public ObfuscationPropertiesDecorator​(org.refcodes.configuration.Properties aProperties,
                                              java.lang.String aSecret)
        Decorates the provided Properties with additional ObfuscationProperties behavior or functionality. Changes applied to the provided Properties affect the decorator. The given secret is used to encrypt and decrypt the according properties.
        Parameters:
        aProperties - The Properties to be decorated.
        aSecret - The secret to use when encrypting and decrypting the according properties.