public class DefaultBundleService extends Object implements BundleService
BundleService which is using direct bundle operations (BundleContext.installBundle(),
bundle.start()/stop()/uninstall()). The implementation is used in a standalone DX instance or in case DX clustering is not activated (
cluster.activated=false).
getInfo/getInfos/getAllInfos methods of this implementation return a map containing a single entry whose key is an empty string, and value is local information about the bundle/bundles. These methods do not support the target parameter, because it only makes sense in a cluster; InvalidTargetException will be thrown in case there is a non-null value passed.
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
DefaultBundleService.ExceptionProvider |
protected static class |
DefaultBundleService.FailingMap<K,V>
A special implementation of the Map whose any method simply throws an exception provided by the associated ExceptionProvider.
|
BundleService.BundleInformation, BundleService.FragmentInformation, BundleService.ModuleInformation| Constructor and Description |
|---|
DefaultBundleService() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Map<String,BundleService.BundleInformation>> |
getAllInfos(String target)
Get info about all installed bundles.
|
Map<String,BundleService.BundleInformation> |
getAllLocalInfos()
Get local info about all installed bundles.
|
protected static org.osgi.framework.Bundle |
getBundleEnsureExists(BundleInfo bundleInfo) |
static String |
getClusterNodeId()
Returns the cluster node ID of this DX node.
|
Map<String,BundleService.BundleInformation> |
getInfo(BundleInfo bundleInfo,
String target)
Get info about a bundle.
|
Map<String,Map<String,BundleService.BundleInformation>> |
getInfos(BundleBucketInfo bundleBucketInfo,
String target)
Get info about multiple bundles belonging to a single bundle bucket.
|
Map<String,Map<String,BundleService.BundleInformation>> |
getInfos(Collection<BundleInfo> bundleInfos,
String target)
Get info about multiple bundles.
|
BundleService.BundleInformation |
getLocalInfo(BundleInfo bundleInfo)
Get local info about a bundle.
|
Map<String,BundleService.BundleInformation> |
getLocalInfos(BundleBucketInfo bundleBucketInfo)
Get local info about multiple bundles belonging to a single bundle bucket.
|
BundleState |
getLocalState(BundleInfo bundleInfo)
Get current local state of a bundle.
|
void |
install(String uri,
String target,
boolean start)
Install the specified bundle on the target group of cluster nodes, optionally starting it right after if the
start
parameter is true. |
void |
install(String uri,
String target,
boolean start,
int startLevel)
Install the specified bundle on the target group of cluster nodes, optionally starting it right after if the
start
parameter is true. |
void |
refresh(BundleInfo bundleInfo,
String target)
Performs the refresh operation with the provided bundle on the target group of cluster nodes.
|
void |
refresh(Collection<BundleInfo> bundleInfos,
String target)
Performs the refresh operation with the provided bundles on the target group of cluster nodes.
|
protected void |
refreshUninstalledBundle(org.osgi.framework.Bundle bundle) |
void |
resolve(BundleInfo bundleInfo,
String target)
Performs the resolve operation with the provided bundle on the target group of cluster nodes.
|
void |
setTemplateManagerService(JahiaTemplateManagerService templateManagerService)
Injects an instance of the template manager service.
|
void |
start(BundleInfo bundleInfo,
String target)
Performs the start operation with the provided bundle on the target group of cluster nodes.
|
void |
stop(BundleInfo bundleInfo,
String target)
Performs the stop operation with the provided bundle on the target group of cluster nodes.
|
void |
uninstall(BundleInfo bundleInfo,
String target)
Performs the uninstall operation with the provided bundle on the target group of cluster nodes.
|
void |
update(BundleInfo bundleInfo,
String target)
Performs the update operation with the provided bundle on the target group of cluster nodes.
|
protected static org.osgi.framework.Bundle getBundleEnsureExists(BundleInfo bundleInfo) throws ModuleNotFoundException
ModuleNotFoundExceptionpublic static String getClusterNodeId()
public void setTemplateManagerService(JahiaTemplateManagerService templateManagerService)
templateManagerService - an instance of the template manager servicepublic void install(String uri, String target, boolean start) throws ModuleManagementException
BundleServicestart
parameter is true.
In case the same version of the bundle is already installed, update it with the snapshot referenced by the uri.install in interface BundleServiceuri - The bundle locationtarget - The group of cluster nodes targeted by the install operation (see JavaDoc of the class)start - Whether the installed bundle should be started right awayModuleManagementException - in case of operation failureInvalidTargetException - in case target is not a valid target for module operationpublic void install(String uri, String target, boolean start, int startLevel) throws ModuleManagementException
BundleServicestart
parameter is true.
In case the same version of the bundle is already installed, update it with the snapshot referenced by the uri.install in interface BundleServiceuri - The bundle locationtarget - The group of cluster nodes targeted by the install operation (see JavaDoc of the class)start - Whether the installed bundle should be started right awaystartLevel - The start level to apply to the installed bundleModuleManagementException - in case of operation failureInvalidTargetException - in case target is not a valid target for module operationprotected void refreshUninstalledBundle(org.osgi.framework.Bundle bundle)
public void resolve(BundleInfo bundleInfo, String target) throws ModuleManagementException, ModuleNotFoundException, InvalidTargetException
BundleServiceresolve in interface BundleServicebundleInfo - The bundle to perform operation fortarget - The group of cluster nodes targeted by the resolve operation (see JavaDoc of the class)ModuleManagementException - in case of operation failureModuleNotFoundException - in case the corresponding bundle cannot be foundInvalidTargetException - in case target is not a valid target for module operationpublic void start(BundleInfo bundleInfo, String target) throws ModuleNotFoundException
BundleServicestart in interface BundleServicebundleInfo - The bundle to perform operation fortarget - The group of cluster nodes targeted by the start operation (see JavaDoc of the class)ModuleNotFoundException - in case the corresponding bundle cannot be foundpublic void stop(BundleInfo bundleInfo, String target) throws ModuleNotFoundException
BundleServicestop in interface BundleServicebundleInfo - The bundle to perform operation fortarget - The group of cluster nodes targeted by the stop operation (see JavaDoc of the class)ModuleNotFoundException - in case the corresponding bundle cannot be foundpublic void uninstall(BundleInfo bundleInfo, String target) throws ModuleNotFoundException
BundleServiceuninstall in interface BundleServicebundleInfo - The bundle to perform operation fortarget - The group of cluster nodes targeted by the uninstall operation (see JavaDoc of the class)ModuleNotFoundException - in case the corresponding bundle cannot be foundpublic void refresh(BundleInfo bundleInfo, String target) throws ModuleManagementException
BundleServicerefresh in interface BundleServicebundleInfo - The bundle to perform operation fortarget - The group of cluster nodes targeted by the refresh operation (see JavaDoc of the class)ModuleManagementException - in case of operation failureModuleNotFoundException - in case the corresponding bundle cannot be foundInvalidTargetException - in case target is not a valid target for module operationpublic void refresh(Collection<BundleInfo> bundleInfos, String target) throws ModuleManagementException
BundleServicerefresh in interface BundleServicebundleInfos - The bundles to perform operation fortarget - The group of cluster nodes targeted by the refresh operation (see JavaDoc of the class)ModuleManagementException - in case of operation failureModuleNotFoundException - in case any if the corresponding bundles cannot be foundInvalidTargetException - in case target is not a valid target for module operationpublic void update(BundleInfo bundleInfo, String target) throws ModuleManagementException
BundleServiceupdate in interface BundleServicebundleInfo - The bundle to perform operation fortarget - The group of cluster nodes targeted by the update operation (see JavaDoc of the class)ModuleManagementException - in case of operation failureModuleNotFoundException - in case the corresponding bundle cannot be foundInvalidTargetException - in case target is not a valid target for module operationpublic Map<String,BundleService.BundleInformation> getInfo(BundleInfo bundleInfo, String target) throws ModuleManagementException, InvalidTargetException
BundleServicegetInfo in interface BundleServicebundleInfo - The bundle to retrieve info abouttarget - The group of cluster nodes to get info from (see JavaDoc of the class)InvalidTargetException - in case the target is not a valid oneModuleManagementExceptionpublic Map<String,Map<String,BundleService.BundleInformation>> getInfos(Collection<BundleInfo> bundleInfos, String target) throws ModuleManagementException, InvalidTargetException
BundleServicegetInfos in interface BundleServicebundleInfos - The bundles to retrieve info abouttarget - The group of cluster nodes to get info from (see JavaDoc of the class)InvalidTargetException - in case the target is not a valid oneModuleManagementExceptionpublic Map<String,Map<String,BundleService.BundleInformation>> getInfos(BundleBucketInfo bundleBucketInfo, String target) throws ModuleManagementException, InvalidTargetException
BundleServicegetInfos in interface BundleServicebundleBucketInfo - The bundle buckettarget - The group of cluster nodes to get info from (see JavaDoc of the class)ModuleManagementExceptionInvalidTargetExceptionpublic Map<String,Map<String,BundleService.BundleInformation>> getAllInfos(String target) throws ModuleManagementException, InvalidTargetException
BundleServicegetAllInfos in interface BundleServicetarget - The group of cluster nodes to get info from (see JavaDoc of the class)InvalidTargetException - in case the target is not a valid oneModuleManagementExceptionpublic BundleState getLocalState(BundleInfo bundleInfo) throws ModuleNotFoundException
BundleServicegetLocalState in interface BundleServicebundleInfo - The bundle to retrieve statusModuleNotFoundExceptionpublic BundleService.BundleInformation getLocalInfo(BundleInfo bundleInfo) throws ModuleNotFoundException
BundleServicegetLocalInfo in interface BundleServicebundleInfo - The bundle to retrieve info aboutModuleNotFoundExceptionpublic Map<String,BundleService.BundleInformation> getLocalInfos(BundleBucketInfo bundleBucketInfo) throws ModuleManagementException
BundleServicegetLocalInfos in interface BundleServicebundleBucketInfo - The bundle bucketModuleManagementExceptionpublic Map<String,BundleService.BundleInformation> getAllLocalInfos() throws ModuleManagementException
BundleServicegetAllLocalInfos in interface BundleServiceModuleManagementExceptionCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.