public class ResourceFormatParserService extends PluggableProviderRegistryService<ResourceFormatParser> implements DescribableService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SERVICE_NAME |
framework, instanceregistry, registry
Constructor and Description |
---|
ResourceFormatParserService(Framework framework) |
Modifier and Type | Method and Description |
---|---|
ResourceFormatParser |
createProviderInstance(java.lang.Class<ResourceFormatParser> clazz,
java.lang.String name)
Create provider instance from a class
|
ResourceFormatParser |
createScriptProviderInstance(ScriptPluginProvider provider)
Return the instance for a ScriptPluginProvider definition
|
java.util.List<java.lang.String> |
getBundledProviderNames() |
static java.lang.String |
getFileExtension(java.lang.String name)
Return the file extension of the file, without ".", or null if the file name doesn't have an extension
|
static ResourceFormatParserService |
getInstanceForFramework(Framework framework) |
java.lang.String |
getName()
Return the name used to identify the service
|
ResourceFormatParser |
getParserForFileExtension(java.io.File file)
Return a parser for a file, based on the file extension.
|
ResourceFormatParser |
getParserForFileExtension(java.lang.String extension)
Return a parser for a file, based on the bare file extension.
|
ResourceFormatParser |
getParserForFormat(java.lang.String format)
Return a parser for the exact format name
|
ResourceFormatParser |
getParserForMIMEType(java.lang.String mimeType)
Return a parser for a mime type.
|
boolean |
isScriptPluggable()
Return true if the service supports script plugins
|
boolean |
isValidProviderClass(java.lang.Class clazz)
Return true if the class is a valid provider class for the service
|
java.util.List<ProviderIdent> |
listDescribableProviders() |
java.util.List<Description> |
listDescriptions() |
java.util.List<java.lang.String> |
listFormats()
List the available format identifiers provided by all parsers
|
java.util.List<java.lang.String> |
listSupportedFileExtensions()
List the available format identifiers provided by all parsers
|
listProviders, providerOfType
createProviderInstanceFromType, hasValidProviderSignature, registerClass, registerInstance
public static final java.lang.String SERVICE_NAME
public ResourceFormatParserService(Framework framework)
public java.util.List<java.lang.String> getBundledProviderNames()
public java.lang.String getName()
FrameworkSupportService
getName
in interface FrameworkSupportService
public java.util.List<java.lang.String> listFormats()
public java.util.List<java.lang.String> listSupportedFileExtensions()
public ResourceFormatParser getParserForFileExtension(java.io.File file) throws UnsupportedFormatException
file
- the fileUnsupportedFormatException
- if the file extension does not match an available parser, or if the file has
no extensionpublic static java.lang.String getFileExtension(java.lang.String name)
public ResourceFormatParser getParserForFileExtension(java.lang.String extension) throws UnsupportedFormatException
extension
- the file extension stringUnsupportedFormatException
- if the file extension does not match an available parser, or if the file has
no extensionpublic ResourceFormatParser getParserForFormat(java.lang.String format) throws UnsupportedFormatException
format
- the format nameExecutionServiceException
- if no provider for the format existsUnsupportedFormatException
public ResourceFormatParser getParserForMIMEType(java.lang.String mimeType) throws UnsupportedFormatException
mimeType
- the MIME type stringUnsupportedFormatException
- if no parser are available for the MIME typepublic boolean isValidProviderClass(java.lang.Class clazz)
PluggableService
isValidProviderClass
in interface PluggableService<ResourceFormatParser>
clazz
- the classpublic ResourceFormatParser createProviderInstance(java.lang.Class<ResourceFormatParser> clazz, java.lang.String name) throws PluginException, ProviderCreationException
PluggableService
createProviderInstance
in interface PluggableService<ResourceFormatParser>
clazz
- the classname
- the provider namePluginException
ProviderCreationException
public boolean isScriptPluggable()
PluggableService
isScriptPluggable
in interface PluggableService<ResourceFormatParser>
public ResourceFormatParser createScriptProviderInstance(ScriptPluginProvider provider) throws PluginException
PluggableService
createScriptProviderInstance
in interface PluggableService<ResourceFormatParser>
provider
- the script plugin providerPluginException
public java.util.List<ProviderIdent> listDescribableProviders()
listDescribableProviders
in interface DescribableService
public java.util.List<Description> listDescriptions()
listDescriptions
in interface DescribableService
public static ResourceFormatParserService getInstanceForFramework(Framework framework)