db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer StatementManager.java
Date Fri, 02 May 2003 18:13:28 GMT
brj         2003/05/02 11:13:28

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        StatementManager.java
  Log:
  minor refactoring
  to get rid of warnings
  
  Revision  Changes    Path
  1.33      +50 -50    db-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
  
  Index: StatementManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- StatementManager.java	29 Apr 2003 16:26:55 -0000	1.32
  +++ StatementManager.java	2 May 2003 18:13:28 -0000	1.33
  @@ -95,27 +95,27 @@
    */
   public class StatementManager implements StatementManagerIF
   {
  -	private Logger log = LoggerFactory.getLogger(StatementManager.class);
  +	private Logger m_log = LoggerFactory.getLogger(StatementManager.class);
   
   	/** internal table of StatementForClass objects */
  -	private Map statementTable = new WeakHashMap();
  +	private Map m_statementTable = new WeakHashMap();
   	/** the associated broker */
  -	private final PersistenceBroker broker;
  -	private Platform platform;
  +	private final PersistenceBroker m_broker;
  +	private Platform m_platform;
   	/**
   	 * Used when OJB run in JBoss
   	 * @todo Find a better solution to handle OJB within JBoss
   	 * --> the JCA implementation should solve this problem
   	 */
   	private boolean m_eagerRelease;
  -	private ConnectionManagerIF conMan;
  +	private ConnectionManagerIF m_conMan;
   
   	public StatementManager(final PersistenceBroker pBroker)
   	{
  -		this.broker = pBroker;
  -		this.conMan = broker.serviceConnectionManager();
  -		m_eagerRelease = conMan.getConnectionDescriptor().getEagerRelease();
  -		platform = PlatformFactory.getPlatformFor(conMan.getConnectionDescriptor());
  +		this.m_broker = pBroker;
  +		this.m_conMan = m_broker.serviceConnectionManager();
  +		m_eagerRelease = m_conMan.getConnectionDescriptor().getEagerRelease();
  +		m_platform = PlatformFactory.getPlatformFor(m_conMan.getConnectionDescriptor());
   	}
   
   	/**
  @@ -125,13 +125,13 @@
   	 */
   	protected StatementsForClassIF getStatementsForClass(ClassDescriptor cds) throws PersistenceBrokerException
   	{
  -		StatementsForClassIF sfc = (StatementsForClassIF) statementTable.get(cds);
  +		StatementsForClassIF sfc = (StatementsForClassIF) m_statementTable.get(cds);
   		if (sfc == null)
   		{
  -			synchronized (statementTable)
  +			synchronized (m_statementTable)
   			{
  -				sfc = (StatementsForClassIF) new StatementsForClassImpl(conMan.getConnectionDescriptor(),
cds);
  -				statementTable.put(cds, sfc);
  +				sfc = (StatementsForClassIF) new StatementsForClassImpl(m_conMan.getConnectionDescriptor(),
cds);
  +				m_statementTable.put(cds, sfc);
   			}
   		}
   		return sfc;
  @@ -139,11 +139,11 @@
   
   	public void closeResources(Statement stmt, ResultSet rs)
   	{
  -		if (log.isDebugEnabled())
  -			log.debug("closeResources was called");
  +		if (m_log.isDebugEnabled())
  +			m_log.debug("closeResources was called");
   		try
   		{
  -			platform.beforeStatementClose(stmt, rs);
  +			m_platform.beforeStatementClose(stmt, rs);
   			//close statement on wrapped statement class, or real statement
   			if (stmt != null)
   			{
  @@ -157,20 +157,20 @@
   				*/
   				if (m_eagerRelease)
   				{
  -					conMan.releaseConnection();
  +					m_conMan.releaseConnection();
   				}
   
   			}
  -			platform.afterStatementClose(stmt, rs);
  +			m_platform.afterStatementClose(stmt, rs);
   		}
   		catch (PlatformException e)
   		{
  -			log.error("Platform dependent operation failed", e);
  +			m_log.error("Platform dependent operation failed", e);
   		}
   		catch (SQLException ignored)
   		{
  -			if (log.isDebugEnabled())
  -				log.debug("Statement closing failed", ignored);
  +			if (m_log.isDebugEnabled())
  +				m_log.debug("Statement closing failed", ignored);
   		}
   	}
   
  @@ -184,21 +184,21 @@
   
   		if (cld == null)
   		{
  -			cld = broker.getClassDescriptor(oid.getObjectsClass());
  +			cld = m_broker.getClassDescriptor(oid.getObjectsClass());
   		}
   
  -		values = getKeyValues(broker, cld, oid);
  +		values = getKeyValues(m_broker, cld, oid);
   
   		try
   		{
   			for (i = 0; i < values.length; i++)
   			{
  -				platform.setObjectForStatement(stmt, i + 1, values[i], SqlHelper.getSqlTypePk(cld,
i));
  +				m_platform.setObjectForStatement(stmt, i + 1, values[i], SqlHelper.getSqlTypePk(cld,
i));
   			}
   		}
   		catch (SQLException e)
   		{
  -			log.error("bindDelete failed for: " + oid.toString() + ", PK: " + i + ", value: " +
values[i]);
  +			m_log.error("bindDelete failed for: " + oid.toString() + ", PK: " + i + ", value: "
+ values[i]);
   			throw e;
   		}
   	}
  @@ -214,10 +214,10 @@
   		currentLockingValues = cld.getCurrentLockingValues(obj);
   
   		// parameters for WHERE-clause pk
  -		values = getKeyValues(broker, cld, obj);
  +		values = getKeyValues(m_broker, cld, obj);
   		for (int i = 0; i < values.length; i++)
   		{
  -			platform.setObjectForStatement(stmt, index, values[i], SqlHelper.getSqlTypePk(cld, i));
  +			m_platform.setObjectForStatement(stmt, index, values[i], SqlHelper.getSqlTypePk(cld,
i));
   			index++;
   		}
   
  @@ -225,7 +225,7 @@
   		values = currentLockingValues;
   		for (int i = 0; i < values.length; i++)
   		{
  -			platform.setObjectForStatement(stmt, index, values[i], SqlHelper.getSqlTypeLocking(cld,
i));
  +			m_platform.setObjectForStatement(stmt, index, values[i], SqlHelper.getSqlTypeLocking(cld,
i));
   			index++;
   		}
   	}
  @@ -259,11 +259,11 @@
   			// BRJ: use field conversions and platform
   			if (value != null)
   			{
  -				platform.setObjectForStatement(stmt, index, fld.getFieldConversion().javaToSql(value),
fld.getColumnJdbcType());
  +				m_platform.setObjectForStatement(stmt, index, fld.getFieldConversion().javaToSql(value),
fld.getColumnJdbcType());
   			}
   			else
   			{
  -				platform.setNullForStatement(stmt, index, fld.getColumnJdbcType());
  +				m_platform.setNullForStatement(stmt, index, fld.getColumnJdbcType());
   			}
   		}
   		else
  @@ -490,11 +490,11 @@
   			Object val = values[i];
   			if (val != null)
   			{
  -				platform.setObjectForStatement(stmt, i + 1, val, SqlHelper.getSqlTypeRwAll(cld, i));
  +				m_platform.setObjectForStatement(stmt, i + 1, val, SqlHelper.getSqlTypeRwAll(cld, i));
   			}
   			else
   			{
  -				platform.setNullForStatement(stmt, i + 1, SqlHelper.getSqlTypeRwAll(cld, i));
  +				m_platform.setNullForStatement(stmt, i + 1, SqlHelper.getSqlTypeRwAll(cld, i));
   			}
   
   		}
  @@ -510,27 +510,27 @@
   
   		if (cld == null)
   		{
  -			cld = broker.getClassDescriptor(oid.getObjectsClass());
  +			cld = m_broker.getClassDescriptor(oid.getObjectsClass());
   		}
   		try
   		{
  -			values = getKeyValues(broker, cld, oid);
  +			values = getKeyValues(m_broker, cld, oid);
   			for (i = 0; i < values.length; i++)
   			{
   				Object val = values[i];
   				if (val != null)
   				{
  -					platform.setObjectForStatement(stmt, i + 1, val, SqlHelper.getSqlTypePk(cld, i));
  +					m_platform.setObjectForStatement(stmt, i + 1, val, SqlHelper.getSqlTypePk(cld, i));
   				}
   				else
   				{
  -					platform.setNullForStatement(stmt, i + 1, SqlHelper.getSqlTypePk(cld, i));
  +					m_platform.setNullForStatement(stmt, i + 1, SqlHelper.getSqlTypePk(cld, i));
   				}
   			}
   		}
   		catch (SQLException e)
   		{
  -			log.error("bindSelect failed for: " + oid.toString() + ", PK: " + i + ", value: " +
values[i]);
  +			m_log.error("bindSelect failed for: " + oid.toString() + ", PK: " + i + ", value: "
+ values[i]);
   			throw e;
   		}
   	}
  @@ -545,20 +545,20 @@
   
   		currentLockingValues = cld.getCurrentLockingValues(obj);
   		cld.updateLockingValues(obj); // BRJ
  -		values = getNonKeyValues(broker, cld, obj);
  +		values = getNonKeyValues(m_broker, cld, obj);
   
   		// parameters for SET-clause
   		for (int i = 0; i < values.length; i++)
   		{
   			Object val = values[i];
   			if (val != null)
  -				platform.setObjectForStatement(stmt, index, val, SqlHelper.getSqlTypeRwNonPk(cld, i));
  +				m_platform.setObjectForStatement(stmt, index, val, SqlHelper.getSqlTypeRwNonPk(cld,
i));
   			else
  -				platform.setNullForStatement(stmt, index, SqlHelper.getSqlTypeRwNonPk(cld, i));
  +				m_platform.setNullForStatement(stmt, index, SqlHelper.getSqlTypeRwNonPk(cld, i));
   			index++;
   		}
   		// parameters for WHERE-clause pk
  -		values = getKeyValues(broker, cld, obj);
  +		values = getKeyValues(m_broker, cld, obj);
   		for (int i = 0; i < values.length; i++)
   		{
   			Object val = values[i];
  @@ -602,7 +602,7 @@
   		{
   			for (int i = 0; i < values.length; i++)
   			{
  -				platform.setObjectForStatement(stmt, index, values[i], SqlHelper.getSqlTypeByValue(values[i]));
  +				m_platform.setObjectForStatement(stmt, index, values[i], SqlHelper.getSqlTypeByValue(values[i]));
   				index++;
   			}
   		}
  @@ -616,7 +616,7 @@
   	{
   		try
   		{
  -			return getStatementsForClass(cld).getDeleteStmt(conMan.getConnection());
  +			return getStatementsForClass(cld).getDeleteStmt(m_conMan.getConnection());
   		}
   		catch (SQLException e)
   		{
  @@ -636,7 +636,7 @@
   	{
   		try
   		{
  -			return getStatementsForClass(cds).getGenericStmt(conMan.getConnection(), scrollable);
  +			return getStatementsForClass(cds).getGenericStmt(m_conMan.getConnection(), scrollable);
   		}
   		catch (LookupException e)
   		{
  @@ -651,7 +651,7 @@
   	{
   		try
   		{
  -			return getStatementsForClass(cds).getInsertStmt(conMan.getConnection());
  +			return getStatementsForClass(cds).getInsertStmt(m_conMan.getConnection());
   		}
   		catch (SQLException e)
   		{
  @@ -670,7 +670,7 @@
   	{
   		try
   		{
  -			return getStatementsForClass(cds).getPreparedStmt(conMan.getConnection(), sql, scrollable);
  +			return getStatementsForClass(cds).getPreparedStmt(m_conMan.getConnection(), sql, scrollable);
   		}
   		catch (LookupException e)
   		{
  @@ -685,7 +685,7 @@
   	{
   		try
   		{
  -			return getStatementsForClass(cds).getSelectByPKStmt(conMan.getConnection());
  +			return getStatementsForClass(cds).getSelectByPKStmt(m_conMan.getConnection());
   		}
   		catch (SQLException e)
   		{
  @@ -704,7 +704,7 @@
   	{
   		try
   		{
  -			return getStatementsForClass(cds).getUpdateStmt(conMan.getConnection());
  +			return getStatementsForClass(cds).getUpdateStmt(m_conMan.getConnection());
   		}
   		catch (SQLException e)
   		{
  @@ -722,7 +722,7 @@
   	 */
   	protected Object[] getAllValues(ClassDescriptor cld, Object obj) throws PersistenceBrokerException
   	{
  -		return broker.serviceBrokerHelper().getAllRwValues(cld, obj);
  +		return m_broker.serviceBrokerHelper().getAllRwValues(cld, obj);
   	}
   
   	/**
  
  
  

Mime
View raw message