PageRenderTime 38ms CodeModel.GetById 24ms app.highlight 13ms RepoModel.GetById 0ms app.codeStats 0ms

/jboss-as-7.1.1.Final/ee/src/main/java/org/jboss/as/ee/component/deployers/AbstractComponentConfigProcessor.java

#
Java | 78 lines | 29 code | 8 blank | 41 comment | 6 complexity | 91b98afb8b0e87b90b3b894d17fd8b8b MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
 1/*
 2 * JBoss, Home of Professional Open Source.
 3 * Copyright 2010, 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 */
22
23package org.jboss.as.ee.component.deployers;
24
25import org.jboss.as.ee.component.Attachments;
26import org.jboss.as.ee.component.ComponentDescription;
27import org.jboss.as.ee.component.EEModuleDescription;
28import org.jboss.as.server.deployment.DeploymentPhaseContext;
29import org.jboss.as.server.deployment.DeploymentUnit;
30import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
31import org.jboss.as.server.deployment.DeploymentUnitProcessor;
32import org.jboss.as.server.deployment.annotation.CompositeIndex;
33
34import java.util.Collection;
35
36/**
37 * Abstract deployment unit processors used to process {@link org.jboss.as.ee.component.ComponentDescription} instances.
38 *
39 * @author John Bailey
40 */
41public abstract class AbstractComponentConfigProcessor implements DeploymentUnitProcessor {
42
43    /**
44     * {@inheritDoc} *
45     */
46    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
47        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
48        final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
49        final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
50        if (componentConfigurations == null || componentConfigurations.isEmpty()) {
51            return;
52        }
53
54        for (ComponentDescription componentConfiguration : componentConfigurations) {
55            final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
56            if (index != null) {
57                processComponentConfig(deploymentUnit, phaseContext, index, componentConfiguration);
58            }
59        }
60    }
61
62    /**
63     * Process the component configuration instance.
64     *
65     * @param deploymentUnit         The deployment unit
66     * @param phaseContext           The phase context
67     * @param index                  The annotation index
68     * @param componentDescription The component configuration
69     * @throws DeploymentUnitProcessingException if any problems occur
70     */
71    protected abstract void processComponentConfig(final DeploymentUnit deploymentUnit, final DeploymentPhaseContext phaseContext, final CompositeIndex index, final ComponentDescription componentDescription) throws DeploymentUnitProcessingException;
72
73    /**
74     * {@inheritDoc} *
75     */
76    public void undeploy(DeploymentUnit context) {
77    }
78}