Package org.jboss.as.deployment.unit

Examples of org.jboss.as.deployment.unit.DeploymentUnitProcessingException


        final List<AnnotationTarget> webServletAnnotationTargets = index.getAnnotationTargets(webServlet);
        if (webServletAnnotationTargets != null && webServletAnnotationTargets.size() > 0) {
            WebServletProcessor processor = new WebServletProcessor(finder);
            for (final AnnotationTarget target : webServletAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@WebServlet is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @WebServlet on " + target);
                }
                if (type != null) {
                    processor.process(metaData, type);
                }
            }
        }
        // @WebFilter
        final List<AnnotationTarget> webFilterAnnotationTargets = index.getAnnotationTargets(webFilter);
        if (webFilterAnnotationTargets != null && webFilterAnnotationTargets.size() > 0) {
            WebFilterProcessor processor = new WebFilterProcessor(finder);
            for (final AnnotationTarget target : webFilterAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@WebFilter is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @WebFilter on " + target);
                }
                if (type != null) {
                    processor.process(metaData, type);
                }
            }
        }
        // @WebListener
        final List<AnnotationTarget> webListenerAnnotationTargets = index.getAnnotationTargets(webListener);
        if (webListenerAnnotationTargets != null && webListenerAnnotationTargets.size() > 0) {
            WebListenerProcessor processor = new WebListenerProcessor(finder);
            for (final AnnotationTarget target : webListenerAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@WebListener is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @WebListener on " + target);
                }
                if (type != null) {
                    processor.process(metaData, type);
                }
            }
        }
        // @RunAs
        final List<AnnotationTarget> runAsAnnotationTargets = index.getAnnotationTargets(runAs);
        if (runAsAnnotationTargets != null && runAsAnnotationTargets.size() > 0) {
            RunAsProcessor processor = new RunAsProcessor(finder);
            AnnotationsMetaData annotations = metaData.getAnnotations();
            if (annotations == null) {
               annotations = new AnnotationsMetaData();
               metaData.setAnnotations(annotations);
            }
            for (final AnnotationTarget target : runAsAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@RunAs is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @RunAs on " + target);
                }
                if (type != null) {
                    processor.process(annotations, type);
                }
            }
        }
        // @DeclareRoles
        final List<AnnotationTarget> declareRolesAnnotationTargets = index.getAnnotationTargets(declareRoles);
        if (declareRolesAnnotationTargets != null && declareRolesAnnotationTargets.size() > 0) {
            DeclareRolesProcessor processor = new DeclareRolesProcessor(finder);
            SecurityRolesMetaData securityRoles = metaData.getSecurityRoles();
            if (securityRoles == null) {
               securityRoles = new SecurityRolesMetaData();
               metaData.setSecurityRoles(securityRoles);
            }
            for (final AnnotationTarget target : declareRolesAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@DeclareRoles is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @DeclareRoles on " + target);
                }
                if (type != null) {
                    processor.process(securityRoles, type);
                }
            }
        }
        // @MultipartConfig
        final List<AnnotationTarget> multipartConfigAnnotationTargets = index.getAnnotationTargets(multipartConfig);
        if (multipartConfigAnnotationTargets != null && multipartConfigAnnotationTargets.size() > 0) {
            MultipartConfigProcessor processor = new MultipartConfigProcessor(finder);
            AnnotationsMetaData annotations = metaData.getAnnotations();
            if (annotations == null) {
               annotations = new AnnotationsMetaData();
               metaData.setAnnotations(annotations);
            }
            for (final AnnotationTarget target : multipartConfigAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@MultipartConfig is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @MultipartConfig on " + target);
                }
                if (type != null) {
                    processor.process(annotations, type);
                }
            }
        }
        // @ServletSecurity
        final List<AnnotationTarget> servletSecurityAnnotationTargets = index.getAnnotationTargets(servletSecurity);
        if (servletSecurityAnnotationTargets != null && servletSecurityAnnotationTargets.size() > 0) {
            ServletSecurityProcessor processor = new ServletSecurityProcessor(finder);
            AnnotationsMetaData annotations = metaData.getAnnotations();
            if (annotations == null) {
               annotations = new AnnotationsMetaData();
               metaData.setAnnotations(annotations);
            }
            for (final AnnotationTarget target : servletSecurityAnnotationTargets) {
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@ServletSecurity is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                Class<?> type = null;
                try {
                    type = classLoader.loadClass(classInfo.name().toString());
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException("Could not process @ServletSecurity on " + target);
                }
                if (type != null) {
                    processor.process(annotations, type);
                }
            }
View Full Code Here


                final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
                inputFactory.setXMLResolver(NoopXmlResolver.create());
                XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
                warMetaData.setJbossWebMetaData(JBossWebMetaDataParser.parse(xmlReader));
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException("Failed to parse " + jbossWebXml, e);
            } finally {
                try {
                    if (is != null) {
                        is.close();
                    }
View Full Code Here

                        }
                    }
                    indexes.put(archive.getName(), indexer.complete());
                }
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException("Failed to index deployment root for annotations");
            }
        }
    }
View Full Code Here

                        VFSUtils.safeClose(inputStream);
                    }
                }
                return indexer.complete();
            } catch(Throwable t) {
                throw new DeploymentUnitProcessingException("Failed to index deployment root for annotations", t);
            }
        }
        return null;
    }
View Full Code Here

            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            inputFactory.setXMLResolver(NoopXmlResolver.create());
            XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
            return TldMetaDataParser.parse(xmlReader);
        } catch (Exception e) {
            throw new DeploymentUnitProcessingException("Failed to parse " + tld, e);
        } finally {
            try {
                if (is != null) {
                    is.close();
                }
View Full Code Here

TOP

Related Classes of org.jboss.as.deployment.unit.DeploymentUnitProcessingException

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.