archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1582094 - in /archiva/trunk/archiva-modules: archiva-web/archiva-webapp/ plugins/metadata-store-cassandra/ plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/ plugins/metadata-store-cassandra/sr...
Date Wed, 26 Mar 2014 22:27:02 GMT
Author: olamy
Date: Wed Mar 26 22:27:02 2014
New Revision: 1582094

URL: http://svn.apache.org/r1582094
Log:
extract cassandra configuration in a configuration file

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
    archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/pom.xml
    archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java
    archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/resources/META-INF/spring-context.xml

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml?rev=1582094&r1=1582093&r2=1582094&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml Wed Mar 26 22:27:02 2014
@@ -1003,12 +1003,8 @@
             <archiva.devMode>${archiva.devMode}</archiva.devMode>
             <archiva.javascriptLog>${archiva.javascriptLog}</archiva.javascriptLog>
             <archiva.logMissingI18n>${archiva.logMissingI18n}</archiva.logMissingI18n>
-            <!--
-            not needed as we use asyncLogger in configuration
-            <Log4jContextSelector>org.apache.logging.log4j.core.async.AsyncLoggerContextSelector</Log4jContextSelector>
-            -->
-            <cassandraHost>localhost</cassandraHost>
-            <cassandraPort>9160</cassandraPort>
+            <cassandra.host>localhost</cassandra.host>
+            <cassandra.port>9160</cassandra.port>
             <org.apache.sirona.configuration.sirona.properties>${archiva.sirona.configuration}</org.apache.sirona.configuration.sirona.properties>
           </systemProperties>
           <additionalClasspathDirs>

Modified: archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/pom.xml?rev=1582094&r1=1582093&r2=1582094&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/pom.xml (original)
+++ archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/pom.xml Wed Mar 26 22:27:02
2014
@@ -272,7 +272,7 @@
           <artifactId>maven-surefire-plugin</artifactId>
           <configuration>
             <systemPropertyVariables>
-              <cassandraPort>${cassandraPort}</cassandraPort>
+              <cassandra.port>${cassandraPort}</cassandra.port>
             </systemPropertyVariables>
           </configuration>
         </plugin>

Modified: archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java?rev=1582094&r1=1582093&r2=1582094&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java
(original)
+++ archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java
Wed Mar 26 22:27:02 2014
@@ -33,6 +33,7 @@ import me.prettyprint.hector.api.ddl.Com
 import me.prettyprint.hector.api.factory.HFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 
@@ -87,23 +88,35 @@ public class DefaultCassandraArchivaMana
 
     private String dependencyFamilyName = "dependency";
 
+    @Value("${cassandra.host}")
+    private String cassandraHost;// = System.getProperty( "cassandra.host", "localhost" );
+
+    @Value("${cassandra.port}")
+    private String cassandraPort;// = System.getProperty( "cassandra.port", "9160" );
+
+    @Value("${cassandra.maxActive}")
+    private int maxActive;// = Integer.getInteger( "cassandra.maxActive", 20 );
+
+    @Value("${cassandra.readConsistencyLevel}")
+    private String readConsistencyLevel;// =
+        //System.getProperty( "cassandra.readConsistencyLevel", HConsistencyLevel.QUORUM.name()
);
+
+    @Value("${cassandra.writeConsistencyLevel}")
+    private String writeConsistencyLevel;
+    //= System.getProperty( "cassandra.writeConsistencyLevel", HConsistencyLevel.QUORUM.name()
);
+
+    @Value("${cassandra.replicationFactor}")
+    private int replicationFactor;// = Integer.getInteger( "cassandra.replicationFactor",
1 );
+
+    @Value("${cassandra.keyspace.name}")
+    private String keyspaceName;// = System.getProperty( "cassandra.keyspace.name", KEYSPACE_NAME
);
+
+    @Value("${cassandra.cluster.name}")
+    private String clusterName;// = System.getProperty( "cassandra.cluster.name", CLUSTER_NAME
);
 
     @PostConstruct
     public void initialize()
     {
-        // FIXME must come from configuration not sys props
-        String cassandraHost = System.getProperty( "cassandraHost", "localhost" );
-        String cassandraPort = System.getProperty( "cassandraPort" );
-        int maxActive = Integer.getInteger( "cassandra.maxActive", 20 );
-        String readConsistencyLevel =
-            System.getProperty( "cassandra.readConsistencyLevel", HConsistencyLevel.QUORUM.name()
);
-        String writeConsistencyLevel =
-            System.getProperty( "cassandra.readConsistencyLevel", HConsistencyLevel.QUORUM.name()
);
-
-        int replicationFactor = Integer.getInteger( "cassandra.replicationFactor", 1 );
-
-        String keyspaceName = System.getProperty( "cassandra.keyspace.name", KEYSPACE_NAME
);
-        String clusterName = System.getProperty( "cassandra.cluster.name", CLUSTER_NAME );
 
         final CassandraHostConfigurator configurator =
             new CassandraHostConfigurator( cassandraHost + ":" + cassandraPort );

Modified: archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/resources/META-INF/spring-context.xml?rev=1582094&r1=1582093&r2=1582094&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/resources/META-INF/spring-context.xml
(original)
+++ archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/resources/META-INF/spring-context.xml
Wed Mar 26 22:27:02 2014
@@ -30,4 +30,14 @@
   <context:annotation-config/>
   <context:component-scan base-package="org.apache.archiva.metadata.repository.cassandra"/>
 
+  <context:property-placeholder location="classpath:default-archiva-cassandra.properties"
+                                system-properties-mode="OVERRIDE"
+                                order="2"/>
+
+  <context:property-placeholder location="file:${archiva.cassandra.configuration.file}"
+                                ignore-resource-not-found="true"
+                                ignore-unresolvable="true"
+                                system-properties-mode="OVERRIDE"
+                                order="1"/>
+
 </beans>
\ No newline at end of file



Mime
View raw message