You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2013/02/04 19:09:41 UTC
svn commit: r1442284 [11/14] - in /accumulo/trunk: core/
core/src/main/java/org/apache/accumulo/core/cli/
core/src/main/java/org/apache/accumulo/core/client/
core/src/main/java/org/apache/accumulo/core/client/admin/
core/src/main/java/org/apache/accumu...
Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveScan.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveScan.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveScan.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveScan.java Mon Feb 4 18:09:38 2013
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ActiveScan");
private static final org.apache.thrift.protocol.TField CLIENT_FIELD_DESC = new org.apache.thrift.protocol.TField("client", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField("principal", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I64, (short)4);
private static final org.apache.thrift.protocol.TField IDLE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("idleTime", org.apache.thrift.protocol.TType.I64, (short)5);
@@ -68,7 +68,7 @@ import org.slf4j.LoggerFactory;
}
public String client; // required
- public String user; // required
+ public String principal; // required
public String table; // required
public long age; // required
public long idleTime; // required
@@ -90,7 +90,7 @@ import org.slf4j.LoggerFactory;
/** 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 {
CLIENT((short)1, "client"),
- USER((short)2, "user"),
+ PRINCIPAL((short)2, "principal"),
TABLE((short)3, "table"),
AGE((short)4, "age"),
IDLE_TIME((short)5, "idleTime"),
@@ -124,8 +124,8 @@ import org.slf4j.LoggerFactory;
switch(fieldId) {
case 1: // CLIENT
return CLIENT;
- case 2: // USER
- return USER;
+ case 2: // PRINCIPAL
+ return PRINCIPAL;
case 3: // TABLE
return TABLE;
case 4: // AGE
@@ -192,7 +192,7 @@ import org.slf4j.LoggerFactory;
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.CLIENT, new org.apache.thrift.meta_data.FieldMetaData("client", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ tmpMap.put(_Fields.PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("principal", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
@@ -224,7 +224,7 @@ import org.slf4j.LoggerFactory;
public ActiveScan(
String client,
- String user,
+ String principal,
String table,
long age,
long idleTime,
@@ -237,7 +237,7 @@ import org.slf4j.LoggerFactory;
{
this();
this.client = client;
- this.user = user;
+ this.principal = principal;
this.table = table;
this.age = age;
setAgeIsSet(true);
@@ -259,8 +259,8 @@ import org.slf4j.LoggerFactory;
if (other.isSetClient()) {
this.client = other.client;
}
- if (other.isSetUser()) {
- this.user = other.user;
+ if (other.isSetPrincipal()) {
+ this.principal = other.principal;
}
if (other.isSetTable()) {
this.table = other.table;
@@ -308,7 +308,7 @@ import org.slf4j.LoggerFactory;
@Override
public void clear() {
this.client = null;
- this.user = null;
+ this.principal = null;
this.table = null;
setAgeIsSet(false);
this.age = 0;
@@ -346,27 +346,27 @@ import org.slf4j.LoggerFactory;
}
}
- public String getUser() {
- return this.user;
+ public String getPrincipal() {
+ return this.principal;
}
- public ActiveScan setUser(String user) {
- this.user = user;
+ public ActiveScan setPrincipal(String principal) {
+ this.principal = principal;
return this;
}
- public void unsetUser() {
- this.user = null;
+ public void unsetPrincipal() {
+ this.principal = null;
}
- /** Returns true if field user is set (has been assigned a value) and false otherwise */
- public boolean isSetUser() {
- return this.user != null;
+ /** Returns true if field principal is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrincipal() {
+ return this.principal != null;
}
- public void setUserIsSet(boolean value) {
+ public void setPrincipalIsSet(boolean value) {
if (!value) {
- this.user = null;
+ this.principal = null;
}
}
@@ -655,11 +655,11 @@ import org.slf4j.LoggerFactory;
}
break;
- case USER:
+ case PRINCIPAL:
if (value == null) {
- unsetUser();
+ unsetPrincipal();
} else {
- setUser((String)value);
+ setPrincipal((String)value);
}
break;
@@ -743,8 +743,8 @@ import org.slf4j.LoggerFactory;
case CLIENT:
return getClient();
- case USER:
- return getUser();
+ case PRINCIPAL:
+ return getPrincipal();
case TABLE:
return getTable();
@@ -786,8 +786,8 @@ import org.slf4j.LoggerFactory;
switch (field) {
case CLIENT:
return isSetClient();
- case USER:
- return isSetUser();
+ case PRINCIPAL:
+ return isSetPrincipal();
case TABLE:
return isSetTable();
case AGE:
@@ -832,12 +832,12 @@ import org.slf4j.LoggerFactory;
return false;
}
- boolean this_present_user = true && this.isSetUser();
- boolean that_present_user = true && that.isSetUser();
- if (this_present_user || that_present_user) {
- if (!(this_present_user && that_present_user))
+ boolean this_present_principal = true && this.isSetPrincipal();
+ boolean that_present_principal = true && that.isSetPrincipal();
+ if (this_present_principal || that_present_principal) {
+ if (!(this_present_principal && that_present_principal))
return false;
- if (!this.user.equals(that.user))
+ if (!this.principal.equals(that.principal))
return false;
}
@@ -948,12 +948,12 @@ import org.slf4j.LoggerFactory;
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
+ lastComparison = Boolean.valueOf(isSetPrincipal()).compareTo(typedOther.isSetPrincipal());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetUser()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
+ if (isSetPrincipal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.principal, typedOther.principal);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1076,11 +1076,11 @@ import org.slf4j.LoggerFactory;
}
first = false;
if (!first) sb.append(", ");
- sb.append("user:");
- if (this.user == null) {
+ sb.append("principal:");
+ if (this.principal == null) {
sb.append("null");
} else {
- sb.append(this.user);
+ sb.append(this.principal);
}
first = false;
if (!first) sb.append(", ");
@@ -1203,10 +1203,10 @@ import org.slf4j.LoggerFactory;
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 2: // USER
+ case 2: // PRINCIPAL
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.user = iprot.readString();
- struct.setUserIsSet(true);
+ struct.principal = iprot.readString();
+ struct.setPrincipalIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -1336,9 +1336,9 @@ import org.slf4j.LoggerFactory;
oprot.writeString(struct.client);
oprot.writeFieldEnd();
}
- if (struct.user != null) {
- oprot.writeFieldBegin(USER_FIELD_DESC);
- oprot.writeString(struct.user);
+ if (struct.principal != null) {
+ oprot.writeFieldBegin(PRINCIPAL_FIELD_DESC);
+ oprot.writeString(struct.principal);
oprot.writeFieldEnd();
}
if (struct.table != null) {
@@ -1424,7 +1424,7 @@ import org.slf4j.LoggerFactory;
if (struct.isSetClient()) {
optionals.set(0);
}
- if (struct.isSetUser()) {
+ if (struct.isSetPrincipal()) {
optionals.set(1);
}
if (struct.isSetTable()) {
@@ -1458,8 +1458,8 @@ import org.slf4j.LoggerFactory;
if (struct.isSetClient()) {
oprot.writeString(struct.client);
}
- if (struct.isSetUser()) {
- oprot.writeString(struct.user);
+ if (struct.isSetPrincipal()) {
+ oprot.writeString(struct.principal);
}
if (struct.isSetTable()) {
oprot.writeString(struct.table);
@@ -1517,8 +1517,8 @@ import org.slf4j.LoggerFactory;
struct.setClientIsSet(true);
}
if (incoming.get(1)) {
- struct.user = iprot.readString();
- struct.setUserIsSet(true);
+ struct.principal = iprot.readString();
+ struct.setPrincipalIsSet(true);
}
if (incoming.get(2)) {
struct.table = iprot.readString();
Modified: accumulo/trunk/proxy/src/main/thrift/proxy.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/thrift/proxy.thrift?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/thrift/proxy.thrift (original)
+++ accumulo/trunk/proxy/src/main/thrift/proxy.thrift Mon Feb 4 18:09:38 2013
@@ -64,9 +64,9 @@ struct ScanColumn {
2:optional binary colQualifier
}
-struct UserPass {
- 1:string username,
- 2:binary password
+struct PrincipalToken {
+ 1:string principal,
+ 2:binary token
}
struct IteratorSetting {
@@ -142,7 +142,7 @@ struct Column {
struct ActiveScan {
1:string client
- 2:string user
+ 2:string principal
3:string table
4:i64 age
5:i64 idleTime
@@ -230,104 +230,103 @@ exception TableExistsException {
service AccumuloProxy
{
- // get an identity token
- binary login(1:UserPass login);
+ bool ping (1:PrincipalToken PrincipalToken);
// table operations
- i32 addConstraint (1:binary login, 2:string tableName, 3:string constraintClassName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void addSplits (1:binary login, 2:string tableName, 3:set<binary> splits) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
- void attachIterator (1:binary login, 2:string tableName, 3:IteratorSetting setting,
+ i32 addConstraint (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string constraintClassName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+ void addSplits (1:PrincipalToken PrincipalToken, 2:string tableName, 3:set<binary> splits) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+ void attachIterator (1:PrincipalToken PrincipalToken, 2:string tableName, 3:IteratorSetting setting,
4:set<IteratorScope> scopes)
- throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
- void checkIteratorConflicts (1:binary login, 2:string tableName, 3:IteratorSetting setting,
+ throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+ void checkIteratorConflicts (1:PrincipalToken PrincipalToken, 2:string tableName, 3:IteratorSetting setting,
4:set<IteratorScope> scopes)
- throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
- void clearLocatorCache (1:binary login, 2:string tableName) throws (1:TableNotFoundException ouch1);
- void cloneTable (1:binary login, 2:string tableName, 3:string newTableName, 4:bool flush,
+ throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+ void clearLocatorCache (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:TableNotFoundException ouch1);
+ void cloneTable (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string newTableName, 4:bool flush,
5:map<string,string> propertiesToSet, 6:set<string> propertiesToExclude)
- throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3, 4:TableExistsException ouch4);
- void compactTable (1:binary login, 2:string tableName, 3:binary startRow, 4:binary endRow,
- 5:list<IteratorSetting> iterators, 6:bool flush, 7:bool wait) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3);
- void cancelCompaction(1:binary login, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3);
+ throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3, 4:TableExistsException ouch4);
+ void compactTable (1:PrincipalToken PrincipalToken, 2:string tableName, 3:binary startRow, 4:binary endRow,
+ 5:list<IteratorSetting> iterators, 6:bool flush, 7:bool wait) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3);
+ void cancelCompaction(1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3);
- void createTable (1:binary login, 2:string tableName, 3:bool versioningIter, 4:TimeType type) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableExistsException ouch3);
- void deleteTable (1:binary login, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void deleteRows (1:binary login, 2:string tableName, 3:binary startRow, 4:binary endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void exportTable (1:binary login, 2:string tableName, 3:string exportDir) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
- void flushTable (1:binary login, 2:string tableName, 3:binary startRow, 4:binary endRow,
+ void createTable (1:PrincipalToken PrincipalToken, 2:string tableName, 3:bool versioningIter, 4:TimeType type) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableExistsException ouch3);
+ void deleteTable (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+ void deleteRows (1:PrincipalToken PrincipalToken, 2:string tableName, 3:binary startRow, 4:binary endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+ void exportTable (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string exportDir) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+ void flushTable (1:PrincipalToken PrincipalToken, 2:string tableName, 3:binary startRow, 4:binary endRow,
5:bool wait)
- throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- map<string,set<string>> getLocalityGroups (1:binary login, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
- IteratorSetting getIteratorSetting (1:binary login, 2:string tableName,
+ throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ map<string,set<string>> getLocalityGroups (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+ IteratorSetting getIteratorSetting (1:PrincipalToken PrincipalToken, 2:string tableName,
3:string iteratorName, 4:IteratorScope scope)
- throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
- binary getMaxRow (1:binary login, 2:string tableName, 3:set<binary> auths, 4:binary startRow,
+ throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+ binary getMaxRow (1:PrincipalToken PrincipalToken, 2:string tableName, 3:set<binary> auths, 4:binary startRow,
5:bool startInclusive, 6:binary endRow, 7:bool endInclusive)
- throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
- map<string,string> getTableProperties (1:binary login, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
- list<binary> getSplits (1:binary login, 2:string tableName, 3:i32 maxSplits) throws (1:TableNotFoundException ouch1);
- void importDirectory (1:binary login, 2:string tableName, 3:string importDir,
+ throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+ map<string,string> getTableProperties (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+ list<binary> getSplits (1:PrincipalToken PrincipalToken, 2:string tableName, 3:i32 maxSplits) throws (1:TableNotFoundException ouch1);
+ void importDirectory (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string importDir,
4:string failureDir, 5:bool setTime)
- throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch3, 3:AccumuloSecurityException ouch4);
- void importTable (1:binary login, 2:string tableName, 3:string importDir) throws (1:TableExistsException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
- set<string> listTables (1:binary login);
- map<string,set<IteratorScope>> listIterators (1:binary login, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
- map<string,i32> listConstraints (1:binary login, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
- void mergeTablets (1:binary login, 2:string tableName, 3:binary startRow, 4:binary endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void offlineTable (1:binary login, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
- void onlineTable (1:binary login, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
- void removeConstraint (1:binary login, 2:string tableName, 3:i32 constraint) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void removeIterator (1:binary login, 2:string tableName, 3:string iterName,
+ throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch3, 3:AccumuloSecurityException ouch4);
+ void importTable (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string importDir) throws (1:TableExistsException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+ set<string> listTables (1:PrincipalToken PrincipalToken);
+ map<string,set<IteratorScope>> listIterators (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+ map<string,i32> listConstraints (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+ void mergeTablets (1:PrincipalToken PrincipalToken, 2:string tableName, 3:binary startRow, 4:binary endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+ void offlineTable (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+ void onlineTable (1:PrincipalToken PrincipalToken, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+ void removeConstraint (1:PrincipalToken PrincipalToken, 2:string tableName, 3:i32 constraint) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void removeIterator (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string iterName,
4:set<IteratorScope> scopes)
- throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
- void removeTableProperty (1:binary login, 2:string tableName, 3:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void renameTable (1:binary login, 2:string oldTableName, 3:string newTableName) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3, 4:TableExistsException ouch4);
- void setLocalityGroups (1:binary login, 2:string tableName, 3:map<string,set<string>> groups) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void setTableProperty (1:binary login, 2:string tableName, 3:string property, 4:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- set<Range> splitRangeByTablets (1:binary login, 2:string tableName, 3:Range range, 4:i32 maxSplits) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- bool tableExists (1:binary login, 2:string tableName);
- map<string,string> tableIdMap (1:binary login);
+ throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+ void removeTableProperty (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void renameTable (1:PrincipalToken PrincipalToken, 2:string oldTableName, 3:string newTableName) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3, 4:TableExistsException ouch4);
+ void setLocalityGroups (1:PrincipalToken PrincipalToken, 2:string tableName, 3:map<string,set<string>> groups) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+ void setTableProperty (1:PrincipalToken PrincipalToken, 2:string tableName, 3:string property, 4:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ set<Range> splitRangeByTablets (1:PrincipalToken PrincipalToken, 2:string tableName, 3:Range range, 4:i32 maxSplits) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+ bool tableExists (1:PrincipalToken PrincipalToken, 2:string tableName);
+ map<string,string> tableIdMap (1:PrincipalToken PrincipalToken);
// instance operations
- void pingTabletServer(1:binary login, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- list<ActiveScan> getActiveScans (1:binary login, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- list<ActiveCompaction> getActiveCompactions(1:binary login, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- map<string,string> getSiteConfiguration (1:binary login) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- map<string,string> getSystemConfiguration (1:binary login) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- list<string> getTabletServers (1:binary login);
- void removeProperty (1:binary login, 2:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void setProperty (1:binary login, 2:string property, 3:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- bool testClassLoad (1:binary login, 2:string className, 3:string asTypeName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void pingTabletServer(1:PrincipalToken PrincipalToken, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ list<ActiveScan> getActiveScans (1:PrincipalToken PrincipalToken, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ list<ActiveCompaction> getActiveCompactions(1:PrincipalToken PrincipalToken, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ map<string,string> getSiteConfiguration (1:PrincipalToken PrincipalToken) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ map<string,string> getSystemConfiguration (1:PrincipalToken PrincipalToken) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ list<string> getTabletServers (1:PrincipalToken PrincipalToken);
+ void removeProperty (1:PrincipalToken PrincipalToken, 2:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void setProperty (1:PrincipalToken PrincipalToken, 2:string property, 3:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ bool testClassLoad (1:PrincipalToken PrincipalToken, 2:string className, 3:string asTypeName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
// security operations
- bool authenticateUser (1:binary login, 2:string user, 3:binary password) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void changeUserAuthorizations (1:binary login, 2:string user, 3:set<binary> authorizations) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void changeUserPassword (1:binary login, 2:string user, 3:binary password) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void createUser (1:binary login, 2:string user, 3:binary password) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void dropUser (1:binary login, 2:string user) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- list<binary> getUserAuthorizations (1:binary login, 2:string user) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void grantSystemPermission (1:binary login, 2:string user, 3:SystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void grantTablePermission (1:binary login, 2:string user, 3:string table, 4:TablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- bool hasSystemPermission (1:binary login, 2:string user, 3:SystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- bool hasTablePermission (1:binary login, 2:string user, 3:string table, 4:TablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- set<string> listUsers (1:binary login) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void revokeSystemPermission (1:binary login, 2:string user, 3:SystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- void revokeTablePermission (1:binary login, 2:string user, 3:string table, 4:TablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ bool authenticateUser (1:PrincipalToken PrincipalToken, 2:string principal, 3:binary token) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void changeUserAuthorizations (1:PrincipalToken PrincipalToken, 2:string principal, 3:set<binary> authorizations) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void changePrincipalTokenword (1:PrincipalToken PrincipalToken, 2:string principal, 3:binary token) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void createUser (1:PrincipalToken PrincipalToken, 2:string principal, 3:binary token) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void dropUser (1:PrincipalToken PrincipalToken, 2:string principal) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ list<binary> getUserAuthorizations (1:PrincipalToken PrincipalToken, 2:string principal) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void grantSystemPermission (1:PrincipalToken PrincipalToken, 2:string principal, 3:SystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void grantTablePermission (1:PrincipalToken PrincipalToken, 2:string principal, 3:string table, 4:TablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ bool hasSystemPermission (1:PrincipalToken PrincipalToken, 2:string principal, 3:SystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ bool hasTablePermission (1:PrincipalToken PrincipalToken, 2:string principal, 3:string table, 4:TablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ set<string> listUsers (1:PrincipalToken PrincipalToken) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void revokeSystemPermission (1:PrincipalToken PrincipalToken, 2:string principal, 3:SystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void revokeTablePermission (1:PrincipalToken PrincipalToken, 2:string principal, 3:string table, 4:TablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
// scanning
- string createBatchScanner(1:binary login, 2:string tableName, 3:BatchScanOptions options) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
- string createScanner(1:binary login, 2:string tableName, 3:ScanOptions options) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ string createBatchScanner(1:PrincipalToken PrincipalToken, 2:string tableName, 3:BatchScanOptions options) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ string createScanner(1:PrincipalToken PrincipalToken, 2:string tableName, 3:ScanOptions options) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
// use the scanner
- bool hasNext(1:string scanner) throws(1:UnknownScanner ouch1);
- KeyValueAndPeek nextEntry(1:string scanner) throws(1:NoMoreEntriesException ouch1, 2:UnknownScanner ouch2, 3:AccumuloSecurityException ouch3);
- ScanResult nextK(1:string scanner, 2:i32 k) throws(1:NoMoreEntriesException ouch1, 2:UnknownScanner ouch2, 3:AccumuloSecurityException ouch3);
- void closeScanner(1:string scanner) throws(1:UnknownScanner ouch1);
+ bool hasNext(1:string scanner) throws(1:UnknownScanner ouch1);
+ KeyValueAndPeek nextEntry(1:string scanner) throws(1:NoMoreEntriesException ouch1, 2:UnknownScanner ouch2, 3:AccumuloSecurityException ouch3);
+ ScanResult nextK(1:string scanner, 2:i32 k) throws(1:NoMoreEntriesException ouch1, 2:UnknownScanner ouch2, 3:AccumuloSecurityException ouch3);
+ void closeScanner(1:string scanner) throws (1:UnknownScanner ouch1);
// writing
- void updateAndFlush(1:binary login, 2:string tableName, 3:map<binary, list<ColumnUpdate>> cells) throws(1:AccumuloException outch1, 2:AccumuloSecurityException ouch2);
- string createWriter(1:binary login, 2:string tableName, 3:WriterOptions opts) throws(1:AccumuloException outch1, 2:AccumuloSecurityException ouch2);
+ void updateAndFlush(1:PrincipalToken PrincipalToken, 2:string tableName, 3:map<binary, list<ColumnUpdate>> cells) throws(1:AccumuloException outch1, 2:AccumuloSecurityException ouch2);
+ string createWriter(1:PrincipalToken PrincipalToken, 2:string tableName, 3:WriterOptions opts) throws(1:AccumuloException outch1, 2:AccumuloSecurityException ouch2);
// use the writer
oneway void update(1:string writer, 2:map<binary, list<ColumnUpdate>> cells);
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Mon Feb 4 18:09:38 2013
@@ -58,6 +58,7 @@ import org.apache.accumulo.proxy.thrift.
import org.apache.accumulo.proxy.thrift.IteratorSetting;
import org.apache.accumulo.proxy.thrift.Key;
import org.apache.accumulo.proxy.thrift.PartialKey;
+import org.apache.accumulo.proxy.thrift.PrincipalToken;
import org.apache.accumulo.proxy.thrift.Range;
import org.apache.accumulo.proxy.thrift.ScanColumn;
import org.apache.accumulo.proxy.thrift.ScanOptions;
@@ -67,7 +68,6 @@ import org.apache.accumulo.proxy.thrift.
import org.apache.accumulo.proxy.thrift.SystemPermission;
import org.apache.accumulo.proxy.thrift.TablePermission;
import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.accumulo.proxy.thrift.UserPass;
import org.apache.accumulo.test.MiniAccumuloCluster;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.commons.io.FileUtils;
@@ -98,11 +98,10 @@ public class SimpleTest {
private static Thread thread;
private static int proxyPort;
private static org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client;
- private static UserPass userpass = new UserPass("root", ByteBuffer.wrap(secret.getBytes()));
- private static ByteBuffer creds = null;
-
+ private static PrincipalToken creds = new PrincipalToken("root", ByteBuffer.wrap(secret.getBytes()));
+
private static Class<? extends TProtocolFactory> protocolClass;
-
+
static Class<? extends TProtocolFactory> getRandomProtocol() {
List<Class<? extends TProtocolFactory>> protocolFactories = new ArrayList<Class<? extends TProtocolFactory>>();
protocolFactories.add(org.apache.thrift.protocol.TJSONProtocol.Factory.class);
@@ -113,20 +112,20 @@ public class SimpleTest {
Random rand = new Random();
return protocolFactories.get(rand.nextInt(protocolFactories.size()));
}
-
+
@BeforeClass
public static void setupMiniCluster() throws Exception {
folder.create();
accumulo = new MiniAccumuloCluster(folder.getRoot(), secret);
accumulo.start();
-
+
Properties props = new Properties();
props.put("org.apache.accumulo.proxy.ProxyServer.instancename", accumulo.getInstanceName());
props.put("org.apache.accumulo.proxy.ProxyServer.zookeepers", accumulo.getZookeepers());
protocolClass = getRandomProtocol();
System.out.println(protocolClass.getName());
-
+
proxyPort = 40000 + random.nextInt(20000);
proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class, org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
protocolClass, props);
@@ -140,9 +139,13 @@ public class SimpleTest {
while (!proxyServer.isServing())
UtilWaitThread.sleep(100);
client = new TestProxyClient("localhost", proxyPort, protocolClass.newInstance()).proxy();
- creds = client.login(userpass);
}
-
+
+ @Test(timeout = 10000)
+ public void testPing() throws Exception {
+ client.ping(creds);
+ }
+
@Test(timeout = 10000)
public void testInstanceOperations() throws Exception {
int tservers = 0;
@@ -171,7 +174,7 @@ public class SimpleTest {
// try to load some classes via the proxy
assertTrue(client.testClassLoad(creds, DevNull.class.getName(), SortedKeyValueIterator.class.getName()));
assertFalse(client.testClassLoad(creds, "foo.bar", SortedKeyValueIterator.class.getName()));
-
+
// create a table that's very slow, so we can look for scans/compactions
client.createTable(creds, "slow", true, TimeType.MILLIS);
IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "100"));
@@ -199,19 +202,18 @@ public class SimpleTest {
t.start();
// look for the scan
List<ActiveScan> scans = Collections.emptyList();
- loop:
- for (int i = 0; i < 100; i++) {
- for (String tserver: client.getTabletServers(creds)) {
- scans = client.getActiveScans(creds, tserver);
- if (!scans.isEmpty())
- break loop;
- UtilWaitThread.sleep(10);
+ loop: for (int i = 0; i < 100; i++) {
+ for (String tserver : client.getTabletServers(creds)) {
+ scans = client.getActiveScans(creds, tserver);
+ if (!scans.isEmpty())
+ break loop;
+ UtilWaitThread.sleep(10);
}
}
t.join();
assertFalse(scans.isEmpty());
ActiveScan scan = scans.get(0);
- assertEquals("root", scan.getUser());
+ assertEquals("root", scan.getPrincipal());
assertEquals(ScanState.RUNNING, scan.getState());
assertEquals(ScanType.SINGLE, scan.getType());
assertEquals("slow", scan.getTable());
@@ -236,9 +238,8 @@ public class SimpleTest {
// try to catch it in the act
List<ActiveCompaction> compactions = Collections.emptyList();
- loop2:
- for (int i = 0; i < 100; i++) {
- for (String tserver: client.getTabletServers(creds)) {
+ loop2: for (int i = 0; i < 100; i++) {
+ for (String tserver : client.getTabletServers(creds)) {
compactions = client.getActiveCompactions(creds, tserver);
if (!compactions.isEmpty())
break loop2;
@@ -262,24 +263,23 @@ public class SimpleTest {
// check password
assertTrue(client.authenticateUser(creds, "root", s2bb(secret)));
assertFalse(client.authenticateUser(creds, "root", s2bb("")));
-
+
// create a user
client.createUser(creds, "stooge", s2bb("password"));
// change auths
Set<String> users = client.listUsers(creds);
assertEquals(new HashSet<String>(Arrays.asList("root", "stooge")), users);
- HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"),s2bb("B")));
+ HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
client.changeUserAuthorizations(creds, "stooge", auths);
List<ByteBuffer> update = client.getUserAuthorizations(creds, "stooge");
assertEquals(auths, new HashSet<ByteBuffer>(update));
// change password
- client.changeUserPassword(creds, "stooge", s2bb(""));
+ client.changePrincipalTokenword(creds, "stooge", s2bb(""));
assertTrue(client.authenticateUser(creds, "stooge", s2bb("")));
// check permission failure
- ByteBuffer stooge = client.login(new UserPass("stooge", s2bb("")));
-
+ PrincipalToken stooge = new PrincipalToken("stooge", s2bb(""));
try {
client.createTable(stooge, "fail", true, TimeType.MILLIS);
fail("should not create the table");
@@ -309,8 +309,7 @@ public class SimpleTest {
String scanner = client.createScanner(stooge, "test", null);
client.nextK(scanner, 100);
fail("stooge should not read table test");
- } catch (TException ex) {
- }
+ } catch (TException ex) {}
// grant
assertFalse(client.hasTablePermission(creds, "stooge", "test", TablePermission.READ));
client.grantTablePermission(creds, "stooge", "test", TablePermission.READ);
@@ -325,8 +324,7 @@ public class SimpleTest {
scanner = client.createScanner(stooge, "test", null);
client.nextK(scanner, 100);
fail("stooge should not read table test");
- } catch (TException ex) {
- }
+ } catch (TException ex) {}
// delete user
client.dropUser(creds, "stooge");
@@ -346,8 +344,7 @@ public class SimpleTest {
try {
client.updateAndFlush(creds, "test", mutation("row1", "cf", "cq", "x"));
fail("constraint did not fire");
- } catch (Exception ex) {
- }
+ } catch (Exception ex) {}
client.removeConstraint(creds, "test", 1);
client.updateAndFlush(creds, "test", mutation("row1", "cf", "cq", "x"));
String scanner = client.createScanner(creds, "test", null);
@@ -370,7 +367,7 @@ public class SimpleTest {
// iterators
client.deleteTable(creds, "test");
client.createTable(creds, "test", true, TimeType.MILLIS);
- HashMap<String, String> options = new HashMap<String, String>();
+ HashMap<String,String> options = new HashMap<String,String>();
options.put("type", "STRING");
options.put("columns", "cf");
IteratorSetting setting = new IteratorSetting(10, "test", SummingCombiner.class.getName(), options);
@@ -385,12 +382,11 @@ public class SimpleTest {
try {
client.checkIteratorConflicts(creds, "test", setting, EnumSet.allOf(IteratorScope.class));
fail("checkIteratorConflicts did not throw and exception");
- } catch (Exception ex) {
- }
+ } catch (Exception ex) {}
client.deleteRows(creds, "test", null, null);
client.removeIterator(creds, "test", "test", EnumSet.allOf(IteratorScope.class));
for (int i = 0; i < 10; i++) {
- client.updateAndFlush(creds, "test", mutation("row"+i, "cf", "cq", ""+i));
+ client.updateAndFlush(creds, "test", mutation("row" + i, "cf", "cq", "" + i));
client.flushTable(creds, "test", null, null, true);
}
scanner = client.createScanner(creds, "test", null);
@@ -438,7 +434,7 @@ public class SimpleTest {
// Locality groups
client.createTable(creds, "test", true, TimeType.MILLIS);
- Map<String, Set<String>> groups = new HashMap<String, Set<String>>();
+ Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
groups.put("group1", Collections.singleton("cf1"));
groups.put("group2", Collections.singleton("cf2"));
client.setLocalityGroups(creds, "test", groups);
@@ -497,17 +493,17 @@ public class SimpleTest {
}
return result;
}
-
+
private Map<ByteBuffer,List<ColumnUpdate>> mutation(String row, String cf, String cq, String value) {
ColumnUpdate upd = new ColumnUpdate(s2bb(cf), s2bb(cq));
upd.setValue(value.getBytes());
return Collections.singletonMap(s2bb(row), Collections.singletonList(upd));
}
-
+
private ByteBuffer s2bb(String cf) {
return ByteBuffer.wrap(cf.getBytes());
}
-
+
@AfterClass
public static void tearDownMiniCluster() throws Exception {
accumulo.stop();
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java Mon Feb 4 18:09:38 2013
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTru
import java.nio.ByteBuffer;
import java.util.Properties;
-import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.accumulo.proxy.thrift.PrincipalToken;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
@@ -35,7 +35,7 @@ public class TestProxyInstanceOperations
protected static TServer proxy;
protected static Thread thread;
protected static TestProxyClient tpc;
- protected static ByteBuffer userpass;
+ protected static PrincipalToken userpass;
protected static final int port = 10197;
@BeforeClass
@@ -53,7 +53,7 @@ public class TestProxyInstanceOperations
};
thread.start();
tpc = new TestProxyClient("localhost", port);
- userpass = tpc.proxy.login(new UserPass("root", ByteBuffer.wrap("".getBytes())));
+ userpass = new PrincipalToken("root", ByteBuffer.wrap("".getBytes()));
}
@AfterClass
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java Mon Feb 4 18:09:38 2013
@@ -33,11 +33,11 @@ import org.apache.accumulo.proxy.thrift.
import org.apache.accumulo.proxy.thrift.IteratorSetting;
import org.apache.accumulo.proxy.thrift.Key;
import org.apache.accumulo.proxy.thrift.KeyValue;
+import org.apache.accumulo.proxy.thrift.PrincipalToken;
import org.apache.accumulo.proxy.thrift.Range;
import org.apache.accumulo.proxy.thrift.ScanOptions;
import org.apache.accumulo.proxy.thrift.ScanResult;
import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.accumulo.proxy.thrift.UserPass;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
import org.junit.After;
@@ -50,7 +50,7 @@ public class TestProxyReadWrite {
protected static TServer proxy;
protected static Thread thread;
protected static TestProxyClient tpc;
- protected static ByteBuffer userpass;
+ protected static PrincipalToken userpass;
protected static final int port = 10194;
protected static final String testtable = "testtable";
@@ -69,7 +69,7 @@ public class TestProxyReadWrite {
};
thread.start();
tpc = new TestProxyClient("localhost", port);
- userpass = tpc.proxy().login(new UserPass("root", ByteBuffer.wrap("".getBytes())));
+ userpass = new PrincipalToken("root", ByteBuffer.wrap("".getBytes()));
}
@AfterClass
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java Mon Feb 4 18:09:38 2013
@@ -25,10 +25,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Properties;
+import org.apache.accumulo.proxy.thrift.PrincipalToken;
import org.apache.accumulo.proxy.thrift.SystemPermission;
import org.apache.accumulo.proxy.thrift.TablePermission;
import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.accumulo.proxy.thrift.UserPass;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
@@ -42,7 +42,7 @@ public class TestProxySecurityOperations
protected static TServer proxy;
protected static Thread thread;
protected static TestProxyClient tpc;
- protected static ByteBuffer userpass;
+ protected static PrincipalToken userpass;
protected static final int port = 10196;
protected static final String testtable = "testtable";
protected static final String testuser = "VonJines";
@@ -64,7 +64,7 @@ public class TestProxySecurityOperations
thread.start();
tpc = new TestProxyClient("localhost", port);
- userpass = tpc.proxy().login(new UserPass("root", ByteBuffer.wrap("".getBytes())));
+ userpass = new PrincipalToken("root", ByteBuffer.wrap("".getBytes()));
}
@AfterClass
@@ -98,7 +98,7 @@ public class TestProxySecurityOperations
assertTrue(tpc.proxy().authenticateUser(userpass, testuser, testpw));
assertFalse(tpc.proxy().authenticateUser(userpass, "EvilUser", testpw));
- tpc.proxy().changeUserPassword(userpass, testuser, ByteBuffer.wrap("newpass".getBytes()));
+ tpc.proxy().changePrincipalTokenword(userpass, testuser, ByteBuffer.wrap("newpass".getBytes()));
assertFalse(tpc.proxy().authenticateUser(userpass, testuser, testpw));
assertTrue(tpc.proxy().authenticateUser(userpass, testuser, ByteBuffer.wrap("newpass".getBytes())));
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java Mon Feb 4 18:09:38 2013
@@ -31,8 +31,8 @@ import java.util.Properties;
import java.util.Set;
import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.PrincipalToken;
import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.accumulo.proxy.thrift.UserPass;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
@@ -47,7 +47,7 @@ public class TestProxyTableOperations {
protected static TServer proxy;
protected static Thread thread;
protected static TestProxyClient tpc;
- protected static ByteBuffer userpass;
+ protected static PrincipalToken userpass;
protected static final int port = 10195;
protected static final String testtable = "testtable";
@@ -66,7 +66,7 @@ public class TestProxyTableOperations {
};
thread.start();
tpc = new TestProxyClient("localhost", port);
- userpass = tpc.proxy().login(new UserPass("root", ByteBuffer.wrap("".getBytes())));
+ userpass = new PrincipalToken("root", ByteBuffer.wrap("".getBytes()));
}
@AfterClass
@@ -86,6 +86,11 @@ public class TestProxyTableOperations {
}
@Test
+ public void ping() throws Exception {
+ tpc.proxy().ping(userpass);
+ }
+
+ @Test
public void createExistsDelete() throws TException {
assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
tpc.proxy().createTable(userpass, "testtable2", true, TimeType.MILLIS);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java Mon Feb 4 18:09:38 2013
@@ -32,8 +32,6 @@ import java.util.concurrent.ExecutorServ
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import org.apache.accumulo.trace.instrument.TraceRunnable;
-import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -53,8 +51,8 @@ import org.apache.accumulo.core.data.thr
import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.core.file.FileSKVIterator;
import org.apache.accumulo.core.file.FileUtil;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.LoggingRunnable;
@@ -62,6 +60,8 @@ import org.apache.accumulo.core.util.Nam
import org.apache.accumulo.core.util.StopWatch;
import org.apache.accumulo.core.util.ThriftUtil;
import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.trace.instrument.TraceRunnable;
+import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -74,7 +74,7 @@ public class BulkImporter {
private static final Logger log = Logger.getLogger(BulkImporter.class);
- public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, InstanceTokenWrapper creds, long tid, String tableId, List<String> files,
+ public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, Credentials creds, long tid, String tableId, List<String> files,
String errorDir, boolean setTime) throws IOException, AccumuloException, AccumuloSecurityException, ThriftTableOperationException {
AssignmentStats stats = new BulkImporter(conf, instance, creds, tid, tableId, setTime).importFiles(files, new Path(errorDir));
List<String> result = new ArrayList<String>();
@@ -91,13 +91,13 @@ public class BulkImporter {
}
private Instance instance;
- private InstanceTokenWrapper credentials;
+ private Credentials credentials;
private String tableId;
private long tid;
private AccumuloConfiguration acuConf;
private boolean setTime;
- public BulkImporter(AccumuloConfiguration conf, Instance instance, InstanceTokenWrapper credentials, long tid, String tableId, boolean setTime) {
+ public BulkImporter(AccumuloConfiguration conf, Instance instance, Credentials credentials, long tid, String tableId, boolean setTime) {
this.instance = instance;
this.credentials = credentials;
this.tid = tid;
@@ -415,7 +415,7 @@ public class BulkImporter {
return result;
}
- private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, InstanceTokenWrapper credentials, FileSystem fs,
+ private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, Credentials credentials, FileSystem fs,
String tableId, Map<Path,List<TabletLocation>> assignments, Collection<Path> paths, int numThreads, int numMapThreads) {
timer.start(Timers.EXAMINE_MAP_FILES);
Map<Path,List<AssignmentInfo>> assignInfo = estimateSizes(acuConf, conf, fs, assignments, paths, numMapThreads);
@@ -433,10 +433,10 @@ public class BulkImporter {
private class AssignmentTask implements Runnable {
final Map<Path,List<KeyExtent>> assignmentFailures;
String location;
- InstanceTokenWrapper credentials;
+ Credentials credentials;
private Map<KeyExtent,List<PathSize>> assignmentsPerTablet;
- public AssignmentTask(InstanceTokenWrapper credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location,
+ public AssignmentTask(Credentials credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location,
Map<KeyExtent,List<PathSize>> assignmentsPerTablet) {
this.assignmentFailures = assignmentFailures;
this.location = location;
@@ -497,7 +497,7 @@ public class BulkImporter {
}
}
- private Map<Path,List<KeyExtent>> assignMapFiles(InstanceTokenWrapper credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments,
+ private Map<Path,List<KeyExtent>> assignMapFiles(Credentials credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments,
Map<KeyExtent,String> locations, int numThreads) {
// group assignments by tablet
@@ -575,7 +575,7 @@ public class BulkImporter {
return assignmentFailures;
}
- private List<KeyExtent> assignMapFiles(InstanceTokenWrapper credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet) throws AccumuloException,
+ private List<KeyExtent> assignMapFiles(Credentials credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet) throws AccumuloException,
AccumuloSecurityException {
try {
long timeInMillis = instance.getConfiguration().getTimeInMillis(Property.TSERV_BULK_TIMEOUT);
@@ -593,7 +593,7 @@ public class BulkImporter {
}
log.debug("Asking " + location + " to bulk load " + files);
- List<TKeyExtent> failures = client.bulkImport(Tracer.traceInfo(), credentials.toThrift(), tid, Translator.translate(files, Translator.KET), setTime);
+ List<TKeyExtent> failures = client.bulkImport(Tracer.traceInfo(), credentials, tid, Translator.translate(files, Translator.KET), setTime);
return Translator.translate(failures, Translator.TKET);
} finally {
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java Mon Feb 4 18:09:38 2013
@@ -24,7 +24,6 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Callable;
-import org.apache.accumulo.trace.thrift.TInfo;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
@@ -39,16 +38,16 @@ import org.apache.accumulo.core.conf.Pro
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
-import org.apache.accumulo.core.security.thrift.ThriftInstanceTokenWrapper;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.TokenHelper;
+import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.security.AuditedSecurityOperation;
import org.apache.accumulo.server.security.SecurityOperation;
import org.apache.accumulo.server.zookeeper.TransactionWatcher;
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
+import org.apache.accumulo.trace.thrift.TInfo;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
@@ -91,149 +90,86 @@ public class ClientServiceHandler implem
}
@Override
- public void ping(ThriftInstanceTokenWrapper credentials) {
+ public void ping(Credentials credentials) {
// anybody can call this; no authentication check
log.info("Master reports: I just got pinged!");
}
@Override
- public boolean authenticateUser(TInfo tinfo, ThriftInstanceTokenWrapper credentials, ByteBuffer token) throws ThriftSecurityException {
+ public boolean authenticateUser(TInfo tinfo, Credentials credentials, String principal, ByteBuffer token) throws ThriftSecurityException {
try {
- return security.authenticateUser(new InstanceTokenWrapper(credentials), TokenHelper.unwrap(token));
+ return security.authenticateUser(credentials, principal, ByteBufferUtil.toBytes(token));
} catch (ThriftSecurityException e) {
log.error(e);
throw e;
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
}
}
@Override
- public void changeAuthorizations(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, List<ByteBuffer> authorizations)
- throws ThriftSecurityException {
- try {
- security.changeAuthorizations(new InstanceTokenWrapper(credentials), user, new Authorizations(authorizations));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public void changeAuthorizations(TInfo tinfo, Credentials credentials, String user, List<ByteBuffer> authorizations) throws ThriftSecurityException {
+ security.changeAuthorizations(credentials, user, new Authorizations(authorizations));
}
@Override
- public void changePassword(TInfo tinfo, ThriftInstanceTokenWrapper credentials, ByteBuffer token) throws ThriftSecurityException {
- try {
- security.changePassword(new InstanceTokenWrapper(credentials), TokenHelper.unwrap(token));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public void changePassword(TInfo tinfo, Credentials credentials, String principal, ByteBuffer token) throws ThriftSecurityException {
+ security.changePassword(credentials, principal, ByteBufferUtil.toBytes(token));
}
@Override
- public void createUser(TInfo tinfo, ThriftInstanceTokenWrapper credentials, ByteBuffer token, List<ByteBuffer> authorizations) throws ThriftSecurityException {
- try {
- security.createUser(new InstanceTokenWrapper(credentials), TokenHelper.unwrap(token), new Authorizations(authorizations));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public void createUser(TInfo tinfo, Credentials credentials, String principal, ByteBuffer token, List<ByteBuffer> authorizations)
+ throws ThriftSecurityException {
+ security.createUser(credentials, principal, ByteBufferUtil.toBytes(token), new Authorizations(authorizations));
}
@Override
- public void dropUser(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user) throws ThriftSecurityException {
- try {
- security.dropUser(new InstanceTokenWrapper(credentials), user);
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public void dropUser(TInfo tinfo, Credentials credentials, String user) throws ThriftSecurityException {
+ security.dropUser(credentials, user);
}
@Override
- public List<ByteBuffer> getUserAuthorizations(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user) throws ThriftSecurityException {
- try {
- return security.getUserAuthorizations(new InstanceTokenWrapper(credentials), user).getAuthorizationsBB();
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public List<ByteBuffer> getUserAuthorizations(TInfo tinfo, Credentials credentials, String user) throws ThriftSecurityException {
+ return security.getUserAuthorizations(credentials, user).getAuthorizationsBB();
}
@Override
- public void grantSystemPermission(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, byte permission) throws ThriftSecurityException {
- try {
- security.grantSystemPermission(new InstanceTokenWrapper(credentials), user, SystemPermission.getPermissionById(permission));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public void grantSystemPermission(TInfo tinfo, Credentials credentials, String user, byte permission) throws ThriftSecurityException {
+ security.grantSystemPermission(credentials, user, SystemPermission.getPermissionById(permission));
}
@Override
- public void grantTablePermission(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, String tableName, byte permission)
- throws ThriftSecurityException, ThriftTableOperationException {
+ public void grantTablePermission(TInfo tinfo, Credentials credentials, String user, String tableName, byte permission) throws ThriftSecurityException,
+ ThriftTableOperationException {
String tableId = checkTableId(tableName, TableOperation.PERMISSION);
- try {
- security.grantTablePermission(new InstanceTokenWrapper(credentials), user, tableId, TablePermission.getPermissionById(permission));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ security.grantTablePermission(credentials, user, tableId, TablePermission.getPermissionById(permission));
}
@Override
- public void revokeSystemPermission(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, byte permission) throws ThriftSecurityException {
- try {
- security.revokeSystemPermission(new InstanceTokenWrapper(credentials), user, SystemPermission.getPermissionById(permission));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public void revokeSystemPermission(TInfo tinfo, Credentials credentials, String user, byte permission) throws ThriftSecurityException {
+ security.revokeSystemPermission(credentials, user, SystemPermission.getPermissionById(permission));
}
@Override
- public void revokeTablePermission(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, String tableName, byte permission)
- throws ThriftSecurityException, ThriftTableOperationException {
+ public void revokeTablePermission(TInfo tinfo, Credentials credentials, String user, String tableName, byte permission) throws ThriftSecurityException,
+ ThriftTableOperationException {
String tableId = checkTableId(tableName, TableOperation.PERMISSION);
- try {
- security.revokeTablePermission(new InstanceTokenWrapper(credentials), user, tableId, TablePermission.getPermissionById(permission));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ security.revokeTablePermission(credentials, user, tableId, TablePermission.getPermissionById(permission));
}
@Override
- public boolean hasSystemPermission(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, byte sysPerm) throws ThriftSecurityException {
- try {
- return security.hasSystemPermission(new InstanceTokenWrapper(credentials), user, SystemPermission.getPermissionById(sysPerm));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public boolean hasSystemPermission(TInfo tinfo, Credentials credentials, String user, byte sysPerm) throws ThriftSecurityException {
+ return security.hasSystemPermission(credentials, user, SystemPermission.getPermissionById(sysPerm));
}
@Override
- public boolean hasTablePermission(TInfo tinfo, ThriftInstanceTokenWrapper credentials, String user, String tableName, byte tblPerm)
- throws ThriftSecurityException, ThriftTableOperationException {
+ public boolean hasTablePermission(TInfo tinfo, Credentials credentials, String user, String tableName, byte tblPerm) throws ThriftSecurityException,
+ ThriftTableOperationException {
String tableId = checkTableId(tableName, TableOperation.PERMISSION);
- try {
- return security.hasTablePermission(new InstanceTokenWrapper(credentials), user, tableId, TablePermission.getPermissionById(tblPerm));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ return security.hasTablePermission(credentials, user, tableId, TablePermission.getPermissionById(tblPerm));
}
@Override
- public Set<String> listUsers(TInfo tinfo, ThriftInstanceTokenWrapper credentials) throws ThriftSecurityException {
- try {
- return security.listUsers(new InstanceTokenWrapper(credentials));
- } catch (AccumuloSecurityException e) {
- log.error(e);
- throw e.asThriftException();
- }
+ public Set<String> listUsers(TInfo tinfo, Credentials credentials) throws ThriftSecurityException {
+ return security.listUsers(credentials);
}
static private Map<String,String> conf(AccumuloConfiguration conf) {
@@ -266,10 +202,10 @@ public class ClientServiceHandler implem
}
@Override
- public List<String> bulkImportFiles(TInfo tinfo, final ThriftInstanceTokenWrapper tikw, final long tid, final String tableId, final List<String> files,
+ public List<String> bulkImportFiles(TInfo tinfo, final Credentials tikw, final long tid, final String tableId, final List<String> files,
final String errorDir, final boolean setTime) throws ThriftSecurityException, ThriftTableOperationException, TException {
try {
- final InstanceTokenWrapper credentials = new InstanceTokenWrapper(tikw);
+ final Credentials credentials = new Credentials(tikw);
if (!security.hasSystemPermission(credentials, credentials.getPrincipal(), SystemPermission.SYSTEM))
throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
return transactionWatcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, new Callable<List<String>>() {
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java Mon Feb 4 18:09:38 2013
@@ -32,11 +32,9 @@ import org.apache.accumulo.core.client.i
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.UserPassToken;
+import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.StringUtil;
import org.apache.accumulo.core.util.TextUtil;
@@ -56,7 +54,6 @@ import org.apache.thrift.transport.TTran
* An implementation of Instance that looks in HDFS and ZooKeeper to find the master and root tablet location.
*
*/
-@SuppressWarnings("deprecation")
public class HdfsZooInstance implements Instance {
public static class AccumuloNotInitializedException extends RuntimeException {
@@ -147,25 +144,20 @@ public class HdfsZooInstance implements
return (int) ServerConfiguration.getSiteConfiguration().getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT);
}
- /**
- * @deprecated since 1.5, use {@link #getConnector(SecurityToken)}
- */
+ @SuppressWarnings("deprecation")
@Override
+ // Not really deprecated, just not for client use
public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
- return getConnector(new UserPassToken(user, pass));
+ return new ConnectorImpl(this, user, pass);
}
- /**
- * @deprecated since 1.5, use {@link #getConnector(SecurityToken)}
- */
+ @SuppressWarnings("deprecation")
@Override
+ // Not really deprecated, just not for client use
public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
- return getConnector(new UserPassToken(user, pass));
+ return new ConnectorImpl(this, user, ByteBufferUtil.toBytes(pass));
}
- /**
- * @deprecated since 1.5, use {@link #getConnector(SecurityToken)}
- */
@Override
public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));
@@ -193,29 +185,17 @@ public class HdfsZooInstance implements
System.out.println("Masters: " + StringUtil.join(instance.getMasterLocations(), ", "));
}
- /**
- * @deprecated since 1.5, use {@link #getConnector(SecurityToken)}
- */
@Override
- public Connector getConnector(AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
- return getConnector(UserPassToken.convertAuthInfo(auth));
- }
-
- public Connector getConnector(SecurityToken token) throws AccumuloException, AccumuloSecurityException {
- return new ConnectorImpl(this, token);
- }
-
- @Override
- public Connector getConnector(InstanceTokenWrapper token) throws AccumuloException, AccumuloSecurityException {
- return getConnector(token.getToken());
+ public Connector getConnector(Credentials auth) throws AccumuloException, AccumuloSecurityException {
+ return getConnector(auth.getPrincipal(), auth.getToken());
}
@Override
- public String getSecurityTokenClass() throws AccumuloException {
+ public String getAuthenticatorClassName() throws AccumuloException {
Client client = null;
try {
client = MasterClient.getConnectionWithRetry(this);
- return client.getSecurityTokenClass();
+ return client.getAuthenticatorClassName();
} catch (TTransportException e) {
throw new AccumuloException(e);
} catch (ThriftSecurityException e) {
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java Mon Feb 4 18:09:38 2013
@@ -26,11 +26,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
-import org.apache.accumulo.trace.instrument.Span;
-import org.apache.accumulo.trace.instrument.Trace;
-import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -45,6 +41,9 @@ import org.apache.accumulo.server.util.A
import org.apache.accumulo.server.util.MetadataTable;
import org.apache.accumulo.server.util.MetadataTable.LogEntry;
import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.trace.instrument.Span;
+import org.apache.accumulo.trace.instrument.Trace;
+import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -142,13 +141,11 @@ public class GarbageCollectWriteAheadLog
Client tserver = null;
try {
tserver = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
- tserver.removeLogs(Tracer.traceInfo(), SecurityConstants.getSystemCredentials().toThrift(), entry.getValue());
+ tserver.removeLogs(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), entry.getValue());
log.debug("deleted " + entry.getValue() + " from " + entry.getKey());
status.currentLog.deleted += entry.getValue().size();
} catch (TException e) {
log.warn("Error talking to " + address + ": " + e);
- } catch (AccumuloSecurityException e) {
- log.warn("Error generating system credentials");
} finally {
if (tserver != null)
ThriftUtil.returnClient(tserver);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java Mon Feb 4 18:09:38 2013
@@ -64,9 +64,7 @@ import org.apache.accumulo.core.gc.thrif
import org.apache.accumulo.core.gc.thrift.GCStatus;
import org.apache.accumulo.core.gc.thrift.GcCycleStats;
import org.apache.accumulo.core.master.state.tables.TableState;
-import org.apache.accumulo.core.security.SecurityUtil;
-import org.apache.accumulo.core.security.thrift.ThriftInstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.util.ServerServices;
@@ -81,6 +79,7 @@ import org.apache.accumulo.server.client
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.master.state.tables.TableManager;
import org.apache.accumulo.server.security.SecurityConstants;
+import org.apache.accumulo.core.security.SecurityUtil;
import org.apache.accumulo.server.trace.TraceFileSystem;
import org.apache.accumulo.server.util.Halt;
import org.apache.accumulo.server.util.OfflineMetadataScanner;
@@ -120,7 +119,7 @@ public class SimpleGarbageCollector impl
private static final Logger log = Logger.getLogger(SimpleGarbageCollector.class);
- private InstanceTokenWrapper credentials;
+ private Credentials credentials;
private long gcStartDelay;
private boolean checkForBulkProcessingFiles;
private FileSystem fs;
@@ -180,7 +179,7 @@ public class SimpleGarbageCollector impl
this.address = address;
}
- public void init(FileSystem fs, Instance instance, InstanceTokenWrapper credentials, boolean noTrash) throws IOException {
+ public void init(FileSystem fs, Instance instance, Credentials credentials, boolean noTrash) throws IOException {
this.fs = TraceFileSystem.wrap(fs);
this.credentials = credentials;
this.instance = instance;
@@ -423,7 +422,7 @@ public class SimpleGarbageCollector impl
return candidates;
}
- Scanner scanner = instance.getConnector(credentials).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
+ Scanner scanner = instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
if (continueKey != null) {
// want to ensure GC makes progress... if the 1st N deletes are stable and we keep processing them, then will never inspect deletes after N
@@ -471,7 +470,7 @@ public class SimpleGarbageCollector impl
}
} else {
try {
- scanner = new IsolatedScanner(instance.getConnector(credentials).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS));
+ scanner = new IsolatedScanner(instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS));
} catch (AccumuloSecurityException ex) {
throw new AccumuloException(ex);
} catch (TableNotFoundException ex) {
@@ -562,7 +561,7 @@ public class SimpleGarbageCollector impl
if (!offline) {
Connector c;
try {
- c = instance.getConnector(SecurityConstants.getSystemCredentials());
+ c = instance.getConnector(SecurityConstants.SYSTEM_PRINCIPAL, SecurityConstants.getSystemToken());
writer = c.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
} catch (Exception e) {
log.error("Unable to create writer to remove file from the !METADATA table", e);
@@ -688,7 +687,7 @@ public class SimpleGarbageCollector impl
}
@Override
- public GCStatus getStatus(TInfo info, ThriftInstanceTokenWrapper credentials) {
+ public GCStatus getStatus(TInfo info, Credentials credentials) {
return status;
}
}