KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > webapps > session > TransactionManager


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.webapps.session;
17
18 import org.apache.cocoon.ProcessingException;
19 import org.apache.cocoon.webapps.session.context.SessionContext;
20
21 /**
22  * Transaction management<p>
23  * </p>
24  * Transactions are a series of get/set calls to a session context which must
25  * be seen as atomic (single modification).
26  * We distingish between reading and writing. Usually parallel reading is
27  * allowed but if one thread wants to write, no other can read or write.
28  *
29  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
30  * @version CVS $Id: TransactionManager.java 30932 2004-07-29 17:35:38Z vgritsenko $
31 */

32 public interface TransactionManager {
33
34     /** Avalon role */
35     String JavaDoc ROLE = TransactionManager.class.getName();;
36
37
38     /**
39      * Reset the transaction management state.
40      */

41     void resetTransactions(SessionContext context);
42
43     /**
44      * Start a reading transaction.
45      * This call must always be matched with a stopReadingTransaction().
46      * Otherwise the session context is blocked.
47      */

48     void startReadingTransaction(SessionContext context)
49     throws ProcessingException;
50
51     /**
52      * Stop a reading transaction.
53      * This call must always be done for each startReadingTransaction().
54      * Otherwise the session context is blocked.
55      */

56     void stopReadingTransaction(SessionContext context);
57
58     /**
59      * Start a writing transaction.
60      * This call must always be matched with a stopWritingTransaction().
61      * Otherwise the session context is blocked.
62      */

63     void startWritingTransaction(SessionContext context)
64     throws ProcessingException;
65
66     /**
67      * Stop a writing transaction.
68      * This call must always be done for each startWritingTransaction().
69      * Otherwise the session context is blocked.
70      */

71     void stopWritingTransaction(SessionContext context);
72
73 }
74
Popular Tags