001: /**
002: * EasyBeans
003: * Copyright (C) 2007 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: ContainerTransaction.java 2059 2007-11-22 17:22:33Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.deployment.xml.struct;
025:
026: import java.util.LinkedList;
027: import java.util.List;
028:
029: import javax.ejb.TransactionAttributeType;
030:
031: import org.ow2.easybeans.deployment.xml.struct.common.MethodDD;
032:
033: /**
034: * Defines a contrainer transaction used within an assembly descriptor.
035: * @author Florent BENOIT
036: */
037: public class ContainerTransaction {
038:
039: /**
040: * Name of this element.
041: */
042: public static final String NAME = "container-transaction";
043:
044: /**
045: * List of method on which apply this container transaction block.
046: */
047: private List<MethodDD> methods = null;
048:
049: /**
050: * Transaction Attribute set by this container transaction.
051: */
052: private TransactionAttributeType txAttribute = null;
053:
054: /**
055: * Defines a new Container transaction object.
056: */
057: public ContainerTransaction() {
058: this .methods = new LinkedList<MethodDD>();
059: }
060:
061: /**
062: * Add a new Method.
063: * @param method the given method.
064: */
065: public void addMethod(final MethodDD method) {
066: this .methods.add(method);
067: }
068:
069: /**
070: * @return list of methods.
071: */
072: public List<MethodDD> getMethods() {
073: return this .methods;
074: }
075:
076: /**
077: * Sets the transaction attribute for this block.
078: * @param txAttribute the given transaction attribute
079: */
080: public void setTransactionAttribute(
081: final TransactionAttributeType txAttribute) {
082: this .txAttribute = txAttribute;
083: }
084:
085: /**
086: * Gets the transaction attribute for this block.
087: * @return the transaction attribute
088: */
089: public TransactionAttributeType getTransactionAttribute() {
090: return this .txAttribute;
091: }
092:
093: /**
094: * @return string representation of this module.
095: */
096: @Override
097: public String toString() {
098: StringBuilder sb = new StringBuilder(ContainerTransaction.class
099: .getSimpleName());
100: sb.append("[");
101: for (MethodDD method : methods) {
102: sb.append(method);
103: }
104: sb.append(", txAttribute=");
105: sb.append(txAttribute);
106: sb.append("]");
107: return sb.toString();
108: }
109:
110: }
|