@Override public void undeploy(Archive<?> archive) throws DeploymentException { try { Manifest manifest = new Manifest(archive.get("/META-INF/MANIFEST.MF").getAsset().openStream()); OSGiMetaData metadata = OSGiMetaDataBuilder.load(manifest); undeploy(metadata.getBundleSymbolicName()); } catch (IOException e) { throw new DeploymentException("Cannot undeploy: " + archive.getName(), e); } }
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"); } } } } }
@Override public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException { try { Manifest manifest = new Manifest(archive.get("/META-INF/MANIFEST.MF").getAsset().openStream()); OSGiMetaData metadata = OSGiMetaDataBuilder.load(manifest); BundleHandle handle = installBundle(archive); deployedBundles.put(metadata.getBundleSymbolicName(), handle); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new DeploymentException("Cannot deploy: " + archive.getName(), ex); } MBeanServerConnection mbeanServer = mbeanServerInstance.get(); return new ProtocolMetaData().addContext(new JMXContext(mbeanServer)); }
assertResourceCreated(); try { String symbolicName = metadata.getBundleSymbolicName(); Version bundleVersion = metadata.getBundleVersion(); ParameterizedAttribute idparams = metadata.getBundleParameters();