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/11/01 03:00:05 UTC
[04/54] ACCUMULO-802 Apply Sean Hickey's patch (v5)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/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 488e065..9eac584 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
@@ -96,6 +96,8 @@ import org.slf4j.LoggerFactory;
public Map<String,String> getTableConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableName) throws ThriftTableOperationException, org.apache.thrift.TException;
+ public Map<String,String> getTableNamespaceConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String ns) throws ThriftTableOperationException, org.apache.thrift.TException;
+
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;
@@ -150,6 +152,8 @@ import org.slf4j.LoggerFactory;
public void getTableConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableName, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getTableConfiguration_call> resultHandler) throws org.apache.thrift.TException;
+ public void getTableNamespaceConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String ns, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getTableNamespaceConfiguration_call> resultHandler) throws org.apache.thrift.TException;
+
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<AsyncClient.checkClass_call> 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<AsyncClient.checkTableClass_call> resultHandler) throws org.apache.thrift.TException;
@@ -794,6 +798,34 @@ import org.slf4j.LoggerFactory;
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getTableConfiguration failed: unknown result");
}
+ public Map<String,String> getTableNamespaceConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String ns) throws ThriftTableOperationException, org.apache.thrift.TException
+ {
+ send_getTableNamespaceConfiguration(tinfo, credentials, ns);
+ return recv_getTableNamespaceConfiguration();
+ }
+
+ public void send_getTableNamespaceConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String ns) throws org.apache.thrift.TException
+ {
+ getTableNamespaceConfiguration_args args = new getTableNamespaceConfiguration_args();
+ args.setTinfo(tinfo);
+ args.setCredentials(credentials);
+ args.setNs(ns);
+ sendBase("getTableNamespaceConfiguration", args);
+ }
+
+ public Map<String,String> recv_getTableNamespaceConfiguration() throws ThriftTableOperationException, org.apache.thrift.TException
+ {
+ getTableNamespaceConfiguration_result result = new getTableNamespaceConfiguration_result();
+ receiveBase(result, "getTableNamespaceConfiguration");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.tope != null) {
+ throw result.tope;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getTableNamespaceConfiguration failed: unknown result");
+ }
+
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
{
send_checkClass(tinfo, credentials, className, interfaceMatch);
@@ -1748,6 +1780,44 @@ import org.slf4j.LoggerFactory;
}
}
+ public void getTableNamespaceConfiguration(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String ns, org.apache.thrift.async.AsyncMethodCallback<getTableNamespaceConfiguration_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getTableNamespaceConfiguration_call method_call = new getTableNamespaceConfiguration_call(tinfo, credentials, ns, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getTableNamespaceConfiguration_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 ns;
+ public getTableNamespaceConfiguration_call(org.apache.accumulo.trace.thrift.TInfo tinfo, org.apache.accumulo.core.security.thrift.TCredentials credentials, String ns, org.apache.thrift.async.AsyncMethodCallback<getTableNamespaceConfiguration_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.ns = ns;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getTableNamespaceConfiguration", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getTableNamespaceConfiguration_args args = new getTableNamespaceConfiguration_args();
+ args.setTinfo(tinfo);
+ args.setCredentials(credentials);
+ args.setNs(ns);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public Map<String,String> getResult() throws 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_getTableNamespaceConfiguration();
+ }
+ }
+
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<checkClass_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
checkClass_call method_call = new checkClass_call(tinfo, credentials, className, interfaceMatch, resultHandler, this, ___protocolFactory, ___transport);
@@ -1869,6 +1939,7 @@ import org.slf4j.LoggerFactory;
processMap.put("revokeTablePermission", new revokeTablePermission());
processMap.put("getConfiguration", new getConfiguration());
processMap.put("getTableConfiguration", new getTableConfiguration());
+ processMap.put("getTableNamespaceConfiguration", new getTableNamespaceConfiguration());
processMap.put("checkClass", new checkClass());
processMap.put("checkTableClass", new checkTableClass());
return processMap;
@@ -2421,6 +2492,30 @@ import org.slf4j.LoggerFactory;
}
}
+ public static class getTableNamespaceConfiguration<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getTableNamespaceConfiguration_args> {
+ public getTableNamespaceConfiguration() {
+ super("getTableNamespaceConfiguration");
+ }
+
+ public getTableNamespaceConfiguration_args getEmptyArgsInstance() {
+ return new getTableNamespaceConfiguration_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public getTableNamespaceConfiguration_result getResult(I iface, getTableNamespaceConfiguration_args args) throws org.apache.thrift.TException {
+ getTableNamespaceConfiguration_result result = new getTableNamespaceConfiguration_result();
+ try {
+ result.success = iface.getTableNamespaceConfiguration(args.tinfo, args.credentials, args.ns);
+ } catch (ThriftTableOperationException tope) {
+ result.tope = tope;
+ }
+ return result;
+ }
+ }
+
public static class checkClass<I extends Iface> extends org.apache.thrift.ProcessFunction<I, checkClass_args> {
public checkClass() {
super("checkClass");
@@ -25579,6 +25674,1089 @@ import org.slf4j.LoggerFactory;
}
+ public static class getTableNamespaceConfiguration_args implements org.apache.thrift.TBase<getTableNamespaceConfiguration_args, getTableNamespaceConfiguration_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getTableNamespaceConfiguration_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)3);
+ private static final org.apache.thrift.protocol.TField NS_FIELD_DESC = new org.apache.thrift.protocol.TField("ns", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getTableNamespaceConfiguration_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getTableNamespaceConfiguration_argsTupleSchemeFactory());
+ }
+
+ public org.apache.accumulo.trace.thrift.TInfo tinfo; // required
+ public org.apache.accumulo.core.security.thrift.TCredentials credentials; // required
+ public String ns; // 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)3, "credentials"),
+ NS((short)2, "ns");
+
+ 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 3: // CREDENTIALS
+ return CREDENTIALS;
+ case 2: // NS
+ return NS;
+ 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.NS, new org.apache.thrift.meta_data.FieldMetaData("ns", 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(getTableNamespaceConfiguration_args.class, metaDataMap);
+ }
+
+ public getTableNamespaceConfiguration_args() {
+ }
+
+ public getTableNamespaceConfiguration_args(
+ org.apache.accumulo.trace.thrift.TInfo tinfo,
+ org.apache.accumulo.core.security.thrift.TCredentials credentials,
+ String ns)
+ {
+ this();
+ this.tinfo = tinfo;
+ this.credentials = credentials;
+ this.ns = ns;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getTableNamespaceConfiguration_args(getTableNamespaceConfiguration_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.isSetNs()) {
+ this.ns = other.ns;
+ }
+ }
+
+ public getTableNamespaceConfiguration_args deepCopy() {
+ return new getTableNamespaceConfiguration_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.tinfo = null;
+ this.credentials = null;
+ this.ns = null;
+ }
+
+ public org.apache.accumulo.trace.thrift.TInfo getTinfo() {
+ return this.tinfo;
+ }
+
+ public getTableNamespaceConfiguration_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 getTableNamespaceConfiguration_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 getNs() {
+ return this.ns;
+ }
+
+ public getTableNamespaceConfiguration_args setNs(String ns) {
+ this.ns = ns;
+ return this;
+ }
+
+ public void unsetNs() {
+ this.ns = null;
+ }
+
+ /** Returns true if field ns is set (has been assigned a value) and false otherwise */
+ public boolean isSetNs() {
+ return this.ns != null;
+ }
+
+ public void setNsIsSet(boolean value) {
+ if (!value) {
+ this.ns = 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 NS:
+ if (value == null) {
+ unsetNs();
+ } else {
+ setNs((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TINFO:
+ return getTinfo();
+
+ case CREDENTIALS:
+ return getCredentials();
+
+ case NS:
+ return getNs();
+
+ }
+ 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 NS:
+ return isSetNs();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getTableNamespaceConfiguration_args)
+ return this.equals((getTableNamespaceConfiguration_args)that);
+ return false;
+ }
+
+ public boolean equals(getTableNamespaceConfiguration_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_ns = true && this.isSetNs();
+ boolean that_present_ns = true && that.isSetNs();
+ if (this_present_ns || that_present_ns) {
+ if (!(this_present_ns && that_present_ns))
+ return false;
+ if (!this.ns.equals(that.ns))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public int compareTo(getTableNamespaceConfiguration_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ getTableNamespaceConfiguration_args typedOther = (getTableNamespaceConfiguration_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(isSetNs()).compareTo(typedOther.isSetNs());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNs()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ns, typedOther.ns);
+ 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("getTableNamespaceConfiguration_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("ns:");
+ if (this.ns == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ns);
+ }
+ 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 getTableNamespaceConfiguration_argsStandardSchemeFactory implements SchemeFactory {
+ public getTableNamespaceConfiguration_argsStandardScheme getScheme() {
+ return new getTableNamespaceConfiguration_argsStandardScheme();
+ }
+ }
+
+ private static class getTableNamespaceConfiguration_argsStandardScheme extends StandardScheme<getTableNamespaceConfiguration_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getTableNamespaceConfiguration_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 3: // 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: // NS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.ns = iprot.readString();
+ struct.setNsIsSet(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, getTableNamespaceConfiguration_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.ns != null) {
+ oprot.writeFieldBegin(NS_FIELD_DESC);
+ oprot.writeString(struct.ns);
+ oprot.writeFieldEnd();
+ }
+ if (struct.credentials != null) {
+ oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
+ struct.credentials.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getTableNamespaceConfiguration_argsTupleSchemeFactory implements SchemeFactory {
+ public getTableNamespaceConfiguration_argsTupleScheme getScheme() {
+ return new getTableNamespaceConfiguration_argsTupleScheme();
+ }
+ }
+
+ private static class getTableNamespaceConfiguration_argsTupleScheme extends TupleScheme<getTableNamespaceConfiguration_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getTableNamespaceConfiguration_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.isSetNs()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetTinfo()) {
+ struct.tinfo.write(oprot);
+ }
+ if (struct.isSetCredentials()) {
+ struct.credentials.write(oprot);
+ }
+ if (struct.isSetNs()) {
+ oprot.writeString(struct.ns);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getTableNamespaceConfiguration_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ 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.ns = iprot.readString();
+ struct.setNsIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class getTableNamespaceConfiguration_result implements org.apache.thrift.TBase<getTableNamespaceConfiguration_result, getTableNamespaceConfiguration_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getTableNamespaceConfiguration_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.MAP, (short)0);
+ 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)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getTableNamespaceConfiguration_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getTableNamespaceConfiguration_resultTupleSchemeFactory());
+ }
+
+ public Map<String,String> success; // 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"),
+ TOPE((short)1, "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: // 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
+ 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.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ 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(getTableNamespaceConfiguration_result.class, metaDataMap);
+ }
+
+ public getTableNamespaceConfiguration_result() {
+ }
+
+ public getTableNamespaceConfiguration_result(
+ Map<String,String> success,
+ ThriftTableOperationException tope)
+ {
+ this();
+ this.success = success;
+ this.tope = tope;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getTableNamespaceConfiguration_result(getTableNamespaceConfiguration_result other) {
+ if (other.isSetSuccess()) {
+ Map<String,String> __this__success = new HashMap<String,String>();
+ for (Map.Entry<String, String> other_element : other.success.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ String other_element_value = other_element.getValue();
+
+ String __this__success_copy_key = other_element_key;
+
+ String __this__success_copy_value = other_element_value;
+
+ __this__success.put(__this__success_copy_key, __this__success_copy_value);
+ }
+ this.success = __this__success;
+ }
+ if (other.isSetTope()) {
+ this.tope = new ThriftTableOperationException(other.tope);
+ }
+ }
+
+ public getTableNamespaceConfiguration_result deepCopy() {
+ return new getTableNamespaceConfiguration_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.tope = null;
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public void putToSuccess(String key, String val) {
+ if (this.success == null) {
+ this.success = new HashMap<String,String>();
+ }
+ this.success.put(key, val);
+ }
+
+ public Map<String,String> getSuccess() {
+ return this.success;
+ }
+
+ public getTableNamespaceConfiguration_result setSuccess(Map<String,String> success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public ThriftTableOperationException getTope() {
+ return this.tope;
+ }
+
+ public getTableNamespaceConfiguration_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((Map<String,String>)value);
+ }
+ break;
+
+ case TOPE:
+ if (value == null) {
+ unsetTope();
+ } else {
+ setTope((ThriftTableOperationException)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ 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 TOPE:
+ return isSetTope();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getTableNamespaceConfiguration_result)
+ return this.equals((getTableNamespaceConfiguration_result)that);
+ return false;
+ }
+
+ public boolean equals(getTableNamespaceConfiguration_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ 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(getTableNamespaceConfiguration_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ getTableNamespaceConfiguration_result typedOther = (getTableNamespaceConfiguration_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(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("getTableNamespaceConfiguration_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ 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 {
+ 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 getTableNamespaceConfiguration_resultStandardSchemeFactory implements SchemeFactory {
+ public getTableNamespaceConfiguration_resultStandardScheme getScheme() {
+ return new getTableNamespaceConfiguration_resultStandardScheme();
+ }
+ }
+
+ private static class getTableNamespaceConfiguration_resultStandardScheme extends StandardScheme<getTableNamespaceConfiguration_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getTableNamespaceConfiguration_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.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map84 = iprot.readMapBegin();
+ struct.success = new HashMap<String,String>(2*_map84.size);
+ for (int _i85 = 0; _i85 < _map84.size; ++_i85)
+ {
+ String _key86; // required
+ String _val87; // required
+ _key86 = iprot.readString();
+ _val87 = iprot.readString();
+ struct.success.put(_key86, _val87);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // 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, getTableNamespaceConfiguration_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size()));
+ for (Map.Entry<String, String> _iter88 : struct.success.entrySet())
+ {
+ oprot.writeString(_iter88.getKey());
+ oprot.writeString(_iter88.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.tope != null) {
+ oprot.writeFieldBegin(TOPE_FIELD_DESC);
+ struct.tope.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getTableNamespaceConfiguration_resultTupleSchemeFactory implements SchemeFactory {
+ public getTableNamespaceConfiguration_resultTupleScheme getScheme() {
+ return new getTableNamespaceConfiguration_resultTupleScheme();
+ }
+ }
+
+ private static class getTableNamespaceConfiguration_resultTupleScheme extends TupleScheme<getTableNamespaceConfiguration_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getTableNamespaceConfiguration_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ if (struct.isSetTope()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetSuccess()) {
+ {
+ oprot.writeI32(struct.success.size());
+ for (Map.Entry<String, String> _iter89 : struct.success.entrySet())
+ {
+ oprot.writeString(_iter89.getKey());
+ oprot.writeString(_iter89.getValue());
+ }
+ }
+ }
+ if (struct.isSetTope()) {
+ struct.tope.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getTableNamespaceConfiguration_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TMap _map90 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.success = new HashMap<String,String>(2*_map90.size);
+ for (int _i91 = 0; _i91 < _map90.size; ++_i91)
+ {
+ String _key92; // required
+ String _val93; // required
+ _key92 = iprot.readString();
+ _val93 = iprot.readString();
+ struct.success.put(_key92, _val93);
+ }
+ }
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.tope = new ThriftTableOperationException();
+ struct.tope.read(iprot);
+ struct.setTopeIsSet(true);
+ }
+ }
+ }
+
+ }
+
public static class checkClass_args implements org.apache.thrift.TBase<checkClass_args, checkClass_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkClass_args");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
index 5ee144d..37e8379 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
@@ -22,8 +22,10 @@ import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;
+import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.client.admin.TimeType;
+import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.metadata.MetadataTable;
@@ -36,6 +38,7 @@ import org.apache.hadoop.io.Text;
public class MockAccumulo {
final Map<String,MockTable> tables = new HashMap<String,MockTable>();
+ final Map<String,MockTableNamespace> namespaces = new HashMap<String,MockTableNamespace>();
final Map<String,String> systemProperties = new HashMap<String,String>();
Map<String,MockUser> users = new HashMap<String,MockUser>();
final FileSystem fs;
@@ -48,6 +51,8 @@ public class MockAccumulo {
MockUser root = new MockUser("root", new PasswordToken(new byte[0]), Authorizations.EMPTY);
root.permissions.add(SystemPermission.SYSTEM);
users.put(root.name, root);
+ namespaces.put(Constants.DEFAULT_TABLE_NAMESPACE, new MockTableNamespace());
+ namespaces.put(Constants.SYSTEM_TABLE_NAMESPACE, new MockTableNamespace());
createTable("root", RootTable.NAME, true, TimeType.LOGICAL);
createTable("root", MetadataTable.NAME, true, TimeType.LOGICAL);
}
@@ -78,11 +83,28 @@ public class MockAccumulo {
}
public void createTable(String username, String tableName, boolean useVersions, TimeType timeType) {
- MockTable t = new MockTable(useVersions, timeType);
+ String namespace = Tables.extractNamespace(tableName);
+
+ if (!namespaceExists(namespace)) {
+ return;
+ }
+
+ MockTableNamespace n = namespaces.get(namespace);
+ MockTable t = new MockTable(n, useVersions, timeType);
t.userPermissions.put(username, EnumSet.allOf(TablePermission.class));
+ t.setNamespaceName(namespace);
+ t.setNamespace(n);
tables.put(tableName, t);
}
+ public void createNamespace(String username, String namespace) {
+ if (!namespaceExists(namespace)) {
+ MockTableNamespace n = new MockTableNamespace();
+ n.userPermissions.put(username, EnumSet.allOf(TablePermission.class));
+ namespaces.put(namespace, n);
+ }
+ }
+
public void addSplits(String tableName, SortedSet<Text> partitionKeys) {
tables.get(tableName).addSplits(partitionKeys);
}
@@ -94,4 +116,8 @@ public class MockAccumulo {
public void merge(String tableName, Text start, Text end) {
tables.get(tableName).merge(start, end);
}
+
+ private boolean namespaceExists(String namespace) {
+ return namespaces.containsKey(namespace);
+ }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
index 80ec513..ecca271 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
@@ -32,6 +32,7 @@ import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.InstanceOperations;
import org.apache.accumulo.core.client.admin.SecurityOperations;
+import org.apache.accumulo.core.client.admin.TableNamespaceOperations;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.NullToken;
@@ -135,6 +136,11 @@ public class MockConnector extends Connector {
public InstanceOperations instanceOperations() {
return new MockInstanceOperations(acu);
}
+
+ @Override
+ public TableNamespaceOperations tableNamespaceOperations() {
+ return new MockTableNamespaceOperations(acu, username);
+ }
@Override
public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) throws TableNotFoundException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/core/src/main/java/org/apache/accumulo/core/client/mock/MockTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTable.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTable.java
index 3dcab11..0e71414 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTable.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.client.mock;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -56,7 +57,7 @@ public class MockTable {
@Override
public boolean equals(Object other) {
- return (other instanceof MockMemKey) && super.equals((MockMemKey)other) && count == ((MockMemKey)other).count;
+ return (other instanceof MockMemKey) && super.equals((MockMemKey) other) && count == ((MockMemKey) other).count;
}
@Override
@@ -88,7 +89,9 @@ public class MockTable {
Map<String,EnumSet<TablePermission>> userPermissions = new HashMap<String,EnumSet<TablePermission>>();
private TimeType timeType;
SortedSet<Text> splits = new ConcurrentSkipListSet<Text>();
- Map<String,Set<Text>> localityGroups = new TreeMap<String, Set<Text>>();
+ Map<String,Set<Text>> localityGroups = new TreeMap<String,Set<Text>>();
+ private MockTableNamespace namespace;
+ private String namespaceName;
MockTable(boolean limitVersion, TimeType timeType) {
this.timeType = timeType;
@@ -100,6 +103,18 @@ public class MockTable {
}
}
+ MockTable(MockTableNamespace namespace, boolean limitVersion, TimeType timeType) {
+ this(limitVersion, timeType);
+ Set<Entry<String,String>> set = namespace.getSettings().entrySet();
+ Iterator<Entry<String,String>> entries = set.iterator();
+ while (entries.hasNext()) {
+ Entry<String,String> entry = entries.next();
+ String key = entry.getKey();
+ if (key.startsWith(Property.TABLE_PREFIX.getKey()))
+ settings.put(key, entry.getValue());
+ }
+ }
+
synchronized void addMutation(Mutation m) {
if (m.size() == 0)
throw new IllegalArgumentException("Can not add empty mutations");
@@ -131,6 +146,7 @@ public class MockTable {
public void setLocalityGroups(Map<String,Set<Text>> groups) {
localityGroups = groups;
}
+
public Map<String,Set<Text>> getLocalityGroups() {
return localityGroups;
}
@@ -143,4 +159,20 @@ public class MockTable {
if (reAdd)
splits.add(start);
}
+
+ public void setNamespaceName(String n) {
+ this.namespaceName = n;
+ }
+
+ public void setNamespace(MockTableNamespace n) {
+ this.namespace = n;
+ }
+
+ public String getNamespaceName() {
+ return this.namespaceName;
+ }
+
+ public MockTableNamespace getNamespace() {
+ return this.namespace;
+ }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespace.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespace.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespace.java
new file mode 100644
index 0000000..2a32165
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespace.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.client.mock;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.security.TablePermission;
+
+
+public class MockTableNamespace {
+
+ final Map<String,String> settings;
+ Map<String,EnumSet<TablePermission>> userPermissions = new HashMap<String,EnumSet<TablePermission>>();
+
+ public MockTableNamespace() {
+ settings = new HashMap<String,String>();
+ for (Entry<String,String> entry : AccumuloConfiguration.getDefaultConfiguration()) {
+ String key = entry.getKey();
+ if (key.startsWith(Property.TABLE_PREFIX.getKey())) {
+ settings.put(key, entry.getValue());
+ }
+ }
+ }
+
+ public Map<String,String> getSettings() {
+ return settings;
+ }
+
+ public List<String> getTables(MockAccumulo acu) {
+ List<String> l = new LinkedList<String>();
+ for (String t : acu.tables.keySet()) {
+ if (acu.tables.get(t).getNamespace().equals(this)) {
+ l.add(t);
+ }
+ }
+ return l;
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/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
new file mode 100644
index 0000000..c2b8a39
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableNamespaceOperations.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.client.mock;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableNamespaceExistsException;
+import org.apache.accumulo.core.client.TableNamespaceNotEmptyException;
+import org.apache.accumulo.core.client.TableNamespaceNotFoundException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.admin.DiskUsage;
+import org.apache.accumulo.core.client.admin.TableNamespaceOperations;
+import org.apache.accumulo.core.client.admin.TimeType;
+import org.apache.accumulo.core.client.impl.Tables;
+
+public class MockTableNamespaceOperations implements TableNamespaceOperations {
+
+ final private MockAccumulo acu;
+ final private String username;
+
+ MockTableNamespaceOperations(MockAccumulo acu, String username) {
+ this.acu = acu;
+ this.username = username;
+ }
+
+ @Override
+ public SortedSet<String> list() {
+ return new TreeSet<String>(acu.namespaces.keySet());
+ }
+
+ @Override
+ public boolean exists(String tableName) {
+ return acu.namespaces.containsKey(tableName);
+ }
+
+ @Override
+ public void create(String tableName) throws AccumuloException, AccumuloSecurityException, TableNamespaceExistsException {
+ create(tableName, true, TimeType.MILLIS);
+ }
+
+ @Override
+ public void create(String tableName, boolean versioningIter) throws AccumuloException, AccumuloSecurityException, TableNamespaceExistsException {
+ create(tableName, versioningIter, TimeType.MILLIS);
+ }
+
+ @Override
+ public void create(String namespace, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException,
+ TableNamespaceExistsException {
+ if (!namespace.matches(Constants.VALID_TABLE_NAMESPACE_REGEX)) {
+ throw new IllegalArgumentException();
+ }
+
+ if (exists(namespace))
+ throw new TableNamespaceExistsException(namespace, namespace, "");
+
+ if (!exists(namespace)) {
+ acu.createNamespace(username, namespace);
+ }
+ acu.createTable(username, namespace, versioningIter, timeType);
+ }
+
+ @Override
+ public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, TableNamespaceNotFoundException, TableNamespaceNotEmptyException {
+ delete(namespace, false);
+ }
+
+ @Override
+ public void delete(String namespace, boolean deleteTables) throws AccumuloException, AccumuloSecurityException, TableNamespaceNotFoundException, TableNamespaceNotEmptyException {
+ if (!exists(namespace))
+ throw new TableNamespaceNotFoundException(namespace, namespace, "");
+
+ MockTableNamespace n = acu.namespaces.get(namespace);
+ if (!deleteTables) {
+ if (n.getTables(acu).size() > 0) {
+ throw new TableNamespaceNotEmptyException(null, namespace, null);
+ }
+ } else {
+ for (String t : n.getTables(acu)) {
+ try {
+ new MockConnector(username, acu, null).tableOperations().delete(t);
+ } catch (TableNotFoundException e) {
+ System.err.println("Table (" + e.getTableName() + ") not found while deleting namespace (" + namespace + ")");
+ }
+ }
+ }
+ acu.namespaces.remove(namespace);
+ }
+
+ @Override
+ public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, TableNamespaceNotFoundException, AccumuloException,
+ TableNamespaceExistsException {
+ if (!exists(oldNamespaceName))
+ throw new TableNamespaceNotFoundException(oldNamespaceName, oldNamespaceName, "");
+ if (exists(newNamespaceName))
+ throw new TableNamespaceExistsException(newNamespaceName, newNamespaceName, "");
+
+ MockTableNamespace n = acu.namespaces.get(oldNamespaceName);
+ for (String t : n.getTables(acu)) {
+ String tt = newNamespaceName + "." + Tables.extractTableName(t);
+ acu.tables.put(tt, acu.tables.remove(t));
+ }
+ acu.namespaces.put(newNamespaceName, acu.namespaces.remove(oldNamespaceName));
+ }
+
+ @Override
+ public void setProperty(String namespace, String property, String value) throws AccumuloException, AccumuloSecurityException {
+ acu.namespaces.get(namespace).settings.put(property, value);
+ }
+
+ @Override
+ public void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException {
+ acu.namespaces.get(namespace).settings.remove(property);
+ }
+
+ @Override
+ public Iterable<Entry<String,String>> getProperties(String namespace) throws TableNamespaceNotFoundException {
+ if (!exists(namespace)) {
+ throw new TableNamespaceNotFoundException(namespace, namespace, "");
+ }
+
+ return acu.namespaces.get(namespace).settings.entrySet();
+ }
+
+ @Override
+ public void offline(String namespace) throws AccumuloSecurityException, AccumuloException, TableNamespaceNotFoundException {
+ if (!exists(namespace))
+ throw new TableNamespaceNotFoundException(namespace, namespace, "");
+ }
+
+ @Override
+ public void online(String namespace) throws AccumuloSecurityException, AccumuloException, TableNamespaceNotFoundException {
+ if (!exists(namespace))
+ throw new TableNamespaceNotFoundException(namespace, namespace, "");
+ }
+
+ @Override
+ public Map<String,String> namespaceIdMap() {
+ Map<String,String> result = new HashMap<String,String>();
+ for (String table : acu.tables.keySet()) {
+ result.put(table, table);
+ }
+ return result;
+ }
+
+ @Override
+ public List<DiskUsage> getDiskUsage(String namespace) throws AccumuloException, AccumuloSecurityException {
+
+ List<DiskUsage> diskUsages = new ArrayList<DiskUsage>();
+ diskUsages.add(new DiskUsage(new TreeSet<String>(acu.namespaces.get(namespace).getTables(acu)), 0l));
+
+ return diskUsages;
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d4c3e6a9/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
index a3c2043..78b7826 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -39,6 +40,7 @@ import org.apache.accumulo.core.client.admin.DiskUsage;
import org.apache.accumulo.core.client.admin.FindMax;
import org.apache.accumulo.core.client.admin.TableOperationsHelper;
import org.apache.accumulo.core.client.admin.TimeType;
+import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -73,16 +75,21 @@ public class MockTableOperations extends TableOperationsHelper {
return new TreeSet<String>(acu.tables.keySet());
}
+ /*
+ * @Override public SortedSet<String> listNamespaces() { return new TreeSet<String>(acu.namespaces.keySet()); }
+ */
+
@Override
public boolean exists(String tableName) {
return acu.tables.containsKey(tableName);
}
+ private boolean namespaceExists(String namespace) {
+ return acu.namespaces.containsKey(namespace);
+ }
+
@Override
public void create(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException {
- if (!tableName.matches(Constants.VALID_TABLE_NAME_REGEX)) {
- throw new IllegalArgumentException();
- }
create(tableName, true, TimeType.MILLIS);
}
@@ -93,11 +100,16 @@ public class MockTableOperations extends TableOperationsHelper {
@Override
public void create(String tableName, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException {
+ String namespace = Tables.extractNamespace(tableName);
if (!tableName.matches(Constants.VALID_TABLE_NAME_REGEX)) {
throw new IllegalArgumentException();
}
if (exists(tableName))
throw new TableExistsException(tableName, tableName, "");
+
+ if (!namespaceExists(namespace)) {
+ throw new IllegalArgumentException("Table namespace (" + namespace + ") does not exist, create it first");
+ }
acu.createTable(username, tableName, versioningIter, timeType);
}
@@ -147,6 +159,14 @@ public class MockTableOperations extends TableOperationsHelper {
if (exists(newTableName))
throw new TableExistsException(newTableName, newTableName, "");
MockTable t = acu.tables.remove(oldTableName);
+ String namespace = Tables.extractNamespace(newTableName);
+ MockTableNamespace n = acu.namespaces.get(namespace);
+ if (n == null) {
+ n = new MockTableNamespace();
+ }
+ t.setNamespaceName(namespace);
+ t.setNamespace(n);
+ acu.namespaces.put(namespace, n);
acu.tables.put(newTableName, t);
}
@@ -166,9 +186,26 @@ public class MockTableOperations extends TableOperationsHelper {
@Override
public Iterable<Entry<String,String>> getProperties(String tableName) throws TableNotFoundException {
- if (!exists(tableName))
+ String namespace = Tables.extractNamespace(tableName);
+
+ if (!namespaceExists(namespace)) {
+ throw new IllegalArgumentException("Table namespace (" + namespace + ") does not exist");
+ }
+
+ Set<Entry<String,String>> props = new HashSet<Entry<String,String>>(acu.namespaces.get(namespace).settings.entrySet());
+
+ if (!exists(tableName)) {
throw new TableNotFoundException(tableName, tableName, "");
- return acu.tables.get(tableName).settings.entrySet();
+ }
+
+ Set<Entry<String,String>> tableProps = acu.tables.get(tableName).settings.entrySet();
+ for (Entry<String,String> e : tableProps) {
+ if (props.contains(e)) {
+ props.remove(e);
+ }
+ props.add(e);
+ }
+ return props;
}
@Override