Package jadex.micro
Class KernelMultiAgent
- java.lang.Object
- 
- jadex.micro.KernelMultiAgent
 
- 
- All Implemented Interfaces:
- IComponentFactory,- IMultiKernelNotifierService
 
 public class KernelMultiAgent extends java.lang.Object implements IComponentFactory, IMultiKernelNotifierService Multi kernel.
- 
- 
Field SummaryFields Modifier and Type Field Description protected IInternalAccessagentThe internal access.protected static IFilter<SClassReader.ClassInfo>cfilterFilter for scanning for kernel agent class infos.protected java.util.Set<java.lang.String>componenttypesCurrently supported types (loadable suffixes)protected booleandirtyThe dirty flag (when classpath changes).protected static FileFilterffilterFilter for scanning for kernel agent class files.protected CallSequentializer<IComponentFactory>getnewfacThe sequentializer to execute getNewFactory() one by one and not interleaved.protected java.util.Map<java.lang.String,byte[]>iconcacheCache of component iconsprotected booleaninitedThe started flag (because init is invoked twice, service impl for 2 services.protected static java.lang.StringKERNEL_EXTENSIONSKernel model property for extensionsprotected java.util.Map<java.lang.String,java.util.Collection<Tuple2<java.lang.String,java.util.Set<java.lang.String>>>>kernelfilesThe scanned kernel files (suffix -> {(classname, suffixes)} ).protected java.util.Map<java.lang.String,IComponentIdentifier>kernelsThe started factories (kernel classname -> kernel component).protected java.util.Set<java.lang.String>known_kernelsThe known factories.protected MultiCollection<java.lang.String,Tuple2<java.lang.String,java.util.Set<java.lang.String>>>known_kernels_cacheprotected ILibraryServicelibserviceprotected java.util.List<IMultiKernelListener>listenersThe listeners.static java.lang.StringMULTIFACTORYstatic java.util.Map<java.lang.String,java.lang.Object>propsUsed in SComponentFactory to reorder checks (multi last).protected IServiceIdentifiersidThe service identifier.
 - 
Constructor SummaryConstructors Constructor Description KernelMultiAgent()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>addKernelListener(IMultiKernelListener listener)Adds a kernel listener.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 factoryvoidfireTypesAdded(java.lang.String[] types)Fires a types added event.voidfireTypesRemoved(java.lang.String[] types)Fires a types removed event.IFuture<java.util.Collection<IComponentFeatureFactory>>getComponentFeatures(IModelInfo model)Get the component features for a model.IFuture<java.lang.String>getComponentType(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid)Get the component type of a model.IFuture<byte[]>getComponentTypeIcon(java.lang.String type)Get a default icon for a component type.java.lang.String[]getComponentTypes()Get the names of component types supported by this factory.protected java.util.Collection<IComponentFactory>getFactories()Get all subfactories except the multi itself.protected IFuture<IComponentFactory>getFactoryForModel(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid, java.util.Iterator<IComponentFactory> it)Get a factory for a model.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.protected java.lang.String[]getKernelTypes(SClassReader.ClassInfo ci)Add infos about a kernel to the map.protected java.util.Map<java.lang.String,java.util.Collection<Tuple2<java.lang.String,java.util.Set<java.lang.String>>>>getKnownKernels()Get known kernels.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.java.util.Map<java.lang.String,java.lang.Object>getProperties(java.lang.String type)Get the properties (name/value pairs).protected IFuture<IComponentFactory>getRunningFactory(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid, java.util.Iterator<IComponentFactory> it)Get a running subfactory.protected java.util.Set<java.lang.String>getSuffixes()Get the filename suffixes that can be loaded with any of the found factories.protected booleanisLoadable(java.lang.String filename)Check if a filename is loadable with respect to the suffixes.IFuture<java.lang.Boolean>isLoadable(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid)Test if a model can be loaded by the factory.IFuture<java.lang.Boolean>isStartable(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid)Test if a model is startable (e.g.IFuture<IModelInfo>loadModel(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid)Load a model.IFuture<java.lang.Void>removeKernelListener(IMultiKernelListener listener)Removes a kernel listener.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.IFuture<java.lang.Void>startService()Starts the service.
 
- 
- 
- 
Field Detail- 
KERNEL_EXTENSIONSprotected static final java.lang.String KERNEL_EXTENSIONS Kernel model property for extensions- See Also:
- Constant Field Values
 
 - 
ffilterprotected static FileFilter ffilter Filter for scanning for kernel agent class files.
 - 
cfilterprotected static IFilter<SClassReader.ClassInfo> cfilter Filter for scanning for kernel agent class infos.
 - 
agentprotected IInternalAccess agent The internal access.
 - 
libserviceprotected ILibraryService libservice 
 - 
listenersprotected java.util.List<IMultiKernelListener> listeners The listeners.
 - 
iconcacheprotected java.util.Map<java.lang.String,byte[]> iconcache Cache of component icons
 - 
sidprotected IServiceIdentifier sid The service identifier.
 - 
componenttypesprotected java.util.Set<java.lang.String> componenttypes Currently supported types (loadable suffixes)
 - 
kernelfilesprotected 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)} ).
 - 
kernelsprotected java.util.Map<java.lang.String,IComponentIdentifier> kernels The started factories (kernel classname -> kernel component).
 - 
