01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.components.repository.helpers;
18:
19: import org.apache.cocoon.ProcessingException;
20:
21: /**
22: * A locking helper interface intended to be used by flowscripts or corresponding wrapper components.
23: */
24: public interface RepositoryTransactionHelper {
25:
26: /**
27: * beginning a transaction on the repository
28: *
29: * @return a boolean indicating success.
30: * @throws ProcessingException
31: */
32: boolean beginTran() throws ProcessingException;
33:
34: /**
35: * committing a transaction on the repository
36: *
37: * @return a boolean indicating success.
38: * @throws ProcessingException
39: */
40: boolean commitTran() throws ProcessingException;
41:
42: /**
43: * rolling back a transaction on the repository
44: *
45: * @return a boolean indicating success.
46: * @throws ProcessingException
47: */
48: boolean rollbackTran() throws ProcessingException;
49:
50: /**
51: * lock the resource
52: *
53: * @param uri the uri of the resource.
54: * @return a boolean indicating success.
55: * @throws ProcessingException
56: */
57: boolean lock(String uri) throws ProcessingException;
58:
59: /**
60: * lock the resource with explicit timeout in seconds
61: *
62: * @param uri the uri of the resource.
63: * @param timeout the lock timeout in seconds.
64: * @return a boolean indicating success.
65: * @throws ProcessingException
66: */
67: boolean lock(String uri, int timeout) throws ProcessingException;
68:
69: /**
70: * unlock resource
71: *
72: * @param uri the uri of the resource.
73: * @return a boolean indicating success.
74: * @throws ProcessingException
75: */
76: boolean unlock(String uri) throws ProcessingException;
77:
78: /**
79: * checking wether the repository supports transactions
80: *
81: * @return true if the repository supports transactions.
82: */
83: boolean supportsTransactions();
84:
85: /**
86: * checking wether the repository supports locking
87: *
88: * @return true if the repository supports locking.
89: */
90: boolean supportsLocking();
91:
92: }
|