亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? abstractsessionfactory.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.orm.toplink;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import oracle.toplink.exceptions.TopLinkException;
import oracle.toplink.sessions.Session;
import oracle.toplink.sessions.UnitOfWork;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Abstract SessionFactory implementation that creates proxies for
 * "managed" client Sessions and transaction-aware Session references.
 *
 * <p>Delegates to two template methods:
 *
 * @author Juergen Hoeller
 * @since 1.2.6
 * @see #getMasterSession()
 * @see #createClientSession()
 */
public abstract class AbstractSessionFactory implements SessionFactory {

	/** Logger available to subclasses */
	protected final Log logger = LogFactory.getLog(getClass());


	/**
	 * Create a plain client Session for this factory's master Session.
	 * @see #createClientSession()
	 */
	public Session createSession() throws TopLinkException {
		logger.debug("Creating TopLink client Session");
		return createClientSession();
	}

	/**
	 * Create a "managed" client Session reference for an underlying
	 * client Session created for this factory.
	 * @see #createClientSession()
	 */
	public Session createManagedClientSession() throws TopLinkException {
		logger.debug("Creating managed TopLink client Session");
		return (Session) Proxy.newProxyInstance(
				getClass().getClassLoader(), new Class[] {Session.class},
				new ManagedClientInvocationHandler(createClientSession()));
	}

	/**
	 * Create a transaction-aware Session reference for this factory's master Session,
	 * expecting transactions to be registered for this SessionFactory.
	 * @see #getMasterSession()
	 * @see oracle.toplink.sessions.Session#getActiveSession()
	 * @see oracle.toplink.sessions.Session#getActiveUnitOfWork()
	 */
	public Session createTransactionAwareSession() throws TopLinkException {
		logger.debug("Creating transaction-aware TopLink Session");
		return createTransactionAwareSession(this);
	}

	/**
	 * Create a transaction-aware Session reference for this factory's master Session,
	 * expecting transactions to be registered for the given SessionFactory.
	 * <p>This method is public to allow custom SessionFactory facades to access
	 * it directly, if necessary.
	 * @param sessionFactory the SessionFactory that transactions
	 * are expected to be registered for
	 * @see #getMasterSession()
	 * @see oracle.toplink.sessions.Session#getActiveSession()
	 * @see oracle.toplink.sessions.Session#getActiveUnitOfWork()
	 */
	public Session createTransactionAwareSession(SessionFactory sessionFactory) throws TopLinkException {
		return (Session) Proxy.newProxyInstance(
				getClass().getClassLoader(), new Class[] {Session.class},
				new TransactionAwareInvocationHandler(sessionFactory, getMasterSession()));
	}


	/**
	 * Return this factory's "master" Session.
	 * For example, a TopLink ServerSession.
	 * <p>Used for creating transaction-aware Session reference.
	 */
	protected abstract Session getMasterSession();

	/**
	 * Create a new client Session for this factory's master Session.
	 * For example, a TopLink ClientSession.
	 * <p>Used for creating plain Sessions and "managed" client Sessions.
	 * @throws TopLinkException if creation of a client Session failed
	 */
	protected abstract Session createClientSession() throws TopLinkException;


	/**
	 * Invocation handler that decorates a client Session with an "active"
	 * UnitOfWork. For use in situations where Spring's TopLinkTransactionManager
	 * requires a "managed" thread-safe TopLink Session.
	 */
	private static class ManagedClientInvocationHandler implements InvocationHandler {

		private final Session target;

		private final UnitOfWork uow;

		public ManagedClientInvocationHandler(Session target) {
			this.target = target;
			this.uow = this.target.acquireUnitOfWork();
		}

		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
			if (method.getName().equals("getActiveSession")) {
				return this.target;
			}
			else if (method.getName().equals("getActiveUnitOfWork")) {
				return this.uow;
			}
			else if (method.getName().equals("release")) {
				this.uow.release();
				this.target.release();
			}
			else if (method.getName().equals("equals")) {
				// Only consider equal when proxies are identical.
				return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
			}
			else if (method.getName().equals("hashCode")) {
				// Use hashCode of SessionFactory proxy.
				return new Integer(System.identityHashCode(proxy));
			}

