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); } } } }
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); } } } }