summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-28 11:43:24 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-28 11:43:24 +0000
commitbef128817d76a8aac1fa575df8197f8af5a62921 (patch)
tree8eef57af1b1bc9ac655d485aa267b88787f93c28 /archiva-modules/archiva-web
parentd4aee19ee6b233bff720ac573106565a2d0976b7 (diff)
downloadarchiva-bef128817d76a8aac1fa575df8197f8af5a62921.tar.gz
archiva-bef128817d76a8aac1fa575df8197f8af5a62921.zip
move the factory bean to the api
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1582713 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-security/pom.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/RepositorySessionFactoryBean.java77
-rwxr-xr-xarchiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/resources/archiva-runtime.properties20
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/pom.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java2
7 files changed, 5 insertions, 105 deletions
diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml
index c1e99c861..4c59752f3 100644
--- a/archiva-modules/archiva-web/archiva-security/pom.xml
+++ b/archiva-modules/archiva-web/archiva-security/pom.xml
@@ -243,6 +243,7 @@
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
<redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
<redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
+ <archiva.repositorySessionFactory.id>file</archiva.repositorySessionFactory.id>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/RepositorySessionFactoryBean.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/RepositorySessionFactoryBean.java
deleted file mode 100644
index 855b8b89a..000000000
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/RepositorySessionFactoryBean.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.archiva.web.startup;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.config.AbstractFactoryBean;
-
-import java.util.Properties;
-
-/**
- * @author Olivier Lamy
- * @since 2.0.2
- */
-public class RepositorySessionFactoryBean
- extends AbstractFactoryBean<RepositorySessionFactory>
-{
-
- private Logger logger = LoggerFactory.getLogger( getClass() );
-
- //@Value( "repositorySessionFactory#${archiva.repositorySessionFactory.id}" )
- //private String beanName;
-
- private Properties properties;
-
- public RepositorySessionFactoryBean( Properties properties )
- {
- this.properties = properties;
- // we can override with system props
- this.properties.putAll( System.getProperties() );
- }
-
- @Override
- public Class<RepositorySessionFactory> getObjectType()
- {
- return RepositorySessionFactory.class;
- }
-
- @Override
- protected RepositorySessionFactory createInstance()
- throws Exception
- {
- String id = properties.getProperty( "archiva.repositorySessionFactory.id" );
- RepositorySessionFactory repositorySessionFactory =
- getBeanFactory().getBean( "repositorySessionFactory#" + id, RepositorySessionFactory.class );
- logger.info( "create RepositorySessionFactory instance of {}", repositorySessionFactory.getClass().getName() );
- return repositorySessionFactory;
- }
-
- public Properties getProperties()
- {
- return properties;
- }
-
- public void setProperties( Properties properties )
- {
- this.properties = properties;
- }
-}
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 a948d74aa..06cf58a64 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
@@ -40,7 +40,8 @@
<constructor-arg ref="jcr-config"/>
</bean>
- <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
+ <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create"
+ lazy-init="true">
<constructor-arg value="${appserver.base}/conf/repository.xml"/>
<constructor-arg value="${appserver.base}/data/jcr"/>
</bean>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/archiva-runtime.properties b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/archiva-runtime.properties
deleted file mode 100644
index ad69475d7..000000000
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/archiva-runtime.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-archiva.repositorySessionFactory.id=jcr \ 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 155d08000..254bf6206 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
@@ -37,12 +37,6 @@
<alias name="authorizer#rbac" alias="authorizer#default"/>
<alias name="repositoryStatisticsManager#default" alias="repositoryStatisticsManager"/>
- <!-- so can be override with -Darchiva.repositorySessionFactory.id= jcr or cassandra or file -->
- <bean name="repositorySessionFactory" class="org.apache.archiva.web.startup.RepositorySessionFactoryBean">
- <constructor-arg>
- <util:properties location="classpath:archiva-runtime.properties" local-override="true"/>
- </constructor-arg>
- </bean>
<alias name="environmentCheck#archiva-locked-admin-check" alias="environmentCheck#locked-admin-check"/>
<alias name="userManager#archiva" alias="userManager#default"/>
diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml
index 2166fa7c3..ed1d56fd8 100644
--- a/archiva-modules/archiva-web/archiva-webdav/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml
@@ -308,6 +308,7 @@
<archiva.user.configFileName>${project.build.testOutputDirectory}/repository-archiva.xml</archiva.user.configFileName>
<redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
<redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
+ <archiva.repositorySessionFactory.id>beer</archiva.repositorySessionFactory.id>
</systemPropertyVariables>
<forkMode>${webdav.forkMode}</forkMode>
</configuration>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
index 224f7ec23..93a4e5ce5 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
@@ -21,7 +21,7 @@ package org.apache.archiva.metadata.repository;
import org.springframework.stereotype.Service;
-@Service
+@Service("repositorySessionFactory#beer")
public class TestRepositorySessionFactory
implements RepositorySessionFactory
{