cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1095250 - in /cassandra/branches/cassandra-0.7: contrib/pig/src/java/org/apache/cassandra/hadoop/pig/ src/java/org/apache/cassandra/db/marshal/ src/java/org/apache/cassandra/utils/
Date Wed, 20 Apr 2011 01:50:06 GMT
Author: jbellis
Date: Wed Apr 20 01:50:06 2011
New Revision: 1095250

URL: http://svn.apache.org/viewvc?rev=1095250&view=rev
Log:
r/m AT.getInstance methods
patch by jbellis; reviewed by jhanna for CASSANDRA-2513

Modified:
    cassandra/branches/cassandra-0.7/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/AsciiType.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/BytesType.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/IntegerType.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LongType.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/FBUtilities.java

Modified: cassandra/branches/cassandra-0.7/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
(original)
+++ cassandra/branches/cassandra-0.7/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
Wed Apr 20 01:50:06 2011
@@ -179,8 +179,8 @@ public class CassandraStorage extends Lo
         AbstractType default_validator = null;
         try
         {
-            comparator = FBUtilities.getInstance(cfDef.comparator_type, "comparator");
-            default_validator = FBUtilities.getInstance(cfDef.default_validation_class, "validator");
+            comparator = FBUtilities.getComparator(cfDef.comparator_type);
+            default_validator = FBUtilities.getComparator(cfDef.default_validation_class);
         }
         catch (ConfigurationException e)
         {
@@ -202,7 +202,7 @@ public class CassandraStorage extends Lo
                 AbstractType validator = null;
                 try
                 {
-                    validator = FBUtilities.getInstance(cd.getValidation_class(), "validator");
+                    validator = FBUtilities.getComparator(cd.getValidation_class());
                     validators.put(cd.name, validator);
                 }
                 catch (ConfigurationException e)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/AsciiType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/AsciiType.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/AsciiType.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/AsciiType.java
Wed Apr 20 01:50:06 2011
@@ -32,11 +32,6 @@ public class AsciiType extends AbstractT
 {
     public static final AsciiType instance = new AsciiType();
 
-    public static AsciiType getInstance()
-    {
-        return instance;
-    }
-
     AsciiType() {} // singleton
 
     public String compose(ByteBuffer bytes)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/BytesType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/BytesType.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/BytesType.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/BytesType.java
Wed Apr 20 01:50:06 2011
@@ -29,11 +29,6 @@ public class BytesType extends AbstractT
 {
     public static final BytesType instance = new BytesType();
 
-    public static BytesType getInstance()
-    {
-        return instance;
-    }
-
     BytesType() {} // singleton
 
     public ByteBuffer compose(ByteBuffer bytes)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/IntegerType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/IntegerType.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/IntegerType.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/IntegerType.java
Wed Apr 20 01:50:06 2011
@@ -29,12 +29,6 @@ public final class IntegerType extends A
 {
     public static final IntegerType instance = new IntegerType();
 
-    public static IntegerType getInstance()
-    {
-        return instance;
-    }
-
-
     private static int findMostSignificantByte(ByteBuffer bytes)
     {
         int len = bytes.remaining() - 1;

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
Wed Apr 20 01:50:06 2011
@@ -30,11 +30,6 @@ public class LexicalUUIDType extends Abs
 {
     public static final LexicalUUIDType instance = new LexicalUUIDType();
 
-    public static LexicalUUIDType getInstance()
-    {
-        return instance;
-    }
-
     LexicalUUIDType() {} // singleton
 
     public UUID compose(ByteBuffer bytes)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LongType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LongType.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LongType.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/LongType.java
Wed Apr 20 01:50:06 2011
@@ -29,11 +29,6 @@ public class LongType extends AbstractTy
 {
     public static final LongType instance = new LongType();
 
-    public static LongType getInstance()
-    {
-        return instance;
-    }
-
     LongType() {} // singleton
 
     public Long compose(ByteBuffer bytes)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
Wed Apr 20 01:50:06 2011
@@ -30,11 +30,6 @@ public class TimeUUIDType extends Abstra
 {
     public static final TimeUUIDType instance = new TimeUUIDType();
 
-    public static TimeUUIDType getInstance()
-    {
-        return instance;
-    }
-
     TimeUUIDType() {} // singleton
 
     public UUID compose(ByteBuffer bytes)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/UTF8Type.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
Wed Apr 20 01:50:06 2011
@@ -30,11 +30,6 @@ public class UTF8Type extends AbstractTy
 {
     public static final UTF8Type instance = new UTF8Type();
 
-    public static UTF8Type getInstance()
-    {
-        return instance;
-    }
-
     UTF8Type() {} // singleton
 
     public String compose(ByteBuffer bytes)

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/FBUtilities.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/FBUtilities.java?rev=1095250&r1=1095249&r2=1095250&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/FBUtilities.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/FBUtilities.java
Wed Apr 20 01:50:06 2011
@@ -511,7 +511,6 @@ public class FBUtilities
 
     /**
      * Constructs an instance of the given class, which must have a no-arg constructor.
-     * TODO: Similar method for our 'instance member' singleton pattern would be nice.
      * @param classname Fully qualified classname.
      * @param readable Descriptive noun for the role the class plays.
      * @throws ConfigurationException If the class cannot be found.
@@ -543,31 +542,6 @@ public class FBUtilities
         }
     }
 
-    public static <T> T getInstance(String classname, String readable) throws ConfigurationException
-    {
-        Class cls = classForName(classname,  readable);
-        T rval = null;
-        try
-        {
-            rval = (T) cls.getDeclaredMethod("getInstance").invoke(new Object[] {null, null});
-
-        }
-        catch (NoSuchMethodException e)
-        {
-            throw new ConfigurationException("Class does not have the getInstance method
with no arguments");
-        }
-        catch (InvocationTargetException e)
-        {
-            throw new ConfigurationException(String.format("Could not call method getInstance
on %s class %s", readable, classname));
-        }
-        catch (IllegalAccessException e)
-        {
-            throw new ConfigurationException(String.format("Could not call method getInstance
on %s class %s", readable, classname));
-        }
-
-        return rval;
-    }
-
     public static <T extends Comparable> SortedSet<T> singleton(T column)
     {
         return new TreeSet<T>(Arrays.asList(column));



Mime
View raw message