/jboss-as-7.1.1.Final/ejb3/src/main/java/org/jboss/as/ejb3/deployment/processors/AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java
Java | 68 lines | 32 code | 6 blank | 30 comment | 2 complexity | e04f1910c095582f986854b67dba64ce MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
1/*
2 * JBoss, Home of Professional Open Source.
3 * Copyright (c) 2012, Red Hat, Inc., and individual contributors
4 * as indicated by the @author tags. See the copyright.txt file in the
5 * distribution for a full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22package org.jboss.as.ejb3.deployment.processors;
23
24import org.jboss.as.server.deployment.DeploymentUnit;
25import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
26import org.jboss.as.server.deployment.DeploymentUnitProcessor;
27import org.jboss.as.server.deployment.annotation.CompositeIndex;
28import org.jboss.logging.Logger;
29import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
30
31/**
32 * Make sure we process annotations first and then start on the descriptors.
33 *
34 * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
35 */
36public class AnnotatedEJBComponentDescriptionDeploymentUnitProcessor extends AbstractDeploymentUnitProcessor implements DeploymentUnitProcessor {
37 private static final Logger logger = Logger.getLogger(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.class);
38 private final EJBComponentDescriptionFactory[] factories;
39
40 /**
41 * If this is an appclient we want to make the components as not installable, so we can still look up which EJB's are in
42 * the deployment, but do not actually install them
43 */
44 protected final boolean appclient;
45
46 public AnnotatedEJBComponentDescriptionDeploymentUnitProcessor(final boolean appclient) {
47 super(appclient);
48 this.appclient = appclient;
49 this.factories = new EJBComponentDescriptionFactory[] {
50 new MessageDrivenComponentDescriptionFactory(appclient),
51 new SessionBeanComponentDescriptionFactory(appclient)
52 };
53 }
54
55 @Override
56 protected void processAnnotations(final DeploymentUnit deploymentUnit, final CompositeIndex compositeIndex) throws DeploymentUnitProcessingException {
57 for (final EJBComponentDescriptionFactory factory : factories) {
58 factory.processAnnotations(deploymentUnit, compositeIndex);
59 }
60 }
61
62 @Override
63 protected void processBeanMetaData(final DeploymentUnit deploymentUnit, final EnterpriseBeanMetaData ejb) throws DeploymentUnitProcessingException {
64 for (final EJBComponentDescriptionFactory factory : factories) {
65 factory.processBeanMetaData(deploymentUnit, ejb);
66 }
67 }
68}