Class ResourceFormatParserService
- java.lang.Object
-
- com.dtolabs.rundeck.core.plugins.AbstractProviderRegistryService<T>
-
- com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService<T>
-
- com.dtolabs.rundeck.core.plugins.PluggableProviderRegistryService<ResourceFormatParser>
-
- com.dtolabs.rundeck.core.resources.format.ResourceFormatParserService
-
- All Implemented Interfaces:
FrameworkSupportService,ProviderService<ResourceFormatParser>,DescribableService,JavaClassProviderLoadable<ResourceFormatParser>,PluggableProviderService<ResourceFormatParser>,PluggableService<ResourceFormatParser>,ProviderRegistryService<ResourceFormatParser>
public class ResourceFormatParserService extends PluggableProviderRegistryService<ResourceFormatParser> implements DescribableService, JavaClassProviderLoadable<ResourceFormatParser>
ResourceFormatParserService is ...
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSERVICE_NAME-
Fields inherited from class com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService
framework
-
Fields inherited from class com.dtolabs.rundeck.core.plugins.AbstractProviderRegistryService
instanceregistry, registry
-
-
Constructor Summary
Constructors Constructor Description ResourceFormatParserService(Framework framework)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbaseMimeType(java.lang.String mimeType)<X extends ResourceFormatParser>
ResourceFormatParsercreateProviderInstance(java.lang.Class<X> clazz, java.lang.String name)java.util.List<java.lang.String>getBundledProviderNames()static java.lang.StringgetFileExtension(java.lang.String name)static ResourceFormatParserServicegetInstanceForFramework(Framework framework, IServicesRegistration registration)java.lang.StringgetName()ResourceFormatParsergetParserForFileExtension(java.io.File file)Return a parser for a file, based on the file extension.ResourceFormatParsergetParserForFileExtension(java.lang.String extension)Return a parser for a file, based on the bare file extension.ResourceFormatParsergetParserForFormat(java.lang.String format)Return a parser for the exact format nameResourceFormatParsergetParserForMIMEType(java.lang.String mimeType)Return a parser for a mime type.booleanisValidProviderClass(java.lang.Class clazz)java.util.List<ProviderIdent>listDescribableProviders()java.util.List<Description>listDescriptions()java.util.List<java.lang.String>listFormats()java.util.List<java.lang.String>listSupportedFileExtensions()-
Methods inherited from class com.dtolabs.rundeck.core.plugins.PluggableProviderRegistryService
closeableProviderOfType, listProviders, providerOfType
-
Methods inherited from class com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService
createProviderInstanceFromType, hasValidProviderSignature
-
Methods inherited from class com.dtolabs.rundeck.core.plugins.AbstractProviderRegistryService
getRegistryMap, registerClass, registerInstance
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.dtolabs.rundeck.core.plugins.PluggableProviderService
adapter
-
Methods inherited from interface com.dtolabs.rundeck.core.plugins.PluggableService
canLoadWithLoader, loadCloseableWithLoader, loadWithLoader
-
Methods inherited from interface com.dtolabs.rundeck.core.plugins.ProviderRegistryService
isCacheInstances, registerClass, registerInstance, setCacheInstances
-
-
-
-
Field Detail
-
SERVICE_NAME
public static final java.lang.String SERVICE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceFormatParserService
public ResourceFormatParserService(Framework framework)
-
-
Method Detail
-
getBundledProviderNames
public java.util.List<java.lang.String> getBundledProviderNames()
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceFrameworkSupportService- Returns:
- the name used to identify the service
-
listFormats
public java.util.List<java.lang.String> listFormats()
- Returns:
- the available format identifiers provided by all parsers
-
listSupportedFileExtensions
public java.util.List<java.lang.String> listSupportedFileExtensions()
- Returns:
- the available format identifiers provided by all parsers
-
getParserForFileExtension
public ResourceFormatParser getParserForFileExtension(java.io.File file) throws UnsupportedFormatException
Return a parser for a file, based on the file extension.- Parameters:
file- the file- Returns:
- the parser found for the extension
- Throws:
UnsupportedFormatException- if the file extension does not match an available parser, or if the file has no extension
-
getFileExtension
public static java.lang.String getFileExtension(java.lang.String name)
- Parameters:
name- file name- Returns:
- the file extension of the file, without ".", or null if the file name doesn't have an extension
-
getParserForFileExtension
public ResourceFormatParser getParserForFileExtension(java.lang.String extension) throws UnsupportedFormatException
Return a parser for a file, based on the bare file extension.- Parameters:
extension- the file extension string- Returns:
- the parser found for the extension
- Throws:
UnsupportedFormatException- if the file extension does not match an available parser, or if the file has no extension
-
getParserForFormat
public ResourceFormatParser getParserForFormat(java.lang.String format) throws UnsupportedFormatException
Return a parser for the exact format name- Parameters:
format- the format name- Returns:
- the parser found for the format
- Throws:
UnsupportedFormatException- if format is not supported
-
getParserForMIMEType
public ResourceFormatParser getParserForMIMEType(java.lang.String mimeType) throws UnsupportedFormatException
Return a parser for a mime type.- Parameters:
mimeType- the MIME type string- Returns:
- The first matching parser for the mime type
- Throws:
UnsupportedFormatException- if no parser are available for the MIME type
-
baseMimeType
public static java.lang.String baseMimeType(java.lang.String mimeType)
-
isValidProviderClass
public boolean isValidProviderClass(java.lang.Class clazz)
- Specified by:
isValidProviderClassin interfaceJavaClassProviderLoadable<ResourceFormatParser>- Parameters:
clazz- the class- Returns:
- true if the class is a valid provider class for the service
-
createProviderInstance
public <X extends ResourceFormatParser> ResourceFormatParser createProviderInstance(java.lang.Class<X> clazz, java.lang.String name) throws PluginException, ProviderCreationException
- Specified by:
createProviderInstancein interfaceJavaClassProviderLoadable<ResourceFormatParser>- Type Parameters:
X- subtype of T- Parameters:
clazz- the classname- the provider name- Returns:
- Create provider instance from a class
- Throws:
PluginException- if the plugin has an errorProviderCreationException- if creating the instance has an error
-
listDescribableProviders
public java.util.List<ProviderIdent> listDescribableProviders()
- Specified by:
listDescribableProvidersin interfaceDescribableService
-
listDescriptions
public java.util.List<Description> listDescriptions()
- Specified by:
listDescriptionsin interfaceDescribableService
-
getInstanceForFramework
public static ResourceFormatParserService getInstanceForFramework(Framework framework, IServicesRegistration registration)
-
-