Package jadex.micro

Class KernelMultiAgent

    • Field Detail

      • KERNEL_EXTENSIONS

        protected static final java.lang.String KERNEL_EXTENSIONS
        Kernel model property for extensions
        See Also:
        Constant Field Values
      • ffilter

        protected static FileFilter ffilter
        Filter for scanning for kernel agent class files.
      • iconcache

        protected java.util.Map<java.lang.String,​byte[]> iconcache
        Cache of component icons
      • componenttypes

        protected java.util.Set<java.lang.String> componenttypes
        Currently supported types (loadable suffixes)
      • kernelfiles

        protected java.util.Map<java.lang.String,​java.util.Collection<Tuple2<java.lang.String,​java.util.Set<java.lang.String>>>> kernelfiles
        The scanned kernel files (suffix -> {(classname, suffixes)} ).
      • kernels

        protected java.util.Map<java.lang.String,​java.lang.Object> kernels
        The started factories (kernel classname -> kernel component).
      • inited

        protected boolean inited
        The started flag (because init is invoked twice, service impl for 2 services.
      • dirty

        protected boolean dirty
        The dirty flag (when classpath changes).
      • known_kernels

        protected java.util.Set<java.lang.String> known_kernels
        The known factories.
      • known_kernels_cache

        protected MultiCollection<java.lang.String,​Tuple2<java.lang.String,​java.util.Set<java.lang.String>>> known_kernels_cache
      • props

        public static final java.util.Map<java.lang.String,​java.lang.Object> props
        Used in SComponentFactory to reorder checks (multi last). Still necessary?!.
      • cnt

        protected int cnt
        Test if a model can be loaded by the factory.
    • Constructor Detail

      • KernelMultiAgent

        public KernelMultiAgent()
    • Method Detail

      • startService

        public IFuture<java.lang.Void> startService()
        Starts the service.
      • loadModel

        public IFuture<IModelInfo> loadModel​(java.lang.String model,
                                             java.lang.String[] imports,
                                             IResourceIdentifier rid)
        Load a model.
        Specified by:
        loadModel in interface IComponentFactory
        Parameters:
        model - The model (e.g. file name or resource name).
        The - imports (if any).
        Returns:
        The loaded model.
      • getFactoryForModel

        protected IFuture<IComponentFactory> getFactoryForModel​(java.lang.String model,
                                                                java.lang.String[] imports,
                                                                IResourceIdentifier rid)
        Get a factory for a model. 1) will check running factories 2) if none was found will check if a new can be started
        Returns:
        A factory that can load the model (or null if none was found).
      • getNewFactory

        protected IFuture<IComponentFactory> getNewFactory​(java.lang.String model,
                                                           java.lang.String[] imports,
                                                           IResourceIdentifier rid)
        If there are other kernel specs for the current filename suffix start and test them. Returns a new factory that can load the model (if any).
      • scanForKernels

        protected java.util.Map<java.lang.String,​java.util.Collection<Tuple2<java.lang.String,​java.util.Set<java.lang.String>>>> scanForKernels()
        Scan files for kernel components.
        Returns:
        (suffix -> classname)
      • check

        protected IFuture<IComponentFactory> check​(java.util.Iterator<Tuple2<java.lang.String,​java.util.Set<java.lang.String>>> it,
                                                   java.lang.String model,
                                                   java.lang.String[] imports,
                                                   IResourceIdentifier rid)
        Check a factory
        Parameters:
        it - factory iterator.
      • doStartKernel

        protected IFuture<IComponentFactory> doStartKernel​(java.lang.String model)
        Parameters:
        model -
        Returns:
      • getKnownKernels

        protected java.util.Map<java.lang.String,​java.util.Collection<Tuple2<java.lang.String,​java.util.Set<java.lang.String>>>> getKnownKernels()
        Get known kernels.
      • getKernelTypes

        protected java.lang.String[] getKernelTypes​(SClassReader.ClassInfo ci)
        Add infos about a kernel to the map.
      • getKernelFiles

        protected java.util.Map<java.lang.String,​java.util.Collection<Tuple2<java.lang.String,​java.util.Set<java.lang.String>>>> getKernelFiles()
        Get all kernel files, i.e. specs to start a kernel.
      • isLoadable

        public IFuture<java.lang.Boolean> isLoadable​(java.lang.String model,
                                                     java.lang.String[] imports,
                                                     IResourceIdentifier rid)
        Description copied from interface: IComponentFactory
        Test if a model can be loaded by the factory.
        Specified by:
        isLoadable in interface IComponentFactory
        Parameters:
        model - The model (e.g. file name or resource name).
        Returns:
        True, if model can be loaded.
      • isStartable

        public IFuture<java.lang.Boolean> isStartable​(java.lang.String model,
                                                      java.lang.String[] imports,
                                                      IResourceIdentifier rid)
        Test if a model is startable (e.g. an component).
        Specified by:
        isStartable in interface IComponentFactory
        Parameters:
        model - The model (e.g. file name or resource name).
        The - imports (if any).
        Returns:
        True, if startable (and loadable).
      • getComponentType

        public IFuture<java.lang.String> getComponentType​(java.lang.String model,
                                                          java.lang.String[] imports,
                                                          IResourceIdentifier rid)
        Get the component type of a model.
        Specified by:
        getComponentType in interface IComponentFactory
        Parameters:
        model - The model (e.g. file name or resource name).
        The - imports (if any).
      • getComponentTypes

        public java.lang.String[] getComponentTypes()
        Get the names of component types supported by this factory.
        Specified by:
        getComponentTypes in interface IComponentFactory
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getProperties​(java.lang.String type)
        Get the properties (name/value pairs). Arbitrary properties that can e.g. be used to define kernel-specific settings to configure tools.
        Specified by:
        getProperties in interface IComponentFactory
        Parameters:
        type - The component type.
        Returns:
        The properties or null, if the component type is not supported by this factory.
      • getSuffixes

        protected java.util.Set<java.lang.String> getSuffixes()
        Get the filename suffixes that can be loaded with any of the found factories.
      • isLoadable

        protected boolean isLoadable​(java.lang.String filename)
        Check if a filename is loadable with respect to the suffixes.
      • fireTypesAdded

        public void fireTypesAdded​(java.lang.String[] types)
        Fires a types added event.
        Parameters:
        types - The types added.
      • fireTypesRemoved

        public void fireTypesRemoved​(java.lang.String[] types)
        Fires a types removed event.
        Parameters:
        types - The types removed.
      • getFactories

        protected java.util.Collection<IComponentFactory> getFactories()
        Get all subfactories except the multi itself.