Examples of BeanDeploymentArchive


Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

            final String callerName = getCallingClassName();

            final ClassLoader tccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
            final Class<?> callerClass = Reflections.loadClass(callerName, tccl);
            if (callerClass != null) {
                final BeanDeploymentArchive bda = deployment.getBeanDeploymentArchive(callerClass);
                if (bda != null) {
                    return new BeanManagerProxy(container.beanDeploymentArchives().get(bda));
                }
            }
            // fallback for cases when we are unable to load the class or no BeanManager exists yet for the given BDA
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

     */
    public BeanManagerImpl getBeanManager(String beanArchiveId) {
        if (!started) {
            throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer");
        }
        BeanDeploymentArchive beanDeploymentArchive = beanDeploymentArchives.get(beanArchiveId);
        if (beanDeploymentArchive == null) {
            throw WeldLogger.ROOT_LOGGER.beanDeploymentNotFound(beanArchiveId);
        }
        return bootstrap.getManager(beanDeploymentArchive);
    }
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

        return serviceRegistry;
    }

    /** {@inheritDoc} */
    public synchronized BeanDeploymentArchive loadBeanDeploymentArchive(final Class<?> beanClass) {
        final BeanDeploymentArchive bda = this.getBeanDeploymentArchive(beanClass);
        if (bda != null) {
            return bda;
        }
        /*
         * No, there is no BDA for the class yet. Let's create one.
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

        libJarBDAs = scanForLibJars(archive, ejbs, context);
        if ((libJarBDAs != null) && libJarBDAs.size() > 0) {
            return;
        }

        BeanDeploymentArchive bda = new BeanDeploymentArchiveImpl(archive, ejbs, context);
        this.beanDeploymentArchives.add(bda);
        if (((BeanDeploymentArchiveImpl)bda).getBDAType().equals(BDAType.WAR)) {
            if (warBDAs == null) {
                warBDAs = new ArrayList<BeanDeploymentArchive>();
            }
            warBDAs.add(bda);
        } else if (((BeanDeploymentArchiveImpl)bda).getBDAType().equals(BDAType.JAR)) {
            if (jarBDAs == null) {
                jarBDAs = new ArrayList<BeanDeploymentArchive>();
            }
            jarBDAs.add(bda);
        }
        this.idToBeanDeploymentArchive.put(bda.getId(), bda);
    }
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

            if ((libJarBDAs != null) && libJarBDAs.size() > 0) {
                return;
            }
        }

        BeanDeploymentArchive bda = new BeanDeploymentArchiveImpl(archive, ejbs, context);

        this.context = context;

        if (idToBeanDeploymentArchive == null) {
            idToBeanDeploymentArchive = new HashMap<String, BeanDeploymentArchive>();
        }

        beanDeploymentArchives.add(bda);
        if (((BeanDeploymentArchiveImpl)bda).getBDAType().equals(BDAType.WAR)) {
            if (warBDAs == null) {
                warBDAs = new ArrayList<BeanDeploymentArchive>();
            }
            warBDAs.add(bda);
        } else if (((BeanDeploymentArchiveImpl)bda).getBDAType().equals(BDAType.JAR)) {
            if (jarBDAs == null) {
                jarBDAs = new ArrayList<BeanDeploymentArchive>();
            }
            jarBDAs.add(bda);
        }
        idToBeanDeploymentArchive.put(bda.getId(), bda);

    }
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

        if (warBDAs != null) {
            ListIterator<BeanDeploymentArchive> warIter = warBDAs.listIterator();
            boolean modifiedArchive = false;
            while (warIter.hasNext()) {
                BeanDeploymentArchive warBDA = warIter.next();
                if (jarBDAs != null) {
                    for (BeanDeploymentArchive jarBDA : jarBDAs) {
                        warBDA.getBeanDeploymentArchives().add(jarBDA);
                        modifiedArchive = true;
                    }
                }

                // Make /lib jars (application) accessible

                if (libJarBDAs != null) {
                    for (BeanDeploymentArchive libJarBDA : libJarBDAs) {
                        warBDA.getBeanDeploymentArchives().add(libJarBDA);
                        modifiedArchive = true;
                    }
                }

                if (modifiedArchive) {
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

        }
        List<BeanDeploymentArchive> beanDeploymentArchives = getBeanDeploymentArchives();

        ListIterator<BeanDeploymentArchive> lIter = beanDeploymentArchives.listIterator();
        while (lIter.hasNext()) {
            BeanDeploymentArchive bda = lIter.next();
            if ( logger.isLoggable( FINE ) ) {
                logger.log(FINE, "checking for " + beanClass + " in root BDA" + bda.getId());
            }
            if (((BeanDeploymentArchiveImpl)bda).getModuleBeanClassObjects().contains(beanClass)) {
                //don't stuff this Bean Class into the BDA's beanClasses,
                //as Weld automatically add theses classes to the BDA's bean Classes
                if ( logger.isLoggable( FINE ) ) {
                    logger.log(FINE, "DeploymentImpl(as part of loadBDA)::An " +
                    "existing BDA has this class " + beanClass.getName()
                    + " and so adding this class as a bean class it to " +
                    "existing bda: " + bda);
                //((BeanDeploymentArchiveImpl)bda).addBeanClass(beanClass.getName());
                }
                return bda;
            }

            //XXX: As of now, we handle one-level. Ideally, a bean deployment
            //descriptor is a composite and we should be able to search the tree
            //and get the right BDA for the beanClass
            if (bda.getBeanDeploymentArchives().size() > 0) {
                for(BeanDeploymentArchive subBda: bda.getBeanDeploymentArchives()){
                    Collection<Class<?>> moduleBeanClasses = ((BeanDeploymentArchiveImpl)subBda).getModuleBeanClassObjects();
                    if ( logger.isLoggable( FINE ) ) {
                        logger.log(FINE, "checking for " + beanClass + " in subBDA" + subBda.getId());
                    }
                    boolean match = moduleBeanClasses.contains(beanClass);
                    if (match) {
                        //don't stuff this Bean Class into the BDA's beanClasses,
                        //as Weld automatically add theses classes to the BDA's bean Classes
                        if ( logger.isLoggable( FINE ) ) {
                            logger.log(FINE, "DeploymentImpl(as part of loadBDA)::" +
                            "An existing BDA has this class "
                                + beanClass.getName() + " and so adding this " +
                                "class as a bean class to existing bda:" + subBda);
                        }
                        //((BeanDeploymentArchiveImpl)subBda).addBeanClass(beanClass.getName());
                        return subBda;
                    }
                }
            }
        }

        // If the BDA was not found for the Class, create one and add it
        if ( logger.isLoggable( FINE ) ) {
            logger.log(FINE, "+++++ DeploymentImpl(as part of loadBDA):: beanClass "
                + beanClass + " not found in the BDAs of this deployment. " +
                "Hence creating a new BDA");
        }
        List<Class<?>> beanClasses = new ArrayList<Class<?>>();
        List<URL> beanXMLUrls = new CopyOnWriteArrayList<URL>();
        Set<EjbDescriptor> ejbs = new HashSet<EjbDescriptor>();
        beanClasses.add(beanClass);

        // Workaround for WELD-1182
        // TODO: The workaround will be removed once the defect is addressed.
        WeldGFExtension gfExtension = beanClass.getAnnotation(WeldGFExtension.class);
        if(gfExtension != null)
          beanClasses.addAll(java.util.Arrays.asList(gfExtension.beans()));

        BeanDeploymentArchive newBda =
            new BeanDeploymentArchiveImpl(beanClass.getName(),
                    beanClasses, beanXMLUrls, ejbs, context);
        if ( logger.isLoggable( FINE ) ) {
            logger.log(FINE, "DeploymentImpl(as part of loadBDA):: new BDA "
                + newBda + "created. Now adding this new BDA to " +
                "all root BDAs of this deployment");
        }
        lIter = beanDeploymentArchives.listIterator();
        while (lIter.hasNext()) {
            BeanDeploymentArchive bda = lIter.next();
            bda.getBeanDeploymentArchives().add(newBda);
        }
        if ( logger.isLoggable( FINE ) ) {
            logger.log(FINE, "DeploymentImpl(as part of loadBDA):: for beanClass "
                + beanClass + " finally returning the " +
                "newly created BDA " + newBda);
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

    public String toString() {
        StringBuffer valBuff = new StringBuffer();
        List<BeanDeploymentArchive> beanDeploymentArchives = getBeanDeploymentArchives();
        ListIterator<BeanDeploymentArchive> lIter = beanDeploymentArchives.listIterator();
        while (lIter.hasNext()) {
            BeanDeploymentArchive bda = lIter.next();
            valBuff.append(bda.toString());
        }
        return valBuff.toString();
    }
View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

        if (libJars != null) {
            String libDir = holder.app.getLibraryDirectory();
            ListIterator<ReadableArchive> libJarIterator = libJars.listIterator();
            while (libJarIterator.hasNext()) {
                ReadableArchive libJarArchive = (ReadableArchive)libJarIterator.next();
                BeanDeploymentArchive bda = new BeanDeploymentArchiveImpl(
                        libJarArchive, ejbs, context,
                        /* use lib/jarname as BDA ID */ libDir + SEPARATOR_CHAR
                        + libJarArchive.getName());
                this.beanDeploymentArchives.add(bda);
                if (libJarBDAs  == null) {
                    libJarBDAs = new ArrayList<BeanDeploymentArchive>();
                }
                libJarBDAs.add(bda);
                this.idToBeanDeploymentArchive.put(bda.getId(), bda);
            }
            //Ensure each library jar in EAR/lib is visible to each other.
            ensureEarLibJarVisibility(libJarBDAs);
        }

View Full Code Here

Examples of org.jboss.weld.bootstrap.spi.BeanDeploymentArchive

    }

    private void ensureEarLibJarVisibility(List<BeanDeploymentArchive> earLibBDAs) {
        //ensure all ear/lib JAR BDAs are visible to each other
        for (int i = 0; i < earLibBDAs.size(); i++) {
            BeanDeploymentArchive firstBDA = earLibBDAs.get(i);
            boolean modified = false;
            //loop through the list once more
            for (int j = 0; j < earLibBDAs.size(); j++) {
                BeanDeploymentArchive otherBDA = earLibBDAs.get(j);
                if (!firstBDA.getId().equals(otherBDA.getId())){
                    if ( logger.isLoggable( FINE ) ) {
                        logger.log(FINE, "DeploymentImpl::ensureEarLibJarVisibility - " + firstBDA.getId() + " being associated with " + otherBDA.getId());
                    }
                    firstBDA.getBeanDeploymentArchives().add(otherBDA);
                    modified = true;
                }
            }
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.