[3649] Strip end of line whitespaces

This commit is contained in:
Sylvain Lebresne 2012-02-27 11:21:34 +01:00
parent 185e0250ab
commit 07cdfd07a3
409 changed files with 2680 additions and 2680 deletions

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.auth;
/*
*
*
* 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.auth;
* 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.util.Map;
@ -38,7 +38,7 @@ public class AllowAllAuthenticator implements IAuthenticator
{
return USER;
}
public void validateConfiguration() throws ConfigurationException
{
// pass

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.auth;
/*
*
*
* 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.auth;
* 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.util.EnumSet;

View File

@ -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.auth;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.auth;
/*
*
*
* 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.auth;
* 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.util.Map;

View File

@ -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.auth;
@ -29,7 +29,7 @@ import org.apache.cassandra.config.ConfigurationException;
/**
* Cassandra's resource hierarchy looks something like:
* {{/cassandra/keyspaces/$ks_name/...}}
*
*
* In table form:
* /cassandra/
* - no checked permissions
@ -44,11 +44,11 @@ import org.apache.cassandra.config.ConfigurationException;
* - String
* * An individual keyspace: READ/WRITE permissions apply to the entire namespace and control the ability to both
* view and manipulate column families, and to read and write the data contained within.
*
*
* Over time Cassandra _may_ add additional authorize calls for resources higher or lower in the hierarchy and
* IAuthority implementations should be able to handle these calls (although many will choose to ignore them
* completely).
*
*
* NB: {{/cassandra/}} will not be checked for permissions via a call to IAuthority.authorize, so IAuthority
* implementations can only deny access when a user attempts to access an ancestor resource.
*/
@ -57,7 +57,7 @@ public interface IAuthority
/**
* @param user An authenticated user from a previous call to IAuthenticator.authenticate.
* @param resource A List of Objects containing Strings and byte[]s: represents a resource in the hierarchy
* described in the Javadocs.
* described in the Javadocs.
* @return An AccessLevel representing the permissions for the user and resource: should never return null.
*/
public EnumSet<Permission> authorize(AuthenticatedUser user, List<Object> resource);

View File

@ -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.auth;

View File

@ -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.auth;

View File

