001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.metadata;
023:
024: import org.jboss.deployment.DeploymentException;
025: import org.jboss.util.Strings;
026: import org.w3c.dom.Element;
027:
028: /**
029: * Parse the activation-config-property element used in message driven bean.
030: * It is a name/value pair
031: *
032: * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>.
033: * @version $Revision: 57209 $
034: */
035: public class ActivationConfigPropertyMetaData extends MetaData {
036: // Constants -----------------------------------------------------
037:
038: // Attributes ----------------------------------------------------
039:
040: /** The property name */
041: private String name;
042:
043: /** The property value */
044: private String value;
045:
046: // Static --------------------------------------------------------
047:
048: // Constructors --------------------------------------------------
049:
050: /**
051: * Create a new Activation Config Property MetaData object
052: */
053: public ActivationConfigPropertyMetaData() {
054: }
055:
056: /**
057: * Create a new Activation Config Property MetaData object
058: *
059: * @param name the name
060: * @param value the value
061: */
062: public ActivationConfigPropertyMetaData(String name, String value) {
063: this .name = name;
064: this .value = value;
065: }
066:
067: // Public --------------------------------------------------------
068:
069: /**
070: * Retrieve the property name
071: */
072: public String getName() {
073: return name;
074: }
075:
076: public void setName(String name) {
077: this .name = name;
078: }
079:
080: /**
081: * Retrieve the property value
082: */
083: public String getValue() {
084: return value;
085: }
086:
087: public void setValue(String value) {
088: this .value = value;
089: }
090:
091: public void importXml(Element element) throws DeploymentException {
092: name = getElementContent(getUniqueChild(element,
093: "activation-config-property-name"));
094: value = getElementContent(getUniqueChild(element,
095: "activation-config-property-value"));
096: if (name == null || name.trim().length() == 0)
097: throw new DeploymentException(
098: "activation-config-property doesn't have a name");
099: if (Strings.isValidJavaIdentifier(name) == false)
100: throw new DeploymentException(
101: "activation-config-property '" + name
102: + "' is not a valid java identifier");
103: }
104:
105: // Object overrides ----------------------------------------------
106:
107: public String toString() {
108: return "ActivationConfigProperty(" + name + "=" + value + ")";
109: }
110:
111: // Package protected ---------------------------------------------
112:
113: // Protected -----------------------------------------------------
114:
115: // Private -------------------------------------------------------
116:
117: // Inner classes -------------------------------------------------
118: }
|