001: /**
002: *
003: * Licensed to the Apache Software Foundation (ASF) under one or more
004: * contributor license agreements. See the NOTICE file distributed with
005: * this work for additional information regarding copyright ownership.
006: * The ASF licenses this file to You under the Apache License, Version 2.0
007: * (the "License"); you may not use this file except in compliance with
008: * the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package org.apache.openejb.jee;
018:
019: import javax.xml.bind.annotation.XmlAccessType;
020: import javax.xml.bind.annotation.XmlAccessorType;
021: import javax.xml.bind.annotation.XmlAttribute;
022: import javax.xml.bind.annotation.XmlElement;
023: import javax.xml.bind.annotation.XmlID;
024: import javax.xml.bind.annotation.XmlType;
025: import javax.xml.bind.annotation.XmlTransient;
026: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
027: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
028: import java.util.ArrayList;
029: import java.util.List;
030:
031: /**
032: * The env-entryType is used to declare an application's
033: * environment entry. The declaration consists of an optional
034: * description, the name of the environment entry, a type
035: * (optional if the value is injected, otherwise required), and
036: * an optional value.
037: * <p/>
038: * It also includes optional elements to define injection of
039: * the named resource into fields or JavaBeans properties.
040: * <p/>
041: * If a value is not specified and injection is requested,
042: * no injection will occur and no entry of the specified name
043: * will be created. This allows an initial value to be
044: * specified in the source code without being incorrectly
045: * changed when no override has been specified.
046: * <p/>
047: * If a value is not specified and no injection is requested,
048: * a value must be supplied during deployment.
049: * <p/>
050: * This type is used by env-entry elements.
051: */
052: @XmlAccessorType(XmlAccessType.FIELD)
053: @XmlType(name="env-entryType",propOrder={"description","envEntryName","envEntryType","envEntryValue","mappedName","injectionTarget"})
054: public class EnvEntry implements JndiReference {
055:
056: @XmlElement(required=true)
057: protected List<Text> description;
058: @XmlElement(name="env-entry-name",required=true)
059: protected String envEntryName;
060: @XmlElement(name="env-entry-type")
061: protected String envEntryType;
062:
063: @XmlJavaTypeAdapter(StringAdapter.class)
064: @XmlElement(name="env-entry-value")
065: protected String envEntryValue;
066:
067: @XmlElement(name="mapped-name")
068: protected String mappedName;
069: @XmlElement(name="injection-target",required=true)
070: protected List<InjectionTarget> injectionTarget;
071: @XmlAttribute
072: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
073: @XmlID
074: protected String id;
075:
076: public EnvEntry() {
077: }
078:
079: public EnvEntry(String envEntryName, String envEntryType,
080: String envEntryValue) {
081: this .envEntryName = envEntryName;
082: this .envEntryType = envEntryType;
083: this .envEntryValue = envEntryValue;
084: }
085:
086: @XmlTransient
087: public String getName() {
088: return getEnvEntryName();
089: }
090:
091: @XmlTransient
092: public String getType() {
093: return getEnvEntryType();
094: }
095:
096: public void setName(String name) {
097: setEnvEntryName(name);
098: }
099:
100: public String getKey() {
101: return getName();
102: }
103:
104: public void setType(String type) {
105: setEnvEntryType(type);
106: }
107:
108: public List<Text> getDescription() {
109: if (description == null) {
110: description = new ArrayList<Text>();
111: }
112: return this .description;
113: }
114:
115: public String getEnvEntryName() {
116: return envEntryName;
117: }
118:
119: public void setEnvEntryName(String value) {
120: this .envEntryName = value;
121: }
122:
123: /**
124: * Gets the value of the envEntryType property.
125: */
126: public String getEnvEntryType() {
127: return envEntryType;
128: }
129:
130: public void setEnvEntryType(String value) {
131: this .envEntryType = value;
132: }
133:
134: public String getEnvEntryValue() {
135: return envEntryValue;
136: }
137:
138: public void setEnvEntryValue(String value) {
139: this .envEntryValue = value;
140: }
141:
142: public String getMappedName() {
143: return mappedName;
144: }
145:
146: public void setMappedName(String value) {
147: this .mappedName = value;
148: }
149:
150: public List<InjectionTarget> getInjectionTarget() {
151: if (injectionTarget == null) {
152: injectionTarget = new ArrayList<InjectionTarget>();
153: }
154: return this .injectionTarget;
155: }
156:
157: public String getId() {
158: return id;
159: }
160:
161: public void setId(String value) {
162: this.id = value;
163: }
164:
165: }
|