Package org.glassfish.api.deployment.archive

Examples of org.glassfish.api.deployment.archive.ReadableArchive


                while (entries.hasMoreElements()) {
                    String entry = (String)entries.nextElement();
                    //if directly under WEB-INF/lib
                    if (entry.endsWith(JAR_SUFFIX) &&
                        entry.indexOf(SEPARATOR_CHAR, WEB_INF_LIB.length() + 1 ) == -1 ) {
                        ReadableArchive weblibJarArchive = archive.getSubArchive(entry);
                        if (weblibJarArchive.exists(META_INF_BEANS_XML)) {
                            if ( logger.isLoggable( FINE ) ) {
                                logger.log(FINE,
                                           CDILoggerInfo.WEB_INF_LIB_CONSIDERING_BEAN_ARCHIVE,
                                           new Object[]{ entry });
                            }
                            weblibJarsThatAreBeanArchives.add(weblibJarArchive);

                            // This is causing tck failures, specifically
                            // MultiModuleProcessingTest.testProcessedModulesCount
                            // creating a bda for an extionsion that does not include a beans.xml is handled later
                            // when annotated types are created by that extension.  This is done in
                            // DeploymentImpl.loadBeanDeploymentArchive(Class<?> beanClass)
//                        } else if (weblibJarArchive.exists(META_INF_SERVICES_EXTENSION)) {
//                            if ( logger.isLoggable( FINE ) ) {
//                                logger.log(FINE, "-WEB-INF/lib: considering " + entry
//                                        + " as an extension and creating another BDA for it");
//                            }
//                            weblibJarsThatAreBeanArchives.add(weblibJarArchive);
                        } else {
                            // Check for classes annotated with qualified annotations
                            URI entryPath = new File(context.getSourceDir().getAbsolutePath(), entry).toURI();
                            if (WeldUtils.hasCDIEnablingAnnotations(context, entryPath)) {
                                if ( logger.isLoggable( FINE ) ) {
                                    logger.log(FINE,
                                               CDILoggerInfo.WEB_INF_LIB_CONSIDERING_BEAN_ARCHIVE,
                                               new Object[]{ entry });
                                }
                                weblibJarsThatAreBeanArchives.add(weblibJarArchive);
                            } else {
                                if ( logger.isLoggable( FINE ) ) {
                                    logger.log(FINE,
                                               CDILoggerInfo.WEB_INF_LIB_SKIPPING_BEAN_ARCHIVE,
                                               new Object[]{ archive.getName() } );
                                }
                            }
                        }
                    }
               }

                //process all web-inf lib JARs and create BDAs for them
                List<BeanDeploymentArchiveImpl> webLibBDAs = new ArrayList<BeanDeploymentArchiveImpl>();
                if (weblibJarsThatAreBeanArchives.size() > 0) {
                    ListIterator<ReadableArchive> libJarIterator = weblibJarsThatAreBeanArchives.listIterator();
                    while (libJarIterator.hasNext()) {
                        ReadableArchive libJarArchive = (ReadableArchive)libJarIterator.next();
                        BeanDeploymentArchiveImpl wlbda = new BeanDeploymentArchiveImpl(libJarArchive,
                                ejbs, context,
                                WEB_INF_LIB + SEPARATOR_CHAR + libJarArchive.getName() /* Use WEB-INF/lib/jarName as BDA Id*/);
                        this.beanDeploymentArchives.add(wlbda); //add to list of BDAs for this WAR
                        webLibBDAs.add(wlbda);
                    }
                }
                ensureWebLibJarVisibility(webLibBDAs);
View Full Code Here


        }
        Enumeration<String> entries = archive.entries();
        while (entries.hasMoreElements()) {
            String entry = entries.nextElement();
            if (entry.endsWith(JAR_SUFFIX)){
                ReadableArchive jarArchive = archive.getSubArchive(entry);
                collectJarInfo(jarArchive, true, true);
            } else {
                handleEntry(archive, entry, true, true);
            }
        }
