⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mylobhandler.java

📁 Jaoso新闻文章发布系统 0.9.1final 程序架构: Struts+Spring+Hibernate 主要功能:   ·新闻采用在线编辑器,可以象使用word一样编辑新闻,可简繁
💻 JAVA
字号:
package jaoso.framework.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.jdbc.support.lob.LobCreator;
import org.springframework.jdbc.support.lob.LobHandler;

import java.io.InputStream;
import java.io.Reader;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author ��Ե�¿�
 * @since 2004-10-7
 */
public class MyLobHandler implements LobHandler {
	private final Log log = LogFactory.getLog(getClass());

	private LobHandler defaultLobHandler;

	private LobHandler oracleLobHandler;

	private LobHandler myLobHandler;

	private boolean isOracle;

	private String dataBaseType;

	/**
	 *  
	 */
	private MyLobHandler() {
		super();
	}

	/**
	 * @return Returns the isOracle.
	 */
	private boolean isOracle() {
		return getDataBaseType().indexOf("Oracle") != -1;
	}

	/**
	 * @return Returns the oracleLobHandler.
	 */
	private LobHandler getOracleLobHandler() {
		return oracleLobHandler;
	}

	/**
	 * @param oracleLobHandler
	 *            The oracleLobHandler to set.
	 */
	public void setOracleLobHandler(LobHandler oracleLobHandler) {
		this.oracleLobHandler = oracleLobHandler;
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.support.lob.LobHandler#getBlobAsBytes(java.sql.ResultSet,
	 *      int)
	 */
	public byte[] getBlobAsBytes(ResultSet arg0, int arg1) throws SQLException {
		return getMyLobHandler().getBlobAsBytes(arg0, arg1);
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.support.lob.LobHandler#getBlobAsBinaryStream(java.sql.ResultSet,
	 *      int)
	 */
	public InputStream getBlobAsBinaryStream(ResultSet arg0, int arg1)
			throws SQLException {
		return getMyLobHandler().getBlobAsBinaryStream(arg0, arg1);
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.support.lob.LobHandler#getClobAsString(java.sql.ResultSet,
	 *      int)
	 */
	public String getClobAsString(ResultSet arg0, int arg1) throws SQLException {
		return getMyLobHandler().getClobAsString(arg0, arg1);
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.support.lob.LobHandler#getClobAsAsciiStream(java.sql.ResultSet,
	 *      int)
	 */
	public InputStream getClobAsAsciiStream(ResultSet arg0, int arg1)
			throws SQLException {
		return getMyLobHandler().getClobAsAsciiStream(arg0, arg1);
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.support.lob.LobHandler#getClobAsCharacterStream(java.sql.ResultSet,
	 *      int)
	 */
	public Reader getClobAsCharacterStream(ResultSet arg0, int arg1)
			throws SQLException {
		return getMyLobHandler().getClobAsCharacterStream(arg0, arg1);
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.support.lob.LobHandler#getLobCreator()
	 */
	public LobCreator getLobCreator() {
		return getMyLobHandler().getLobCreator();
	}

	/**
	 * @return Returns the myLobHandler.
	 */
	private LobHandler getMyLobHandler() {
		if (isOracle()) {
			myLobHandler = getOracleLobHandler();
		} else {
			myLobHandler = getDefaultLobHandler();
		}

		return myLobHandler;
	}

	/**
	 * @param myLobHandler
	 *            The myLobHandler to set.
	 */
	private void setMyLobHandler(LobHandler myLobHandler) {
		this.myLobHandler = myLobHandler;
	}

	/**
	 * @return Returns the defaultLobHandler.
	 */
	private LobHandler getDefaultLobHandler() {
		return defaultLobHandler;
	}

	/**
	 * @param defaultLobHandler
	 *            The defaultLobHandler to set.
	 */
	public void setDefaultLobHandler(LobHandler defaultLobHandler) {
		this.defaultLobHandler = defaultLobHandler;
	}

	/**
	 * @return Returns the dataBaseType.
	 */
	private String getDataBaseType() {
		return dataBaseType;
	}

	/**
	 * @param dataBaseType
	 *            The dataBaseType to set.
	 */
	public void setDataBaseType(String dataBaseType) {
		this.dataBaseType = dataBaseType;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -