KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > metadata > ActivationConfigPropertyMetaData


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.metadata;
23
24 import org.jboss.deployment.DeploymentException;
25 import org.jboss.util.Strings;
26 import org.w3c.dom.Element JavaDoc;
27
28 /**
29  * Parse the activation-config-property element used in message driven bean.
30  * It is a name/value pair
31  *
32  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>.
33  * @version $Revision: 58231 $
34  */

35 public class ActivationConfigPropertyMetaData extends MetaData
36 {
37    // Constants -----------------------------------------------------
38

39    // Attributes ----------------------------------------------------
40

41    /** The property name */
42    private String JavaDoc name;
43
44    /** The property value */
45    private String JavaDoc value;
46
47    // Static --------------------------------------------------------
48

49    // Constructors --------------------------------------------------
50

51    /**
52     * Create a new Activation Config Property MetaData object
53     */

54    public ActivationConfigPropertyMetaData()
55    {
56    }
57
58    /**
59     * Create a new Activation Config Property MetaData object
60     *
61     * @param name the name
62     * @param value the value
63     */

64    public ActivationConfigPropertyMetaData(String JavaDoc name, String JavaDoc value)
65    {
66       this.name = name;
67       this.value = value;
68    }
69    
70    // Public --------------------------------------------------------
71

72    /**
73     * Retrieve the property name
74     */

75    public String JavaDoc getName()
76    {
77       return name;
78    }
79    
80    public void setName(String JavaDoc name)
81    {
82       this.name = name;
83    }
84
85    /**
86     * Retrieve the property value
87     */

88    public String JavaDoc getValue()
89    {
90       return value;
91    }
92    
93    public void setValue(String JavaDoc value)
94    {
95       if (Strings.isValidJavaIdentifier(name) == false)
96       {
97          throw new IllegalStateException JavaDoc("activation-config-property '" + name + "' is not a valid java identifier");
98       }
99       this.value = value;
100    }
101
102    public void importXml(Element JavaDoc element) throws DeploymentException
103    {
104       name = getElementContent(getUniqueChild(element, "activation-config-property-name"));
105       value = getElementContent(getUniqueChild(element, "activation-config-property-value"));
106       if (name == null || name.trim().length() == 0)
107          throw new DeploymentException("activation-config-property doesn't have a name");
108       if (Strings.isValidJavaIdentifier(name) == false)
109          throw new DeploymentException("activation-config-property '" + name + "' is not a valid java identifier");
110    }
111
112    // Object overrides ----------------------------------------------
113

114    public String JavaDoc toString()
115    {
116       return "ActivationConfigProperty(" + name + "=" + value + ")";
117    }
118
119    // Package protected ---------------------------------------------
120

121    // Protected -----------------------------------------------------
122

123    // Private -------------------------------------------------------
124

125    // Inner classes -------------------------------------------------
126
}
127
Popular Tags