Examples of OSGiMetaData


Examples of org.jboss.osgi.metadata.OSGiMetaData

    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

        // Create the {@link ModuleRegisterService}
        final DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        final Module module = depUnit.getAttachment(Attachments.MODULE);
        final OSGiMetaData metadata = OSGiMetaDataAttachment.getOSGiMetaData(depUnit);
        if (module != null) {
            ModuleRegisterService.addService(phaseContext, module, metadata);
        }
    }
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

            ServiceName serviceName = depUnit.getServiceName().append("Activate");
            BundleActivateService service = new BundleActivateService(depUnit);
            ServiceBuilder<XBundle> builder = serviceTarget.addService(serviceName, service);
            builder.addDependency(resolvedBundle, XBundle.class, service.injectedBundle);
            // Add a dependency on the BundleActivator component
            OSGiMetaData metadata = depUnit.getAttachment(OSGiConstants.OSGI_METADATA_KEY);
            if (metadata != null && metadata.getBundleActivator() != null) {
                String activatorClass = metadata.getBundleActivator();
                EEModuleDescription moduleDescription = depUnit.getAttachment(EE_MODULE_DESCRIPTION);
                for (ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
                    if (activatorClass.equals(componentDescription.getComponentClassName())) {
                        ServiceName startServiceName = componentDescription.getStartServiceName();
                        builder.addDependency(startServiceName, Component.class, service.injectedComponent);
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

        }
        registrations.clear();
    }

    private XBundleRevision registerInternal(final BundleContext context, final XEnvironment env, final Registration reg) {
        final OSGiMetaData metadata = reg.metadata;
        final Module module = reg.module;

        LOGGER.infoRegisterModule(module.getIdentifier());
        XBundleRevisionBuilderFactory factory = new XBundleRevisionBuilderFactory() {
            @Override
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

        final Module module = depUnit.getAttachment(Attachments.MODULE);
        final ModuleSpecification moduleSpecification = depUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        if (module == null || moduleSpecification.isPrivateModule())
            return;

        OSGiMetaData metadata = depUnit.getAttachment(OSGiConstants.OSGI_METADATA_KEY);
        registrationTracker.registerModule(module, metadata);
    }
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

        // Check for attached BundleInfo
        BundleInfo info = depUnit.getAttachment(OSGiConstants.BUNDLE_INFO_KEY);
        if (deployment == null && info != null) {
            deployment = DeploymentFactory.createDeployment(info);
            deployment.addAttachment(BundleInfo.class, info);
            OSGiMetaData metadata = info.getOSGiMetadata();
            deployment.setAutoStart(!metadata.isFragment());

            // Set the start level and prevent autostart if greater than the Framwork startlevel
            AnnotationInstance slAware = getAnnotation(depUnit, "org.jboss.arquillian.osgi.StartLevelAware");
            if (slAware != null) {
                MethodInfo slTarget = (MethodInfo) slAware.target();
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

public class OSGiComponentParseProcessor implements DeploymentUnitProcessor {

    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        OSGiMetaData metadata = depUnit.getAttachment(OSGiConstants.OSGI_METADATA_KEY);
        if (metadata == null || metadata.getBundleActivator() == null)
            return;

        String componentClass = metadata.getBundleActivator();
        String componentName = BundleActivator.class.getSimpleName();
        EEModuleDescription moduleDescription = depUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
        if (moduleDescription != null) {
            ComponentDescription componentDescription = new ComponentDescription(componentName, componentClass, moduleDescription, depUnit.getServiceName());
            moduleDescription.addComponent(componentDescription);
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

            return;

        try {
            Properties props = new Properties();
            props.load(xserviceFile.openStream());
            OSGiMetaData metadata = OSGiMetaDataBuilder.load(props);
            depUnit.putAttachment(OSGiConstants.OSGI_METADATA_KEY, metadata);
        } catch (IOException ex) {
            throw MESSAGES.cannotParseOSGiMetadata(ex, xserviceFile);
        }
    }
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

                    module = moduleLoader.loadModule(moduleId);
                } catch (ModuleLoadException ex) {
                    throw MESSAGES.cannotResolveInitialCapability(ex, identifier);
                }

                final OSGiMetaData metadata = getModuleMetadata(module);
                final BundleContext syscontext = injectedSystemContext.getValue();
                XBundleRevisionBuilderFactory factory = new XBundleRevisionBuilderFactory() {
                    @Override
                    public XBundleRevision createResource() {
                        return new AbstractBundleRevisionAdaptor(syscontext, module);
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

        // Check if we already have a bundle {@link Deployment}
        if (BundleLifecycleIntegration.getDeployment(runtimeName) != null)
            return;

        // Get the manifest from the deployment's virtual file
        OSGiMetaData metadata = depUnit.getAttachment(OSGiConstants.OSGI_METADATA_KEY);
        if (metadata != null) {
            try {
                // Construct and attach the {@link BundleInfo} from {@link OSGiMetaData}
                VirtualFile virtualFile = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
                BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(virtualFile), runtimeName, metadata);
View Full Code Here

Examples of org.jboss.osgi.metadata.OSGiMetaData

        // 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);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.