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 ta...@apache.org on 2006/02/22 07:29:12 UTC
svn commit: r379713 - in /portals/jetspeed-2/trunk/components/statistics:
project.xml
src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
src/test/org/apache/jetspeed/statistics/TestStatistics.java
Author: taylor
Date: Tue Feb 21 22:29:09 2006
New Revision: 379713
URL: http://svn.apache.org/viewcvs?rev=379713&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-495
configuring portal with Spring transactions to support commit and rollback
Modified:
portals/jetspeed-2/trunk/components/statistics/project.xml
portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java
Modified: portals/jetspeed-2/trunk/components/statistics/project.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/project.xml?rev=379713&r1=379712&r2=379713&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/project.xml (original)
+++ portals/jetspeed-2/trunk/components/statistics/project.xml Tue Feb 21 22:29:09 2006
@@ -88,6 +88,15 @@
</properties>
</dependency>
+ <!-- Apache OJB persistence framework -->
+ <dependency>
+ <id>ojb:db-ojb</id>
+ <version>1.0.3</version>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
</dependencies>
<build>
Modified: portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java?rev=379713&r1=379712&r2=379713&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java (original)
+++ portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java Tue Feb 21 22:29:09 2006
@@ -33,16 +33,12 @@
import java.util.Map;
import java.util.TreeMap;
-import javax.naming.Context;
-import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;
-import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.components.rdbms.ojb.ConnectionRepositoryEntry;
import org.apache.jetspeed.om.page.ContentPage;
import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.statistics.AggregateStatistics;
@@ -107,8 +103,8 @@
protected long maxTimeMsToFlush_Page = 10 * 1000;
- protected ConnectionRepositoryEntry jetspeedDSEntry;
-
+ //protected ConnectionRepositoryEntry jetspeedDSEntry;
+
/* after this is NOT for injection */
protected DataSource ds;
@@ -125,15 +121,13 @@
* Default constructor.
* </p>
*/
- public PortalStatisticsImpl()
- {
- }
public PortalStatisticsImpl(boolean logToCLF, boolean logToDatabase,
int maxRecordToFlush_Portal, int maxRecordToFlush_User,
int maxRecordToFlush_Page, long maxTimeMsToFlush_Portal,
long maxTimeMsToFlush_User, long maxTimeMsToFlush_Page,
- ConnectionRepositoryEntry jetspeedDSEntry)
+ DataSource dataSource)
+ //ConnectionRepositoryEntry jetspeedDSEntry)
{
this.logToCLF = logToCLF;
@@ -144,7 +138,8 @@
this.maxTimeMsToFlush_Portlet = maxTimeMsToFlush_Portal;
this.maxTimeMsToFlush_User = maxTimeMsToFlush_User;
this.maxTimeMsToFlush_Page = maxTimeMsToFlush_Page;
- this.jetspeedDSEntry = jetspeedDSEntry;
+ //this.jetspeedDSEntry = jetspeedDSEntry;
+ this.ds = dataSource;
currentUsers = new TreeMap();
}
@@ -152,30 +147,31 @@
{
formatter = new SimpleDateFormat("dd/MM/yyyy:hh:mm:ss z");
- if (jetspeedDSEntry != null)
- {
- if (jetspeedDSEntry.getJndiName() != null)
- {
- try
- {
- Context initialContext = new InitialContext();
- ds = (DataSource) initialContext.lookup(jetspeedDSEntry
- .getJndiName());
- } catch (NamingException e)
- {
- e.printStackTrace();
- throw e;
- }
- } else
- {
- BasicDataSource bds = new BasicDataSource();
- bds.setDriverClassName(jetspeedDSEntry.getDriverClassName());
- bds.setUrl(jetspeedDSEntry.getUrl());
- bds.setUsername(jetspeedDSEntry.getUsername());
- bds.setPassword(jetspeedDSEntry.getPassword());
- ds = (DataSource) bds;
- }
- }
+ //if (jetspeedDSEntry != null)
+// if (dataSource != null)
+// {
+// if (jndiLocator.getJndiName() != null)
+// {
+// try
+// {
+// Context initialContext = new InitialContext();
+// ds = (DataSource) initialContext.lookup(jndiLocator
+// .getJndiName());
+// } catch (NamingException e)
+// {
+// e.printStackTrace();
+// throw e;
+// }
+// } else
+// {
+// BasicDataSource bds = new BasicDataSource();
+// bds.setDriverClassName(jetspeedDSEntry.getDriverClassName());
+// bds.setUrl(jetspeedDSEntry.getUrl());
+// bds.setUsername(jetspeedDSEntry.getUsername());
+// bds.setPassword(jetspeedDSEntry.getPassword());
+// ds = (DataSource) bds;
+// }
+// }
currentUserCount = 0;
}
Modified: portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java?rev=379713&r1=379712&r2=379713&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java (original)
+++ portals/jetspeed-2/trunk/components/statistics/src/test/org/apache/jetspeed/statistics/TestStatistics.java Tue Feb 21 22:29:09 2006
@@ -320,7 +320,13 @@
protected String[] getConfigurations()
{
return new String[]
- { "statistics.xml"};
+ { "statistics.xml", "transaction.xml", "boot/datasource.xml"};
}
+ protected String[] getBootConfigurations()
+ {
+ return new String[]
+ { "boot/datasource.xml"};
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org