Class ObfuscationResourcePropertiesBuilderDecorator

java.lang.Object
org.refcodes.properties.AbstractPropertiesDecorator<T>
org.refcodes.properties.AbstractPropertiesBuilderDecorator<T>
org.refcodes.properties.AbstractResourcePropertiesBuilderDecorator<org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder>
org.refcodes.properties.ext.obfuscation.AbstractObfuscationResourcePropertiesBuilderDecorator
org.refcodes.properties.ext.obfuscation.ObfuscationResourcePropertiesBuilderDecorator
All Implemented Interfaces:
Flushable, Map<String,String>, org.refcodes.component.Flushable, org.refcodes.component.Flushable.FlushBuilder<org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder>, org.refcodes.mixin.AnnotatorAccessor, org.refcodes.mixin.Clearable, org.refcodes.mixin.DecryptPrefixAccessor, org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixBuilder<ObfuscationProperties.ObfuscationPropertiesBuilder>, org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixMutator, org.refcodes.mixin.DecryptPrefixAccessor.DecryptPrefixProperty, org.refcodes.mixin.DelimiterAccessor, org.refcodes.mixin.Dumpable, org.refcodes.mixin.EmptyAccessor, org.refcodes.mixin.EncryptPrefixAccessor, org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixBuilder<ObfuscationProperties.ObfuscationPropertiesBuilder>, org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixMutator, org.refcodes.mixin.EncryptPrefixAccessor.EncryptPrefixProperty, org.refcodes.mixin.TypeAccessor<String>, ObfuscationProperties, ObfuscationProperties.MutableObfuscationProperties, ObfuscationProperties.ObfuscationPropertiesBuilder, ObfuscationResourceProperties, ObfuscationResourceProperties.MutableObfuscationResourceProperties, ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder, org.refcodes.properties.Properties, org.refcodes.properties.Properties.MutableProperties, org.refcodes.properties.Properties.PropertiesBuilder, org.refcodes.properties.ResourceProperties, org.refcodes.properties.ResourceProperties.MutableResoureProperties, org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder, org.refcodes.struct.CanonicalMap, org.refcodes.struct.CanonicalMap.CanonicalMapBuilder, org.refcodes.struct.CanonicalMap.MutableCanonicalMap, org.refcodes.struct.Containable, org.refcodes.struct.Dictionary<String,String>, org.refcodes.struct.Dictionary.MutableDictionary<String,String>, org.refcodes.struct.Dictionary.MutableDictionary.DictionaryBuilder<String,String,org.refcodes.struct.PathMap.PathMapBuilder<String>>, org.refcodes.struct.InterOperableMap<String>, org.refcodes.struct.InterOperableMap.InterOperableMapBuilder<String>, org.refcodes.struct.InterOperableMap.MutableInterOperableMap<String>, org.refcodes.struct.Keys<String,String>, org.refcodes.struct.Keys.MutableKeys<String,String>, org.refcodes.struct.Keys.MutableValues<String,String>, org.refcodes.struct.PathMap<String>, org.refcodes.struct.PathMap.MutablePathMap<String>, org.refcodes.struct.PathMap.PathMapBuilder<String>

