diff options
author | Martin Stockhammer <martin_s@apache.org> | 2017-05-18 21:47:01 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2017-05-20 23:15:10 +0200 |
commit | acc02bf9620de9e82ae36fbb3867e84a1bd1ccf1 (patch) | |
tree | 583ef9e1a7756264f465d8e74eaf5a50cb69ae61 /archiva-modules | |
parent | 053315826d996288174fb65f51e2f0b04ef88cde (diff) | |
parent | dd311845e13f46062251744f7cc2cfd21e2e5cf4 (diff) | |
download | archiva-acc02bf9620de9e82ae36fbb3867e84a1bd1ccf1.tar.gz archiva-acc02bf9620de9e82ae36fbb3867e84a1bd1ccf1.zip |
[MRM-1942] Merge branch 'jpa' into master
Removing JDO and add JPA backend.
Diffstat (limited to 'archiva-modules')
36 files changed, 640 insertions, 84 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-cleanup-released-snapshots.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-cleanup-released-snapshots.xml index 297ab975b..349cd9c56 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-cleanup-released-snapshots.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-cleanup-released-snapshots.xml @@ -20,11 +20,11 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <bean name="archivaConfiguration#cleanup-released-snapshots" class="org.apache.archiva.configuration.DefaultArchivaConfiguration"> @@ -65,4 +65,37 @@ </property> </bean> + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml index 171344424..63aafa55a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml @@ -20,11 +20,11 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <context:annotation-config/> @@ -115,5 +115,38 @@ </property> </bean> + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml index 1b8fbab90..fc70ff89f 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml @@ -20,11 +20,11 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <context:annotation-config/> <context:component-scan base-package="org.apache.archiva.metadata.repository"/> @@ -46,4 +46,37 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 992314e55..4e0a4d0ce 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -168,6 +168,11 @@ <artifactId>xercesImpl</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> <pluginManagement> diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml index df446567a..a071075f9 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/resources/spring-context.xml @@ -20,11 +20,11 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="false"> <context:annotation-config/> @@ -41,4 +41,37 @@ </property> </bean> <alias name="userConfiguration#redback" alias="userConfiguration#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index c55a1f350..a474f97e8 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -209,6 +209,12 @@ <artifactId>assertj-core</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <scope>test</scope> + </dependency> + </dependencies> <build> <plugins> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml index ee094eaf1..5815e0338 100755 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml @@ -20,11 +20,11 @@ <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <context:annotation-config/> @@ -85,4 +85,36 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index cd3293663..ae8230a51 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -235,6 +235,12 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <scope>test</scope> + </dependency> + </dependencies> <build> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml index e1e4b87cd..3ae58092e 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml @@ -20,11 +20,12 @@ --> <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:context="http://www.springframework.org/schema/context" 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" default-lazy-init="true"> + http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" + default-lazy-init="true"> <context:annotation-config/> <context:component-scan base-package="org.apache.archiva.admin.mock"/> @@ -58,4 +59,36 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml index d38f7b41b..33f967fc7 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml @@ -177,6 +177,12 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <scope>test</scope> + </dependency> + </dependencies> <build> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml index a0a12c611..3f50a7207 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml @@ -19,9 +19,10 @@ ~ under the License. --> <beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" default-lazy-init="true"> + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" + default-lazy-init="true"> <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler"> <property name="properties"> @@ -60,4 +61,36 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index d1a4ce2ab..456e3a1cc 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -315,6 +315,12 @@ <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> @@ -323,6 +329,12 @@ </dependency> <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <scope>test</scope> + </dependency> + + <dependency> <groupId>org.apache.jackrabbit</groupId> <artifactId>jackrabbit-core</artifactId> <scope>test</scope> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java index 0284bb8f5..4b3db121e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java @@ -67,7 +67,7 @@ public class DefaultRedbackRuntimeConfigurationService private RedbackRuntimeConfigurationAdmin redbackRuntimeConfigurationAdmin; @Inject - @Named(value = "userManager#configurable") + @Named(value = "userManager#default") private UserManager userManager; @Inject @@ -220,7 +220,8 @@ public class DefaultRedbackRuntimeConfigurationService } } - //check repositories roles are here !!! + + return Boolean.TRUE; } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RedbackRuntimeConfigurationServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RedbackRuntimeConfigurationServiceTest.java index 42d99a59e..bddb302ec 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RedbackRuntimeConfigurationServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RedbackRuntimeConfigurationServiceTest.java @@ -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 ) ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml index 9b95b9430..ceea546a8 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml @@ -21,17 +21,18 @@ <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:jaxrs="http://cxf.apache.org/jaxrs" + xmlns:jaxrs="http://cxf.apache.org/jaxrs" 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://cxf.apache.org/jaxrs - http://cxf.apache.org/schemas/jaxrs.xsd" default-lazy-init="true"> + http://cxf.apache.org/schemas/jaxrs.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" + default-lazy-init="true"> <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"> @@ -103,4 +104,36 @@ <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml index 486850de9..08e98f648 100644 --- a/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml @@ -20,11 +20,11 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <bean name="securitySystem#testable" class="org.apache.archiva.redback.system.DefaultSecuritySystem"> @@ -120,4 +120,36 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml index c8cd1165d..4b79066c4 100644 --- a/archiva-modules/archiva-web/archiva-web-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml @@ -340,6 +340,12 @@ <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> @@ -414,6 +420,12 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <scope>test</scope> + </dependency> + </dependencies> <build> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java index 70f75be15..9ea05cb56 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java @@ -78,7 +78,7 @@ public class ArchivaConfigurableUsersManager setUserManagerImpl( userManagerImpl ); userManagerPerId.put( id, userManagerImpl ); } - + this.usersCache.clear(); this.useUsersCache = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().isUseUsersCache(); } catch ( RepositoryAdminException e ) @@ -333,7 +333,7 @@ public class ArchivaConfigurableUsersManager @Override public String getId() { - return null; + return "archiva-configurable"; } @Override diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java index 143f3c21b..6b2eb9e8f 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java @@ -98,6 +98,8 @@ public class ArchivaRbacManager List<String> rbacManagerIds = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getRbacManagerImpls(); + clearCaches(); + if ( rbacManagerIds.isEmpty() ) { rbacManagerIds.add( RedbackRuntimeConfigurationAdmin.DEFAULT_RBAC_MANAGER_IMPL ); @@ -113,6 +115,7 @@ public class ArchivaRbacManager rbacManagersPerId.put( id, rbacManager ); } + } catch ( RepositoryAdminException e ) { @@ -122,12 +125,23 @@ public class ArchivaRbacManager } } + private void clearCaches() { + resourcesCache.clear(); + operationsCache.clear(); + permissionsCache.clear(); + rolesCache.clear(); + userAssignmentsCache.clear(); + userPermissionsCache.clear(); + effectiveRoleSetCache.clear(); + } + protected RBACManager getRbacManagerForWrite() { for ( RBACManager rbacManager : this.rbacManagersPerId.values() ) { if ( !rbacManager.isReadOnly() ) { + log.debug("Writable Rbac manager {}", rbacManager.getDescriptionKey()); return rbacManager; } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java index 0a74e395b..b1cbc9cf8 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java @@ -209,6 +209,7 @@ public class ArchivaUserManagerAuthenticator { log.warn( "Login for user {} and userManager {} failed, message: {}", source.getUsername(), userManager.getId(), e.getMessage() ); + e.printStackTrace(); resultException = e; authnResultErrors.add( new AuthenticationFailureCause( AuthenticationConstants.AUTHN_RUNTIME_EXCEPTION, "Login for user " + source.getUsername() diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml index f3f50bf8d..1a981c78c 100755 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml @@ -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" /> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index 122db4f3d..eb4dc0351 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -687,7 +687,7 @@ rest.csrffilter.enabled.help.content=If true, validation of REST requests will b archiva.redback.rbacmanager.ldap=LDAP RBac Manager archiva.redback.rbacmanager.jdo=Database RBac Manager -archiva.redback.rbackmanager.jpa=Database JPA RBac Manager +archiva.redback.rbacmanager.jpa=Database JPA RBac Manager archiva.redback.rbacmanager.cached=Cached RBac Manager redback.runtime.rbac-managers.impls.chose=RbacManager(s) chosen redback.runtime.rbac-managers.impls.available=Available RbacManagers diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java index eec7ae9d9..410d6c1a3 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java @@ -37,7 +37,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; @@ -75,7 +75,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() ) ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml index 08974cf01..570eeb588 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml @@ -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> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml index 8f8085e74..9bc51d7b2 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml @@ -20,16 +20,16 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <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"> @@ -84,4 +84,36 @@ <alias name="userConfiguration#archiva" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml index c9ff7946c..5a1171022 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml @@ -21,11 +21,11 @@ <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown"> @@ -58,4 +58,37 @@ <alias name="userConfiguration#archiva" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> + </beans> diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index d9920c8af..9dc3eb80c 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> 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 06cf58a64..b0b3840b6 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,20 @@ + <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" > + <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" /> + </property> + </bean> + + + <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven transaction-manager="transactionManager"/> + </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml index e11370579..49f0301db 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml @@ -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" /> @@ -108,37 +110,6 @@ </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> @@ -324,4 +295,28 @@ </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> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js index 8d3269ee1..95ed9f3da 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js @@ -1358,7 +1358,15 @@ define("archiva/admin/features/generaladmin/main",["jquery","jquery.ui","i18n"," self.redbackRuntimeConfiguration().rbacManagerImpls.push(beanId); } - + var adminAvailableResponseFn = function(adminExists) { + $.log("admin exists "+adminExists); + if (adminExists) { + window.sammyArchivaApplication.runRoute("get","#redbackruntimeconfig"); + } else { + logout(); + displayWelcome(); + } + } $.log("rememberme enabled:"+self.redbackRuntimeConfiguration().findPropertyValue("security.rememberme.enabled")); $.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/redbackRuntimeConfiguration", { @@ -1368,7 +1376,7 @@ define("archiva/admin/features/generaladmin/main",["jquery","jquery.ui","i18n"," dataType: 'json', success: function(data) { var message=$.i18n.prop('redback-runtime-configuration.updated'); - window.sammyArchivaApplication.runRoute("get","#redbackruntimeconfig"); + checkCreateAdminLink(adminAvailableResponseFn); displaySuccessMessage(message); }, error: function(data) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index c047c2da8..4a72ce817 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -825,14 +825,15 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa } else { createAdminLink.hide(); } - if(callbackFn){ - callbackFn() + if(callbackFn) { + callbackFn(adminExists) } $.log("adminExists:"+adminExists); } }); }; + // handle url with registration link checkUrlParams=function(){ var validateMeId = $.urlParam('validateMe'); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml index e4e860f73..55668911a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml @@ -26,12 +26,14 @@ </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"/> --> 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 4f7ce1d69..9e5769484 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,13 @@ driverClassName="org.apache.derby.jdbc.EmbeddedDriver" url="jdbc:derby:${appserver.base}/database/users;create=true" /> + <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost"/> - + + + + + </Context> diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 0cee94fa7..fdf11ddf0 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -151,6 +151,11 @@ </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> <scope>test</scope> </dependency> diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml index 048c824f0..1619c96e5 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml @@ -20,18 +20,18 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <context:property-placeholder system-properties-mode="OVERRIDE"/> <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"> @@ -75,4 +75,36 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml index fc8cb6076..66f4661ce 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml @@ -20,17 +20,17 @@ --> <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:context="http://www.springframework.org/schema/context" 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/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <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"> @@ -76,4 +76,36 @@ <alias name="userConfiguration#redback" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> + + <!-- *** + JPA settings + *** --> + <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-hsqldb.xml" /> + <property name="jpaPropertyMap"> + <map> + <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" /> + <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" /> + <entry key="openjpa.ConnectionUserName" value="sa" /> + <entry key="openjpa.ConnectionPassword" value="" /> + <entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" /> + <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> + <entry key="openjpa.jdbc.MappingDefaults" + value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> + </map> + </property> + + </bean> + + <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" > + <property name="entityManagerFactory" ref="entityManagerFactory" /> + </bean> + + <tx:annotation-driven /> + <!-- *** + End of JPA settings + *** --> </beans>
\ No newline at end of file |