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 resource-env-refType is used to define
033: * resource-env-type elements. It contains a declaration of a
034: * Deployment Component's reference to an administered object
035: * associated with a resource in the Deployment Component's
036: * environment. It consists of an optional description, the
037: * resource environment reference name, and an optional
038: * indication of the resource environment reference type
039: * expected by the Deployment Component code.
040: * <p/>
041: * It also includes optional elements to define injection of
042: * the named resource into fields or JavaBeans properties.
043: * <p/>
044: * The resource environment type must be supplied unless an
045: * injection target is specified, in which case the type
046: * of the target is used. If both are specified, the type
047: * must be assignment compatible with the type of the injection
048: * target.
049: * <p/>
050: * Example:
051: * <p/>
052: * <resource-env-ref>
053: * <resource-env-ref-name>jms/StockQueue
054: * </resource-env-ref-name>
055: * <resource-env-ref-type>javax.jms.Queue
056: * </resource-env-ref-type>
057: * </resource-env-ref>
058: */
059: @XmlAccessorType(XmlAccessType.FIELD)
060: @XmlType(name="resource-env-refType",propOrder={"description","resourceEnvRefName","resourceEnvRefType","mappedName","injectionTarget"})
061: public class ResourceEnvRef implements JndiReference {
062:
063: @XmlElement(required=true)
064: protected List<Text> description;
065: @XmlElement(name="resource-env-ref-name",required=true)
066: protected String resourceEnvRefName;
067: @XmlElement(name="resource-env-ref-type")
068: protected String resourceEnvRefType;
069: @XmlElement(name="mapped-name")
070: protected String mappedName;
071: @XmlElement(name="injection-target",required=true)
072: protected List<InjectionTarget> injectionTarget;
073: @XmlAttribute
074: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
075: @XmlID
076: protected String id;
077:
078: @XmlTransient
079: public String getName() {
080: return getResourceEnvRefName();
081: }
082:
083: public String getKey() {
084: return getName();
085: }
086:
087: @XmlTransient
088: public String getType() {
089: return getResourceEnvRefType();
090: }
091:
092: public void setName(String name) {
093: setResourceEnvRefName(name);
094: }
095:
096: public void setType(String type) {
097: setResourceEnvRefType(type);
098: }
099:
100: public List<Text> getDescription() {
101: if (description == null) {
102: description = new ArrayList<Text>();
103: }
104: return this .description;
105: }
106:
107: public String getResourceEnvRefName() {
108: return resourceEnvRefName;
109: }
110:
111: public void setResourceEnvRefName(String value) {
112: this .resourceEnvRefName = value;
113: }
114:
115: public String getResourceEnvRefType() {
116: return resourceEnvRefType;
117: }
118:
119: public void setResourceEnvRefType(String value) {
120: this .resourceEnvRefType = value;
121: }
122:
123: public String getMappedName() {
124: return mappedName;
125: }
126:
127: public void setMappedName(String value) {
128: this .mappedName = value;
129: }
130:
131: public List<InjectionTarget> getInjectionTarget() {
132: if (injectionTarget == null) {
133: injectionTarget = new ArrayList<InjectionTarget>();
134: }
135: return this .injectionTarget;
136: }
137:
138: public String getId() {
139: return id;
140: }
141:
142: public void setId(String value) {
143: this.id = value;
144: }
145:
146: }
|