Package jadex.base

Class Starter


  • public class Starter
    extends java.lang.Object
    Starter class for starting the Jadex platform.
    • Field Detail

      • DATA_PARAMETERCOPY

        public static java.lang.String DATA_PARAMETERCOPY
        Flag if copying parameters for local service calls is allowed.
      • DATA_REALTIMETIMEOUT

        public static java.lang.String DATA_REALTIMETIMEOUT
        Flag if local timeouts should be realtime (instead of clock dependent).
      • DATA_SERVICEREGISTRY

        public static java.lang.String DATA_SERVICEREGISTRY
        The local service registry data key.
      • DATA_SERIALIZATIONSERVICES

        public static java.lang.String DATA_SERIALIZATIONSERVICES
        The serialization services for serializing and en/decoding objects including remote reference handling.
      • DATA_TRANSPORTCACHE

        public static java.lang.String DATA_TRANSPORTCACHE
        The transport cache used to .
      • DATA_NETWORKNAMESCACHE

        public static java.lang.String DATA_NETWORKNAMESCACHE
        The used to store the current network names.
      • DATA_CMSSTATE

        public static java.lang.String DATA_CMSSTATE
        The CMS state.
      • DATA_DEFAULT_TIMEOUT

        public static java.lang.String DATA_DEFAULT_TIMEOUT
        Constant for default timeout name.
      • DATA_PLATFORMACCESS

        public static java.lang.String DATA_PLATFORMACCESS
        The bootstrap component factory.
      • DATA_PLATFORMSETTINGS

        public static java.lang.String DATA_PLATFORMSETTINGS
        The platform settings.
      • DATA_BOOTSTRAPFACTORY

        public static java.lang.String DATA_BOOTSTRAPFACTORY
        The bootstrap component factory.
      • DATA_INVOKEDMETHODS

        public static java.lang.String DATA_INVOKEDMETHODS
        The weak set of invoked init, start or shutdown methods - to not invoke twice.
      • platformmem

        protected static final IRwMap<IComponentIdentifier,​IRwMap<java.lang.String,​java.lang.Object>> platformmem
        Global platform data. For each platform stored by
    • Constructor Detail

      • Starter

        public Starter()
    • Method Detail

      • unescape

        protected static java.lang.String unescape​(java.lang.String str)
        Unescape a string.
      • main

        public static void main​(java.lang.String[] args)
        Main for starting the platform (with meaningful fallbacks)
        Parameters:
        args - The arguments.
        Throws:
        java.lang.Exception
      • createPlatform

        public static IFuture<IExternalAccess> createPlatform​(java.util.Map<java.lang.String,​java.lang.String> args)
        Create the platform.
        Parameters:
        args - The command line arguments.
        Returns:
        The external access of the root component.
      • createPlatform

        public static IFuture<IExternalAccess> createPlatform​(java.lang.String... args)
        Create the platform.
        Parameters:
        args - The command line arguments.
        Returns:
        The external access of the root component.
      • createPlatform

        public static IFuture<IExternalAccess> createPlatform()
        Create the platform.
        Returns:
        The external access of the root component.
      • createPlatform

        public static IFuture<IExternalAccess> createPlatform​(IPlatformConfiguration pconfig,
                                                              java.lang.String[] args)
        Create the platform.
        Parameters:
        config - The PlatformConfiguration object.
        Returns:
        The external access of the root component.
      • getBooleanValueWithArgs

        public static boolean getBooleanValueWithArgs​(java.util.Map<java.lang.String,​java.lang.Object> args,
                                                      java.lang.String argname,
                                                      boolean def)
        Get a boolean value from args (otherwise return default value passed as arg).
        Parameters:
        args - The args map.
        argname - The argument name.
        def - The default value.
        Returns:
        The args value.
      • createPlatform

        public static IFuture<IExternalAccess> createPlatform​(IPlatformConfiguration pconfig,
                                                              java.util.Map<java.lang.String,​java.lang.Object> pargs)
        Create the platform.
        Parameters:
        config - The PlatformConfiguration object.
        Returns:
        The external access of the root component.
      • createPlatformIdentifier

        public static IComponentIdentifier createPlatformIdentifier​(java.lang.String pfname)
        Internal method to create a component identifier.
        Parameters:
        pfname - The platform name.
      • startComponents

        protected static IFuture<java.lang.Void> startComponents​(int i,
                                                                 java.util.List<java.lang.String> components,
                                                                 IInternalAccess instance)
        Loop for starting components.
        Parameters:
        i - Number to start.
        components - The list of components.
        instance - The instance.
        Returns:
        True, when done.
      • scheduleRescueStep

        public static void scheduleRescueStep​(IComponentIdentifier cid,
                                              java.lang.Runnable run)
        Schedule a rescue step.
        Parameters:
        cid - The id of a component of the platform.
        run - The runnable to execute.
      • isRescueThread

        public static boolean isRescueThread​(IComponentIdentifier cid)
        Test if the current thread is the rescue thread of the platform.
        Parameters:
        cid - The id of a component of the platform.
        Returns:
        True, if is the rescue thread.
      • shutdownRescueThread

        public static void shutdownRescueThread​(IComponentIdentifier cid)
        Shutdown the rescue thread of a platform.
      • getPlatformValue

        public static java.lang.Object getPlatformValue​(IComponentIdentifier platform,
                                                        java.lang.String key)
        Get a global platform value.
        Parameters:
        platform - The platform name.
        key - The key.
        Returns:
        The value.
      • putPlatformValue

        public static void putPlatformValue​(IComponentIdentifier platform,
                                            java.lang.String key,
                                            java.lang.Object value)
        Get a global platform value.
        Parameters:
        platform - The platform name.
        key - The key.
        value - The value.
      • hasPlatformValue

        public static boolean hasPlatformValue​(IComponentIdentifier platform,
                                               java.lang.String key)
        Get a global platform value.
        Parameters:
        platform - The platform name.
        key - The key.
        Returns:
        The value.
      • removePlatformMemory

        public static void removePlatformMemory​(IComponentIdentifier platform)
        Get a global platform value.
        Parameters:
        platform - The platform name.
      • getDefaultTimeout

        public static long getDefaultTimeout​(IComponentIdentifier platform)
        Get the default timeout.
      • getScaledDefaultTimeout

        public static long getScaledDefaultTimeout​(IComponentIdentifier platform,
                                                   double scale)
        Get the scaled default timeout.
      • setDefaultTimeout

        public static void setDefaultTimeout​(IComponentIdentifier platform,
                                             long timeout)
        Set the default timeout.
      • isRealtimeTimeout

        public static boolean isRealtimeTimeout​(IComponentIdentifier platform)
        Check if the real time timeout flag is set for a platform.
      • isParameterCopy

        public static boolean isParameterCopy​(IComponentIdentifier platform)
        Check if the parameter copy flag is set for a platform.
      • parseArgs

        public static java.util.Map<java.lang.String,​java.lang.Object> parseArgs​(java.lang.String args)
        Create a platform configuration.
        Parameters:
        args - The command line arguments.
        Returns:
        StarterConfiguration
      • parseArgs

        public static java.util.Map<java.lang.String,​java.lang.Object> parseArgs​(java.lang.String[] args)
        Parameters:
        args -
        config -
      • parseArg

        public static void parseArg​(java.lang.String okey,
                                    java.lang.String val,
                                    java.util.Map<java.lang.String,​java.lang.Object> vals)
        Parameters:
        okey -
        val -
        config -
      • createAgent

        public static IFuture<IExternalAccess> createAgent​(java.lang.String filename,
                                                           IComponentFactory cfac,
                                                           IExecutionService es,
                                                           IClockService cs)
        Create an agent based on filename, agent factory and platform services.
        Parameters:
        filename - The model filename.
        es - The execution service.
        cs - The clock service.
        Returns:
        External access of the created agent.
      • isNoPlatformMode

        public static boolean isNoPlatformMode​(IInternalAccess agent)
        Test if agent runs in no platform mode.
        Parameters:
        agent - The agent.
        Returns:
        True, if runs in no platform mode.
      • createServices

        public static Tuple2<IExecutionService,​IClockService> createServices()
        Create the necessary platform service replacements.
        Returns:
        The services (execution and clock).