Commit ce4990e1 authored by toaster's avatar toaster
Browse files

more mvn changes

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@50 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent 591723d0
......@@ -16,12 +16,128 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
<!-- use this for javax.persistence
<snapshots>
<enabled>true</enabled>
</snapshots> -->
</repository>
</repositories>
<dependencies>
<!-- local ace deps -->
<dependency>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- for persistence -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
</dependency>
<!-- for json -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.0.1</version>
</dependency>
<!-- for Jstl / webapp stuff-->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>quartz</groupId>
<artifactId>quartz</artifactId>
<version>1.5.2</version>
</dependency>
<!-- local ones -->
<dependency>
<groupId>edu.umiacs</groupId>
<artifactId>jargon</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>edu.umiacs</groupId>
<artifactId>swap</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>edu.umiacs</groupId>
<artifactId>adapt-srb</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>edu.umiacs</groupId>
<artifactId>irods-api</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path=""/>
......@@ -8,7 +8,7 @@ import javax.persistence.EntityManager;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tomcat.util.http.fileupload.FileUploadBase;
//import org.apache.tomcat.util.http.fileupload.FileUploadBase;
/**
*
......
......@@ -31,9 +31,18 @@
package edu.umiacs.ace.util;
/**
import oracle.toplink.essentials.jndi.JNDIConnector;
import oracle.toplink.essentials.sessions.Session;
import oracle.toplink.essentials.tools.sessionconfiguration.SessionCustomizer;
import oracle.toplink.essentials.tools.sessionconfiguration.SessionCustomizer;*/
import org.eclipse.persistence.config.SessionCustomizer;
import org.eclipse.persistence.sessions.DatabaseLogin;
import org.eclipse.persistence.sessions.JNDIConnector;
import org.eclipse.persistence.sessions.Session;
import org.eclipse.persistence.sessions.server.ServerSession;
import javax.naming.Context;
import javax.naming.InitialContext;
/**
* register jndi connection
......@@ -43,6 +52,35 @@ public class DataSourceSessionCustomizer implements SessionCustomizer {
@Override
public void customize( Session session ) throws Exception {
JNDIConnector connector = null;
Context context = null;
// try {
context = new InitialContext();
if(null != context) {
connector = (JNDIConnector)session.getLogin().getConnector(); // possible CCE
// Change from COMPOSITE_NAME_LOOKUP to STRING_LOOKUP
// Note: if both jta and non-jta elements exist this will only change the first one - and may still result in
// the COMPOSITE_NAME_LOOKUP being set
// Make sure only jta-data-source is in persistence.xml with no non-jta-data-source property set
connector.setLookupType(JNDIConnector.STRING_LOOKUP);
// Or, if you are specifying both JTA and non-JTA in your persistence.xml then set both connectors to be safe
JNDIConnector writeConnector = (JNDIConnector)session.getLogin().getConnector();
writeConnector.setLookupType(JNDIConnector.STRING_LOOKUP);
JNDIConnector readConnector =
(JNDIConnector)((DatabaseLogin)((ServerSession)session).getReadConnectionPool().getLogin()).getConnector();
readConnector.setLookupType(JNDIConnector.STRING_LOOKUP);
System.out.println("_JPAEclipseLinkSessionCustomizer: configured " + connector.getName());
}
else {
throw new Exception("_JPAEclipseLinkSessionCustomizer: Context is null");
}
//}
//catch(Exception e) {
// e.printStackTrace();
//}
JNDIConnector conn = (JNDIConnector) session.getLogin().getConnector();
conn.setLookupType(JNDIConnector.STRING_LOOKUP);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment