Package jadex.base
Class PlatformConfigurationHandler
- java.lang.Object
-
- jadex.base.PlatformConfigurationHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class PlatformConfigurationHandler extends java.lang.Object implements java.lang.reflect.InvocationHandlerPlatform configuration handler is a proxy handler that implements the logic for the configuration interfaces.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.String,java.lang.Object>defvaluesThe default values.static java.util.Map<java.lang.String,java.lang.String>namemappingsUsed for mapping method names to property names (if they differ).protected booleanreadonlyReadonly flag.protected java.util.Map<java.lang.String,java.lang.Object>valuesThe map of values.
-
Constructor Summary
Constructors Constructor Description PlatformConfigurationHandler()Create a new handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IPlatformConfigurationaddInternetComm(IPlatformConfiguration config)Add global (internet) communication settings to configuration.static IPlatformConfigurationaddIntranetComm(IPlatformConfiguration config)Add local (intranet) communication settings to configuration.protected voidcheckReadOnly()Check the readonly state.static IPlatformConfigurationgetAndroidDefault()Returns a PlatformConfiguration with the default parameters.static java.lang.ObjectgetArgumentValueFromModel(java.lang.String name, IModelInfo model)static ConfigurationInfogetConfigurationInfo(java.lang.String configname, IModelInfo model)Get the configuration name.java.lang.StringgetConfigurationName()static IPlatformConfigurationgetDefault()Returns a PlatformConfiguration with the default parameters.static IPlatformConfigurationgetDefaultNoGui()Returns a PlatformConfiguration with the default parameters but without gui.protected java.lang.StringgetKeyForMethodname(java.lang.String mname, int prefixlen)Get the key for a method name.static IPlatformConfigurationgetMinimal()Returns a minimal platform configuration without any network connectivity.static IPlatformConfigurationgetMinimalComm()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.protected IModelInfogetModel()static IPlatformConfigurationgetPlatformConfiguration()Get the default platform configuration.static IPlatformConfigurationgetPlatformConfiguration(java.lang.ClassLoader cl)Get the default platform configuration.static IPlatformConfigurationgetPlatformConfiguration(java.lang.ClassLoader cl, PlatformConfigurationHandler h)Get the default platform configuration.protected java.lang.ObjectgetValue(java.lang.String key, IModelInfo model)Generic getter for configuration parameters.java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)Called on method invocation.voidparseArg(IPlatformConfiguration config, java.lang.String key, java.lang.String strval, java.lang.Object value)Parse an argument.
-
-
-
Field Detail
-
readonly
protected boolean readonly
Readonly flag.
-
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.
-
-
Method Detail
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.ThrowableCalled on method invocation.- Specified by:
invokein interfacejava.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.
-
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:
-
getModel
protected IModelInfo getModel()
-
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.
-
-