View Full Code Here

     */
    private boolean isJaxwsRIDeployment(AnnotationInfo annInfo) {
        boolean riDeployment = false;
        AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
        try {
            ReadableArchive moduleArchive = annInfo.getProcessingContext().getArchive();
            if (moduleArchive != null && moduleArchive.exists("WEB-INF/sun-jaxws.xml")
                    && !((Class)annInfo.getAnnotatedElement()).isInterface()
                    && ( (annCtx instanceof WebBundleContext) || (annCtx instanceof WebComponentContext))) {
                riDeployment = true;
            }
        } catch (Exception e) {
View Full Code Here

     */
    private boolean isJaxwsRIDeployment(AnnotationInfo annInfo) {
        boolean riDeployment = false;
        AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
        try {
            ReadableArchive moduleArchive = annInfo.getProcessingContext().getArchive();
            if (moduleArchive != null && moduleArchive.exists("WEB-INF/sun-jaxws.xml")
                    && !((Class)annInfo.getAnnotatedElement()).isInterface()
                    && ( (annCtx instanceof WebBundleContext) || (annCtx instanceof WebComponentContext))) {
                riDeployment = true;
            }
        } catch (Exception e) {
View Full Code Here

        }
        return rarName;
    }

    public static boolean isEmbedded(DeploymentContext context) {
        ReadableArchive archive = context.getSource();
        return (archive != null && archive.getParentArchive() != null);
    }
View Full Code Here

        return (archive != null && archive.getParentArchive() != null);
    }

    public static String getApplicationName(DeploymentContext context) {
        String applicationName = null;
        ReadableArchive parentArchive = context.getSource().getParentArchive();
        if (parentArchive != null) {
            applicationName = parentArchive.getName();
        }else{
            applicationName = context.getSource().getName();
        }
        return applicationName;
    }
View Full Code Here

        List<URL> libraryURLs = new ArrayList<URL>();

        // add libraries referenced through manifest
        libraryURLs.addAll(DeploymentUtils.getManifestLibraries(archive));

        ReadableArchive parentArchive = archive.getParentArchive();

        if (parentArchive == null || bundleDesc == null) {
            // ear level or standalone module
            return libraryURLs;
        }

        File appRoot = new File(parentArchive.getURI());

        ModuleDescriptor moduleDesc = ((BundleDescriptor)bundleDesc).getModuleDescriptor();
        Application app = ((BundleDescriptor)moduleDesc.getDescriptor()).getApplication();

        // add libraries jars inside application lib directory
View Full Code Here

                while (entries.hasMoreElements()) {
                    String entry = (String)entries.nextElement();
                    //if directly under WEB-INF/lib
                    if (entry.endsWith(JAR_SUFFIX) &&
                        entry.indexOf(SEPARATOR_CHAR, WEB_INF_LIB.length() + 1 ) == -1 ) {
                        ReadableArchive weblibJarArchive = archive.getSubArchive(entry);
                        if (weblibJarArchive.exists(META_INF_BEANS_XML)) {
                            if ( logger.isLoggable( FINE ) ) {
                                logger.log(FINE, "-WEB-INF/lib: considering " + entry
                                  + " as a bean archive and hence added another BDA for it");
                            }
                            weblibJarsThatAreBeanArchives.add(weblibJarArchive);

                            // This is causing tck failures, specifically
                            // MultiModuleProcessingTest.testProcessedModulesCount
                            // creating a bda for an extionsion that does not include a beans.xml is handled later
                            // when annotated types are created by that extension.  This is done in
                            // DeploymentImpl.loadBeanDeploymentArchive(Class<?> beanClass)
//                        } else if (weblibJarArchive.exists(META_INF_SERVICES_EXTENSION)) {
//                            if ( logger.isLoggable( FINE ) ) {
//                                logger.log(FINE, "-WEB-INF/lib: considering " + entry
//                                        + " as an extension and creating another BDA for it");
//                            }
//                            weblibJarsThatAreBeanArchives.add(weblibJarArchive);
                        } else {
                            if ( logger.isLoggable( FINE ) ) {
                                logger.log(FINE, "-WEB-INF/lib: skipping " + archive.getName()
                                              + " as it doesn't have beans.xml or an extension");
                            }
                        }
                    }
               }

                //process all web-inf lib JARs and create BDAs for them
                List<BeanDeploymentArchiveImpl> webLibBDAs = new ArrayList<BeanDeploymentArchiveImpl>();
                if (weblibJarsThatAreBeanArchives.size() > 0) {
                    ListIterator<ReadableArchive> libJarIterator = weblibJarsThatAreBeanArchives.listIterator();
                    while (libJarIterator.hasNext()) {
                        ReadableArchive libJarArchive = (ReadableArchive)libJarIterator.next();
                        BeanDeploymentArchiveImpl wlbda = new BeanDeploymentArchiveImpl(libJarArchive,
                                ejbs, context,
                                WEB_INF_LIB + SEPARATOR_CHAR + libJarArchive.getName() /* Use WEB-INF/lib/jarName as BDA Id*/);
                        this.beanDeploymentArchives.add(wlbda); //add to list of BDAs for this WAR
                        webLibBDAs.add(wlbda);
                    }
                }
                ensureWebLibJarVisibility(webLibBDAs);
View Full Code Here

        }
        Enumeration<String> entries = archive.entries();
        while (entries.hasMoreElements()) {
            String entry = entries.nextElement();
            if (entry.endsWith(JAR_SUFFIX)){
                ReadableArchive jarArchive = archive.getSubArchive(entry);
                collectJarInfo(jarArchive, true);
            } else {
                handleEntry(archive, entry, true);
            }
        }
View Full Code Here

                    String entryName = entries.nextElement();
                    // if a jar is directly in lib dir and not WEB-INF/lib/foo/bar.jar
                    if (entryName.endsWith(JAR_SUFFIX) &&
                        entryName.indexOf(SEPARATOR_CHAR, libDir.length() + 1 ) == -1 ) {
                        try {
                            ReadableArchive jarInLib = archive.getSubArchive(entryName);
                            if (jarInLib.exists(META_INF_BEANS_XML)) {
                                if (libJars == null) {
                                    libJars = new ArrayList<ReadableArchive>();
                                }
                                libJars.add(jarInLib);
                                // This is causing tck failures, specifically
                                // MultiModuleProcessingTest.testProcessedModulesCount
                                // creating a bda for an extionsion that does not include a beans.xml is handled later
                                // when annotated types are created by that extension.  This is done in
                                // loadBeanDeploymentArchive(Class<?> beanClass)
//                            } else if (jarInLib.exists(META_INF_SERVICES_EXTENSION)){
//                                if (libJars == null) {
//                                    libJars = new ArrayList<ReadableArchive>();
//                                }
//                                libJars.add(jarInLib);
                            }
                        } catch (IOException e) {
                            logger.log(FINE, "Exception thrown while scanning for library jars", e);
                        }
                    }
                }
            }
        }

        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);
View Full Code Here

TOP

Related Classes of org.glassfish.api.deployment.archive.ReadableArchive

Copyright © 2018 www.massapicom. 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.