KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > kernel > deployment > jboss > JBossBeanDeployer


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.kernel.deployment.jboss;
23
24 import java.net.URL JavaDoc;
25
26 import org.jboss.deployment.DeploymentException;
27 import org.jboss.deployment.DeploymentInfo;
28 import org.jboss.deployment.SchemaResolverSimpleSubDeployerSupport;
29 import org.jboss.kernel.spi.deployment.KernelDeployment;
30
31 /**
32  * A bean deployer for use with the JBoss JMX Deployers framework
33  *
34  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
35  * @version $Revision: 40704 $
36  */

37 public class JBossBeanDeployer extends SchemaResolverSimpleSubDeployerSupport implements JBossBeanDeployerMBean
38 {
39    protected String JavaDoc extension = ".beans";
40    
41    protected String JavaDoc metaDataURL = "META-INF/jboss-beans.xml";
42    
43    public JBossBeanDeployer()
44    {
45       setEnhancedSuffixes(new String JavaDoc[] { "200:.beans" });
46    }
47    
48    public String JavaDoc getExtension()
49    {
50       return extension;
51    }
52
53    public void setExtension(String JavaDoc extension)
54    {
55       this.extension = extension;
56    }
57    
58    public String JavaDoc getMetaDataURL()
59    {
60       return metaDataURL;
61    }
62    
63    public void setMetaDataURL(String JavaDoc metaDataURL)
64    {
65       this.metaDataURL = metaDataURL;
66    }
67
68    public String JavaDoc getObjectName(DeploymentInfo di) throws DeploymentException
69    {
70       String JavaDoc name = di.shortName;
71       di = di.parent;
72       while (di != null)
73       {
74          name = di.shortName + "#" + name;
75          di = di.parent;
76       }
77       return "jboss.beans:service=JBossBeanDeployment,name='" + name + "'";
78    }
79
80    public String JavaDoc getDeploymentClass()
81    {
82       return JBossBeanDeployment.class.getName();
83    }
84
85    protected void parseMetaData(DeploymentInfo di, URL JavaDoc url) throws DeploymentException
86    {
87       super.parseMetaData(di, url);
88       KernelDeployment deployment = (KernelDeployment) di.metaData;
89       deployment.setName(url.toString());
90    }
91 }
92
Popular Tags