Package com.dtolabs.rundeck.core.plugins
Class ScriptPluginProviderLoader
- java.lang.Object
-
- com.dtolabs.rundeck.core.plugins.ScriptPluginProviderLoader
-
- All Implemented Interfaces:
PluginMetadata
,PluginResourceLoader
,ProviderLoader
,FileCache.Cacheable
,FileCache.Expireable
public class ScriptPluginProviderLoader extends java.lang.Object implements ProviderLoader, FileCache.Expireable, PluginResourceLoader, PluginMetadata
ScriptPluginProviderLoader can load a provider instance for a service from a script plugin zip file. Services that want to use this loader need to implementScriptPluginProviderLoadable
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.String>
SUPPORTED_PLUGIN_VERSIONS
static VersionCompare
SUPPORTS_RESOURCES_PLUGIN_VERSION
static java.lang.String
VERSION_1_0
static java.lang.String
VERSION_1_1
static java.lang.String
VERSION_1_2
static java.lang.String
VERSION_2_0
-
Constructor Summary
Constructors Constructor Description ScriptPluginProviderLoader(java.io.File file, java.io.File cachedir)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canLoadForService(FrameworkSupportService service)
boolean
equals(java.lang.Object o)
void
expire()
Expire the loader cache itemjava.util.Date
getDateLoaded()
static boolean
getDefaultMergeEnvVars(PluginMeta pluginMeta)
Return default value for "mergeEnvironment" based on plugin type versionjava.io.File
getFile()
java.lang.String
getFilename()
java.lang.String
getPluginArtifactName()
java.lang.String
getPluginAuthor()
java.util.Date
getPluginDate()
java.lang.String
getPluginDescription()
java.lang.String
getPluginDocsLink()
java.lang.String
getPluginFileVersion()
java.lang.String
getPluginId()
This id is generated off of the plugin name.java.lang.String
getPluginLicense()
java.lang.String
getPluginName()
java.util.List<java.lang.String>
getPluginResourcesList()
java.lang.String
getPluginSourceLink()
java.lang.String
getPluginThirdPartyDependencies()
java.lang.String
getPluginType()
java.lang.String
getPluginUrl()
java.lang.String
getPluginVersion()
java.lang.String
getResourcesBasePath()
static java.lang.String
getResourcesBasePath(PluginMeta metadata)
java.lang.String
getRundeckCompatibilityVersion()
java.util.List<java.lang.String>
getTags()
java.lang.String
getTargetHostCompatibility()
int
hashCode()
boolean
isLoaderFor(ProviderIdent ident)
Return true if the plugin file can loade a provider for the identjava.util.List<ProviderIdent>
listProviders()
List providers availablejava.util.List<java.lang.String>
listResources()
<T> T
load(PluggableService<T> service, java.lang.String providerName)
Load a provider instance for the service by name<T> CloseableProvider<T>
loadCloseable(PluggableService<T> service, java.lang.String providerName)
Return a closeable provider instancejava.io.InputStream
openResourceStreamFor(java.lang.String name)
Open a stream to load a resourcestatic boolean
supportsResources(PluginMeta pluginMeta)
Return true if the plugin version supports resources
-
-
-
Field Detail
-
VERSION_1_0
public static final java.lang.String VERSION_1_0
- See Also:
- Constant Field Values
-
VERSION_1_1
public static final java.lang.String VERSION_1_1
- See Also:
- Constant Field Values
-
VERSION_1_2
public static final java.lang.String VERSION_1_2
- See Also:
- Constant Field Values
-
SUPPORTS_RESOURCES_PLUGIN_VERSION
public static final VersionCompare SUPPORTS_RESOURCES_PLUGIN_VERSION
-
VERSION_2_0
public static final java.lang.String VERSION_2_0
- See Also:
- Constant Field Values
-
SUPPORTED_PLUGIN_VERSIONS
public static final java.util.List<java.lang.String> SUPPORTED_PLUGIN_VERSIONS
-
-
Method Detail
-
canLoadForService
public boolean canLoadForService(FrameworkSupportService service)
- Specified by:
canLoadForService
in interfaceProviderLoader
- Parameters:
service
- service- Returns:
- true if the service can be used to load with this loader, e.g. if it implements any necessary interface
-
listResources
public java.util.List<java.lang.String> listResources() throws PluginException, java.io.IOException
- Specified by:
listResources
in interfacePluginResourceLoader
- Returns:
- the list of resources available
- Throws:
PluginException
java.io.IOException
-
openResourceStreamFor
public java.io.InputStream openResourceStreamFor(java.lang.String name) throws PluginException, java.io.IOException
Description copied from interface:PluginResourceLoader
Open a stream to load a resource- Specified by:
openResourceStreamFor
in interfacePluginResourceLoader
- Parameters:
name
- resource path and name- Returns:
- input stream for the resources, must be closed when finished, or null if the plugin does not support resources
- Throws:
PluginException
- if a path is requested that was not in the pluginjava.io.IOException
- if an error occurs
-
load
public <T> T load(PluggableService<T> service, java.lang.String providerName) throws ProviderLoaderException
Load a provider instance for the service by name- Specified by:
load
in interfaceProviderLoader
- Throws:
ProviderLoaderException
-
loadCloseable
public <T> CloseableProvider<T> loadCloseable(PluggableService<T> service, java.lang.String providerName) throws ProviderLoaderException
Description copied from interface:ProviderLoader
Return a closeable provider instance- Specified by:
loadCloseable
in interfaceProviderLoader
- Type Parameters:
T
- type- Parameters:
service
- serviceproviderName
- provider name- Returns:
- closeable provider
- Throws:
ProviderLoaderException
-
isLoaderFor
public boolean isLoaderFor(ProviderIdent ident)
Return true if the plugin file can loade a provider for the ident- Specified by:
isLoaderFor
in interfaceProviderLoader
-
listProviders
public java.util.List<ProviderIdent> listProviders()
Description copied from interface:ProviderLoader
List providers available- Specified by:
listProviders
in interfaceProviderLoader
-
expire
public void expire()
Expire the loader cache item- Specified by:
expire
in interfaceFileCache.Expireable
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getDefaultMergeEnvVars
public static boolean getDefaultMergeEnvVars(PluginMeta pluginMeta)
Return default value for "mergeEnvironment" based on plugin type version- Parameters:
pluginMeta
-- Returns:
-
supportsResources
public static boolean supportsResources(PluginMeta pluginMeta)
Return true if the plugin version supports resources- Parameters:
pluginMeta
-- Returns:
-
getPluginResourcesList
public java.util.List<java.lang.String> getPluginResourcesList() throws java.io.IOException
- Throws:
java.io.IOException
-
getResourcesBasePath
public java.lang.String getResourcesBasePath() throws java.io.IOException
- Throws:
java.io.IOException
-
getResourcesBasePath
public static java.lang.String getResourcesBasePath(PluginMeta metadata) throws java.io.IOException
- Throws:
java.io.IOException
-
getFilename
public java.lang.String getFilename()
- Specified by:
getFilename
in interfacePluginMetadata
- Returns:
- Name of file on disk
-
getFile
public java.io.File getFile()
- Specified by:
getFile
in interfacePluginMetadata
- Returns:
- Source file on disk
-
getPluginArtifactName
public java.lang.String getPluginArtifactName()
- Specified by:
getPluginArtifactName
in interfacePluginMetadata
- Returns:
- The name in plugin.yaml or the Rundeck-Plugin-Name attribute in the jar manifest
-
getPluginAuthor
public java.lang.String getPluginAuthor()
- Specified by:
getPluginAuthor
in interfacePluginMetadata
- Returns:
- author metadata
-
getPluginFileVersion
public java.lang.String getPluginFileVersion()
- Specified by:
getPluginFileVersion
in interfacePluginMetadata
- Returns:
- plugin file version
-
getPluginVersion
public java.lang.String getPluginVersion()
- Specified by:
getPluginVersion
in interfacePluginMetadata
- Returns:
- rundeck plugin format version
-
getPluginUrl
public java.lang.String getPluginUrl()
- Specified by:
getPluginUrl
in interfacePluginMetadata
- Returns:
- plugin URL
-
getPluginDate
public java.util.Date getPluginDate()
- Specified by:
getPluginDate
in interfacePluginMetadata
- Returns:
- build date of plugin
-
getDateLoaded
public java.util.Date getDateLoaded()
- Specified by:
getDateLoaded
in interfacePluginMetadata
- Returns:
- date loaded
-
getPluginName
public java.lang.String getPluginName()
- Specified by:
getPluginName
in interfacePluginMetadata
- Returns:
- plugin name
-
getPluginDescription
public java.lang.String getPluginDescription()
- Specified by:
getPluginDescription
in interfacePluginMetadata
- Returns:
- plugin description
-
getPluginId
public java.lang.String getPluginId()
Description copied from interface:PluginMetadata
This id is generated off of the plugin name. It is the first 12 characters of the sha256 of the plugin name. This is set automatically by the system. No need to add it manually.- Specified by:
getPluginId
in interfacePluginMetadata
- Returns:
- plugin id
-
getRundeckCompatibilityVersion
public java.lang.String getRundeckCompatibilityVersion()
- Specified by:
getRundeckCompatibilityVersion
in interfacePluginMetadata
- Returns:
- version of Rundeck with which this plugin is compatible
-
getTargetHostCompatibility
public java.lang.String getTargetHostCompatibility()
- Specified by:
getTargetHostCompatibility
in interfacePluginMetadata
- Returns:
- os family with which this plugin is compatible
-
getTags
public java.util.List<java.lang.String> getTags()
- Specified by:
getTags
in interfacePluginMetadata
- Returns:
- tags
-
getPluginLicense
public java.lang.String getPluginLicense()
- Specified by:
getPluginLicense
in interfacePluginMetadata
- Returns:
- plugin license
-
getPluginThirdPartyDependencies
public java.lang.String getPluginThirdPartyDependencies()
- Specified by:
getPluginThirdPartyDependencies
in interfacePluginMetadata
- Returns:
- plugin third party dependencies
-
getPluginSourceLink
public java.lang.String getPluginSourceLink()
- Specified by:
getPluginSourceLink
in interfacePluginMetadata
- Returns:
- link to plugin source
-
getPluginDocsLink
public java.lang.String getPluginDocsLink()
- Specified by:
getPluginDocsLink
in interfacePluginMetadata
- Returns:
- link to plugin docs
-
getPluginType
public java.lang.String getPluginType()
- Specified by:
getPluginType
in interfacePluginMetadata
- Returns:
- plugin type
-
-