Class ConfigurationBuilder


  • public class ConfigurationBuilder
    extends java.lang.Object
    Mutable construction object for new instances of Configuration. Provides defaults for each property if not specified (null) according to the following:
    • executorService - Stay null, none is required and ShrinkWrap will create its own and destroy it when done as needed
    • extensionLoader - A new instance of the service extension loader from shrinkwrap-impl
    Not thread-safe. When done altering properties here, a new configuration may be constructed by calling upon build().
    Version:
    $Revision: $
    • Field Detail

      • log

        private static final java.util.logging.Logger log
        Logger
      • EXTENSION_LOADER_IMPL

        private static final java.lang.String EXTENSION_LOADER_IMPL
        Implementation class name of the default ExtensionLoader to be used
        See Also:
        Constant Field Values
      • extensionLoader

        private ExtensionLoader extensionLoader
        Loader mapping archive types to the appropriate underlying implementation
      • executorService

        private java.util.concurrent.ExecutorService executorService
        ExecutorService used for all asynchronous operations
      • classLoaders

        private java.lang.Iterable<java.lang.ClassLoader> classLoaders
        ClassLoaders used for extension loading, adding resources, etc
    • Constructor Detail

      • ConfigurationBuilder

        public ConfigurationBuilder()
        Creates a new builder initialized to defaults (null) values. Any properties not explicitly provided by the user will be defaulted during build().
    • Method Detail

      • getExtensionLoader

        public ExtensionLoader getExtensionLoader()
        Returns:
        the extensionLoader
      • getExecutorService

        public java.util.concurrent.ExecutorService getExecutorService()
        Returns:
        the executorService
      • getClassLoaders

        public java.lang.Iterable<java.lang.ClassLoader> getClassLoaders()
        Returns:
      • executorService

        public ConfigurationBuilder executorService​(java.util.concurrent.ExecutorService executorService)
        Sets the ExecutorService to be used, returning this instance
        Parameters:
        executorService -
        Returns:
      • classLoaders

        public ConfigurationBuilder classLoaders​(java.lang.Iterable<java.lang.ClassLoader> classLoaders)
        Sets the ClassLoader used in resolving extension implementations by the ExtensionLoader; other tasks requiring a CL by the Archive
        Parameters:
        classLoaders -
        Returns:
      • build

        public Configuration build()
        Builds a new Configuration using the properties contained in this builder. In the case a property has not been specified, it will be defaulted according to the rules set forth in this ConfigurationBuilder's contract.
        Returns:
      • setDefaults

        void setDefaults()
        Sets properties to their default values if they haven't been explicitly provided by the user. If no ClassLoaders are specified, use the TCCL.
      • createDefaultExtensionLoader

        ExtensionLoader createDefaultExtensionLoader()
        Obtains the default ExtensionLoader to be used if none is specified
        Returns: