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 container-transactionType specifies how the container
033: * must manage transaction scopes for the enterprise bean's
034: * method invocations. It defines an optional description, a
035: * list of method elements, and a transaction attribute. The
036: * transaction attribute is to be applied to all the specified
037: * methods.
038: */
039: @XmlAccessorType(XmlAccessType.FIELD)
040: @XmlType(name="container-transactionType",propOrder={"descriptions","method","transAttribute"})
041: public class ContainerTransaction {
042:
043: @XmlElement(required=true)
044: protected List<Method> method;
045: @XmlElement(name="trans-attribute",required=true)
046: protected TransAttribute transAttribute;
047: @XmlAttribute
048: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
049: @XmlID
050: protected String id;
051:
052: @XmlTransient
053: protected TextMap description = new TextMap();
054:
055: @XmlElement(name="description",required=true)
056: public Text[] getDescriptions() {
057: return description.toArray();
058: }
059:
060: public ContainerTransaction() {
061: }
062:
063: public ContainerTransaction(TransAttribute transAttribute,
064: String className, String ejbName, String methodName) {
065: this (transAttribute, new Method(ejbName, className, methodName));
066: }
067:
068: public ContainerTransaction(TransAttribute transAttribute,
069: String ejbName, java.lang.reflect.Method method) {
070: this (transAttribute, new Method(ejbName, method));
071: }
072:
073: public ContainerTransaction(TransAttribute transAttribute,
074: Method method) {
075: this .transAttribute = transAttribute;
076: getMethod().add(method);
077: }
078:
079: public void setDescriptions(Text[] text) {
080: description.set(text);
081: }
082:
083: public String getDescription() {
084: return description.get();
085: }
086:
087: public List<Method> getMethod() {
088: if (method == null) {
089: method = new ArrayList<Method>();
090: }
091: return this .method;
092: }
093:
094: public TransAttribute getTransAttribute() {
095: return transAttribute;
096: }
097:
098: public void setTransAttribute(TransAttribute value) {
099: this .transAttribute = value;
100: }
101:
102: public String getId() {
103: return id;
104: }
105:
106: public void setId(String value) {
107: this.id = value;
108: }
109:
110: }
|