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

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

public class ResourceFormatParserService
extends PluggableProviderRegistryService<ResourceFormatParser>
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
ResourceFormatParserService(Framework framework)
           
 
Method Summary
 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
 
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

ResourceFormatParserService

public ResourceFormatParserService(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


listSupportedFileExtensions

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

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

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<ResourceFormatParser>
Parameters:
clazz - the class

createProviderInstance

public ResourceFormatParser createProviderInstance(java.lang.Class<ResourceFormatParser> 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<ResourceFormatParser>
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<ResourceFormatParser>

createScriptProviderInstance

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

Specified by:
createScriptProviderInstance in interface PluggableService<ResourceFormatParser>
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 ResourceFormatParserService getInstanceForFramework(Framework framework)