Repository: archiva Updated Branches: refs/heads/jpa [created] b7174c444
Adding JPA provider as user manager Project: http://git-wip-us.apache.org/repos/asf/archiva/repo Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/b7174c44 Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/b7174c44 Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/b7174c44 Branch: refs/heads/jpa Commit: b7174c444032ce5431fdf9d96cf7bd82060536cd Parents: 0cc2733 Author: Martin Stockhammer <marti...@apache.org> Authored: Sun Oct 9 21:20:45 2016 +0200 Committer: Martin Stockhammer <marti...@apache.org> Committed: Sun Oct 9 21:20:45 2016 +0200 ---------------------------------------------------------------------- .../archiva-web/archiva-webapp/pom.xml | 35 ++++++++++++++++++++ .../main/resources/META-INF/spring-context.xml | 15 +++++++-- .../src/main/webapp/WEB-INF/web.xml | 6 ++++ .../src/test/tomcat/tomcat-context-archiva.xml | 12 ++++++- pom.xml | 2 ++ 5 files changed, 67 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/archiva/blob/b7174c44/archiva-modules/archiva-web/archiva-webapp/pom.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index f5658d6..734a597 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -831,6 +831,18 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-orm</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + + </dependencies> @@ -969,6 +981,8 @@ <additionalClasspathDirs> <additionalClasspathDir>${basedir}/src/test/tomcat</additionalClasspathDir> </additionalClasspathDirs> + + </configuration> <dependencies> <dependency> @@ -981,6 +995,27 @@ <artifactId>mail</artifactId> <version>${javaxMailVersion}</version> </dependency> + <dependency> + <groupId>org.apache.openjpa</groupId> + <artifactId>openjpa</artifactId> + <version>${openjpaVersion}</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jpa_2.0_spec</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jta_1.1_spec</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.serp</groupId> + <artifactId>serp</artifactId> + <version>1.15.1</version> + </dependency> + </dependencies> </plugin> http://git-wip-us.apache.org/repos/asf/archiva/blob/b7174c44/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml index 06cf58a..d295d09 100755 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml @@ -21,13 +21,14 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" - xmlns:util="http://www.springframework.org/schema/util" + xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="http://www.springframework.org/schema/jee" + xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/util - http://www.springframework.org/schema/util/spring-util-3.0.xsd" + http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <context:annotation-config/> @@ -48,5 +49,15 @@ + <jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/redbackjpa" /> + <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> + <property name="dataSource" ref="dataSource" /> + <property name="jpaVendorAdapter" > + <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" /> + </property> + </bean> + + + </beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/archiva/blob/b7174c44/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml index e1ac74b..83714e2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml @@ -144,6 +144,12 @@ <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> <resource-ref> + <res-ref-name>jdbc/redbackjpa</res-ref-name> + <res-type>javax.sql.DataSource</res-type> + <res-auth>Container</res-auth> + <res-sharing-scope>Shareable</res-sharing-scope> + </resource-ref> + <resource-ref> <res-ref-name>mail/Session</res-ref-name> <res-type>javax.mail.Session</res-type> <res-auth>Container</res-auth> http://git-wip-us.apache.org/repos/asf/archiva/blob/b7174c44/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml index 4f7ce1d..3f51102 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml @@ -24,8 +24,18 @@ driverClassName="org.apache.derby.jdbc.EmbeddedDriver" url="jdbc:derby:${appserver.base}/database/users;create=true" /> + <Resource name="jdbc/redbackjpa" auth="Container" type="javax.sql.DataSource" + username="sa" + password="" + driverClassName="org.apache.derby.jdbc.EmbeddedDriver" + url="jdbc:derby:${appserver.base}/database/jpausers;create=true" + /> <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost"/> - + + + + + </Context> http://git-wip-us.apache.org/repos/asf/archiva/blob/b7174c44/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 4e8a90f..107668b 100644 --- a/pom.xml +++ b/pom.xml @@ -91,6 +91,7 @@ <javaxMailVersion>1.4</javaxMailVersion> <jettyVersion>8.1.14.v20131031</jettyVersion> <guava.version>16.0.1</guava.version> + <openjpaVersion>2.4.1</openjpaVersion> <!-- restore when we will be able to use a derby in memory database --> <redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl> @@ -1537,6 +1538,7 @@ <artifactId>jsoup</artifactId> <version>1.7.2</version> </dependency> + </dependencies> </dependencyManagement>