james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject svn commit: r1685945 - in /james/mailbox/trunk: ./ cassandra/src/main/java/org/apache/james/mailbox/cassandra/ cassandra/src/main/resources/META-INF/spring/
Date Wed, 17 Jun 2015 08:39:28 GMT
Author: btellier
Date: Wed Jun 17 08:39:28 2015
New Revision: 1685945

URL: http://svn.apache.org/r1685945
Log:
MAILBOX-237 Spring invoked factories need to be static

Modified:
    james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterFactory.java
    james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterWithKeyspaceCreatedFactory.java
    james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/SessionFactory.java
    james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
    james/mailbox/trunk/pom.xml

Modified: james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterFactory.java?rev=1685945&r1=1685944&r2=1685945&view=diff
==============================================================================
--- james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterFactory.java
(original)
+++ james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterFactory.java
Wed Jun 17 08:39:28 2015
@@ -40,7 +40,7 @@ public class ClusterFactory {
     private final static String DEFAULT_CLUSTER_IP = "localhost";
     private final static int DEFAULT_CLUSTER_PORT = 9042;
 
-    public Cluster createClusterForClusterWithPassWord(List<CassandraServer> servers,
String userName, String password) {
+    public static Cluster createClusterForClusterWithPassWord(List<CassandraServer>
servers, String userName, String password) {
         Cluster.Builder clusterBuilder = Cluster.builder();
         servers.forEach(
             (server) -> clusterBuilder.addContactPoint(server.ip).withPort(server.port)
@@ -51,19 +51,19 @@ public class ClusterFactory {
         return clusterBuilder.build();
     }
 
-    public Cluster createClusterForClusterWithoutPassWord(List<CassandraServer> servers)
{
+    public static Cluster createClusterForClusterWithoutPassWord(List<CassandraServer>
servers) {
         return createClusterForClusterWithPassWord(servers, null, null);
     }
-    
-    public Cluster createClusterForSingleServerWithPassWord(String ip, int port, String userName,
String password) {
+
+    public static Cluster createClusterForSingleServerWithPassWord(String ip, int port, String
userName, String password) {
         return createClusterForClusterWithPassWord(ImmutableList.of(new CassandraServer(ip,
port)), userName, password);
     }
 
-    public Cluster createClusterForSingleServerWithoutPassWord(String ip, int port) {
+    public static Cluster createClusterForSingleServerWithoutPassWord(String ip, int port)
{
         return createClusterForClusterWithPassWord(ImmutableList.of(new CassandraServer(ip,
port)), null, null);
     }
 
-    public Cluster createDefaultSession() {
+     public static Cluster createDefaultSession() {
         return createClusterForSingleServerWithoutPassWord(DEFAULT_CLUSTER_IP, DEFAULT_CLUSTER_PORT);
     }
 }

Modified: james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterWithKeyspaceCreatedFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterWithKeyspaceCreatedFactory.java?rev=1685945&r1=1685944&r2=1685945&view=diff
==============================================================================
--- james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterWithKeyspaceCreatedFactory.java
(original)
+++ james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ClusterWithKeyspaceCreatedFactory.java
Wed Jun 17 08:39:28 2015
@@ -7,22 +7,22 @@ public class ClusterWithKeyspaceCreatedF
 
     private final static int DEFAULT_REPLICATION_FACTOR = 1;
 
-    public Cluster clusterWithInitializedKeyspace(Cluster cluster, String keyspace, int replicationFactor)
{
+    public static Cluster clusterWithInitializedKeyspace(Cluster cluster, String keyspace,
int replicationFactor) {
         if (isKeyspacePresent(cluster, keyspace)) {
             createKeyspace(cluster, keyspace, replicationFactor);
         }
         return cluster;
     }
 
-    public Cluster clusterWithInitializedKeyspace(Cluster cluster, String keyspace) {
+    public static Cluster clusterWithInitializedKeyspace(Cluster cluster, String keyspace)
{
         return clusterWithInitializedKeyspace(cluster, keyspace, DEFAULT_REPLICATION_FACTOR);
     }
 
-    private boolean isKeyspacePresent(Cluster cluster, String keyspace) {
+    private static boolean isKeyspacePresent(Cluster cluster, String keyspace) {
         return cluster.getMetadata().getKeyspace(keyspace) == null;
     }
 
-    private void createKeyspace(Cluster cluster, String keyspace, int replicationFactor)
{
+    private static void createKeyspace(Cluster cluster, String keyspace, int replicationFactor)
{
         try (Session session = cluster.connect()) {
             session.execute("CREATE KEYSPACE IF NOT EXISTS " + keyspace
                 + " WITH replication = {'class':'SimpleStrategy', 'replication_factor':"
+ replicationFactor + "};");

Modified: james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/SessionFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/SessionFactory.java?rev=1685945&r1=1685944&r2=1685945&view=diff
==============================================================================
--- james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/SessionFactory.java
(original)
+++ james/mailbox/trunk/cassandra/src/main/java/org/apache/james/mailbox/cassandra/SessionFactory.java
Wed Jun 17 08:39:28 2015
@@ -25,14 +25,14 @@ import com.datastax.driver.core.Session;
 public class SessionFactory {
     private final static String DEFAULT_KEYSPACE_NAME = "apache_james";
 
-    public Session createSession(Cluster cluster, String keyspace) {
+    public static Session createSession(Cluster cluster, String keyspace) {
         Session session = cluster.connect(keyspace);
         new CassandraTableManager(session)
             .ensureAllTables();
         return session;
     }
 
-    public Session createSession(Cluster cluster) {
+    public static Session createSession(Cluster cluster) {
         return createSession(cluster, DEFAULT_KEYSPACE_NAME);
     }
 

Modified: james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml?rev=1685945&r1=1685944&r2=1685945&view=diff
==============================================================================
--- james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
(original)
+++ james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
Wed Jun 17 08:39:28 2015
@@ -75,7 +75,7 @@
         <constructor-arg index="2" value="${cassandra.replication.factor}" type="int"/>
     </bean>
 
-    <bean id="cassandra-session" class="org.apache.james.mailbox.cassandra.SessionFactory"
factory-method="">
+    <bean id="cassandra-session" class="org.apache.james.mailbox.cassandra.SessionFactory"
factory-method="createSession">
         <constructor-arg index="0" ref="cassandra-cluster-initialized"/>
         <constructor-arg index="1" value="${cassandra.keyspace}"/>
     </bean>

Modified: james/mailbox/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/pom.xml?rev=1685945&r1=1685944&r2=1685945&view=diff
==============================================================================
--- james/mailbox/trunk/pom.xml (original)
+++ james/mailbox/trunk/pom.xml Wed Jun 17 08:39:28 2015
@@ -95,7 +95,7 @@
         <jmock.version>2.5.1</jmock.version>
         <hbase.version>0.92.0</hbase.version>
         <hadoop.version>1.0.1</hadoop.version>
-        <spring.version>3.1.2.RELEASE</spring.version>
+        <spring.version>3.2.13.RELEASE</spring.version>
         <commons-io.version>2.4</commons-io.version>
         <commons-lang.version>2.6</commons-lang.version>
         <commons-pool.version>1.6</commons-pool.version>



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message