[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; package org.apache.cassandra.auth;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.util.Map; import java.util.Map;
@ -38,7 +38,7 @@ public class AllowAllAuthenticator implements IAuthenticator
{ {
return USER; return USER;
} }
public void validateConfiguration() throws ConfigurationException public void validateConfiguration() throws ConfigurationException
{ {
// pass // pass

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.auth; package org.apache.cassandra.auth;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.util.EnumSet; import java.util.EnumSet;

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.auth; package org.apache.cassandra.auth;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.auth; package org.apache.cassandra.auth;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.util.Map; import java.util.Map;

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.auth; package org.apache.cassandra.auth;
@ -29,7 +29,7 @@ import org.apache.cassandra.config.ConfigurationException;
/** /**
* Cassandra's resource hierarchy looks something like: * Cassandra's resource hierarchy looks something like:
* {{/cassandra/keyspaces/$ks_name/...}} * {{/cassandra/keyspaces/$ks_name/...}}
* *
* In table form: * In table form:
* /cassandra/ * /cassandra/
* - no checked permissions * - no checked permissions
@ -44,11 +44,11 @@ import org.apache.cassandra.config.ConfigurationException;
* - String * - String
* * An individual keyspace: READ/WRITE permissions apply to the entire namespace and control the ability to both * * 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. * 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 * 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 * IAuthority implementations should be able to handle these calls (although many will choose to ignore them
* completely). * completely).
* *
* NB: {{/cassandra/}} will not be checked for permissions via a call to IAuthority.authorize, so IAuthority * 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. * 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 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 * @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. * @return An AccessLevel representing the permissions for the user and resource: should never return null.
*/ */
public EnumSet<Permission> authorize(AuthenticatedUser user, List<Object> resource); public EnumSet<Permission> authorize(AuthenticatedUser user, List<Object> resource);

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.auth; package org.apache.cassandra.auth;

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.auth; 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 volatile ScheduledFuture<?> saveTask;
protected final CacheService.CacheType cacheType; protected final CacheService.CacheType cacheType;
public AutoSavingCache(ICache<K, V> cache, CacheService.CacheType cacheType) public AutoSavingCache(ICache<K, V> cache, CacheService.CacheType cacheType)
{ {
super(cache); super(cache);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.util.Set; import java.util.Set;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import org.apache.cassandra.db.ColumnFamily; import org.apache.cassandra.db.ColumnFamily;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import org.apache.cassandra.db.ColumnFamily; import org.apache.cassandra.db.ColumnFamily;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.util.Set; import java.util.Set;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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 Logger logger = LoggerFactory.getLogger(SerializingCache.class);
private static final int DEFAULT_CONCURENCY_LEVEL = 64; private static final int DEFAULT_CONCURENCY_LEVEL = 64;
private final ConcurrentLinkedHashMap<K, FreeableMemory> map; private final ConcurrentLinkedHashMap<K, FreeableMemory> map;
private final ISerializer<V> serializer; private final ISerializer<V> serializer;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cache; package org.apache.cassandra.cache;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import org.apache.cassandra.db.ColumnFamily; import org.apache.cassandra.db.ColumnFamily;

View File

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

View File

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

View File

@ -31,7 +31,7 @@ public class CliSessionState
public String hostName; // cassandra server name public String hostName; // cassandra server name
public int thriftPort; // cassandra server's thrift port 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 boolean debug = false; // print stack traces when errors occur in the CLI
public String username; // cassandra login name (if SimpleAuthenticator is used) public String username; // cassandra login name (if SimpleAuthenticator is used)
public String password; // cassandra login password (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) public void setOut(PrintStream newOut)
{ {
this.out = newOut; this.out = newOut;
} }
public void setErr(PrintStream newErr) 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.cassandra.thrift.KsDef;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.concurrent; package org.apache.cassandra.concurrent;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.concurrent; package org.apache.cassandra.concurrent;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -21,17 +21,17 @@ package org.apache.cassandra.concurrent;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class JMXConfigurableThreadPoolExecutor extends JMXEnabledThreadPoolExecutor implements JMXConfigurableThreadPoolExecutorMBean public class JMXConfigurableThreadPoolExecutor extends JMXEnabledThreadPoolExecutor implements JMXConfigurableThreadPoolExecutorMBean
{ {
public JMXConfigurableThreadPoolExecutor(int corePoolSize, public JMXConfigurableThreadPoolExecutor(int corePoolSize,
long keepAliveTime, long keepAliveTime,
TimeUnit unit, TimeUnit unit,
BlockingQueue<Runnable> workQueue, BlockingQueue<Runnable> workQueue,
NamedThreadFactory threadFactory, NamedThreadFactory threadFactory,
String jmxPath) String jmxPath)
{ {
super(corePoolSize, keepAliveTime, unit, workQueue, threadFactory, 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 * 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. * Runtime Exceptions.
*/ */
@ -64,7 +64,7 @@ public class JMXEnabledThreadPoolExecutor extends DebuggableThreadPoolExecutor i
{ {
this(corePoolSize, corePoolSize, keepAliveTime, unit, workQueue, threadFactory, jmxPath); this(corePoolSize, corePoolSize, keepAliveTime, unit, workQueue, threadFactory, jmxPath);
} }
public JMXEnabledThreadPoolExecutor(int corePoolSize, public JMXEnabledThreadPoolExecutor(int corePoolSize,
int maxPoolSize, int maxPoolSize,
long keepAliveTime, long keepAliveTime,

View File

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

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.concurrent; package org.apache.cassandra.concurrent;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -40,7 +40,7 @@ public class StageManager
static static
{ {
stages.put(Stage.MUTATION, multiThreadedConfigurableStage(Stage.MUTATION, getConcurrentWriters())); 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.REQUEST_RESPONSE, multiThreadedStage(Stage.REQUEST_RESPONSE, Runtime.getRuntime().availableProcessors()));
stages.put(Stage.INTERNAL_RESPONSE, multiThreadedStage(Stage.INTERNAL_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())); stages.put(Stage.REPLICATE_ON_WRITE, multiThreadedConfigurableStage(Stage.REPLICATE_ON_WRITE, getConcurrentReplicators()));
@ -62,7 +62,7 @@ public class StageManager
new NamedThreadFactory(stage.getJmxName()), new NamedThreadFactory(stage.getJmxName()),
stage.getJmxType()); stage.getJmxType());
} }
private static ThreadPoolExecutor multiThreadedConfigurableStage(Stage stage, int numThreads) private static ThreadPoolExecutor multiThreadedConfigurableStage(Stage stage, int numThreads)
{ {
return new JMXConfigurableThreadPoolExecutor(numThreads, return new JMXConfigurableThreadPoolExecutor(numThreads,
@ -81,7 +81,7 @@ public class StageManager
{ {
return stages.get(stage); return stages.get(stage);
} }
/** /**
* This method shuts down all registered stages. * This method shuts down all registered stages.
*/ */

View File

@ -315,7 +315,7 @@ public final class CFMetaData
.bloomFilterFpChance(oldCFMD.bloomFilterFpChance) .bloomFilterFpChance(oldCFMD.bloomFilterFpChance)
.caching(oldCFMD.caching); .caching(oldCFMD.caching);
} }
/** /**
* generate a column family name for an index corresponding to the given column. * 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. * 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); return new ArrayList<T>(array);
} }
public String getComment() public String getComment()
{ {
return comment; return comment;
@ -457,7 +457,7 @@ public final class CFMetaData
{ {
return replicateOnWrite; return replicateOnWrite;
} }
public int getGcGraceSeconds() public int getGcGraceSeconds()
{ {
return gcGraceSeconds; return gcGraceSeconds;
@ -611,7 +611,7 @@ public final class CFMetaData
} }
/** applies implicit defaults to cf definition. useful in updates */ /** 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()) if (!cf_def.isSetComment())
cf_def.setComment(""); cf_def.setComment("");
@ -781,7 +781,7 @@ public final class CFMetaData
for (ByteBuffer name : column_metadata.keySet()) for (ByteBuffer name : column_metadata.keySet())
if (!newColumns.contains(name)) if (!newColumns.contains(name))
toRemove.add(name); toRemove.add(name);
// remove the ones leaving. // remove the ones leaving.
for (ByteBuffer indexName : toRemove) for (ByteBuffer indexName : toRemove)
{ {
@ -802,7 +802,7 @@ public final class CFMetaData
for (ColumnDef def : toAdd) for (ColumnDef def : toAdd)
{ {
AbstractType<?> dValidClass = TypeParser.parse(def.validation_class); AbstractType<?> dValidClass = TypeParser.parse(def.validation_class);
ColumnDefinition cd = new ColumnDefinition(def.name, ColumnDefinition cd = new ColumnDefinition(def.name,
dValidClass, dValidClass,
def.index_type == null ? null : IndexType.valueOf(def.index_type.name()), def.index_type == null ? null : IndexType.valueOf(def.index_type.name()),
def.index_options, def.index_options,
@ -967,7 +967,7 @@ public final class CFMetaData
try try
{ {
AbstractType<?> comparator = TypeParser.parse(cf_def.comparator_type); AbstractType<?> comparator = TypeParser.parse(cf_def.comparator_type);
for (org.apache.cassandra.thrift.ColumnDef column : cf_def.column_metadata) for (org.apache.cassandra.thrift.ColumnDef column : cf_def.column_metadata)
{ {
if (column.index_type != null && column.index_name == null) if (column.index_type != null && column.index_name == null)

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.config; package org.apache.cassandra.config;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -45,13 +45,13 @@ public class ColumnDefinition
private IndexType index_type; private IndexType index_type;
private Map<String,String> index_options; private Map<String,String> index_options;
private String index_name; private String index_name;
public ColumnDefinition(ByteBuffer name, AbstractType<?> validator, IndexType index_type, Map<String, String> index_options, String index_name) public ColumnDefinition(ByteBuffer name, AbstractType<?> validator, IndexType index_type, Map<String, String> index_options, String index_name)
{ {
this.name = name; this.name = name;
this.index_name = index_name; this.index_name = index_name;
this.validator = validator; this.validator = validator;
this.setIndexType(index_type, index_options); this.setIndexType(index_type, index_options);
} }
@ -282,7 +282,7 @@ public class ColumnDefinition
{ {
return index_name; return index_name;
} }
public void setIndexName(String s) public void setIndexName(String s)
{ {
index_name = s; index_name = s;
@ -291,19 +291,19 @@ public class ColumnDefinition
public void setIndexType(IndexType index_type, Map<String,String> index_options) public void setIndexType(IndexType index_type, Map<String,String> index_options)
{ {
this.index_type = index_type; this.index_type = index_type;
this.index_options = index_options; this.index_options = index_options;
} }
public IndexType getIndexType() public IndexType getIndexType()
{ {
return index_type; return index_type;
} }
public Map<String,String> getIndexOptions() public Map<String,String> getIndexOptions()
{ {
return index_options; return index_options;
} }
public AbstractType<?> getValidator() public AbstractType<?> getValidator()
{ {
return validator; return validator;
@ -313,18 +313,18 @@ public class ColumnDefinition
{ {
this.validator = validator; this.validator = validator;
} }
public static Map<String,String> getStringMap(Map<CharSequence, CharSequence> charMap) public static Map<String,String> getStringMap(Map<CharSequence, CharSequence> charMap)
{ {
if (charMap == null) if (charMap == null)
return null; return null;
Map<String,String> stringMap = new HashMap<String, String>(); 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()); stringMap.put(entry.getKey().toString(), entry.getValue().toString());
return stringMap; return stringMap;
} }
} }

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.config; package org.apache.cassandra.config;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider; import org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider;
@ -31,46 +31,46 @@ public class Config
public String cluster_name = "Test Cluster"; public String cluster_name = "Test Cluster";
public String authenticator; public String authenticator;
public String authority; public String authority;
/* Hashing strategy Random or OPHF */ /* Hashing strategy Random or OPHF */
public String partitioner; public String partitioner;
public Boolean auto_bootstrap = true; public Boolean auto_bootstrap = true;
public Boolean hinted_handoff_enabled = true; public Boolean hinted_handoff_enabled = true;
public Integer max_hint_window_in_ms = Integer.MAX_VALUE; public Integer max_hint_window_in_ms = Integer.MAX_VALUE;
public SeedProviderDef seed_provider; public SeedProviderDef seed_provider;
public DiskAccessMode disk_access_mode = DiskAccessMode.auto; public DiskAccessMode disk_access_mode = DiskAccessMode.auto;
/* Address where to run the job tracker */ /* Address where to run the job tracker */
public String job_tracker_host; public String job_tracker_host;
/* Job Jar Location */ /* Job Jar Location */
public String job_jar_file_location; public String job_jar_file_location;
/* initial token in the ring */ /* initial token in the ring */
public String initial_token; public String initial_token;
public Long rpc_timeout_in_ms = new Long(2000); public Long rpc_timeout_in_ms = new Long(2000);
public Integer streaming_socket_timeout_in_ms = new Integer(0); public Integer streaming_socket_timeout_in_ms = new Integer(0);
public Integer phi_convict_threshold = 8; public Integer phi_convict_threshold = 8;
public Integer concurrent_reads = 8; public Integer concurrent_reads = 8;
public Integer concurrent_writes = 32; public Integer concurrent_writes = 32;
public Integer concurrent_replicates = 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_flush_writers = null; // will get set to the length of data dirs in DatabaseDescriptor
public Integer memtable_total_space_in_mb; public Integer memtable_total_space_in_mb;
public Integer sliced_buffer_size_in_kb = 64; public Integer sliced_buffer_size_in_kb = 64;
public Integer storage_port = 7000; public Integer storage_port = 7000;
public Integer ssl_storage_port = 7001; public Integer ssl_storage_port = 7001;
public String listen_address; public String listen_address;
public String broadcast_address; public String broadcast_address;
public String rpc_address; public String rpc_address;
public Integer rpc_port = 9160; public Integer rpc_port = 9160;
public String rpc_server_type = "sync"; public String rpc_server_type = "sync";
@ -103,7 +103,7 @@ public class Config
public CommitLogSync commitlog_sync; public CommitLogSync commitlog_sync;
public Double commitlog_sync_batch_window_in_ms; public Double commitlog_sync_batch_window_in_ms;
public Integer commitlog_sync_period_in_ms; public Integer commitlog_sync_period_in_ms;
public String endpoint_snitch; public String endpoint_snitch;
public Boolean dynamic_snitch = true; public Boolean dynamic_snitch = true;
public Integer dynamic_snitch_update_interval_in_ms = 100; public Integer dynamic_snitch_update_interval_in_ms = 100;
@ -163,14 +163,14 @@ public class Config
periodic, periodic,
batch batch
} }
public static enum DiskAccessMode { public static enum DiskAccessMode {
auto, auto,
mmap, mmap,
mmap_index_only, mmap_index_only,
standard, standard,
} }
public static enum RequestSchedulerId public static enum RequestSchedulerId
{ {
keyspace keyspace

View File

@ -71,7 +71,7 @@ public class DatabaseDescriptor
private static IPartitioner partitioner; private static IPartitioner partitioner;
private static Config.DiskAccessMode indexAccessMode; private static Config.DiskAccessMode indexAccessMode;
private static Config conf; private static Config conf;
private static IAuthenticator authenticator = new AllowAllAuthenticator(); private static IAuthenticator authenticator = new AllowAllAuthenticator();
@ -472,7 +472,7 @@ public class DatabaseDescriptor
} }
/** load keyspace (table) definitions, but do not initialize the table instances. */ /** 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); 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; 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; return conf.thrift_framed_transport_size_in_mb * 1024 * 1024;
} }
@ -603,7 +603,7 @@ public class DatabaseDescriptor
{ {
partitioner = newPartitioner; partitioner = newPartitioner;
} }
public static IEndpointSnitch getEndpointSnitch() public static IEndpointSnitch getEndpointSnitch()
{ {
return snitch; return snitch;
@ -632,7 +632,7 @@ public class DatabaseDescriptor
{ {
return conf.job_tracker_host; return conf.job_tracker_host;
} }
public static int getColumnIndexSize() public static int getColumnIndexSize()
{ {
return conf.column_index_size_in_kb * 1024; return conf.column_index_size_in_kb * 1024;
@ -762,7 +762,7 @@ public class DatabaseDescriptor
{ {
return conf.saved_caches_directory; return conf.saved_caches_directory;
} }
public static Set<InetAddress> getSeeds() public static Set<InetAddress> getSeeds()
{ {
return Collections.unmodifiableSet(new HashSet(seedProvider.getSeeds())); return Collections.unmodifiableSet(new HashSet(seedProvider.getSeeds()));
@ -772,22 +772,22 @@ public class DatabaseDescriptor
{ {
return listenAddress; return listenAddress;
} }
public static InetAddress getBroadcastAddress() public static InetAddress getBroadcastAddress()
{ {
return broadcastAddress; return broadcastAddress;
} }
public static void setBroadcastAddress(InetAddress broadcastAdd) public static void setBroadcastAddress(InetAddress broadcastAdd)
{ {
broadcastAddress = broadcastAdd; broadcastAddress = broadcastAdd;
} }
public static InetAddress getRpcAddress() public static InetAddress getRpcAddress()
{ {
return rpcAddress; return rpcAddress;
} }
public static String getRpcServerType() public static String getRpcServerType()
{ {
return conf.rpc_server_type; return conf.rpc_server_type;
@ -802,12 +802,12 @@ public class DatabaseDescriptor
{ {
return conf.rpc_min_threads; return conf.rpc_min_threads;
} }
public static Integer getRpcMaxThreads() public static Integer getRpcMaxThreads()
{ {
return conf.rpc_max_threads; return conf.rpc_max_threads;
} }
public static Integer getRpcSendBufferSize() public static Integer getRpcSendBufferSize()
{ {
return conf.rpc_send_buff_size_in_bytes; return conf.rpc_send_buff_size_in_bytes;

View File

@ -2,7 +2,7 @@ package org.apache.cassandra.config;
import java.util.Map; import java.util.Map;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
/** /**

View File

@ -27,7 +27,7 @@ public class SeedProviderDef
{ {
public String class_name; public String class_name;
public Map<String, String> parameters; public Map<String, String> parameters;
public SeedProviderDef(LinkedHashMap p) public SeedProviderDef(LinkedHashMap p)
{ {
class_name = (String)p.get("class_name"); class_name = (String)p.get("class_name");

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -25,7 +25,7 @@ public class CQLStatement
public StatementType type; public StatementType type;
public Object statement; public Object statement;
public int boundTerms = 0; public int boundTerms = 0;
public CQLStatement(StatementType type, Object statement, int lastMarker) public CQLStatement(StatementType type, Object statement, int lastMarker)
{ {
this.type = type; this.type = type;

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -49,7 +49,7 @@ public class CreateColumnFamilyStatement
{ {
this.name = name; this.name = name;
} }
/** Perform validation of parsed params */ /** Perform validation of parsed params */
private void validate(List<ByteBuffer> variables) throws InvalidRequestException 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)); throw new InvalidRequestException(String.format("\"%s\" is not a valid column family name", name));
if (name.length() > 32) if (name.length() > 32)
throw new InvalidRequestException(String.format("Column family names shouldn't be more than 32 character long (got \"%s\")", name)); 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. // Ensure that exactly one key has been specified.
if (keyValidator.size() < 1) if (keyValidator.size() < 1)
throw new InvalidRequestException("You must specify a PRIMARY KEY"); 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 */ /** Map a column name to a validator for its value */
public void addColumn(Term term, String comparator) public void addColumn(Term term, String comparator)
{ {
columns.put(term, comparator); columns.put(term, comparator);
} }
public void setKeyType(String validator) public void setKeyType(String validator)
{ {
keyValidator.add(validator); keyValidator.add(validator);
} }
public String getKeyType() public String getKeyType()
{ {
return keyValidator.get(0); return keyValidator.get(0);
@ -124,12 +124,12 @@ public class CreateColumnFamilyStatement
{ {
return name; return name;
} }
// Column definitions // Column definitions
private Map<ByteBuffer, ColumnDefinition> getColumns(AbstractType<?> comparator) throws InvalidRequestException private Map<ByteBuffer, ColumnDefinition> getColumns(AbstractType<?> comparator) throws InvalidRequestException
{ {
Map<ByteBuffer, ColumnDefinition> columnDefs = new HashMap<ByteBuffer, ColumnDefinition>(); Map<ByteBuffer, ColumnDefinition> columnDefs = new HashMap<ByteBuffer, ColumnDefinition>();
for (Map.Entry<Term, String> col : columns.entrySet()) for (Map.Entry<Term, String> col : columns.entrySet())
{ {
try try
@ -148,14 +148,14 @@ public class CreateColumnFamilyStatement
throw ex; throw ex;
} }
} }
return columnDefs; return columnDefs;
} }
/** /**
* Returns a CFMetaData instance based on the parameters parsed from this * Returns a CFMetaData instance based on the parameters parsed from this
* <code>CREATE</code> statement, or defaults where applicable. * <code>CREATE</code> statement, or defaults where applicable.
* *
* @param keyspace keyspace to apply this column family to * @param keyspace keyspace to apply this column family to
* @return a CFMetaData instance corresponding to the values parsed from this statement * @return a CFMetaData instance corresponding to the values parsed from this statement
* @throws InvalidRequestException on failure to validate parsed parameters * @throws InvalidRequestException on failure to validate parsed parameters
@ -197,7 +197,7 @@ public class CreateColumnFamilyStatement
} }
return newCFMD; return newCFMD;
} }
private String getPropertyString(String key, String defaultValue) private String getPropertyString(String key, String defaultValue)
{ {
return cfProps.getPropertyString(key, defaultValue); return cfProps.getPropertyString(key, defaultValue);

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -26,26 +26,26 @@ public class CreateIndexStatement
private final String columnFamily; private final String columnFamily;
private final String indexName; private final String indexName;
private final Term columnName; private final Term columnName;
public CreateIndexStatement(String indexName, String columnFamily, Term columnName) public CreateIndexStatement(String indexName, String columnFamily, Term columnName)
{ {
this.indexName = indexName; this.indexName = indexName;
this.columnFamily = columnFamily; this.columnFamily = columnFamily;
this.columnName = columnName; this.columnName = columnName;
} }
/** Column family namespace. */ /** Column family namespace. */
public String getColumnFamily() public String getColumnFamily()
{ {
return columnFamily; return columnFamily;
} }
/** Column name to index. */ /** Column name to index. */
public Term getColumnName() public Term getColumnName()
{ {
return columnName; return columnName;
} }
/** Index name (or null). */ /** Index name (or null). */
public String getIndexName() public String getIndexName()
{ {

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -34,16 +34,16 @@ import org.apache.cassandra.thrift.InvalidRequestException;
/** A <code>CREATE KEYSPACE</code> statement parsed from a CQL query. */ /** A <code>CREATE KEYSPACE</code> statement parsed from a CQL query. */
public class CreateKeyspaceStatement public class CreateKeyspaceStatement
{ {
private final String name; private final String name;
private final Map<String, String> attrs; private final Map<String, String> attrs;
private String strategyClass; private String strategyClass;
private Map<String, String> strategyOptions = new HashMap<String, String>(); private Map<String, String> strategyOptions = new HashMap<String, String>();
/** /**
* Creates a new <code>CreateKeyspaceStatement</code> instance for a given * Creates a new <code>CreateKeyspaceStatement</code> instance for a given
* keyspace name and keyword arguments. * keyspace name and keyword arguments.
* *
* @param name the name of the keyspace to create * @param name the name of the keyspace to create
* @param attrs map of the raw keyword arguments that followed the <code>WITH</code> keyword. * @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.name = name;
this.attrs = attrs; this.attrs = attrs;
} }
/** /**
* The <code>CqlParser</code> only goes as far as extracting the keyword arguments * The <code>CqlParser</code> only goes as far as extracting the keyword arguments
* from these statements, so this method is responsible for processing and * from these statements, so this method is responsible for processing and
* validating, and must be called prior to access. * validating, and must be called prior to access.
* *
* @throws InvalidRequestException if arguments are missing or unacceptable * @throws InvalidRequestException if arguments are missing or unacceptable
*/ */
public void validate() throws InvalidRequestException 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)); throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > 32) if (name.length() > 32)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than 32 character long (got \"%s\")", name)); throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than 32 character long (got \"%s\")", name));
// required // required
if (!attrs.containsKey("strategy_class")) if (!attrs.containsKey("strategy_class"))
throw new InvalidRequestException("missing required argument \"strategy_class\""); throw new InvalidRequestException("missing required argument \"strategy_class\"");
strategyClass = attrs.get("strategy_class"); strategyClass = attrs.get("strategy_class");
// optional // optional
for (String key : attrs.keySet()) for (String key : attrs.keySet())
if ((key.contains(":")) && (key.startsWith("strategy_options"))) if ((key.contains(":")) && (key.startsWith("strategy_options")))

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -45,7 +45,7 @@ public class DeleteStatement extends AbstractModification
{ {
private List<Term> columns; private List<Term> columns;
private List<Term> keys; private List<Term> keys;
public DeleteStatement(List<Term> columns, String keyspace, String columnFamily, String keyName, List<Term> keys, Attributes attrs) public DeleteStatement(List<Term> columns, String keyspace, String columnFamily, String keyName, List<Term> keys, Attributes attrs)
{ {
super(keyspace, columnFamily, keyName, attrs); super(keyspace, columnFamily, keyName, attrs);

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; 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!"); throw new InvalidRequestException("Start key must sort before (or equal to) finish key in your partitioner!");
} }
AbstractBounds<RowPosition> bounds = new Bounds<RowPosition>(startKey, finishKey); AbstractBounds<RowPosition> bounds = new Bounds<RowPosition>(startKey, finishKey);
// XXX: Our use of Thrift structs internally makes me Sad. :( // XXX: Our use of Thrift structs internally makes me Sad. :(
SlicePredicate thriftSlicePredicate = slicePredicateFromSelect(select, metadata, variables); SlicePredicate thriftSlicePredicate = slicePredicateFromSelect(select, metadata, variables);
validateSlicePredicate(metadata, thriftSlicePredicate); validateSlicePredicate(metadata, thriftSlicePredicate);
@ -253,7 +253,7 @@ public class QueryProcessor
rowMutations.addAll(update.prepareRowMutations(keyspace, clientState, variables)); rowMutations.addAll(update.prepareRowMutations(keyspace, clientState, variables));
} }
try try
{ {
StorageProxy.mutate(rowMutations, consistency); StorageProxy.mutate(rowMutations, consistency);
@ -267,12 +267,12 @@ public class QueryProcessor
throw new TimedOutException(); throw new TimedOutException();
} }
} }
private static SlicePredicate slicePredicateFromSelect(SelectStatement select, CFMetaData metadata, List<ByteBuffer> variables) private static SlicePredicate slicePredicateFromSelect(SelectStatement select, CFMetaData metadata, List<ByteBuffer> variables)
throws InvalidRequestException throws InvalidRequestException
{ {
SlicePredicate thriftSlicePredicate = new SlicePredicate(); SlicePredicate thriftSlicePredicate = new SlicePredicate();
if (select.isColumnRange() || select.getColumnNames().size() == 0) if (select.isColumnRange() || select.getColumnNames().size() == 0)
{ {
SliceRange sliceRange = new SliceRange(); SliceRange sliceRange = new SliceRange();
@ -286,10 +286,10 @@ public class QueryProcessor
{ {
thriftSlicePredicate.column_names = getColumnNames(select, metadata, variables); thriftSlicePredicate.column_names = getColumnNames(select, metadata, variables);
} }
return thriftSlicePredicate; return thriftSlicePredicate;
} }
/* Test for SELECT-specific taboos */ /* Test for SELECT-specific taboos */
private static void validateSelect(String keyspace, SelectStatement select, List<ByteBuffer> variables) throws InvalidRequestException 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) // Finish key w/o start key (KEY < foo)
if (!select.isKeyRange() && (select.getKeyFinish() != null)) if (!select.isKeyRange() && (select.getKeyFinish() != null))
throw new InvalidRequestException("Key range clauses must include a start key (i.e. KEY > term)"); 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) // Key range and by-key(s) combined (KEY > foo AND KEY = bar)
if (select.isKeyRange() && select.getKeys().size() > 0) if (select.isKeyRange() && select.getKeys().size() > 0)
throw new InvalidRequestException("You cannot combine key range and by-key clauses in a SELECT"); 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). // 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)) 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"); throw new InvalidRequestException("You cannot combine key range and by-column clauses in a SELECT");
// Can't use more than one KEY = // Can't use more than one KEY =
if (!select.isMultiKey() && select.getKeys().size() > 1) if (!select.isMultiKey() && select.getKeys().size() > 1)
throw new InvalidRequestException("You cannot use more than one KEY = in a SELECT"); throw new InvalidRequestException("You cannot use more than one KEY = in a SELECT");
@ -362,7 +362,7 @@ public class QueryProcessor
validateSchemaIsSettled(); validateSchemaIsSettled();
} }
public static void validateKey(ByteBuffer key) throws InvalidRequestException public static void validateKey(ByteBuffer key) throws InvalidRequestException
{ {
if (key == null || key.remaining() == 0) if (key == null || key.remaining() == 0)
@ -405,7 +405,7 @@ public class QueryProcessor
{ {
validateColumnNames(Arrays.asList(column)); validateColumnNames(Arrays.asList(column));
} }
public static void validateColumn(CFMetaData metadata, ByteBuffer name, ByteBuffer value) public static void validateColumn(CFMetaData metadata, ByteBuffer name, ByteBuffer value)
throws InvalidRequestException throws InvalidRequestException
{ {
@ -424,7 +424,7 @@ public class QueryProcessor
me.getMessage())); me.getMessage()));
} }
} }
private static void validateSlicePredicate(CFMetaData metadata, SlicePredicate predicate) private static void validateSlicePredicate(CFMetaData metadata, SlicePredicate predicate)
throws InvalidRequestException throws InvalidRequestException
{ {
@ -433,13 +433,13 @@ public class QueryProcessor
else else
validateColumnNames(predicate.column_names); validateColumnNames(predicate.column_names);
} }
private static void validateSliceRange(CFMetaData metadata, SliceRange range) private static void validateSliceRange(CFMetaData metadata, SliceRange range)
throws InvalidRequestException throws InvalidRequestException
{ {
validateSliceRange(metadata, range.start, range.finish, range.reversed); validateSliceRange(metadata, range.start, range.finish, range.reversed);
} }
private static void validateSliceRange(CFMetaData metadata, ByteBuffer start, ByteBuffer finish, boolean reversed) private static void validateSliceRange(CFMetaData metadata, ByteBuffer start, ByteBuffer finish, boolean reversed)
throws InvalidRequestException throws InvalidRequestException
{ {
@ -448,7 +448,7 @@ public class QueryProcessor
if (start.remaining() > 0 && finish.remaining() > 0 && orderedComparator.compare(start, finish) > 0) if (start.remaining() > 0 && finish.remaining() > 0 && orderedComparator.compare(start, finish) > 0)
throw new InvalidRequestException("range finish must come after start in traversal order"); throw new InvalidRequestException("range finish must come after start in traversal order");
} }
// Copypasta from CassandraServer (where it is private). // Copypasta from CassandraServer (where it is private).
private static void validateSchemaAgreement() throws SchemaDisagreementException private static void validateSchemaAgreement() throws SchemaDisagreementException
{ {
@ -467,13 +467,13 @@ public class QueryProcessor
throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException
{ {
String keyspace = null; String keyspace = null;
// Some statements won't have (or don't need) a keyspace (think USE, or CREATE). // 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)) if (statement.type != StatementType.SELECT && StatementType.requiresKeyspace.contains(statement.type))
keyspace = clientState.getKeyspace(); keyspace = clientState.getKeyspace();
CqlResult result = new CqlResult(); CqlResult result = new CqlResult();
if (logger.isDebugEnabled()) logger.debug("CQL statement type: {}", statement.type.toString()); if (logger.isDebugEnabled()) logger.debug("CQL statement type: {}", statement.type.toString());
CFMetaData metadata; CFMetaData metadata;
switch (statement.type) switch (statement.type)
@ -627,7 +627,7 @@ public class QueryProcessor
batchUpdate(clientState, Collections.singletonList(update), update.getConsistencyLevel(), variables); batchUpdate(clientState, Collections.singletonList(update), update.getConsistencyLevel(), variables);
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case BATCH: case BATCH:
BatchStatement batch = (BatchStatement) statement.statement; BatchStatement batch = (BatchStatement) statement.statement;
ThriftValidation.validateConsistencyLevel(keyspace, batch.getConsistencyLevel(), RequestType.WRITE); ThriftValidation.validateConsistencyLevel(keyspace, batch.getConsistencyLevel(), RequestType.WRITE);
@ -661,20 +661,20 @@ public class QueryProcessor
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case USE: case USE:
clientState.setKeyspace(CliUtils.unescapeSQLString((String) statement.statement)); clientState.setKeyspace(CliUtils.unescapeSQLString((String) statement.statement));
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case TRUNCATE: case TRUNCATE:
Pair<String, String> columnFamily = (Pair<String, String>)statement.statement; Pair<String, String> columnFamily = (Pair<String, String>)statement.statement;
keyspace = columnFamily.left == null ? clientState.getKeyspace() : columnFamily.left; keyspace = columnFamily.left == null ? clientState.getKeyspace() : columnFamily.left;
validateColumnFamily(keyspace, columnFamily.right); validateColumnFamily(keyspace, columnFamily.right);
clientState.hasColumnFamilyAccess(keyspace, columnFamily.right, Permission.WRITE); clientState.hasColumnFamilyAccess(keyspace, columnFamily.right, Permission.WRITE);
try try
{ {
StorageProxy.truncateBlocking(keyspace, columnFamily.right); StorageProxy.truncateBlocking(keyspace, columnFamily.right);
@ -687,10 +687,10 @@ public class QueryProcessor
{ {
throw (UnavailableException) new UnavailableException().initCause(e); throw (UnavailableException) new UnavailableException().initCause(e);
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case DELETE: case DELETE:
DeleteStatement delete = (DeleteStatement)statement.statement; DeleteStatement delete = (DeleteStatement)statement.statement;
@ -704,17 +704,17 @@ public class QueryProcessor
{ {
throw new TimedOutException(); throw new TimedOutException();
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case CREATE_KEYSPACE: case CREATE_KEYSPACE:
CreateKeyspaceStatement create = (CreateKeyspaceStatement)statement.statement; CreateKeyspaceStatement create = (CreateKeyspaceStatement)statement.statement;
create.validate(); create.validate();
ThriftValidation.validateKeyspaceNotSystem(create.getName()); ThriftValidation.validateKeyspaceNotSystem(create.getName());
clientState.hasKeyspaceSchemaAccess(Permission.WRITE); clientState.hasKeyspaceSchemaAccess(Permission.WRITE);
validateSchemaAgreement(); validateSchemaAgreement();
try try
{ {
KsDef ksd = new KsDef(create.getName(), KsDef ksd = new KsDef(create.getName(),
@ -731,10 +731,10 @@ public class QueryProcessor
ex.initCause(e); ex.initCause(e);
throw ex; throw ex;
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case CREATE_COLUMNFAMILY: case CREATE_COLUMNFAMILY:
CreateColumnFamilyStatement createCf = (CreateColumnFamilyStatement)statement.statement; CreateColumnFamilyStatement createCf = (CreateColumnFamilyStatement)statement.statement;
clientState.hasColumnFamilySchemaAccess(Permission.WRITE); clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
@ -752,10 +752,10 @@ public class QueryProcessor
ex.initCause(e); ex.initCause(e);
throw ex; throw ex;
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case CREATE_INDEX: case CREATE_INDEX:
CreateIndexStatement createIdx = (CreateIndexStatement)statement.statement; CreateIndexStatement createIdx = (CreateIndexStatement)statement.statement;
clientState.hasColumnFamilySchemaAccess(Permission.WRITE); clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
@ -775,7 +775,7 @@ public class QueryProcessor
{ {
if (cd.index_type != null) if (cd.index_type != null)
throw new InvalidRequestException("Index already exists"); 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()); logger.debug("Updating column {} definition for index {}", oldCfm.comparator.getString(columnName), createIdx.getIndexName());
cd.setIndex_type(IndexType.KEYS); cd.setIndex_type(IndexType.KEYS);
cd.setIndex_name(createIdx.getIndexName()); cd.setIndex_name(createIdx.getIndexName());
@ -798,7 +798,7 @@ public class QueryProcessor
ex.initCause(e); ex.initCause(e);
throw ex; throw ex;
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
@ -832,7 +832,7 @@ public class QueryProcessor
ThriftValidation.validateKeyspaceNotSystem(deleteKeyspace); ThriftValidation.validateKeyspaceNotSystem(deleteKeyspace);
clientState.hasKeyspaceSchemaAccess(Permission.WRITE); clientState.hasKeyspaceSchemaAccess(Permission.WRITE);
validateSchemaAgreement(); validateSchemaAgreement();
try try
{ {
applyMigrationOnStage(new DropKeyspace(deleteKeyspace)); applyMigrationOnStage(new DropKeyspace(deleteKeyspace));
@ -843,15 +843,15 @@ public class QueryProcessor
ex.initCause(e); ex.initCause(e);
throw ex; throw ex;
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
case DROP_COLUMNFAMILY: case DROP_COLUMNFAMILY:
String deleteColumnFamily = (String)statement.statement; String deleteColumnFamily = (String)statement.statement;
clientState.hasColumnFamilySchemaAccess(Permission.WRITE); clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
validateSchemaAgreement(); validateSchemaAgreement();
try try
{ {
applyMigrationOnStage(new DropColumnFamily(keyspace, deleteColumnFamily)); applyMigrationOnStage(new DropColumnFamily(keyspace, deleteColumnFamily));
@ -862,7 +862,7 @@ public class QueryProcessor
ex.initCause(e); ex.initCause(e);
throw ex; throw ex;
} }
result.type = CqlResultType.VOID; result.type = CqlResultType.VOID;
return result; return result;
@ -913,21 +913,21 @@ public class QueryProcessor
return new CqlPreparedResult(statementId, statement.boundTerms); return new CqlPreparedResult(statementId, statement.boundTerms);
} }
public static CqlResult processPrepared(CQLStatement statement, ClientState clientState, List<ByteBuffer> variables) public static CqlResult processPrepared(CQLStatement statement, ClientState clientState, List<ByteBuffer> variables)
throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException 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.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", throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
statement.boundTerms, statement.boundTerms,
variables.size())); variables.size()));
// at this point there is a match in count between markers and variables that is non-zero // 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++) for (int i = 0; i < variables.size(); i++)
logger.trace("[{}] '{}'", i+1, variables.get(i)); logger.trace("[{}] '{}'", i+1, variables.get(i));
} }
@ -970,15 +970,15 @@ public class QueryProcessor
CqlLexer lexer = new CqlLexer(stream); CqlLexer lexer = new CqlLexer(stream);
TokenStream tokenStream = new CommonTokenStream(lexer); TokenStream tokenStream = new CommonTokenStream(lexer);
CqlParser parser = new CqlParser(tokenStream); CqlParser parser = new CqlParser(tokenStream);
// Parse the query string to a statement instance // Parse the query string to a statement instance
CQLStatement statement = parser.query(); CQLStatement statement = parser.query();
// The lexer and parser queue up any errors they may have encountered // The lexer and parser queue up any errors they may have encountered
// along the way, if necessary, we turn them into exceptions here. // along the way, if necessary, we turn them into exceptions here.
lexer.throwLastRecognitionError(); lexer.throwLastRecognitionError();
parser.throwLastRecognitionError(); parser.throwLastRecognitionError();
return statement; return statement;
} }

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -30,10 +30,10 @@ public class Relation
private Term entity; private Term entity;
private RelationType relationType; private RelationType relationType;
private Term value; private Term value;
/** /**
* Creates a new relation. * Creates a new relation.
* *
* @param entity the kind of relation this is; what the term is being compared to. * @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 type the type that describes how this entity relates to the value.
* @param value the value being compared. * @param value the value being compared.
@ -44,22 +44,22 @@ public class Relation
this.relationType = RelationType.forString(type); this.relationType = RelationType.forString(type);
this.value = value; this.value = value;
} }
public RelationType operator() public RelationType operator()
{ {
return relationType; return relationType;
} }
public Term getEntity() public Term getEntity()
{ {
return entity; return entity;
} }
public Term getValue() public Term getValue()
{ {
return value; return value;
} }
@Override @Override
public String toString() public String toString()
{ {
@ -70,7 +70,7 @@ public class Relation
enum RelationType enum RelationType
{ {
EQ, LT, LTE, GTE, GT; EQ, LT, LTE, GTE, GT;
public static RelationType forString(String s) public static RelationType forString(String s)
{ {
if (s.equals("=")) if (s.equals("="))
@ -83,7 +83,7 @@ enum RelationType
return GTE; return GTE;
else if (s.equals(">")) else if (s.equals(">"))
return GT; return GT;
return null; return null;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -28,23 +28,23 @@ import java.util.List;
* determine which columns will appear in the result set. SelectExpression * determine which columns will appear in the result set. SelectExpression
* instances encapsulate a parsed expression from a <code>SELECT</code> * instances encapsulate a parsed expression from a <code>SELECT</code>
* statement. * statement.
* *
* See: doc/cql/CQL.html#SpecifyingColumns * See: doc/cql/CQL.html#SpecifyingColumns
*/ */
public class SelectExpression public class SelectExpression
{ {
public static final int MAX_COLUMNS_DEFAULT = 10000; public static final int MAX_COLUMNS_DEFAULT = 10000;
private int numColumns = MAX_COLUMNS_DEFAULT; private int numColumns = MAX_COLUMNS_DEFAULT;
private boolean reverseColumns = false; private boolean reverseColumns = false;
private boolean hasFirstSet; private boolean hasFirstSet;
private final boolean wildcard; private final boolean wildcard;
private Term start, finish; private Term start, finish;
private List<Term> columns; private List<Term> columns;
/** /**
* Create a new SelectExpression for a range (slice) of columns. * Create a new SelectExpression for a range (slice) of columns.
* *
* @param start the starting column name * @param start the starting column name
* @param finish the finishing column name * @param finish the finishing column name
* @param count the number of columns to limit the results to * @param count the number of columns to limit the results to
@ -61,10 +61,10 @@ public class SelectExpression
this.wildcard = wildcard; this.wildcard = wildcard;
hasFirstSet = firstSet; hasFirstSet = firstSet;
} }
/** /**
* Create a new SelectExpression for a list of columns. * Create a new SelectExpression for a list of columns.
* *
* @param first the first (possibly only) column name to select on. * @param first the first (possibly only) column name to select on.
* @param count the number of columns to limit the results on * @param count the number of columns to limit the results on
* @param reverse true to reverse column order * @param reverse true to reverse column order
@ -79,10 +79,10 @@ public class SelectExpression
reverseColumns = reverse; reverseColumns = reverse;
hasFirstSet = firstSet; hasFirstSet = firstSet;
} }
/** /**
* Add an additional column name to a SelectExpression. * Add an additional column name to a SelectExpression.
* *
* @param addTerm * @param addTerm
*/ */
public void and(Term addTerm) public void and(Term addTerm)
@ -90,12 +90,12 @@ public class SelectExpression
assert !isColumnRange(); // Not possible when invoked by parser assert !isColumnRange(); // Not possible when invoked by parser
columns.add(addTerm); columns.add(addTerm);
} }
public boolean isColumnRange() public boolean isColumnRange()
{ {
return (start != null); return (start != null);
} }
public boolean isColumnList() public boolean isColumnList()
{ {
return !isColumnRange(); return !isColumnRange();
@ -109,12 +109,12 @@ public class SelectExpression
{ {
return reverseColumns; return reverseColumns;
} }
public void setColumnsReversed(boolean reversed) public void setColumnsReversed(boolean reversed)
{ {
reverseColumns = reversed; reverseColumns = reversed;
} }
public void setColumnsLimit(int limit) public void setColumnsLimit(int limit)
{ {
numColumns = limit; numColumns = limit;
@ -159,6 +159,6 @@ public class SelectExpression
finish, finish,
columns); columns);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -43,7 +43,7 @@ public class SelectStatement
private final ConsistencyLevel cLevel; private final ConsistencyLevel cLevel;
private final WhereClause clause; private final WhereClause clause;
private final int numRecords; private final int numRecords;
public SelectStatement(SelectExpression expression, boolean isCountOper, String keyspace, String columnFamily, public SelectStatement(SelectExpression expression, boolean isCountOper, String keyspace, String columnFamily,
ConsistencyLevel cLevel, WhereClause clause, int numRecords) ConsistencyLevel cLevel, WhereClause clause, int numRecords)
{ {
@ -55,32 +55,32 @@ public class SelectStatement
this.clause = (clause != null) ? clause : new WhereClause(); this.clause = (clause != null) ? clause : new WhereClause();
this.numRecords = numRecords; this.numRecords = numRecords;
} }
public boolean isKeyRange() public boolean isKeyRange()
{ {
return clause.isKeyRange(); return clause.isKeyRange();
} }
public Set<Term> getKeys() public Set<Term> getKeys()
{ {
return clause.getKeys(); return clause.getKeys();
} }
public Term getKeyStart() public Term getKeyStart()
{ {
return clause.getStartKey(); return clause.getStartKey();
} }
public Term getKeyFinish() public Term getKeyFinish()
{ {
return clause.getFinishKey(); return clause.getFinishKey();
} }
public List<Relation> getColumnRelations() public List<Relation> getColumnRelations()
{ {
return clause.getColumnRelations(); return clause.getColumnRelations();
} }
public boolean isColumnRange() public boolean isColumnRange()
{ {
return expression.isColumnRange(); return expression.isColumnRange();
@ -99,12 +99,12 @@ public class SelectStatement
{ {
return expression.getColumns(); return expression.getColumns();
} }
public Term getColumnStart() public Term getColumnStart()
{ {
return expression.getStart(); return expression.getStart();
} }
public Term getColumnFinish() public Term getColumnFinish()
{ {
return expression.getFinish(); return expression.getFinish();
@ -124,12 +124,12 @@ public class SelectStatement
{ {
return columnFamily; return columnFamily;
} }
public boolean isColumnsReversed() public boolean isColumnsReversed()
{ {
return expression.isColumnsReversed(); return expression.isColumnsReversed();
} }
public ConsistencyLevel getConsistencyLevel() public ConsistencyLevel getConsistencyLevel()
{ {
return cLevel; return cLevel;
@ -144,7 +144,7 @@ public class SelectStatement
{ {
return expression.getColumnsLimit(); return expression.getColumnsLimit();
} }
public boolean isCountOperation() public boolean isCountOperation()
{ {
return isCountOper; return isCountOper;
@ -179,7 +179,7 @@ public class SelectStatement
{ {
return Schema.instance.getComparator(keyspace, columnFamily); return Schema.instance.getComparator(keyspace, columnFamily);
} }
public AbstractType<?> getValueValidator(String keyspace, ByteBuffer column) public AbstractType<?> getValueValidator(String keyspace, ByteBuffer column)
{ {
return Schema.instance.getValueValidator(keyspace, columnFamily, column); return Schema.instance.getValueValidator(keyspace, columnFamily, column);
@ -196,6 +196,6 @@ public class SelectStatement
clause, clause,
numRecords); numRecords);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; 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, SELECT, INSERT, UPDATE, BATCH, USE, TRUNCATE, DELETE, CREATE_KEYSPACE, CREATE_COLUMNFAMILY, CREATE_INDEX, DROP_INDEX,
DROP_KEYSPACE, DROP_COLUMNFAMILY, ALTER_TABLE; DROP_KEYSPACE, DROP_COLUMNFAMILY, ALTER_TABLE;
// Statement types that don't require a keyspace to be set. // Statement types that don't require a keyspace to be set.
private static final EnumSet<StatementType> topLevel = EnumSet.of(USE, CREATE_KEYSPACE, DROP_KEYSPACE); private static final EnumSet<StatementType> topLevel = EnumSet.of(USE, CREATE_KEYSPACE, DROP_KEYSPACE);
public static final EnumSet<StatementType> requiresKeyspace = EnumSet.complementOf(topLevel); public static final EnumSet<StatementType> requiresKeyspace = EnumSet.complementOf(topLevel);

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -47,7 +47,7 @@ public class Term
/** /**
* Create new Term instance from a string, and an integer that corresponds * Create new Term instance from a string, and an integer that corresponds
* with the token ID from CQLParser. * with the token ID from CQLParser.
* *
* @param text the text representation of the term. * @param text the text representation of the term.
* @param type the term's type as an integer token ID. * @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. * Returns the text parsed to create this term.
* *
* @return the string term acquired from a CQL statement. * @return the string term acquired from a CQL statement.
*/ */
public String getText() public String getText()
{ {
return text; return text;
} }
/** /**
* Returns the typed value, serialized to a ByteBuffer according to a * Returns the typed value, serialized to a ByteBuffer according to a
* comparator/validator. * comparator/validator.
* *
* @return a ByteBuffer of the value. * @return a ByteBuffer of the value.
* @throws InvalidRequestException if unable to coerce the string to its type. * @throws InvalidRequestException if unable to coerce the string to its type.
*/ */
@ -94,11 +94,11 @@ public class Term
try try
{ {
if (!isBindMarker()) return validator.fromString(text); if (!isBindMarker()) return validator.fromString(text);
// must be a marker term so check for a CqlBindValue stored in the term // must be a marker term so check for a CqlBindValue stored in the term
if (bindIndex == null) if (bindIndex == null)
throw new AssertionError("a marker Term was encountered with no index value"); throw new AssertionError("a marker Term was encountered with no index value");
return variables.get(bindIndex); return variables.get(bindIndex);
} }
catch (MarshalException e) catch (MarshalException e)
@ -106,10 +106,10 @@ public class Term
throw new InvalidRequestException(e.getMessage()); throw new InvalidRequestException(e.getMessage());
} }
} }
/** /**
* Returns the typed value, serialized to a ByteBuffer. * Returns the typed value, serialized to a ByteBuffer.
* *
* @return a ByteBuffer of the value. * @return a ByteBuffer of the value.
* @throws InvalidRequestException if unable to coerce the string to its type. * @throws InvalidRequestException if unable to coerce the string to its type.
*/ */
@ -119,35 +119,35 @@ public class Term
{ {
case STRING: case STRING:
return AsciiType.instance.fromString(text); return AsciiType.instance.fromString(text);
case INTEGER: case INTEGER:
return IntegerType.instance.fromString(text); return IntegerType.instance.fromString(text);
case UUID: case UUID:
// we specifically want the Lexical class here, not "UUIDType," because we're supposed to have // 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). // 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); return LexicalUUIDType.instance.fromString(text);
case FLOAT: case FLOAT:
return FloatType.instance.fromString(text); return FloatType.instance.fromString(text);
} }
// FIXME: handle scenario that should never happen // FIXME: handle scenario that should never happen
return null; return null;
} }
/** /**
* Obtain the term's type. * Obtain the term's type.
* *
* @return the type * @return the type
*/ */
public TermType getType() public TermType getType()
{ {
return type; return type;
} }
public String toString() public String toString()
{ {
return String.format("Term(%s, type=%s)", getText(), type); return String.format("Term(%s, type=%s)", getText(), type);
} }
public boolean isBindMarker() public boolean isBindMarker()
{ {
return type==TermType.QMARK; return type==TermType.QMARK;
@ -173,7 +173,7 @@ public class Term
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
Term other = (Term) obj; 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 (text == null)
{ {
if (other.text != null) if (other.text != null)
@ -185,13 +185,13 @@ public class Term
return true; return true;
} }
} }
enum TermType enum TermType
{ {
STRING, INTEGER, UUID, FLOAT, QMARK; STRING, INTEGER, UUID, FLOAT, QMARK;
static TermType forInt(int type) static TermType forInt(int type)
{ {
if ((type == CqlParser.STRING_LITERAL) || (type == CqlParser.IDENT)) if ((type == CqlParser.STRING_LITERAL) || (type == CqlParser.IDENT))
@ -204,7 +204,7 @@ enum TermType
return FLOAT; return FLOAT;
else if (type == CqlParser.QMARK) else if (type == CqlParser.QMARK)
return QMARK; return QMARK;
// FIXME: handled scenario that should never occur. // FIXME: handled scenario that should never occur.
return null; return null;
} }

View File

@ -1,5 +1,5 @@
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
@ -73,7 +73,7 @@ public class UpdateStatement extends AbstractModification
this.columns = columns; this.columns = columns;
this.keys = keys; this.keys = keys;
} }
/** /**
* Creates a new UpdateStatement from a column family name, a consistency level, * 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 * 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 * Returns the consistency level of this <code>UPDATE</code> statement, either
* one parsed from the CQL statement, or the default level otherwise. * one parsed from the CQL statement, or the default level otherwise.
* *
* @return the consistency level as a Thrift enum. * @return the consistency level as a Thrift enum.
*/ */
public ConsistencyLevel getConsistencyLevel() public ConsistencyLevel getConsistencyLevel()
{ {
return (cLevel != null) ? cLevel : defaultConsistency; return (cLevel != null) ? cLevel : defaultConsistency;
} }
/** /**
* True if an explicit consistency level was parsed from the statement. * True if an explicit consistency level was parsed from the statement.
* *
* @return true if a consistency was parsed, false otherwise. * @return true if a consistency was parsed, false otherwise.
*/ */
public boolean isSetConsistencyLevel() public boolean isSetConsistencyLevel()
@ -244,29 +244,29 @@ public class UpdateStatement extends AbstractModification
{ {
return keys; return keys;
} }
public Map<Term, Operation> getColumns() throws InvalidRequestException public Map<Term, Operation> getColumns() throws InvalidRequestException
{ {
// Created from an UPDATE // Created from an UPDATE
if (columns != null) if (columns != null)
return columns; return columns;
// Created from an INSERT // Created from an INSERT
// Don't hate, validate. // Don't hate, validate.
if (columnNames.size() != columnValues.size()) if (columnNames.size() != columnValues.size())
throw new InvalidRequestException("unmatched column names/values"); throw new InvalidRequestException("unmatched column names/values");
if (columnNames.size() < 1) if (columnNames.size() < 1)
throw new InvalidRequestException("no columns specified for INSERT"); throw new InvalidRequestException("no columns specified for INSERT");
columns = new HashMap<Term, Operation>(); columns = new HashMap<Term, Operation>();
for (int i = 0; i < columnNames.size(); i++) for (int i = 0; i < columnNames.size(); i++)
columns.put(columnNames.get(i), new Operation(columnValues.get(i))); columns.put(columnNames.get(i), new Operation(columnValues.get(i)));
return columns; return columns;
} }
public String toString() public String toString()
{ {
return String.format("UpdateStatement(keyspace=%s, columnFamily=%s, keys=%s, columns=%s, consistency=%s, timestamp=%s, timeToLive=%s)", 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, timestamp,
timeToLive); timeToLive);
} }
public AbstractType<?> getKeyType(String keyspace) public AbstractType<?> getKeyType(String keyspace)
{ {
return Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator(); return Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();
} }
public AbstractType<?> getComparator(String keyspace) public AbstractType<?> getComparator(String keyspace)
{ {
return Schema.instance.getComparator(keyspace, columnFamily); return Schema.instance.getComparator(keyspace, columnFamily);
} }
public AbstractType<?> getValueValidator(String keyspace, ByteBuffer column) public AbstractType<?> getValueValidator(String keyspace, ByteBuffer column)
{ {
return Schema.instance.getValueValidator(keyspace, columnFamily, column); return Schema.instance.getValueValidator(keyspace, columnFamily, column);
@ -303,5 +303,5 @@ public class UpdateStatement extends AbstractModification
{ {
return columnValues; return columnValues;
} }
} }

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql; package org.apache.cassandra.cql;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -50,20 +50,20 @@ public class WhereClause
/** /**
* Create a new WhereClause with the first parsed relation. * Create a new WhereClause with the first parsed relation.
* *
* @param firstRelation key or column relation * @param firstRelation key or column relation
*/ */
public WhereClause(Relation firstRelation) public WhereClause(Relation firstRelation)
{ {
and(firstRelation); and(firstRelation);
} }
public WhereClause() public WhereClause()
{} {}
/** /**
* Add an additional relation to this WHERE clause. * Add an additional relation to this WHERE clause.
* *
* @param relation the relation to add. * @param relation the relation to add.
*/ */
public void and(Relation relation) public void and(Relation relation)
@ -84,22 +84,22 @@ public class WhereClause
{ {
return columns; return columns;
} }
public boolean isKeyRange() public boolean isKeyRange()
{ {
return startKey != null; return startKey != null;
} }
public Term getStartKey() public Term getStartKey()
{ {
return startKey; return startKey;
} }
public Term getFinishKey() public Term getFinishKey()
{ {
return finishKey; return finishKey;
} }
public Set<Term> getKeys() public Set<Term> getKeys()
{ {
return keys; return keys;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -30,7 +30,7 @@ public abstract class AbstractJdbcUUID extends AbstractJdbcType<UUID>
{ {
return obj.toString(); return obj.toString();
} }
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return false; return false;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -32,9 +32,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcAscii extends AbstractJdbcType<String> public class JdbcAscii extends AbstractJdbcType<String>
{ {
public static final JdbcAscii instance = new JdbcAscii(); public static final JdbcAscii instance = new JdbcAscii();
JdbcAscii() {} JdbcAscii() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return true; return true;
@ -96,7 +96,7 @@ public class JdbcAscii extends AbstractJdbcType<String>
{ {
return getString(bytes); return getString(bytes);
} }
public ByteBuffer decompose(String value) public ByteBuffer decompose(String value)
{ {
return ByteBufferUtil.bytes(value, Charsets.US_ASCII); return ByteBufferUtil.bytes(value, Charsets.US_ASCII);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcBoolean extends AbstractJdbcType<Boolean> public class JdbcBoolean extends AbstractJdbcType<Boolean>
{ {
public static final JdbcBoolean instance = new JdbcBoolean(); public static final JdbcBoolean instance = new JdbcBoolean();
JdbcBoolean() {} JdbcBoolean() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return false; 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()); throw new MarshalException("A boolean is stored in exactly 1 byte: "+bytes.remaining());
} }
byte value = bytes.get(bytes.position()); byte value = bytes.get(bytes.position());
return value ==0 ? Boolean.FALSE.toString(): Boolean.TRUE.toString(); 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()); byte value = bytes.get(bytes.position());
return Boolean.valueOf(value ==0 ? false:true); return Boolean.valueOf(value ==0 ? false:true);
} }
public ByteBuffer decompose(Boolean value) public ByteBuffer decompose(Boolean value)
{ {
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -30,7 +30,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcBytes extends AbstractJdbcType<ByteBuffer> public class JdbcBytes extends AbstractJdbcType<ByteBuffer>
{ {
public static final JdbcBytes instance = new JdbcBytes(); public static final JdbcBytes instance = new JdbcBytes();
JdbcBytes() {} JdbcBytes() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
@ -87,7 +87,7 @@ public class JdbcBytes extends AbstractJdbcType<ByteBuffer>
{ {
return bytes.duplicate(); return bytes.duplicate();
} }
public ByteBuffer decompose(ByteBuffer value) public ByteBuffer decompose(ByteBuffer value)
{ {
return value; return value;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
public class JdbcCounterColumn extends JdbcLong public class JdbcCounterColumn extends JdbcLong
{ {
public static final JdbcCounterColumn instance = new JdbcCounterColumn(); public static final JdbcCounterColumn instance = new JdbcCounterColumn();
JdbcCounterColumn() {} JdbcCounterColumn() {}
} }

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -50,11 +50,11 @@ public class JdbcDate extends AbstractJdbcType<Date>
return new SimpleDateFormat(DEFAULT_FORMAT); return new SimpleDateFormat(DEFAULT_FORMAT);
} }
}; };
public static final JdbcDate instance = new JdbcDate(); public static final JdbcDate instance = new JdbcDate();
JdbcDate() {} JdbcDate() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return false; 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()); throw new MarshalException("A date is exactly 8 bytes (stored as a long): " + bytes.remaining());
} }
// uses ISO-8601 formatted string // uses ISO-8601 formatted string
return FORMATTER.get().format(new Date(bytes.getLong(bytes.position()))); 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)); return new Date(ByteBufferUtil.toLong(bytes));
} }
public ByteBuffer decompose(Date value) public ByteBuffer decompose(Date value)
{ {
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.math.BigDecimal; import java.math.BigDecimal;
@ -30,7 +30,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcDecimal extends AbstractJdbcType<BigDecimal> public class JdbcDecimal extends AbstractJdbcType<BigDecimal>
{ {
public static final JdbcDecimal instance = new JdbcDecimal(); public static final JdbcDecimal instance = new JdbcDecimal();
JdbcDecimal() {} JdbcDecimal() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
@ -88,7 +88,7 @@ public class JdbcDecimal extends AbstractJdbcType<BigDecimal>
public BigDecimal compose(ByteBuffer bytes) public BigDecimal compose(ByteBuffer bytes)
{ {
if (bytes == null) return null; if (bytes == null) return null;
// do not consume the contents of the ByteBuffer // do not consume the contents of the ByteBuffer
bytes = bytes.duplicate(); bytes = bytes.duplicate();
int scale = bytes.getInt(); int scale = bytes.getInt();
@ -106,16 +106,16 @@ public class JdbcDecimal extends AbstractJdbcType<BigDecimal>
public ByteBuffer decompose(BigDecimal value) public ByteBuffer decompose(BigDecimal value)
{ {
if (value == null) return ByteBufferUtil.EMPTY_BYTE_BUFFER; if (value == null) return ByteBufferUtil.EMPTY_BYTE_BUFFER;
BigInteger bi = value.unscaledValue(); BigInteger bi = value.unscaledValue();
Integer scale = value.scale(); Integer scale = value.scale();
byte[] bibytes = bi.toByteArray(); byte[] bibytes = bi.toByteArray();
byte[] sbytes = ByteBufferUtil.bytes(scale).array(); byte[] sbytes = ByteBufferUtil.bytes(scale).array();
byte[] bytes = new byte[bi.toByteArray().length+4]; byte[] bytes = new byte[bi.toByteArray().length+4];
for (int i = 0 ; i < 4 ; i++) bytes[i] = sbytes[i]; 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]; for (int i = 4 ; i < bibytes.length+4 ; i++) bytes[i] = bibytes[i-4];
return ByteBuffer.wrap(bytes); return ByteBuffer.wrap(bytes);
} }

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcDouble extends AbstractJdbcType<Double> public class JdbcDouble extends AbstractJdbcType<Double>
{ {
public static final JdbcDouble instance = new JdbcDouble(); public static final JdbcDouble instance = new JdbcDouble();
JdbcDouble() {} JdbcDouble() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return false; return false;
@ -77,7 +77,7 @@ public class JdbcDouble extends AbstractJdbcType<Double>
{ {
throw new MarshalException("A double is exactly 8 bytes : "+bytes.remaining()); throw new MarshalException("A double is exactly 8 bytes : "+bytes.remaining());
} }
return ((Double)ByteBufferUtil.toDouble(bytes)).toString(); return ((Double)ByteBufferUtil.toDouble(bytes)).toString();
} }
@ -95,7 +95,7 @@ public class JdbcDouble extends AbstractJdbcType<Double>
{ {
return ByteBufferUtil.toDouble(bytes); return ByteBufferUtil.toDouble(bytes);
} }
public ByteBuffer decompose(Double value) public ByteBuffer decompose(Double value)
{ {
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value); return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcFloat extends AbstractJdbcType<Float> public class JdbcFloat extends AbstractJdbcType<Float>
{ {
public static final JdbcFloat instance = new JdbcFloat(); public static final JdbcFloat instance = new JdbcFloat();
JdbcFloat() {} JdbcFloat() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return false; return false;
@ -77,7 +77,7 @@ public class JdbcFloat extends AbstractJdbcType<Float>
{ {
throw new MarshalException("A float is exactly 4 bytes : "+bytes.remaining()); throw new MarshalException("A float is exactly 4 bytes : "+bytes.remaining());
} }
return ((Float)ByteBufferUtil.toFloat(bytes)).toString(); return ((Float)ByteBufferUtil.toFloat(bytes)).toString();
} }
@ -95,7 +95,7 @@ public class JdbcFloat extends AbstractJdbcType<Float>
{ {
return ByteBufferUtil.toFloat(bytes); return ByteBufferUtil.toFloat(bytes);
} }
public ByteBuffer decompose(Float value) public ByteBuffer decompose(Float value)
{ {
return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value); return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -30,9 +30,9 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class JdbcInteger extends AbstractJdbcType<BigInteger> public class JdbcInteger extends AbstractJdbcType<BigInteger>
{ {
public static final JdbcInteger instance = new JdbcInteger(); public static final JdbcInteger instance = new JdbcInteger();
JdbcInteger() {} JdbcInteger() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return false; return false;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -29,9 +29,9 @@ import org.apache.cassandra.utils.UUIDGen;
public class JdbcLexicalUUID extends AbstractJdbcUUID public class JdbcLexicalUUID extends AbstractJdbcUUID
{ {
public static final JdbcLexicalUUID instance = new JdbcLexicalUUID(); public static final JdbcLexicalUUID instance = new JdbcLexicalUUID();
public JdbcLexicalUUID() {} public JdbcLexicalUUID() {}
public String getString(ByteBuffer bytes) public String getString(ByteBuffer bytes)
{ {
if (bytes.remaining() == 0) if (bytes.remaining() == 0)

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -29,9 +29,9 @@ import org.apache.cassandra.utils.UUIDGen;
public class JdbcTimeUUID extends AbstractJdbcUUID public class JdbcTimeUUID extends AbstractJdbcUUID
{ {
public static final JdbcTimeUUID instance = new JdbcTimeUUID(); public static final JdbcTimeUUID instance = new JdbcTimeUUID();
JdbcTimeUUID() {} JdbcTimeUUID() {}
public String getString(ByteBuffer bytes) public String getString(ByteBuffer bytes)
{ {
if (bytes.remaining() == 0) if (bytes.remaining() == 0)

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -32,9 +32,9 @@ import com.google.common.base.Charsets;
public class JdbcUTF8 extends AbstractJdbcType<String> public class JdbcUTF8 extends AbstractJdbcType<String>
{ {
public static final JdbcUTF8 instance = new JdbcUTF8(); public static final JdbcUTF8 instance = new JdbcUTF8();
public JdbcUTF8() {} public JdbcUTF8() {}
public boolean isCaseSensitive() public boolean isCaseSensitive()
{ {
return true; return true;

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -29,9 +29,9 @@ import org.apache.cassandra.utils.UUIDGen;
public class JdbcUUID extends AbstractJdbcUUID public class JdbcUUID extends AbstractJdbcUUID
{ {
public static final JdbcUUID instance = new JdbcUUID(); public static final JdbcUUID instance = new JdbcUUID();
JdbcUUID() {} JdbcUUID() {}
public UUID compose(ByteBuffer bytes) public UUID compose(ByteBuffer bytes)
{ {
bytes = bytes.slice(); bytes = bytes.slice();
@ -50,7 +50,7 @@ public class JdbcUUID extends AbstractJdbcUUID
{ {
throw new MarshalException("UUIDs must be exactly 16 bytes"); throw new MarshalException("UUIDs must be exactly 16 bytes");
} }
return compose(bytes).toString(); return compose(bytes).toString();
} }

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.cql.jdbc; package org.apache.cassandra.cql.jdbc;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -27,7 +27,7 @@ import java.util.Map;
public class TypesMap public class TypesMap
{ {
private final static Map<String, AbstractJdbcType<?>> map = new HashMap<String, AbstractJdbcType<?>>(); private final static Map<String, AbstractJdbcType<?>> map = new HashMap<String, AbstractJdbcType<?>>();
static static
{ {
map.put("org.apache.cassandra.db.marshal.AsciiType", JdbcAscii.instance); 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.UTF8Type", JdbcUTF8.instance);
map.put("org.apache.cassandra.db.marshal.UUIDType", JdbcUUID.instance); map.put("org.apache.cassandra.db.marshal.UUIDType", JdbcUUID.instance);
} }
public static AbstractJdbcType<?> getTypeForComparator(String comparator) public static AbstractJdbcType<?> getTypeForComparator(String comparator)
{ {
// If not fully qualified, assume it's the short name for a built-in. // 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()) for (Map.Entry<ColumnIdentifier, String> col : columns.entrySet())
{ {
AbstractType<?> validator = CFPropDefs.parseType(col.getValue()); AbstractType<?> validator = CFPropDefs.parseType(col.getValue());
columnDefs.put(col.getKey().key, new ColumnDefinition(col.getKey().key, validator, null, null, null)); 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(); ColumnFamily returnCF = container.cloneMeShallow();
filter.collateColumns(returnCF, Collections.singletonList(toCollate), gcBefore); filter.collateColumns(returnCF, Collections.singletonList(toCollate), gcBefore);
// "hoist up" the requested data into a more recent sstable // "hoist up" the requested data into a more recent sstable
if (sstablesIterated > cfs.getMinimumCompactionThreshold() if (sstablesIterated > cfs.getMinimumCompactionThreshold()
&& !cfs.isCompactionDisabled() && !cfs.isCompactionDisabled()

View File

@ -243,7 +243,7 @@ public class Column implements IColumn
{ {
return localCopy(cfs, HeapAllocator.instance); return localCopy(cfs, HeapAllocator.instance);
} }
public IColumn localCopy(ColumnFamilyStore cfs, Allocator allocator) public IColumn localCopy(ColumnFamilyStore cfs, Allocator allocator)
{ {
return new Column(cfs.internOrCopy(name, allocator), allocator.clone(value), timestamp); 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; assert cfm != null;
this.cfm = cfm; this.cfm = cfm;
} }
public ColumnFamily cloneMeShallow(ISortedColumns.Factory factory, boolean reversedInsertOrder) public ColumnFamily cloneMeShallow(ISortedColumns.Factory factory, boolean reversedInsertOrder)
{ {
ColumnFamily cf = ColumnFamily.create(cfm, factory, reversedInsertOrder); ColumnFamily cf = ColumnFamily.create(cfm, factory, reversedInsertOrder);

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db; package org.apache.cassandra.db;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

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

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db; package org.apache.cassandra.db;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
@ -37,7 +37,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
public class ColumnSerializer implements IColumnSerializer public class ColumnSerializer implements IColumnSerializer
{ {
private static final Logger logger = LoggerFactory.getLogger(ColumnSerializer.class); private static final Logger logger = LoggerFactory.getLogger(ColumnSerializer.class);
public final static int DELETION_MASK = 0x01; public final static int DELETION_MASK = 0x01;
public final static int EXPIRATION_MASK = 0x02; public final static int EXPIRATION_MASK = 0x02;
public final static int COUNTER_MASK = 0x04; 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; import org.apache.cassandra.utils.HeapAllocator;
public class DeletedColumn extends Column public class DeletedColumn extends Column
{ {
public DeletedColumn(ByteBuffer name, int localDeletionTime, long timestamp) public DeletedColumn(ByteBuffer name, int localDeletionTime, long timestamp)
{ {
this(name, ByteBufferUtil.bytes(localDeletionTime), timestamp); this(name, ByteBufferUtil.bytes(localDeletionTime), timestamp);
@ -57,7 +57,7 @@ public class DeletedColumn extends Column
return super.reconcile(column, allocator); return super.reconcile(column, allocator);
return column.reconcile(this, allocator); return column.reconcile(this, allocator);
} }
@Override @Override
public IColumn localCopy(ColumnFamilyStore cfs) public IColumn localCopy(ColumnFamilyStore cfs)
{ {

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db; package org.apache.cassandra.db;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

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

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db; package org.apache.cassandra.db;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
import java.nio.ByteBuffer; import java.nio.ByteBuffer;

View File

@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "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 * @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) public Iterator<Map.Entry<DecoratedKey, ColumnFamily>> getEntryIterator(final RowPosition startWith, final RowPosition stopAt)
{ {

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db; package org.apache.cassandra.db;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

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

View File

@ -57,7 +57,7 @@ public abstract class ReadCommand implements MessageProducer, IReadCommand
public final QueryPath queryPath; public final QueryPath queryPath;
public final String table; public final String table;
public final ByteBuffer key; public final ByteBuffer key;
private boolean isDigestQuery = false; private boolean isDigestQuery = false;
protected final byte commandType; protected final byte commandType;
protected ReadCommand(String table, ByteBuffer key, QueryPath queryPath, byte cmdType) 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> class ReadCommandSerializer implements IVersionedSerializer<ReadCommand>
{ {
private static final Map<Byte, IVersionedSerializer<ReadCommand>> CMD_SERIALIZER_MAP = new HashMap<Byte, 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_BY_NAMES, new SliceByNamesReadCommandSerializer());
CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE, new SliceFromReadCommandSerializer()); 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; import org.apache.cassandra.net.MessagingService;
public class ReadRepairVerbHandler implements IVerbHandler public class ReadRepairVerbHandler implements IVerbHandler
{ {
public void doVerb(Message message, String id) public void doVerb(Message message, String id)
{ {
byte[] body = message.getMessageBody(); byte[] body = message.getMessageBody();
FastByteArrayInputStream buffer = new FastByteArrayInputStream(body); FastByteArrayInputStream buffer = new FastByteArrayInputStream(body);
try try
{ {
RowMutation rm = RowMutation.serializer().deserialize(new DataInputStream(buffer), message.getVersion()); 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. * 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. * 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_; return serializer_;
} }
private final Row row_; private final Row row_;
private final ByteBuffer digest_; private final ByteBuffer digest_;
@ -62,12 +62,12 @@ private static IVersionedSerializer<ReadResponse> serializer_;
digest_ = null; digest_ = null;
} }
public Row row() public Row row()
{ {
return row_; return row_;
} }
public ByteBuffer digest() public ByteBuffer digest()
{ {
return digest_; return digest_;
} }
@ -89,7 +89,7 @@ class ReadResponseSerializer implements IVersionedSerializer<ReadResponse>
if (!response.isDigestQuery()) if (!response.isDigestQuery())
Row.serializer().serialize(response.row(), dos, version); Row.serializer().serialize(response.row(), dos, version);
} }
public ReadResponse deserialize(DataInput dis, int version) throws IOException public ReadResponse deserialize(DataInput dis, int version) throws IOException
{ {
byte[] digest = null; 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 * Get a row iterator over the provided memtables and sstables, between the provided keys
* and filtered by the queryfilter. * and filtered by the queryfilter.

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db; package org.apache.cassandra.db;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -74,7 +74,7 @@ public class SystemTable
{ {
return StorageService.getPartitioner().decorateKey(key); return StorageService.getPartitioner().decorateKey(key);
} }
public static void finishStartup() throws IOException public static void finishStartup() throws IOException
{ {
setupVersion(); setupVersion();
@ -273,13 +273,13 @@ public class SystemTable
ex.initCause(err); ex.initCause(err);
throw ex; throw ex;
} }
SortedSet<ByteBuffer> cols = new TreeSet<ByteBuffer>(BytesType.instance); SortedSet<ByteBuffer> cols = new TreeSet<ByteBuffer>(BytesType.instance);
cols.add(CLUSTERNAME); cols.add(CLUSTERNAME);
QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF), cols); QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF), cols);
ColumnFamilyStore cfs = table.getColumnFamilyStore(STATUS_CF); ColumnFamilyStore cfs = table.getColumnFamilyStore(STATUS_CF);
ColumnFamily cf = cfs.getColumnFamily(filter); ColumnFamily cf = cfs.getColumnFamily(filter);
if (cf == null) if (cf == null)
{ {
// this is a brand new node // this is a brand new node
@ -295,8 +295,8 @@ public class SystemTable
return; return;
} }
IColumn clusterCol = cf.getColumn(CLUSTERNAME); IColumn clusterCol = cf.getColumn(CLUSTERNAME);
assert clusterCol != null; assert clusterCol != null;
String savedClusterName = ByteBufferUtil.string(clusterCol.value()); String savedClusterName = ByteBufferUtil.string(clusterCol.value());
@ -352,7 +352,7 @@ public class SystemTable
return generation; return generation;
} }
public static boolean isBootstrapped() public static boolean isBootstrapped()
{ {
Table table = Table.open(Table.SYSTEM_TABLE); Table table = Table.open(Table.SYSTEM_TABLE);
@ -369,7 +369,7 @@ public class SystemTable
public static void setBootstrapped(boolean isBootstrapped) public static void setBootstrapped(boolean isBootstrapped)
{ {
ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF); 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) }), ByteBuffer.wrap(new byte[] { (byte) (isBootstrapped ? 1 : 0) }),
FBUtilities.timestampMicros())); FBUtilities.timestampMicros()));
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, BOOTSTRAP_KEY); 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 // 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. // proper directories here as well as in CassandraDaemon.
static static
{ {
if (!StorageService.instance.isClientMode()) if (!StorageService.instance.isClientMode())
{ {
try try
{ {
@ -145,7 +145,7 @@ public class Table
return t; return t;
} }
} }
public Collection<ColumnFamilyStore> getColumnFamilyStores() public Collection<ColumnFamilyStore> getColumnFamilyStores()
{ {
return Collections.unmodifiableCollection(columnFamilyStores.values()); 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 * 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 * @param snapshotName the tag associated with the name of the snapshot. This value may not be null
*/ */
public void snapshot(String snapshotName) public void snapshot(String snapshotName)
@ -253,7 +253,7 @@ public class Table
cfStore.clearSnapshot(snapshotName); cfStore.clearSnapshot(snapshotName);
} }
} }
/** /**
* @return A list of open SSTableReaders * @return A list of open SSTableReaders
*/ */
@ -295,7 +295,7 @@ public class Table
{ {
if (replicationStrategy != null) if (replicationStrategy != null)
StorageService.instance.getTokenMetadata().unregister(replicationStrategy); StorageService.instance.getTokenMetadata().unregister(replicationStrategy);
replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name, replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name,
ksm.strategyClass, ksm.strategyClass,
StorageService.instance.getTokenMetadata(), StorageService.instance.getTokenMetadata(),
@ -310,10 +310,10 @@ public class Table
ColumnFamilyStore cfs = columnFamilyStores.remove(cfId); ColumnFamilyStore cfs = columnFamilyStores.remove(cfId);
if (cfs == null) if (cfs == null)
return; return;
unloadCf(cfs); unloadCf(cfs);
} }
// disassociate a cfs from this table instance. // disassociate a cfs from this table instance.
private void unloadCf(ColumnFamilyStore cfs) throws IOException private void unloadCf(ColumnFamilyStore cfs) throws IOException
{ {
@ -331,7 +331,7 @@ public class Table
} }
cfs.invalidate(); cfs.invalidate();
} }
/** adds a cf to internal structures, ends up creating disk files). */ /** adds a cf to internal structures, ends up creating disk files). */
public void initCf(Integer cfId, String cfName) public void initCf(Integer cfId, String cfName)
{ {
@ -386,7 +386,7 @@ public class Table
{ {
if (writeCommitLog) if (writeCommitLog)
CommitLog.instance.add(mutation); CommitLog.instance.add(mutation);
DecoratedKey<?> key = StorageService.getPartitioner().decorateKey(mutation.key()); DecoratedKey<?> key = StorageService.getPartitioner().decorateKey(mutation.key());
for (ColumnFamily cf : mutation.getColumnFamilies()) for (ColumnFamily cf : mutation.getColumnFamilies())
{ {

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator; package org.apache.cassandra.db.columniterator;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator; package org.apache.cassandra.db.columniterator;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator; package org.apache.cassandra.db.columniterator;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.db.columniterator; package org.apache.cassandra.db.columniterator;
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * 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 * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */

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