You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2009/05/17 05:07:00 UTC
svn commit: r775576 - in /portals/jetspeed-2/portal/trunk:
components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/
jetspeed-portal-resources/src/main/resources/assembly/alternate/debug/
jetspeed-portal-resources/src/main/resou...
Author: rwatler
Date: Sun May 17 03:06:59 2009
New Revision: 775576
URL: http://svn.apache.org/viewvc?rev=775576&view=rev
Log:
backing out 775413
Removed:
portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionManagerManagementBean.java
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionManagerImpl.java
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/debug/datasource.xml
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/boot/datasource.xml
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionManagerImpl.java?rev=775576&r1=775575&r2=775576&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionManagerImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionManagerImpl.java Sun May 17 03:06:59 2009
@@ -81,76 +81,63 @@
{
this.broker = broker;
this.pbKey = broker.getPBKey();
- this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);
- this.connectionFactory = setupConnectionFactory(jcd);
- this.platform = PlatformFactory.getPlatformFor(jcd);
- /*
- by default batch mode is not enabled and after use of a PB
- instance, before instance was returned to pool, batch mode
- was set to false again (PB implementation close method)
- Be carefully in modify this behaviour, changes could cause
- unexpected behaviour
- */
- setBatchMode(false);
-
- // save connection manager instance
- ConnectionManagerManagementBean.addConnectionManager(this);
- }
-
- /**
- * Construct new connection factory.
- *
- * @param jcd JDBC connection descriptor
- * @return
- */
- private static ConnectionFactory setupConnectionFactory(JdbcConnectionDescriptor jcd)
- {
- ConnectionFactory cf = null;
+ this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);
ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
if (cpd != null && cpd.getConnectionFactory() != null)
{
- cf = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
- if ( cf == null )
+ connectionFactory = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
+ if ( connectionFactory == null )
{
try
{
- if (Boolean.valueOf(jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
+ if (Boolean.valueOf(this.jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
- Thread.currentThread().setContextClassLoader(ConnectionManagerImpl.class.getClassLoader());
- cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
- connectionFactories.put(cpd.getConnectionFactory(), cf);
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ connectionFactory = (ConnectionFactory)
+ ClassHelper.newInstance (cpd.getConnectionFactory(), true);
+ connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
- cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
- connectionFactories.put(cpd.getConnectionFactory(), cf);
+ connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
}
}
else
{
- cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
+ connectionFactory = (ConnectionFactory)
+ ClassHelper.newInstance (cpd.getConnectionFactory(), true);
}
}
catch (InstantiationException e)
{
String err = "Can't instantiate class " + cpd.getConnectionFactory();
+ log.error(err, e);
throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
}
catch (IllegalAccessException e)
{
String err = "Can't instantiate class " + cpd.getConnectionFactory();
+ log.error(err, e);
throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
}
}
}
else
{
- cf = (ConnectionFactory) ConnectionFactoryFactory.getInstance().createNewInstance();
+ this.connectionFactory = ConnectionFactoryFactory.getInstance().createConnectionFactory();
}
- return cf;
+ this.platform = PlatformFactory.getPlatformFor(jcd);
+ /*
+ by default batch mode is not enabled and after use of a PB
+ instance, before instance was returned to pool, batch mode
+ was set to false again (PB implementation close method)
+ Be carefully in modify this behaviour, changes could cause
+ unexpected behaviour
+ */
+ setBatchMode(false);
}
/**
@@ -498,31 +485,4 @@
batchCon.clearBatch();
}
}
-
- /**
- * Reset cached connection and connection factory.
- */
- protected void reset()
- {
- // roll back and/or release cached connection
- if (isInLocalTransaction())
- {
- localRollback();
- }
- else
- {
- releaseConnection();
- }
- // reset connection factory
- connectionFactory = setupConnectionFactory(jcd);
- }
-
- /**
- * Reset cached connection factories.
- */
- protected static void resetConnectionFactories()
- {
- // clear cached connection factories
- connectionFactories.clear();
- }
}
Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/debug/datasource.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/debug/datasource.xml?rev=775576&r1=775575&r2=775576&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/debug/datasource.xml (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/debug/datasource.xml Sun May 17 03:06:59 2009
@@ -29,11 +29,9 @@
<value>com.fmr</value>
</list>
</property>
- </bean>
+ </bean>
- <bean id="ojbConnectionManagement" class="org.apache.jetspeed.components.rdbms.ojb.ConnectionManagerManagementBean" />
-
- <bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOjbConfigurer" depends-on="ojbConnectionManagement" />
+ <bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOjbConfigurer"/>
<!--
Dynamically configures Database Platform for OJB by looking at the connection string
Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/boot/datasource.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/boot/datasource.xml?rev=775576&r1=775575&r2=775576&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/boot/datasource.xml (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/boot/datasource.xml Sun May 17 03:06:59 2009
@@ -27,9 +27,7 @@
<property name="jndiName" value="java:comp/env/jdbc/jetspeed" />
</bean>
- <bean id="ojbConnectionManagement" class="org.apache.jetspeed.components.rdbms.ojb.ConnectionManagerManagementBean" />
-
- <bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOjbConfigurer" depends-on="ojbConnectionManagement" />
+ <bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOjbConfigurer" />
<!--
Dynamically configures Database Platform for OJB by looking at the connection string
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org