XBundle bundle = injectedBundle.getValue();
Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
Component activatorComponent = injectedComponent.getOptionalValue();
if (activatorComponent != null && deployment.getAttachment(BundleActivator.class) == null) {
ComponentInstance componentInstance = activatorComponent.createInstance();
BundleActivator instance = (BundleActivator) componentInstance.getInstance();
deployment.addAttachment(BundleActivator.class, instance);
}
OperationAssociation.INSTANCE.setAssociation(new ModelNode("deploy"));
try {
bundleManager.startBundle(bundle, Bundle.START_ACTIVATION_POLICY);