PlatformTransactionManagerFacade.java
Upload User: jiancairen
Upload Date: 2007-08-27
Package Size: 26458k
Code Size: 2k
Category:

Java Develop

Development Platform:

Java

  1. /*
  2.  * Copyright 2002-2004 the original author or authors.
  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.springframework.transaction.interceptor;
  17. import org.springframework.transaction.PlatformTransactionManager;
  18. import org.springframework.transaction.TransactionDefinition;
  19. import org.springframework.transaction.TransactionStatus;
  20. /**
  21.  * Used for testing only (for example, when we must replace the
  22.  * behaviour of a PlatformTransactionManager bean we don't have access to).
  23.  * Allows behaviour of an entire class to change with static delegate change.
  24.  * Not multithreaded.
  25.  * @author Rod Johnson
  26.  * @since 26-Apr-2003
  27.  */
  28. public class PlatformTransactionManagerFacade implements PlatformTransactionManager {
  29. /**
  30.  * This member can be changed to change behaviour class-wide.
  31.  */
  32. public static PlatformTransactionManager delegate;
  33. /**
  34.  * @see org.springframework.transaction.PlatformTransactionManager#getTransaction(org.springframework.transaction.TransactionDefinition)
  35.  */
  36. public TransactionStatus getTransaction(TransactionDefinition definition) {
  37. return delegate.getTransaction(definition);
  38. }
  39. /**
  40.  * @see org.springframework.transaction.PlatformTransactionManager#commit(org.springframework.transaction.TransactionStatus)
  41.  */
  42. public void commit(TransactionStatus status) {
  43. delegate.commit(status);
  44. }
  45. /**
  46.  * @see org.springframework.transaction.PlatformTransactionManager#rollback(org.springframework.transaction.TransactionStatus)
  47.  */
  48. public void rollback(TransactionStatus status) {
  49. delegate.rollback(status);
  50. }
  51. }