public void autostartBundle(@Observes AfterDeploy event) throws Exception { if (event.getDeployableContainer() instanceof CommonDeployableContainer) { CommonDeployableContainer<?> container = (CommonDeployableContainer<?>) event.getDeployableContainer(); if (container.isAutostartBundle()) { Manifest manifest = new Manifest(event.getDeployment().getArchive().get("/META-INF/MANIFEST.MF").getAsset().openStream()); OSGiMetaData metadata = OSGiMetaDataBuilder.load(manifest); if (metadata.getFragmentHost() == null) { container.startBundle(metadata.getBundleSymbolicName(), metadata.getBundleVersion().toString()); } else { logger.debug("Fragment bundle cannot be started"); } } } } }
public void afterDeploy(@Observes AfterDeploy afterDeploy) { DeploymentDronePointsRegistry deplDronePoints = this.deploymentDronePointsRegistry.get(); if (deplDronePoints != null) { String deplName = afterDeploy.getDeployment().getName(); Map<DronePoint<?>, Object> filteredDronePoints = deplDronePoints.filterDeploymentDronePoints(deplName); for (DronePoint dronePoint : filteredDronePoints.keySet()) { if (!droneContext.get().get(dronePoint).hasFutureInstance()) { createDroneConfigurationCommand.fire(new PrepareDrone(dronePoint)); } // in case that deployment is done before the enrichment, then only prepare the DronePoint - Enrichment will be done later as a part of the standard process Object testClass = filteredDronePoints.get(dronePoint); if (testClass != null) { // in case that deployment is done after the standard enrichment, we have to enrich the class manually DroneTestEnricher droneTestEnricher = injector.get().inject(new DroneTestEnricher()); droneTestEnricher.enrichTestClass(testClassInstance.get().getJavaClass(), testClass, false); } } } }
@Override public Void call() throws Exception { DeployableContainer<?> deployableContainer = event.getDeployableContainer(); Deployment deployment = event.getDeployment(); DeploymentDescription deploymentDescription = deployment.getDescription(); /* * TODO: should the DeploymentDescription producer some how be automatically registered ? * Or should we just 'know' who is the first one to create the context */ deploymentDescriptionProducer.set(deploymentDescription); deploymentProducer.set(deployment); deployEvent.fire(new BeforeDeploy(deployableContainer, deploymentDescription)); try { if (deploymentDescription.isArchiveDeployment()) { protocolMetadata.set(deployableContainer.deploy( deploymentDescription.getTestableArchive() != null ? deploymentDescription.getTestableArchive() : deploymentDescription.getArchive())); } else { deployableContainer.deploy(deploymentDescription.getDescriptor()); } deployment.deployed(); } catch (Exception e) { deployment.deployedWithError(e); throw e; } deployEvent.fire(new AfterDeploy(deployableContainer, deploymentDescription)); return null; } });
public void afterDeploy(@Observes AfterDeploy afterDeploy) { DeploymentDronePointsRegistry deplDronePoints = this.deploymentDronePointsRegistry.get(); if (deplDronePoints != null) { String deplName = afterDeploy.getDeployment().getName(); Map<DronePoint<?>, Object> filteredDronePoints = deplDronePoints.filterDeploymentDronePoints(deplName); for (DronePoint dronePoint : filteredDronePoints.keySet()) { if (!droneContext.get().get(dronePoint).hasFutureInstance()) { createDroneConfigurationCommand.fire(new PrepareDrone(dronePoint)); } // in case that deployment is done before the enrichment, then only prepare the DronePoint - Enrichment will be done later as a part of the standard process Object testClass = filteredDronePoints.get(dronePoint); if (testClass != null) { // in case that deployment is done after the standard enrichment, we have to enrich the class manually DroneTestEnricher droneTestEnricher = injector.get().inject(new DroneTestEnricher()); droneTestEnricher.enrichTestClass(testClassInstance.get().getJavaClass(), testClass, false); } } } }
@Override public Void call() throws Exception { DeployableContainer<?> deployableContainer = event.getDeployableContainer(); Deployment deployment = event.getDeployment(); DeploymentDescription deploymentDescription = deployment.getDescription(); /* * TODO: should the DeploymentDescription producer some how be automatically registered ? * Or should we just 'know' who is the first one to create the context */ deploymentDescriptionProducer.set(deploymentDescription); deploymentProducer.set(deployment); deployEvent.fire(new BeforeDeploy(deployableContainer, deploymentDescription)); try { if (deploymentDescription.isArchiveDeployment()) { protocolMetadata.set(deployableContainer.deploy( deploymentDescription.getTestableArchive() != null ? deploymentDescription.getTestableArchive() : deploymentDescription.getArchive())); } else { deployableContainer.deploy(deploymentDescription.getDescriptor()); } deployment.deployed(); } catch (Exception e) { deployment.deployedWithError(e); throw e; } deployEvent.fire(new AfterDeploy(deployableContainer, deploymentDescription)); return null; } });