You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/02/27 11:31:17 UTC
[5/14] [3649] Strip end of line whitespaces
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/concurrent/Stage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/Stage.java b/src/java/org/apache/cassandra/concurrent/Stage.java
index 9dc9eed..48fe9ad 100644
--- a/src/java/org/apache/cassandra/concurrent/Stage.java
+++ b/src/java/org/apache/cassandra/concurrent/Stage.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.concurrent;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.concurrent;
* 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.
- *
+ *
*/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/concurrent/StageManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/StageManager.java b/src/java/org/apache/cassandra/concurrent/StageManager.java
index b96c1b3..c57b593 100644
--- a/src/java/org/apache/cassandra/concurrent/StageManager.java
+++ b/src/java/org/apache/cassandra/concurrent/StageManager.java
@@ -40,7 +40,7 @@ public class StageManager
static
{
stages.put(Stage.MUTATION, multiThreadedConfigurableStage(Stage.MUTATION, getConcurrentWriters()));
- stages.put(Stage.READ, multiThreadedConfigurableStage(Stage.READ, getConcurrentReaders()));
+ stages.put(Stage.READ, multiThreadedConfigurableStage(Stage.READ, getConcurrentReaders()));
stages.put(Stage.REQUEST_RESPONSE, multiThreadedStage(Stage.REQUEST_RESPONSE, Runtime.getRuntime().availableProcessors()));
stages.put(Stage.INTERNAL_RESPONSE, multiThreadedStage(Stage.INTERNAL_RESPONSE, Runtime.getRuntime().availableProcessors()));
stages.put(Stage.REPLICATE_ON_WRITE, multiThreadedConfigurableStage(Stage.REPLICATE_ON_WRITE, getConcurrentReplicators()));
@@ -62,7 +62,7 @@ public class StageManager
new NamedThreadFactory(stage.getJmxName()),
stage.getJmxType());
}
-
+
private static ThreadPoolExecutor multiThreadedConfigurableStage(Stage stage, int numThreads)
{
return new JMXConfigurableThreadPoolExecutor(numThreads,
@@ -81,7 +81,7 @@ public class StageManager
{
return stages.get(stage);
}
-
+
/**
* This method shuts down all registered stages.
*/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 1c2d1ec..a7d1d14 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -315,7 +315,7 @@ public final class CFMetaData
.bloomFilterFpChance(oldCFMD.bloomFilterFpChance)
.caching(oldCFMD.caching);
}
-
+
/**
* generate a column family name for an index corresponding to the given column.
* This is NOT the same as the index's name! This is only used in sstable filenames and is not exposed to users.
@@ -437,7 +437,7 @@ public final class CFMetaData
{
return new ArrayList<T>(array);
}
-
+
public String getComment()
{
return comment;
@@ -457,7 +457,7 @@ public final class CFMetaData
{
return replicateOnWrite;
}
-
+
public int getGcGraceSeconds()
{
return gcGraceSeconds;
@@ -611,7 +611,7 @@ public final class CFMetaData
}
/** applies implicit defaults to cf definition. useful in updates */
- public static void applyImplicitDefaults(org.apache.cassandra.thrift.CfDef cf_def)
+ public static void applyImplicitDefaults(org.apache.cassandra.thrift.CfDef cf_def)
{
if (!cf_def.isSetComment())
cf_def.setComment("");
@@ -781,7 +781,7 @@ public final class CFMetaData
for (ByteBuffer name : column_metadata.keySet())
if (!newColumns.contains(name))
toRemove.add(name);
-
+
// remove the ones leaving.
for (ByteBuffer indexName : toRemove)
{
@@ -802,7 +802,7 @@ public final class CFMetaData
for (ColumnDef def : toAdd)
{
AbstractType<?> dValidClass = TypeParser.parse(def.validation_class);
- ColumnDefinition cd = new ColumnDefinition(def.name,
+ ColumnDefinition cd = new ColumnDefinition(def.name,
dValidClass,
def.index_type == null ? null : IndexType.valueOf(def.index_type.name()),
def.index_options,
@@ -967,7 +967,7 @@ public final class CFMetaData
try
{
AbstractType<?> comparator = TypeParser.parse(cf_def.comparator_type);
-
+
for (org.apache.cassandra.thrift.ColumnDef column : cf_def.column_metadata)
{
if (column.index_type != null && column.index_name == null)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java
index 68875d6..dbba216 100644
--- a/src/java/org/apache/cassandra/config/ColumnDefinition.java
+++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.config;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.config;
* 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.
- *
+ *
*/
@@ -45,13 +45,13 @@ public class ColumnDefinition
private IndexType index_type;
private Map<String,String> index_options;
private String index_name;
-
+
public ColumnDefinition(ByteBuffer name, AbstractType<?> validator, IndexType index_type, Map<String, String> index_options, String index_name)
{
this.name = name;
this.index_name = index_name;
this.validator = validator;
-
+
this.setIndexType(index_type, index_options);
}
@@ -282,7 +282,7 @@ public class ColumnDefinition
{
return index_name;
}
-
+
public void setIndexName(String s)
{
index_name = s;
@@ -291,19 +291,19 @@ public class ColumnDefinition
public void setIndexType(IndexType index_type, Map<String,String> index_options)
{
this.index_type = index_type;
- this.index_options = index_options;
+ this.index_options = index_options;
}
public IndexType getIndexType()
{
return index_type;
}
-
+
public Map<String,String> getIndexOptions()
{
return index_options;
}
-
+
public AbstractType<?> getValidator()
{
return validator;
@@ -313,18 +313,18 @@ public class ColumnDefinition
{
this.validator = validator;
}
-
+
public static Map<String,String> getStringMap(Map<CharSequence, CharSequence> charMap)
{
if (charMap == null)
return null;
-
+
Map<String,String> stringMap = new HashMap<String, String>();
-
- for (Map.Entry<CharSequence, CharSequence> entry : charMap.entrySet())
+
+ for (Map.Entry<CharSequence, CharSequence> entry : charMap.entrySet())
stringMap.put(entry.getKey().toString(), entry.getValue().toString());
-
-
+
+
return stringMap;
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index 69e0c40..bc0f103 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.config;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.config;
* 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.cassandra.cache.ConcurrentLinkedHashCacheProvider;
@@ -31,46 +31,46 @@ public class Config
public String cluster_name = "Test Cluster";
public String authenticator;
public String authority;
-
+
/* Hashing strategy Random or OPHF */
public String partitioner;
-
+
public Boolean auto_bootstrap = true;
public Boolean hinted_handoff_enabled = true;
public Integer max_hint_window_in_ms = Integer.MAX_VALUE;
-
+
public SeedProviderDef seed_provider;
public DiskAccessMode disk_access_mode = DiskAccessMode.auto;
-
+
/* Address where to run the job tracker */
public String job_tracker_host;
-
+
/* Job Jar Location */
public String job_jar_file_location;
-
+
/* initial token in the ring */
public String initial_token;
-
+
public Long rpc_timeout_in_ms = new Long(2000);
public Integer streaming_socket_timeout_in_ms = new Integer(0);
public Integer phi_convict_threshold = 8;
-
+
public Integer concurrent_reads = 8;
public Integer concurrent_writes = 32;
public Integer concurrent_replicates = 32;
-
+
public Integer memtable_flush_writers = null; // will get set to the length of data dirs in DatabaseDescriptor
public Integer memtable_total_space_in_mb;
public Integer sliced_buffer_size_in_kb = 64;
-
+
public Integer storage_port = 7000;
public Integer ssl_storage_port = 7001;
public String listen_address;
public String broadcast_address;
-
+
public String rpc_address;
public Integer rpc_port = 9160;
public String rpc_server_type = "sync";
@@ -103,7 +103,7 @@ public class Config
public CommitLogSync commitlog_sync;
public Double commitlog_sync_batch_window_in_ms;
public Integer commitlog_sync_period_in_ms;
-
+
public String endpoint_snitch;
public Boolean dynamic_snitch = true;
public Integer dynamic_snitch_update_interval_in_ms = 100;
@@ -163,14 +163,14 @@ public class Config
periodic,
batch
}
-
+
public static enum DiskAccessMode {
auto,
mmap,
mmap_index_only,
standard,
}
-
+
public static enum RequestSchedulerId
{
keyspace
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 20a5466..0c20160 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -71,7 +71,7 @@ public class DatabaseDescriptor
private static IPartitioner partitioner;
private static Config.DiskAccessMode indexAccessMode;
-
+
private static Config conf;
private static IAuthenticator authenticator = new AllowAllAuthenticator();
@@ -472,7 +472,7 @@ public class DatabaseDescriptor
}
/** load keyspace (table) definitions, but do not initialize the table instances. */
- public static void loadSchemas() throws IOException
+ public static void loadSchemas() throws IOException
{
ColumnFamilyStore schemaCFS = SystemTable.schemaCFS(SystemTable.SCHEMA_KEYSPACES_CF);
@@ -556,8 +556,8 @@ public class DatabaseDescriptor
{
return conf.thrift_max_message_length_in_mb * 1024 * 1024;
}
-
- public static int getThriftFramedTransportSize()
+
+ public static int getThriftFramedTransportSize()
{
return conf.thrift_framed_transport_size_in_mb * 1024 * 1024;
}
@@ -603,7 +603,7 @@ public class DatabaseDescriptor
{
partitioner = newPartitioner;
}
-
+
public static IEndpointSnitch getEndpointSnitch()
{
return snitch;
@@ -632,7 +632,7 @@ public class DatabaseDescriptor
{
return conf.job_tracker_host;
}
-
+
public static int getColumnIndexSize()
{
return conf.column_index_size_in_kb * 1024;
@@ -762,7 +762,7 @@ public class DatabaseDescriptor
{
return conf.saved_caches_directory;
}
-
+
public static Set<InetAddress> getSeeds()
{
return Collections.unmodifiableSet(new HashSet(seedProvider.getSeeds()));
@@ -772,22 +772,22 @@ public class DatabaseDescriptor
{
return listenAddress;
}
-
+
public static InetAddress getBroadcastAddress()
{
return broadcastAddress;
}
-
+
public static void setBroadcastAddress(InetAddress broadcastAdd)
{
broadcastAddress = broadcastAdd;
}
-
+
public static InetAddress getRpcAddress()
{
return rpcAddress;
}
-
+
public static String getRpcServerType()
{
return conf.rpc_server_type;
@@ -802,12 +802,12 @@ public class DatabaseDescriptor
{
return conf.rpc_min_threads;
}
-
+
public static Integer getRpcMaxThreads()
{
return conf.rpc_max_threads;
}
-
+
public static Integer getRpcSendBufferSize()
{
return conf.rpc_send_buff_size_in_bytes;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java b/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java
index 1cf12b4..804e42d 100644
--- a/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java
+++ b/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java
@@ -2,7 +2,7 @@ package org.apache.cassandra.config;
import java.util.Map;
/*
- *
+ *
* 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
@@ -10,16 +10,16 @@ import java.util.Map;
* 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.
- *
+ *
*/
/**
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/config/SeedProviderDef.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/SeedProviderDef.java b/src/java/org/apache/cassandra/config/SeedProviderDef.java
index 4e33bfe..21c18d5 100644
--- a/src/java/org/apache/cassandra/config/SeedProviderDef.java
+++ b/src/java/org/apache/cassandra/config/SeedProviderDef.java
@@ -27,7 +27,7 @@ public class SeedProviderDef
{
public String class_name;
public Map<String, String> parameters;
-
+
public SeedProviderDef(LinkedHashMap p)
{
class_name = (String)p.get("class_name");
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/CQLStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CQLStatement.java b/src/java/org/apache/cassandra/cql/CQLStatement.java
index 803dd1d..d884b6e 100644
--- a/src/java/org/apache/cassandra/cql/CQLStatement.java
+++ b/src/java/org/apache/cassandra/cql/CQLStatement.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -25,7 +25,7 @@ public class CQLStatement
public StatementType type;
public Object statement;
public int boundTerms = 0;
-
+
public CQLStatement(StatementType type, Object statement, int lastMarker)
{
this.type = type;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
index 328a70b..ad789c3 100644
--- a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -49,7 +49,7 @@ public class CreateColumnFamilyStatement
{
this.name = name;
}
-
+
/** Perform validation of parsed params */
private void validate(List<ByteBuffer> variables) throws InvalidRequestException
{
@@ -60,7 +60,7 @@ public class CreateColumnFamilyStatement
throw new InvalidRequestException(String.format("\"%s\" is not a valid column family name", name));
if (name.length() > 32)
throw new InvalidRequestException(String.format("Column family names shouldn't be more than 32 character long (got \"%s\")", name));
-
+
// Ensure that exactly one key has been specified.
if (keyValidator.size() < 1)
throw new InvalidRequestException("You must specify a PRIMARY KEY");
@@ -89,18 +89,18 @@ public class CreateColumnFamilyStatement
}
}
-
+
/** Map a column name to a validator for its value */
public void addColumn(Term term, String comparator)
{
columns.put(term, comparator);
}
-
+
public void setKeyType(String validator)
{
keyValidator.add(validator);
}
-
+
public String getKeyType()
{
return keyValidator.get(0);
@@ -124,12 +124,12 @@ public class CreateColumnFamilyStatement
{
return name;
}
-
+
// Column definitions
private Map<ByteBuffer, ColumnDefinition> getColumns(AbstractType<?> comparator) throws InvalidRequestException
{
Map<ByteBuffer, ColumnDefinition> columnDefs = new HashMap<ByteBuffer, ColumnDefinition>();
-
+
for (Map.Entry<Term, String> col : columns.entrySet())
{
try
@@ -148,14 +148,14 @@ public class CreateColumnFamilyStatement
throw ex;
}
}
-
+
return columnDefs;
}
/**
* Returns a CFMetaData instance based on the parameters parsed from this
* <code>CREATE</code> statement, or defaults where applicable.
- *
+ *
* @param keyspace keyspace to apply this column family to
* @return a CFMetaData instance corresponding to the values parsed from this statement
* @throws InvalidRequestException on failure to validate parsed parameters
@@ -197,7 +197,7 @@ public class CreateColumnFamilyStatement
}
return newCFMD;
}
-
+
private String getPropertyString(String key, String defaultValue)
{
return cfProps.getPropertyString(key, defaultValue);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/CreateIndexStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CreateIndexStatement.java b/src/java/org/apache/cassandra/cql/CreateIndexStatement.java
index 42b62bc..34940b5 100644
--- a/src/java/org/apache/cassandra/cql/CreateIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateIndexStatement.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -26,26 +26,26 @@ public class CreateIndexStatement
private final String columnFamily;
private final String indexName;
private final Term columnName;
-
+
public CreateIndexStatement(String indexName, String columnFamily, Term columnName)
{
this.indexName = indexName;
this.columnFamily = columnFamily;
this.columnName = columnName;
}
-
+
/** Column family namespace. */
public String getColumnFamily()
{
return columnFamily;
}
-
+
/** Column name to index. */
public Term getColumnName()
{
return columnName;
}
-
+
/** Index name (or null). */
public String getIndexName()
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java b/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
index ca0b228..0b8fea4 100644
--- a/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql;
* 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.
- *
+ *
*/
@@ -34,16 +34,16 @@ import org.apache.cassandra.thrift.InvalidRequestException;
/** A <code>CREATE KEYSPACE</code> statement parsed from a CQL query. */
public class CreateKeyspaceStatement
-{
+{
private final String name;
private final Map<String, String> attrs;
private String strategyClass;
private Map<String, String> strategyOptions = new HashMap<String, String>();
-
+
/**
* Creates a new <code>CreateKeyspaceStatement</code> instance for a given
* keyspace name and keyword arguments.
- *
+ *
* @param name the name of the keyspace to create
* @param attrs map of the raw keyword arguments that followed the <code>WITH</code> keyword.
*/
@@ -52,12 +52,12 @@ public class CreateKeyspaceStatement
this.name = name;
this.attrs = attrs;
}
-
+
/**
* The <code>CqlParser</code> only goes as far as extracting the keyword arguments
* from these statements, so this method is responsible for processing and
* validating, and must be called prior to access.
- *
+ *
* @throws InvalidRequestException if arguments are missing or unacceptable
*/
public void validate() throws InvalidRequestException
@@ -67,12 +67,12 @@ public class CreateKeyspaceStatement
throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > 32)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than 32 character long (got \"%s\")", name));
-
+
// required
if (!attrs.containsKey("strategy_class"))
throw new InvalidRequestException("missing required argument \"strategy_class\"");
strategyClass = attrs.get("strategy_class");
-
+
// optional
for (String key : attrs.keySet())
if ((key.contains(":")) && (key.startsWith("strategy_options")))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/DeleteStatement.java b/src/java/org/apache/cassandra/cql/DeleteStatement.java
index f19cd3b..9de571e 100644
--- a/src/java/org/apache/cassandra/cql/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql/DeleteStatement.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -45,7 +45,7 @@ public class DeleteStatement extends AbstractModification
{
private List<Term> columns;
private List<Term> keys;
-
+
public DeleteStatement(List<Term> columns, String keyspace, String columnFamily, String keyName, List<Term> keys, Attributes attrs)
{
super(keyspace, columnFamily, keyName, attrs);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/QueryProcessor.java b/src/java/org/apache/cassandra/cql/QueryProcessor.java
index befcb21..78be1d3 100644
--- a/src/java/org/apache/cassandra/cql/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql/QueryProcessor.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -170,7 +170,7 @@ public class QueryProcessor
throw new InvalidRequestException("Start key must sort before (or equal to) finish key in your partitioner!");
}
AbstractBounds<RowPosition> bounds = new Bounds<RowPosition>(startKey, finishKey);
-
+
// XXX: Our use of Thrift structs internally makes me Sad. :(
SlicePredicate thriftSlicePredicate = slicePredicateFromSelect(select, metadata, variables);
validateSlicePredicate(metadata, thriftSlicePredicate);
@@ -253,7 +253,7 @@ public class QueryProcessor
rowMutations.addAll(update.prepareRowMutations(keyspace, clientState, variables));
}
-
+
try
{
StorageProxy.mutate(rowMutations, consistency);
@@ -267,12 +267,12 @@ public class QueryProcessor
throw new TimedOutException();
}
}
-
+
private static SlicePredicate slicePredicateFromSelect(SelectStatement select, CFMetaData metadata, List<ByteBuffer> variables)
throws InvalidRequestException
{
SlicePredicate thriftSlicePredicate = new SlicePredicate();
-
+
if (select.isColumnRange() || select.getColumnNames().size() == 0)
{
SliceRange sliceRange = new SliceRange();
@@ -286,10 +286,10 @@ public class QueryProcessor
{
thriftSlicePredicate.column_names = getColumnNames(select, metadata, variables);
}
-
+
return thriftSlicePredicate;
}
-
+
/* Test for SELECT-specific taboos */
private static void validateSelect(String keyspace, SelectStatement select, List<ByteBuffer> variables) throws InvalidRequestException
{
@@ -298,15 +298,15 @@ public class QueryProcessor
// Finish key w/o start key (KEY < foo)
if (!select.isKeyRange() && (select.getKeyFinish() != null))
throw new InvalidRequestException("Key range clauses must include a start key (i.e. KEY > term)");
-
+
// Key range and by-key(s) combined (KEY > foo AND KEY = bar)
if (select.isKeyRange() && select.getKeys().size() > 0)
throw new InvalidRequestException("You cannot combine key range and by-key clauses in a SELECT");
-
+
// Start and finish keys, *and* column relations (KEY > foo AND KEY < bar and name1 = value1).
if (select.isKeyRange() && (select.getKeyFinish() != null) && (select.getColumnRelations().size() > 0))
throw new InvalidRequestException("You cannot combine key range and by-column clauses in a SELECT");
-
+
// Can't use more than one KEY =
if (!select.isMultiKey() && select.getKeys().size() > 1)
throw new InvalidRequestException("You cannot use more than one KEY = in a SELECT");
@@ -362,7 +362,7 @@ public class QueryProcessor
validateSchemaIsSettled();
}
-
+
public static void validateKey(ByteBuffer key) throws InvalidRequestException
{
if (key == null || key.remaining() == 0)
@@ -405,7 +405,7 @@ public class QueryProcessor
{
validateColumnNames(Arrays.asList(column));
}
-
+
public static void validateColumn(CFMetaData metadata, ByteBuffer name, ByteBuffer value)
throws InvalidRequestException
{
@@ -424,7 +424,7 @@ public class QueryProcessor
me.getMessage()));
}
}
-
+
private static void validateSlicePredicate(CFMetaData metadata, SlicePredicate predicate)
throws InvalidRequestException
{
@@ -433,13 +433,13 @@ public class QueryProcessor
else
validateColumnNames(predicate.column_names);
}
-
+
private static void validateSliceRange(CFMetaData metadata, SliceRange range)
throws InvalidRequestException
{
validateSliceRange(metadata, range.start, range.finish, range.reversed);
}
-
+
private static void validateSliceRange(CFMetaData metadata, ByteBuffer start, ByteBuffer finish, boolean reversed)
throws InvalidRequestException
{
@@ -448,7 +448,7 @@ public class QueryProcessor
if (start.remaining() > 0 && finish.remaining() > 0 && orderedComparator.compare(start, finish) > 0)
throw new InvalidRequestException("range finish must come after start in traversal order");
}
-
+
// Copypasta from CassandraServer (where it is private).
private static void validateSchemaAgreement() throws SchemaDisagreementException
{
@@ -467,13 +467,13 @@ public class QueryProcessor
throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException
{
String keyspace = null;
-
+
// Some statements won't have (or don't need) a keyspace (think USE, or CREATE).
if (statement.type != StatementType.SELECT && StatementType.requiresKeyspace.contains(statement.type))
keyspace = clientState.getKeyspace();
CqlResult result = new CqlResult();
-
+
if (logger.isDebugEnabled()) logger.debug("CQL statement type: {}", statement.type.toString());
CFMetaData metadata;
switch (statement.type)
@@ -627,7 +627,7 @@ public class QueryProcessor
batchUpdate(clientState, Collections.singletonList(update), update.getConsistencyLevel(), variables);
result.type = CqlResultType.VOID;
return result;
-
+
case BATCH:
BatchStatement batch = (BatchStatement) statement.statement;
ThriftValidation.validateConsistencyLevel(keyspace, batch.getConsistencyLevel(), RequestType.WRITE);
@@ -661,20 +661,20 @@ public class QueryProcessor
result.type = CqlResultType.VOID;
return result;
-
+
case USE:
clientState.setKeyspace(CliUtils.unescapeSQLString((String) statement.statement));
result.type = CqlResultType.VOID;
-
+
return result;
-
+
case TRUNCATE:
Pair<String, String> columnFamily = (Pair<String, String>)statement.statement;
keyspace = columnFamily.left == null ? clientState.getKeyspace() : columnFamily.left;
validateColumnFamily(keyspace, columnFamily.right);
clientState.hasColumnFamilyAccess(keyspace, columnFamily.right, Permission.WRITE);
-
+
try
{
StorageProxy.truncateBlocking(keyspace, columnFamily.right);
@@ -687,10 +687,10 @@ public class QueryProcessor
{
throw (UnavailableException) new UnavailableException().initCause(e);
}
-
+
result.type = CqlResultType.VOID;
return result;
-
+
case DELETE:
DeleteStatement delete = (DeleteStatement)statement.statement;
@@ -704,17 +704,17 @@ public class QueryProcessor
{
throw new TimedOutException();
}
-
+
result.type = CqlResultType.VOID;
return result;
-
+
case CREATE_KEYSPACE:
CreateKeyspaceStatement create = (CreateKeyspaceStatement)statement.statement;
create.validate();
ThriftValidation.validateKeyspaceNotSystem(create.getName());
clientState.hasKeyspaceSchemaAccess(Permission.WRITE);
validateSchemaAgreement();
-
+
try
{
KsDef ksd = new KsDef(create.getName(),
@@ -731,10 +731,10 @@ public class QueryProcessor
ex.initCause(e);
throw ex;
}
-
+
result.type = CqlResultType.VOID;
return result;
-
+
case CREATE_COLUMNFAMILY:
CreateColumnFamilyStatement createCf = (CreateColumnFamilyStatement)statement.statement;
clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
@@ -752,10 +752,10 @@ public class QueryProcessor
ex.initCause(e);
throw ex;
}
-
+
result.type = CqlResultType.VOID;
return result;
-
+
case CREATE_INDEX:
CreateIndexStatement createIdx = (CreateIndexStatement)statement.statement;
clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
@@ -775,7 +775,7 @@ public class QueryProcessor
{
if (cd.index_type != null)
throw new InvalidRequestException("Index already exists");
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled())
logger.debug("Updating column {} definition for index {}", oldCfm.comparator.getString(columnName), createIdx.getIndexName());
cd.setIndex_type(IndexType.KEYS);
cd.setIndex_name(createIdx.getIndexName());
@@ -798,7 +798,7 @@ public class QueryProcessor
ex.initCause(e);
throw ex;
}
-
+
result.type = CqlResultType.VOID;
return result;
@@ -832,7 +832,7 @@ public class QueryProcessor
ThriftValidation.validateKeyspaceNotSystem(deleteKeyspace);
clientState.hasKeyspaceSchemaAccess(Permission.WRITE);
validateSchemaAgreement();
-
+
try
{
applyMigrationOnStage(new DropKeyspace(deleteKeyspace));
@@ -843,15 +843,15 @@ public class QueryProcessor
ex.initCause(e);
throw ex;
}
-
+
result.type = CqlResultType.VOID;
return result;
-
+
case DROP_COLUMNFAMILY:
String deleteColumnFamily = (String)statement.statement;
clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
validateSchemaAgreement();
-
+
try
{
applyMigrationOnStage(new DropColumnFamily(keyspace, deleteColumnFamily));
@@ -862,7 +862,7 @@ public class QueryProcessor
ex.initCause(e);
throw ex;
}
-
+
result.type = CqlResultType.VOID;
return result;
@@ -913,21 +913,21 @@ public class QueryProcessor
return new CqlPreparedResult(statementId, statement.boundTerms);
}
-
+
public static CqlResult processPrepared(CQLStatement statement, ClientState clientState, List<ByteBuffer> variables)
throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException
{
- // Check to see if there are any bound variables to verify
+ // Check to see if there are any bound variables to verify
if (!(variables.isEmpty() && (statement.boundTerms == 0)))
{
- if (variables.size() != statement.boundTerms)
+ if (variables.size() != statement.boundTerms)
throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
statement.boundTerms,
variables.size()));
// at this point there is a match in count between markers and variables that is non-zero
- if (logger.isTraceEnabled())
+ if (logger.isTraceEnabled())
for (int i = 0; i < variables.size(); i++)
logger.trace("[{}] '{}'", i+1, variables.get(i));
}
@@ -970,15 +970,15 @@ public class QueryProcessor
CqlLexer lexer = new CqlLexer(stream);
TokenStream tokenStream = new CommonTokenStream(lexer);
CqlParser parser = new CqlParser(tokenStream);
-
+
// Parse the query string to a statement instance
CQLStatement statement = parser.query();
-
+
// The lexer and parser queue up any errors they may have encountered
// along the way, if necessary, we turn them into exceptions here.
lexer.throwLastRecognitionError();
parser.throwLastRecognitionError();
-
+
return statement;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/Relation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/Relation.java b/src/java/org/apache/cassandra/cql/Relation.java
index eb34080..cf93151 100644
--- a/src/java/org/apache/cassandra/cql/Relation.java
+++ b/src/java/org/apache/cassandra/cql/Relation.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -30,10 +30,10 @@ public class Relation
private Term entity;
private RelationType relationType;
private Term value;
-
+
/**
* Creates a new relation.
- *
+ *
* @param entity the kind of relation this is; what the term is being compared to.
* @param type the type that describes how this entity relates to the value.
* @param value the value being compared.
@@ -44,22 +44,22 @@ public class Relation
this.relationType = RelationType.forString(type);
this.value = value;
}
-
+
public RelationType operator()
{
return relationType;
}
-
+
public Term getEntity()
{
return entity;
}
-
+
public Term getValue()
{
return value;
}
-
+
@Override
public String toString()
{
@@ -70,7 +70,7 @@ public class Relation
enum RelationType
{
EQ, LT, LTE, GTE, GT;
-
+
public static RelationType forString(String s)
{
if (s.equals("="))
@@ -83,7 +83,7 @@ enum RelationType
return GTE;
else if (s.equals(">"))
return GT;
-
+
return null;
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/SelectExpression.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/SelectExpression.java b/src/java/org/apache/cassandra/cql/SelectExpression.java
index 6c223ef..67882ce 100644
--- a/src/java/org/apache/cassandra/cql/SelectExpression.java
+++ b/src/java/org/apache/cassandra/cql/SelectExpression.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -28,23 +28,23 @@ import java.util.List;
* determine which columns will appear in the result set. SelectExpression
* instances encapsulate a parsed expression from a <code>SELECT</code>
* statement.
- *
+ *
* See: doc/cql/CQL.html#SpecifyingColumns
*/
public class SelectExpression
{
public static final int MAX_COLUMNS_DEFAULT = 10000;
-
+
private int numColumns = MAX_COLUMNS_DEFAULT;
private boolean reverseColumns = false;
private boolean hasFirstSet;
private final boolean wildcard;
private Term start, finish;
private List<Term> columns;
-
+
/**
* Create a new SelectExpression for a range (slice) of columns.
- *
+ *
* @param start the starting column name
* @param finish the finishing column name
* @param count the number of columns to limit the results to
@@ -61,10 +61,10 @@ public class SelectExpression
this.wildcard = wildcard;
hasFirstSet = firstSet;
}
-
+
/**
* Create a new SelectExpression for a list of columns.
- *
+ *
* @param first the first (possibly only) column name to select on.
* @param count the number of columns to limit the results on
* @param reverse true to reverse column order
@@ -79,10 +79,10 @@ public class SelectExpression
reverseColumns = reverse;
hasFirstSet = firstSet;
}
-
+
/**
* Add an additional column name to a SelectExpression.
- *
+ *
* @param addTerm
*/
public void and(Term addTerm)
@@ -90,12 +90,12 @@ public class SelectExpression
assert !isColumnRange(); // Not possible when invoked by parser
columns.add(addTerm);
}
-
+
public boolean isColumnRange()
{
return (start != null);
}
-
+
public boolean isColumnList()
{
return !isColumnRange();
@@ -109,12 +109,12 @@ public class SelectExpression
{
return reverseColumns;
}
-
+
public void setColumnsReversed(boolean reversed)
{
reverseColumns = reversed;
}
-
+
public void setColumnsLimit(int limit)
{
numColumns = limit;
@@ -159,6 +159,6 @@ public class SelectExpression
finish,
columns);
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/SelectStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/SelectStatement.java b/src/java/org/apache/cassandra/cql/SelectStatement.java
index eb87e53..23595f7 100644
--- a/src/java/org/apache/cassandra/cql/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql/SelectStatement.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -43,7 +43,7 @@ public class SelectStatement
private final ConsistencyLevel cLevel;
private final WhereClause clause;
private final int numRecords;
-
+
public SelectStatement(SelectExpression expression, boolean isCountOper, String keyspace, String columnFamily,
ConsistencyLevel cLevel, WhereClause clause, int numRecords)
{
@@ -55,32 +55,32 @@ public class SelectStatement
this.clause = (clause != null) ? clause : new WhereClause();
this.numRecords = numRecords;
}
-
+
public boolean isKeyRange()
{
return clause.isKeyRange();
}
-
+
public Set<Term> getKeys()
{
return clause.getKeys();
}
-
+
public Term getKeyStart()
{
return clause.getStartKey();
}
-
+
public Term getKeyFinish()
{
return clause.getFinishKey();
}
-
+
public List<Relation> getColumnRelations()
{
return clause.getColumnRelations();
}
-
+
public boolean isColumnRange()
{
return expression.isColumnRange();
@@ -99,12 +99,12 @@ public class SelectStatement
{
return expression.getColumns();
}
-
+
public Term getColumnStart()
{
return expression.getStart();
}
-
+
public Term getColumnFinish()
{
return expression.getFinish();
@@ -124,12 +124,12 @@ public class SelectStatement
{
return columnFamily;
}
-
+
public boolean isColumnsReversed()
{
return expression.isColumnsReversed();
}
-
+
public ConsistencyLevel getConsistencyLevel()
{
return cLevel;
@@ -144,7 +144,7 @@ public class SelectStatement
{
return expression.getColumnsLimit();
}
-
+
public boolean isCountOperation()
{
return isCountOper;
@@ -179,7 +179,7 @@ public class SelectStatement
{
return Schema.instance.getComparator(keyspace, columnFamily);
}
-
+
public AbstractType<?> getValueValidator(String keyspace, ByteBuffer column)
{
return Schema.instance.getValueValidator(keyspace, columnFamily, column);
@@ -196,6 +196,6 @@ public class SelectStatement
clause,
numRecords);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/StatementType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/StatementType.java b/src/java/org/apache/cassandra/cql/StatementType.java
index 7988654..09729aa 100644
--- a/src/java/org/apache/cassandra/cql/StatementType.java
+++ b/src/java/org/apache/cassandra/cql/StatementType.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -26,7 +26,7 @@ public enum StatementType
{
SELECT, INSERT, UPDATE, BATCH, USE, TRUNCATE, DELETE, CREATE_KEYSPACE, CREATE_COLUMNFAMILY, CREATE_INDEX, DROP_INDEX,
DROP_KEYSPACE, DROP_COLUMNFAMILY, ALTER_TABLE;
-
+
// Statement types that don't require a keyspace to be set.
private static final EnumSet<StatementType> topLevel = EnumSet.of(USE, CREATE_KEYSPACE, DROP_KEYSPACE);
public static final EnumSet<StatementType> requiresKeyspace = EnumSet.complementOf(topLevel);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/Term.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/Term.java b/src/java/org/apache/cassandra/cql/Term.java
index aef4659..9223701 100644
--- a/src/java/org/apache/cassandra/cql/Term.java
+++ b/src/java/org/apache/cassandra/cql/Term.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -47,7 +47,7 @@ public class Term
/**
* Create new Term instance from a string, and an integer that corresponds
* with the token ID from CQLParser.
- *
+ *
* @param text the text representation of the term.
* @param type the term's type as an integer token ID.
*/
@@ -74,18 +74,18 @@ public class Term
/**
* Returns the text parsed to create this term.
- *
+ *
* @return the string term acquired from a CQL statement.
*/
public String getText()
{
return text;
}
-
+
/**
* Returns the typed value, serialized to a ByteBuffer according to a
* comparator/validator.
- *
+ *
* @return a ByteBuffer of the value.
* @throws InvalidRequestException if unable to coerce the string to its type.
*/
@@ -94,11 +94,11 @@ public class Term
try
{
if (!isBindMarker()) return validator.fromString(text);
-
+
// must be a marker term so check for a CqlBindValue stored in the term
if (bindIndex == null)
throw new AssertionError("a marker Term was encountered with no index value");
-
+
return variables.get(bindIndex);
}
catch (MarshalException e)
@@ -106,10 +106,10 @@ public class Term
throw new InvalidRequestException(e.getMessage());
}
}
-
+
/**
* Returns the typed value, serialized to a ByteBuffer.
- *
+ *
* @return a ByteBuffer of the value.
* @throws InvalidRequestException if unable to coerce the string to its type.
*/
@@ -119,35 +119,35 @@ public class Term
{
case STRING:
return AsciiType.instance.fromString(text);
- case INTEGER:
+ case INTEGER:
return IntegerType.instance.fromString(text);
case UUID:
// we specifically want the Lexical class here, not "UUIDType," because we're supposed to have
// a uuid-shaped string here, and UUIDType also accepts integer or date strings (and turns them into version 1 uuids).
return LexicalUUIDType.instance.fromString(text);
- case FLOAT:
+ case FLOAT:
return FloatType.instance.fromString(text);
}
-
+
// FIXME: handle scenario that should never happen
return null;
}
/**
* Obtain the term's type.
- *
+ *
* @return the type
*/
public TermType getType()
{
return type;
}
-
+
public String toString()
{
return String.format("Term(%s, type=%s)", getText(), type);
}
-
+
public boolean isBindMarker()
{
return type==TermType.QMARK;
@@ -173,7 +173,7 @@ public class Term
if (getClass() != obj.getClass())
return false;
Term other = (Term) obj;
- if (type==TermType.QMARK) return false; // markers are never equal
+ if (type==TermType.QMARK) return false; // markers are never equal
if (text == null)
{
if (other.text != null)
@@ -185,13 +185,13 @@ public class Term
return true;
}
-
+
}
enum TermType
{
STRING, INTEGER, UUID, FLOAT, QMARK;
-
+
static TermType forInt(int type)
{
if ((type == CqlParser.STRING_LITERAL) || (type == CqlParser.IDENT))
@@ -204,7 +204,7 @@ enum TermType
return FLOAT;
else if (type == CqlParser.QMARK)
return QMARK;
-
+
// FIXME: handled scenario that should never occur.
return null;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/UpdateStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/UpdateStatement.java b/src/java/org/apache/cassandra/cql/UpdateStatement.java
index 8f772a2..d6d410a 100644
--- a/src/java/org/apache/cassandra/cql/UpdateStatement.java
+++ b/src/java/org/apache/cassandra/cql/UpdateStatement.java
@@ -1,5 +1,5 @@
/*
- *
+ *
* 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
@@ -7,16 +7,16 @@
* 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.
- *
+ *
*/
package org.apache.cassandra.cql;
@@ -73,7 +73,7 @@ public class UpdateStatement extends AbstractModification
this.columns = columns;
this.keys = keys;
}
-
+
/**
* Creates a new UpdateStatement from a column family name, a consistency level,
* key, and lists of column names and values. It is intended for use with the
@@ -105,17 +105,17 @@ public class UpdateStatement extends AbstractModification
/**
* Returns the consistency level of this <code>UPDATE</code> statement, either
* one parsed from the CQL statement, or the default level otherwise.
- *
+ *
* @return the consistency level as a Thrift enum.
*/
public ConsistencyLevel getConsistencyLevel()
{
return (cLevel != null) ? cLevel : defaultConsistency;
}
-
+
/**
* True if an explicit consistency level was parsed from the statement.
- *
+ *
* @return true if a consistency was parsed, false otherwise.
*/
public boolean isSetConsistencyLevel()
@@ -244,29 +244,29 @@ public class UpdateStatement extends AbstractModification
{
return keys;
}
-
+
public Map<Term, Operation> getColumns() throws InvalidRequestException
{
// Created from an UPDATE
if (columns != null)
return columns;
-
+
// Created from an INSERT
-
+
// Don't hate, validate.
if (columnNames.size() != columnValues.size())
throw new InvalidRequestException("unmatched column names/values");
if (columnNames.size() < 1)
throw new InvalidRequestException("no columns specified for INSERT");
-
+
columns = new HashMap<Term, Operation>();
-
+
for (int i = 0; i < columnNames.size(); i++)
columns.put(columnNames.get(i), new Operation(columnValues.get(i)));
return columns;
}
-
+
public String toString()
{
return String.format("UpdateStatement(keyspace=%s, columnFamily=%s, keys=%s, columns=%s, consistency=%s, timestamp=%s, timeToLive=%s)",
@@ -278,17 +278,17 @@ public class UpdateStatement extends AbstractModification
timestamp,
timeToLive);
}
-
+
public AbstractType<?> getKeyType(String keyspace)
{
return Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();
}
-
+
public AbstractType<?> getComparator(String keyspace)
{
return Schema.instance.getComparator(keyspace, columnFamily);
}
-
+
public AbstractType<?> getValueValidator(String keyspace, ByteBuffer column)
{
return Schema.instance.getValueValidator(keyspace, columnFamily, column);
@@ -303,5 +303,5 @@ public class UpdateStatement extends AbstractModification
{
return columnValues;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/WhereClause.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java b/src/java/org/apache/cassandra/cql/WhereClause.java
index 0007c98..349641a 100644
--- a/src/java/org/apache/cassandra/cql/WhereClause.java
+++ b/src/java/org/apache/cassandra/cql/WhereClause.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql;
* 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 java.nio.ByteBuffer;
@@ -50,20 +50,20 @@ public class WhereClause
/**
* Create a new WhereClause with the first parsed relation.
- *
+ *
* @param firstRelation key or column relation
*/
public WhereClause(Relation firstRelation)
{
and(firstRelation);
}
-
+
public WhereClause()
{}
-
+
/**
* Add an additional relation to this WHERE clause.
- *
+ *
* @param relation the relation to add.
*/
public void and(Relation relation)
@@ -84,22 +84,22 @@ public class WhereClause
{
return columns;
}
-
+
public boolean isKeyRange()
{
return startKey != null;
}
-
+
public Term getStartKey()
{
return startKey;
}
-
+
public Term getFinishKey()
{
return finishKey;
}
-
+
public Set<Term> getKeys()
{
return keys;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java
index 3e86e53..aa596fd 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java
index 67567dd..cd3a82f 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -30,7 +30,7 @@ public abstract class AbstractJdbcUUID extends AbstractJdbcType<UUID>
{
return obj.toString();
}
-
+
public boolean isCaseSensitive()
{
return false;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
index f4c4f17..85b258f 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -32,9 +32,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcAscii extends AbstractJdbcType<String>
{
public static final JdbcAscii instance = new JdbcAscii();
-
+
JdbcAscii() {}
-
+
public boolean isCaseSensitive()
{
return true;
@@ -96,7 +96,7 @@ public class JdbcAscii extends AbstractJdbcType<String>
{
return getString(bytes);
}
-
+
public ByteBuffer decompose(String value)
{
return ByteBufferUtil.bytes(value, Charsets.US_ASCII);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java
index 99b5805..1760502 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcBoolean extends AbstractJdbcType<Boolean>
{
public static final JdbcBoolean instance = new JdbcBoolean();
-
+
JdbcBoolean() {}
-
+
public boolean isCaseSensitive()
{
return false;
@@ -78,7 +78,7 @@ public class JdbcBoolean extends AbstractJdbcType<Boolean>
throw new MarshalException("A boolean is stored in exactly 1 byte: "+bytes.remaining());
}
byte value = bytes.get(bytes.position());
-
+
return value ==0 ? Boolean.FALSE.toString(): Boolean.TRUE.toString();
}
@@ -97,7 +97,7 @@ public class JdbcBoolean extends AbstractJdbcType<Boolean>
byte value = bytes.get(bytes.position());
return Boolean.valueOf(value ==0 ? false:true);
}
-
+
public ByteBuffer decompose(Boolean value)
{
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java
index cbb6355..67e424e 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -30,7 +30,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcBytes extends AbstractJdbcType<ByteBuffer>
{
public static final JdbcBytes instance = new JdbcBytes();
-
+
JdbcBytes() {}
public boolean isCaseSensitive()
@@ -87,7 +87,7 @@ public class JdbcBytes extends AbstractJdbcType<ByteBuffer>
{
return bytes.duplicate();
}
-
+
public ByteBuffer decompose(ByteBuffer value)
{
return value;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java
index da40e16..2475294 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,22 +8,22 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
public class JdbcCounterColumn extends JdbcLong
{
public static final JdbcCounterColumn instance = new JdbcCounterColumn();
-
+
JdbcCounterColumn() {}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java
index c612c28..6d0e63f 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -50,11 +50,11 @@ public class JdbcDate extends AbstractJdbcType<Date>
return new SimpleDateFormat(DEFAULT_FORMAT);
}
};
-
+
public static final JdbcDate instance = new JdbcDate();
-
+
JdbcDate() {}
-
+
public boolean isCaseSensitive()
{
return false;
@@ -100,7 +100,7 @@ public class JdbcDate extends AbstractJdbcType<Date>
{
throw new MarshalException("A date is exactly 8 bytes (stored as a long): " + bytes.remaining());
}
-
+
// uses ISO-8601 formatted string
return FORMATTER.get().format(new Date(bytes.getLong(bytes.position())));
}
@@ -119,7 +119,7 @@ public class JdbcDate extends AbstractJdbcType<Date>
{
return new Date(ByteBufferUtil.toLong(bytes));
}
-
+
public ByteBuffer decompose(Date value)
{
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java
index 3792795..5852b1a 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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 java.math.BigDecimal;
@@ -30,7 +30,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcDecimal extends AbstractJdbcType<BigDecimal>
{
public static final JdbcDecimal instance = new JdbcDecimal();
-
+
JdbcDecimal() {}
public boolean isCaseSensitive()
@@ -88,7 +88,7 @@ public class JdbcDecimal extends AbstractJdbcType<BigDecimal>
public BigDecimal compose(ByteBuffer bytes)
{
if (bytes == null) return null;
-
+
// do not consume the contents of the ByteBuffer
bytes = bytes.duplicate();
int scale = bytes.getInt();
@@ -106,16 +106,16 @@ public class JdbcDecimal extends AbstractJdbcType<BigDecimal>
public ByteBuffer decompose(BigDecimal value)
{
if (value == null) return ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
+
BigInteger bi = value.unscaledValue();
Integer scale = value.scale();
byte[] bibytes = bi.toByteArray();
byte[] sbytes = ByteBufferUtil.bytes(scale).array();
byte[] bytes = new byte[bi.toByteArray().length+4];
-
+
for (int i = 0 ; i < 4 ; i++) bytes[i] = sbytes[i];
for (int i = 4 ; i < bibytes.length+4 ; i++) bytes[i] = bibytes[i-4];
-
+
return ByteBuffer.wrap(bytes);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java
index 6036608..e19c349 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcDouble extends AbstractJdbcType<Double>
{
public static final JdbcDouble instance = new JdbcDouble();
-
+
JdbcDouble() {}
-
+
public boolean isCaseSensitive()
{
return false;
@@ -77,7 +77,7 @@ public class JdbcDouble extends AbstractJdbcType<Double>
{
throw new MarshalException("A double is exactly 8 bytes : "+bytes.remaining());
}
-
+
return ((Double)ByteBufferUtil.toDouble(bytes)).toString();
}
@@ -95,7 +95,7 @@ public class JdbcDouble extends AbstractJdbcType<Double>
{
return ByteBufferUtil.toDouble(bytes);
}
-
+
public ByteBuffer decompose(Double value)
{
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java
index 82d755b..c9cc7ee 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/
@@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcFloat extends AbstractJdbcType<Float>
{
public static final JdbcFloat instance = new JdbcFloat();
-
+
JdbcFloat() {}
-
+
public boolean isCaseSensitive()
{
return false;
@@ -77,7 +77,7 @@ public class JdbcFloat extends AbstractJdbcType<Float>
{
throw new MarshalException("A float is exactly 4 bytes : "+bytes.remaining());
}
-
+
return ((Float)ByteBufferUtil.toFloat(bytes)).toString();
}
@@ -95,7 +95,7 @@ public class JdbcFloat extends AbstractJdbcType<Float>
{
return ByteBufferUtil.toFloat(bytes);
}
-
+
public ByteBuffer decompose(Float value)
{
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java
index 5a05a80..908af05 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java
@@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc;
* 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.
- *
+ *
*/