Package jadex.microservice
Class MicroserviceFactory
- java.lang.Object
-
- jadex.bridge.service.BasicService
-
- jadex.microservice.MicroserviceFactory
-
- All Implemented Interfaces:
IInternalService
,IService
,IBootstrapFactory
,IComponentFactory
public class MicroserviceFactory extends BasicService implements IComponentFactory, IBootstrapFactory
Factory for creating micro services.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Collection<IComponentFeatureFactory>
features
The standard + micro component features.static java.lang.String
FILETYPE_MICROSERVICE
The micro agent file type.static java.lang.String[]
FILETYPES
The supported component types (file extensions).protected java.util.Map<java.lang.String,java.lang.Object>
fproperties
The properties.protected static LazyResource
ICON
The image icon.protected ILibraryServiceListener
libservicelistener
The library service listenerprotected MicroserviceModelLoader
loader
The model loader.protected IInternalAccess
provider
The platform.-
Fields inherited from class jadex.bridge.service.BasicService
idcnt, impltype, internalaccess, providerid, shutdowned, sid, started, type
-
Fields inherited from interface jadex.bridge.service.IService
EMPTY_SERVICES
-
-
Constructor Summary
Constructors Constructor Description MicroserviceFactory(IInternalAccess provider, java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new agent factory.MicroserviceFactory(java.lang.String providerid)
Create a new agent factory for startup.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 file type.java.lang.String[]
getComponentTypes()
Get the names of ADF file types supported by this factory.protected ILibraryService
getLibraryService()
Get the library serviceprotected java.lang.Class<?>
getMicroAgentClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)
Get the mirco agent class.java.util.Map<java.lang.String,java.lang.Object>
getProperties(java.lang.String type)
Get the properties.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>
shutdownService()
Shutdown the service.IFuture<java.lang.Void>
startService(IInternalAccess component, IResourceIdentifier rid)
Start the service.-
Methods inherited from class jadex.bridge.service.BasicService
createServiceIdentifier, createServiceIdentifier, equals, generateServiceName, getInterfaceType, getInternalAccess, getInvokeMethod, getMethodInfos, getMethodTimeout, getPropertyMap, getProviderId, getServiceId, hashCode, initNFProperties, invokeMethod, isValid, setComponentAccess, setPropertyMap, setServiceIdentifier, startService, toString
-
-
-
-
Field Detail
-
FILETYPES
public static final java.lang.String[] FILETYPES
The supported component types (file extensions). Convention used by platform config panel.
-
FILETYPE_MICROSERVICE
public static final java.lang.String FILETYPE_MICROSERVICE
The micro agent file type.- See Also:
- Constant Field Values
-
ICON
protected static final LazyResource ICON
The image icon.
-
loader
protected MicroserviceModelLoader loader
The model loader.
-
provider
protected IInternalAccess provider
The platform.
-
fproperties
protected java.util.Map<java.lang.String,java.lang.Object> fproperties
The properties.
-
libservicelistener
protected ILibraryServiceListener libservicelistener
The library service listener
-
features
protected java.util.Collection<IComponentFeatureFactory> features
The standard + micro component features.
-
-
Constructor Detail
-
MicroserviceFactory
public MicroserviceFactory(IInternalAccess provider, java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new agent factory.
-
MicroserviceFactory
public MicroserviceFactory(java.lang.String providerid)
Create a new agent factory for startup.- Parameters:
platform
- The platform.
-
-
Method Detail
-
startService
public IFuture<java.lang.Void> startService(IInternalAccess component, IResourceIdentifier rid)
Start the service.- Specified by:
startService
in interfaceIBootstrapFactory
- Parameters:
component
- The component.rid
- The resource identifier.
-
shutdownService
public IFuture<java.lang.Void> shutdownService()
Shutdown the service.- Specified by:
shutdownService
in interfaceIInternalService
- Overrides:
shutdownService
in classBasicService
- Parameters:
listener
- The listener.- Returns:
- A future that is done when the service has completed its shutdown.
-
loadModel
public IFuture<IModelInfo> loadModel(java.lang.String model, java.lang.String[] imports, IResourceIdentifier rid)
Load a model.- Specified by:
loadModel
in interfaceIComponentFactory
- Parameters:
model
- The model (e.g. file name).The
- imports (if any).- Returns:
- The loaded model.
-
isLoadable
public 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:
isLoadable
in interfaceIComponentFactory
- Parameters:
model
- The model (e.g. file name).The
- imports (if any).- 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 interfaceIComponentFactory
- Parameters:
model
- The model (e.g. file name).The
- imports (if any).- Returns:
- True, if startable (and loadable).
-
getComponentTypes
public java.lang.String[] getComponentTypes()
Get the names of ADF file types supported by this factory.- Specified by:
getComponentTypes
in interfaceIComponentFactory
-
getComponentTypeIcon
public IFuture<byte[]> getComponentTypeIcon(java.lang.String type)
Get a default icon for a file type.- Specified by:
getComponentTypeIcon
in interfaceIComponentFactory
-
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 interfaceIComponentFactory
- Parameters:
model
- The model (e.g. file name).The
- imports (if any).
-
getComponentFeatures
public IFuture<java.util.Collection<IComponentFeatureFactory>> getComponentFeatures(IModelInfo model)
Get the component features for a model.- Specified by:
getComponentFeatures
in interfaceIComponentFactory
- Parameters:
model
- The component model.- Returns:
- The component features.
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties(java.lang.String type)
Get the properties. Arbitrary properties that can e.g. be used to define kernel-specific settings to configure tools.- Specified by:
getProperties
in interfaceIComponentFactory
- Parameters:
type
- The component type.- Returns:
- The properties or null, if the component type is not supported by this factory.
-
getMicroAgentClass
protected java.lang.Class<?> getMicroAgentClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)
Get the mirco agent class.
-
getLibraryService
protected ILibraryService getLibraryService()
Get the library service
-
-