Package org.corpus_tools.pepper.core
Class PepperImpl
- java.lang.Object
-
- org.corpus_tools.pepper.core.PepperImpl
-
-
Constructor Summary
Constructors Constructor Description PepperImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ModuleFitness>checkFitness()Checks the fitness of each registered Pepper module.voidcleanUp()Cleans up current workspace.StringcreateJob()Creates a newPepperJobobject for a new conversion process.Set<String>findAppropriateImporters(org.eclipse.emf.common.util.URI corpusPath)Returns the names of importers which can import the data located at the specifiedcorpusPath.PepperConfigurationgetConfiguration()Returns set configuration forPepper.PepperJobgetJob(String id)Returns aPepperJobcorresponding to the passed id.Set<String>getJobIds()Return identifiers of all registeredPepperJobImplobjects.FilegetLocation(String id)Returns the location of a job.ModuleResolvergetModuleResolver()Returns the setModuleResolverImplobject, to resolvePepperModuleobjects.PepperJobImplgetPepperJobImpl(String id){@inheritDoc Pepper#getJob(String)}Collection<PepperModuleDesc>getRegisteredImporters()Returns allPepperModuleDesccorresponding to a registered importer.Collection<PepperModuleDesc>getRegisteredModules()Returns a collection of allPepperModuleDesccorresponding to Pepper modules, which are registered in thisPepperinstance.StringgetRegisteredModulesAsString()Returns a string representation of the methodPepper.getRegisteredModules().booleanremoveJob(String id)Removes thePepperJobcorresponding to the passed identifier, if a job exists.Collection<String>selfTest()Checks if the Pepper framework is ready to run.voidsetConfiguration(PepperConfiguration configuration)Sets the configuration forPepper.voidsetModuleResolver(ModuleResolver moduleResolver)Sets aModuleResolverImplobject to resolvePepperModuleobjects for Pepper jobs.StringtoString()Returns a string representation of this object.voidunsetModuleResolver(ModuleResolver moduleResolver)Unsets theModuleResolverImplreference.
-
-
-
Method Detail
-
getConfiguration
public PepperConfiguration getConfiguration()
Description copied from interface:PepperReturns set configuration forPepper.- Specified by:
getConfigurationin interfacePepper- Returns:
-
setConfiguration
public void setConfiguration(PepperConfiguration configuration)
Description copied from interface:PepperSets the configuration forPepper.- Specified by:
setConfigurationin interfacePepper
-
findAppropriateImporters
public Set<String> findAppropriateImporters(org.eclipse.emf.common.util.URI corpusPath) throws FileNotFoundException
Description copied from interface:PepperReturns the names of importers which can import the data located at the specifiedcorpusPath. If no importer was found for importing the returned list is empty, not null.- Specified by:
findAppropriateImportersin interfacePepper- Parameters:
corpusPath- the path which should be checked by each importer- Returns:
- names of importers how can import the data located at
corpusPath - Throws:
FileNotFoundException
-
createJob
public String createJob()
Description copied from interface:PepperCreates a newPepperJobobject for a new conversion process.
-
getJobIds
public Set<String> getJobIds()
Return identifiers of all registeredPepperJobImplobjects.- Returns:
- a list of all job identifiers
-
getJob
public PepperJob getJob(String id) throws JobNotFoundException
Description copied from interface:PepperReturns aPepperJobcorresponding to the passed id.- Specified by:
getJobin interfacePepper- Parameters:
id- identifier of aPepperJob- Returns:
- a
PepperJobcorresponding to the passed id - Throws:
JobNotFoundException
-
getPepperJobImpl
public PepperJobImpl getPepperJobImpl(String id) throws JobNotFoundException
{@inheritDoc Pepper#getJob(String)}- Throws:
JobNotFoundException
-
removeJob
public boolean removeJob(String id) throws JobNotFoundException
Description copied from interface:PepperRemoves thePepperJobcorresponding to the passed identifier, if a job exists.- Specified by:
removeJobin interfacePepper- Parameters:
id- identifier of aPepperJob- Returns:
- true, if job was removed successfully, false otherwise
- Throws:
JobNotFoundException
-
getLocation
public File getLocation(String id) throws JobNotFoundException
Returns the location of a job.- Parameters:
id-- Returns:
- Throws:
JobNotFoundException
-
cleanUp
public void cleanUp()
Cleans up current workspace. Removes all non active jobs.
-
getRegisteredImporters
public Collection<PepperModuleDesc> getRegisteredImporters()
Description copied from interface:PepperReturns allPepperModuleDesccorresponding to a registered importer. When no importer is registered returns an empty collection, not null.- Specified by:
getRegisteredImportersin interfacePepper- Returns:
- all importer fingerprints
-
getRegisteredModules
public Collection<PepperModuleDesc> getRegisteredModules()
Description copied from interface:PepperReturns a collection of allPepperModuleDesccorresponding to Pepper modules, which are registered in thisPepperinstance.
Note: Depending on the implementation, the computation of this result, can take a time. It could be useful, to store the returned list in case of multiple calls.- Specified by:
getRegisteredModulesin interfacePepper- Returns:
- a collection of all
PepperModuleDescobjects corresponding to Pepper modules
-
getModuleResolver
public ModuleResolver getModuleResolver()
Returns the setModuleResolverImplobject, to resolvePepperModuleobjects.- Returns:
- set set
ModuleResolverImplobject
-
setModuleResolver
public void setModuleResolver(ModuleResolver moduleResolver)
Sets aModuleResolverImplobject to resolvePepperModuleobjects for Pepper jobs.- Parameters:
moduleResolver-ModuleResolverImplobject to be used for jobs
-
unsetModuleResolver
public void unsetModuleResolver(ModuleResolver moduleResolver)
Unsets theModuleResolverImplreference. This is necessary for OSGi declarative service.
-
checkFitness
public Collection<ModuleFitness> checkFitness()
Description copied from interface:PepperChecks the fitness of each registered Pepper module. The fitness of a module indicates in what way a module is docking to the Pepper interface. For instance it checks whether a module provides a contact address of the module'supplier. Or when the module is an importer whether it supports thePepperImporterImpl.isImportable(URI)method.
Further the fitness says whether a module is ready to start.- Specified by:
checkFitnessin interfacePepper- Returns:
- a list of fitness entries, one per module, if no module is registered an empty list is returned
-
selfTest
public Collection<String> selfTest()
Description copied from interface:PepperChecks if the Pepper framework is ready to run. This means, it checks if everything necessary is given and if all registered modules could be ran. This method can be used as a kind of integration test.
-
getRegisteredModulesAsString
public String getRegisteredModulesAsString()
Description copied from interface:PepperReturns a string representation of the methodPepper.getRegisteredModules().- Specified by:
getRegisteredModulesAsStringin interfacePepper- Returns:
- a string representation of all registered modules
-
-