01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.ee;
20:
21: import javax.transaction.SystemException;
22: import javax.transaction.TransactionManager;
23:
24: /**
25: * This interface must be implemented by concrete plugins to application
26: * servers in order to integrate the OpenJPA runtime in a managed environment.
27: *
28: * @author Abe White
29: */
30: public interface ManagedRuntime {
31:
32: /**
33: * Return the TransactionManager for the managed runtime. This
34: * manager is used to register synchronization listeners, to
35: * map transactional PersistenceManagers to the current transaction,
36: * and possibly to enlist XA resources.
37: */
38: public TransactionManager getTransactionManager() throws Exception;
39:
40: /**
41: * Sets the rollback only flag on the current transaction. If the
42: * TransactionManager is capable of tracking the cause of the
43: * rollback-only flag, it will also pass along cause information.
44: *
45: * @param cause the Throwable that caused the transaction to be
46: * marked for rollback, or null of none is known
47: */
48: public void setRollbackOnly(Throwable cause) throws Exception;
49:
50: /**
51: * Returns the Throwable that caused the current transaction to be
52: * marked for rollback, provided that any exists.
53: *
54: * @return the Throwable cause, or null if none
55: */
56: public Throwable getRollbackCause() throws Exception;
57:
58: /**
59: * Returns a transaction key that can be used to associate transactions
60: * and Brokers.
61: * @return the transaction key
62: */
63: public Object getTransactionKey() throws Exception, SystemException;
64:
65: }
|