Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B590F8D5 for ; Thu, 2 May 2013 21:50:00 +0000 (UTC) Received: (qmail 76412 invoked by uid 500); 2 May 2013 21:50:00 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 76389 invoked by uid 500); 2 May 2013 21:50:00 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 76382 invoked by uid 99); 2 May 2013 21:50:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 21:50:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 21:49:49 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8AD2623889FA; Thu, 2 May 2013 21:49:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1478583 [1/3] - in /accumulo/trunk: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ core/src/main/java/org/apache/accumulo/core/client/mapreduce/l... Date: Thu, 02 May 2013 21:49:25 -0000 To: commits@accumulo.apache.org From: kturner@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130502214926.8AD2623889FA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kturner Date: Thu May 2 21:49:24 2013 New Revision: 1478583 URL: http://svn.apache.org/r1478583 Log: ACCUMULO-1369 updated shell commands to support per table classpaths Added: accumulo/trunk/test/src/test/resources/FooConstraint.jar - copied unchanged from r1478511, accumulo/branches/1.5/test/src/test/resources/FooConstraint.jar Modified: accumulo/trunk/ (props changed) accumulo/trunk/assemble/ (props changed) accumulo/trunk/core/ (props changed) accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java accumulo/trunk/core/src/main/thrift/client.thrift accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java accumulo/trunk/examples/ (props changed) accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (props changed) accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java (props changed) accumulo/trunk/pom.xml (props changed) accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java accumulo/trunk/proxy/src/main/thrift/proxy.thrift accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java accumulo/trunk/server/ (props changed) accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java accumulo/trunk/src/ (props changed) accumulo/trunk/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java Propchange: accumulo/trunk/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5:r1478511 Propchange: accumulo/trunk/assemble/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/assemble:r1478511 Propchange: accumulo/trunk/core/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/core:r1478511 Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java Thu May 2 21:49:24 2013 @@ -101,7 +101,8 @@ public interface InstanceOperations { public void ping(String tserver) throws AccumuloException; /** - * Test to see if the instance can load the given class as the given type. + * Test to see if the instance can load the given class as the given type. This check does not consider per table classpaths, see + * {@link TableOperations#testClassLoad(String, String, String)} * * @param className * @param asTypeName Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java Thu May 2 21:49:24 2013 @@ -681,7 +681,6 @@ public interface TableOperations { */ public Map listConstraints(String tableName) throws AccumuloException, TableNotFoundException; - /** * Gets the number of bytes being used in the files for a set of tables * @@ -692,5 +691,18 @@ public interface TableOperations { * @throws AccumuloSecurityException */ public List getDiskUsage(Set tables) throws AccumuloException, AccumuloSecurityException, TableNotFoundException; - + + /** + * Test to see if the instance can load the given class as the given type. This check uses the table classpath if it is set. + * + * @param className + * @param asTypeName + * @return true if the instance can load the given class as the given type, false otherwise + * @throws AccumuloException + * + * + * @since 1.5.0 + */ + public boolean testClassLoad(String tableName, final String className, final String asTypeName) throws AccumuloException, AccumuloSecurityException, + TableNotFoundException; } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java Thu May 2 21:49:24 2013 @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -69,11 +70,14 @@ import org.apache.accumulo.core.client.s import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.constraints.Constraint; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.file.FileUtil; import org.apache.accumulo.core.iterators.IteratorUtil; +import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; +import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.TableOperation; @@ -1301,4 +1305,47 @@ public class TableOperationsImpl extends throw new RuntimeException(e1); } } + + @Override + public boolean testClassLoad(final String tableName, final String className, final String asTypeName) throws TableNotFoundException, AccumuloException, + AccumuloSecurityException { + ArgumentChecker.notNull(tableName, className, asTypeName); + + + try { + return ServerClient.executeRaw(instance, new ClientExecReturn() { + @Override + public Boolean execute(ClientService.Client client) throws Exception { + return client.checkTableClass(Tracer.traceInfo(), credentials, tableName, className, asTypeName); + } + }); + } catch (ThriftTableOperationException e) { + switch (e.getType()) { + case NOTFOUND: + throw new TableNotFoundException(e); + case OTHER: + default: + throw new AccumuloException(e.description, e); + } + } catch (ThriftSecurityException e) { + throw new AccumuloSecurityException(e.user, e.code, e); + } catch (AccumuloException e) { + throw e; + } catch (Exception e) { + throw new AccumuloException(e); + } + } + + @Override + public void attachIterator(String tableName, IteratorSetting setting, EnumSet scopes) throws AccumuloSecurityException, AccumuloException, + TableNotFoundException { + testClassLoad(tableName, setting.getIteratorClass(), SortedKeyValueIterator.class.getName()); + super.attachIterator(tableName, setting, scopes); + } + + @Override + public int addConstraint(String tableName, String constraintClassName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { + testClassLoad(tableName, constraintClassName, Constraint.class.getName()); + return super.addConstraint(tableName, constraintClassName); + } } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java Thu May 2 21:49:24 2013 @@ -96,6 +96,8 @@ import org.slf4j.LoggerFactory; public boolean checkClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String className, String interfaceMatch) throws org.apache.thrift.TException; + public boolean checkTableClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableId, String className, String interfaceMatch) throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException; + } public interface AsyncIface { @@ -146,6 +148,8 @@ import org.slf4j.LoggerFactory; public void checkClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void checkTableClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableId, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -782,6 +786,39 @@ import org.slf4j.LoggerFactory; throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkClass failed: unknown result"); } + public boolean checkTableClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableId, String className, String interfaceMatch) throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException + { + send_checkTableClass(tinfo, credentials, tableId, className, interfaceMatch); + return recv_checkTableClass(); + } + + public void send_checkTableClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableId, String className, String interfaceMatch) throws org.apache.thrift.TException + { + checkTableClass_args args = new checkTableClass_args(); + args.setTinfo(tinfo); + args.setCredentials(credentials); + args.setTableId(tableId); + args.setClassName(className); + args.setInterfaceMatch(interfaceMatch); + sendBase("checkTableClass", args); + } + + public boolean recv_checkTableClass() throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException + { + checkTableClass_result result = new checkTableClass_result(); + receiveBase(result, "checkTableClass"); + if (result.isSetSuccess()) { + return result.success; + } + if (result.sec != null) { + throw result.sec; + } + if (result.tope != null) { + throw result.tope; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkTableClass failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { @@ -1683,6 +1720,50 @@ import org.slf4j.LoggerFactory; } } + public void checkTableClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableId, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + checkTableClass_call method_call = new checkTableClass_call(tinfo, credentials, tableId, className, interfaceMatch, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class checkTableClass_call extends org.apache.thrift.async.TAsyncMethodCall { + private org.apache.accumulo.trace.thrift.TInfo tinfo; + private org.apache.accumulo.core.security.thrift.TCredentials credentials; + private String tableId; + private String className; + private String interfaceMatch; + public checkTableClass_call(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableId, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.tinfo = tinfo; + this.credentials = credentials; + this.tableId = tableId; + this.className = className; + this.interfaceMatch = interfaceMatch; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("checkTableClass", org.apache.thrift.protocol.TMessageType.CALL, 0)); + checkTableClass_args args = new checkTableClass_args(); + args.setTinfo(tinfo); + args.setCredentials(credentials); + args.setTableId(tableId); + args.setClassName(className); + args.setInterfaceMatch(interfaceMatch); + args.write(prot); + prot.writeMessageEnd(); + } + + public boolean getResult() throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_checkTableClass(); + } + } + } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -1719,6 +1800,7 @@ import org.slf4j.LoggerFactory; processMap.put("getConfiguration", new getConfiguration()); processMap.put("getTableConfiguration", new getTableConfiguration()); processMap.put("checkClass", new checkClass()); + processMap.put("checkTableClass", new checkTableClass()); return processMap; } @@ -2264,6 +2346,33 @@ import org.slf4j.LoggerFactory; } } + public static class checkTableClass extends org.apache.thrift.ProcessFunction { + public checkTableClass() { + super("checkTableClass"); + } + + public checkTableClass_args getEmptyArgsInstance() { + return new checkTableClass_args(); + } + + protected boolean isOneway() { + return false; + } + + public checkTableClass_result getResult(I iface, checkTableClass_args args) throws org.apache.thrift.TException { + checkTableClass_result result = new checkTableClass_result(); + try { + result.success = iface.checkTableClass(args.tinfo, args.credentials, args.tableId, args.className, args.interfaceMatch); + result.setSuccessIsSet(true); + } catch (ThriftSecurityException sec) { + result.sec = sec; + } catch (ThriftTableOperationException tope) { + result.tope = tope; + } + return result; + } + } + } public static class getRootTabletLocation_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { @@ -25269,4 +25378,1326 @@ import org.slf4j.LoggerFactory; } + public static class checkTableClass_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTableClass_args"); + + private static final org.apache.thrift.protocol.TField TINFO_FIELD_DESC = new org.apache.thrift.protocol.TField("tinfo", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField CREDENTIALS_FIELD_DESC = new org.apache.thrift.protocol.TField("credentials", org.apache.thrift.protocol.TType.STRUCT, (short)5); + private static final org.apache.thrift.protocol.TField TABLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tableId", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField INTERFACE_MATCH_FIELD_DESC = new org.apache.thrift.protocol.TField("interfaceMatch", org.apache.thrift.protocol.TType.STRING, (short)4); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new checkTableClass_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new checkTableClass_argsTupleSchemeFactory()); + } + + public org.apache.accumulo.trace.thrift.TInfo tinfo; // required + public org.apache.accumulo.core.security.thrift.TCredentials credentials; // required + public String tableId; // required + public String className; // required + public String interfaceMatch; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + TINFO((short)1, "tinfo"), + CREDENTIALS((short)5, "credentials"), + TABLE_ID((short)2, "tableId"), + CLASS_NAME((short)3, "className"), + INTERFACE_MATCH((short)4, "interfaceMatch"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // TINFO + return TINFO; + case 5: // CREDENTIALS + return CREDENTIALS; + case 2: // TABLE_ID + return TABLE_ID; + case 3: // CLASS_NAME + return CLASS_NAME; + case 4: // INTERFACE_MATCH + return INTERFACE_MATCH; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.TINFO, new org.apache.thrift.meta_data.FieldMetaData("tinfo", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.trace.thrift.TInfo.class))); + tmpMap.put(_Fields.CREDENTIALS, new org.apache.thrift.meta_data.FieldMetaData("credentials", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.security.thrift.TCredentials.class))); + tmpMap.put(_Fields.TABLE_ID, new org.apache.thrift.meta_data.FieldMetaData("tableId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("className", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.INTERFACE_MATCH, new org.apache.thrift.meta_data.FieldMetaData("interfaceMatch", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(checkTableClass_args.class, metaDataMap); + } + + public checkTableClass_args() { + } + + public checkTableClass_args( + org.apache.accumulo.trace.thrift.TInfo tinfo, + org.apache.accumulo.core.security.thrift.TCredentials credentials, + String tableId, + String className, + String interfaceMatch) + { + this(); + this.tinfo = tinfo; + this.credentials = credentials; + this.tableId = tableId; + this.className = className; + this.interfaceMatch = interfaceMatch; + } + + /** + * Performs a deep copy on other. + */ + public checkTableClass_args(checkTableClass_args other) { + if (other.isSetTinfo()) { + this.tinfo = new org.apache.accumulo.trace.thrift.TInfo(other.tinfo); + } + if (other.isSetCredentials()) { + this.credentials = new org.apache.accumulo.core.security.thrift.TCredentials(other.credentials); + } + if (other.isSetTableId()) { + this.tableId = other.tableId; + } + if (other.isSetClassName()) { + this.className = other.className; + } + if (other.isSetInterfaceMatch()) { + this.interfaceMatch = other.interfaceMatch; + } + } + + public checkTableClass_args deepCopy() { + return new checkTableClass_args(this); + } + + @Override + public void clear() { + this.tinfo = null; + this.credentials = null; + this.tableId = null; + this.className = null; + this.interfaceMatch = null; + } + + public org.apache.accumulo.trace.thrift.TInfo getTinfo() { + return this.tinfo; + } + + public checkTableClass_args setTinfo(org.apache.accumulo.trace.thrift.TInfo tinfo) { + this.tinfo = tinfo; + return this; + } + + public void unsetTinfo() { + this.tinfo = null; + } + + /** Returns true if field tinfo is set (has been assigned a value) and false otherwise */ + public boolean isSetTinfo() { + return this.tinfo != null; + } + + public void setTinfoIsSet(boolean value) { + if (!value) { + this.tinfo = null; + } + } + + public org.apache.accumulo.core.security.thrift.TCredentials getCredentials() { + return this.credentials; + } + + public checkTableClass_args setCredentials(org.apache.accumulo.core.security.thrift.TCredentials credentials) { + this.credentials = credentials; + return this; + } + + public void unsetCredentials() { + this.credentials = null; + } + + /** Returns true if field credentials is set (has been assigned a value) and false otherwise */ + public boolean isSetCredentials() { + return this.credentials != null; + } + + public void setCredentialsIsSet(boolean value) { + if (!value) { + this.credentials = null; + } + } + + public String getTableId() { + return this.tableId; + } + + public checkTableClass_args setTableId(String tableId) { + this.tableId = tableId; + return this; + } + + public void unsetTableId() { + this.tableId = null; + } + + /** Returns true if field tableId is set (has been assigned a value) and false otherwise */ + public boolean isSetTableId() { + return this.tableId != null; + } + + public void setTableIdIsSet(boolean value) { + if (!value) { + this.tableId = null; + } + } + + public String getClassName() { + return this.className; + } + + public checkTableClass_args setClassName(String className) { + this.className = className; + return this; + } + + public void unsetClassName() { + this.className = null; + } + + /** Returns true if field className is set (has been assigned a value) and false otherwise */ + public boolean isSetClassName() { + return this.className != null; + } + + public void setClassNameIsSet(boolean value) { + if (!value) { + this.className = null; + } + } + + public String getInterfaceMatch() { + return this.interfaceMatch; + } + + public checkTableClass_args setInterfaceMatch(String interfaceMatch) { + this.interfaceMatch = interfaceMatch; + return this; + } + + public void unsetInterfaceMatch() { + this.interfaceMatch = null; + } + + /** Returns true if field interfaceMatch is set (has been assigned a value) and false otherwise */ + public boolean isSetInterfaceMatch() { + return this.interfaceMatch != null; + } + + public void setInterfaceMatchIsSet(boolean value) { + if (!value) { + this.interfaceMatch = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TINFO: + if (value == null) { + unsetTinfo(); + } else { + setTinfo((org.apache.accumulo.trace.thrift.TInfo)value); + } + break; + + case CREDENTIALS: + if (value == null) { + unsetCredentials(); + } else { + setCredentials((org.apache.accumulo.core.security.thrift.TCredentials)value); + } + break; + + case TABLE_ID: + if (value == null) { + unsetTableId(); + } else { + setTableId((String)value); + } + break; + + case CLASS_NAME: + if (value == null) { + unsetClassName(); + } else { + setClassName((String)value); + } + break; + + case INTERFACE_MATCH: + if (value == null) { + unsetInterfaceMatch(); + } else { + setInterfaceMatch((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TINFO: + return getTinfo(); + + case CREDENTIALS: + return getCredentials(); + + case TABLE_ID: + return getTableId(); + + case CLASS_NAME: + return getClassName(); + + case INTERFACE_MATCH: + return getInterfaceMatch(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case TINFO: + return isSetTinfo(); + case CREDENTIALS: + return isSetCredentials(); + case TABLE_ID: + return isSetTableId(); + case CLASS_NAME: + return isSetClassName(); + case INTERFACE_MATCH: + return isSetInterfaceMatch(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof checkTableClass_args) + return this.equals((checkTableClass_args)that); + return false; + } + + public boolean equals(checkTableClass_args that) { + if (that == null) + return false; + + boolean this_present_tinfo = true && this.isSetTinfo(); + boolean that_present_tinfo = true && that.isSetTinfo(); + if (this_present_tinfo || that_present_tinfo) { + if (!(this_present_tinfo && that_present_tinfo)) + return false; + if (!this.tinfo.equals(that.tinfo)) + return false; + } + + boolean this_present_credentials = true && this.isSetCredentials(); + boolean that_present_credentials = true && that.isSetCredentials(); + if (this_present_credentials || that_present_credentials) { + if (!(this_present_credentials && that_present_credentials)) + return false; + if (!this.credentials.equals(that.credentials)) + return false; + } + + boolean this_present_tableId = true && this.isSetTableId(); + boolean that_present_tableId = true && that.isSetTableId(); + if (this_present_tableId || that_present_tableId) { + if (!(this_present_tableId && that_present_tableId)) + return false; + if (!this.tableId.equals(that.tableId)) + return false; + } + + boolean this_present_className = true && this.isSetClassName(); + boolean that_present_className = true && that.isSetClassName(); + if (this_present_className || that_present_className) { + if (!(this_present_className && that_present_className)) + return false; + if (!this.className.equals(that.className)) + return false; + } + + boolean this_present_interfaceMatch = true && this.isSetInterfaceMatch(); + boolean that_present_interfaceMatch = true && that.isSetInterfaceMatch(); + if (this_present_interfaceMatch || that_present_interfaceMatch) { + if (!(this_present_interfaceMatch && that_present_interfaceMatch)) + return false; + if (!this.interfaceMatch.equals(that.interfaceMatch)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(checkTableClass_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + checkTableClass_args typedOther = (checkTableClass_args)other; + + lastComparison = Boolean.valueOf(isSetTinfo()).compareTo(typedOther.isSetTinfo()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTinfo()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tinfo, typedOther.tinfo); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCredentials()).compareTo(typedOther.isSetCredentials()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCredentials()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credentials, typedOther.credentials); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetTableId()).compareTo(typedOther.isSetTableId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTableId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableId, typedOther.tableId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetClassName()).compareTo(typedOther.isSetClassName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetClassName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.className, typedOther.className); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInterfaceMatch()).compareTo(typedOther.isSetInterfaceMatch()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInterfaceMatch()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.interfaceMatch, typedOther.interfaceMatch); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("checkTableClass_args("); + boolean first = true; + + sb.append("tinfo:"); + if (this.tinfo == null) { + sb.append("null"); + } else { + sb.append(this.tinfo); + } + first = false; + if (!first) sb.append(", "); + sb.append("credentials:"); + if (this.credentials == null) { + sb.append("null"); + } else { + sb.append(this.credentials); + } + first = false; + if (!first) sb.append(", "); + sb.append("tableId:"); + if (this.tableId == null) { + sb.append("null"); + } else { + sb.append(this.tableId); + } + first = false; + if (!first) sb.append(", "); + sb.append("className:"); + if (this.className == null) { + sb.append("null"); + } else { + sb.append(this.className); + } + first = false; + if (!first) sb.append(", "); + sb.append("interfaceMatch:"); + if (this.interfaceMatch == null) { + sb.append("null"); + } else { + sb.append(this.interfaceMatch); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (tinfo != null) { + tinfo.validate(); + } + if (credentials != null) { + credentials.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class checkTableClass_argsStandardSchemeFactory implements SchemeFactory { + public checkTableClass_argsStandardScheme getScheme() { + return new checkTableClass_argsStandardScheme(); + } + } + + private static class checkTableClass_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, checkTableClass_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // TINFO + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.tinfo = new org.apache.accumulo.trace.thrift.TInfo(); + struct.tinfo.read(iprot); + struct.setTinfoIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // CREDENTIALS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.credentials = new org.apache.accumulo.core.security.thrift.TCredentials(); + struct.credentials.read(iprot); + struct.setCredentialsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TABLE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.tableId = iprot.readString(); + struct.setTableIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // CLASS_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.className = iprot.readString(); + struct.setClassNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // INTERFACE_MATCH + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.interfaceMatch = iprot.readString(); + struct.setInterfaceMatchIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, checkTableClass_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.tinfo != null) { + oprot.writeFieldBegin(TINFO_FIELD_DESC); + struct.tinfo.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.tableId != null) { + oprot.writeFieldBegin(TABLE_ID_FIELD_DESC); + oprot.writeString(struct.tableId); + oprot.writeFieldEnd(); + } + if (struct.className != null) { + oprot.writeFieldBegin(CLASS_NAME_FIELD_DESC); + oprot.writeString(struct.className); + oprot.writeFieldEnd(); + } + if (struct.interfaceMatch != null) { + oprot.writeFieldBegin(INTERFACE_MATCH_FIELD_DESC); + oprot.writeString(struct.interfaceMatch); + oprot.writeFieldEnd(); + } + if (struct.credentials != null) { + oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); + struct.credentials.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class checkTableClass_argsTupleSchemeFactory implements SchemeFactory { + public checkTableClass_argsTupleScheme getScheme() { + return new checkTableClass_argsTupleScheme(); + } + } + + private static class checkTableClass_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, checkTableClass_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTinfo()) { + optionals.set(0); + } + if (struct.isSetCredentials()) { + optionals.set(1); + } + if (struct.isSetTableId()) { + optionals.set(2); + } + if (struct.isSetClassName()) { + optionals.set(3); + } + if (struct.isSetInterfaceMatch()) { + optionals.set(4); + } + oprot.writeBitSet(optionals, 5); + if (struct.isSetTinfo()) { + struct.tinfo.write(oprot); + } + if (struct.isSetCredentials()) { + struct.credentials.write(oprot); + } + if (struct.isSetTableId()) { + oprot.writeString(struct.tableId); + } + if (struct.isSetClassName()) { + oprot.writeString(struct.className); + } + if (struct.isSetInterfaceMatch()) { + oprot.writeString(struct.interfaceMatch); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, checkTableClass_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(5); + if (incoming.get(0)) { + struct.tinfo = new org.apache.accumulo.trace.thrift.TInfo(); + struct.tinfo.read(iprot); + struct.setTinfoIsSet(true); + } + if (incoming.get(1)) { + struct.credentials = new org.apache.accumulo.core.security.thrift.TCredentials(); + struct.credentials.read(iprot); + struct.setCredentialsIsSet(true); + } + if (incoming.get(2)) { + struct.tableId = iprot.readString(); + struct.setTableIdIsSet(true); + } + if (incoming.get(3)) { + struct.className = iprot.readString(); + struct.setClassNameIsSet(true); + } + if (incoming.get(4)) { + struct.interfaceMatch = iprot.readString(); + struct.setInterfaceMatchIsSet(true); + } + } + } + + } + + public static class checkTableClass_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTableClass_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); + private static final org.apache.thrift.protocol.TField SEC_FIELD_DESC = new org.apache.thrift.protocol.TField("sec", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final org.apache.thrift.protocol.TField TOPE_FIELD_DESC = new org.apache.thrift.protocol.TField("tope", org.apache.thrift.protocol.TType.STRUCT, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new checkTableClass_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new checkTableClass_resultTupleSchemeFactory()); + } + + public boolean success; // required + public ThriftSecurityException sec; // required + public ThriftTableOperationException tope; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"), + SEC((short)1, "sec"), + TOPE((short)2, "tope"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + case 1: // SEC + return SEC; + case 2: // TOPE + return TOPE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __SUCCESS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.SEC, new org.apache.thrift.meta_data.FieldMetaData("sec", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + tmpMap.put(_Fields.TOPE, new org.apache.thrift.meta_data.FieldMetaData("tope", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(checkTableClass_result.class, metaDataMap); + } + + public checkTableClass_result() { + } + + public checkTableClass_result( + boolean success, + ThriftSecurityException sec, + ThriftTableOperationException tope) + { + this(); + this.success = success; + setSuccessIsSet(true); + this.sec = sec; + this.tope = tope; + } + + /** + * Performs a deep copy on other. + */ + public checkTableClass_result(checkTableClass_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + if (other.isSetSec()) { + this.sec = new ThriftSecurityException(other.sec); + } + if (other.isSetTope()) { + this.tope = new ThriftTableOperationException(other.tope); + } + } + + public checkTableClass_result deepCopy() { + return new checkTableClass_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + this.sec = null; + this.tope = null; + } + + public boolean isSuccess() { + return this.success; + } + + public checkTableClass_result setSuccess(boolean success) { + this.success = success; + setSuccessIsSet(true); + return this; + } + + public void unsetSuccess() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + public void setSuccessIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); + } + + public ThriftSecurityException getSec() { + return this.sec; + } + + public checkTableClass_result setSec(ThriftSecurityException sec) { + this.sec = sec; + return this; + } + + public void unsetSec() { + this.sec = null; + } + + /** Returns true if field sec is set (has been assigned a value) and false otherwise */ + public boolean isSetSec() { + return this.sec != null; + } + + public void setSecIsSet(boolean value) { + if (!value) { + this.sec = null; + } + } + + public ThriftTableOperationException getTope() { + return this.tope; + } + + public checkTableClass_result setTope(ThriftTableOperationException tope) { + this.tope = tope; + return this; + } + + public void unsetTope() { + this.tope = null; + } + + /** Returns true if field tope is set (has been assigned a value) and false otherwise */ + public boolean isSetTope() { + return this.tope != null; + } + + public void setTopeIsSet(boolean value) { + if (!value) { + this.tope = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((Boolean)value); + } + break; + + case SEC: + if (value == null) { + unsetSec(); + } else { + setSec((ThriftSecurityException)value); + } + break; + + case TOPE: + if (value == null) { + unsetTope(); + } else { + setTope((ThriftTableOperationException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return Boolean.valueOf(isSuccess()); + + case SEC: + return getSec(); + + case TOPE: + return getTope(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + case SEC: + return isSetSec(); + case TOPE: + return isSetTope(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof checkTableClass_result) + return this.equals((checkTableClass_result)that); + return false; + } + + public boolean equals(checkTableClass_result that) { + if (that == null) + return false; + + boolean this_present_success = true; + boolean that_present_success = true; + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (this.success != that.success) + return false; + } + + boolean this_present_sec = true && this.isSetSec(); + boolean that_present_sec = true && that.isSetSec(); + if (this_present_sec || that_present_sec) { + if (!(this_present_sec && that_present_sec)) + return false; + if (!this.sec.equals(that.sec)) + return false; + } + + boolean this_present_tope = true && this.isSetTope(); + boolean that_present_tope = true && that.isSetTope(); + if (this_present_tope || that_present_tope) { + if (!(this_present_tope && that_present_tope)) + return false; + if (!this.tope.equals(that.tope)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(checkTableClass_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + checkTableClass_result typedOther = (checkTableClass_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetSec()).compareTo(typedOther.isSetSec()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSec()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sec, typedOther.sec); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetTope()).compareTo(typedOther.isSetTope()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTope()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tope, typedOther.tope); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("checkTableClass_result("); + boolean first = true; + + sb.append("success:"); + sb.append(this.success); + first = false; + if (!first) sb.append(", "); + sb.append("sec:"); + if (this.sec == null) { + sb.append("null"); + } else { + sb.append(this.sec); + } + first = false; + if (!first) sb.append(", "); + sb.append("tope:"); + if (this.tope == null) { + sb.append("null"); + } else { + sb.append(this.tope); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class checkTableClass_resultStandardSchemeFactory implements SchemeFactory { + public checkTableClass_resultStandardScheme getScheme() { + return new checkTableClass_resultStandardScheme(); + } + } + + private static class checkTableClass_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, checkTableClass_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 1: // SEC + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.sec = new ThriftSecurityException(); + struct.sec.read(iprot); + struct.setSecIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TOPE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.tope = new ThriftTableOperationException(); + struct.tope.read(iprot); + struct.setTopeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, checkTableClass_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeBool(struct.success); + oprot.writeFieldEnd(); + } + if (struct.sec != null) { + oprot.writeFieldBegin(SEC_FIELD_DESC); + struct.sec.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.tope != null) { + oprot.writeFieldBegin(TOPE_FIELD_DESC); + struct.tope.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class checkTableClass_resultTupleSchemeFactory implements SchemeFactory { + public checkTableClass_resultTupleScheme getScheme() { + return new checkTableClass_resultTupleScheme(); + } + } + + private static class checkTableClass_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, checkTableClass_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + if (struct.isSetSec()) { + optionals.set(1); + } + if (struct.isSetTope()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetSuccess()) { + oprot.writeBool(struct.success); + } + if (struct.isSetSec()) { + struct.sec.write(oprot); + } + if (struct.isSetTope()) { + struct.tope.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, checkTableClass_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { + struct.sec = new ThriftSecurityException(); + struct.sec.read(iprot); + struct.setSecIsSet(true); + } + if (incoming.get(2)) { + struct.tope = new ThriftTableOperationException(); + struct.tope.read(iprot); + struct.setTopeIsSet(true); + } + } + } + + } + } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java Thu May 2 21:49:24 2013 @@ -515,7 +515,7 @@ public class InputConfigurator extends C if (!conf.getBoolean(enumToConfKey(implementingClass, Features.USE_LOCAL_ITERATORS), false)) { // validate that any scan-time iterators can be loaded by the the tablet servers for (IteratorSetting iter : getIterators(implementingClass, conf)) { - if (!c.instanceOperations().testClassLoad(iter.getIteratorClass(), SortedKeyValueIterator.class.getName())) + if (!c.tableOperations().testClassLoad(getInputTableName(implementingClass, conf), iter.getIteratorClass(), SortedKeyValueIterator.class.getName())) throw new AccumuloException("Servers are unable to load " + iter.getIteratorClass() + " as a " + SortedKeyValueIterator.class.getName()); } } @@ -524,6 +524,8 @@ public class InputConfigurator extends C throw new IOException(e); } catch (AccumuloSecurityException e) { throw new IOException(e); + } catch (TableNotFoundException e) { + throw new IOException(e); } } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java Thu May 2 21:49:24 2013 @@ -48,6 +48,7 @@ import org.apache.accumulo.core.file.Fil import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; +import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader; import org.apache.commons.lang.NotImplementedException; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileStatus; @@ -381,4 +382,17 @@ public class MockTableOperations extends public void exportTable(String tableName, String exportDir) throws TableNotFoundException, AccumuloException, AccumuloSecurityException { throw new NotImplementedException(); } + + @Override + public boolean testClassLoad(String tableName, String className, String asTypeName) throws AccumuloException, AccumuloSecurityException, + TableNotFoundException { + + try { + AccumuloVFSClassLoader.loadClass(className, Class.forName(asTypeName)); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + return false; + } + return true; + } } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java Thu May 2 21:49:24 2013 @@ -35,7 +35,7 @@ public class ConstraintCommand extends C switch (OptUtil.getAldOpt(cl)) { case ADD: for (String constraint : cl.getArgs()) { - if (!shellState.getConnector().instanceOperations().testClassLoad(constraint, Constraint.class.getName())) { + if (!shellState.getConnector().tableOperations().testClassLoad(tableName, constraint, Constraint.class.getName())) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + constraint + " as type " + Constraint.class.getName()); } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/InsertCommand.java Thu May 2 21:49:24 2013 @@ -106,6 +106,8 @@ public class InsertCommand extends Comma } shellState.printLines(lines.iterator(), false); + + return 1; } return 0; } Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java Thu May 2 21:49:24 2013 @@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.A import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.iterators.OptionDescriber; import org.apache.accumulo.core.iterators.OptionDescriber.IteratorOptions; @@ -42,10 +43,12 @@ import org.apache.accumulo.core.util.she import org.apache.accumulo.core.util.shell.ShellCommandException; import org.apache.accumulo.core.util.shell.ShellCommandException.ErrorCode; import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader; +import org.apache.accumulo.start.classloader.vfs.ContextManager; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.OptionGroup; import org.apache.commons.cli.Options; +import org.apache.commons.vfs2.FileSystemException; public class SetIterCommand extends Command { @@ -75,11 +78,50 @@ public class SetIterCommand extends Comm classname = ReqVisFilter.class.getName(); } - final String name = cl.getOptionValue(nameOpt.getOpt(), setUpOptions(shellState.getReader(), classname, options)); + ClassLoader classloader = getClassLoader(cl, shellState); + + final String name = cl.getOptionValue(nameOpt.getOpt(), setUpOptions(classloader, shellState.getReader(), classname, options)); setTableProperties(cl, shellState, priority, options, classname, name); return 0; } + + private ClassLoader getClassLoader(final CommandLine cl, final Shell shellState) throws AccumuloException, TableNotFoundException, AccumuloSecurityException, + IOException, FileSystemException { + String classpath = null; + Iterable> tableProps = shellState.getConnector().tableOperations().getProperties(OptUtil.getTableOpt(cl, shellState)); + for (Entry entry : tableProps) { + if (entry.getKey().equals(Property.TABLE_CLASSPATH.getKey())) { + classpath = entry.getValue(); + } + } + + ClassLoader classloader; + + if (classpath != null && !classpath.equals("")) { + shellState.getConnector().instanceOperations().getSystemConfiguration().get(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + classpath); + + try { + AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig(new Iterable>() { + @Override + public Iterator> iterator() { + try { + return shellState.getConnector().instanceOperations().getSystemConfiguration().entrySet().iterator(); + } catch (AccumuloException e) { + throw new RuntimeException(e); + } catch (AccumuloSecurityException e) { + throw new RuntimeException(e); + } + } + })); + } catch (IllegalStateException ise) {} + + classloader = AccumuloVFSClassLoader.getContextManager().getClassLoader(classpath); + } else { + classloader = AccumuloVFSClassLoader.getClassLoader(); + } + return classloader; + } protected void setTableProperties(final CommandLine cl, final Shell shellState, final int priority, final Map options, final String classname, final String name) throws AccumuloException, AccumuloSecurityException, ShellCommandException, TableNotFoundException { @@ -87,7 +129,7 @@ public class SetIterCommand extends Comm final String tableName = OptUtil.getTableOpt(cl, shellState); - if (!shellState.getConnector().instanceOperations().testClassLoad(classname, SortedKeyValueIterator.class.getName())) { + if (!shellState.getConnector().tableOperations().testClassLoad(tableName, classname, SortedKeyValueIterator.class.getName())) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type " + SortedKeyValueIterator.class.getName()); } @@ -95,7 +137,7 @@ public class SetIterCommand extends Comm final String aggregatorClass = options.get("aggregatorClass"); @SuppressWarnings("deprecation") String deprecatedAggregatorClassName = org.apache.accumulo.core.iterators.aggregation.Aggregator.class.getName(); - if (aggregatorClass != null && !shellState.getConnector().instanceOperations().testClassLoad(aggregatorClass, deprecatedAggregatorClassName)) { + if (aggregatorClass != null && !shellState.getConnector().tableOperations().testClassLoad(tableName, aggregatorClass, deprecatedAggregatorClassName)) { throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + aggregatorClass + " as type " + deprecatedAggregatorClassName); } @@ -123,13 +165,14 @@ public class SetIterCommand extends Comm shellState.getConnector().tableOperations().attachIterator(tableName, setting, scopes); } - private static String setUpOptions(final ConsoleReader reader, final String className, final Map options) throws IOException, + private static String setUpOptions(ClassLoader classloader, final ConsoleReader reader, final String className, final Map options) + throws IOException, ShellCommandException { String input; OptionDescriber skvi; Class clazz; try { - clazz = AccumuloVFSClassLoader.loadClass(className, OptionDescriber.class); + clazz = classloader.loadClass(className).asSubclass(OptionDescriber.class); skvi = clazz.newInstance(); } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e.getMessage()); Modified: accumulo/trunk/core/src/main/thrift/client.thrift URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/client.thrift?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/main/thrift/client.thrift (original) +++ accumulo/trunk/core/src/main/thrift/client.thrift Thu May 2 21:49:24 2013 @@ -129,6 +129,7 @@ service ClientService { map getConfiguration(2:trace.TInfo tinfo, 3:security.TCredentials credentials, 1:ConfigurationType type); map getTableConfiguration(1:trace.TInfo tinfo, 3:security.TCredentials credentials, 2:string tableName) throws (1:ThriftTableOperationException tope); bool checkClass(1:trace.TInfo tinfo, 4:security.TCredentials credentials, 2:string className, 3:string interfaceMatch); + bool checkTableClass(1:trace.TInfo tinfo, 5:security.TCredentials credentials, 2:string tableId, 3:string className, 4:string interfaceMatch) throws (1:ThriftSecurityException sec, 2:ThriftTableOperationException tope); } // Only used for a unit test Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java (original) +++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java Thu May 2 21:49:24 2013 @@ -207,6 +207,12 @@ public class TableOperationsHelperTest { @Override public void cancelCompaction(String tableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException {} + + @Override + public boolean testClassLoad(String tableName, String className, String asTypeName) throws AccumuloException, AccumuloSecurityException, + TableNotFoundException { + return false; + } } @Test Propchange: accumulo/trunk/examples/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/examples:r1478511 Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1478511 Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1478511 Propchange: accumulo/trunk/pom.xml ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/pom.xml:r1478511 Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1478583&r1=1478582&r2=1478583&view=diff ============================================================================== --- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original) +++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Thu May 2 21:49:24 2013 @@ -1476,4 +1476,16 @@ public class ProxyServer implements Accu token.init(props); return token; } + + @Override + public boolean testTableClassLoad(ByteBuffer login, String tableName, String className, String asTypeName) + throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, + org.apache.accumulo.proxy.thrift.TableNotFoundException, TException { + try { + return getConnector(login).tableOperations().testClassLoad(tableName, className, asTypeName); + } catch (Exception e) { + handleExceptionTNF(e); + return false; + } + } }