com.dtolabs.rundeck.core.resources.format
Class ResourceFormatGeneratorService

java.lang.Object
  extended by com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService<T>
      extended by com.dtolabs.rundeck.core.plugins.PluggableProviderRegistryService<ResourceFormatGenerator>
          extended by com.dtolabs.rundeck.core.resources.format.ResourceFormatGeneratorService
All Implemented Interfaces:
FrameworkSupportService, ProviderService<ResourceFormatGenerator>, DescribableService, PluggableService<ResourceFormatGenerator>

public class ResourceFormatGeneratorService
extends PluggableProviderRegistryService<ResourceFormatGenerator>
implements DescribableService

ResourceFormatParserService is ...


Field Summary
static java.lang.String SERVICE_NAME
           
 
Fields inherited from class com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService
framework, instanceregistry, registry
 
Constructor Summary
ResourceFormatGeneratorService(Framework framework)
           
 
Method Summary
 ResourceFormatGenerator createProviderInstance(java.lang.Class<ResourceFormatGenerator> clazz, java.lang.String name)
          Create provider instance from a class
 ResourceFormatGenerator createScriptProviderInstance(ScriptPluginProvider provider)
          Return the instance for a ScriptPluginProvider definition
 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 name
 ResourceFormatGenerator getGeneratorForMIMEType(java.lang.String mimeType)
          Return a generator for a mime type.
static ResourceFormatGeneratorService getInstanceForFramework(Framework framework)
           
 java.lang.String getName()
          Return the name used to identify the service
 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
 
Methods inherited from class com.dtolabs.rundeck.core.plugins.PluggableProviderRegistryService
listProviders, providerOfType
 
Methods inherited from class com.dtolabs.rundeck.core.plugins.BaseProviderRegistryService
createProviderInstanceFromType, hasValidProviderSignature, registerClass, registerInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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()
Description copied from interface: FrameworkSupportService
Return the name used to identify the service

Specified by:
getName in interface FrameworkSupportService

listFormats

public java.util.List<java.lang.String> listFormats()
List 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:
ExecutionServiceException - if no provider for the format exists
UnsupportedFormatException

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)
Description copied from interface: PluggableService
Return true if the class is a valid provider class for the service

Specified by:
isValidProviderClass in interface PluggableService<ResourceFormatGenerator>
Parameters:
clazz - the class

createProviderInstance

public ResourceFormatGenerator createProviderInstance(java.lang.Class<ResourceFormatGenerator> clazz,
                                                      java.lang.String name)
                                               throws PluginException,
                                                      ProviderCreationException
Description copied from interface: PluggableService
Create provider instance from a class

Specified by:
createProviderInstance in interface PluggableService<ResourceFormatGenerator>
Parameters:
clazz - the class
name - the provider name
Throws:
PluginException
ProviderCreationException

isScriptPluggable

public boolean isScriptPluggable()
Description copied from interface: PluggableService
Return true if the service supports script plugins

Specified by:
isScriptPluggable in interface PluggableService<ResourceFormatGenerator>

createScriptProviderInstance

public ResourceFormatGenerator createScriptProviderInstance(ScriptPluginProvider provider)
                                                     throws PluginException
Description copied from interface: PluggableService
Return the instance for a ScriptPluginProvider definition

Specified by:
createScriptProviderInstance in interface PluggableService<ResourceFormatGenerator>
Parameters:
provider - the script plugin provider
Throws:
PluginException

listDescribableProviders

public java.util.List<ProviderIdent> listDescribableProviders()
Specified by:
listDescribableProviders in interface DescribableService

listDescriptions

public java.util.List<Description> listDescriptions()
Specified by:
listDescriptions in interface DescribableService

getInstanceForFramework

public static ResourceFormatGeneratorService getInstanceForFramework(Framework framework)