Package jadex.base

Class PlatformConfigurationHandler

  • All Implemented Interfaces:
    java.lang.reflect.InvocationHandler

    public class PlatformConfigurationHandler
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler
    Platform configuration handler is a proxy handler that implements the logic for the configuration interfaces.
    • Field Detail

      • readonly

        protected boolean readonly
        Readonly flag means that the config has been used to start a platform and is now immutable.
      • values

        protected java.util.Map<java.lang.String,​java.lang.Object> values
        The map of values.
      • namemappings

        public static java.util.Map<java.lang.String,​java.lang.String> namemappings
        Used for mapping method names to property names (if they differ).
      • defvalues

        public static java.util.Map<java.lang.String,​java.lang.Object> defvalues
        The default values.
    • Constructor Detail

      • PlatformConfigurationHandler

        public PlatformConfigurationHandler()
        Create a new handler.
    • Method Detail

      • invoke

        public java.lang.Object invoke​(java.lang.Object proxy,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
        Called on method invocation.
        Specified by:
        invoke in interface java.lang.reflect.InvocationHandler
        Parameters:
        proxy - The proxy.
        method - The method.
        args - The arguments.
        Throws:
        java.lang.Throwable
      • checkReadOnly

        protected void checkReadOnly()
        Check the readonly state.
      • makeImmutable

        protected static void makeImmutable​(IPlatformConfiguration config)
        Check the readonly state.
      • getKeyForMethodname

        protected java.lang.String getKeyForMethodname​(java.lang.String mname,
                                                       int prefixlen)
        Get the key for a method name.
        Parameters:
        mname - The method name.
        prefixlen - The prefix length.
        Returns:
        The key.
      • parseArg

        public void parseArg​(IPlatformConfiguration config,
                             java.lang.String key,
                             java.lang.String strval,
                             java.lang.Object value)
        Parse an argument.
        Parameters:
        key - The key.
        strval - The value.
      • getValue

        protected java.lang.Object getValue​(java.lang.String key,
                                            IModelInfo model)
        Generic getter for configuration parameters. Retrieves values in 3 stages: 1. From given command line arguments. 2. From given model configuration ("auto", "fixed", ...) 3. From model default values. For retrieval from model, setPlatformModel has to be called before.
        Parameters:
        key -
        Returns:
      • getConfigurationInfo

        public static ConfigurationInfo getConfigurationInfo​(java.lang.String configname,
                                                             IModelInfo model)
        Get the configuration name.
      • getConfigurationName

        public java.lang.String getConfigurationName()
      • getArgumentValueFromModel

        public static java.lang.Object getArgumentValueFromModel​(java.lang.String name,
                                                                 IModelInfo model)
        Parameters:
        name -
        Returns:
      • getPlatformConfiguration

        public static IPlatformConfiguration getPlatformConfiguration()
        Get the default platform configuration.
        Returns:
        The default configuration.
      • getPlatformConfiguration

        public static IPlatformConfiguration getPlatformConfiguration​(java.lang.ClassLoader cl)
        Get the default platform configuration.
        Parameters:
        cl - The classloader.
        Returns:
        The default configuration.
      • getPlatformConfiguration

        public static IPlatformConfiguration getPlatformConfiguration​(java.lang.ClassLoader cl,
                                                                      PlatformConfigurationHandler h)
        Get the default platform configuration.
        Parameters:
        cl - The classloader.
        Returns:
        The default configuration.
      • getDefault

        public static IPlatformConfiguration getDefault()
        Returns a PlatformConfiguration with the default parameters.
      • getDefaultNoGui

        public static IPlatformConfiguration getDefaultNoGui()
        Returns a PlatformConfiguration with the default parameters but without gui.
      • getAndroidDefault

        public static IPlatformConfiguration getAndroidDefault()
        Returns a PlatformConfiguration with the default parameters.
      • getMinimal

        public static IPlatformConfiguration getMinimal()
        Returns a minimal platform configuration without any network connectivity.
      • getMinimalComm

        public static IPlatformConfiguration getMinimalComm()
        Returns a minimal platform configuration that allows service discovery and platform communication in local (intranet via multicast/tcp) and global (internet via superpeer/relay over websockets) networks.
      • addInternetComm

        public static IPlatformConfiguration addInternetComm​(IPlatformConfiguration config)
        Add global (internet) communication settings to configuration.
        Returns:
        Supplied configuration for builder pattern.
      • addIntranetComm

        public static IPlatformConfiguration addIntranetComm​(IPlatformConfiguration config)
        Add local (intranet) communication settings to configuration.
        Returns:
        Supplied configuration for builder pattern.