@Component @Named(value="extension") @Singleton public class ExtensionManagerScriptService extends AbstractExtensionScriptService
Namespaces are ways to isolate extensions in a particular context, they are generally prefixed with the type of
context. For example to install an extension in a namespace linked to a particular wiki the namespace is prefixed
with wiki:
which gives for the wiki wiki1
: wiki:wiki1
.
Modifier and Type | Field and Description |
---|---|
static String |
EXTENSION_JOBID_PREFIX
Deprecated.
since 8.2RC1, use
ExtensionRequest.JOBID_PREFIX instead |
static String |
EXTENSIONACTION_JOBID_PREFIX
Deprecated.
since 8.2RC1, use
ExtensionRequest.JOBID_ACTION_PREFIX instead |
static String |
EXTENSIONPLAN_JOBID_PREFIX
Deprecated.
since 8.2RC1, use
ExtensionRequest.JOBID_PLAN_PREFIX instead |
static String |
ROLEHINT
The role hint of this component.
|
authorization, documentAccessBridge, execution, EXTENSIONERROR_KEY, jobExecutor, PROPERTY_CALLERREFERENCE, PROPERTY_CHECKRIGHTS, PROPERTY_CONTEXT_ACTION, PROPERTY_CONTEXT_WIKI, PROPERTY_USERREFERENCE, scriptProvider, WIKI_NAMESPACE_PREFIX, xcontextProvider
Constructor and Description |
---|
ExtensionManagerScriptService() |
Modifier and Type | Method and Description |
---|---|
org.xwiki.extension.ExtensionDependency |
createExtensionDependency(String id,
String versionConstraint)
Creates an extension dependency object.
|
org.xwiki.extension.ExtensionDependency |
createExtensionDependency(String id,
String versionConstraint,
boolean optional)
Creates an extension dependency object.
|
org.xwiki.extension.ExtensionId |
createExtensionId(String id,
String version)
Create an instance of
ExtensionId . |
org.xwiki.job.Job |
createInstallPlan(org.xwiki.extension.job.InstallRequest installRequest)
Start the asynchronous installation plan creation process for an extension.
|
org.xwiki.job.Job |
createInstallPlan(String id,
String version,
String namespace)
Start the asynchronous installation plan creation process for an extension.
|
org.xwiki.extension.job.InstallRequest |
createInstallPlanRequest(String id,
String version,
String namespace)
Create an
InstallRequest instance based on given parameters, to be used to create the install plan. |
org.xwiki.extension.job.InstallRequest |
createInstallRequest(String id,
String version,
String namespace)
Create an
InstallRequest instance based on passed parameters. |
org.xwiki.job.Job |
createUninstallPlan(org.xwiki.extension.ExtensionId extensionId)
Start the asynchronous uninstallation plan creation process for an extension if no other job is in progress
already.
|
org.xwiki.job.Job |
createUninstallPlan(String id,
String namespace)
Start the asynchronous uninstallation plan creation process for an extension.
|
org.xwiki.job.Job |
createUninstallPlan(org.xwiki.extension.job.UninstallRequest uninstallRequest)
Adds a new job to the job queue to perform the given uninstall plan request.
|
org.xwiki.extension.job.UninstallRequest |
createUninstallRequest()
Create an
UninstallRequest instance. |
org.xwiki.extension.job.UninstallRequest |
createUninstallRequest(String id,
String namespace)
Create an
UninstallRequest instance based on passed parameters. |
org.xwiki.job.Job |
createUpgradePlan()
Start the asynchronous upgrade plan creation process for all the namespaces.
|
org.xwiki.job.Job |
createUpgradePlan(org.xwiki.extension.job.InstallRequest request)
Schedule the upgrade plan creation job.
|
org.xwiki.job.Job |
createUpgradePlan(String namespace)
Start the asynchronous upgrade plan creation process for the provided namespace.
|
org.xwiki.extension.job.InstallRequest |
createUpgradePlanRequest(org.xwiki.extension.ExtensionId extensionId,
String namespace)
Create a request used when asking for the upgrade plan of an extension on a namespace.
|
org.xwiki.extension.job.InstallRequest |
createUpgradePlanRequest(String namespace)
Create a request used when asking for the upgrade plan on a namespace.
|
<S extends org.xwiki.script.service.ScriptService> |
get(String serviceName) |
org.xwiki.extension.Extension |
getAccessibleExtension(String feature,
org.xwiki.component.namespace.Namespace namespace)
Get the accessible (i.e.
|
Map<String,Collection<org.xwiki.extension.InstalledExtension>> |
getBackwardDependencies(String feature,
String version)
Deprecated.
since 5.3M1, use
InstalledExtensionScriptService.getBackwardDependencies(String) instead |
org.xwiki.extension.CoreExtension |
getCoreExtension(String feature)
Deprecated.
since 5.3M1, use
CoreExtensionScriptService.getCoreExtension(String) instead |
Collection<org.xwiki.extension.CoreExtension> |
getCoreExtensions()
Deprecated.
since 5.3M1, use
CoreExtensionScriptService.getCoreExtensions() instead |
org.xwiki.job.Job |
getCurrentJob()
Get a reference to the currently job executed.
|
org.xwiki.job.event.status.JobStatus |
getCurrentJobStatus()
Get the status of the currently executing job, if any.
|
org.xwiki.job.event.status.JobStatus |
getExtensionJobStatus(String extensionId,
String namespace)
Return job status corresponding to the provided extension id from the current executed job or stored history.
|
org.xwiki.job.event.status.JobStatus |
getExtensionPlanJobStatus(String extensionId,
String namespace)
Return extension plan corresponding to the provided extension id from the current executed job or stored history.
|
org.xwiki.extension.InstalledExtension |
getInstalledExtension(String feature,
String namespace)
Deprecated.
since 5.3M1, use
InstalledExtensionScriptService.getInstalledExtension(String, String)
instead |
Collection<org.xwiki.extension.InstalledExtension> |
getInstalledExtensions()
Deprecated.
since 5.3M1, use
InstalledExtensionScriptService.getInstalledExtensions() instead |
Collection<org.xwiki.extension.InstalledExtension> |
getInstalledExtensions(String namespace)
Deprecated.
since 5.3M1, use
InstalledExtensionScriptService.getInstalledExtensions(String) instead |
Collection<org.xwiki.extension.LocalExtension> |
getLocalExtensions()
Deprecated.
since 5.3M1, use
LocalExtensionScriptService.getLocalExtensions() |
Collection<org.xwiki.extension.repository.ExtensionRepository> |
getRepositories() |
org.xwiki.extension.repository.ExtensionRepository |
getRepository(String repositoryId) |
org.xwiki.job.Job |
install(org.xwiki.extension.job.InstallRequest installRequest)
Start the asynchronous installation process for an extension if the context document has programming rights.
|
org.xwiki.job.Job |
install(String id,
String version,
String namespace)
Start the asynchronous installation process for an extension if the context document has programming rights.
|
boolean |
isAllowed(Collection<String> allowedNamespaces,
String namespace) |
boolean |
isAllowed(org.xwiki.extension.Extension extension,
String namespace) |
org.xwiki.extension.repository.search.ExtensionQuery |
newQuery(String query)
Create a new instance of a
ExtensionQuery to be used in other APIs. |
org.xwiki.extension.version.Version |
parseVersion(String version) |
org.xwiki.extension.version.VersionConstraint |
parseVersionConstraint(String versionConstraint) |
org.xwiki.extension.version.VersionRange |
parseVersionRange(String versionRange) |
org.xwiki.extension.Extension |
resolve(org.xwiki.extension.ExtensionDependency extensionDependency)
Deprecated.
since 5.3M1, use
resolve(ExtensionDependency, String) instead |
org.xwiki.extension.Extension |
resolve(org.xwiki.extension.ExtensionDependency extensionDependency,
String namespace)
Search the provided extension as a dependency of another extension among all repositories including core and
local repositories.
|
org.xwiki.extension.Extension |
resolve(String id,
String version)
Get the extension handler corresponding to the given extension ID and version.
|
org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.version.Version> |
resolveVersions(String id,
int offset,
int nb)
Return ordered (ascendent) versions for the provided extension id.
|
org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.Extension> |
search(org.xwiki.extension.repository.search.ExtensionQuery query)
Search among all remote (those listed in xwiki.properties)
AdvancedSearchable repositories for extensions matching the search
query. |
org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.Extension> |
search(String pattern,
int offset,
int nb)
Search among all remote (those listed in xwiki.properties)
Searchable repositories for extensions matching the search terms. |
org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.Extension> |
searchAccessibleExtensions(org.xwiki.component.namespace.Namespace namespace,
org.xwiki.extension.repository.search.ExtensionQuery query)
Search accessible (i.e.
|
org.xwiki.job.Job |
uninstall(org.xwiki.extension.ExtensionId extensionId)
Start the asynchronous uninstall process for an extension if the context document has programming rights.
|
org.xwiki.job.Job |
uninstall(String id,
String namespace)
Start the asynchronous uninstall process for an extension if the context document has programming rights.
|
org.xwiki.job.Job |
uninstall(org.xwiki.extension.job.UninstallRequest uninstallRequest)
Adds a new job to the job queue to perform the given uninstall request.
|
contextualize, fromWikitoNamespace, getCallerDocument, getJobStatus, getLastError, safe, safeWrapError, setError, setRightsProperties, toWikiId, wrapError
public static final String ROLEHINT
@Deprecated public static final String EXTENSION_JOBID_PREFIX
ExtensionRequest.JOBID_PREFIX
instead@Deprecated public static final String EXTENSIONACTION_JOBID_PREFIX
ExtensionRequest.JOBID_ACTION_PREFIX
instead@Deprecated public static final String EXTENSIONPLAN_JOBID_PREFIX
ExtensionRequest.JOBID_PLAN_PREFIX
insteadpublic <S extends org.xwiki.script.service.ScriptService> S get(String serviceName)
S
- the type of the ScriptService
serviceName
- the name of the sub ScriptService
ScriptService
or null of none could be foundpublic Collection<org.xwiki.extension.repository.ExtensionRepository> getRepositories()
public org.xwiki.extension.repository.ExtensionRepository getRepository(String repositoryId)
repositoryId
- the identifier of the remote repositorypublic org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.Extension> search(String pattern, int offset, int nb)
Searchable
repositories for extensions matching the search terms.pattern
- the words to search foroffset
- the offset from where to start returning search results, 0-basednb
- the maximum number of search results to return. -1 indicate no limit. 0 indicate that no result will be
returned but it can be used to get the total hits.Searchable
public org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.Extension> search(org.xwiki.extension.repository.search.ExtensionQuery query)
AdvancedSearchable
repositories for extensions matching the search
query.query
- the search querySearchable
public org.xwiki.extension.repository.search.ExtensionQuery newQuery(String query)
ExtensionQuery
to be used in other APIs.query
- the query to executeExtensionQuery
instancepublic org.xwiki.extension.Extension resolve(String id, String version)
id
- the extension id or provided feature (virtual extension) of the extension to resolveversion
- the specific version to resolvenull
if the extension couldn't
be resolved, in which case AbstractExtensionScriptService.getLastError()
contains the failure reason@Deprecated public org.xwiki.extension.Extension resolve(org.xwiki.extension.ExtensionDependency extensionDependency)
resolve(ExtensionDependency, String)
insteadextensionDependency
- the extension dependency to resolvenull
if the extension couldn't
be resolved, in which case AbstractExtensionScriptService.getLastError()
contains the failure reasonpublic org.xwiki.extension.Extension resolve(org.xwiki.extension.ExtensionDependency extensionDependency, String namespace)
The search is done in the following order:
extensionDependency
- the extension dependency to resolvenamespace
- the namespace where to search for the dependencynull
if the extension couldn't
be resolved, in which case AbstractExtensionScriptService.getLastError()
contains the failure reasonpublic org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.version.Version> resolveVersions(String id, int offset, int nb)
id
- the id of the extensions for which to return versionsoffset
- the offset from where to start returning versionsnb
- the maximum number of versions to returnpublic org.xwiki.extension.ExtensionId createExtensionId(String id, String version)
ExtensionId
.id
- the id of the extensionversion
- the version of the extensionExtensionId
instancepublic org.xwiki.extension.job.InstallRequest createInstallRequest(String id, String version, String namespace)
InstallRequest
instance based on passed parameters.id
- the identifier of the extension to installversion
- the version to installnamespace
- the (optional) namespace where to install the extension; if null
or empty, the extension
will be installed in root namespace (globally)InstallRequest
public org.xwiki.job.Job install(String id, String version, String namespace)
id
- the identifier of the extension to installversion
- the version to installnamespace
- the (optional) namespace where to install the extension; if null
or empty, the extension
will be installed globallyJob
object which can be used to monitor the progress of the installation process, or
null
in case of failurepublic org.xwiki.job.Job install(org.xwiki.extension.job.InstallRequest installRequest)
installRequest
- installation instructionsJob
object which can be used to monitor the progress of the installation process, or
null
in case of failurepublic org.xwiki.extension.job.InstallRequest createInstallPlanRequest(String id, String version, String namespace)
InstallRequest
instance based on given parameters, to be used to create the install plan.id
- the identifier of the extension to installversion
- the version to installnamespace
- the (optional) namespace where to install the extension; if null
or empty, the extension
will be installed in root namespace (globally)InstallRequest
public org.xwiki.job.Job createInstallPlan(org.xwiki.extension.job.InstallRequest installRequest)
installRequest
- installation instructionsJob
object which can be used to monitor the progress of the installation process, or
null
in case of failurepublic org.xwiki.job.Job createInstallPlan(String id, String version, String namespace)
id
- the identifier of the extension to installversion
- the version to installnamespace
- the (optional) namespace where to install the extension; if null
or empty, the extension
will be installed globallyJob
object which can be used to monitor the progress of the installation process, or
null
in case of failurepublic org.xwiki.job.Job uninstall(String id, String namespace)
Only uninstall from the provided namespace.
id
- the identifier of the extension to removenamespace
- the (optional) namespace from where to uninstall the extension; if null
or empty, the
extension will be installed globallyJob
object which can be used to monitor the progress of the uninstallation process, or
null
in case of failurepublic org.xwiki.job.Job uninstall(org.xwiki.extension.ExtensionId extensionId)
Uninstall from all namespaces.
extensionId
- the identifier of the extension to removeJob
object which can be used to monitor the progress of the uninstallation process, or
null
in case of failurepublic org.xwiki.job.Job uninstall(org.xwiki.extension.job.UninstallRequest uninstallRequest)
This method requires programming rights.
uninstallRequest
- the uninstall request to performJob
object which can be used to monitor the progress of the uninstall process, or
null
in case of failurepublic org.xwiki.extension.job.UninstallRequest createUninstallRequest(String id, String namespace)
UninstallRequest
instance based on passed parameters.
Only uninstall from the provided namespace.
id
- the identifier of the extension to uninstallnamespace
- the (optional) namespace from where to uninstall the extension; if null
or empty, the
extension will be removed from root namespaceUninstallRequest
public org.xwiki.extension.job.UninstallRequest createUninstallRequest()
UninstallRequest
instance.UninstallRequest
public org.xwiki.job.Job createUninstallPlan(String id, String namespace)
Only uninstall from the provided namespace.
id
- the identifier of the extension to uninstallnamespace
- the (optional) namespace from where to uninstall the extension; if null
or empty, the
extension will be removed from root namespaceJob
object which can be used to monitor the progress of the installation process, or
null
in case of failurepublic org.xwiki.job.Job createUninstallPlan(org.xwiki.extension.ExtensionId extensionId)
Uninstall from all namespaces.
extensionId
- the identifier of the extension that is going to be removedJob
object which can be used to monitor the progress of the installation process, or
null
in case of failurepublic org.xwiki.job.Job createUninstallPlan(org.xwiki.extension.job.UninstallRequest uninstallRequest)
This method requires programming rights.
uninstallRequest
- the uninstall plan request to performJob
object which can be used to monitor the progress of the uninstall plan process, or
null
in case of failurepublic org.xwiki.extension.job.InstallRequest createUpgradePlanRequest(String namespace)
namespace
- the namespace to upgradepublic org.xwiki.extension.job.InstallRequest createUpgradePlanRequest(org.xwiki.extension.ExtensionId extensionId, String namespace)
extensionId
- the id of the extensionnamespace
- the namespace to upgradepublic org.xwiki.job.Job createUpgradePlan(org.xwiki.extension.job.InstallRequest request)
request
- the request to pass to pass to the upgrade plan jobJob
object which can be used to monitor the progress of the upgrade plan creation process, or
null
in case of failurepublic org.xwiki.job.Job createUpgradePlan(String namespace)
namespace
- the namespace where to upgrade the extensionsJob
object which can be used to monitor the progress of the plan creation process, or
null
in case of failurepublic org.xwiki.job.Job createUpgradePlan()
Job
object which can be used to monitor the progress of the plan creation process, or
null
in case of failurepublic org.xwiki.job.Job getCurrentJob()
Current here basically means the extension related job that is going to block any new job that would be associated to the current namespace.
null
if no job is being executedpublic org.xwiki.job.event.status.JobStatus getExtensionJobStatus(String extensionId, String namespace)
extensionId
- the extension identifiernamespace
- the namespace where the job is being or has been executedpublic org.xwiki.job.event.status.JobStatus getExtensionPlanJobStatus(String extensionId, String namespace)
extensionId
- the extension identifiernamespace
- the namespace where the job is being or has been executedpublic org.xwiki.job.event.status.JobStatus getCurrentJobStatus()
null
if no job is being executedpublic org.xwiki.extension.version.Version parseVersion(String version)
version
- the string to parseVersion
instancepublic org.xwiki.extension.version.VersionRange parseVersionRange(String versionRange)
versionRange
- the string to parseVersionRange
instancepublic org.xwiki.extension.version.VersionConstraint parseVersionConstraint(String versionConstraint)
versionConstraint
- the string to parseVersionConstraint
instancepublic org.xwiki.extension.ExtensionDependency createExtensionDependency(String id, String versionConstraint)
id
- the dependency identifierversionConstraint
- the dependency version constraintpublic org.xwiki.extension.ExtensionDependency createExtensionDependency(String id, String versionConstraint, boolean optional)
id
- the dependency identifierversionConstraint
- the dependency version constraintoptional
- true if the dependency is optionalpublic boolean isAllowed(Collection<String> allowedNamespaces, String namespace)
allowedNamespaces
- the allowed dynamic (or not) namespaces, null matches any namespacenamespace
- to validate against passed allowed namespacespublic boolean isAllowed(org.xwiki.extension.Extension extension, String namespace)
extension
- the extension to check with the passed namespacenamespace
- to validate against passed allowed namespaces@Deprecated public Collection<org.xwiki.extension.InstalledExtension> getInstalledExtensions()
InstalledExtensionScriptService.getInstalledExtensions()
instead@Deprecated public Collection<org.xwiki.extension.InstalledExtension> getInstalledExtensions(String namespace)
InstalledExtensionScriptService.getInstalledExtensions(String)
insteadThis doesn't include core extensions, only extension installed through the API.
namespace
- the target namespace for which to retrieve the list of installed extensions@Deprecated public org.xwiki.extension.InstalledExtension getInstalledExtension(String feature, String namespace)
InstalledExtensionScriptService.getInstalledExtension(String, String)
insteadThe returned handler can be used to get more information about the extension, such as the authors, an extension description, its license...
feature
- the extension id or provided feature (virtual extension) of the extension to resolvenamespace
- the optional namespace where the extension should be installednull
if the extension isn't
installed in the target namespace@Deprecated public Map<String,Collection<org.xwiki.extension.InstalledExtension>> getBackwardDependencies(String feature, String version)
InstalledExtensionScriptService.getBackwardDependencies(String)
insteadfeature
- the extension id or provided feature (virtual extension) of the extension to resolveversion
- the specific version to checknull
if any error occurs while computing
the result, in which case AbstractExtensionScriptService.getLastError()
contains the failure reason@Deprecated public Collection<org.xwiki.extension.CoreExtension> getCoreExtensions()
CoreExtensionScriptService.getCoreExtensions()
instead@Deprecated public org.xwiki.extension.CoreExtension getCoreExtension(String feature)
CoreExtensionScriptService.getCoreExtension(String)
insteadfeature
- the extension id or provided feature (virtual extension) of the extension to resolvenull
if the extension isn't
provided by the platform@Deprecated public Collection<org.xwiki.extension.LocalExtension> getLocalExtensions()
LocalExtensionScriptService.getLocalExtensions()
public org.xwiki.extension.Extension getAccessibleExtension(String feature, org.xwiki.component.namespace.Namespace namespace)
feature
- the extension id or provided feature (virtual extension)namespace
- the namespace from where the extension is usableExtension
instancepublic org.xwiki.extension.repository.result.IterableResult<org.xwiki.extension.Extension> searchAccessibleExtensions(org.xwiki.component.namespace.Namespace namespace, org.xwiki.extension.repository.search.ExtensionQuery query) throws org.xwiki.extension.repository.search.SearchException
namespace
- the namespace where to searchquery
- the extension query used to filter and order the resultorg.xwiki.extension.repository.search.SearchException
- error when trying to search provided patternCopyright © 2004–2021 XWiki. All rights reserved.