com.dtolabs.rundeck.core.plugins
Class BasePluggableProviderService<T>

java.lang.Object
  extended by com.dtolabs.rundeck.core.plugins.BasePluggableProviderService<T>
All Implemented Interfaces:
FrameworkSupportService, ProviderService<T>, DescribableService, PluggableProviderService<T>, PluggableService<T>
Direct Known Subclasses:
FrameworkPluggableProviderService

public abstract class BasePluggableProviderService<T>
extends java.lang.Object
implements PluggableProviderService<T>

BasePluggableProviderService is an abstract base for a provider service which can load providers from plugins. Created by greg Date: 4/12/13 Time: 4:52 PM


Field Summary
protected  java.lang.Class<? extends T> implementationClass
           
protected  java.lang.String name
           
 
Constructor Summary
BasePluggableProviderService(java.lang.String name, java.lang.Class<? extends T> implementationClass)
           
 
Method Summary
<X> ProviderService<X>
adapter(Converter<T,X> converter)
          Create an adapted form of this service given a converter.
 T createProviderInstance(java.lang.Class<T> clazz, java.lang.String name)
          Create provider instance from a class
protected  T createProviderInstanceFromType(java.lang.Class<? extends T> execClass, java.lang.String providerName)
           
 T createScriptProviderInstance(ScriptPluginProvider provider)
          Return the instance for a ScriptPluginProvider definition
 java.lang.String getName()
          Return the name used to identify the service
abstract  ServiceProviderLoader getPluginManager()
          Return the plugin manager to use
protected  boolean hasValidProviderSignature(java.lang.Class clazz)
           
 boolean isScriptPluggable()
          default implementation returns false, subclasses should override to
 boolean isValidProviderClass(java.lang.Class clazz)
          Return true if the class is a valid provider class for the service
 java.util.List<ProviderIdent> listDescribableProviders()
          default implementation of listDescribableProviders that can be used if subclasses implement DescribableService
 java.util.List<Description> listDescriptions()
          default implementation of listDescriptions that can be used if subclasses implement DescribableService
 java.util.List<ProviderIdent> listProviders()
           
 T providerOfType(java.lang.String providerName)
          Return the provider instance of the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

implementationClass

protected java.lang.Class<? extends T> implementationClass

name

protected java.lang.String name
Constructor Detail

BasePluggableProviderService

public BasePluggableProviderService(java.lang.String name,
                                    java.lang.Class<? extends T> implementationClass)
Method Detail

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

createProviderInstance

public T createProviderInstance(java.lang.Class<T> 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<T>
Parameters:
clazz - the class
name - the provider name
Throws:
PluginException
ProviderCreationException

providerOfType

public T providerOfType(java.lang.String providerName)
                 throws ExecutionServiceException
Description copied from interface: ProviderService
Return the provider instance of the given name.

Specified by:
providerOfType in interface ProviderService<T>
Throws:
ExecutionServiceException

getPluginManager

public abstract ServiceProviderLoader getPluginManager()
Return the plugin manager to use

Returns:

listProviders

public java.util.List<ProviderIdent> listProviders()
Specified by:
listProviders in interface ProviderService<T>

isScriptPluggable

public boolean isScriptPluggable()
default implementation returns false, subclasses should override to

Specified by:
isScriptPluggable in interface PluggableService<T>

createScriptProviderInstance

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

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

createProviderInstanceFromType

protected T createProviderInstanceFromType(java.lang.Class<? extends T> execClass,
                                           java.lang.String providerName)
                                    throws ProviderCreationException
Throws:
ProviderCreationException

hasValidProviderSignature

protected boolean hasValidProviderSignature(java.lang.Class clazz)

listDescriptions

public java.util.List<Description> listDescriptions()
default implementation of listDescriptions that can be used if subclasses implement DescribableService

Specified by:
listDescriptions in interface DescribableService

listDescribableProviders

public java.util.List<ProviderIdent> listDescribableProviders()
default implementation of listDescribableProviders that can be used if subclasses implement DescribableService

Specified by:
listDescribableProviders in interface DescribableService

adapter

public <X> ProviderService<X> adapter(Converter<T,X> converter)
Create an adapted form of this service given a converter.


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