001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.command;
018
019import org.apache.activemq.util.IntrospectionSupport;
020
021/**
022 * @openwire:marshaller code="54"
023 */
024public class JournalTransaction implements DataStructure {
025
026    public static final byte DATA_STRUCTURE_TYPE = CommandTypes.JOURNAL_TRANSACTION;
027
028    public static final byte XA_PREPARE = 1;
029    public static final byte XA_COMMIT = 2;
030    public static final byte XA_ROLLBACK = 3;
031    public static final byte LOCAL_COMMIT = 4;
032    public static final byte LOCAL_ROLLBACK = 5;
033
034    public byte type;
035    public boolean wasPrepared;
036    public TransactionId transactionId;
037
038    public JournalTransaction(byte type, TransactionId transactionId, boolean wasPrepared) {
039        this.type = type;
040        this.transactionId = transactionId;
041        this.wasPrepared = wasPrepared;
042    }
043
044    public JournalTransaction() {
045    }
046
047    public byte getDataStructureType() {
048        return DATA_STRUCTURE_TYPE;
049    }
050
051    /**
052     * @openwire:property version=1
053     */
054    public TransactionId getTransactionId() {
055        return transactionId;
056    }
057
058    public void setTransactionId(TransactionId transactionId) {
059        this.transactionId = transactionId;
060    }
061
062    /**
063     * @openwire:property version=1
064     */
065    public byte getType() {
066        return type;
067    }
068
069    public void setType(byte type) {
070        this.type = type;
071    }
072
073    /**
074     * @openwire:property version=1
075     */
076    public boolean getWasPrepared() {
077        return wasPrepared;
078    }
079
080    public void setWasPrepared(boolean wasPrepared) {
081        this.wasPrepared = wasPrepared;
082    }
083
084    public boolean isMarshallAware() {
085        return false;
086    }
087
088    public String toString() {
089        return IntrospectionSupport.toString(this, JournalTransaction.class);
090    }
091}