activemq-cpp-3.4.0

src/main/cms/XAResource.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _CMS_XARESOURCE_H_
00019 #define _CMS_XARESOURCE_H_
00020 
00021 #include <cms/Config.h>
00022 
00023 #include <cms/Xid.h>
00024 #include <cms/XAException.h>
00025 
00026 namespace cms {
00027 
00044     class CMS_API XAResource {
00045     public:
00046 
00050         static const int TMENDRSCAN;
00051 
00056         static const int TMFAIL;
00057 
00062         static const int TMJOIN;
00063 
00067         static const int TMNOFLAGS;
00068 
00072         static const int TMONEPHASE;
00073 
00078         static const int TMRESUME;
00079 
00083         static const int TMSTARTRSCAN;
00084 
00088         static const int TMSUCCESS;
00089 
00094         static const int TMSUSPEND;
00095 
00100         static const int XA_RDONLY;
00101 
00105         static const int XA_OK;
00106 
00107     public:
00108 
00109         virtual ~XAResource();
00110 
00132         virtual void commit( const Xid* xid, bool onePhase ) = 0;
00133 
00164         virtual void end( const Xid* xid, int flags ) = 0;
00165 
00178         virtual void forget( const Xid* xid ) = 0;
00179 
00190         virtual int getTransactionTimeout() const = 0;
00191 
00204         virtual bool isSameRM( const XAResource* theXAResource ) = 0;
00205 
00224         virtual int prepare( const Xid* xid ) = 0;
00225 
00245         virtual int recover(int flag, Xid** recovered ) = 0;
00246 
00256         virtual void rollback( const Xid* xid ) = 0;
00257 
00272         virtual bool setTransactionTimeout( int seconds ) = 0;
00273 
00299         virtual void start( const Xid* xid, int flags ) = 0;
00300 
00301     };
00302 
00303 }
00304 
00305 #endif /* _CMS_XARESOURCE_H_ */