Class ResourceFormatGeneratorService
- java.lang.Object
-
- com.dtolabs.rundeck.core.plugins.AbstractProviderRegistryService<T>
-
- com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService<T>
-
- com.dtolabs.rundeck.core.plugins.PluggableProviderRegistryService<ResourceFormatGenerator>
-
- com.dtolabs.rundeck.core.resources.format.ResourceFormatGeneratorService
-
- All Implemented Interfaces:
FrameworkSupportService
,ProviderService<ResourceFormatGenerator>
,DescribableService
,JavaClassProviderLoadable<ResourceFormatGenerator>
,PluggableProviderService<ResourceFormatGenerator>
,PluggableService<ResourceFormatGenerator>
,ProviderRegistryService<ResourceFormatGenerator>
public class ResourceFormatGeneratorService extends PluggableProviderRegistryService<ResourceFormatGenerator> implements DescribableService, JavaClassProviderLoadable<ResourceFormatGenerator>
ResourceFormatParserService is ...
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SERVICE_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 ResourceFormatGeneratorService(Framework framework)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <X extends ResourceFormatGenerator>
ResourceFormatGeneratorcreateProviderInstance(java.lang.Class<X> clazz, java.lang.String name)
ResourceFormatGenerator
createScriptProviderInstance(ScriptPluginProvider provider)
java.util.List<java.lang.String>
getBundledProviderNames()
ResourceFormatGenerator
getGeneratorForFileExtension(java.io.File file)
Return a generator for a file, based on the file extension.ResourceFormatGenerator
getGeneratorForFileExtension(java.lang.String extension)
Return a generator for a file, based on the bare file extension.ResourceFormatGenerator
getGeneratorForFormat(java.lang.String format)
Return a parser for the exact format nameResourceFormatGenerator
getGeneratorForMIMEType(java.lang.String mimeType)
Return a generator for a mime type.static ResourceFormatGeneratorService
getInstanceForFramework(Framework framework, IServicesRegistration registration)
java.lang.String
getName()
boolean
isScriptPluggable()
boolean
isValidProviderClass(java.lang.Class clazz)
java.util.List<ProviderIdent>
listDescribableProviders()
java.util.List<Description>
listDescriptions()
java.util.List<java.lang.String>
listFormats()
-
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
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
-
ResourceFormatGeneratorService
public ResourceFormatGeneratorService(Framework framework)
-
-
Method Detail
-
getBundledProviderNames
public java.util.List<java.lang.String> getBundledProviderNames()
-
getName
public java.lang.String getName()
- Specified by:
getName
in 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
-
getGeneratorForFileExtension
public ResourceFormatGenerator getGeneratorForFileExtension(java.io.File file) throws UnsupportedFormatException
Return a generator for a file, based on the file extension.- Parameters:
file
- the file- Returns:
- the generator found for the extension
- Throws:
UnsupportedFormatException
- if the file extension does not match an available generator, or if the file has no extension
-
getGeneratorForFileExtension
public ResourceFormatGenerator getGeneratorForFileExtension(java.lang.String extension) throws UnsupportedFormatException
Return a generator for a file, based on the bare file extension.- Parameters:
extension
- the file extension string- Returns:
- the generator found for the extension
- Throws:
UnsupportedFormatException
- if the file extension does not match an available generator
-
getGeneratorForFormat
public ResourceFormatGenerator getGeneratorForFormat(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 no provider for the format exists
-
getGeneratorForMIMEType
public ResourceFormatGenerator getGeneratorForMIMEType(java.lang.String mimeType) throws UnsupportedFormatException
Return a generator for a mime type.- Parameters:
mimeType
- the MIME type string- Returns:
- The first matching parser for the mime type
- Throws:
UnsupportedFormatException
- if no generators are available for the MIME type
-
isValidProviderClass
public boolean isValidProviderClass(java.lang.Class clazz)
- Specified by:
isValidProviderClass
in interfaceJavaClassProviderLoadable<ResourceFormatGenerator>
- Parameters:
clazz
- the class- Returns:
- true if the class is a valid provider class for the service
-
createProviderInstance
public <X extends ResourceFormatGenerator> ResourceFormatGenerator createProviderInstance(java.lang.Class<X> clazz, java.lang.String name) throws PluginException, ProviderCreationException
- Specified by:
createProviderInstance
in interfaceJavaClassProviderLoadable<ResourceFormatGenerator>
- 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
-
isScriptPluggable
public boolean isScriptPluggable()
-
createScriptProviderInstance
public ResourceFormatGenerator createScriptProviderInstance(ScriptPluginProvider provider) throws PluginException
- Throws:
PluginException
-
listDescribableProviders
public java.util.List<ProviderIdent> listDescribableProviders()
- Specified by:
listDescribableProviders
in interfaceDescribableService
-
listDescriptions
public java.util.List<Description> listDescriptions()
- Specified by:
listDescriptions
in interfaceDescribableService
-
getInstanceForFramework
public static ResourceFormatGeneratorService getInstanceForFramework(Framework framework, IServicesRegistration registration)
-
-