KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > deployment > EARDeployment


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * 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 package org.jboss.deployment;
23
24 import java.util.Map JavaDoc;
25
26 import javax.management.ObjectName JavaDoc;
27
28 import org.jboss.mx.util.ObjectNameFactory;
29 import org.jboss.system.ServiceMBeanSupport;
30
31 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
32
33 /**
34  * An EAR Deployment
35  *
36  * @see EARDeployer
37  *
38  * @author <a HREF="mailto:adrian@jboss.com">Adrian.Brock</a>
39  * @version $Revision: 37459 $
40  *
41  * @jmx:mbean extends="org.jboss.system.ServiceMBean"
42  */

43 public class EARDeployment
44    extends ServiceMBeanSupport
45    implements EARDeploymentMBean
46 {
47    // Constants -----------------------------------------------------
48

49    public static final String JavaDoc BASE_EAR_DEPLOYMENT_NAME = "jboss.j2ee:service=EARDeployment";
50
51    public static final ObjectName JavaDoc EAR_DEPLOYMENT_QUERY_NAME = ObjectNameFactory.create(BASE_EAR_DEPLOYMENT_NAME + ",*");
52    
53    // Attributes ----------------------------------------------------
54

55    private DeploymentInfo deploymentInfo;
56    private ConcurrentReaderHashMap metadata = new ConcurrentReaderHashMap();
57
58    // Static --------------------------------------------------------
59

60    public static String JavaDoc getJMXName(J2eeApplicationMetaData metaData, DeploymentInfo di)
61    {
62       String JavaDoc name = metaData.getJMXName();
63       if( name == null )
64          name = BASE_EAR_DEPLOYMENT_NAME + ",url='" + di.shortName + "'";
65       return name;
66    }
67    
68    // Constructors --------------------------------------------------
69

70    public EARDeployment(final DeploymentInfo di)
71    {
72       this.deploymentInfo = di;
73    }
74    
75    // Public --------------------------------------------------------
76

77    public String JavaDoc getJMXName() throws Exception JavaDoc
78    {
79       J2eeApplicationMetaData metaData = (J2eeApplicationMetaData) deploymentInfo.metaData;
80       return getJMXName(metaData, deploymentInfo);
81    }
82
83    /**
84     * @jmx:managed-operation
85     *
86     */

87    public Object JavaDoc resolveMetaData(Object JavaDoc key)
88    {
89       return metadata.get(key);
90    }
91
92     /**
93      * @jmx:managed-operation
94      *
95      */

96    public void addMetaData(Object JavaDoc key, Object JavaDoc value)
97    {
98       metadata.put(key, value);
99    }
100
101     /**
102      * @jmx:managed-operation
103      *
104      */

105    public Map JavaDoc getMetaData()
106    {
107       return metadata;
108    }
109 }
110
Popular Tags