Package org.apache.any23.extractor
Class ExtractorRegistryImpl
- java.lang.Object
-
- org.eclipse.rdf4j.common.lang.service.ServiceRegistry<String,ExtractorFactory>
-
- org.apache.any23.extractor.ExtractorRegistryImpl
-
- All Implemented Interfaces:
ExtractorRegistry
public class ExtractorRegistryImpl extends org.eclipse.rdf4j.common.lang.service.ServiceRegistry<String,ExtractorFactory> implements ExtractorRegistry
Singleton class acting as a register for all the variousExtractor
.
-
-
Constructor Summary
Constructors Constructor Description ExtractorRegistryImpl()
Public constructor for ExtractorRegistryImpl.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getAllNames()
Returns the names of all registered extractors, sorted alphabetically.ExtractorGroup
getExtractorGroup()
ExtractorGroup
getExtractorGroup(List<String> names)
Returns anExtractorGroup
containing theExtractorFactory
mathing the names provided as input.ExtractorFactory<?>
getFactory(String name)
Retrieves aExtractorFactory
given its namestatic ExtractorRegistry
getInstance()
protected String
getKey(ExtractorFactory service)
boolean
isRegisteredName(String name)
void
register(ExtractorFactory<?> factory)
Registers anExtractorFactory
.void
unregister(String name)
Unregisters theExtractorFactory
with the given name.
-
-
-
Method Detail
-
getInstance
public static ExtractorRegistry getInstance()
- Returns:
- returns the
ExtractorRegistry
instance.
-
register
public void register(ExtractorFactory<?> factory)
Registers anExtractorFactory
.- Specified by:
register
in interfaceExtractorRegistry
- Parameters:
factory
- theExtractorFactory
to register- Throws:
IllegalArgumentException
- if trying to register aExtractorFactory
with a that already exists in the registry.
-
unregister
public void unregister(String name)
Unregisters theExtractorFactory
with the given name.- Specified by:
unregister
in interfaceExtractorRegistry
- Parameters:
name
- The name of the ExtractorFactory to unregister.
-
getFactory
public ExtractorFactory<?> getFactory(String name)
Retrieves aExtractorFactory
given its name- Specified by:
getFactory
in interfaceExtractorRegistry
- Parameters:
name
- of the desired factory- Returns:
- the
ExtractorFactory
associated to the provided name - Throws:
IllegalArgumentException
- if there is not aExtractorFactory
associated to the provided name.
-
getExtractorGroup
public ExtractorGroup getExtractorGroup()
- Specified by:
getExtractorGroup
in interfaceExtractorRegistry
- Returns:
- an
ExtractorGroup
with all the registeredExtractor
.
-
getExtractorGroup
public ExtractorGroup getExtractorGroup(List<String> names)
Returns anExtractorGroup
containing theExtractorFactory
mathing the names provided as input.- Specified by:
getExtractorGroup
in interfaceExtractorRegistry
- Parameters:
names
- aList
containing the names of the desiredExtractorFactory
.- Returns:
- the extraction group.
-
isRegisteredName
public boolean isRegisteredName(String name)
- Specified by:
isRegisteredName
in interfaceExtractorRegistry
- Parameters:
name
- of theExtractorFactory
- Returns:
true
if is there aExtractorFactory
associated to the provided name.
-
getAllNames
public List<String> getAllNames()
Returns the names of all registered extractors, sorted alphabetically.- Specified by:
getAllNames
in interfaceExtractorRegistry
- Returns:
- an alphabetically sorted
List
-
getKey
protected String getKey(ExtractorFactory service)
- Specified by:
getKey
in classorg.eclipse.rdf4j.common.lang.service.ServiceRegistry<String,ExtractorFactory>
-
-