You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/12/05 00:58:43 UTC
[02/50] [abbrv] ACCUMULO-802 updated more shell commands to include
the tableNamespaces option
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java b/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java
index 9eac584..b857c27 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java
@@ -102,6 +102,8 @@ import org.slf4j.LoggerFactory;
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 boolean checkTableNamespaceClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String namespaceId, String className, String interfaceMatch) throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException;
+
}
public interface AsyncIface {
@@ -158,6 +160,8 @@ 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<AsyncClient.checkTableClass_call> resultHandler) throws org.apache.thrift.TException;
+ public void checkTableNamespaceClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String namespaceId, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.checkTableNamespaceClass_call> resultHandler) throws org.apache.thrift.TException;
+
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -885,6 +889,39 @@ import org.slf4j.LoggerFactory;
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkTableClass failed: unknown result");
}
+ public boolean checkTableNamespaceClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String namespaceId, String className, String interfaceMatch) throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException
+ {
+ send_checkTableNamespaceClass(tinfo, credentials, namespaceId, className, interfaceMatch);
+ return recv_checkTableNamespaceClass();
+ }
+
+ public void send_checkTableNamespaceClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String namespaceId, String className, String interfaceMatch) throws org.apache.thrift.TException
+ {
+ checkTableNamespaceClass_args args = new checkTableNamespaceClass_args();
+ args.setTinfo(tinfo);
+ args.setCredentials(credentials);
+ args.setNamespaceId(namespaceId);
+ args.setClassName(className);
+ args.setInterfaceMatch(interfaceMatch);
+ sendBase("checkTableNamespaceClass", args);
+ }
+
+ public boolean recv_checkTableNamespaceClass() throws ThriftSecurityException, ThriftTableOperationException, org.apache.thrift.TException
+ {
+ checkTableNamespaceClass_result result = new checkTableNamespaceClass_result();
+ receiveBase(result, "checkTableNamespaceClass");
+ 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, "checkTableNamespaceClass 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<AsyncClient> {
@@ -1903,6 +1940,50 @@ import org.slf4j.LoggerFactory;
}
}
+ public void checkTableNamespaceClass(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String namespaceId, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback<checkTableNamespaceClass_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ checkTableNamespaceClass_call method_call = new checkTableNamespaceClass_call(tinfo, credentials, namespaceId, className, interfaceMatch, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class checkTableNamespaceClass_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 namespaceId;
+ private String className;
+ private String interfaceMatch;
+ public checkTableNamespaceClass_call(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String namespaceId, String className, String interfaceMatch, org.apache.thrift.async.AsyncMethodCallback<checkTableNamespaceClass_call> 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.namespaceId = namespaceId;
+ 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("checkTableNamespaceClass", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ checkTableNamespaceClass_args args = new checkTableNamespaceClass_args();
+ args.setTinfo(tinfo);
+ args.setCredentials(credentials);
+ args.setNamespaceId(namespaceId);
+ 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_checkTableNamespaceClass();
+ }
+ }
+
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -1942,6 +2023,7 @@ import org.slf4j.LoggerFactory;
processMap.put("getTableNamespaceConfiguration", new getTableNamespaceConfiguration());
processMap.put("checkClass", new checkClass());
processMap.put("checkTableClass", new checkTableClass());
+ processMap.put("checkTableNamespaceClass", new checkTableNamespaceClass());
return processMap;
}
@@ -2564,6 +2646,33 @@ import org.slf4j.LoggerFactory;
}
}
+ public static class checkTableNamespaceClass<I extends Iface> extends org.apache.thrift.ProcessFunction<I, checkTableNamespaceClass_args> {
+ public checkTableNamespaceClass() {
+ super("checkTableNamespaceClass");
+ }
+
+ public checkTableNamespaceClass_args getEmptyArgsInstance() {
+ return new checkTableNamespaceClass_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public checkTableNamespaceClass_result getResult(I iface, checkTableNamespaceClass_args args) throws org.apache.thrift.TException {
+ checkTableNamespaceClass_result result = new checkTableNamespaceClass_result();
+ try {
+ result.success = iface.checkTableNamespaceClass(args.tinfo, args.credentials, args.namespaceId, 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<getRootTabletLocation_args, getRootTabletLocation_args._Fields>, java.io.Serializable, Cloneable {
@@ -29097,4 +29206,1326 @@ import org.slf4j.LoggerFactory;
}
+ public static class checkTableNamespaceClass_args implements org.apache.thrift.TBase<checkTableNamespaceClass_args, checkTableNamespaceClass_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTableNamespaceClass_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)2);
+ private static final org.apache.thrift.protocol.TField NAMESPACE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("namespaceId", org.apache.thrift.protocol.TType.STRING, (short)3);
+ 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)4);
+ 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)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new checkTableNamespaceClass_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new checkTableNamespaceClass_argsTupleSchemeFactory());
+ }
+
+ public org.apache.accumulo.trace.thrift.TInfo tinfo; // required
+ public org.apache.accumulo.core.security.thrift.TCredentials credentials; // required
+ public String namespaceId; // 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)2, "credentials"),
+ NAMESPACE_ID((short)3, "namespaceId"),
+ CLASS_NAME((short)4, "className"),
+ INTERFACE_MATCH((short)5, "interfaceMatch");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ 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 2: // CREDENTIALS
+ return CREDENTIALS;
+ case 3: // NAMESPACE_ID
+ return NAMESPACE_ID;
+ case 4: // CLASS_NAME
+ return CLASS_NAME;
+ case 5: // 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.NAMESPACE_ID, new org.apache.thrift.meta_data.FieldMetaData("namespaceId", 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(checkTableNamespaceClass_args.class, metaDataMap);
+ }
+
+ public checkTableNamespaceClass_args() {
+ }
+
+ public checkTableNamespaceClass_args(
+ org.apache.accumulo.trace.thrift.TInfo tinfo,
+ org.apache.accumulo.core.security.thrift.TCredentials credentials,
+ String namespaceId,
+ String className,
+ String interfaceMatch)
+ {
+ this();
+ this.tinfo = tinfo;
+ this.credentials = credentials;
+ this.namespaceId = namespaceId;
+ this.className = className;
+ this.interfaceMatch = interfaceMatch;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public checkTableNamespaceClass_args(checkTableNamespaceClass_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.isSetNamespaceId()) {
+ this.namespaceId = other.namespaceId;
+ }
+ if (other.isSetClassName()) {
+ this.className = other.className;
+ }
+ if (other.isSetInterfaceMatch()) {
+ this.interfaceMatch = other.interfaceMatch;
+ }
+ }
+
+ public checkTableNamespaceClass_args deepCopy() {
+ return new checkTableNamespaceClass_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.tinfo = null;
+ this.credentials = null;
+ this.namespaceId = null;
+ this.className = null;
+ this.interfaceMatch = null;
+ }
+
+ public org.apache.accumulo.trace.thrift.TInfo getTinfo() {
+ return this.tinfo;
+ }
+
+ public checkTableNamespaceClass_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 checkTableNamespaceClass_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 getNamespaceId() {
+ return this.namespaceId;
+ }
+
+ public checkTableNamespaceClass_args setNamespaceId(String namespaceId) {
+ this.namespaceId = namespaceId;
+ return this;
+ }
+
+ public void unsetNamespaceId() {
+ this.namespaceId = null;
+ }
+
+ /** Returns true if field namespaceId is set (has been assigned a value) and false otherwise */
+ public boolean isSetNamespaceId() {
+ return this.namespaceId != null;
+ }
+
+ public void setNamespaceIdIsSet(boolean value) {
+ if (!value) {
+ this.namespaceId = null;
+ }
+ }
+
+ public String getClassName() {
+ return this.className;
+ }
+
+ public checkTableNamespaceClass_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 checkTableNamespaceClass_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 NAMESPACE_ID:
+ if (value == null) {
+ unsetNamespaceId();
+ } else {
+ setNamespaceId((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 NAMESPACE_ID:
+ return getNamespaceId();
+
+ 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 NAMESPACE_ID:
+ return isSetNamespaceId();
+ 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 checkTableNamespaceClass_args)
+ return this.equals((checkTableNamespaceClass_args)that);
+ return false;
+ }
+
+ public boolean equals(checkTableNamespaceClass_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_namespaceId = true && this.isSetNamespaceId();
+ boolean that_present_namespaceId = true && that.isSetNamespaceId();
+ if (this_present_namespaceId || that_present_namespaceId) {
+ if (!(this_present_namespaceId && that_present_namespaceId))
+ return false;
+ if (!this.namespaceId.equals(that.namespaceId))
+ 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(checkTableNamespaceClass_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ checkTableNamespaceClass_args typedOther = (checkTableNamespaceClass_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(isSetNamespaceId()).compareTo(typedOther.isSetNamespaceId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNamespaceId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.namespaceId, typedOther.namespaceId);
+ 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("checkTableNamespaceClass_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("namespaceId:");
+ if (this.namespaceId == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.namespaceId);
+ }
+ 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 checkTableNamespaceClass_argsStandardSchemeFactory implements SchemeFactory {
+ public checkTableNamespaceClass_argsStandardScheme getScheme() {
+ return new checkTableNamespaceClass_argsStandardScheme();
+ }
+ }
+
+ private static class checkTableNamespaceClass_argsStandardScheme extends StandardScheme<checkTableNamespaceClass_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, checkTableNamespaceClass_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 2: // 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 3: // NAMESPACE_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.namespaceId = iprot.readString();
+ struct.setNamespaceIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // 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 5: // 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, checkTableNamespaceClass_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.credentials != null) {
+ oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
+ struct.credentials.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.namespaceId != null) {
+ oprot.writeFieldBegin(NAMESPACE_ID_FIELD_DESC);
+ oprot.writeString(struct.namespaceId);
+ 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();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class checkTableNamespaceClass_argsTupleSchemeFactory implements SchemeFactory {
+ public checkTableNamespaceClass_argsTupleScheme getScheme() {
+ return new checkTableNamespaceClass_argsTupleScheme();
+ }
+ }
+
+ private static class checkTableNamespaceClass_argsTupleScheme extends TupleScheme<checkTableNamespaceClass_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, checkTableNamespaceClass_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.isSetNamespaceId()) {
+ 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.isSetNamespaceId()) {
+ oprot.writeString(struct.namespaceId);
+ }
+ if (struct.isSetClassName()) {
+ oprot.writeString(struct.className);
+ }
+ if (struct.isSetInterfaceMatch()) {
+ oprot.writeString(struct.interfaceMatch);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, checkTableNamespaceClass_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.namespaceId = iprot.readString();
+ struct.setNamespaceIdIsSet(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 checkTableNamespaceClass_result implements org.apache.thrift.TBase<checkTableNamespaceClass_result, checkTableNamespaceClass_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTableNamespaceClass_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<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new checkTableNamespaceClass_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new checkTableNamespaceClass_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<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ 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(checkTableNamespaceClass_result.class, metaDataMap);
+ }
+
+ public checkTableNamespaceClass_result() {
+ }
+
+ public checkTableNamespaceClass_result(
+ boolean success,
+ ThriftSecurityException sec,
+ ThriftTableOperationException tope)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ this.sec = sec;
+ this.tope = tope;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public checkTableNamespaceClass_result(checkTableNamespaceClass_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 checkTableNamespaceClass_result deepCopy() {
+ return new checkTableNamespaceClass_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ this.sec = null;
+ this.tope = null;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public checkTableNamespaceClass_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 checkTableNamespaceClass_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 checkTableNamespaceClass_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 checkTableNamespaceClass_result)
+ return this.equals((checkTableNamespaceClass_result)that);
+ return false;
+ }
+
+ public boolean equals(checkTableNamespaceClass_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(checkTableNamespaceClass_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ checkTableNamespaceClass_result typedOther = (checkTableNamespaceClass_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("checkTableNamespaceClass_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 checkTableNamespaceClass_resultStandardSchemeFactory implements SchemeFactory {
+ public checkTableNamespaceClass_resultStandardScheme getScheme() {
+ return new checkTableNamespaceClass_resultStandardScheme();
+ }
+ }
+
+ private static class checkTableNamespaceClass_resultStandardScheme extends StandardScheme<checkTableNamespaceClass_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, checkTableNamespaceClass_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, checkTableNamespaceClass_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 checkTableNamespaceClass_resultTupleSchemeFactory implements SchemeFactory {
+ public checkTableNamespaceClass_resultTupleScheme getScheme() {
+ return new checkTableNamespaceClass_resultTupleScheme();
+ }
+ }
+
+ private static class checkTableNamespaceClass_resultTupleScheme extends TupleScheme<checkTableNamespaceClass_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, checkTableNamespaceClass_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, checkTableNamespaceClass_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);
+ }
+ }
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespaceOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespaceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespaceOperations.java
index 94fdb4b..28f2edc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespaceOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespaceOperations.java
@@ -36,9 +36,11 @@ import org.apache.accumulo.core.client.admin.DiskUsage;
import org.apache.accumulo.core.client.admin.TableNamespaceOperationsHelper;
import org.apache.accumulo.core.client.admin.TimeType;
import org.apache.accumulo.core.client.impl.Tables;
-import org.apache.accumulo.core.security.Credentials;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
import org.apache.commons.lang.NotImplementedException;
+
+
public class MockTableNamespaceOperations extends TableNamespaceOperationsHelper {
final private MockAccumulo acu;
@@ -184,4 +186,17 @@ public class MockTableNamespaceOperations extends TableNamespaceOperationsHelper
// TODO Implement clone in Mock
throw new NotImplementedException();
}
+
+ @Override
+ public boolean testClassLoad(String namespace, String className, String asTypeName) throws AccumuloException, AccumuloSecurityException,
+ TableNamespaceNotFoundException {
+
+ try {
+ AccumuloVFSClassLoader.loadClass(className, Class.forName(asTypeName));
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
index f72fa32..c91f29e 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
@@ -19,7 +19,6 @@ package org.apache.accumulo.core.util.shell.commands;
import java.util.Map.Entry;
import org.apache.accumulo.core.constraints.Constraint;
-import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.accumulo.core.util.shell.ShellCommandException;
@@ -48,20 +47,23 @@ public class ConstraintCommand extends Command {
} else {
tableName = null;
}
-
+
int i;
-
switch (OptUtil.getAldOpt(cl)) {
case ADD:
for (String constraint : cl.getArgs()) {
- if (!shellState.getConnector().tableOperations().testClassLoad(MetadataTable.NAME, constraint, Constraint.class.getName())) {
- throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + constraint + " as type "
- + Constraint.class.getName());
- }
if (namespace != null) {
+ if (!shellState.getConnector().tableNamespaceOperations().testClassLoad(namespace, constraint, Constraint.class.getName())) {
+ throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + constraint + " as type "
+ + Constraint.class.getName());
+ }
i = shellState.getConnector().tableNamespaceOperations().addConstraint(namespace, constraint);
shellState.getReader().println("Added constraint " + constraint + " to table namespace " + namespace + " with number " + i);
- } else if (tableName != null){
+ } else if (tableName != null && !tableName.isEmpty()){
+ 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());
+ }
i = shellState.getConnector().tableOperations().addConstraint(tableName, constraint);
shellState.getReader().println("Added constraint " + constraint + " to table " + tableName + " with number " + i);
} else {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
index d064482..4f2f46f 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteIterCommand.java
@@ -23,18 +23,31 @@ import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
public class DeleteIterCommand extends Command {
private Option allScopeOpt, mincScopeOpt, majcScopeOpt, scanScopeOpt, nameOpt;
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
- final String tableName = OptUtil.getTableOpt(cl, shellState);
+
+ boolean tables = cl.hasOption(OptUtil.tableOpt().getOpt()) || !shellState.getTableName().isEmpty();
+ boolean namespaces = cl.hasOption(OptUtil.tableNamespaceOpt().getOpt());
final String name = cl.getOptionValue(nameOpt.getOpt());
- if (!shellState.getConnector().tableOperations().listIterators(tableName).containsKey(name)) {
- Shell.log.warn("no iterators found that match your criteria");
- return 0;
+
+ if (namespaces) {
+ if (!shellState.getConnector().tableNamespaceOperations().listIterators(OptUtil.getTableNamespaceOpt(cl, shellState)).containsKey(name)) {
+ Shell.log.warn("no iterators found that match your criteria");
+ return 0;
+ }
+ } else if (tables) {
+ if (!shellState.getConnector().tableOperations().listIterators(OptUtil.getTableOpt(cl, shellState)).containsKey(name)) {
+ Shell.log.warn("no iterators found that match your criteria");
+ return 0;
+ }
+ } else {
+ throw new IllegalArgumentException("No table or table namespace specified");
}
final EnumSet<IteratorScope> scopes = EnumSet.noneOf(IteratorScope.class);
@@ -50,13 +63,20 @@ public class DeleteIterCommand extends Command {
if (scopes.isEmpty()) {
throw new IllegalArgumentException("You must select at least one scope to configure");
}
- shellState.getConnector().tableOperations().removeIterator(tableName, name, scopes);
+
+ if (namespaces) {
+ shellState.getConnector().tableNamespaceOperations().removeIterator(OptUtil.getTableNamespaceOpt(cl, shellState), name, scopes);
+ } else if (tables) {
+ shellState.getConnector().tableOperations().removeIterator(OptUtil.getTableOpt(cl, shellState), name, scopes);
+ } else {
+ throw new IllegalArgumentException("No table or table namespace specified");
+ }
return 0;
}
@Override
public String description() {
- return "deletes a table-specific iterator";
+ return "deletes a table-specific or table-namespace-specific iterator";
}
public Options getOptions() {
@@ -71,7 +91,10 @@ public class DeleteIterCommand extends Command {
majcScopeOpt = new Option(IteratorScope.majc.name(), "major-compaction", false, "remove from major compaction scope");
scanScopeOpt = new Option(IteratorScope.scan.name(), "scan-time", false, "remove from scan scope");
- o.addOption(OptUtil.tableOpt("table to delete the iterator from"));
+ OptionGroup grp = new OptionGroup();
+ grp.addOption(OptUtil.tableOpt("table to delete the iterator from"));
+ grp.addOption(OptUtil.tableNamespaceOpt("table namespace to delete the iterator from"));
+ o.addOptionGroup(grp);
o.addOption(nameOpt);
o.addOption(allScopeOpt);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
index e2d4d91..5e5018f 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ListIterCommand.java
@@ -27,6 +27,7 @@ import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
public class ListIterCommand extends Command {
@@ -35,9 +36,18 @@ public class ListIterCommand extends Command {
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
- final String tableName = OptUtil.getTableOpt(cl, shellState);
- final Map<String,EnumSet<IteratorScope>> iterators = shellState.getConnector().tableOperations().listIterators(tableName);
+ boolean tables = cl.hasOption(OptUtil.tableOpt().getOpt()) || !shellState.getTableName().isEmpty();
+ boolean namespaces = cl.hasOption(OptUtil.tableNamespaceOpt().getOpt());
+
+ final Map<String,EnumSet<IteratorScope>> iterators;
+ if (namespaces) {
+ iterators = shellState.getConnector().tableNamespaceOperations().listIterators(OptUtil.getTableNamespaceOpt(cl, shellState));
+ } else if (tables) {
+ iterators = shellState.getConnector().tableOperations().listIterators(OptUtil.getTableOpt(cl, shellState));
+ } else {
+ throw new IllegalArgumentException("No table or table namespace specified");
+ }
if (cl.hasOption(nameOpt.getOpt())) {
final String name = cl.getOptionValue(nameOpt.getOpt());
@@ -57,12 +67,19 @@ public class ListIterCommand extends Command {
}
if (!hasScope) {
throw new IllegalArgumentException("You must select at least one scope to configure");
- }
+ }
final StringBuilder sb = new StringBuilder("-\n");
for (String name : iterators.keySet()) {
for (IteratorScope scope : iterators.get(name)) {
if (cl.hasOption(scopeOpts.get(scope).getOpt())) {
- IteratorSetting setting = shellState.getConnector().tableOperations().getIteratorSetting(tableName, name, scope);
+ IteratorSetting setting;
+ if (namespaces) {
+ setting = shellState.getConnector().tableNamespaceOperations().getIteratorSetting(OptUtil.getTableNamespaceOpt(cl, shellState), name, scope);
+ } else if (tables) {
+ setting = shellState.getConnector().tableOperations().getIteratorSetting(OptUtil.getTableOpt(cl, shellState), name, scope);
+ } else {
+ throw new IllegalArgumentException("No table or table namespace specified");
+ }
sb.append("- Iterator ").append(setting.getName()).append(", ").append(scope).append(" scope options:\n");
sb.append("- ").append("iteratorPriority").append(" = ").append(setting.getPriority()).append("\n");
sb.append("- ").append("iteratorClassName").append(" = ").append(setting.getIteratorClass()).append("\n");
@@ -79,7 +96,7 @@ public class ListIterCommand extends Command {
}
public String description() {
- return "lists table-specific iterators configured in this shell session";
+ return "lists table-specific or table-namespace-specific iterators configured in this shell session";
}
@Override
@@ -99,7 +116,10 @@ public class ListIterCommand extends Command {
scopeOpts.put(IteratorScope.majc, new Option(IteratorScope.majc.name(), "major-compaction", false, "list iterator for major compaction scope"));
scopeOpts.put(IteratorScope.scan, new Option(IteratorScope.scan.name(), "scan-time", false, "list iterator for scan scope"));
- o.addOption(OptUtil.tableOpt("table to list the configured iterators on"));
+ OptionGroup grp = new OptionGroup();
+ grp.addOption(OptUtil.tableOpt("table to list the configured iterators on"));
+ grp.addOption(OptUtil.tableNamespaceOpt("table namespace to list the configured iterators on"));
+ o.addOptionGroup(grp);
o.addOption(nameOpt);
for (Option opt : scopeOpts.values()) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
index f0c14d4..e92be4a 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.core.util.shell.commands;
import java.io.UnsupportedEncodingException;
+import org.apache.accumulo.core.client.TableNamespaceNotFoundException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.commons.cli.CommandLine;
@@ -45,6 +46,19 @@ public abstract class OptUtil {
return tableName;
}
+ public static String getTableNamespaceOpt(final CommandLine cl, final Shell shellState) throws TableNamespaceNotFoundException {
+ String namespace = null;
+ if (cl.hasOption(Shell.tableNamespaceOption)) {
+ namespace = cl.getOptionValue(Shell.tableNamespaceOption);
+ if (!shellState.getConnector().tableNamespaceOperations().exists(namespace)) {
+ throw new TableNamespaceNotFoundException(namespace, namespace, "specified table namespace that doesn't exist");
+ }
+ } else {
+ throw new TableNamespaceNotFoundException(null, null, "no table namespace specified");
+ }
+ return namespace;
+ }
+
public static Option tableOpt() {
return tableOpt("tableName");
}
@@ -56,6 +70,17 @@ public abstract class OptUtil {
return tableOpt;
}
+ public static Option tableNamespaceOpt() {
+ return tableNamespaceOpt("tableNamespace");
+ }
+
+ public static Option tableNamespaceOpt(final String description) {
+ final Option tableNamespaceOpt = new Option(Shell.tableNamespaceOption, "tableNamespace", true, description);
+ tableNamespaceOpt.setArgName("tableNamespace");
+ tableNamespaceOpt.setRequired(false);
+ return tableNamespaceOpt;
+ }
+
public static enum AdlOpt {
ADD("a"), DELETE("d"), LIST("l");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
index 3a71556..ce72ecc 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
@@ -28,6 +28,7 @@ import jline.console.ConsoleReader;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.TableNamespaceNotFoundException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
@@ -59,6 +60,9 @@ public class SetIterCommand extends Command {
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException, IOException, ShellCommandException {
+ boolean tables = cl.hasOption(OptUtil.tableOpt().getOpt()) || !shellState.getTableName().isEmpty();
+ boolean namespaces = cl.hasOption(OptUtil.tableNamespaceOpt().getOpt());
+
final int priority = Integer.parseInt(cl.getOptionValue(priorityOpt.getOpt()));
final Map<String,String> options = new HashMap<String,String>();
@@ -79,17 +83,43 @@ public class SetIterCommand extends Command {
}
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);
+ if (namespaces) {
+ try {
+ setTableNamespaceProperties(cl, shellState, priority, options, classname, name);
+ } catch (TableNamespaceNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else if (tables) {
+ setTableProperties(cl, shellState, priority, options, classname, name);
+ } else {
+ throw new IllegalArgumentException("No table or table namespace specified");
+ }
return 0;
}
-
+
private ClassLoader getClassLoader(final CommandLine cl, final Shell shellState) throws AccumuloException, TableNotFoundException, AccumuloSecurityException,
IOException, FileSystemException {
+
+ boolean tables = cl.hasOption(OptUtil.tableOpt().getOpt()) || !shellState.getTableName().isEmpty();
+ boolean namespaces = cl.hasOption(OptUtil.tableNamespaceOpt().getOpt());
+
String classpath = null;
- Iterable<Entry<String,String>> tableProps = shellState.getConnector().tableOperations().getProperties(OptUtil.getTableOpt(cl, shellState));
+ Iterable<Entry<String,String>> tableProps;
+
+ if (namespaces) {
+ try {
+ tableProps = shellState.getConnector().tableNamespaceOperations().getProperties(OptUtil.getTableNamespaceOpt(cl, shellState));
+ } catch (TableNamespaceNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else if (tables) {
+ tableProps = shellState.getConnector().tableOperations().getProperties(OptUtil.getTableOpt(cl, shellState));
+ } else {
+ throw new IllegalArgumentException("No table or table namespace specified");
+ }
for (Entry<String,String> entry : tableProps) {
if (entry.getKey().equals(Property.TABLE_CLASSPATH.getKey())) {
classpath = entry.getValue();
@@ -97,7 +127,7 @@ public class SetIterCommand extends Command {
}
ClassLoader classloader;
-
+
if (classpath != null && !classpath.equals("")) {
shellState.getConnector().instanceOperations().getSystemConfiguration().get(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + classpath);
@@ -115,7 +145,7 @@ public class SetIterCommand extends Command {
}
}));
} catch (IllegalStateException ise) {}
-
+
classloader = AccumuloVFSClassLoader.getContextManager().getClassLoader(classpath);
} else {
classloader = AccumuloVFSClassLoader.getClassLoader();
@@ -128,7 +158,7 @@ public class SetIterCommand extends Command {
// remove empty values
final String tableName = OptUtil.getTableOpt(cl, shellState);
-
+
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());
@@ -165,9 +195,51 @@ public class SetIterCommand extends Command {
shellState.getConnector().tableOperations().attachIterator(tableName, setting, scopes);
}
+ protected void setTableNamespaceProperties(final CommandLine cl, final Shell shellState, final int priority, final Map<String,String> options,
+ final String classname, final String name) throws AccumuloException, AccumuloSecurityException, ShellCommandException, TableNamespaceNotFoundException {
+ // remove empty values
+
+ final String namespace = OptUtil.getTableNamespaceOpt(cl, shellState);
+
+ if (!shellState.getConnector().tableNamespaceOperations().testClassLoad(namespace, classname, SortedKeyValueIterator.class.getName())) {
+ throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type "
+ + SortedKeyValueIterator.class.getName());
+ }
+
+ final String aggregatorClass = options.get("aggregatorClass");
+ @SuppressWarnings("deprecation")
+ String deprecatedAggregatorClassName = org.apache.accumulo.core.iterators.aggregation.Aggregator.class.getName();
+ if (aggregatorClass != null
+ && !shellState.getConnector().tableNamespaceOperations().testClassLoad(namespace, aggregatorClass, deprecatedAggregatorClassName)) {
+ throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + aggregatorClass + " as type "
+ + deprecatedAggregatorClassName);
+ }
+
+ for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); i.hasNext();) {
+ final Entry<String,String> entry = i.next();
+ if (entry.getValue() == null || entry.getValue().isEmpty()) {
+ i.remove();
+ }
+ }
+ final EnumSet<IteratorScope> scopes = EnumSet.noneOf(IteratorScope.class);
+ if (cl.hasOption(allScopeOpt.getOpt()) || cl.hasOption(mincScopeOpt.getOpt())) {
+ scopes.add(IteratorScope.minc);
+ }
+ if (cl.hasOption(allScopeOpt.getOpt()) || cl.hasOption(majcScopeOpt.getOpt())) {
+ scopes.add(IteratorScope.majc);
+ }
+ if (cl.hasOption(allScopeOpt.getOpt()) || cl.hasOption(scanScopeOpt.getOpt())) {
+ scopes.add(IteratorScope.scan);
+ }
+ if (scopes.isEmpty()) {
+ throw new IllegalArgumentException("You must select at least one scope to configure");
+ }
+ final IteratorSetting setting = new IteratorSetting(priority, name, classname, options);
+ shellState.getConnector().tableNamespaceOperations().attachIterator(namespace, setting, scopes);
+ }
+
private static String setUpOptions(ClassLoader classloader, final ConsoleReader reader, final String className, final Map<String,String> options)
- throws IOException,
- ShellCommandException {
+ throws IOException, ShellCommandException {
String input;
OptionDescriber skvi;
Class<? extends OptionDescriber> clazz;
@@ -266,7 +338,7 @@ public class SetIterCommand extends Command {
@Override
public String description() {
- return "sets a table-specific iterator";
+ return "sets a table-specific or table-namespace-specific iterator";
}
@Override
@@ -302,7 +374,10 @@ public class SetIterCommand extends Command {
typeGroup.addOption(ageoffTypeOpt);
typeGroup.setRequired(true);
- o.addOption(OptUtil.tableOpt("table to configure iterators on"));
+ final OptionGroup tableGroup = new OptionGroup();
+ tableGroup.addOption(OptUtil.tableOpt("table to configure iterators on"));
+ tableGroup.addOption(OptUtil.tableNamespaceOpt("tableNamespace to configure iterators on"));
+
o.addOption(priorityOpt);
o.addOption(nameOpt);
o.addOption(allScopeOpt);
@@ -310,6 +385,7 @@ public class SetIterCommand extends Command {
o.addOption(majcScopeOpt);
o.addOption(scanScopeOpt);
o.addOptionGroup(typeGroup);
+ o.addOptionGroup(tableGroup);
return o;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
index 8449e65..5d9b087 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TablesCommand.java
@@ -42,7 +42,6 @@ public class TablesCommand extends Command {
private Option tableIdOption;
private Option sortByTableIdOption;
private Option disablePaginationOpt;
- private Option tableNamespaceOpt;
@SuppressWarnings("unchecked")
@Override
@@ -52,8 +51,8 @@ public class TablesCommand extends Command {
final Iterator<String> tableNames;
final Iterator<String> tableIds;
- if (cl.hasOption(tableNamespaceOpt.getOpt())) {
- String namespace = shellState.getConnector().tableNamespaceOperations().namespaceIdMap().get(cl.getOptionValue(tableNamespaceOpt.getOpt()));
+ if (cl.hasOption(OptUtil.tableNamespaceOpt().getOpt())) {
+ String namespace = shellState.getConnector().tableNamespaceOperations().namespaceIdMap().get(OptUtil.getTableNamespaceOpt(cl, shellState));
tableNames = TableNamespaces.getTableNames(shellState.getConnector().getInstance(), namespace).iterator();
List<String> tableIdStrings = TableNamespaces.getTableIds(shellState.getConnector().getInstance(), namespace);
if (cl.hasOption(sortByTableIdOption.getOpt()))
@@ -112,8 +111,7 @@ public class TablesCommand extends Command {
o.addOption(sortByTableIdOption);
disablePaginationOpt = new Option("np", "no-pagination", false, "disable pagination of output");
o.addOption(disablePaginationOpt);
- tableNamespaceOpt = new Option(Shell.tableNamespaceOption, "table-namespace", true, "name of table namespace to list only its tables");
- o.addOption(tableNamespaceOpt);
+ o.addOption(OptUtil.tableNamespaceOpt("name of table namespace to list only its tables"));
return o;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/core/src/main/thrift/client.thrift
----------------------------------------------------------------------
diff --git a/core/src/main/thrift/client.thrift b/core/src/main/thrift/client.thrift
index 1e6a145..67f43d8 100644
--- a/core/src/main/thrift/client.thrift
+++ b/core/src/main/thrift/client.thrift
@@ -138,6 +138,7 @@ service ClientService {
map<string, string> getTableNamespaceConfiguration(1:trace.TInfo tinfo, 3:security.TCredentials credentials, 2:string ns) 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);
+ bool checkTableNamespaceClass(1:trace.TInfo tinfo, 2:security.TCredentials credentials, 3:string namespaceId, 4:string className, 5:string interfaceMatch) throws (1:ThriftSecurityException sec, 2:ThriftTableOperationException tope);
}
// Only used for a unit test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5acd6a48/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
index d0d83cb..0421ec1 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
@@ -90,6 +90,18 @@ public class ClientServiceHandler implements ClientService.Iface {
return tableId;
}
+ protected String checkTableNamespaceId(String tableNamespace, TableOperation operation) throws ThriftTableOperationException {
+ String namespaceId = TableNamespaces.getNameToIdMap(instance).get(tableNamespace);
+ if (namespaceId == null) {
+ // maybe the table namespace exists, but the cache was not updated yet... so try to clear the cache and check again
+ Tables.clearCache(instance);
+ namespaceId = TableNamespaces.getNameToIdMap(instance).get(tableNamespace);
+ if (namespaceId == null)
+ throw new ThriftTableOperationException(null, tableNamespace, operation, TableOperationExceptionType.NOTFOUND, null);
+ }
+ return namespaceId;
+ }
+
@Override
public String getInstanceId() {
return instance.getInstanceID();
@@ -321,6 +333,40 @@ public class ClientServiceHandler implements ClientService.Iface {
}
@Override
+ public boolean checkTableNamespaceClass(TInfo tinfo, TCredentials credentials, String tableNamespace, String className, String interfaceMatch)
+ throws TException, ThriftTableOperationException, ThriftSecurityException {
+
+ security.authenticateUser(credentials, credentials);
+
+ String tableNamespaceId = checkTableNamespaceId(tableNamespace, null);
+
+ ClassLoader loader = getClass().getClassLoader();
+ Class<?> shouldMatch;
+ try {
+ shouldMatch = loader.loadClass(interfaceMatch);
+
+ new ServerConfiguration(instance).getTableNamespaceConfiguration(tableNamespaceId);
+
+ String context = new ServerConfiguration(instance).getTableNamespaceConfiguration(tableNamespaceId).get(Property.TABLE_CLASSPATH);
+
+ ClassLoader currentLoader;
+
+ if (context != null && !context.equals("")) {
+ currentLoader = AccumuloVFSClassLoader.getContextManager().getClassLoader(context);
+ } else {
+ currentLoader = AccumuloVFSClassLoader.getClassLoader();
+ }
+
+ Class<?> test = currentLoader.loadClass(className).asSubclass(shouldMatch);
+ test.newInstance();
+ return true;
+ } catch (Exception e) {
+ log.warn("Error checking object types", e);
+ return false;
+ }
+ }
+
+ @Override
public List<TDiskUsage> getDiskUsage(Set<String> tables, TCredentials credentials) throws ThriftTableOperationException, ThriftSecurityException, TException {
try {
AuthenticationToken token = AuthenticationTokenSerializer.deserialize(credentials.getTokenClassName(), credentials.getToken());