public abstract class AbstractContentParserService extends AbstractLoggableComponent implements ContentParserService
ContentParserService
interface.| Modifier and Type | Field and Description |
|---|---|
private List<AbstractContentParser> |
contentParsers |
private ContentParser |
genericParser |
private Map<String,ContentParser> |
primaryKey2parserMap |
private Map<String,ContentParser> |
secondaryKey2parserMap |
| Constructor and Description |
|---|
AbstractContentParserService()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParser(ContentParser parser,
String... keys)
This method registers the given
parser for the given
extension. |
protected void |
doInitialize()
This method performs the actual
initialization. |
ContentParser |
getGenericParser()
This method gets a generic
parser that can be used as
fallback if no specific parser is available. |
ContentParser |
getParser(String key)
This method gets the
parser for the given
key. |
void |
setContentParsers(List<AbstractContentParser> contentParsers) |
createLogger, getLoggerdoInitialized, getInitializationState, initializeprivate List<AbstractContentParser> contentParsers
setContentParsers(List)private ContentParser genericParser
getGenericParser()private final Map<String,ContentParser> primaryKey2parserMap
private Map<String,ContentParser> secondaryKey2parserMap
public AbstractContentParserService()
protected void doInitialize()
initialization. It is called when AbstractComponent.initialize() is
invoked for the first time. super.AbstractComponent.doInitialize().doInitialize in class AbstractLoggableComponentpublic ContentParser getGenericParser()
parser that can be used as
fallback if no specific parser is available.getGenericParser in interface ContentParserService@Inject public void setContentParsers(List<AbstractContentParser> contentParsers)
contentParsers - is the contentParsers to setpublic ContentParser getParser(String key)
parser for the given
key.getParser in interface ContentParserServicekey - is the key identifying the requested parser. You can use the
extension or the
mimetype of the content you want
to parse.parser for the given key or
the generic parser if no specific
parser is available (check ContentParser.getExtension() for
null to figure out).ContentParser.getPrimaryKeys(),
ContentParser.getSecondaryKeys()public void addParser(ContentParser parser, String... keys)
parser for the given
extension.parser - is the parser to register.keys - are the extensions the parser will be associated with.getParser(String)Copyright © 2001–2016 mmm-Team. All rights reserved.