cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r966272 - in /cassandra/trunk/src/java/org/apache/cassandra/config: ColumnFamily.java Config.java Converter.java DatabaseDescriptor.java Keyspace.java RawColumnFamily.java RawKeyspace.java
Date Wed, 21 Jul 2010 15:13:39 GMT
Author: gdusbabek
Date: Wed Jul 21 15:13:39 2010
New Revision: 966272

URL: http://svn.apache.org/viewvc?rev=966272&view=rev
Log:
rename yaml related classes. patch by stuhood, reviewed by gdusbabek. CASSANDRA-1186

Added:
    cassandra/trunk/src/java/org/apache/cassandra/config/RawColumnFamily.java
      - copied, changed from r966033, cassandra/trunk/src/java/org/apache/cassandra/config/ColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/config/RawKeyspace.java
Removed:
    cassandra/trunk/src/java/org/apache/cassandra/config/ColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/config/Keyspace.java
Modified:
    cassandra/trunk/src/java/org/apache/cassandra/config/Config.java
    cassandra/trunk/src/java/org/apache/cassandra/config/Converter.java
    cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/Config.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/Config.java?rev=966272&r1=966271&r2=966272&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/Config.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/Config.java Wed Jul 21 15:13:39 2010
@@ -2,7 +2,8 @@ package org.apache.cassandra.config;
 import java.util.List;
 
 
