public static boolean isValidOSGiBundleArchive(Archive<?> appArchive) { // org.jboss.arquillian.container:arquillian-container-osgi must be be provided ClassLoader classLoader = OSGiApplicationArchiveProcessor.class.getClassLoader(); try { classLoader.loadClass("org.jboss.arquillian.container.osgi.AbstractOSGiApplicationArchiveProcessor"); } catch (ClassNotFoundException ex) { return false; } Manifest manifest = ManifestUtils.getManifest(appArchive); return OSGiManifestBuilder.isValidBundleManifest(manifest); } }
private boolean isValidOSGiBundle(Archive<?> appArchive) { Manifest manifest = ManifestUtils.getManifest(appArchive); if(manifest != null) { if(OSGiManifestBuilder.isValidBundleManifest(manifest)) { return true; } } return false; } }
protected OSGiMetaData getOSGiMetaDataFromManifest(XResource resource) throws IOException { OSGiMetaData result = null; Manifest manifest = getResourceManifest(resource); if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { result = OSGiMetaDataBuilder.load(manifest); } return result; }
if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { return;
try { Manifest manifest = new Manifest(input); if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { return OSGiMetaDataBuilder.load(manifest);
if (OSGiManifestBuilder.isValidBundleManifest(manifest)) return OSGiMetaDataBuilder.load(manifest);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit depUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, depUnit)) { return; } ResourceRoot deploymentRoot = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); List<ResourceRoot> potentialSubDeployments = depUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : potentialSubDeployments) { if (IgnoreMetaInfMarker.isIgnoreMetaInf(resourceRoot)) continue; // Don't accept archives in the 'lib' directory String pathName = resourceRoot.getRoot().getPathNameRelativeTo(deploymentRoot.getRoot()); if (pathName.startsWith("lib/")) continue; // Check if this sub deployment has a valid OSGi manifest - if so mark it Manifest manifest = ManifestAttachmentProcessor.getManifest(resourceRoot); if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { SubDeploymentMarker.mark(resourceRoot); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit depUnit = phaseContext.getDeploymentUnit(); if (depUnit.hasAttachment(Attachments.OSGI_MANIFEST) || depUnit.hasAttachment(OSGiConstants.OSGI_METADATA_KEY)) return; final ResourceRoot deploymentRoot = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot == null) return; // Check whether this is an OSGi manifest Manifest manifest = deploymentRoot.getAttachment(Attachments.MANIFEST); if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { depUnit.putAttachment(Attachments.OSGI_MANIFEST, manifest); OSGiMetaData metadata = OSGiMetaDataBuilder.load(manifest); depUnit.putAttachment(OSGiConstants.OSGI_METADATA_KEY, metadata); } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit depUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, depUnit)) { return; } ResourceRoot deploymentRoot = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); List<ResourceRoot> potentialSubDeployments = depUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : potentialSubDeployments) { if (IgnoreMetaInfMarker.isIgnoreMetaInf(resourceRoot)) continue; // Don't accept archives in the 'lib' directory String pathName = resourceRoot.getRoot().getPathNameRelativeTo(deploymentRoot.getRoot()); if (pathName.startsWith("lib/")) continue; // Check if this sub deployment has a valid OSGi manifest - if so mark it Manifest manifest = ManifestAttachmentProcessor.getManifest(resourceRoot); if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { SubDeploymentMarker.mark(resourceRoot); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit depUnit = phaseContext.getDeploymentUnit(); Manifest manifest = depUnit.getAttachment(Attachments.OSGI_MANIFEST); if (manifest != null) return; // Check if we already have a bundle {@link Deployment} Deployment dep = BundleLifecycleIntegration.getDeployment(depUnit.getName()); if (dep != null) { manifest = dep.getAttachment(IntegrationConstants.MANIFEST_KEY); } ResourceRoot deploymentRoot = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (manifest == null && deploymentRoot != null) { manifest = deploymentRoot.getAttachment(Attachments.MANIFEST); } // Check whether this is an OSGi manifest if (OSGiManifestBuilder.isValidBundleManifest(manifest)) { depUnit.putAttachment(Attachments.OSGI_MANIFEST, manifest); depUnit.putAttachment(OSGiConstants.DEPLOYMENT_TYPE_KEY, DeploymentType.Bundle); } }