Class PepperModuleImpl

    • Field Detail

      • logger

        protected org.slf4j.Logger logger
      • saltProject

        protected org.corpus_tools.salt.common.SaltProject saltProject
        Salt project which is processed by module.
      • resources

        protected org.eclipse.emf.common.util.URI resources
        TODO make docu
      • temproraries

        @Deprecated
        protected org.eclipse.emf.common.util.URI temproraries
        Deprecated.
        TODO make docu
      • symbolicName

        protected String symbolicName
        TODO make docu
      • moduleController

        protected ModuleController moduleController
        the controller object, which acts as bridge between Pepper framework and Pepper module.
      • sCorpusGraph

        protected org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph
        The SCorpusGraph object which should be processed by this module.
      • isMultithreaded

        protected boolean isMultithreaded
    • Method Detail

      • getFingerprint

        public PepperModuleDesc getFingerprint()
        Returns a PepperModuleDesc object, which is a kind of a fingerprint of this PepperModule. This fingerprint for instance contains information like the name, the version of this module or information about the supplier.
        Specified by:
        getFingerprint in interface PepperModule
        Returns:
        fingerprint to this module
      • getName

        public String getName()
        Returns the name of this module. In most cases, the name somehow describes the task of the module.
        Specified by:
        getName in interface PepperModule
        Returns:
        the value of the 'Name' attribute.
      • setName

        protected void setName​(String name)
        Sets the name of this PepperModule. Note, that a name can only be set once and not be changed again.
        Parameters:
        name - name of this module.
      • getVersion

        public String getVersion()
        Returns the version of this module.
        Specified by:
        getVersion in interface PepperModule
        Returns:
        the value of the 'Version' attribute.
      • setVersion

        public void setVersion​(String newVersion)
        Sets the version of this module. The version normally is set internally, this method only exists for dependency injection, by the modules project itself. But this method is never called by the pepper framework.
        Specified by:
        setVersion in interface PepperModule
        Parameters:
        newVersion - the new value of the 'Version' attribute.
      • getDesc

        public String getDesc()
        Returns a short description of this module. Please support some information, for the user, of what task this module does.
        Specified by:
        getDesc in interface PepperModule
        Returns:
        a short description of the task of this module
      • setDesc

        public void setDesc​(String desc)
        Sets a short description of this module. Please support some information, for the user, of what task this module does.
        Specified by:
        setDesc in interface PepperModule
        Parameters:
        desc - a short description of the task of this module
      • getSupplierContact

        public org.eclipse.emf.common.util.URI getSupplierContact()
        Returns a uri where to find more information about this module and where to find some contact information to contact the supplier.
        Specified by:
        getSupplierContact in interface PepperModule
        Returns:
        contact address like eMail address or homepage address
      • setSupplierContact

        public void setSupplierContact​(org.eclipse.emf.common.util.URI supplierContact)
        Sets a uri where to find more information about this module and where to find some contact information to contact the supplier.
        Specified by:
        setSupplierContact in interface PepperModule
      • getSupplierHomepage

        public org.eclipse.emf.common.util.URI getSupplierHomepage()
        Description copied from interface: PepperModule
        Sets the URI to the homepage describing the functionality of the module.
        Specified by:
        getSupplierHomepage in interface PepperModule
        Returns:
        URI to the homepage
      • setSupplierHomepage

        public void setSupplierHomepage​(org.eclipse.emf.common.util.URI hp)
        Description copied from interface: PepperModule
        Returns the URI to the homepage describing the functionality of the module.
        Specified by:
        setSupplierHomepage in interface PepperModule
        Parameters:
        hp - URI to the homepage
      • setProperties

        public void setProperties​(PepperModuleProperties properties)
        Sets thePepperModuleProperties object containing properties to customize the behavior of this PepperModule. Please make sure, that this method is called in constructor of your module. If not, a general PepperModuleProperties object is created by the pepper framework and will be initialized. This means, when calling this method later, all properties for customizing the module will be overridden.
        Specified by:
        setProperties in interface PepperModule
      • getSaltProject

        public org.corpus_tools.salt.common.SaltProject getSaltProject()
        Returns the SaltProject object, which is filled, manipulated or exported by the current module.
        Specified by:
        getSaltProject in interface PepperModule
        Returns:
        the value of the 'Salt Project' attribute.
      • setSaltProject

        public void setSaltProject​(org.corpus_tools.salt.common.SaltProject newSaltProject)
        Sets the SaltProject object, which is filled, manipulated or exported by the current module. Note: This method only should be called by the pepper framework.
        Specified by:
        setSaltProject in interface PepperModule
        Parameters:
        newSaltProject - the new value of the 'Salt Project' attribute.
      • getResources

        public org.eclipse.emf.common.util.URI getResources()
        Returns the path of the folder which might contain resources for a Pepper module. This is the folder, which is delivered as part of the modules zip. Usually a Pepper module is a zip file containing a jar file and a folder having the same name as the jar file. In default configuration all files of folder "./src/main/resources" are copied to the resource folder.
        Specified by:
        getResources in interface PepperModule
        Returns:
        path to resources
      • setTemproraries

        @Deprecated
        public void setTemproraries​(org.eclipse.emf.common.util.URI newTemproraries)
        Deprecated.
        TODO make docu
        Specified by:
        setTemproraries in interface PepperModule
      • getSymbolicName

        public String getSymbolicName()
        Returns the symbolic name of this OSGi bundle.
        Specified by:
        getSymbolicName in interface PepperModule
        Returns:
        the value of the 'Symbolic Name' attribute.
      • setSymbolicName

        public void setSymbolicName​(String newSymbolicName)
        Sets the symbolic name of this OSGi bundle. This value is set automatically inside the activate method, which is implemented in PepperModuleImpl class. If you want to manipulate that method. make sure to set the symbolic name and make sure, that it is set to the bundles symbolic name.
        Specified by:
        setSymbolicName in interface PepperModule
        Parameters:
        newSymbolicName - the new value of the 'Symbolic Name' attribute.
      • getComponentContext

        public org.osgi.service.component.ComponentContext getComponentContext()
        Returns the ComponentContext of the OSGi environment the bundle was started in.
        Specified by:
        getComponentContext in interface PepperModule
        Returns:
      • activate

        protected void activate​(org.osgi.service.component.ComponentContext componentContext)
        This method is called by OSGi framework and sets the component context, this class is running in. This method scans the given ComponentContext object for symbolic name and version and initializes its values symbolicName and #version with it. When running this class in OSGi context, you do not have to set both values by hand. With the given architecture, the symbolic name and the bundle version will be given by pom.xml, via MANIFEST.MF and finally read by this method. Also sets the internal field storing the ComponentContext which can be retrieved via getComponentContext().
        Parameters:
        componentContext -
      • isReadyToStart

        public boolean isReadyToStart()
                               throws PepperModuleNotReadyException
        This method is called by the pepper framework after initializing this object and directly before start processing. Initializing means setting properties PepperModuleProperties, setting temporary files, resources etc. . returns false or throws an exception in case of PepperModule instance is not ready for any reason
        This method is also called, when Pepper is in self-test mode, to check if module is correctly instantiated.
        The default implementation checks:
        • if a path to resource folder is given
        • if the MODULE_TYPE is not null
        • if the name is not null
        When overriding this method, please call super.isReadyToStart() first and in case a problem occured add it to the list PepperModule.getStartProblems().
        Specified by:
        isReadyToStart in interface PepperModule
        Returns:
        false, PepperModule instance is not ready for any reason, true, else.
        Throws:
        PepperModuleNotReadyException
      • getModuleController

        public ModuleController getModuleController()
        Returns the container and controller object for the current module. The ModuleController object is a kind of communicator between a PepperModule and the pepper framework.
        Specified by:
        getModuleController in interface PepperModule
        Returns:
        the value of the 'Pepper Module Controller' container reference.
      • setPepperModuleController_basic

        public void setPepperModuleController_basic​(ModuleController newModuleController)
        Sets the container and controller object for the current module. The ModuleController object is a kind of communicator between a PepperModule and the pepper framework. Note, this method only should be called by pepper framework.
        Specified by:
        setPepperModuleController_basic in interface PepperModule
        Parameters:
        newModuleController - the new value of the 'Pepper Module Controller' container reference.
      • getCorpusGraph

        public org.corpus_tools.salt.common.SCorpusGraph getCorpusGraph()
        Returns the SCorpusGraph object which is filled, manipulated or exported by the current module. The SCorpusGraph object is contained in the salt project PepperModule.getSaltProject().
        Specified by:
        getCorpusGraph in interface PepperModule
        Returns:
        the value of the 'SCorpus Graph' attribute.
      • setCorpusGraph

        public void setCorpusGraph​(org.corpus_tools.salt.common.SCorpusGraph newSCorpusGraph)
        Sets the SCorpusGraph object which is filled, manipulated or exported by the current module. The SCorpusGraph object is contained in the salt project PepperModule.getSaltProject(). Note: This method only should be called by the pepper framework.
        Specified by:
        setCorpusGraph in interface PepperModule
        Parameters:
        newSCorpusGraph - the new value of the 'SCorpus Graph' attribute.
      • setIsMultithreaded

        public void setIsMultithreaded​(boolean isMultithreaded)
        Sets whether this PepperModule is able to run multithreaded. This method only should be called by the module itself.
        Specified by:
        setIsMultithreaded in interface PepperModule
      • getMapperThreadGroup

        protected ThreadGroup getMapperThreadGroup()
        Returns a ThreadGroup where PepperMapper objects and the corresponding threads are supposed to run in.
        Returns:
      • setMapperThreadGroup

        protected void setMapperThreadGroup​(ThreadGroup mapperThreadGroup)
        Sets a ThreadGroup where PepperMapper objects and the corresponding threads are supposed to run in.
        Parameters:
        mapperThreadGroup -
      • start

        public void start​(org.corpus_tools.salt.graph.Identifier sElementId)
                   throws PepperModuleException
        This method is called by method start(), if the method was not overridden by the current class. If this is not the case, this method will be called for every document which has to be processed.
        Specified by:
        start in interface PepperModule
        Parameters:
        sElementId - the id value for the current document or corpus to process
        Throws:
        PepperModuleException
      • createPepperMapper

        public PepperMapper createPepperMapper​(org.corpus_tools.salt.graph.Identifier sElementId)
        OVERRIDE THIS METHOD FOR CUSTOMIZED MAPPING. This method creates a customized PepperMapper object and returns it. You can here do some additional initialisations. Thinks like setting the Identifier of the SDocument or SCorpus object and the URI resource is done by the framework (or more in detail in method PepperModule.start()). The parameter sElementId, if a PepperMapper object should be created in case of the object to map is either an SDocument object or an SCorpus object of the mapper should be initialized differently.
        Note: Override this method.
        Specified by:
        createPepperMapper in interface PepperModule
        Parameters:
        sElementId - Identifier of the SCorpus or SDocument to be processed.
        Returns:
        PepperMapper object to do the mapping task for object connected to given Identifier
      • getProgress

        public Double getProgress()
        {@inheritDoc PepperModule#getProgress()}
        Specified by:
        getProgress in interface PepperModule
        Returns:
        the progress of all documents processed by this module
      • proposeImportOrder

        public List<org.corpus_tools.salt.graph.Identifier> proposeImportOrder​(org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph)
        This method could be overridden, to make a proposal for the import order of SDocument objects. Overriding this method is useful, in case of the order matters in the specific mapping of this PepperModule . In this case a influencing the import order can decrease the processing time. If you do not want to influence the order, just return an empty list, or don't override this method.
        In case you want to override this method, you can return a value for each passed SCorpusGraph.
        OVERRIDE THIS METHOD FOR CUSTOMIZED MAPPING.
        Specified by:
        proposeImportOrder in interface PepperModule
        Parameters:
        sCorpusGraph - the SCorpusGraph object for which the order could be proposed
        Returns:
        a list determining the import order of SDocument objects
      • toString

        public String toString()
        Returns a string representation of this object.
        Note: This representation cannot be used for serialization/ deserialization purposes.
        Overrides:
        toString in class Object