-public class Config {
+public class Config
+{
     public String cluster_name = "Test Cluster";
     public String authenticator;
     
@@ -76,7 +77,7 @@ public class Config {
     public RequestSchedulerId request_scheduler_id;
     public RequestSchedulerOptions request_scheduler_options;
 
-    public List<Keyspace> keyspaces;
+    public List<RawKeyspace> keyspaces;
     
     public static enum CommitLogSync {
         periodic,

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/Converter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/Converter.java?rev=966272&r1=966271&r2=966272&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/Converter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/Converter.java Wed Jul 21 15:13:39
2010
@@ -25,15 +25,19 @@ import org.yaml.snakeyaml.nodes.NodeTupl
 import org.yaml.snakeyaml.nodes.Tag;
 import org.yaml.snakeyaml.representer.Representer;
 
-public class Converter {
+/**
+ * @deprecated Yaml configuration for Keyspaces and ColumnFamilies is deprecated in 0.7
+ */
+public class Converter
+{
 
     private static Config conf = new Config();
     private final static String PREVIOUS_CONF_FILE = "cassandra.xml";
     
-    private static List<Keyspace> readTablesFromXml(XMLUtils xmlUtils) throws ConfigurationException
+    private static List<RawKeyspace> readTablesFromXml(XMLUtils xmlUtils) throws ConfigurationException
     {
 
-        List<Keyspace> keyspaces = new ArrayList<Keyspace>();
+        List<RawKeyspace> keyspaces = new ArrayList<RawKeyspace>();
         /* Read the table related stuff from config */
         try
         {
@@ -42,7 +46,7 @@ public class Converter {
             for ( int i = 0; i < size; ++i )
             {
                 String value;
-                Keyspace ks = new Keyspace();
+                RawKeyspace ks = new RawKeyspace();
                 Node table = tablesxml.item(i);
                 /* parsing out the table ksName */
                 ks.name = XMLUtils.getAttributeValue(table, "Name");
@@ -61,11 +65,11 @@ public class Converter {
                 NodeList columnFamilies = xmlUtils.getRequestedNodeList(xqlTable + "ColumnFamily");
 
                 int size2 = columnFamilies.getLength();
-                ks.column_families = new ColumnFamily[size2];
+                ks.column_families = new RawColumnFamily[size2];
                 for ( int j = 0; j < size2; ++j )
                 {
                     Node columnFamily = columnFamilies.item(j);
-                    ks.column_families[j] = new ColumnFamily();
+                    ks.column_families[j] = new RawColumnFamily();
                     ks.column_families[j].name = XMLUtils.getAttributeValue(columnFamily,
"Name");
                     String xqlCF = xqlTable + "ColumnFamily[@Name='" + ks.column_families[j].name
+ "']/";
                     ks.column_families[j].column_type = ColumnFamilyType.create(XMLUtils.getAttributeValue(columnFamily,
"ColumnType"));
@@ -259,7 +263,7 @@ public class Converter {
         SkipNullRepresenter representer = new SkipNullRepresenter();
         /* Use Tag.MAP to avoid the class name being included as global tag */
         representer.addClassTag(Config.class, Tag.MAP);
-        representer.addClassTag(ColumnFamily.class, Tag.MAP);
+        representer.addClassTag(RawColumnFamily.class, Tag.MAP);
         Dumper dumper = new Dumper(representer, options);
         Yaml yaml = new Yaml(dumper);
         String output = yaml.dump(conf);
@@ -285,7 +289,7 @@ public class Converter {
             if (scpurl != null)
                 configname = scpurl.getFile();
             else 
-                throw new ConfigurationException("Error finding previuos configuration file.");
+                throw new ConfigurationException("Error finding previous configuration file.");
             
             System.out.println("Found previous configuration: " + configname);
             

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=966272&r1=966271&r2=966272&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Wed Jul 21
15:13:39 2010
@@ -123,10 +123,10 @@ public class DatabaseDescriptor
             InputStream input = new FileInputStream(new File(configFileName));
             org.yaml.snakeyaml.constructor.Constructor constructor = new org.yaml.snakeyaml.constructor.Constructor(Config.class);
             TypeDescription desc = new TypeDescription(Config.class);
-            desc.putListPropertyType("keyspaces", Keyspace.class);
-            TypeDescription ksDesc = new TypeDescription(Keyspace.class);
-            ksDesc.putListPropertyType("column_families", ColumnFamily.class);
-            TypeDescription cfDesc = new TypeDescription(ColumnFamily.class);
+            desc.putListPropertyType("keyspaces", RawKeyspace.class);
+            TypeDescription ksDesc = new TypeDescription(RawKeyspace.class);
+            ksDesc.putListPropertyType("column_families", RawColumnFamily.class);
+            TypeDescription cfDesc = new TypeDescription(RawColumnFamily.class);
             cfDesc.putListPropertyType("column_metadata", RawColumnDefinition.class);
             constructor.addTypeDescription(desc);
             constructor.addTypeDescription(ksDesc);
@@ -512,7 +512,7 @@ public class DatabaseDescriptor
         
         
         /* Read the table related stuff from config */
-        for (Keyspace keyspace : conf.keyspaces)
+        for (RawKeyspace keyspace : conf.keyspaces)
         {
             /* parsing out the table name */
             if (keyspace.name == null)
@@ -549,7 +549,7 @@ public class DatabaseDescriptor
             int size2 = keyspace.column_families.length;
             CFMetaData[] cfDefs = new CFMetaData[size2];
             int j = 0;
-            for (ColumnFamily cf : keyspace.column_families)
+            for (RawColumnFamily cf : keyspace.column_families)
             {
                 if (cf.name == null)
                 {

Copied: cassandra/trunk/src/java/org/apache/cassandra/config/RawColumnFamily.java (from r966033,
cassandra/trunk/src/java/org/apache/cassandra/config/ColumnFamily.java)
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/RawColumnFamily.java?p2=cassandra/trunk/src/java/org/apache/cassandra/config/RawColumnFamily.java&p1=cassandra/trunk/src/java/org/apache/cassandra/config/ColumnFamily.java&r1=966033&r2=966272&rev=966272&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/ColumnFamily.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/RawColumnFamily.java Wed Jul 21 15:13:39
2010
@@ -6,7 +6,11 @@ import java.util.Map;
 import org.apache.cassandra.db.ClockType;
 import org.apache.cassandra.db.ColumnFamilyType;
 
-public class ColumnFamily {
+/**
+ * @deprecated Yaml configuration for Keyspaces and ColumnFamilies is deprecated in 0.7
+ */
+public class RawColumnFamily
+{
     public String name;            
     public ColumnFamilyType column_type;
     public ClockType clock_type;

Added: cassandra/trunk/src/java/org/apache/cassandra/config/RawKeyspace.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/RawKeyspace.java?rev=966272&view=auto
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/RawKeyspace.java (added)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/RawKeyspace.java Wed Jul 21 15:13:39
2010
@@ -0,0 +1,12 @@
+package org.apache.cassandra.config;
+
+/**
+ * @deprecated Yaml configuration for Keyspaces and ColumnFamilies is deprecated in 0.7
+ */
+public class RawKeyspace
+{
+    public String name;
+    public String replica_placement_strategy;
+    public Integer replication_factor;
+    public RawColumnFamily[] column_families;
+}



Mime
View raw message