Examples of BundleReference


Examples of org.apache.geronimo.naming.reference.BundleReference

            put("java:comp/TransactionManager", transactionManagerRef, ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
            GBeanReference transactionSynchronizationRef = new GBeanReference(module.getConfigId(), query, TransactionSynchronizationRegistry.class);
            put("java:comp/TransactionSynchronizationRegistry", transactionSynchronizationRef, ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
        }

        put("java:comp/Bundle", new BundleReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget> emptySet(), sharedContext);
        put("java:comp/BundleContext", new BundleContextReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget> emptySet(), sharedContext);

        XmlObject[] gerResourceEnvRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_ADMIN_OBJECT_REF_QNAME_SET);
        Map<String, GerResourceEnvRefType> refMap = mapResourceEnvRefs(gerResourceEnvRefsUntyped);
        Map<String, Map<String, GerMessageDestinationType>> messageDestinations = module.getRootEarContext().getMessageDestinations();
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

        this.contribution = contribution;
        this.bundleProcessor = new OSGiBundleProcessor();
    }

    public void addModel(Object resolved) {
        BundleReference bundleRef = (BundleReference)resolved;
        map.put(bundleRef.getBundleUniqueName(), bundleRef);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

     * Handle artifact resolution when the specific class reference is imported from another contribution
     * @param unresolved
     * @return
     */
    private BundleReference resolveImportedModel(BundleReference unresolved) {
        BundleReference resolved = unresolved;

        if( this.contribution != null) {
            for (Import import_ : this.contribution.getImports()) {
               
                resolved = import_.getModelResolver().resolveModel(BundleReference.class, unresolved);
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

        Object bundle = null;
        String bundleName = ((BundleReference)unresolved).getBundleName();
        String bundleVersion = ((BundleReference)unresolved).getBundleVersion();
       
        bundle = osgiRuntime.findBundle(bundleName, bundleVersion);
        BundleReference bundleReference;
       
        if (bundle == null)
            bundleReference = bundleProcessor.installNestedBundle(contribution, bundleName, bundleVersion);
        else {
            bundleReference = new BundleReference(bundle,
                    ((BundleReference)unresolved).getBundleName(),
                    bundleVersion,
                    getBundleFileName(bundle)
                    );
        }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

        this.contribution = contribution;
        this.bundleProcessor = new OSGiBundleProcessor();
    }

    public void addModel(Object resolved) {
        BundleReference bundleRef = (BundleReference)resolved;
        map.put(bundleRef.getBundleUniqueName(), bundleRef);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

     * Handle artifact resolution when the specific class reference is imported from another contribution
     * @param unresolved
     * @return
     */
    private BundleReference resolveImportedModel(BundleReference unresolved) {
        BundleReference resolved = unresolved;

        if( this.contribution != null) {
            for (Import import_ : this.contribution.getImports()) {
               
                resolved = import_.getModelResolver().resolveModel(BundleReference.class, unresolved);
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

        Object bundle = null;
        String bundleName = ((BundleReference)unresolved).getBundleName();
        String bundleVersion = ((BundleReference)unresolved).getBundleVersion();
       
        bundle = osgiRuntime.findBundle(bundleName, bundleVersion);
        BundleReference bundleReference;
       
        if (bundle == null)
            bundleReference = bundleProcessor.installNestedBundle(contribution, bundleName, bundleVersion);
        else {
            bundleReference = new BundleReference(bundle,
                    ((BundleReference)unresolved).getBundleName(),
                    bundleVersion,
                    getBundleFileName(bundle)
                    );
        }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

    public BundleReference installNestedBundle(Contribution contribution,
                                               String bundleSymbolicName,
                                               String bundleVersion) {

        BundleReference bundleReference = null;

        initialize();
        if (osgiRuntime == null)
            return null;

        List<Artifact> artifacts = contribution.getArtifacts();
        for (Artifact a : artifacts) {
            if (a.getURI().endsWith(".jar")) {

                InputStream stream;
                JarInputStream jar = null;
                Object name;
                Object version;
                try {

                    URL artifactURL = new URL(a.getLocation());
                    stream = artifactURL.openStream();
                    jar = new JarInputStream(artifactURL.openStream());
                    Manifest manifest = jar.getManifest();
                    name = manifest.getMainAttributes().get(new Attributes.Name("Bundle-SymbolicName"));
                    version = manifest.getMainAttributes().get(new Attributes.Name("Bundle-Version"));

                    if (bundleSymbolicName.equals(name) && (bundleVersion == null || version == null || bundleVersion
                        .equals(version))) {

                        Object bundle = osgiRuntime.installBundle(a.getLocation(), stream);

                        bundleReference = new BundleReference(bundle, bundleSymbolicName, bundleVersion, a.getURI());

                        break;
                    }

                } catch (Exception e) {
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

          if (!impl.isUnresolved())
            return;
           
            impl.setUnresolved(false);
           
            BundleReference bundleReference = new BundleReference(impl.getBundleSymbolicName(), impl.getBundleVersion());
            BundleReference resolvedBundle = resolver.resolveModel(BundleReference.class, bundleReference);
            Bundle bundle = (Bundle)resolvedBundle.getBundle();
            if (bundle != null)
                impl.setOSGiBundle(bundle);
            else
                throw new ContributionResolveException("Could not locate OSGi bundle " +
                        impl.getBundleSymbolicName());
           
            String bundleName = resolvedBundle.getBundleRelativePath();
            String ctURI = bundleName.endsWith(".jar") || bundleName.endsWith(".JAR")?
                    bundleName.substring(0, bundleName.lastIndexOf(".")) : bundleName;
            ctURI = ctURI.replaceAll("\\.", "/");
            ctURI = ctURI + ".componentType";
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.osgi.BundleReference

    public BundleReference installNestedBundle(Contribution contribution,
                                               String bundleSymbolicName,
                                               String bundleVersion) {

        BundleReference bundleReference = null;

        List<Artifact> artifacts = contribution.getArtifacts();
        for (Artifact a : artifacts) {
            if (a.getURI().endsWith(".jar")) {
                try {
                    Bundle bundle = OSGiBundleActivator.installBundle(a.getLocation());
                    if (bundle != null) {
                        bundleReference = new BundleReference(bundle);
                        break;
                    }
                } catch (Exception e) {
                    // If OSGi cannot process the jar, treat the bundle as a plain jar file.
                }
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.