]> source.dussan.org Git - archiva.git/commitdiff
Adding JPA provider as user manager
authorMartin Stockhammer <martin_s@apache.org>
Sun, 9 Oct 2016 19:20:45 +0000 (21:20 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 9 Oct 2016 19:20:45 +0000 (21:20 +0200)
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml
pom.xml

index f5658d6bab734ee67641c0e2b0eee59b556f07e2..734a59768e7e886f7858146ee80678696963b0c9 100644 (file)
       <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>
 
           <additionalClasspathDirs>
             <additionalClasspathDir>${basedir}/src/test/tomcat</additionalClasspathDir>
           </additionalClasspathDirs>
+
+
         </configuration>
         <dependencies>
           <dependency>
             <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>
 
index 06cf58a64c3762caf7230236b0667b76670e9dc2..d295d09c5fcdff19bad0466457107473a4a09fbd 100755 (executable)
 <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/>
 
 
 
+  <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
index e1ac74b03d9b5502b81446d721a96f9624d6a32a..83714e28063bd964ebb8d10ce3ea69fac3533f55 100644 (file)
     <res-auth>Container</res-auth>
     <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>
index 4f7ce1d69b59f7fe34da3b45fe0f57bcb4f7ead6..3f511020d9a4e3c23a96167762c7a123543ff3b2 100644 (file)
             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>
diff --git a/pom.xml b/pom.xml
index 4e8a90f1676cc3350e59de90851d3ee5f28aa78a..107668b6ee274101127f128cebc6a9b5adfeba8d 100644 (file)
--- 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>
         <artifactId>jsoup</artifactId>
         <version>1.7.2</version>
       </dependency>
+
     </dependencies>
   </dependencyManagement>