Class Registry
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.engine.Registry
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ITuple<java.lang.Class<? extends IAdvancedPreProcessor>,java.lang.Class<? extends org.antlr.v4.runtime.Lexer>>
getAdvancedPostProcessorForLanguage(java.lang.Class<? extends IAdvancedPreProcessorGroup> group, java.lang.String language)
Fetches a tuple containing the correct AdvancedPreProcessor and Lexer implementations for this group/language combinationDetectionType
getDetectionType(java.lang.String identifier)
Fetches the DetectionType object for an identifier if it is presentjava.util.List<AdjustableParameterObj>
getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)
Get the adjustable parameters for a detectorjava.lang.String
getDetectorDescription(java.lang.Class<? extends IDetector> det)
Get the description of a detectorjava.lang.String
getDetectorDisplayName(java.lang.Class<? extends IDetector> det)
Get the display name of the detectorjava.util.Set<java.lang.String>
getDetectorLanguages(java.lang.Class<? extends IDetector> det)
Get the languages supported by the detectorjava.util.Set<java.lang.Class<? extends IDetector>>
getDetectors()
Fetch the set of all detectors registered to Sherlockjava.util.Set<java.lang.Class<? extends IDetector>>
getDetectors(java.lang.String language)
Returns a set of all detectors registered which support the language specifiedjava.util.Set<java.lang.String>
getLanguages()
Returns the set of registered languagesjava.lang.Class<? extends org.antlr.v4.runtime.Lexer>
getLexerForStrategy(PreProcessingStrategy strategy, java.lang.String language)
Finds and returns a valid lexer for the preprocessing stragety, if one cannot be found returns nulljava.util.List<AdjustableParameterObj>
getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)
Gets the adjustable parameters for a postprocessorjava.util.List<AdjustableParameterObj>
getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)
Gets the adjustable parameters for the corresponding post processor for a detectorIPostProcessor
getPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)
Get correct instance of IPostProcessor to process an AbstractModelTaskRawResult objectboolean
registerAdvancedPreProcessorGroup(java.lang.Class<? extends IAdvancedPreProcessorGroup> preProcessorGroup)
Registers a grouping forIAdvancedPreProcessor
to Sherlock.boolean
registerAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)
Registers anIAdvancedPreProcessor
implementation to a groupboolean
registerDetectionType(DetectionType detectionType)
Registers a detection typeboolean
registerDetector(java.lang.Class<? extends IDetector> detector)
Registers anIDetector
implementation to Sherlock.boolean
registerGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)
Registers anIGeneralPreProcessor
implementation to Sherlockboolean
registerLanguage(java.lang.String name, java.lang.Class<? extends org.antlr.v4.runtime.Lexer> lexer)
Register a lexer to the language of the name passed, creating the language if the name is not recognisedboolean
registerPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultType)
Registers anIPostProcessor
implementation to Sherlock, associates it with theAbstractModelTaskRawResult
types it will process
-
-
-
Method Detail
-
getAdvancedPostProcessorForLanguage
public ITuple<java.lang.Class<? extends IAdvancedPreProcessor>,java.lang.Class<? extends org.antlr.v4.runtime.Lexer>> getAdvancedPostProcessorForLanguage(java.lang.Class<? extends IAdvancedPreProcessorGroup> group, java.lang.String language)
Fetches a tuple containing the correct AdvancedPreProcessor and Lexer implementations for this group/language combination- Specified by:
getAdvancedPostProcessorForLanguage
in interfaceIRegistry
- Parameters:
group
- the group to find a valid preprocessor forlanguage
- the language string in use, should have been already validated to work with this group- Returns:
- the tuple
-
getDetectionType
public DetectionType getDetectionType(java.lang.String identifier) throws UnknownDetectionTypeException
Fetches the DetectionType object for an identifier if it is present- Specified by:
getDetectionType
in interfaceIRegistry
- Parameters:
identifier
- String identifier for the detection type- Returns:
- the detection type object
- Throws:
UnknownDetectionTypeException
- if the identifier is not registered
-
getDetectorAdjustableParameters
public java.util.List<AdjustableParameterObj> getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)
Get the adjustable parameters for a detector- Specified by:
getDetectorAdjustableParameters
in interfaceIRegistry
- Parameters:
det
- detector class- Returns:
- adjustable parameters for the detector class
-
getDetectorDescription
public java.lang.String getDetectorDescription(java.lang.Class<? extends IDetector> det)
Get the description of a detector- Specified by:
getDetectorDescription
in interfaceIRegistry
- Parameters:
det
- detector class- Returns:
- description of the detector
-
getDetectorDisplayName
public java.lang.String getDetectorDisplayName(java.lang.Class<? extends IDetector> det)
Get the display name of the detector- Specified by:
getDetectorDisplayName
in interfaceIRegistry
- Parameters:
det
- detector class- Returns:
- display name of the detector
-
getDetectorLanguages
public java.util.Set<java.lang.String> getDetectorLanguages(java.lang.Class<? extends IDetector> det)
Get the languages supported by the detector- Specified by:
getDetectorLanguages
in interfaceIRegistry
- Parameters:
det
- detector class- Returns:
- languages supported by the detector
-
getDetectors
public java.util.Set<java.lang.Class<? extends IDetector>> getDetectors()
Fetch the set of all detectors registered to Sherlock- Specified by:
getDetectors
in interfaceIRegistry
- Returns:
- a set of all detectors registered
-
getDetectors
public java.util.Set<java.lang.Class<? extends IDetector>> getDetectors(java.lang.String language)
Returns a set of all detectors registered which support the language specified- Specified by:
getDetectors
in interfaceIRegistry
- Parameters:
language
- the language string to search- Returns:
- the set of detectors
-
getLanguages
public java.util.Set<java.lang.String> getLanguages()
Returns the set of registered languages- Specified by:
getLanguages
in interfaceIRegistry
- Returns:
- set of languages
-
getLexerForStrategy
public java.lang.Class<? extends org.antlr.v4.runtime.Lexer> getLexerForStrategy(PreProcessingStrategy strategy, java.lang.String language)
Finds and returns a valid lexer for the preprocessing stragety, if one cannot be found returns null- Specified by:
getLexerForStrategy
in interfaceIRegistry
- Parameters:
strategy
- the PreProcessingStrategylanguage
- the language string to prcess- Returns:
- valid lexer or null
-
getPostProcessorAdjustableParameters
public java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)
Gets the adjustable parameters for a postprocessor- Specified by:
getPostProcessorAdjustableParameters
in interfaceIRegistry
- Parameters:
postProcessor
- postprocessor class- Returns:
- the list of adjustable parameters
-
getPostProcessorAdjustableParametersFromDetector
public java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)
Gets the adjustable parameters for the corresponding post processor for a detector- Specified by:
getPostProcessorAdjustableParametersFromDetector
in interfaceIRegistry
- Parameters:
det
- detector class- Returns:
- the list of adjustable parameters
-
getPostProcessorInstance
public IPostProcessor getPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)
Get correct instance of IPostProcessor to process an AbstractModelTaskRawResult object- Specified by:
getPostProcessorInstance
in interfaceIRegistry
- Parameters:
rawClass
- class- Returns:
- new instance of correct postprocessor
-
registerAdvancedPreProcessorGroup
public boolean registerAdvancedPreProcessorGroup(java.lang.Class<? extends IAdvancedPreProcessorGroup> preProcessorGroup)
Registers a grouping forIAdvancedPreProcessor
to Sherlock. These groups of multiple Advanced PreProcessors all perform the same function, for different languages, laxers and parsers- Specified by:
registerAdvancedPreProcessorGroup
in interfaceIRegistry
- Parameters:
preProcessorGroup
- the group- Returns:
- was successful?
-
registerAdvancedPreProcessorImplementation
public boolean registerAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)
Registers anIAdvancedPreProcessor
implementation to a group- Specified by:
registerAdvancedPreProcessorImplementation
in interfaceIRegistry
- Parameters:
groupClassPath
- the ClassPath for the group object to register to. The preProcessor MUST perform the groups assigned function, this cannot be checked!!!preProcessor
- the implementation- Returns:
- was successful?
-
registerDetectionType
public boolean registerDetectionType(DetectionType detectionType)
Registers a detection type- Specified by:
registerDetectionType
in interfaceIRegistry
- Parameters:
detectionType
- object for the new detection type- Returns:
- was successful?
-
registerDetector
public boolean registerDetector(java.lang.Class<? extends IDetector> detector)
Registers anIDetector
implementation to Sherlock. The presence of any dependencies should ideally tested before calling this method, one way to do this is to use theSherlockEngine.isModulePresent(String)
- Specified by:
registerDetector
in interfaceIRegistry
- Parameters:
detector
- the implementation- Returns:
- was successful?
-
registerGeneralPreProcessor
public boolean registerGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)
Registers anIGeneralPreProcessor
implementation to Sherlock- Specified by:
registerGeneralPreProcessor
in interfaceIRegistry
- Parameters:
preProcessor
- the implementation- Returns:
- was successful?
-
registerLanguage
public boolean registerLanguage(java.lang.String name, java.lang.Class<? extends org.antlr.v4.runtime.Lexer> lexer)
Register a lexer to the language of the name passed, creating the language if the name is not recognised- Specified by:
registerLanguage
in interfaceIRegistry
- Parameters:
name
- Name of the language, not case sensitivelexer
- Lexer implementation for the language- Returns:
- was successful?
-
registerPostProcessor
public final boolean registerPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultType)
Registers anIPostProcessor
implementation to Sherlock, associates it with theAbstractModelTaskRawResult
types it will process- Specified by:
registerPostProcessor
in interfaceIRegistry
- Parameters:
postProcessor
- the implementationhandledResultType
- handledAbstractModelTaskRawResult
type(s) by the implementation- Returns:
- was successful?
-
-