Class 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 Detail

      • DEFAULT_FEATURES

        public static final java.util.Collection<IComponentFeatureFactory> DEFAULT_FEATURES
        The default component features.
      • ffilter

        protected static jadex.commons.FileFilter ffilter
        Filter for scanning for kernel agent class files.
      • cfilter

        protected static jadex.commons.IFilter<jadex.commons.SClassReader.ClassInfo> cfilter
        Filter for scanning for kernel agent class infos.
    • Constructor Detail

      • SComponentFactory

        public SComponentFactory()
    • 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> jadex.commons.future.IResultListener<T> createResultListener​(jadex.commons.future.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 jadex.commons.future.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 jadex.commons.future.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 jadex.commons.future.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.
      • isStartable

        public static jadex.commons.future.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 jadex.commons.future.IFuture<byte[]> getFileTypeIcon​(IExternalAccess exta,
                                                                           java.lang.String type)
        Get a default icon for a file type.
      • getProperty

        public static jadex.commons.future.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 jadex.commons.future.IFuture<java.lang.String> getFileType​(IExternalAccess exta,
                                                                                 java.lang.String model,
                                                                                 IResourceIdentifier rid)
        Get the file type of a model.
      • 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<jadex.commons.IFilter<java.lang.Object>> scanForKernelFilters​(java.util.List<java.net.URL> urls)
        Scan files for kernel components.
        Returns:
        (suffix -> classname)
      • getKernelFilter

        public static jadex.commons.IFilter<java.lang.Object> getKernelFilter​(jadex.commons.SClassReader.ClassInfo ci)
        Add infos about a kernel to the map.
      • getComponentModelsAsStream

        public static jadex.commons.future.ISubscriptionIntermediateFuture<java.util.Collection<java.lang.String[]>> getComponentModelsAsStream​(IInternalAccess component)
        Scans for component models and returns them as stream.
        Returns:
        Collection>
      • getComponentModelsAsStream

        public static jadex.commons.future.ISubscriptionIntermediateFuture<java.util.Collection<java.lang.String[]>> getComponentModelsAsStream​(IInternalAccess component,
                                                                                                                                                java.net.URL[] purls)
        Scans for component models and returns them as stream.
        Returns:
        Collection>
      • getKernelFilters

        public static java.util.Collection<jadex.commons.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.
      • existsFile

        public static boolean existsFile​(java.lang.String name,
                                         java.net.URL url)
        Check if a file exists in a dir or jar.
        Parameters:
        name - The name.
        url - The url.
        Returns:
        True, if file exists.