			// Invoke method on target Session.
			try {
				return method.invoke(this.target, args);
			}
			catch (InvocationTargetException ex) {
				throw ex.getTargetException();
			}
		}
	}


	/**
	 * Invocation handler that delegates <code>getActiveSession</code> calls
	 * to SessionFactoryUtils, for being aware of thread-bound transactions.
	 */
	private static class TransactionAwareInvocationHandler implements InvocationHandler {

		private final SessionFactory sessionFactory;

		private final Session target;

		public TransactionAwareInvocationHandler(SessionFactory sessionFactory, Session target) {
			this.sessionFactory = sessionFactory;
			this.target = target;
		}

		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
			// Invocation on Session interface coming in...

			if (method.getName().equals("getActiveSession")) {
				// Handle getActiveSession method: return transactional Session, if any.
				try {
					return SessionFactoryUtils.doGetSession(this.sessionFactory, false);
				}
				catch (IllegalStateException ex) {
					// getActiveSession is supposed to return the Session itself if no active one found.
					return this.target;
				}
			}
			else if (method.getName().equals("getActiveUnitOfWork")) {
				// Handle getActiveUnitOfWork method: return transactional UnitOfWork, if any.
				try {
					return SessionFactoryUtils.doGetSession(this.sessionFactory, false).getActiveUnitOfWork();
				}
				catch (IllegalStateException ex) {
					// getActiveUnitOfWork is supposed to return null if no active one found.
					return null;
				}
			}
			else if (method.getName().equals("equals")) {
				// Only consider equal when proxies are identical.
				return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
			}
			else if (method.getName().equals("hashCode")) {
				// Use hashCode of SessionFactory proxy.
				return new Integer(System.identityHashCode(proxy));
			}

			// Invoke method on target Session.
			try {
				return method.invoke(this.target, args);
			}
			catch (InvocationTargetException ex) {
				throw ex.getTargetException();
			}
		}
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人av资源| 国内一区二区在线| 久久精品999| 99精品视频中文字幕| 欧美一区二区三区在线观看| 国产亚洲精品bt天堂精选| 亚洲午夜国产一区99re久久| 国产东北露脸精品视频| 51精品视频一区二区三区| 一色桃子久久精品亚洲| 黄一区二区三区| 欧美一区二区在线免费观看| 亚洲欧洲综合另类在线| 高清beeg欧美| 日韩精品中文字幕在线不卡尤物| 樱花草国产18久久久久| 国产盗摄一区二区| 久久嫩草精品久久久久| 老色鬼精品视频在线观看播放| 欧美日韩极品在线观看一区| 亚洲精品中文字幕乱码三区| 国产成人在线视频免费播放| 精品久久久久久久久久久久久久久久久 | 26uuu另类欧美亚洲曰本| 免费一级欧美片在线观看| 欧美三级午夜理伦三级中视频| 亚洲男人天堂一区| 色婷婷久久一区二区三区麻豆| 中文字幕高清不卡| 国产成人精品免费在线| 精品国产乱码久久久久久1区2区| 美女国产一区二区三区| 69堂国产成人免费视频| 日韩精彩视频在线观看| 8x福利精品第一导航| 午夜电影久久久| 欧美乱妇一区二区三区不卡视频| 天天影视涩香欲综合网| 538prom精品视频线放| 日韩av中文字幕一区二区三区 | 日韩欧美一区在线观看| 秋霞av亚洲一区二区三| 日韩一区二区视频在线观看| 久久精品国产免费| 久久综合色婷婷| 国产91丝袜在线播放九色| 国产日韩av一区| 91麻豆国产在线观看| 亚洲成人在线观看视频| 91精品国产综合久久久久久漫画| 麻豆中文一区二区| 久久久99久久| 一本大道av伊人久久综合| 亚洲综合视频在线| 538prom精品视频线放| 国产激情偷乱视频一区二区三区| 国产精品国产三级国产aⅴ原创| 在线观看视频91| 老司机精品视频线观看86| 国产精品美女一区二区三区 | 欧美日韩高清一区二区三区| 麻豆91在线观看| 国产嫩草影院久久久久| 色综合天天综合狠狠| 日本欧美一区二区在线观看| 欧美国产日本视频| 在线观看区一区二| 国产精品一区免费在线观看| 一区二区三区丝袜| 日韩一区二区三区视频在线观看| 波多野结衣在线一区| 亚洲成人av免费| 欧美高清在线一区| 欧美老肥妇做.爰bbww| 国产成人亚洲综合色影视| 亚洲综合精品久久| 久久天堂av综合合色蜜桃网| 欧美日精品一区视频| 国产不卡视频一区| 日韩成人免费电影| 亚洲另类春色校园小说| 26uuu欧美日本| 欧美日韩黄色影视| 97久久久精品综合88久久| 麻豆国产91在线播放| 一区二区三区四区激情| 国产人妖乱国产精品人妖| 欧美精品一二三| 99re成人精品视频| 国产精品中文欧美| 久久精品免费观看| 亚洲一二三专区| 专区另类欧美日韩| 久久综合久久综合亚洲| 制服丝袜成人动漫| 欧美性生活影院| 99国产精品久久| 粉嫩13p一区二区三区| 久久se这里有精品| 日韩电影在线观看网站| 亚洲第一综合色| 亚洲激情在线激情| 亚洲欧美日韩久久精品| 国产精品久久看| 国产精品无遮挡| 久久久精品黄色| 久久久噜噜噜久噜久久综合| 精品国产乱码久久久久久闺蜜| 日韩丝袜美女视频| 日韩一区二区中文字幕| 欧美一卡在线观看| 日韩欧美亚洲国产另类| 国产欧美日韩不卡| 精品国产一区二区三区久久久蜜月| 欧美日韩激情一区二区三区| 欧美日韩1234| 91麻豆精品国产91久久久久久久久 | 麻豆精品一区二区av白丝在线| 亚洲国产视频直播| 日韩成人精品视频| 蜜臀av性久久久久蜜臀aⅴ| 日韩高清国产一区在线| 蜜桃久久av一区| 国产乱码精品一区二区三区忘忧草 | 蜜桃视频在线观看一区二区| 捆绑调教一区二区三区| 国产一区二区电影| 国产福利视频一区二区三区| 成人av在线资源网站| 91在线看国产| 欧美日韩一区国产| 日韩视频免费直播| 久久综合久久综合九色| 中文av一区二区| 亚洲素人一区二区| 亚洲在线免费播放| 日韩高清一区在线| 国产一区二区三区黄视频| 不卡一卡二卡三乱码免费网站| 91丨九色porny丨蝌蚪| 欧美日韩成人在线一区| 精品国产一区二区三区久久久蜜月 | 三级成人在线视频| 国产在线精品一区在线观看麻豆| 成人免费va视频| 欧美日韩精品综合在线| 精品久久久久久久久久久久包黑料 | 欧美网站一区二区| 91精品国产综合久久精品性色| 久久精品男人的天堂| 亚洲欧美日韩中文字幕一区二区三区 | 亚洲免费三区一区二区| 日韩不卡一区二区三区| 成人在线视频一区二区| 在线国产亚洲欧美| 精品福利视频一区二区三区| 欧美国产1区2区| 天天综合色天天综合| 国产一区二区三区视频在线播放 | 国产91高潮流白浆在线麻豆 | 蜜臀av国产精品久久久久| 99久久99久久精品免费看蜜桃| 日韩一区和二区| 亚洲免费伊人电影| 国产精品亚洲午夜一区二区三区| 欧美日韩一区二区三区在线| 久久精品一区八戒影视| 亚洲大片精品永久免费| 欧美xingq一区二区| 国产欧美日产一区| 亚洲成人午夜电影| 欧美日本一区二区三区四区| 日韩视频在线你懂得| 国产真实乱对白精彩久久| 在线视频一区二区三| 久久久久久久久久久久电影 | 欧洲精品在线观看| 国产亚洲精品超碰| 91精品国产综合久久久久| 亚洲欧美另类久久久精品| 美脚の诱脚舐め脚责91| 在线观看av一区二区| 国产精品女上位| 精品夜夜嗨av一区二区三区| 在线观看国产一区二区| 久久久无码精品亚洲日韩按摩| 午夜精品成人在线| 91免费看片在线观看| 中文字幕乱码久久午夜不卡| 理论电影国产精品| 欧美一区二区三区影视| 一区二区三区欧美久久| 97久久精品人人澡人人爽| 久久九九久久九九| 国内成人自拍视频| 日韩欧美一区电影| 日韩精品成人一区二区在线| 精品视频在线看| 一区二区三区在线视频观看58| www.欧美精品一二区|