01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.jee;
17:
18: import javax.xml.bind.annotation.XmlAccessType;
19: import javax.xml.bind.annotation.XmlAccessorType;
20: import javax.xml.bind.annotation.XmlAttribute;
21: import javax.xml.bind.annotation.XmlElement;
22: import javax.xml.bind.annotation.XmlID;
23: import javax.xml.bind.annotation.XmlType;
24: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
25: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
26: import java.util.ArrayList;
27: import java.util.List;
28: import java.util.Properties;
29:
30: /**
31: * The activation-configType defines information about the
32: * expected configuration properties of the message-driven bean
33: * in its operational environment. This may include information
34: * about message acknowledgement, message selector, expected
35: * destination type, etc.
36: * <p/>
37: * The configuration information is expressed in terms of
38: * name/value configuration properties.
39: * <p/>
40: * The properties that are recognized for a particular
41: * message-driven bean are determined by the messaging type.
42: */
43: @XmlAccessorType(XmlAccessType.FIELD)
44: @XmlType(name="activation-configType",propOrder={"description","activationConfigProperty"})
45: public class ActivationConfig {
46:
47: @XmlElement(required=true)
48: protected List<Text> description;
49: @XmlElement(name="activation-config-property",required=true)
50: protected List<ActivationConfigProperty> activationConfigProperty;
51: @XmlAttribute
52: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
53: @XmlID
54: protected String id;
55:
56: public List<Text> getDescription() {
57: if (description == null) {
58: description = new ArrayList<Text>();
59: }
60: return this .description;
61: }
62:
63: public void addProperty(String name, String value) {
64: getActivationConfigProperty().add(
65: new ActivationConfigProperty(name, value));
66: }
67:
68: public List<ActivationConfigProperty> getActivationConfigProperty() {
69: if (activationConfigProperty == null) {
70: activationConfigProperty = new ArrayList<ActivationConfigProperty>();
71: }
72: return this .activationConfigProperty;
73: }
74:
75: public String getId() {
76: return id;
77: }
78:
79: public void setId(String value) {
80: this .id = value;
81: }
82:
83: public Properties toProperties() {
84: Properties properties = new Properties();
85: for (ActivationConfigProperty property : getActivationConfigProperty()) {
86: String name = property.getActivationConfigPropertyName();
87: String value = property.getActivationConfigPropertyValue();
88: properties.put(name, value);
89: }
90: return properties;
91: }
92: }
|