initedprotected boolean inited The started flag (because init is invoked twice, service impl for 2 services.
 - 
dirtyprotected boolean dirty The dirty flag (when classpath changes).
 - 
known_kernelsprotected java.util.Set<java.lang.String> known_kernels The known factories.
 - 
known_kernels_cacheprotected MultiCollection<java.lang.String,Tuple2<java.lang.String,java.util.Set<java.lang.String>>> known_kernels_cache 
 - 
MULTIFACTORYpublic static final java.lang.String MULTIFACTORY - See Also:
- Constant Field Values
 
 - 
propspublic static final java.util.Map<java.lang.String,java.lang.Object> props Used in SComponentFactory to reorder checks (multi last). Still necessary?!.
 - 
getnewfacprotected CallSequentializer<IComponentFactory> getnewfac The sequentializer to execute getNewFactory() one by one and not interleaved.
 
- 
 - 
Method Detail- 
startServicepublic IFuture<java.lang.Void> startService() Starts the service.
 - 
getComponentTypeIconpublic IFuture<byte[]> getComponentTypeIcon(java.lang.String type) Get a default icon for a component type.- Specified by:
- getComponentTypeIconin interface- IComponentFactory
 
 - 
loadModelpublic IFuture<IModelInfo> loadModel(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid) Load a model.- Specified by:
- loadModelin interface- IComponentFactory
- Parameters:
- model- The model (e.g. file name or resource name).
- The- imports (if any).
- Returns:
- The loaded model.
 
 - 
getFactoryForModelprotected IFuture<IComponentFactory> getFactoryForModel(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid, java.util.Iterator<IComponentFactory> it) 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).
 
 - 
getNewFactoryprotected 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).
 - 
scanForKernelsprotected 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)
 
 - 
checkprotected 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.
 
 - 
getKnownKernelsprotected java.util.Map<java.lang.String,java.util.Collection<Tuple2<java.lang.String,java.util.Set<java.lang.String>>>> getKnownKernels() Get known kernels.
 - 
getKernelTypesprotected java.lang.String[] getKernelTypes(SClassReader.ClassInfo ci) Add infos about a kernel to the map.
 - 
getKernelFilesprotected 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.
 - 
getRunningFactoryprotected IFuture<IComponentFactory> getRunningFactory(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid, java.util.Iterator<IComponentFactory> it) Get a running subfactory.
 - 
isLoadablepublic IFuture<java.lang.Boolean> isLoadable(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid) Test if a model can be loaded by the factory.- Specified by:
- isLoadablein interface- IComponentFactory
- Parameters:
- model- The model (e.g. file name or resource name).
- The- imports (if any).
- Returns:
- True, if model can be loaded.
 
 - 
isStartablepublic 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:
- isStartablein interface- IComponentFactory
- Parameters:
- model- The model (e.g. file name or resource name).
- The- imports (if any).
- Returns:
- True, if startable (and loadable).
 
 - 
getComponentTypepublic IFuture<java.lang.String> getComponentType(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid) Get the component type of a model.- Specified by:
- getComponentTypein interface- IComponentFactory
- Parameters:
- model- The model (e.g. file name or resource name).
- The- imports (if any).
 
 - 
getComponentTypespublic java.lang.String[] getComponentTypes() Get the names of component types supported by this factory.- Specified by:
- getComponentTypesin interface- IComponentFactory
 
 - 
getPropertiespublic 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:
- getPropertiesin interface- IComponentFactory
- Parameters:
- type- The component type.
- Returns:
- The properties or null, if the component type is not supported by this factory.
 
 - 
getComponentFeaturespublic IFuture<java.util.Collection<IComponentFeatureFactory>> getComponentFeatures(IModelInfo model) Get the component features for a model.- Specified by:
- getComponentFeaturesin interface- IComponentFactory
- Parameters:
- model- The component model.
- Returns:
- The component features.
 
 - 
getSuffixesprotected java.util.Set<java.lang.String> getSuffixes() Get the filename suffixes that can be loaded with any of the found factories.
 - 
isLoadableprotected boolean isLoadable(java.lang.String filename) Check if a filename is loadable with respect to the suffixes.
 - 
addKernelListenerpublic IFuture<java.lang.Void> addKernelListener(IMultiKernelListener listener) Adds a kernel listener.- Specified by:
- addKernelListenerin interface- IMultiKernelNotifierService
- Parameters:
- listener- The listener.
- Returns:
- Null, when done.
 
 - 
removeKernelListenerpublic IFuture<java.lang.Void> removeKernelListener(IMultiKernelListener listener) Removes a kernel listener.- Specified by:
- removeKernelListenerin interface- IMultiKernelNotifierService
- Parameters:
- listener- The listener.
- Returns:
- Null, when done.
 
 - 
fireTypesAddedpublic void fireTypesAdded(java.lang.String[] types) Fires a types added event.- Parameters:
- types- The types added.
 
 - 
fireTypesRemovedpublic void fireTypesRemoved(java.lang.String[] types) Fires a types removed event.- Parameters:
- types- The types removed.
 
 - 
getFactoriesprotected java.util.Collection<IComponentFactory> getFactories() Get all subfactories except the multi itself.
 
- 
 
-