]> source.dussan.org Git - archiva.git/commitdiff
Use JPA as default and only database backend jpa without_jdo
authorMartin Stockhammer <martin_s@apache.org>
Fri, 30 Dec 2016 14:35:19 +0000 (15:35 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Fri, 30 Dec 2016 14:35:19 +0000 (15:35 +0100)
Remove the JDO dependencies and set the JPA implementation as only
database alternative and default implementation. Uses the same database
as JDO before.

21 files changed:
archiva-modules/archiva-base/archiva-indexer/pom.xml
archiva-modules/archiva-base/archiva-proxy/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RedbackRuntimeConfigurationServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
archiva-modules/archiva-web/archiva-web-common/pom.xml
archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.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/applicationContext.xml
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml
archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml
archiva-modules/archiva-web/archiva-webdav/pom.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
pom.xml

index 6996bdd96651f0c27f197fb47eb9e60d6662d165..99b4bc2ac8cdacf4c18e99ae3bc630dea168dbe1 100644 (file)
       <artifactId>xercesImpl</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <pluginManagement>
index 0cc6cb785192c97e13eb165805cf58a4278e4757..c5ccbdfa078052d3191d9bb9aafd87d22cab2abd 100644 (file)
       <artifactId>assertj-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
   <build>
     <plugins>
index 1bca20bb3d7bdf0914887481cf28293b035cc0dc..cfee935fa1079a6d238b61d8f0ca18b23eba0838 100644 (file)
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
index f1c74aef954b99feb66d4b88a2b9a69e815dac86..bad98fccebf668a0230ff0f89f950f7689730756 100644 (file)
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
index 39bafe6e7cf6fd452bca914dd12c4fb76b2569c5..3436e6af64dce557f04421b38daaceb905bd31f6 100644 (file)
       <scope>test</scope>
       <version>${redback.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva.redback</groupId>
+      <artifactId>redback-keys-jpa</artifactId>
+      <scope>test</scope>
+      <version>${redback.version}</version>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-core</artifactId>
index 42d99a59e728bb3dc6153f25ae31d9724e132351..bddb302ecb346a7d01e4c394e125dea66c1a00ef 100644 (file)
@@ -40,7 +40,7 @@ public class RedbackRuntimeConfigurationServiceTest
     {
         RedbackRuntimeConfiguration redbackRuntimeConfiguration =
             getRedbackRuntimeConfigurationService().getRedbackRuntimeConfiguration();
-        assertEquals( "jdo", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
+        assertEquals( "jpa", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
     }
 
     @Test
@@ -49,7 +49,7 @@ public class RedbackRuntimeConfigurationServiceTest
     {
         RedbackRuntimeConfiguration redbackRuntimeConfiguration =
             getRedbackRuntimeConfigurationService().getRedbackRuntimeConfiguration();
-        assertEquals( "jdo", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
+        assertEquals( "jpa", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
 
         redbackRuntimeConfiguration.setUserManagerImpls( Arrays.asList( "foo" ) );
 
@@ -68,7 +68,7 @@ public class RedbackRuntimeConfigurationServiceTest
         RedbackRuntimeConfigurationService service = getRedbackRuntimeConfigurationService();
         List<UserManagerImplementationInformation> infos = service.getUserManagerImplementationInformations();
         assertThat( infos ).isNotNull().isNotEmpty().contains(
-            new UserManagerImplementationInformation( "jdo", null, false ) );
+            new UserManagerImplementationInformation( "jpa", null, false ) );
 
     }
 
@@ -79,7 +79,7 @@ public class RedbackRuntimeConfigurationServiceTest
         RedbackRuntimeConfigurationService service = getRedbackRuntimeConfigurationService();
         List<RBACManagerImplementationInformation> infos = service.getRbacManagerImplementationInformations();
         assertThat( infos ).isNotNull().isNotEmpty().contains(
-            new RBACManagerImplementationInformation( "jdo", null, false ) );
+            new RBACManagerImplementationInformation( "jpa", null, false ) );
 
     }
 
index 951ced8f4edd0a8d98702be7c73624b0f5b0e70f..27d764d58d6b113cfc5dea5771def7f7f4958db1 100644 (file)
@@ -32,7 +32,7 @@
 
   <context:annotation-config/>
   <context:component-scan
-      base-package="org.apache.archiva.rest.services.utils"/>
+      base-package="org.apache.archiva.redback.keys,org.apache.archiva.rest.services.utils"/>
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
index a51aa0e790024eefd07f805c77d510e293bea324..971da5c73dec0ce9bb0db94be3ef8ea380e82632 100644 (file)
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.archiva.redback</groupId>
+      <artifactId>redback-keys-jpa</artifactId>
+      <scope>test</scope>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.archiva.redback</groupId>
       <artifactId>redback-rest-services</artifactId>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
index f3f50bf8d43ba8b160deefcee0bd65fc0e9612e8..1a981c78c2d00a52c36965265ba6a2a488f2c330 100755 (executable)
@@ -34,7 +34,7 @@
        default-lazy-init="true">
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.web.startup, org.apache.archiva.web.runtime, org.apache.archiva.web.api,, org.apache.archiva.web.security"/>
+  <context:component-scan base-package="org.apache.archiva.redback.keys,org.apache.archiva.web.startup, org.apache.archiva.web.runtime, org.apache.archiva.web.api,, org.apache.archiva.web.security"/>
 
   <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
 
index 16c84f23bc3b96ba58e9d11bcdd6217d95d607a7..eda8af6a8343de3ad11c1fee63d414f78a4069e4 100644 (file)
@@ -36,7 +36,7 @@ import org.apache.archiva.redback.users.UserManagerException;
 import org.apache.archiva.redback.users.UserManagerListener;
 import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.redback.users.UserQuery;
-import org.apache.archiva.redback.users.jdo.JdoUser;
+import org.apache.archiva.redback.users.jpa.model.JpaUser;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -74,7 +74,7 @@ public class SecuritySystemStub
         {
             result = new AuthenticationResult( true, source.getUsername(), null );
 
-            User user = new JdoUser();
+            User user = new JpaUser();
             user.setUsername( source.getUsername() );
             user.setPassword( users.get( source.getUsername() ) );
 
index 08974cf0112607062dc0729cac36f02d136d2bdb..570eeb588035f3157b39563acdf98d1af3b5ae9c 100644 (file)
@@ -30,7 +30,6 @@
 
   <context:property-placeholder system-properties-mode="OVERRIDE"/>
 
-
   <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
     <property name="properties">
       <value>
index 2937490c36e04f20dfa77921275d51ef2feaf458..9bc51d7b244430d41d5ce322f9cf5de689421239 100644 (file)
@@ -29,7 +29,7 @@
 
   <context:annotation-config/>
   <context:component-scan
-      base-package="org.apache.archiva.rest.services.utils"/>
+      base-package="org.apache.archiva.redback.keys,org.apache.archiva.rest.services.utils"/>
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
index 3c5ad2e982cc5fbb1552c3f20e209b03e19d0c57..b0b3840b67a119304ed4bf80b53a9cf1139515fb 100755 (executable)
@@ -49,7 +49,7 @@
 
 
 
-  <jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/redbackjpa" />
+  <jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/users" />
   <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
     <property name="dataSource" ref="dataSource" />
     <property name="jpaVendorAdapter" >
index e11370579ade9ef8942aff9ee5408dfea3c79693..49f0301db987d3c5630745022f500c3825c50f2c 100644 (file)
@@ -21,6 +21,7 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
+       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
@@ -28,7 +29,8 @@
            http://www.springframework.org/schema/task
            http://www.springframework.org/schema/task/spring-task-3.0.xsd
            http://www.springframework.org/schema/util
-           http://www.springframework.org/schema/util/spring-util.xsd">
+           http://www.springframework.org/schema/util/spring-util.xsd
+           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
 
   <context:property-placeholder location="classpath:application.properties" />
 
   </bean>
   <!-- END SNIPPET: configuration-files-list -->
 
-  <bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DataSourceConfigurableJdoFactory">
-    <property name="connectionFactoryName" value="java:comp/env/jdbc/users"/>
-    <property name="shutdownConnectionFactoryName" value="java:comp/env/jdbc/usersShutdown"/>
-    <property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
-    <property name="otherProperties">
-      <props>
-        <prop key="org.jpox.autoCreateSchema">true</prop>
-        <prop key="org.jpox.validateTables">false</prop>
-        <prop key="org.jpox.validateConstraints">false</prop>
-        <prop key="org.jpox.validateColumns">false</prop>
-        <prop key="org.jpox.autoStartMechanism">None</prop>
-        <prop key="org.jpox.transactionIsolation">READ_COMMITTED</prop>
-        <prop key="org.jpox.poid.transactionIsolation">READ_COMMITTED</prop>
-        <prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
-        <!-- NEEDED FOR MYSQL UTF-8 Databases -->
-        <prop key="org.jpox.rdbms.stringDefaultLength">255</prop>
-
-        <!-- NEEDED FOR POSTGRES, But causes problems in other JDBC implementations.
-        <prop key="org.jpox.identifier.case">PreserveCase</prop>
-        -->
-
-        <!-- cache activation -->
-        <prop key="org.jpox.cache.level2">true</prop>
-        <prop key="org.jpox.cache.level2.type">ehcacheclassbased</prop>
-        <prop key="org.jpox.cache.level2.cacheName">defaultJpox</prop>
-        <prop key="org.jpox.cache.level2.configurationFile">/ehcache.xml</prop>
-      </props>
-    </property>
-  </bean>
-
-
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
       <props>
   </bean>
   -->
 
+  <bean name="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+    <property name="jpaVendorAdapter" >
+      <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
+    </property>
+    <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
+    <property name="jpaPropertyMap">
+      <map>
+        <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+        <entry key="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)" />
+        <entry key="openjpa.jdbc.MappingDefaults"
+                  value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
+        <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE"/>
+        <entry key="openjpa.jdbc.DBDictionary" value="(disableSchemaFactoryColumnTypeErrors=true,BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_YN)"/>
+      </map>
+    </property>
+
+  </bean>
+
+  <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" >
+    <property name="entityManagerFactory" ref="entityManagerFactory" />
+  </bean>
+
+  <tx:annotation-driven />
+
 </beans>
index 83714e28063bd964ebb8d10ce3ea69fac3533f55..e1ac74b03d9b5502b81446d721a96f9624d6a32a 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 e4e860f735e5912b72267b89058191751a1a9b40..55668911af29073819c762d33e30a6f89d435017 100644 (file)
   </properties>
 
   <appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="console" target="SYSTEM_OUT" level="info">
       <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/-->
       <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" />
     </Console>
     <RollingRandomAccessFile name="rolling" fileName="${logsDirectory}/archiva.log"
-                     filePattern="${logsDirectory}/archiva-%d{MM-dd-yyyy}.log" immediateFlush="false" append="true">
+                     filePattern="${logsDirectory}/archiva-%d{MM-dd-yyyy}.log"
+
+                             immediateFlush="true" append="true">
       <PatternLayout>
         <pattern>%d [%t] %-5p %c %x - %m%n</pattern>
       </PatternLayout>
@@ -82,6 +84,9 @@
 
     <logger name="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry" level="debug"/>
 
+    <logger name="org.apache.archiva.redback.components.taskqueue.DefaultTaskQueue" level="info" />
+
+    <logger name="org.apache.archiva" level="debug" />
     <!--
     <logger name="org.apache.archiva.scheduler.indexing" level="debug"/>
     -->
index 3f511020d9a4e3c23a96167762c7a123543ff3b2..9e576948485e0e19a212be7bfe094f06c3c9c4dc 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"/>
index e34e512fd2d1d6cbeb6f165b960bf3ac7034dcef..ec877a2122ee6f727b460f2f1f0bf1d8f1078596 100644 (file)
       <artifactId>redback-rbac-memory</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva.redback</groupId>
+      <artifactId>redback-keys-jpa</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.archiva.redback</groupId>
       <artifactId>redback-users-memory</artifactId>
index f747bdb8f2a0340f7e797c3424cbc4c95558a2ba..1619c96e5d5d91a8ff5261f81c2901bc4093774a 100644 (file)
@@ -31,7 +31,7 @@
 
   <context:annotation-config/>
   <context:component-scan
-      base-package="org.apache.archiva.webdav,org.apache.archiva.metadata.repository,org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge"/>
+      base-package="org.apache.archiva.redback.keys,org.apache.archiva.webdav,org.apache.archiva.metadata.repository,org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge"/>
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
index fe8f0b82e9cbd87767b03c7265bd8ce0a8ce9970..66f4661cef241a3d123d4b5336c747f33d018dbe 100644 (file)
@@ -30,7 +30,7 @@
   <context:property-placeholder system-properties-mode="OVERRIDE"/>
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.webdav,org.apache.archiva.metadata.repository"/>
+  <context:component-scan base-package="org.apache.archiva.redback.keys,org.apache.archiva.webdav,org.apache.archiva.metadata.repository"/>
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
diff --git a/pom.xml b/pom.xml
index 107668b6ee274101127f128cebc6a9b5adfeba8d..733184cc58c0357229cb1ecd348850226e20712f 100644 (file)
--- a/pom.xml
+++ b/pom.xml
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.apache.archiva.redback</groupId>
+        <artifactId>redback-keys-jpa</artifactId>
+        <version>${redback.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
       <dependency>
         <groupId>org.apache.archiva.redback</groupId>
         <artifactId>redback-rbac-model</artifactId>