Interface IRegistry
-
- All Known Implementing Classes:
Registry
public interface IRegistry
Interface to define API access to the registry via the static wrapper
-
-
Method Summary
All Methods Instance Methods Abstract 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> handledResultTypes)
Registers anIPostProcessor
implementation to Sherlock, associates it with theAbstractModelTaskRawResult
types it will process
-
-
-
Method Detail
-
getAdvancedPostProcessorForLanguage
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- 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
-
getDetectorDescription
java.lang.String getDetectorDescription(java.lang.Class<? extends IDetector> det)
Get the description of a detector- Parameters:
det
- detector class- Returns:
- description of the detector
-
getDetectionType
DetectionType getDetectionType(java.lang.String identifier) throws UnknownDetectionTypeException
Fetches the DetectionType object for an identifier if it is present- Parameters:
identifier
- String identifier for the detection type- Returns:
- the detection type object
- Throws:
UnknownDetectionTypeException
- if the identifier is not registered
-
getDetectorAdjustableParameters
java.util.List<AdjustableParameterObj> getDetectorAdjustableParameters(java.lang.Class<? extends IDetector> det)
Get the adjustable parameters for a detector- Parameters:
det
- detector class- Returns:
- adjustable parameters for the detector class
-
getDetectorDisplayName
java.lang.String getDetectorDisplayName(java.lang.Class<? extends IDetector> det)
Get the display name of the detector- Parameters:
det
- detector class- Returns:
- display name of the detector
-
getDetectorLanguages
java.util.Set<java.lang.String> getDetectorLanguages(java.lang.Class<? extends IDetector> det)
Get the languages supported by the detector- Parameters:
det
- detector class- Returns:
- languages supported by the detector
-
getDetectors
java.util.Set<java.lang.Class<? extends IDetector>> getDetectors()
Fetch the set of all detectors registered to Sherlock- Returns:
- a set of all detectors registered
-
getDetectors
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- Parameters:
language
- the language string to search- Returns:
- the set of detectors
-
getLanguages
java.util.Set<java.lang.String> getLanguages()
Returns the set of registered languages- Returns:
- set of languages
-
getLexerForStrategy
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- Parameters:
strategy
- the PreProcessingStrategylanguage
- the language string to prcess- Returns:
- valid lexer or null
-
getPostProcessorAdjustableParameters
java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParameters(java.lang.Class<? extends IPostProcessor> postProcessor)
Gets the adjustable parameters for a postprocessor- Parameters:
postProcessor
- postprocessor class- Returns:
- the list of adjustable parameters
-
getPostProcessorAdjustableParametersFromDetector
java.util.List<AdjustableParameterObj> getPostProcessorAdjustableParametersFromDetector(java.lang.Class<? extends IDetector> det)
Gets the adjustable parameters for the corresponding post processor for a detector- Parameters:
det
- detector class- Returns:
- the list of adjustable parameters
-
getPostProcessorInstance
IPostProcessor getPostProcessorInstance(java.lang.Class<? extends AbstractModelTaskRawResult> rawClass)
Get correct instance of IPostProcessor to process an AbstractModelTaskRawResult object- Parameters:
rawClass
- class- Returns:
- new instance of correct postprocessor
-
registerAdvancedPreProcessorGroup
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- Parameters:
preProcessorGroup
- the group- Returns:
- was successful?
-
registerAdvancedPreProcessorImplementation
boolean registerAdvancedPreProcessorImplementation(java.lang.String groupClassPath, java.lang.Class<? extends IAdvancedPreProcessor> preProcessor)
Registers anIAdvancedPreProcessor
implementation to a group- 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
boolean registerDetectionType(DetectionType detectionType)
Registers a detection type- Parameters:
detectionType
- object for the new detection type- Returns:
- was successful?
-
registerDetector
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)
- Parameters:
detector
- the implementation- Returns:
- was successful?
-
registerGeneralPreProcessor
boolean registerGeneralPreProcessor(java.lang.Class<? extends IGeneralPreProcessor> preProcessor)
Registers anIGeneralPreProcessor
implementation to Sherlock- Parameters:
preProcessor
- the implementation- Returns:
- was successful?
-
registerLanguage
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- Parameters:
name
- Name of the language, not case sensitivelexer
- Lexer implementation for the language- Returns:
- was successful?
-
registerPostProcessor
boolean registerPostProcessor(java.lang.Class<? extends IPostProcessor> postProcessor, java.lang.Class<? extends AbstractModelTaskRawResult> handledResultTypes)
Registers anIPostProcessor
implementation to Sherlock, associates it with theAbstractModelTaskRawResult
types it will process- Parameters:
postProcessor
- the implementationhandledResultTypes
- handledAbstractModelTaskRawResult
type(s) by the implementation- Returns:
- was successful?
-
-