Class SComponentFactory
- java.lang.Object
-
- jadex.bridge.service.types.factory.SComponentFactory
-
public class SComponentFactory extends java.lang.Object
Standard meta component factory. Uses several sub factories and uses them according to their order and isLoadable() method.
-
-
Field Summary
Fields Modifier and Type Field Description protected static IFilter<SClassReader.ClassInfo>
cfilter
Filter for scanning for kernel agent class infos.static java.util.Collection<IComponentFeatureFactory>
DEFAULT_FEATURES
The default component features.protected static FileFilter
ffilter
Filter for scanning for kernel agent class files.
-
Constructor Summary
Constructors Constructor Description SComponentFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static IFuture<java.lang.Boolean>
checkComponentType(java.lang.String model, IComponentFactory[] facts, int i, IExternalAccess ea, IResourceIdentifier rid)
static <T> IResultListener<T>
createResultListener(IResultListener<T> listener, IExternalAccess ea)
Create a result listener which is executed as an component step.protected static IFuture<IComponentFactory>
doFindFactory(java.util.Iterator<IComponentFactory> facs, FactoryFilter filter)
Find a matching factory in the given iterator.static ISubscriptionIntermediateFuture<java.util.Collection<java.lang.String[]>>
getComponentModelsAsStream(IInternalAccess component)
Scans for component models and returns them as stream.static ISubscriptionIntermediateFuture<java.util.Collection<java.lang.String[]>>
getComponentModelsAsStream(IInternalAccess component, java.net.URL[] urls)
Scans for component models and returns them as stream.static IFuture<IComponentFactory>
getFactory(FactoryFilter filter, IInternalAccess ia)
static IFuture<java.lang.String>
getFileType(IExternalAccess exta, java.lang.String model, IResourceIdentifier rid)
Get the file type of a model.static IFuture<byte[]>
getFileTypeIcon(IExternalAccess exta, java.lang.String type)
Get a default icon for a file type.static IFilter<java.lang.Object>
getKernelFilter(SClassReader.ClassInfo ci)
Add infos about a kernel to the map.static java.util.Collection<IFilter<java.lang.Object>>
getKernelFilters(IInternalAccess component, java.util.List<java.net.URL> urls)
Get all kernel files, i.e.static IFuture<java.lang.Object>
getProperty(IExternalAccess exta, java.lang.String type, java.lang.String key)
Get a default icon for a file type.static boolean
isComponentStepNecessary(IComponentIdentifier target)
Check if a component is necessary.static IFuture<java.lang.Boolean>
isLoadable(IExternalAccess exta, java.lang.String model, java.lang.Object pojo, IResourceIdentifier rid)
Test if a model can be loaded by the factory.static IFuture<java.lang.Boolean>
isModelType(IExternalAccess exta, java.lang.String model, IResourceIdentifier rid)
Test if a model can be loaded by the factory.static IFuture<java.lang.Boolean>
isStartable(IExternalAccess exta, java.lang.String model, java.lang.Object pojo, IResourceIdentifier rid)
Test if a model is startable (e.g.static IFuture<IModelInfo>
loadModel(IExternalAccess exta, java.lang.String model, IResourceIdentifier rid)
Load an component model.static java.util.Collection<IComponentFeatureFactory>
orderComponentFeatures(java.lang.String name, java.util.Collection<java.util.Collection<IComponentFeatureFactory>> facss)
Build an ordered list of component features.protected static java.util.Collection<IComponentFactory>
reorderMultiFactory(java.util.Collection<IComponentFactory> facs)
Exclude the multifactory from a collection.static java.util.Collection<IFilter<java.lang.Object>>
scanForKernelFilters(java.util.List<java.net.URL> urls)
Scan files for kernel components.
-
-
-
Field Detail
-
DEFAULT_FEATURES
public static final java.util.Collection<IComponentFeatureFactory> DEFAULT_FEATURES
The default component features.
-
ffilter
protected static FileFilter ffilter
Filter for scanning for kernel agent class files.
-
cfilter
protected static IFilter<SClassReader.ClassInfo> cfilter
Filter for scanning for kernel agent class infos.
-
-
Method Detail
-
orderComponentFeatures
public static java.util.Collection<IComponentFeatureFactory> orderComponentFeatures(java.lang.String name, java.util.Collection<java.util.Collection<IComponentFeatureFactory>> facss)
Build an ordered list of component features.- Parameters:
facss
- A list of component feature lists.- Returns:
- An ordered list of component features.
-
isComponentStepNecessary
public static boolean isComponentStepNecessary(IComponentIdentifier target)
Check if a component is necessary.- Parameters:
target
- The target component identifier.- Returns:
- The
-
createResultListener
public static <T> IResultListener<T> createResultListener(IResultListener<T> listener, IExternalAccess ea)
Create a result listener which is executed as an component step.- Parameters:
The
- original listener to be called.- Returns:
- The listener.
-
loadModel
public static IFuture<IModelInfo> loadModel(IExternalAccess exta, java.lang.String model, IResourceIdentifier rid)
Load an component model.- Parameters:
model
- The model.- Returns:
- The loaded model.
-
isLoadable
public static IFuture<java.lang.Boolean> isLoadable(IExternalAccess exta, java.lang.String model, java.lang.Object pojo, IResourceIdentifier rid)
Test if a model can be loaded by the factory.- Parameters:
model
- The model.- Returns:
- True, if model can be loaded.
-
isModelType
public static IFuture<java.lang.Boolean> isModelType(IExternalAccess exta, java.lang.String model, IResourceIdentifier rid)
Test if a model can be loaded by the factory.- Parameters:
model
- The model.- Returns:
- True, if model can be loaded.
-
checkComponentType
protected static IFuture<java.lang.Boolean> checkComponentType(java.lang.String model, IComponentFactory[] facts, int i, IExternalAccess ea, IResourceIdentifier rid)
-
isStartable
public static IFuture<java.lang.Boolean> isStartable(IExternalAccess exta, java.lang.String model, java.lang.Object pojo, IResourceIdentifier rid)
Test if a model is startable (e.g. a component).- Parameters:
model
- The model.- Returns:
- True, if startable (and should therefore also be loadable).
-
getFileTypeIcon
public static IFuture<byte[]> getFileTypeIcon(IExternalAccess exta, java.lang.String type)
Get a default icon for a file type.
-
getProperty
public static IFuture<java.lang.Object> getProperty(IExternalAccess exta, java.lang.String type, java.lang.String key)
Get a default icon for a file type.
-
getFileType
public static IFuture<java.lang.String> getFileType(IExternalAccess exta, java.lang.String model, IResourceIdentifier rid)
Get the file type of a model.
-
getFactory
public static IFuture<IComponentFactory> getFactory(FactoryFilter filter, IInternalAccess ia)
-
doFindFactory
protected static IFuture<IComponentFactory> doFindFactory(java.util.Iterator<IComponentFactory> facs, FactoryFilter filter)
Find a matching factory in the given iterator.
-
reorderMultiFactory
protected static java.util.Collection<IComponentFactory> reorderMultiFactory(java.util.Collection<IComponentFactory> facs)
Exclude the multifactory from a collection.- Parameters:
facs
- The factories.- Returns:
- cleaned collection.
-
scanForKernelFilters
public static java.util.Collection<IFilter<java.lang.Object>> scanForKernelFilters(java.util.List<java.net.URL> urls)
Scan files for kernel components.- Returns:
- (suffix -> classname)
-
getKernelFilter
public static IFilter<java.lang.Object> getKernelFilter(SClassReader.ClassInfo ci)
Add infos about a kernel to the map.
-
getComponentModelsAsStream
public static ISubscriptionIntermediateFuture<java.util.Collection<java.lang.String[]>> getComponentModelsAsStream(IInternalAccess component)
Scans for component models and returns them as stream.- Returns:
- Collection
-
getComponentModelsAsStream
public static ISubscriptionIntermediateFuture<java.util.Collection<java.lang.String[]>> getComponentModelsAsStream(IInternalAccess component, java.net.URL[] urls)
Scans for component models and returns them as stream.- Returns:
- Collection
-
getKernelFilters
public static java.util.Collection<IFilter<java.lang.Object>> getKernelFilters(IInternalAccess component, java.util.List<java.net.URL> urls)
Get all kernel files, i.e. specs to start a kernel.
-
-