Package com.jalios.jcms.plugin
Class Plugin
- java.lang.Object
-
- com.jalios.jcms.plugin.Plugin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Plugin.LabelComparator
Comparator class used to compare Plugins' labelsstatic class
Plugin.PluginComparator
Deprecated.this comparator does not properly sort complex plugins dependencies.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Date
activationRequestDate
protected java.util.Set<Plugin>
activeDependenceSet
protected java.util.Set<Plugin>
allDependenceSet
protected java.lang.String[]
appserver
protected java.lang.String
author
protected JProperties
build
protected java.lang.String
buildTime
static java.lang.String
CHANGELOG
protected static Channel
channel
protected org.jdom.Document
config
protected org.jdom.Document
configToSave
static java.lang.String
CONFIGURATION
protected java.util.Date
deactivationRequestDate
static java.lang.String
DEFAULT_ICON
static java.lang.String
DEFAULT_PREVIEW
static java.lang.String
DEFAULT_PROPERTIES_EDITOR
protected java.util.Set<Plugin>
dependenceSet
protected java.util.Map<java.lang.String,java.lang.String>
descriptionMap
static java.lang.String
DOCUMENTATION
static java.lang.String
ICON
static java.lang.String
ICON_PNG
protected boolean
isDeployed
protected boolean
isEnabled
protected boolean
isInitialized
protected boolean
isLoaded
protected boolean
isRestart
protected boolean
isStopped
protected boolean
isWarned
static java.lang.String
JAVADOC
protected java.lang.String
jcms
static org.apache.log4j.Logger
jcmsLogger
protected boolean
jsync
protected java.util.Map<java.lang.String,java.lang.String>
labelMap
protected java.lang.String
license
static java.lang.String
LICENSE
protected org.apache.log4j.Logger
logger
protected java.lang.String
name
protected int
order
protected JProperties
pluginProp
static java.lang.String
PREVIEW
static java.lang.String
PREVIEW_PNG
static java.lang.String
PROPERTIES_EDITOR
static java.lang.String
REVISION
static java.lang.String
SIGNATURE
protected java.util.Set<java.lang.String>
typeNameSet
protected java.util.Map<java.lang.Object,java.util.function.Consumer<java.lang.Object>>
unregisterMap
protected java.lang.String
url
protected java.lang.String
version
protected java.util.Set<java.lang.String>
workflowIdSet
static java.lang.String
XML_COMPONENTS
static java.lang.String
XML_DEPENDENCIES
static java.lang.String
XML_DEPENDENCY
static java.lang.String
XML_HIBERNATE
static java.lang.String
XML_OPENAPI
static java.lang.String
XML_OPENAPI_RESOURCE
static java.lang.String
XML_PRIVATE
static java.lang.String
XML_PUBLIC
static java.lang.String
XML_TYPE
static java.lang.String
XML_TYPES
static java.lang.String
XML_WEBAPP
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
checkAppServer()
Check if the plugin work with the current application serverprotected boolean
checkJCMSVersion()
Check if the plugin work with the current JCMS versionint
compareTo(Plugin o)
java.util.Set<SignatureDiffEntry>
diff()
Diff the base plugin signature and a live plugin signature.boolean
disablePlugin()
Disable this plugin.boolean
enablePlugin()
Enable this plugin.protected void
fillElementPath(java.util.Collection<java.lang.String> paths, java.util.List<org.jdom.Element> elmList, java.lang.String prefix, java.lang.String tagName, boolean deep, java.lang.String matchAttribute, java.lang.String matchValue)
protected void
fillJavaSet(org.jdom.Element itJava, java.util.Set<java.lang.String> pathSet, boolean sources)
protected void
fillPluginComponentPath(java.util.Map<java.lang.String,java.lang.String> itemMap, java.lang.String tagName, boolean sources)
java.util.Date
getActivationRequestDate()
java.util.Set<Plugin>
getActiveDependenceSet()
java.util.Set<Plugin>
getAllDependenceSet()
Returns all plugins used by this plugin recursively.java.util.Set<java.lang.String>
getAllPathSet(boolean sources, boolean generated)
Returns a Set of relative path to all Plugins filesjava.lang.String[]
getAppServer()
java.lang.String
getAuthor()
java.lang.String
getBuild(java.util.Locale userLocale)
java.lang.String
getBuildTime()
java.lang.String
getBuildTime(java.util.Locale userLocale)
java.lang.String
getChangeLog()
java.lang.String
getConfiguration()
java.util.Date
getDeactivationRequestDate()
java.util.Set<Plugin>
getDependenceSet()
java.util.Set<Plugin>
getDependentPluginSet()
Returns the set of plugins that are dependent of this plugin.java.lang.String
getDescription(java.lang.String lang)
protected java.util.Map<java.lang.String,java.lang.String>
getDescriptionMap()
java.lang.String
getDisplayedStatus(java.lang.String userLang)
get localized status with some UI containerjava.lang.String
getDocumentation()
java.util.TreeMap<java.lang.String,java.lang.String>
getEditableProperties()
Return a TreeMap that contains all plugin properties having an I18N value.java.util.Set<java.lang.String>
getHibernateMappingsPath()
Returns a Set of path to plugin's Hibernate mappings (hbm).java.lang.String
getIcon()
protected java.util.Collection<java.lang.String>
getIncludeCollection(java.lang.String tag)
Returns a Collection of JSP Relatives path to include for the given anchor.java.lang.String
getJarPath()
Returns the relative path to the packaged plugin jar sourcesjava.util.Set<java.lang.String>
getJarsPath()
Returns a Set of path to plugin's jars.java.lang.String
getJavadocHtmlLink()
java.util.Set<java.lang.String>
getJavaPath(boolean sources)
Returns a Set of path to plugin's java files.java.lang.String
getJCMSVersion()
java.lang.String
getJenkinsTag()
boolean
getJSync()
java.lang.String
getLabel(java.lang.String lang)
java.util.Map<java.lang.String,java.lang.String>
getLabelMap()
java.lang.String
getLicense()
org.apache.log4j.Logger
getLogger()
Returns the logger of the current Plugin.java.lang.String
getName()
java.util.Map<java.lang.String,java.lang.String>
getOpenAPIResourcePath(boolean sources)
Returns a Map from path of plugin's OpenAPI resources files to their uritemplate.int
getOrder()
java.lang.String
getPackageName()
java.lang.String
getPackagePath()
java.util.Set<java.io.File>
getPackageSet()
Returns a Set of File representing all package version for this plugin.java.util.Map<java.lang.String,java.lang.String>
getPluginComponentPath(boolean sources)
Returns a Map from path of plugin's components files to their nature ("storelistener", "dblistener", ...).protected <T extends PluginComponent>
java.util.List<T>getPluginComponents(java.lang.Class<T> clazz)
Convenient method to retrieve a usage of elements from the plugin configuration and create PluginComponents from attribute class Skip unresolvable types with a warning.protected <T extends PluginComponent>
java.util.List<T>getPluginComponents(java.lang.Class<T> clazz, java.lang.String tagName)
Convenient method to retrieve a usage of elements from the plugin configuration and create PluginComponents from attribute class Skip unresolvable types with a warning.java.lang.String
getPreview()
java.util.Set<java.lang.String>
getPrivatesPath()
Returns a Set of path to plugin's private files.java.lang.String
getPropertiesEditor()
protected java.lang.String
getPublicPath(java.lang.String pluginRelativePath, java.lang.String defaultPath)
java.util.Set<java.lang.String>
getPublicsPath()
Returns a Set of path to plugin's public files.Signature
getSignature()
Returns a Signature of plugin's filesjava.lang.String
getSignaturePath()
java.lang.String
getStatus()
get the status (in english) with any UI artefacts (for REST export for example).java.lang.String
getStatus(java.lang.String userLang)
Deprecated.getDisplayedStatus(String)
method should be used insteadjava.lang.String
getStatusIcons(java.lang.String userLang)
java.lang.String
getSvnRevision()
java.util.Set<java.lang.String>
getTemplatesPath()
Returns a Set of path to plugin's type's templates.java.lang.String
getTextLicense()
java.util.Set<java.lang.String>
getTypeDirectoriesPathSet()
Returns a Set of new plugin's types directory pathjava.util.Map<java.lang.String,java.util.Set<java.lang.String>>
getTypesPath(boolean sources, boolean generated)
Returns a Map of Type Mame / Relative path to declared plugin's type files Type XML Type Template XML Declared custom java Files Declared JSP Declared Resources (preview, images, ...)java.util.List<TypeTemplateEntry>
getTypeTemplateEntries()
Returns templates for given types declared in plugin configuration.java.lang.String
getUrl()
java.lang.String
getVersion()
java.util.Set<java.lang.String>
getWebappsPath()
Returns a Set of path to plugin's webapps files.java.util.Set<java.lang.String>
getWorkflowsPath()
Returns a Set of path to plugin's workflow.void
init(boolean isEnabled)
Called by PluginManager during initialization after all plugins dependencies initialized.protected void
initBuild()
void
initDependencies(boolean checkStatus)
Called by PluginManager during initialization after all plugins loads.boolean
isActive()
boolean
isDeployed()
boolean
isEnabled()
boolean
isInitialized()
boolean
isLoaded()
boolean
isMainPlugin()
Returns true if this plugin is the main plugin.boolean
isProvidingType(java.lang.String className)
Returns true if the give className is a type provided by this plugin.boolean
isProvidingWorkflow(java.lang.String wfId)
Returns true if the given Workflow is provided by this plugin.boolean
isStopped()
boolean
isWarned()
void
load(org.jdom.Document config, boolean isDeployed)
Called by PluginManager during initialization to setup main variable from config file.protected void
loadLanguageProperties(LangProperties properties, java.util.List<java.lang.String> langList)
Load language properties into channel properties.protected void
loadProperties(LangProperties properties)
Load plugin properties into channel properties.boolean
mustRestart()
boolean
performPackage(boolean sources)
Performs a package of the plugin's files.protected void
registerAlarmListener()
Register AlarmListener into the Channel declared in plugin configuration.protected void
registerAlertChannel()
Register AlertChannel declared in plugin configuration.void
registerAllComponents()
Register all components of this plugin.protected void
registerAuthenticationHandler()
Register Authentication handler into the Channel declared in plugin configuration.protected void
registerChannelListener()
Register ChannelListener into the Channel declared in plugin configuration.protected void
registerCleanFilter()
Register CleanFilter into the Channel declared in plugin configuration.protected void
registerDataController()
Register DataControllers into the Channel declared in plugin configuration.protected void
registerDBListener()
Register DBListener into the Channel declared in plugin configuration.protected void
registerHibernateMapping()
Register the Hibernate mapping filesprotected void
registerJSyncListener()
Register JSyncListeners into the Channel declared in plugin configuration.protected void
registerOpenApiResources()
Register RestResource into the Channel declared in plugin configuration.protected void
registerPolicyFilter()
Register PolicyFilter into the Channel declared in plugin configuration.protected void
registerQueryFilter()
Register QueryFilter into the Channel declared in plugin configuration.protected void
registerStoreListener(boolean beforeStoreLoad)
Register StoreListeners into the Channel declared in plugin configuration.protected void
registerTemplates()
Register templates for given types declared in plugin configuration.void
resetConfigToSave()
Clones XML document that represents plugin configuration.void
saveConfig()
void
sendRequestForActivation()
void
sendRequestForDeactivation()
void
setEnabled(boolean isEnabled)
void
setInitialized(boolean initialized)
void
setRestart(boolean restart)
void
setStopped()
void
setup()
Called by PluginManager during initialization after all plugins dependencies initialized.void
setWarned(boolean warn)
boolean
sign(boolean force)
Create a Signature of plugin's files and store it in plugin private directory.java.lang.String
toString()
void
unregisterAllComponents()
Unregister all components of this plugin.void
updateAppServer(java.lang.String[] field)
void
updateAuthor(java.lang.String field)
void
updateDescription(java.util.Map<java.lang.String,java.lang.String> descriptionMap)
void
updateInitialized(boolean field)
void
updateJarSet(java.util.Set<java.lang.String> jarSet)
void
updateJCMSVersion(java.lang.String field)
void
updateJSync(boolean field)
void
updateLabel(java.util.Map<java.lang.String,java.lang.String> labelMap)
void
updateLicense(java.lang.String field)
void
updateOrder(int field)
void
updatePrivateSet(java.util.Set<java.lang.String> privateSet)
void
updatePublicSet(java.util.Set<java.lang.String> publicSet)
void
updateTypeMap(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> map)
void
updateUrl(java.lang.String field)
void
updateVersion(java.lang.String field)
void
updateWebappSet(java.util.Set<java.lang.String> webappSet)
void
updateWorkflowSet(java.util.Set<java.lang.String> workflowSet)
-
-
-
Field Detail
-
jcmsLogger
public static org.apache.log4j.Logger jcmsLogger
-
channel
protected static Channel channel
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
SIGNATURE
public static final java.lang.String SIGNATURE
- See Also:
- Constant Field Values
-
CHANGELOG
public static final java.lang.String CHANGELOG
- See Also:
- Constant Field Values
-
DOCUMENTATION
public static final java.lang.String DOCUMENTATION
- See Also:
- Constant Field Values
-
JAVADOC
public static final java.lang.String JAVADOC
- See Also:
- Constant Field Values
-
LICENSE
public static final java.lang.String LICENSE
- See Also:
- Constant Field Values
-
PREVIEW
public static final java.lang.String PREVIEW
- See Also:
- Constant Field Values
-
PREVIEW_PNG
public static final java.lang.String PREVIEW_PNG
- See Also:
- Constant Field Values
-
ICON
public static final java.lang.String ICON
- See Also:
- Constant Field Values
-
ICON_PNG
public static final java.lang.String ICON_PNG
- See Also:
- Constant Field Values
-
CONFIGURATION
public static final java.lang.String CONFIGURATION
- See Also:
- Constant Field Values
-
PROPERTIES_EDITOR
public static final java.lang.String PROPERTIES_EDITOR
- See Also:
- Constant Field Values
-
DEFAULT_PROPERTIES_EDITOR
public static final java.lang.String DEFAULT_PROPERTIES_EDITOR
- See Also:
- Constant Field Values
-
DEFAULT_PREVIEW
public static final java.lang.String DEFAULT_PREVIEW
- See Also:
- Constant Field Values
-
DEFAULT_ICON
public static final java.lang.String DEFAULT_ICON
- See Also:
- Constant Field Values
-
XML_PRIVATE
public static final java.lang.String XML_PRIVATE
- See Also:
- Constant Field Values
-
XML_PUBLIC
public static final java.lang.String XML_PUBLIC
- See Also:
- Constant Field Values
-
XML_WEBAPP
public static final java.lang.String XML_WEBAPP
- See Also:
- Constant Field Values
-
XML_TYPES
public static final java.lang.String XML_TYPES
- See Also:
- Constant Field Values
-
XML_TYPE
public static final java.lang.String XML_TYPE
- See Also:
- Constant Field Values
-
XML_DEPENDENCIES
public static final java.lang.String XML_DEPENDENCIES
- See Also:
- Constant Field Values
-
XML_DEPENDENCY
public static final java.lang.String XML_DEPENDENCY
- See Also:
- Constant Field Values
-
XML_COMPONENTS
public static final java.lang.String XML_COMPONENTS
- See Also:
- Constant Field Values
-
XML_HIBERNATE
public static final java.lang.String XML_HIBERNATE
- See Also:
- Constant Field Values
-
XML_OPENAPI
public static final java.lang.String XML_OPENAPI
- See Also:
- Constant Field Values
-
XML_OPENAPI_RESOURCE
public static final java.lang.String XML_OPENAPI_RESOURCE
- See Also:
- Constant Field Values
-
config
protected org.jdom.Document config
-
configToSave
protected org.jdom.Document configToSave
-
logger
protected org.apache.log4j.Logger logger
-
isDeployed
protected boolean isDeployed
-
isLoaded
protected boolean isLoaded
-
isInitialized
protected boolean isInitialized
-
isEnabled
protected boolean isEnabled
-
isStopped
protected boolean isStopped
-
isWarned
protected boolean isWarned
-
isRestart
protected boolean isRestart
-
activationRequestDate
protected java.util.Date activationRequestDate
-
deactivationRequestDate
protected java.util.Date deactivationRequestDate
-
name
protected java.lang.String name
-
version
protected java.lang.String version
-
jcms
protected java.lang.String jcms
-
order
protected int order
-
dependenceSet
protected java.util.Set<Plugin> dependenceSet
-
activeDependenceSet
protected java.util.Set<Plugin> activeDependenceSet
-
allDependenceSet
protected java.util.Set<Plugin> allDependenceSet
-
jsync
protected boolean jsync
-
appserver
protected java.lang.String[] appserver
-
url
protected java.lang.String url
-
author
protected java.lang.String author
-
license
protected java.lang.String license
-
labelMap
protected java.util.Map<java.lang.String,java.lang.String> labelMap
-
descriptionMap
protected java.util.Map<java.lang.String,java.lang.String> descriptionMap
-
typeNameSet
protected java.util.Set<java.lang.String> typeNameSet
-
workflowIdSet
protected java.util.Set<java.lang.String> workflowIdSet
-
pluginProp
protected JProperties pluginProp
-
unregisterMap
protected java.util.Map<java.lang.Object,java.util.function.Consumer<java.lang.Object>> unregisterMap
-
build
protected JProperties build
-
buildTime
protected java.lang.String buildTime
-
-
Method Detail
-
load
public void load(org.jdom.Document config, boolean isDeployed)
Called by PluginManager during initialization to setup main variable from config file. Do not access other plugins because they might not been already loadded wait init() method- Parameters:
config
- JDOM Document of config plugin fileisDeployed
- true if the plugin has been deployed
-
getJarPath
public java.lang.String getJarPath()
Returns the relative path to the packaged plugin jar sources- Returns:
- String path to plugin jar
-
performPackage
public boolean performPackage(boolean sources)
Performs a package of the plugin's files. Java files and classes will be bundled in a jar file.- Parameters:
sources
- boolean true to include java source files in the package- Returns:
- boolean true if perform has been done
-
getPackageSet
public java.util.Set<java.io.File> getPackageSet()
Returns a Set of File representing all package version for this plugin.- Returns:
- Set of File
-
initDependencies
public void initDependencies(boolean checkStatus)
Called by PluginManager during initialization after all plugins loads.- Parameters:
checkStatus
- true to check if depending plugin are available
-
getAllDependenceSet
public java.util.Set<Plugin> getAllDependenceSet()
Returns all plugins used by this plugin recursively. TODO: Cache the Set- Returns:
- Set of Plugin used by this plugin
-
getDependentPluginSet
public java.util.Set<Plugin> getDependentPluginSet()
Returns the set of plugins that are dependent of this plugin. If isActive true returns only plugins that are dependent is active state.- Returns:
- the set of plugins that are dependent of this plugin.
- Since:
- jcms-10.0.0
-
init
public void init(boolean isEnabled)
Called by PluginManager during initialization after all plugins dependencies initialized. Called juste after PluginManager Initialisation:- Plugin order declaration is respected.
- Channel not completly initialised
- Properties not loaded.
- Parameters:
isEnabled
- indicates if the plugin is enabled or not.
-
setup
public void setup()
Called by PluginManager during initialization after all plugins dependencies initialized.- Plugin order declaration is respected.
- Properties loaded.
-
checkAppServer
protected boolean checkAppServer()
Check if the plugin work with the current application server- Returns:
- boolean true if it work with current application server
-
checkJCMSVersion
protected boolean checkJCMSVersion()
Check if the plugin work with the current JCMS version- Returns:
- boolean true if it work with current JCMS version
-
sign
public boolean sign(boolean force)
Create a Signature of plugin's files and store it in plugin private directory.- Parameters:
force
- generate signature even if file exists- Returns:
- boolean false if the signature has not been created
-
diff
public java.util.Set<SignatureDiffEntry> diff()
Diff the base plugin signature and a live plugin signature.- Returns:
- a Set of SignatureDiffEntry
-
getSignature
public Signature getSignature()
Returns a Signature of plugin's files- Returns:
- Signature of plugin's files
-
getTypeTemplateEntries
public java.util.List<TypeTemplateEntry> getTypeTemplateEntries()
Returns templates for given types declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- Returns:
- List of TypeTemplateEntry
- Since:
- jcms-6.0.0
-
registerTemplates
protected void registerTemplates()
Register templates for given types declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- Since:
- jcms-6.0.0
-
getIncludeCollection
protected java.util.Collection<java.lang.String> getIncludeCollection(java.lang.String tag)
Returns a Collection of JSP Relatives path to include for the given anchor.- Parameters:
tag
- the anchor to use- Returns:
- a Collection of JSP Relatives path to include for the given anchor.
-
registerAllComponents
public void registerAllComponents()
Register all components of this plugin.- Since:
- jcms-10.0.0
-
unregisterAllComponents
public void unregisterAllComponents()
Unregister all components of this plugin.- Since:
- jcms-10.0.0
-
enablePlugin
public boolean enablePlugin()
Enable this plugin.- Returns:
- true if this plugin has been successfully enabled.
- Since:
- jcms-10.0.0
-
disablePlugin
public boolean disablePlugin()
Disable this plugin.- Returns:
- true if this plugin has been successfully disabled.
- Since:
- jcms-10.0.0
-
registerStoreListener
protected void registerStoreListener(boolean beforeStoreLoad)
Register StoreListeners into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- Parameters:
beforeStoreLoad
- boolean true before loading store
-
registerDBListener
protected void registerDBListener()
Register DBListener into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.
-
registerJSyncListener
protected void registerJSyncListener()
Register JSyncListeners into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.
-
registerDataController
protected void registerDataController()
Register DataControllers into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.
-
registerAlarmListener
protected void registerAlarmListener()
Register AlarmListener into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.
-
registerAlertChannel
protected void registerAlertChannel()
Register AlertChannel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.
-
registerChannelListener
protected void registerChannelListener()
Register ChannelListener into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- See Also:
getPluginComponents(Class)
-
registerQueryFilter
protected void registerQueryFilter()
Register QueryFilter into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- See Also:
getPluginComponents(Class)
-
registerCleanFilter
protected void registerCleanFilter()
Register CleanFilter into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- See Also:
getPluginComponents(Class)
-
registerPolicyFilter
protected void registerPolicyFilter()
Register PolicyFilter into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- See Also:
getPluginComponents(Class)
-
registerAuthenticationHandler
protected void registerAuthenticationHandler()
Register Authentication handler into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.- See Also:
getPluginComponents(Class)
-
getPluginComponents
protected <T extends PluginComponent> java.util.List<T> getPluginComponents(java.lang.Class<T> clazz)
Convenient method to retrieve a usage of elements from the plugin configuration and create PluginComponents from attribute class Skip unresolvable types with a warning. Registration process will not be broken because Plugins types not available.- Type Parameters:
T
- A PluginComponent type- Parameters:
clazz
- the PluginComponent class- Returns:
- List a list of PluginItem (should never be null)
-
getPluginComponents
protected <T extends PluginComponent> java.util.List<T> getPluginComponents(java.lang.Class<T> clazz, java.lang.String tagName)
Convenient method to retrieve a usage of elements from the plugin configuration and create PluginComponents from attribute class Skip unresolvable types with a warning. Registration process will not be broken because Plugins types not available.- Type Parameters:
T
- A PluginComponent type- Parameters:
clazz
- the PluginComponent classtagName
- the name of the tag used in plugin.xml- Returns:
- List a list of PluginItem (should never be null)
-
registerHibernateMapping
protected void registerHibernateMapping()
Register the Hibernate mapping files
-
registerOpenApiResources
protected void registerOpenApiResources()
Register RestResource into the Channel declared in plugin configuration. Skip unresolvable types with a warning. Registration process will not be broken because Plugins may target types not available.
-
loadProperties
protected void loadProperties(LangProperties properties)
Load plugin properties into channel properties. Properties must be stored in "WEB-INF/plugins/Plugin/properties/" and ends with ".prop".- Parameters:
properties
- the channel properties
-
loadLanguageProperties
protected void loadLanguageProperties(LangProperties properties, java.util.List<java.lang.String> langList)
Load language properties into channel properties. Properties must be stored in "WEB-INF/plugins/Plugin/properties/languages" and ends with ".prop".- Parameters:
properties
- the channel propertieslangList
- the lang list of JCMS
-
getEditableProperties
public java.util.TreeMap<java.lang.String,java.lang.String> getEditableProperties()
Return a TreeMap that contains all plugin properties having an I18N value. Skip properties starting with "extra."- Returns:
- TreeMap
-
getAllPathSet
public java.util.Set<java.lang.String> getAllPathSet(boolean sources, boolean generated)
Returns a Set of relative path to all Plugins files- Parameters:
sources
- include java sources in the pathgenerated
- include generated files- Returns:
- Set a set of relatives path
-
getTypeDirectoriesPathSet
public java.util.Set<java.lang.String> getTypeDirectoriesPathSet()
Returns a Set of new plugin's types directory path- Returns:
- Set of String representing types's directories
-
getTypesPath
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getTypesPath(boolean sources, boolean generated)
Returns a Map of Type Mame / Relative path to declared plugin's type files- Type XML
- Type Template XML
- Declared custom java Files
- Declared JSP
- Declared Resources (preview, images, ...)
- Parameters:
sources
- include java sources in the pathgenerated
- include generated content- Returns:
- Set a set of relatives path
-
getWorkflowsPath
public java.util.Set<java.lang.String> getWorkflowsPath()
Returns a Set of path to plugin's workflow.- Returns:
- Set of path
-
getJarsPath
public java.util.Set<java.lang.String> getJarsPath()
Returns a Set of path to plugin's jars.- Returns:
- Set of path
-
getJavaPath
public java.util.Set<java.lang.String> getJavaPath(boolean sources)
Returns a Set of path to plugin's java files.- Parameters:
sources
- boolean true to include java files- Returns:
- Set of path
-
getHibernateMappingsPath
public java.util.Set<java.lang.String> getHibernateMappingsPath()
Returns a Set of path to plugin's Hibernate mappings (hbm).- Returns:
- Set of path
- Since:
- jcms-6.0.0
-
getTemplatesPath
public java.util.Set<java.lang.String> getTemplatesPath()
Returns a Set of path to plugin's type's templates.- Returns:
- Set of path
-
getPublicsPath
public java.util.Set<java.lang.String> getPublicsPath()
Returns a Set of path to plugin's public files.- Returns:
- Set of path
-
getPrivatesPath
public java.util.Set<java.lang.String> getPrivatesPath()
Returns a Set of path to plugin's private files.- Returns:
- Set of path
-
getWebappsPath
public java.util.Set<java.lang.String> getWebappsPath()
Returns a Set of path to plugin's webapps files.- Returns:
- Set of path
-
getPluginComponentPath
public java.util.Map<java.lang.String,java.lang.String> getPluginComponentPath(boolean sources)
Returns a Map from path of plugin's components files to their nature ("storelistener", "dblistener", ...).- Parameters:
sources
- boolean true to include java files- Returns:
- Map of path ==> nature of plugin component
-
getOpenAPIResourcePath
public java.util.Map<java.lang.String,java.lang.String> getOpenAPIResourcePath(boolean sources)
Returns a Map from path of plugin's OpenAPI resources files to their uritemplate.- Parameters:
sources
- boolean true to include java files- Returns:
- Map of path of resource class ==> uri template
-
fillElementPath
protected void fillElementPath(java.util.Collection<java.lang.String> paths, java.util.List<org.jdom.Element> elmList, java.lang.String prefix, java.lang.String tagName, boolean deep, java.lang.String matchAttribute, java.lang.String matchValue)
-
fillJavaSet
protected void fillJavaSet(org.jdom.Element itJava, java.util.Set<java.lang.String> pathSet, boolean sources)
-
fillPluginComponentPath
protected void fillPluginComponentPath(java.util.Map<java.lang.String,java.lang.String> itemMap, java.lang.String tagName, boolean sources)
-
resetConfigToSave
public void resetConfigToSave()
Clones XML document that represents plugin configuration. This method should be called before calling updateXXX() methods.
-
saveConfig
public void saveConfig()
-
updateLabel
public void updateLabel(java.util.Map<java.lang.String,java.lang.String> labelMap)
-
updateDescription
public void updateDescription(java.util.Map<java.lang.String,java.lang.String> descriptionMap)
-
updateInitialized
public void updateInitialized(boolean field)
-
updateVersion
public void updateVersion(java.lang.String field)
-
updateJCMSVersion
public void updateJCMSVersion(java.lang.String field)
-
updateOrder
public void updateOrder(int field)
-
updateUrl
public void updateUrl(java.lang.String field)
-
updateAuthor
public void updateAuthor(java.lang.String field)
-
updateLicense
public void updateLicense(java.lang.String field)
-
updateJSync
public void updateJSync(boolean field)
-
updateAppServer
public void updateAppServer(java.lang.String[] field)
-
updateWorkflowSet
public void updateWorkflowSet(java.util.Set<java.lang.String> workflowSet)
-
updateJarSet
public void updateJarSet(java.util.Set<java.lang.String> jarSet)
-
updatePrivateSet
public void updatePrivateSet(java.util.Set<java.lang.String> privateSet)
-
updatePublicSet
public void updatePublicSet(java.util.Set<java.lang.String> publicSet)
-
updateWebappSet
public void updateWebappSet(java.util.Set<java.lang.String> webappSet)
-
updateTypeMap
public void updateTypeMap(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> map)
-
getLogger
public org.apache.log4j.Logger getLogger()
Returns the logger of the current Plugin. In current implemenation, returned logger is used by JCMS GUI to display Plugin's logs.- Returns:
- Logger the logger
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isDeployed
public boolean isDeployed()
-
isStopped
public boolean isStopped()
-
isLoaded
public boolean isLoaded()
-
isInitialized
public boolean isInitialized()
-
setInitialized
public void setInitialized(boolean initialized)
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean isEnabled)
-
getActivationRequestDate
public java.util.Date getActivationRequestDate()
-
getDeactivationRequestDate
public java.util.Date getDeactivationRequestDate()
-
setStopped
public void setStopped()
-
setRestart
public void setRestart(boolean restart)
-
mustRestart
public boolean mustRestart()
-
isWarned
public boolean isWarned()
-
setWarned
public void setWarned(boolean warn)
-
getName
public java.lang.String getName()
-
getVersion
public java.lang.String getVersion()
-
isActive
public boolean isActive()
-
initBuild
protected void initBuild()
-
getBuild
public java.lang.String getBuild(java.util.Locale userLocale)
-
getSvnRevision
public java.lang.String getSvnRevision()
-
getJenkinsTag
public java.lang.String getJenkinsTag()
-
getBuildTime
public java.lang.String getBuildTime(java.util.Locale userLocale)
-
getBuildTime
public java.lang.String getBuildTime()
-
getJCMSVersion
public java.lang.String getJCMSVersion()
-
getOrder
public int getOrder()
-
getJSync
public boolean getJSync()
-
getAppServer
public java.lang.String[] getAppServer()
-
getUrl
public java.lang.String getUrl()
-
getAuthor
public java.lang.String getAuthor()
-
getLicense
public java.lang.String getLicense()
-
getLabel
public java.lang.String getLabel(java.lang.String lang)
-
getDescription
public java.lang.String getDescription(java.lang.String lang)
-
getDependenceSet
public java.util.Set<Plugin> getDependenceSet()
-
getActiveDependenceSet
public java.util.Set<Plugin> getActiveDependenceSet()
-
getLabelMap
public java.util.Map<java.lang.String,java.lang.String> getLabelMap()
-
getDescriptionMap
protected java.util.Map<java.lang.String,java.lang.String> getDescriptionMap()
-
getPackageName
public java.lang.String getPackageName()
-
getPackagePath
public java.lang.String getPackagePath()
-
getStatus
public java.lang.String getStatus()
get the status (in english) with any UI artefacts (for REST export for example).- Returns:
- the status o the plugin
-
getStatus
public java.lang.String getStatus(java.lang.String userLang)
Deprecated.getDisplayedStatus(String)
method should be used insteadget localized status with some UI container- Parameters:
userLang
- the user language to display status- Returns:
- the displayed status of the plugin
-
getDisplayedStatus
public java.lang.String getDisplayedStatus(java.lang.String userLang)
get localized status with some UI container- Parameters:
userLang
- the user language to display status- Returns:
- the displayed status of the plugin
-
getStatusIcons
public java.lang.String getStatusIcons(java.lang.String userLang)
-
getPropertiesEditor
public java.lang.String getPropertiesEditor()
-
getPreview
public java.lang.String getPreview()
- Returns:
- PNG version "docs/images/preview.png" (
PREVIEW_PNG
) if exists, else, JPG version "docs/images/preview.jpg" (PREVIEW
) if exists, else, default preview "images/jalios/logos/puzzle.jpg" (DEFAULT_PREVIEW
)
-
getIcon
public java.lang.String getIcon()
- Returns:
- PNG version "docs/images/icon.png" (
ICON_PNG
) if exists, else, GIF version "docs/images/icon.gif" (ICON
) if exists, else, default icon "images/jalios/icons/plugin.gif" (DEFAULT_ICON
)
-
getChangeLog
public java.lang.String getChangeLog()
-
getTextLicense
public java.lang.String getTextLicense()
-
getDocumentation
public java.lang.String getDocumentation()
-
getJavadocHtmlLink
public java.lang.String getJavadocHtmlLink()
-
getConfiguration
public java.lang.String getConfiguration()
-
getSignaturePath
public java.lang.String getSignaturePath()
-
getPublicPath
protected java.lang.String getPublicPath(java.lang.String pluginRelativePath, java.lang.String defaultPath)
-
isMainPlugin
public boolean isMainPlugin()
Returns true if this plugin is the main plugin.- Returns:
- true if this plugin is the main plugin.
- Since:
- jcms-8.0.1
-
compareTo
public int compareTo(Plugin o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Plugin>
-
isProvidingType
public boolean isProvidingType(java.lang.String className)
Returns true if the give className is a type provided by this plugin.- Parameters:
className
- the class name of type.- Returns:
- true if the give className is a type provided by this plugin.
- Since:
- jcms-10.0.0
-
isProvidingWorkflow
public boolean isProvidingWorkflow(java.lang.String wfId)
Returns true if the given Workflow is provided by this plugin.- Parameters:
wfId
- the workflow ID.- Returns:
- true if the given Workflow is provided by this plugin.
- Since:
- jcms-10.0.0
-
sendRequestForActivation
public void sendRequestForActivation()
-
sendRequestForDeactivation
public void sendRequestForDeactivation()
-
-