The ObfuscationResourcePropertiesBuilderDecorator represents a decorator for ResourceProperties.ResourcePropertiesBuilder instances by implementing the ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder 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 AbstractObfuscationResourcePropertiesBuilderDecorator.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 or the according methods. Properties marked in the resource as "to be encrypted" by being prefixed with "encrypt:" (default) are encrypted (e.g. with a host individual key) when being added and instead are prefixed with "decrypt:" (default). Retrieving a value via AbstractObfuscationResourcePropertiesBuilderDecorator.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. If the encapsulated ResourceProperties.ResourcePropertiesBuilder instance can be flushed as of Flushable.isFlushable(), then any properties which have been encrypted as of the "encrypt:" prefix (default) upon instantiation are written back to the resource, though this time encrypted, having now the prefix "decrypt:" (default). By public (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()) constructor or the according methods.
  • Constructor Details

    • ObfuscationResourcePropertiesBuilderDecorator

      public ObfuscationResourcePropertiesBuilderDecorator(org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder aProperties) throws IOException
      Decorates the provided ResourceProperties.ResourcePropertiesBuilder with additional ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder behavior or functionality. Changes applied to the provided ResourceProperties.ResourcePropertiesBuilder affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
      Parameters:
      aProperties - The ResourceProperties.ResourcePropertiesBuilder to be decorated.
      Throws:
      IOException - Thrown in case opening the resources for writing back encrypted properties failed.
    • ObfuscationResourcePropertiesBuilderDecorator

      public ObfuscationResourcePropertiesBuilderDecorator(org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder aProperties, String aSecret) throws IOException
      Decorates the provided ResourceProperties.ResourcePropertiesBuilder with additional ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder behavior or functionality. Changes applied to the provided ResourceProperties.ResourcePropertiesBuilder affect the decorator. The given secret is used to encrypt and decrypt the according properties.
      Parameters:
      aProperties - The ResourceProperties to be decorated.
      aSecret - The secret to use when encrypting and decrypting the according properties.
      Throws:
      IOException - Thrown in case opening the resources for writing back encrypted properties failed.
    • ObfuscationResourcePropertiesBuilderDecorator

      public ObfuscationResourcePropertiesBuilderDecorator(org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder aProperties, String aDecryptPrefix, String aEncryptPrefix) throws IOException
      Decorates the provided ResourceProperties.ResourcePropertiesBuilder with additional ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder behavior or functionality. Changes applied to the provided ResourceProperties.ResourcePropertiesBuilder affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
      Parameters:
      aProperties - The ResourceProperties.ResourcePropertiesBuilder 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:".
      Throws:
      IOException - Thrown in case opening the resources for writing back encrypted properties failed.
    • ObfuscationResourcePropertiesBuilderDecorator

      public ObfuscationResourcePropertiesBuilderDecorator(org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder aProperties, String aDecryptPrefix, String aEncryptPrefix, String aSecret) throws IOException
      Decorates the provided ResourceProperties.ResourcePropertiesBuilder with additional ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder behavior or functionality. Changes applied to the provided ResourceProperties.ResourcePropertiesBuilder affect the decorator. The given secret is used to encrypt and decrypt the according properties.
      Parameters:
      aProperties - The ResourceProperties 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.
      Throws:
      IOException - Thrown in case opening the resources for writing back encrypted properties failed.
    • ObfuscationResourcePropertiesBuilderDecorator

      public ObfuscationResourcePropertiesBuilderDecorator(org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder aProperties, String aDecryptPrefix, String aEncryptPrefix, org.refcodes.runtime.SystemContext aObfuscationMode) throws IOException
      Decorates the provided ResourceProperties.ResourcePropertiesBuilder with additional ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder behavior or functionality. Changes applied to the provided ResourceProperties affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
      Parameters:
      aProperties - The ResourceProperties.ResourcePropertiesBuilder 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.
      Throws:
      IOException - Thrown in case opening the resources for writing back encrypted properties failed.
    • ObfuscationResourcePropertiesBuilderDecorator

      public ObfuscationResourcePropertiesBuilderDecorator(org.refcodes.properties.ResourceProperties.ResourcePropertiesBuilder aProperties, org.refcodes.runtime.SystemContext aObfuscationMode) throws IOException
      Decorates the provided ResourceProperties.ResourcePropertiesBuilder with additional ObfuscationResourceProperties.ObfuscationResourcePropertiesBuilder behavior or functionality. Changes applied to the provided ResourceProperties affect the decorator. A host specific secret is used to encrypt and decrypt the according properties.
      Parameters:
      aProperties - The ResourceProperties.ResourcePropertiesBuilder 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.
      Throws:
      IOException - Thrown in case opening the resources for writing back encrypted properties failed.
  • Method Details