@ -52,7 +52,7 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
protected volatile ScheduledFuture<?> saveTask;
protected final CacheService.CacheType cacheType;
public AutoSavingCache(ICache<K, V> cache, CacheService.CacheType cacheType)
{
super(cache);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.util.Set;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.db.ColumnFamily;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.util.concurrent.atomic.AtomicInteger;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.
*
*
*/

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.db.ColumnFamily;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.util.Set;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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,7 +45,7 @@ public class SerializingCache<K, V> implements ICache<K, V>
{
private static final Logger logger = LoggerFactory.getLogger(SerializingCache.class);
private static final int DEFAULT_CONCURENCY_LEVEL = 64;
private final ConcurrentLinkedHashMap<K, FreeableMemory> map;
private final ISerializer<V> serializer;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache;
/*
*
*
* 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.cache;
* 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.db.ColumnFamily;

View File

@ -187,7 +187,7 @@ public class CliClient
sessionState.out.println(getHelp().banner);
}
// Execute a CLI Statement
// Execute a CLI Statement
public void executeCLIStatement(String statement) throws CharacterCodingException, TException, TimedOutException, NotFoundException, NoSuchFieldException, InvalidRequestException, UnavailableException, InstantiationException, IllegalAccessException, ClassNotFoundException, SchemaDisagreementException
{
Tree tree = CliCompiler.compileQuery(statement);
@ -301,14 +301,14 @@ public class CliClient
CliMain.disconnect();
System.exit(0);
}
public KsDef getKSMetaData(String keyspace)
throws NotFoundException, InvalidRequestException, TException
{
// Lazily lookup keyspace meta-data.
if (!(keyspacesMap.containsKey(keyspace)))
keyspacesMap.put(keyspace, thriftClient.describe_keyspace(keyspace));
return keyspacesMap.get(keyspace);
}
@ -342,9 +342,9 @@ public class CliClient
String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec, keyspacesMap.get(keySpace).cf_defs);
int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
ColumnParent colParent = new ColumnParent(columnFamily).setSuper_column((ByteBuffer) null);
if (columnSpecCnt != 0)
{
Tree columnTree = columnFamilySpec.getChild(2);
@ -362,8 +362,8 @@ public class CliClient
int count = thriftClient.get_count(getKeyAsBytes(columnFamily, columnFamilySpec.getChild(1)), colParent, predicate, consistencyLevel);
sessionState.out.printf("%d columns%n", count);
}
private void executeDelete(Tree statement)
private void executeDelete(Tree statement)
throws TException, InvalidRequestException, UnavailableException, TimedOutException
{
if (!CliMain.isConnected() || !hasKeySpace())
@ -380,7 +380,7 @@ public class CliClient
byte[] superColumnName = null;
byte[] columnName = null;
boolean isSuper = cfDef.column_type.equals("Super");
if ((columnSpecCnt < 0) || (columnSpecCnt > 2))
{
sessionState.out.println("Invalid row, super column, or column specification.");
@ -445,7 +445,7 @@ public class CliClient
private void doSlice(String keyspace, ByteBuffer key, String columnFamily, byte[] superColumnName, int limit)
throws InvalidRequestException, UnavailableException, TimedOutException, TException, IllegalAccessException, NotFoundException, InstantiationException, NoSuchFieldException
{
long startTime = System.currentTimeMillis();
ColumnParent parent = new ColumnParent(columnFamily);
if(superColumnName != null)
@ -475,7 +475,7 @@ public class CliClient
validator.getString(col.value), col.timestamp,
col.isSetTtl() ? String.format(", ttl=%d", col.getTtl()) : "");
}
sessionState.out.println(")");
}
else if (cosc.isSetColumn())
@ -514,7 +514,7 @@ public class CliClient
sessionState.out.printf("=> (counter=%s, value=%s)%n", formattedName, column.value);
}
}
sessionState.out.println("Returned " + columns.size() + " results.");
elapsedTime(startTime);
}
@ -557,7 +557,7 @@ public class CliClient
int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
CfDef cfDef = getCfDef(columnFamily);
boolean isSuper = cfDef.column_type.equals("Super");
byte[] superColumnName = null;
ByteBuffer columnName;
@ -647,7 +647,7 @@ public class CliClient
return;
}
byte[] columnValue = column.getValue();
byte[] columnValue = column.getValue();
String valueAsString;
// we have ^(CONVERT_TO_TYPE <type>) inside of GET statement
@ -725,7 +725,7 @@ public class CliClient
String columnFamily = CliCompiler.getColumnFamily(statement, keyspacesMap.get(keySpace).cf_defs);
// ^(CONDITIONS ^(CONDITION $column $value) ...)
Tree conditions = statement.getChild(1);
// fetching column family definition
CfDef columnFamilyDef = getCfDef(columnFamily);
@ -785,8 +785,8 @@ public class CliClient
{
throw new IllegalArgumentException("LIMIT should be greater than zero.");
}
clause.setCount(limitValue);
clause.setCount(limitValue);
}
try
@ -812,7 +812,7 @@ public class CliClient
{
if (!CliMain.isConnected() || !hasKeySpace())
return;
long startTime = System.currentTimeMillis();
// ^(NODE_COLUMN_ACCESS <cf> <key> <column>)
Tree columnFamilySpec = statement.getChild(0);
@ -869,7 +869,7 @@ public class CliClient
parent.setSuper_column(superColumnName);
Column columnToInsert = new Column(columnName).setValue(columnValueInBytes).setTimestamp(FBUtilities.timestampMicros());
// children count = 3 mean that we have ttl in arguments
if (statement.getChildCount() == 3)
{
@ -908,7 +908,7 @@ public class CliClient
String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec, keyspacesMap.get(keySpace).cf_defs);
ByteBuffer key = getKeyAsBytes(columnFamily, columnFamilySpec.getChild(1));
int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
byte[] superColumnName = null;
ByteBuffer columnName;
@ -967,7 +967,7 @@ public class CliClient
{
if (!CliMain.isConnected())
return;
sessionState.out.println(thriftClient.describe_cluster_name());
}
@ -980,7 +980,7 @@ public class CliClient
if (!CliMain.isConnected())
return;
// first value is the keyspace name, after that it is all key=value
String keyspaceName = statement.getChild(0).getText();
KsDef ksDef = new KsDef(keyspaceName, DEFAULT_PLACEMENT_STRATEGY, new LinkedList<CfDef>());
@ -1108,9 +1108,9 @@ public class CliClient
{
KsDef ksDef = new KsDef(ksDefToUpdate);
// removing all column definitions - thrift system_update_keyspace method requires that
// removing all column definitions - thrift system_update_keyspace method requires that
ksDef.setCf_defs(new LinkedList<CfDef>());
for(int i = 1; i < statement.getChildCount(); i += 2)
{
String currentStatement = statement.getChild(i).getText().toUpperCase();
@ -1119,7 +1119,7 @@ public class CliClient
switch(mArgument)
{
case PLACEMENT_STRATEGY:
case PLACEMENT_STRATEGY:
ksDef.setStrategy_class(CliUtils.unescapeSQLString(mValue));
break;
case STRATEGY_OPTIONS:
@ -1152,7 +1152,7 @@ public class CliClient
return ksDef;
}
/**
* Update column family definition attributes
* @param statement - ANTLR tree representing current statement
@ -1258,7 +1258,7 @@ public class CliClient
* @throws TException - exception
* @throws InvalidRequestException - exception
* @throws NotFoundException - exception
* @throws SchemaDisagreementException
* @throws SchemaDisagreementException
*/
private void executeDelKeySpace(Tree statement)
throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException
@ -1270,7 +1270,7 @@ public class CliClient
String version = thriftClient.system_drop_keyspace(keyspaceName);
sessionState.out.println(version);
validateSchemaIsSettled(version);
if (keyspaceName.equals(keySpace)) //we just deleted the keyspace we were authenticated too
keySpace = null;
}
@ -1281,9 +1281,9 @@ public class CliClient
* @throws TException - exception
* @throws InvalidRequestException - exception
* @throws NotFoundException - exception
* @throws SchemaDisagreementException
* @throws SchemaDisagreementException
*/
private void executeDelColumnFamily(Tree statement)
private void executeDelColumnFamily(Tree statement)
throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException
{
if (!CliMain.isConnected() || !hasKeySpace())
@ -1414,7 +1414,7 @@ public class CliClient
if (!CliMain.isConnected() || !hasKeySpace())
return;
// getting CfDef, it will fail if there is no such column family in current keySpace.
// getting CfDef, it will fail if there is no such column family in current keySpace.
CfDef cfDef = getCfDef(CliCompiler.getColumnFamily(columnFamily, keyspacesMap.get(keySpace).cf_defs));
thriftClient.truncate(cfDef.getName());
@ -1513,7 +1513,7 @@ public class CliClient
{
if (!CliMain.isConnected())
return;
sessionState.out.println(thriftClient.describe_version());
}
@ -1790,34 +1790,34 @@ public class CliClient
* Returns true if this.keySpace is set, false otherwise
* @return boolean
*/
private boolean hasKeySpace()
private boolean hasKeySpace()
{
if (keySpace == null)
{
sessionState.out.println("Not authenticated to a working keyspace.");
return false;
}
return true;
}
public String getKeySpace()
public String getKeySpace()
{
return keySpace == null ? "unknown" : keySpace;
}
public void setKeySpace(String keySpace) throws NotFoundException, InvalidRequestException, TException
public void setKeySpace(String keySpace) throws NotFoundException, InvalidRequestException, TException
{
this.keySpace = keySpace;
// We do nothing with the return value, but it hits a cache and the tab-completer.
getKSMetaData(keySpace);
}
public String getUsername()
public String getUsername()
{
return username == null ? "default" : username;
}
public void setUsername(String username)
{
this.username = username;
@ -1840,14 +1840,14 @@ public class CliClient
username = statement.getChild(1).getText();
password = statement.getChild(2).getText();
}
if (keySpaceName == null)
{
sessionState.out.println("Keyspace argument required");
return;
}
try
try
{
AuthenticationRequest authRequest;
Map<String, String> credentials = new HashMap<String, String>();
@ -1856,7 +1856,7 @@ public class CliClient
thriftClient.set_keyspace(keySpaceName);
if (username != null && password != null)
if (username != null && password != null)
{
/* remove quotes */
password = password.replace("\'", "");
@ -1865,19 +1865,19 @@ public class CliClient
authRequest = new AuthenticationRequest(credentials);
thriftClient.login(authRequest);
}
keySpace = keySpaceName;
this.username = username != null ? username : "default";
CliMain.updateCompletor(CliUtils.getCfNamesByKeySpace(getKSMetaData(keySpace)));
sessionState.out.println("Authenticated to keyspace: " + keySpace);
}
catch (AuthenticationException e)
}
catch (AuthenticationException e)
{
sessionState.err.println("Exception during authentication to the cassandra node: " +
"verify keyspace exists, and you are using correct credentials.");
}
catch (AuthorizationException e)
}
catch (AuthorizationException e)
{
sessionState.err.println("You are not authorized to use keyspace: " + keySpaceName);
}
@ -1888,8 +1888,8 @@ public class CliClient
catch (NotFoundException e)
{
sessionState.err.println(keySpaceName + " does not exist.");
}
catch (TException e)
}
catch (TException e)
{
if (sessionState.debug)
e.printStackTrace(sessionState.err);
@ -2145,12 +2145,12 @@ public class CliClient
int portNumber = Integer.parseInt(statement.getChild(1).getText());
StringBuilder hostName = new StringBuilder();
int idCount = idList.getChildCount();
int idCount = idList.getChildCount();
for (int idx = 0; idx < idCount; idx++)
{
hostName.append(idList.getChild(idx).getText());
}
// disconnect current connection, if any.
// This is a no-op, if you aren't currently connected.
CliMain.disconnect();
@ -2172,13 +2172,13 @@ public class CliClient
/**
* To get Column Family Definition object from specified keyspace
* @param keySpaceName key space name to search for specific column family
* @param columnFamilyName column family name
* @param columnFamilyName column family name
* @return CfDef - Column family definition object
*/
private CfDef getCfDef(String keySpaceName, String columnFamilyName)
{
KsDef keySpaceDefinition = keyspacesMap.get(keySpaceName);
for (CfDef columnFamilyDef : keySpaceDefinition.cf_defs)
{
if (columnFamilyDef.name.equals(columnFamilyName))
@ -2213,24 +2213,24 @@ public class CliClient
/**
* Used to parse meta tree and compile meta attributes into List<ColumnDef>
* @param cfDef - column family definition
* @param cfDef - column family definition
* @param meta (Tree representing Array of the hashes with metadata attributes)
* @return List<ColumnDef> List of the ColumnDef's
*
*
* meta is in following format - ^(ARRAY ^(HASH ^(PAIR .. ..) ^(PAIR .. ..)) ^(HASH ...))
*/
private List<ColumnDef> getCFColumnMetaFromTree(CfDef cfDef, Tree meta)
{
// this list will be returned
List<ColumnDef> columnDefinitions = new ArrayList<ColumnDef>();
// each child node is a ^(HASH ...)
for (int i = 0; i < meta.getChildCount(); i++)
{
Tree metaHash = meta.getChild(i);
ColumnDef columnDefinition = new ColumnDef();
// each child node is ^(PAIR $key $value)
for (int j = 0; j < metaHash.getChildCount(); j++)
{
@ -2262,11 +2262,11 @@ public class CliClient
}
else if (metaKey.equals("index_name"))
{
columnDefinition.setIndex_name(metaVal);
columnDefinition.setIndex_name(metaVal);
}
}
// validating columnDef structure, 'name' and 'validation_class' must be set
// validating columnDef structure, 'name' and 'validation_class' must be set
try
{
columnDefinition.validate();
@ -2284,7 +2284,7 @@ public class CliClient
/**
* Getting IndexType object from indexType string
* @param indexTypeAsString - string return by parser corresponding to IndexType
* @param indexTypeAsString - string return by parser corresponding to IndexType
* @return IndexType - an IndexType object
*/
private IndexType getIndexTypeFromString(String indexTypeAsString)
@ -2336,14 +2336,14 @@ public class CliClient
throw new RuntimeException(e);
}
}
/**
* Converts column name into byte[] according to comparator type
* @param column - column name from parser
* @param columnFamily - column family name from parser
* @return ByteBuffer - bytes into which column name was converted according to comparator type
*/
private ByteBuffer columnNameAsBytes(String column, String columnFamily)
private ByteBuffer columnNameAsBytes(String column, String columnFamily)
{
CfDef columnFamilyDef = getCfDef(columnFamily);
return columnNameAsBytes(column, columnFamilyDef);
@ -2354,7 +2354,7 @@ public class CliClient
* @param columnFamilyDef - column family from parser
* @return ByteBuffer bytes - into which column name was converted according to comparator type
*/
private ByteBuffer columnNameAsBytes(String column, CfDef columnFamilyDef)
private ByteBuffer columnNameAsBytes(String column, CfDef columnFamilyDef)
{
String comparatorClass = columnFamilyDef.comparator_type;
return getBytesAccordingToType(column, getFormatType(comparatorClass));
@ -2400,7 +2400,7 @@ public class CliClient
* @param columnFamilyDef - column family from parser
* @return ByteBuffer bytes - into which column name was converted according to comparator type
*/
private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef)
private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef)
{
String comparatorClass = columnFamilyDef.subcomparator_type;
@ -2466,7 +2466,7 @@ public class CliClient
private AbstractType<?> getValidatorForValue(CfDef ColumnFamilyDef, byte[] columnNameInBytes)
{
String defaultValidator = ColumnFamilyDef.default_validation_class;
for (ColumnDef columnDefinition : ColumnFamilyDef.getColumn_metadata())
{
byte[] nameInBytes = columnDefinition.getName();
@ -2477,7 +2477,7 @@ public class CliClient
}
}
if (defaultValidator != null && !defaultValidator.isEmpty())
if (defaultValidator != null && !defaultValidator.isEmpty())
{
return getFormatType(defaultValidator);
}
@ -2516,7 +2516,7 @@ public class CliClient
// current $value
String val = CliUtils.unescapeSQLString(optionPair.getChild(1).getText());
strategyOptions.put(key, val);
strategyOptions.put(key, val);
}
return strategyOptions;
@ -2526,15 +2526,15 @@ public class CliClient
* Used to convert value (function argument, string) into byte[]
* calls convertValueByFunction method with "withUpdate" set to false
* @param functionCall - tree representing function call ^(FUNCTION_CALL function_name value)
* @param columnFamily - column family definition (CfDef)
* @param columnFamily - column family definition (CfDef)
* @param columnName - also updates column family metadata for given column
* @return byte[] - string value as byte[]
* @return byte[] - string value as byte[]
*/
private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName)
{
return convertValueByFunction(functionCall, columnFamily, columnName, false);
}
/**
* Used to convert value (function argument, string) into byte[]
* @param functionCall - tree representing function call ^(FUNCTION_CALL function_name value)

View File

@ -36,7 +36,7 @@ public class CliCompiler
// of the ANTLRStringStream class. Note: This doesn't change the
// token text-- but just relaxes the matching rules to match
// in upper case. [Logic borrowed from Hive code.]
//
//
// Also see discussion on this topic in:
// http://www.antlr.org/wiki/pages/viewpage.action?pageId=1782.
public static class ANTLRNoCaseStringStream extends ANTLRStringStream
@ -45,15 +45,15 @@ public class CliCompiler
{
super(input);
}
public int LA(int i)
{
int returnChar = super.LA(i);
if (returnChar == CharStream.EOF)
{
return returnChar;
return returnChar;
}
else if (returnChar == 0)
else if (returnChar == 0)
{
return returnChar;
}
@ -65,7 +65,7 @@ public class CliCompiler
public static Tree compileQuery(String query)
{
Tree queryTree;
try
{
ANTLRStringStream input = new ANTLRNoCaseStringStream(query);
@ -87,7 +87,7 @@ public class CliCompiler
// if there was an exception we don't want to process request any further
throw new RuntimeException(e.getMessage(), e);
}
return queryTree;
}
/*
@ -167,7 +167,7 @@ public class CliCompiler
public static String getColumn(Tree astNode, int pos)
{
// Skip over table, column family and rowKey
return CliUtils.unescapeSQLString(astNode.getChild(pos + 2).getText());
return CliUtils.unescapeSQLString(astNode.getChild(pos + 2).getText());
}
}

View File

@ -38,7 +38,7 @@ public class CliCompleter extends SimpleCompletor
"rename keyspace",
"rename column family",
"consistencylevel",
"help connect",
"help describe keyspace",
"help exit",
@ -77,7 +77,7 @@ public class CliCompleter extends SimpleCompletor
{
super(commands);
}
String[] getKeyspaceCommands()
{
return keyspaceCommands;

View File

@ -66,7 +66,7 @@ public class CliMain
{
transport = new TFramedTransport(socket);
}
else
else
{
transport = socket;
}
@ -88,7 +88,7 @@ public class CliMain
thriftClient = cassandraClient;
cliClient = new CliClient(sessionState, thriftClient);
if ((sessionState.username != null) && (sessionState.password != null))
{
// Authenticate
@ -121,7 +121,7 @@ public class CliMain
return;
}
}
if (sessionState.keyspace != null)
{
try
@ -192,7 +192,7 @@ public class CliMain
}
return true;
}
public static void updateCompletor(Set<String> candidates)
{
Set<String> actions = new HashSet<String>();
@ -201,9 +201,9 @@ public class CliMain
for (String cmd : completer.getKeyspaceCommands())
actions.add(String.format("%s %s", cmd, cf));
}
String[] strs = Arrays.copyOf(actions.toArray(), actions.toArray().length, String[].class);
completer.setCandidateStrings(strs);
}
@ -252,14 +252,14 @@ public class CliMain
{
try
{
connect(sessionState.hostName, sessionState.thriftPort);
connect(sessionState.hostName, sessionState.thriftPort);
}
catch (RuntimeException e)
{
sessionState.err.println(e.getMessage());
}
}
if ( cliClient == null )
{
// Connection parameter was either invalid or not present.
@ -287,12 +287,12 @@ public class CliMain
}
ConsoleReader reader = new ConsoleReader();
if (!sessionState.batch)
{
reader.addCompletor(completer);
reader.setBellEnabled(false);
String historyFile = System.getProperty("user.home") + File.separator + HISTORYFILE;
try

View File

@ -31,7 +31,7 @@ public class CliSessionState
public String hostName; // cassandra server name
public int thriftPort; // cassandra server's thrift port
public boolean framed = true; // cassandra server's framed transport
public boolean framed = true; // cassandra server's framed transport
public boolean debug = false; // print stack traces when errors occur in the CLI
public String username; // cassandra login name (if SimpleAuthenticator is used)
public String password; // cassandra login password (if SimpleAuthenticator is used)
@ -57,7 +57,7 @@ public class CliSessionState
public void setOut(PrintStream newOut)
{
this.out = newOut;
this.out = newOut;
}
public void setErr(PrintStream newErr)

View File

@ -9,7 +9,7 @@ import org.apache.cassandra.thrift.IndexOperator;
import org.apache.cassandra.thrift.KsDef;
import org.apache.commons.lang.StringEscapeUtils;
/*
*
*
* 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
@ -17,16 +17,16 @@ import org.apache.commons.lang.StringEscapeUtils;
* 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.
*
*
*/

View File

@ -62,12 +62,12 @@ public class RingCache
public void refreshEndpointMap()
{
try {
Cassandra.Client client = ConfigHelper.getClientFromOutputAddressList(conf);
List<TokenRange> ring = client.describe_ring(ConfigHelper.getOutputKeyspace(conf));
rangeMap = ArrayListMultimap.create();
for (TokenRange range : ring)
{
Token<?> left = partitioner.getTokenFactory().fromString(range.start_token);

View File

@ -32,27 +32,27 @@ import java.util.concurrent.TimeoutException;
*
* @param <V>
*/
public class CreationTimeAwareFuture<V> implements Future<V>
public class CreationTimeAwareFuture<V> implements Future<V>
{
private long creationTime = System.currentTimeMillis();
private Future<V> future;
public CreationTimeAwareFuture(Future<V> future)
public CreationTimeAwareFuture(Future<V> future)
{
this.future = future;
creationTime = System.currentTimeMillis();
}
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
{
timeout = unit.toMillis(timeout);
long overallTimeout = timeout - (System.currentTimeMillis() - creationTime);
return future.get(overallTimeout, TimeUnit.MILLISECONDS);
}
public boolean cancel(boolean mayInterruptIfRunning)
public boolean cancel(boolean mayInterruptIfRunning)
{
return future.cancel(mayInterruptIfRunning);
}

View File

@ -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.
*
*
*/

View File

@ -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.
*
*
*/

View File

@ -21,17 +21,17 @@ package org.apache.cassandra.concurrent;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
public class JMXConfigurableThreadPoolExecutor extends JMXEnabledThreadPoolExecutor implements JMXConfigurableThreadPoolExecutorMBean
public class JMXConfigurableThreadPoolExecutor extends JMXEnabledThreadPoolExecutor implements JMXConfigurableThreadPoolExecutorMBean
{
public JMXConfigurableThreadPoolExecutor(int corePoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
BlockingQueue<Runnable> workQueue,
NamedThreadFactory threadFactory,
String jmxPath)
{
super(corePoolSize, keepAliveTime, unit, workQueue, threadFactory, jmxPath);
}
}

View File

@ -29,7 +29,7 @@ import javax.management.ObjectName;
/**
* This is a wrapper class for the <i>ScheduledThreadPoolExecutor</i>. It provides an implementation
* for the <i>afterExecute()</i> found in the <i>ThreadPoolExecutor</i> class to log any unexpected
* for the <i>afterExecute()</i> found in the <i>ThreadPoolExecutor</i> class to log any unexpected
* Runtime Exceptions.
*/
@ -64,7 +64,7 @@ public class JMXEnabledThreadPoolExecutor extends DebuggableThreadPoolExecutor i
{
this(corePoolSize, corePoolSize, keepAliveTime, unit, workQueue, threadFactory, jmxPath);
}
public JMXEnabledThreadPoolExecutor(int corePoolSize,
int maxPoolSize,
long keepAliveTime,

View File

@ -22,8 +22,8 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
* This class is an implementation of the <i>ThreadFactory</i> interface. This
* is useful to give Java threads meaningful names which is useful when using
* This class is an implementation of the <i>ThreadFactory</i> interface. This
* is useful to give Java threads meaningful names which is useful when using
* a tool like JConsole.
*/
@ -46,7 +46,7 @@ public class NamedThreadFactory implements ThreadFactory
}
public Thread newThread(Runnable runnable)
{
{
String name = id + ":" + n.getAndIncrement();
Thread thread = new Thread(runnable, name);
thread.setPriority(priority);

View File

@ -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.
*
*
*/

View File

@ -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.
*/

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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

View File

@ -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;

View File

@ -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.
*
*
*/
/**

View File

@ -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");

View File

@ -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;

View File

@ -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);

View File

@ -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()
{

View File

@ -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")))

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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.
*
*
*/

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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() {}
}

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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.
*
*
*/

View File

@ -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,9 +30,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcInteger extends AbstractJdbcType<BigInteger>
{
public static final JdbcInteger instance = new JdbcInteger();
JdbcInteger() {}
public boolean isCaseSensitive()
{
return false;

View File

@ -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.UUIDGen;
public class JdbcLexicalUUID extends AbstractJdbcUUID
{
public static final JdbcLexicalUUID instance = new JdbcLexicalUUID();
public JdbcLexicalUUID() {}
public String getString(ByteBuffer bytes)
{
if (bytes.remaining() == 0)

View File

@ -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.
*
*
*/

View File

@ -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.UUIDGen;
public class JdbcTimeUUID extends AbstractJdbcUUID
{
public static final JdbcTimeUUID instance = new JdbcTimeUUID();
JdbcTimeUUID() {}
public String getString(ByteBuffer bytes)
{
if (bytes.remaining() == 0)

View File

@ -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 com.google.common.base.Charsets;
public class JdbcUTF8 extends AbstractJdbcType<String>
{
public static final JdbcUTF8 instance = new JdbcUTF8();
public JdbcUTF8() {}
public boolean isCaseSensitive()
{
return true;

View File

@ -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.UUIDGen;
public class JdbcUUID extends AbstractJdbcUUID
{
public static final JdbcUUID instance = new JdbcUUID();
JdbcUUID() {}
public UUID compose(ByteBuffer bytes)
{
bytes = bytes.slice();
@ -50,7 +50,7 @@ public class JdbcUUID extends AbstractJdbcUUID
{
throw new MarshalException("UUIDs must be exactly 16 bytes");
}
return compose(bytes).toString();
}

View File

@ -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.
*
*
*/

View File

@ -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.
*
*
*/
@ -27,7 +27,7 @@ import java.util.Map;
public class TypesMap
{
private final static Map<String, AbstractJdbcType<?>> map = new HashMap<String, AbstractJdbcType<?>>();
static
{
map.put("org.apache.cassandra.db.marshal.AsciiType", JdbcAscii.instance);
@ -46,7 +46,7 @@ public class TypesMap
map.put("org.apache.cassandra.db.marshal.UTF8Type", JdbcUTF8.instance);
map.put("org.apache.cassandra.db.marshal.UUIDType", JdbcUUID.instance);
}
public static AbstractJdbcType<?> getTypeForComparator(String comparator)
{
// If not fully qualified, assume it's the short name for a built-in.

View File

@ -71,7 +71,7 @@ public class CreateColumnFamilyStatement extends SchemaAlteringStatement
for (Map.Entry<ColumnIdentifier, String> col : columns.entrySet())
{
AbstractType<?> validator = CFPropDefs.parseType(col.getValue());
columnDefs.put(col.getKey().key, new ColumnDefinition(col.getKey().key, validator, null, null, null));
}

View File

@ -151,7 +151,7 @@ public class CollationController
};
ColumnFamily returnCF = container.cloneMeShallow();
filter.collateColumns(returnCF, Collections.singletonList(toCollate), gcBefore);
// "hoist up" the requested data into a more recent sstable
if (sstablesIterated > cfs.getMinimumCompactionThreshold()
&& !cfs.isCompactionDisabled()

View File

@ -243,7 +243,7 @@ public class Column implements IColumn
{
return localCopy(cfs, HeapAllocator.instance);
}
public IColumn localCopy(ColumnFamilyStore cfs, Allocator allocator)
{
return new Column(cfs.internOrCopy(name, allocator), allocator.clone(value), timestamp);

View File

@ -83,7 +83,7 @@ public class ColumnFamily extends AbstractColumnContainer
assert cfm != null;
this.cfm = cfm;
}
public ColumnFamily cloneMeShallow(ISortedColumns.Factory factory, boolean reversedInsertOrder)
{
ColumnFamily cf = ColumnFamily.create(cfm, factory, reversedInsertOrder);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db;
/*
*
*
* 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.db;
* 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.
*
*
*/

View File

@ -177,12 +177,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
metadata.compactionStrategyClass = CFMetaData.createCompactionStrategy(compactionStrategyClass);
maybeReloadCompactionStrategy();
}
public String getCompactionStrategyClass()
{
return metadata.compactionStrategyClass.getName();
}
public Map<String,String> getCompressionParameters()
{
return metadata.compressionParameters().asThriftOptions();
@ -248,7 +248,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
{
valid = false;
unregisterMBean();
data.unreferenceSSTables();
indexManager.invalidate();
}
@ -411,7 +411,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
* @param ksName The keyspace name
* @param cfName The columnFamily name
*/
public static synchronized void loadNewSSTables(String ksName, String cfName)
public static synchronized void loadNewSSTables(String ksName, String cfName)
{
/** ks/cf existence checks will be done by open and getCFS methods for us */
Table table = Table.open(ksName);
@ -530,7 +530,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
for (String idxName : idxNames)
indexes.add(cfs.indexManager.getColumnByIdxName(idxName));
Collection<SSTableReader> sstables = cfs.getSSTables();
Collection<SSTableReader> sstables = cfs.getSSTables();
try
{
cfs.indexManager.setIndexRemoved(indexes);
@ -651,11 +651,11 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public void runMayThrow() throws InterruptedException, IOException
{
latch.await();
if (!icc.isEmpty())
{
//only valid when memtables exist
for (SecondaryIndex index : indexManager.getIndexesNotBackedByCfs())
{
// flush any non-cfs backed indexes
@ -663,7 +663,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
index.forceBlockingFlush();
}
}
if (writeCommitLog)
{
// if we're not writing to the commit log, we are replaying the log, so marking
@ -1767,7 +1767,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
{
return data.getCompressionRatio();
}
/** true if this CFS contains secondary index data */
public boolean isIndex()
{

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db;
/*
*
*
* 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.db;
* 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.
*
*
*/
@ -37,7 +37,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class ColumnSerializer implements IColumnSerializer
{
private static final Logger logger = LoggerFactory.getLogger(ColumnSerializer.class);
public final static int DELETION_MASK = 0x01;
public final static int EXPIRATION_MASK = 0x02;
public final static int COUNTER_MASK = 0x04;

View File

@ -27,7 +27,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.HeapAllocator;
public class DeletedColumn extends Column
{
{
public DeletedColumn(ByteBuffer name, int localDeletionTime, long timestamp)
{
this(name, ByteBufferUtil.bytes(localDeletionTime), timestamp);
@ -57,7 +57,7 @@ public class DeletedColumn extends Column
return super.reconcile(column, allocator);
return column.reconcile(this, allocator);
}
@Override
public IColumn localCopy(ColumnFamilyStore cfs)
{

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db;
/*
*
*
* 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.db;
* 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.
*
*
*/

View File

@ -78,7 +78,7 @@ public class ExpiringColumn extends Column
public int size()
{
/*
* An expired column adds to a Column :
* An expired column adds to a Column :
* 4 bytes for the localExpirationTime
* + 4 bytes for the timeToLive
*/
@ -125,7 +125,7 @@ public class ExpiringColumn extends Column
clonedName = allocator.clone(name);
return new ExpiringColumn(clonedName, allocator.clone(value), timestamp, timeToLive, localExpirationTime);
}
@Override
public String getString(AbstractType<?> comparator)
{

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db;
/*
*
*
* 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.db;
* 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;

View File

@ -6,9 +6,9 @@
* 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

View File

@ -317,7 +317,7 @@ public class Memtable
/**
* @param startWith Include data in the result from and including this key and to the end of the memtable
* @return An iterator of entries with the data from the start key
* @return An iterator of entries with the data from the start key
*/
public Iterator<Map.Entry<DecoratedKey, ColumnFamily>> getEntryIterator(final RowPosition startWith, final RowPosition stopAt)
{

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db;
/*
*
*
* 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.db;
* 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.
*
*
*/

View File

@ -64,7 +64,7 @@ import org.apache.thrift.TSerializer;
public class RangeSliceCommand implements MessageProducer, IReadCommand
{
private static final RangeSliceCommandSerializer serializer = new RangeSliceCommandSerializer();
public final String keyspace;
public final String column_family;

View File

@ -57,7 +57,7 @@ public abstract class ReadCommand implements MessageProducer, IReadCommand
public final QueryPath queryPath;
public final String table;
public final ByteBuffer key;
private boolean isDigestQuery = false;
private boolean isDigestQuery = false;
protected final byte commandType;
protected ReadCommand(String table, ByteBuffer key, QueryPath queryPath, byte cmdType)
@ -113,7 +113,7 @@ public abstract class ReadCommand implements MessageProducer, IReadCommand
class ReadCommandSerializer implements IVersionedSerializer<ReadCommand>
{
private static final Map<Byte, IVersionedSerializer<ReadCommand>> CMD_SERIALIZER_MAP = new HashMap<Byte, IVersionedSerializer<ReadCommand>>();
static
static
{
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE_BY_NAMES, new SliceByNamesReadCommandSerializer());
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE, new SliceFromReadCommandSerializer());

View File

@ -28,12 +28,12 @@ import org.apache.cassandra.net.Message;
import org.apache.cassandra.net.MessagingService;
public class ReadRepairVerbHandler implements IVerbHandler
{
{
public void doVerb(Message message, String id)
{
{
byte[] body = message.getMessageBody();
FastByteArrayInputStream buffer = new FastByteArrayInputStream(body);
try
{
RowMutation rm = RowMutation.serializer().deserialize(new DataInputStream(buffer), message.getVersion());

View File

@ -27,7 +27,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
/*
* The read response message is sent by the server when reading data
* The read response message is sent by the server when reading data
* this encapsulates the tablename and the row that has been read.
* The table name is needed so that we can use it to create repairs.
*/
@ -44,7 +44,7 @@ private static IVersionedSerializer<ReadResponse> serializer_;
{
return serializer_;
}
private final Row row_;
private final ByteBuffer digest_;
@ -62,12 +62,12 @@ private static IVersionedSerializer<ReadResponse> serializer_;
digest_ = null;
}
public Row row()
public Row row()
{
return row_;
}
public ByteBuffer digest()
public ByteBuffer digest()
{
return digest_;
}
@ -89,7 +89,7 @@ class ReadResponseSerializer implements IVersionedSerializer<ReadResponse>
if (!response.isDigestQuery())
Row.serializer().serialize(response.row(), dos, version);
}
public ReadResponse deserialize(DataInput dis, int version) throws IOException
{
byte[] digest = null;

View File

@ -41,7 +41,7 @@ public class RowIteratorFactory
}
};
/**
* Get a row iterator over the provided memtables and sstables, between the provided keys
* and filtered by the queryfilter.

View File

@ -60,8 +60,8 @@ public class RowMutationVerbHandler implements IVerbHandler
{
logger_.error("Error in row mutation", e);
}
}
}
/**
* Older version (< 1.0) will not send this message at all, hence we don't
* need to check the version of the data.
@ -70,7 +70,7 @@ public class RowMutationVerbHandler implements IVerbHandler
{
DataInputStream dis = new DataInputStream(new FastByteArrayInputStream(forwardBytes));
int size = dis.readInt();
// remove fwds from message to avoid infinite loop
Message messageCopy = message.withHeaderRemoved(RowMutation.FORWARD_HEADER);
for (int i = 0; i < size; i++)

View File

@ -30,7 +30,7 @@ import org.apache.cassandra.net.MessagingService;
public class SchemaCheckVerbHandler implements IVerbHandler
{
private final Logger logger = LoggerFactory.getLogger(SchemaCheckVerbHandler.class);
public void doVerb(Message message, String id)
{
logger.debug("Received schema check request.");

View File

@ -51,7 +51,7 @@ public class SliceByNamesReadCommand extends ReadCommand
readCommand.setDigestQuery(isDigestQuery());
return readCommand;
}
public Row getRow(Table table) throws IOException
{
DecoratedKey<?> dk = StorageService.getPartitioner().decorateKey(key);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db;
/*
*
*
* 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.db;
* 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.
*
*
*/

View File

@ -74,7 +74,7 @@ public class SystemTable
{
return StorageService.getPartitioner().decorateKey(key);
}
public static void finishStartup() throws IOException
{
setupVersion();
@ -273,13 +273,13 @@ public class SystemTable
ex.initCause(err);
throw ex;
}
SortedSet<ByteBuffer> cols = new TreeSet<ByteBuffer>(BytesType.instance);
cols.add(CLUSTERNAME);
QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF), cols);
ColumnFamilyStore cfs = table.getColumnFamilyStore(STATUS_CF);
ColumnFamily cf = cfs.getColumnFamily(filter);
if (cf == null)
{
// this is a brand new node
@ -295,8 +295,8 @@ public class SystemTable
return;
}
IColumn clusterCol = cf.getColumn(CLUSTERNAME);
assert clusterCol != null;
String savedClusterName = ByteBufferUtil.string(clusterCol.value());
@ -352,7 +352,7 @@ public class SystemTable
return generation;
}
public static boolean isBootstrapped()
{
Table table = Table.open(Table.SYSTEM_TABLE);
@ -369,7 +369,7 @@ public class SystemTable
public static void setBootstrapped(boolean isBootstrapped)
{
ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
cf.addColumn(new Column(BOOTSTRAP,
cf.addColumn(new Column(BOOTSTRAP,
ByteBuffer.wrap(new byte[] { (byte) (isBootstrapped ? 1 : 0) }),
FBUtilities.timestampMicros()));
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, BOOTSTRAP_KEY);

View File

@ -74,9 +74,9 @@ public class Table
// It is possible to call Table.open without a running daemon, so it makes sense to ensure
// proper directories here as well as in CassandraDaemon.
static
static
{
if (!StorageService.instance.isClientMode())
if (!StorageService.instance.isClientMode())
{
try
{
@ -145,7 +145,7 @@ public class Table
return t;
}
}
public Collection<ColumnFamilyStore> getColumnFamilyStores()
{
return Collections.unmodifiableCollection(columnFamilyStores.values());
@ -199,7 +199,7 @@ public class Table
/**
* Take a snapshot of the entire set of column families with a given timestamp
*
*
* @param snapshotName the tag associated with the name of the snapshot. This value may not be null
*/
public void snapshot(String snapshotName)
@ -253,7 +253,7 @@ public class Table
cfStore.clearSnapshot(snapshotName);
}
}
/**
* @return A list of open SSTableReaders
*/
@ -295,7 +295,7 @@ public class Table
{
if (replicationStrategy != null)
StorageService.instance.getTokenMetadata().unregister(replicationStrategy);
replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name,
ksm.strategyClass,
StorageService.instance.getTokenMetadata(),
@ -310,10 +310,10 @@ public class Table
ColumnFamilyStore cfs = columnFamilyStores.remove(cfId);
if (cfs == null)
return;
unloadCf(cfs);
}
// disassociate a cfs from this table instance.
private void unloadCf(ColumnFamilyStore cfs) throws IOException
{
@ -331,7 +331,7 @@ public class Table
}
cfs.invalidate();
}
/** adds a cf to internal structures, ends up creating disk files). */
public void initCf(Integer cfId, String cfName)
{
@ -386,7 +386,7 @@ public class Table
{
if (writeCommitLog)
CommitLog.instance.add(mutation);
DecoratedKey<?> key = StorageService.getPartitioner().decorateKey(mutation.key());
for (ColumnFamily cf : mutation.getColumnFamilies())
{

View File

@ -24,7 +24,7 @@ import java.io.IOException;
public class UnserializableColumnFamilyException extends IOException
{
public final int cfId;
public UnserializableColumnFamilyException(String msg, int cfId)
{
super(msg);

View File

@ -30,11 +30,11 @@ import org.apache.cassandra.utils.FBUtilities;
/*
* This message is sent back the row mutation verb handler
* and basically specifies if the write succeeded or not for a particular
* This message is sent back the row mutation verb handler
* and basically specifies if the write succeeded or not for a particular
* key in a table
*/
public class WriteResponse
public class WriteResponse
{
private static WriteResponseSerializer serializer_ = new WriteResponseSerializer();

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator;
/*
*
*
* 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.db.columniterator;
* 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.
*
*
*/

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator;
/*
*
*
* 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.db.columniterator;
* 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.
*
*
*/

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator;
/*
*
*
* 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.db.columniterator;
* 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.
*
*
*/

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator;
/*
*
*
* 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.db.columniterator;
* 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.
*
*
*/

Some files were not shown because too many files have changed in this diff Show More