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 message-destination-ref element contains a declaration
033: * of Deployment Component's reference to a message destination
034: * associated with a resource in Deployment Component's
035: * environment. It consists of:
036: * <p/>
037: * - an optional description
038: * - the message destination reference name
039: * - an optional message destination type
040: * - an optional specification as to whether
041: * the destination is used for
042: * consuming or producing messages, or both.
043: * if not specified, "both" is assumed.
044: * - an optional link to the message destination
045: * - optional injection targets
046: * <p/>
047: * The message destination type must be supplied unless an
048: * injection target is specified, in which case the type
049: * of the target is used. If both are specified, the type
050: * must be assignment compatible with the type of the injection
051: * target.
052: * <p/>
053: * Examples:
054: * <p/>
055: * <message-destination-ref>
056: * <message-destination-ref-name>jms/StockQueue
057: * </message-destination-ref-name>
058: * <message-destination-type>javax.jms.Queue
059: * </message-destination-type>
060: * <message-destination-usage>Consumes
061: * </message-destination-usage>
062: * <message-destination-link>CorporateStocks
063: * </message-destination-link>
064: * </message-destination-ref>
065: */
066: @XmlAccessorType(XmlAccessType.FIELD)
067: @XmlType(name="message-destination-refType",propOrder={"description","messageDestinationRefName","messageDestinationType","messageDestinationUsage","messageDestinationLink","mappedName","injectionTarget"})
068: public class MessageDestinationRef implements JndiReference {
069:
070: @XmlElement(required=true)
071: protected List<Text> description;
072: @XmlElement(name="message-destination-ref-name",required=true)
073: protected String messageDestinationRefName;
074: @XmlElement(name="message-destination-type")
075: protected String messageDestinationType;
076: @XmlElement(name="message-destination-usage")
077: protected MessageDestinationUsage messageDestinationUsage;
078: @XmlElement(name="message-destination-link")
079: protected String messageDestinationLink;
080: @XmlElement(name="mapped-name")
081: protected String mappedName;
082: @XmlElement(name="injection-target",required=true)
083: protected List<InjectionTarget> injectionTarget;
084: @XmlAttribute
085: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
086: @XmlID
087: protected String id;
088:
089: @XmlTransient
090: public String getName() {
091: return getMessageDestinationRefName();
092: }
093:
094: public String getKey() {
095: return getName();
096: }
097:
098: @XmlTransient
099: public String getType() {
100: return getMessageDestinationType();
101: }
102:
103: public void setName(String name) {
104: setMessageDestinationRefName(name);
105: }
106:
107: public void setType(String type) {
108: setMessageDestinationType(type);
109: }
110:
111: public List<Text> getDescription() {
112: if (description == null) {
113: description = new ArrayList<Text>();
114: }
115: return this .description;
116: }
117:
118: public String getMessageDestinationRefName() {
119: return messageDestinationRefName;
120: }
121:
122: public void setMessageDestinationRefName(String value) {
123: this .messageDestinationRefName = value;
124: }
125:
126: public String getMessageDestinationType() {
127: return messageDestinationType;
128: }
129:
130: public void setMessageDestinationType(String value) {
131: this .messageDestinationType = value;
132: }
133:
134: public MessageDestinationUsage getMessageDestinationUsage() {
135: return messageDestinationUsage;
136: }
137:
138: public void setMessageDestinationUsage(MessageDestinationUsage value) {
139: this .messageDestinationUsage = value;
140: }
141:
142: /**
143: * The Assembler sets the value to reflect the flow of messages
144: * between producers and consumers in the application.
145: * <p/>
146: * The value must be the message-destination-name of a message
147: * destination in the same Deployment File or in another
148: * Deployment File in the same Java EE application unit.
149: * <p/>
150: * Alternatively, the value may be composed of a path name
151: * specifying a Deployment File containing the referenced
152: * message destination with the message-destination-name of the
153: * destination appended and separated from the path name by
154: * "#". The path name is relative to the Deployment File
155: * containing Deployment Component that is referencing the
156: * message destination. This allows multiple message
157: * destinations with the same name to be uniquely identified.
158: */
159: public String getMessageDestinationLink() {
160: return messageDestinationLink;
161: }
162:
163: public void setMessageDestinationLink(String value) {
164: this .messageDestinationLink = value;
165: }
166:
167: public String getMappedName() {
168: return mappedName;
169: }
170:
171: public void setMappedName(String value) {
172: this .mappedName = value;
173: }
174:
175: public List<InjectionTarget> getInjectionTarget() {
176: if (injectionTarget == null) {
177: injectionTarget = new ArrayList<InjectionTarget>();
178: }
179: return this .injectionTarget;
180: }
181:
182: public String getId() {
183: return id;
184: }
185:
186: public void setId(String value) {
187: this.id = value;
188: }
189:
190: }
|