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/01/25 08:04:29 UTC
svn commit: r1438354 [8/12] - in /accumulo/trunk: ./ assemble/ bin/
conf/examples/1GB/native-standalone/ conf/examples/1GB/standalone/
conf/examples/2GB/native-standalone/ conf/examples/2GB/standalone/
conf/examples/3GB/native-standalone/ conf/examples...
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java Fri Jan 25 07:04:25 2013
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
import org.apache.hadoop.io.Text;
public class MetadataTable {
@@ -169,7 +169,7 @@ public class MetadataTable {
return new Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>>(results, locationless);
}
- public static SortedMap<Text,SortedMap<ColumnFQ,Value>> getTabletEntries(Instance instance, KeyExtent ke, List<ColumnFQ> columns, AuthInfo credentials) {
+ public static SortedMap<Text,SortedMap<ColumnFQ,Value>> getTabletEntries(Instance instance, KeyExtent ke, List<ColumnFQ> columns, InstanceTokenWrapper credentials) {
TreeMap<Key,Value> tkv = new TreeMap<Key,Value>();
getTabletAndPrevTabletKeyValues(instance, tkv, ke, columns, credentials);
return getTabletEntries(tkv, columns);
@@ -203,7 +203,7 @@ public class MetadataTable {
return tabletEntries;
}
- public static void getTabletAndPrevTabletKeyValues(Instance instance, SortedMap<Key,Value> tkv, KeyExtent ke, List<ColumnFQ> columns, AuthInfo credentials) {
+ public static void getTabletAndPrevTabletKeyValues(Instance instance, SortedMap<Key,Value> tkv, KeyExtent ke, List<ColumnFQ> columns, InstanceTokenWrapper credentials) {
Text startRow;
Text endRow = ke.getMetadataEntry();
@@ -236,11 +236,11 @@ public class MetadataTable {
}
}
- public static void getEntries(Instance instance, AuthInfo credentials, String table, boolean isTid, Map<KeyExtent,String> locations,
+ public static void getEntries(Instance instance, InstanceTokenWrapper credentials, String table, boolean isTid, Map<KeyExtent,String> locations,
SortedSet<KeyExtent> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
String tableId = isTid ? table : Tables.getNameToIdMap(instance).get(table);
- Scanner scanner = instance.getConnector(credentials.user, credentials.password).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
+ Scanner scanner = instance.getConnector(credentials.getToken()).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Fri Jan 25 07:04:25 2013
@@ -21,7 +21,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
-import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -53,7 +52,8 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.data.thrift.TConstraintViolationSummary;
import org.apache.accumulo.core.security.AuditLevel;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.tokens.AccumuloToken;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
import org.apache.accumulo.core.trace.DistributedTrace;
import org.apache.accumulo.core.util.BadArgumentException;
@@ -168,7 +168,7 @@ public class Shell extends ShellOptions
protected Instance instance;
private Connector connector;
protected ConsoleReader reader;
- private AuthInfo credentials;
+ private AccumuloToken<?,?> credentials;
private Class<? extends Formatter> defaultFormatterClass = DefaultFormatter.class;
private Class<? extends Formatter> binaryFormatterClass = BinaryFormatter.class;
public Map<String,List<IteratorSetting>> scanIteratorOptions = new HashMap<String,List<IteratorSetting>>();
@@ -276,9 +276,7 @@ public class Shell extends ShellOptions
pass = passw.getBytes();
this.setTableName("");
- connector = instance.getConnector(user, pass);
- this.credentials = new AuthInfo(user, ByteBuffer.wrap(pass), connector.getInstance().getInstanceID());
-
+ this.credentials = updateUser(user, pass);
} catch (Exception e) {
printException(e);
configError = true;
@@ -317,8 +315,8 @@ public class Shell extends ShellOptions
new TablesCommand()};
Command[] tableControlCommands = {new AddSplitsCommand(), new CompactCommand(), new ConstraintCommand(), new FlushCommand(), new GetGroupsCommand(),
new GetSplitsCommand(), new MergeCommand(), new SetGroupsCommand()};
- Command[] userCommands = {new AddAuthsCommand(), new CreateUserCommand(), new DeleteUserCommand(), new DropUserCommand(), new GetAuthsCommand(), new PasswdCommand(),
- new SetAuthsCommand(), new UsersCommand()};
+ Command[] userCommands = {new AddAuthsCommand(), new CreateUserCommand(), new DeleteUserCommand(), new DropUserCommand(), new GetAuthsCommand(),
+ new PasswdCommand(), new SetAuthsCommand(), new UsersCommand()};
commandGrouping.put("-- Writing, Reading, and Removing Data --", dataCommands);
commandGrouping.put("-- Debugging Commands -------------------", debuggingCommands);
commandGrouping.put("-- Shell Execution Commands -------------", execCommands);
@@ -518,7 +516,7 @@ public class Shell extends ShellOptions
} // user canceled
try {
- authFailed = !connector.securityOperations().authenticateUser(connector.whoami(), pwd.getBytes());
+ authFailed = !connector.securityOperations().authenticateUser(credentials);
} catch (Exception e) {
++exitCode;
printException(e);
@@ -778,7 +776,7 @@ public class Shell extends ShellOptions
public final void printLines(Iterator<String> lines, boolean paginate) throws IOException {
printLines(lines, paginate, null);
}
-
+
public final void printLines(Iterator<String> lines, boolean paginate, PrintLine out) throws IOException {
int linesPrinted = 0;
String prompt = "-- hit any key to continue or 'q' to quit --";
@@ -933,12 +931,31 @@ public class Shell extends ShellOptions
return reader;
}
- public void updateUser(AuthInfo authInfo) throws AccumuloException, AccumuloSecurityException {
- connector = instance.getConnector(authInfo);
- credentials = authInfo;
+ public AccumuloToken<?,?> updateUser(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
+ AccumuloToken<?,?> token;
+ try {
+ String tokenClass = instance.getSecurityTokenClass();
+ System.out.println(tokenClass);
+ if (tokenClass.equals(UserPassToken.class.getCanonicalName())) {
+ token = new UserPassToken(user, pass);
+// } else if (tokenClass.equals(KerberosToken.class.getCanonicalName())) {
+// token = new KerberosToken(user, new String(pass).toCharArray(), "accumulo");
+ } else
+ throw new RuntimeException("CLI can't handle alternative tokens... yet");
+ } catch (AccumuloException e) {
+ throw new RuntimeException(e);
+// } catch (GeneralSecurityException e) {
+// throw new RuntimeException(e);
+ }
+
+ connector = instance.getConnector(token);
+ credentials = token;
+ if (!connector.securityOperations().authenticateUser(token))
+ throw new RuntimeException("Unable to authenticate user " + token.getPrincipal());
+ return token;
}
- public AuthInfo getCredentials() {
+ public AccumuloToken<?,?> getCredentials() {
return credentials;
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java Fri Jan 25 07:04:25 2013
@@ -22,6 +22,7 @@ import org.apache.accumulo.core.client.A
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
@@ -47,7 +48,7 @@ public class CreateUserCommand extends C
if (!password.equals(passwordConfirm)) {
throw new IllegalArgumentException("Passwords do not match");
}
- shellState.getConnector().securityOperations().createUser(user, password.getBytes());
+ shellState.getConnector().securityOperations().createUser(new UserPassToken(user, password));
Shell.log.debug("Created user " + user);
return 0;
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java Fri Jan 25 07:04:25 2013
@@ -17,12 +17,11 @@
package org.apache.accumulo.core.util.shell.commands;
import java.io.IOException;
-import java.nio.ByteBuffer;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
@@ -47,7 +46,7 @@ public class PasswdCommand extends Comma
return 0;
} // user canceled
- if (!shellState.getConnector().securityOperations().authenticateUser(currentUser, oldPassword.getBytes()))
+ if (!shellState.getConnector().securityOperations().authenticateUser(new UserPassToken(currentUser, oldPassword)))
throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
@@ -65,11 +64,11 @@ public class PasswdCommand extends Comma
throw new IllegalArgumentException("Passwords do not match");
}
byte[] pass = password.getBytes();
- shellState.getConnector().securityOperations().changeUserPassword(user, pass);
+ shellState.getConnector().securityOperations().changeUserPassword(new UserPassToken(user, pass));
// update the current credentials if the password changed was for
// the current user
if (shellState.getConnector().whoami().equals(user)) {
- shellState.updateUser(new AuthInfo(user, ByteBuffer.wrap(pass), shellState.getConnector().getInstance().getInstanceID()));
+ shellState.updateUser(user, pass);
}
Shell.log.debug("Changed password for user " + user);
return 0;
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java Fri Jan 25 07:04:25 2013
@@ -37,7 +37,7 @@ public class TraceCommand extends DebugC
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException {
if (cl.getArgs().length == 1) {
if (cl.getArgs()[0].equalsIgnoreCase("on")) {
- Trace.on("shell:" + shellState.getCredentials().user);
+ Trace.on("shell:" + shellState.getCredentials().getPrincipal());
} else if (cl.getArgs()[0].equalsIgnoreCase("off")) {
if (Trace.isTracing()) {
final long trace = Trace.currentTrace().traceId();
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java Fri Jan 25 07:04:25 2013
@@ -17,13 +17,11 @@
package org.apache.accumulo.core.util.shell.commands;
import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Set;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.accumulo.core.util.shell.Token;
@@ -44,7 +42,7 @@ public class UserCommand extends Command
return 0;
} // user canceled
pass = p.getBytes();
- shellState.updateUser(new AuthInfo(user, ByteBuffer.wrap(pass), shellState.getConnector().getInstance().getInstanceID()));
+ shellState.updateUser(user, pass);
return 0;
}
Modified: accumulo/trunk/core/src/main/thrift/client.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/client.thrift?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/client.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/client.thrift Fri Jan 25 07:04:25 2013
@@ -70,31 +70,31 @@ service ClientService {
string getInstanceId()
string getZooKeepers()
- list<string> bulkImportFiles(1:cloudtrace.TInfo tinfo, 2:security.AuthInfo credentials, 3:i64 tid, 4:string tableId, 5:list<string> files, 6:string errorDir, 7:bool setTime) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope);
+ list<string> bulkImportFiles(1:cloudtrace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:i64 tid, 4:string tableId, 5:list<string> files, 6:string errorDir, 7:bool setTime) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope);
// ensures that nobody is working on the transaction id above
bool isActive(1:cloudtrace.TInfo tinfo, 2:i64 tid),
- void ping(1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
+ void ping(1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
// user management methods
- bool authenticateUser(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:binary password) throws (1:security.ThriftSecurityException sec)
- set<string> listUsers(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
- void createUser(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:binary password, 4:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
- void dropUser(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user) throws (1:security.ThriftSecurityException sec)
- void changePassword(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:binary password) throws (1:security.ThriftSecurityException sec)
- void changeAuthorizations(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
- list<binary> getUserAuthorizations(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user) throws (1:security.ThriftSecurityException sec)
- bool hasSystemPermission(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:byte sysPerm) throws (1:security.ThriftSecurityException sec)
- bool hasTablePermission(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:string tableName, 4:byte tblPerm) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
- void grantSystemPermission(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:byte permission) throws (1:security.ThriftSecurityException sec)
- void revokeSystemPermission(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:byte permission) throws (1:security.ThriftSecurityException sec)
- void grantTablePermission(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
- void revokeTablePermission(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string user, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ bool authenticateUser(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 3:binary Token) throws (1:security.ThriftSecurityException sec)
+ set<string> listUsers(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ void createUser(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:binary token, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
+ void dropUser(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user) throws (1:security.ThriftSecurityException sec)
+ void changePassword(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:binary token) throws (1:security.ThriftSecurityException sec)
+ void changeAuthorizations(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
+ list<binary> getUserAuthorizations(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user) throws (1:security.ThriftSecurityException sec)
+ bool hasSystemPermission(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:byte sysPerm) throws (1:security.ThriftSecurityException sec)
+ bool hasTablePermission(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:string tableName, 4:byte tblPerm) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ void grantSystemPermission(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:byte permission) throws (1:security.ThriftSecurityException sec)
+ void revokeSystemPermission(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:byte permission) throws (1:security.ThriftSecurityException sec)
+ void grantTablePermission(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ void revokeTablePermission(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
map<string, string> getConfiguration(1:ConfigurationType type);
map<string, string> getTableConfiguration(2:string tableName) throws (1:ThriftTableOperationException tope);
bool checkClass(1:cloudtrace.TInfo tinfo, 2:string className, 3:string interfaceMatch);
-}
+ }
// Only used for a unit test
service ThriftTest {
Modified: accumulo/trunk/core/src/main/thrift/gc.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/gc.thrift?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/gc.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/gc.thrift Fri Jan 25 07:04:25 2013
@@ -38,5 +38,5 @@ struct GCStatus {
service GCMonitorService {
- GCStatus getStatus(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec);
+ GCStatus getStatus(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec);
}
Modified: accumulo/trunk/core/src/main/thrift/master.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/master.thrift?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/master.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/master.thrift Fri Jan 25 07:04:25 2013
@@ -131,29 +131,31 @@ enum TableOperation {
service MasterClientService {
// table management methods
- i64 initiateFlush(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string tableName) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void waitForFlush(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string tableName, 6:binary startRow, 7:binary endRow, 3:i64 flushID, 4:i64 maxLoops) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ i64 initiateFlush(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableName) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void waitForFlush(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableName, 6:binary startRow, 7:binary endRow, 3:i64 flushID, 4:i64 maxLoops) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void setTableProperty(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string tableName, 3:string property, 4:string value) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void removeTableProperty(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string tableName, 3:string property) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void setTableProperty(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableName, 3:string property, 4:string value) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void removeTableProperty(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableName, 3:string property) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
// system management methods
- void setMasterGoalState(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:MasterGoalState state) throws (1:security.ThriftSecurityException sec);
- void shutdown(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:bool stopTabletServers) throws (1:security.ThriftSecurityException sec)
- void shutdownTabletServer(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string tabletServer, 4:bool force) throws (1: security.ThriftSecurityException sec)
- void setSystemProperty(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string property, 3:string value) throws (1:security.ThriftSecurityException sec)
- void removeSystemProperty(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string property) throws (1:security.ThriftSecurityException sec)
+ void setMasterGoalState(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:MasterGoalState state) throws (1:security.ThriftSecurityException sec);
+ void shutdown(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:bool stopTabletServers) throws (1:security.ThriftSecurityException sec)
+ void shutdownTabletServer(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tabletServer, 4:bool force) throws (1: security.ThriftSecurityException sec)
+ void setSystemProperty(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string property, 3:string value) throws (1:security.ThriftSecurityException sec)
+ void removeSystemProperty(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string property) throws (1:security.ThriftSecurityException sec)
// system monitoring methods
- MasterMonitorInfo getMasterStats(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
+ MasterMonitorInfo getMasterStats(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
// tablet server reporting
- oneway void reportSplitExtent(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string serverName, 3:TabletSplit split)
- oneway void reportTabletStatus(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string serverName, 3:TabletLoadState status, 4:data.TKeyExtent tablet)
+ oneway void reportSplitExtent(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string serverName, 3:TabletSplit split)
+ oneway void reportTabletStatus(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string serverName, 3:TabletLoadState status, 4:data.TKeyExtent tablet)
//table operations
- i64 beginTableOperation(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
- void executeTableOperation(7:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:i64 opid, 3:TableOperation op, 4:list<binary> arguments, 5:map<string, string> options, 6:bool autoClean)throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- string waitForTableOperation(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void finishTableOperation(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec)
+ i64 beginTableOperation(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ void executeTableOperation(7:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:i64 opid, 3:TableOperation op, 4:list<binary> arguments, 5:map<string, string> options, 6:bool autoClean)throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ string waitForTableOperation(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void finishTableOperation(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec)
+ string getSecurityTokenClass();
+
}
Modified: accumulo/trunk/core/src/main/thrift/security.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/security.thrift?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/security.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/security.thrift Fri Jan 25 07:04:25 2013
@@ -27,15 +27,30 @@ enum SecurityErrorCode {
GRANT_INVALID = 6,
BAD_AUTHORIZATIONS = 7,
INVALID_INSTANCEID = 8,
- TABLE_DOESNT_EXIST = 9
+ TABLE_DOESNT_EXIST = 9,
+ UNSUPPORTED_OPERATION = 10,
+ INVALID_TOKEN = 11,
+ AUTHENTICATOR_FAILED = 12,
+ AUTHORIZOR_FAILED = 13,
+ PERMISSIONHANDLER_FAILED = 14,
+ TOKEN_EXPIRED = 15
}
-struct AuthInfo {
+struct ThriftUserPassToken {
1:string user,
- 2:binary password,
- 3:string instanceId
+ 2:binary password
}
+struct ThriftKerberosToken {
+ 1:string user,
+ 2:binary ticket
+}
+
+struct ThriftInstanceTokenWrapper {
+ 1: binary token,
+ 2: string tokenClass,
+ 3: string instance
+}
exception ThriftSecurityException {
1:string user,
2:SecurityErrorCode code
Modified: accumulo/trunk/core/src/main/thrift/tabletserver.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/tabletserver.thrift?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/tabletserver.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/tabletserver.thrift Fri Jan 25 07:04:25 2013
@@ -130,7 +130,7 @@ struct IteratorConfig {
service TabletClientService extends client.ClientService {
// scan a range of keys
data.InitialScan startScan(11:cloudtrace.TInfo tinfo,
- 1:security.AuthInfo credentials,
+ 1:security.ThriftInstanceTokenWrapper credentials,
2:data.TKeyExtent extent,
3:data.TRange range,
4:list<data.TColumn> columns,
@@ -146,7 +146,7 @@ service TabletClientService extends clie
// scan over a series of ranges
data.InitialMultiScan startMultiScan(8:cloudtrace.TInfo tinfo,
- 1:security.AuthInfo credentials,
+ 1:security.ThriftInstanceTokenWrapper credentials,
2:data.ScanBatch batch,
3:list<data.TColumn> columns,
4:list<data.IterInfo> ssiList,
@@ -157,37 +157,37 @@ service TabletClientService extends clie
void closeMultiScan(2:cloudtrace.TInfo tinfo, 1:data.ScanID scanID) throws (1:NoSuchScanIDException nssi),
//the following calls support a batch update to multiple tablets on a tablet server
- data.UpdateID startUpdate(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec),
+ data.UpdateID startUpdate(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec),
oneway void applyUpdates(1:cloudtrace.TInfo tinfo, 2:data.UpdateID updateID, 3:data.TKeyExtent keyExtent, 4:list<data.TMutation> mutations),
data.UpdateErrors closeUpdate(2:cloudtrace.TInfo tinfo, 1:data.UpdateID updateID) throws (1:NoSuchScanIDException nssi),
//the following call supports making a single update to a tablet
- void update(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:data.TKeyExtent keyExtent, 3:data.TMutation mutation)
+ void update(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:data.TKeyExtent keyExtent, 3:data.TMutation mutation)
throws (1:security.ThriftSecurityException sec,
2:NotServingTabletException nste,
3:ConstraintViolationException cve),
// on success, returns an empty list
- list<data.TKeyExtent> bulkImport(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 4:i64 tid, 2:data.TabletFiles files, 5:bool setTime) throws (1:security.ThriftSecurityException sec),
+ list<data.TKeyExtent> bulkImport(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 4:i64 tid, 2:data.TabletFiles files, 5:bool setTime) throws (1:security.ThriftSecurityException sec),
- void splitTablet(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:data.TKeyExtent extent, 3:binary splitPoint) throws (1:security.ThriftSecurityException sec, 2:NotServingTabletException nste)
+ void splitTablet(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:data.TKeyExtent extent, 3:binary splitPoint) throws (1:security.ThriftSecurityException sec, 2:NotServingTabletException nste)
- oneway void loadTablet(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 4:string lock, 2:data.TKeyExtent extent),
- oneway void unloadTablet(5:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 4:string lock, 2:data.TKeyExtent extent, 3:bool save),
- oneway void flush(4:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 3:string lock, 2:string tableId, 5:binary startRow, 6:binary endRow),
- oneway void flushTablet(1:cloudtrace.TInfo tinfo, 2:security.AuthInfo credentials, 3:string lock, 4:data.TKeyExtent extent),
- oneway void chop(1:cloudtrace.TInfo tinfo, 2:security.AuthInfo credentials, 3:string lock, 4:data.TKeyExtent extent),
- oneway void compact(1:cloudtrace.TInfo tinfo, 2:security.AuthInfo credentials, 3:string lock, 4:string tableId, 5:binary startRow, 6:binary endRow),
+ oneway void loadTablet(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 4:string lock, 2:data.TKeyExtent extent),
+ oneway void unloadTablet(5:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 4:string lock, 2:data.TKeyExtent extent, 3:bool save),
+ oneway void flush(4:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 2:string tableId, 5:binary startRow, 6:binary endRow),
+ oneway void flushTablet(1:cloudtrace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 4:data.TKeyExtent extent),
+ oneway void chop(1:cloudtrace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 4:data.TKeyExtent extent),
+ oneway void compact(1:cloudtrace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 4:string tableId, 5:binary startRow, 6:binary endRow),
- master.TabletServerStatus getTabletServerStatus(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
- list<TabletStats> getTabletStats(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string tableId) throws (1:security.ThriftSecurityException sec)
- TabletStats getHistoricalStats(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
- void halt(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string lock) throws (1:security.ThriftSecurityException sec)
- oneway void fastHalt(3:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials, 2:string lock);
+ master.TabletServerStatus getTabletServerStatus(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ list<TabletStats> getTabletStats(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableId) throws (1:security.ThriftSecurityException sec)
+ TabletStats getHistoricalStats(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ void halt(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string lock) throws (1:security.ThriftSecurityException sec)
+ oneway void fastHalt(3:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string lock);
- list<ActiveScan> getActiveScans(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
- list<ActiveCompaction> getActiveCompactions(2:cloudtrace.TInfo tinfo, 1:security.AuthInfo credentials) throws (1:security.ThriftSecurityException sec)
- oneway void removeLogs(1:cloudtrace.TInfo tinfo, 2:security.AuthInfo credentials, 3:list<string> filenames)
+ list<ActiveScan> getActiveScans(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ list<ActiveCompaction> getActiveCompactions(2:cloudtrace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ oneway void removeLogs(1:cloudtrace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:list<string> filenames)
}
typedef i32 TabletID
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java Fri Jan 25 07:04:25 2013
@@ -43,7 +43,7 @@ public class TestClientOpts {
BatchScannerOpts bsOpts = new BatchScannerOpts();
assertEquals(System.getProperty("user.name"), args.user);
assertNull(args.securePassword);
- assertArrayEquals("secret".getBytes(), args.getPassword());
+ assertArrayEquals("secret".getBytes(), args.password.value);
assertEquals(new Long(cfg.getMaxLatency(TimeUnit.MILLISECONDS)), bwOpts.batchLatency);
assertEquals(new Long(cfg.getTimeout(TimeUnit.MILLISECONDS)), bwOpts.batchTimeout);
assertEquals(new Long(cfg.getMaxMemory()), bwOpts.batchMemory);
@@ -74,7 +74,7 @@ public class TestClientOpts {
"--help");
assertEquals("bar", args.user);
assertNull(args.securePassword);
- assertArrayEquals("foo".getBytes(), args.getPassword());
+ assertArrayEquals("foo".getBytes(), args.password.value);
assertEquals(new Long(3000), bwOpts.batchLatency);
assertEquals(new Long(2000), bwOpts.batchTimeout);
assertEquals(new Long(1024*1024), bwOpts.batchMemory);
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java Fri Jan 25 07:04:25 2013
@@ -30,6 +30,7 @@ import org.apache.accumulo.core.client.m
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.hadoop.io.Text;
public class FindMaxTest extends TestCase {
@@ -49,7 +50,7 @@ public class FindMaxTest extends TestCas
public void test1() throws Exception {
MockInstance mi = new MockInstance();
- Connector conn = mi.getConnector("root", "");
+ Connector conn = mi.getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("foo");
BatchWriter bw = conn.createBatchWriter("foo", new BatchWriterConfig());
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java Fri Jan 25 07:04:25 2013
@@ -48,6 +48,9 @@ import org.apache.accumulo.core.data.Par
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.tokens.AccumuloToken;
+import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
@@ -417,12 +420,23 @@ public class TabletLocatorImplTest exten
this.rtl = rtl;
}
+ /**
+ * @deprecated @since 1.5
+ */
@Override
public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
throw new UnsupportedOperationException();
}
@Override
+ public Connector getConnector(InstanceTokenWrapper itw) throws AccumuloException, AccumuloSecurityException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @deprecated @since 1.5
+ */
+ @Override
public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
throw new UnsupportedOperationException();
}
@@ -439,15 +453,30 @@ public class TabletLocatorImplTest exten
this.conf = conf;
}
+ /**
+ * @deprecated @since 1.5
+ */
@Override
public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
throw new UnsupportedOperationException();
}
+ /**
+ * @deprecated @since 1.5
+ */
@Override
public Connector getConnector(AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
return getConnector(auth.user, auth.password);
}
+
+ public Connector getConnector(AccumuloToken<?,?> token) throws AccumuloException, AccumuloSecurityException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getSecurityTokenClass() throws AccumuloException {
+ return UserPassToken.class.getCanonicalName();
+ }
}
static class TServers {
@@ -574,7 +603,7 @@ public class TabletLocatorImplTest exten
throw new RuntimeException("Asked for empty tablet, but non empty tablet exists");
}
}
-
+
static void setLocation(TServers tservers, String server, KeyExtent tablet, KeyExtent ke, String location) {
Map<KeyExtent,SortedMap<Key,Value>> tablets = tservers.tservers.get(server);
if (tablets == null) {
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java Fri Jan 25 07:04:25 2013
@@ -34,6 +34,7 @@ import org.apache.accumulo.core.conf.Pro
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
@@ -56,7 +57,7 @@ public class AccumuloFileOutputFormatTes
folder.create();
MockInstance mockInstance = new MockInstance("testinstance");
- Connector c = mockInstance.getConnector("root", new byte[] {});
+ Connector c = mockInstance.getConnector(new UserPassToken("root", new byte[0]));
c.tableOperations().create("emptytable");
c.tableOperations().create("testtable");
c.tableOperations().create("badtable");
@@ -135,7 +136,7 @@ public class AccumuloFileOutputFormatTes
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
+ AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass.getBytes(Charset.forName("UTF-8"))));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, "testinstance");
AccumuloFileOutputFormat.setOutputPath(job, new Path(args[3]));
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java Fri Jan 25 07:04:25 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTru
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.List;
import org.apache.accumulo.core.client.BatchWriter;
@@ -36,6 +35,7 @@ import org.apache.accumulo.core.data.Mut
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.user.RegExFilter;
import org.apache.accumulo.core.iterators.user.WholeRowIterator;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.commons.codec.binary.Base64;
import org.apache.hadoop.conf.Configuration;
@@ -236,7 +236,7 @@ public class AccumuloInputFormatTest {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
+ AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, "testmapinstance");
@@ -260,7 +260,7 @@ public class AccumuloInputFormatTest {
@Test
public void testMap() throws Exception {
MockInstance mockInstance = new MockInstance("testmapinstance");
- Connector c = mockInstance.getConnector("root", new byte[] {});
+ Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
c.tableOperations().create("testtable");
BatchWriter bw = c.createBatchWriter("testtable", new BatchWriterConfig());
for (int i = 0; i < 100; i++) {
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java Fri Jan 25 07:04:25 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
@@ -37,6 +36,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.io.Text;
@@ -97,7 +97,7 @@ public class AccumuloOutputFormatTest {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
+ AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, "testmrinstance");
@@ -108,7 +108,7 @@ public class AccumuloOutputFormatTest {
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
- AccumuloOutputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
+ AccumuloOutputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, "testmrinstance");
@@ -168,7 +168,7 @@ public class AccumuloOutputFormatTest {
@Test
public void testMR() throws Exception {
MockInstance mockInstance = new MockInstance("testmrinstance");
- Connector c = mockInstance.getConnector("root", new byte[] {});
+ Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
c.tableOperations().create("testtable1");
c.tableOperations().create("testtable2");
BatchWriter bw = c.createBatchWriter("testtable1", new BatchWriterConfig());
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java Fri Jan 25 07:04:25 2013
@@ -21,7 +21,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -37,6 +36,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.PeekingIterator;
import org.apache.hadoop.conf.Configured;
@@ -153,7 +153,7 @@ public class AccumuloRowInputFormatTest
job.setInputFormatClass(AccumuloRowInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
+ AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, "instance1");
@@ -177,7 +177,7 @@ public class AccumuloRowInputFormatTest
@Test
public void test() throws Exception {
final MockInstance instance = new MockInstance("instance1");
- final Connector conn = instance.getConnector("root", "".getBytes());
+ final Connector conn = instance.getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("test");
BatchWriter writer = null;
try {
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java Fri Jan 25 07:04:25 2013
@@ -44,6 +44,7 @@ import org.apache.accumulo.core.data.Val
import org.apache.accumulo.core.iterators.Combiner;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.hadoop.io.Text;
import org.junit.Test;
@@ -83,7 +84,7 @@ public class MockConnectorTest {
@Test
public void testChangeAuths() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
- c.securityOperations().createUser("greg", new byte[] {});
+ c.securityOperations().createUser(new UserPassToken("greg", new byte[0]));
assertTrue(c.securityOperations().getUserAuthorizations("greg").isEmpty());
c.securityOperations().changeUserAuthorizations("greg", new Authorizations("A".getBytes()));
assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
@@ -95,7 +96,7 @@ public class MockConnectorTest {
@Test
public void testAggregation() throws Exception {
MockInstance mockInstance = new MockInstance();
- Connector c = mockInstance.getConnector("root", new byte[] {});
+ Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
String table = "perDayCounts";
c.tableOperations().create(table);
IteratorSetting is = new IteratorSetting(10, "String Summation", SummingCombiner.class);
@@ -343,8 +344,8 @@ public class MockConnectorTest {
AccumuloSecurityException{
String name = "an-interesting-instance-name";
Instance mockInstance = new MockInstance(name);
- assertEquals(mockInstance, mockInstance.getConnector("foo", "bar").getInstance());
- assertEquals(name, mockInstance.getConnector("foo","bar").getInstance().getInstanceName());
+ assertEquals(mockInstance, mockInstance.getConnector(new UserPassToken("foo", "bar")).getInstance());
+ assertEquals(name, mockInstance.getConnector(new UserPassToken("foo", "bar")).getInstance().getInstanceName());
}
}
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java Fri Jan 25 07:04:25 2013
@@ -18,7 +18,6 @@ package org.apache.accumulo.core.client.
import java.io.IOException;
import java.net.URI;
-import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
@@ -53,7 +52,7 @@ import org.apache.accumulo.core.iterator
import org.apache.accumulo.core.iterators.user.VersioningIterator;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -67,7 +66,7 @@ public class MockTableOperationsTest {
@Test
public void testCreateUseVersions() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
Instance instance = new MockInstance("topstest");
- Connector conn = instance.getConnector("user", "pass");
+ Connector conn = instance.getConnector(new UserPassToken("root", ""));
String t = "tableName1";
{
@@ -129,7 +128,7 @@ public class MockTableOperationsTest {
@Test
public void testTableNotFound() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
Instance instance = new MockInstance("topstest");
- Connector conn = instance.getConnector("user", "pass");
+ Connector conn = instance.getConnector(new UserPassToken("root", ""));
String t = "tableName";
try {
conn.tableOperations().attachIterator(t, null);
@@ -188,8 +187,7 @@ public class MockTableOperationsTest {
public void testImport() throws Throwable {
ImportTestFilesAndData dataAndFiles = prepareTestFiles();
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(new AuthInfo("user", ByteBuffer
- .wrap(new byte[0]), "foo"));
+ Connector connector = instance.getConnector(new UserPassToken("root", ""));
TableOperations tableOperations = connector.tableOperations();
tableOperations.create("a_table");
tableOperations.importDirectory("a_table",
@@ -242,8 +240,7 @@ public class MockTableOperationsTest {
@Test(expected = TableNotFoundException.class)
public void testFailsWithNoTable() throws Throwable {
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(new AuthInfo("user", ByteBuffer
- .wrap(new byte[0]), "foo"));
+ Connector connector = instance.getConnector(new UserPassToken("root", ""));
TableOperations tableOperations = connector.tableOperations();
ImportTestFilesAndData testFiles = prepareTestFiles();
tableOperations.importDirectory("doesnt_exist_table",
@@ -254,8 +251,7 @@ public class MockTableOperationsTest {
@Test(expected = IOException.class)
public void testFailsWithNonEmptyFailureDirectory() throws Throwable {
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(new AuthInfo("user", ByteBuffer
- .wrap(new byte[0]), "foo"));
+ Connector connector = instance.getConnector(new UserPassToken("root", ""));
TableOperations tableOperations = connector.tableOperations();
ImportTestFilesAndData testFiles = prepareTestFiles();
FileSystem fs = testFiles.failurePath.getFileSystem(new Configuration());
@@ -268,7 +264,7 @@ public class MockTableOperationsTest {
@Test
public void testDeleteRows() throws Exception {
Instance instance = new MockInstance("rows");
- Connector connector = instance.getConnector("user", "foo");
+ Connector connector = instance.getConnector(new UserPassToken("root", ""));
TableOperations to = connector.tableOperations();
to.create("test");
BatchWriter bw = connector.createBatchWriter("test", new BatchWriterConfig());
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java Fri Jan 25 07:04:25 2013
@@ -31,6 +31,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.junit.Test;
public class TestBatchScanner821 {
@@ -38,7 +39,7 @@ public class TestBatchScanner821 {
@Test
public void test() throws Exception {
MockInstance inst = new MockInstance();
- Connector conn = inst.getConnector("root", "");
+ Connector conn = inst.getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("test");
BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig());
for (String row : "A,B,C,D".split(",")) {
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java Fri Jan 25 07:04:25 2013
@@ -45,6 +45,7 @@ import org.apache.accumulo.core.iterator
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.SortedMapIterator;
import org.apache.accumulo.core.iterators.system.MultiIterator;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -272,7 +273,7 @@ public class IntersectingIteratorTest ex
public void testWithBatchScanner() throws Exception {
Value empty = new Value(new byte[] {});
MockInstance inst = new MockInstance("mockabye");
- Connector connector = inst.getConnector("user", "pass");
+ Connector connector = inst.getConnector(new UserPassToken("user", "pass"));
connector.tableOperations().create("index");
BatchWriter bw = connector.createBatchWriter("index", new BatchWriterConfig());
Mutation m = new Mutation("000012");
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java Fri Jan 25 07:04:25 2013
@@ -36,6 +36,7 @@ import org.apache.accumulo.core.data.Mut
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.hadoop.io.Text;
/**
@@ -82,7 +83,7 @@ public class RowFilterTest extends TestC
public void test1() throws Exception {
MockInstance instance = new MockInstance("rft1");
- Connector conn = instance.getConnector("", "".getBytes());
+ Connector conn = instance.getConnector(new UserPassToken("", ""));
conn.tableOperations().create("table1");
BatchWriter bw = conn.createBatchWriter("table1", new BatchWriterConfig());
Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
svn:mergeinfo = /accumulo/branches/ACCUMULO-259/examples:1343822-1438352
Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchScanner.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchScanner.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchScanner.java (original)
+++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchScanner.java Fri Jan 25 07:04:25 2013
@@ -162,8 +162,8 @@ public class RandomBatchScanner {
long t2 = System.currentTimeMillis();
- log.info(String.format("%6.2f lookups/sec %6.2f secs%n", num / ((t2 - t1) / 1000.0), ((t2 - t1) / 1000.0)));
- log.info(String.format("num results : %,d%n", receiver.count));
+ log.info(String.format("%6.2f lookups/sec %6.2f secs\n", num / ((t2 - t1) / 1000.0), ((t2 - t1) / 1000.0)));
+ log.info(String.format("num results : %,d\n", receiver.count));
printRowsNotFound(expectedRows);
}
Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java (original)
+++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java Fri Jan 25 07:04:25 2013
@@ -66,14 +66,12 @@ public class ReadWriteExample {
private void execute(Opts opts, ScannerOpts scanOpts) throws Exception {
conn = opts.getConnector();
-
// add the authorizations to the user
Authorizations userAuthorizations = conn.securityOperations().getUserAuthorizations(opts.user);
ByteArraySet auths = new ByteArraySet(userAuthorizations.getAuthorizations());
auths.addAll(opts.auths.getAuthorizations());
if (!auths.isEmpty())
conn.securityOperations().changeUserAuthorizations(opts.user, new Authorizations(auths));
-
// create table
if (opts.createtable) {
SortedSet<Text> partitionKeys = new TreeSet<Text>();
Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Viewer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Viewer.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Viewer.java (original)
+++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Viewer.java Fri Jan 25 07:04:25 2013
@@ -103,7 +103,7 @@ public class Viewer extends JFrame imple
setSize(1000, 800);
setDefaultCloseOperation(EXIT_ON_CLOSE);
q = new QueryUtil(opts);
- fdq = new FileDataQuery(opts.instance, opts.zookeepers, opts.user, opts.getPassword(), opts.dataTable, opts.auths);
+ fdq = new FileDataQuery(opts.instance, opts.zookeepers, opts.getAccumuloToken(), opts.dataTable, opts.auths);
this.topPath = opts.path;
}
Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataIngest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataIngest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataIngest.java (original)
+++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataIngest.java Fri Jan 25 07:04:25 2013
@@ -76,22 +76,15 @@ public class FileDataIngest {
// read through file once, calculating hashes
md5digest.reset();
- InputStream fis = null;
- int numRead = 0;
- try {
- fis = new FileInputStream(filename);
- numRead = fis.read(buf);
- while (numRead >= 0) {
- if (numRead > 0) {
- md5digest.update(buf, 0, numRead);
- }
- numRead = fis.read(buf);
- }
- } finally {
- if (fis != null) {
- fis.close();
+ InputStream fis = new FileInputStream(filename);
+ int numRead = fis.read(buf);
+ while (numRead >= 0) {
+ if (numRead > 0) {
+ md5digest.update(buf, 0, numRead);
}
+ numRead = fis.read(buf);
}
+ fis.close();
String hash = hexString(md5digest.digest());
Text row = new Text(hash);
@@ -107,30 +100,28 @@ public class FileDataIngest {
// read through file again, writing chunks to accumulo
int chunkCount = 0;
try {
- fis = new FileInputStream(filename);
- numRead = fis.read(buf);
- while (numRead >= 0) {
- while (numRead < buf.length) {
- int moreRead = fis.read(buf, numRead, buf.length - numRead);
- if (moreRead > 0)
- numRead += moreRead;
- else if (moreRead < 0)
- break;
- }
- m = new Mutation(row);
- Text chunkCQ = new Text(chunkSizeBytes);
- chunkCQ.append(intToBytes(chunkCount), 0, 4);
- m.put(CHUNK_CF, chunkCQ, cv, new Value(buf, 0, numRead));
- bw.addMutation(m);
- if (chunkCount == Integer.MAX_VALUE)
- throw new RuntimeException("too many chunks for file " + filename + ", try raising chunk size");
- chunkCount++;
- numRead = fis.read(buf);
- }
+ fis = new FileInputStream(filename);
+ numRead = fis.read(buf);
+ while (numRead >= 0) {
+ while (numRead < buf.length) {
+ int moreRead = fis.read(buf, numRead, buf.length - numRead);
+ if (moreRead > 0)
+ numRead += moreRead;
+ else if (moreRead < 0)
+ break;
+ }
+ m = new Mutation(row);
+ Text chunkCQ = new Text(chunkSizeBytes);
+ chunkCQ.append(intToBytes(chunkCount), 0, 4);
+ m.put(CHUNK_CF, chunkCQ, cv, new Value(buf, 0, numRead));
+ bw.addMutation(m);
+ if (chunkCount == Integer.MAX_VALUE)
+ throw new RuntimeException("too many chunks for file " + filename + ", try raising chunk size");
+ chunkCount++;
+ numRead = fis.read(buf);
+ }
} finally {
- if (fis != null) {
- fis.close();
- }
+ fis.close();
}
m = new Mutation(row);
Text chunkCQ = new Text(chunkSizeBytes);
@@ -171,17 +162,16 @@ public class FileDataIngest {
}
public static class Opts extends ClientOnRequiredTable {
- @Parameter(names="--vis", description="use a given visibility for the new counts", converter=VisibilityConverter.class)
+ @Parameter(names = "--vis", description = "use a given visibility for the new counts", converter = VisibilityConverter.class)
ColumnVisibility visibility = new ColumnVisibility();
- @Parameter(names="--chunk", description="size of the chunks used to store partial files")
- int chunkSize = 64*1024;
+ @Parameter(names = "--chunk", description = "size of the chunks used to store partial files")
+ int chunkSize = 64 * 1024;
- @Parameter(description="<file> { <file> ... }")
+ @Parameter(description = "<file> { <file> ... }")
List<String> files = new ArrayList<String>();
}
-
public static void main(String[] args) throws Exception {
Opts opts = new Opts();
BatchWriterOpts bwOpts = new BatchWriterOpts();
Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java (original)
+++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java Fri Jan 25 07:04:25 2013
@@ -31,6 +31,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.tokens.AccumuloToken;
import org.apache.accumulo.core.util.PeekingIterator;
/**
@@ -43,10 +44,10 @@ public class FileDataQuery {
private ChunkInputStream cis;
Scanner scanner;
- public FileDataQuery(String instanceName, String zooKeepers, String user, byte[] password, String tableName, Authorizations auths) throws AccumuloException,
+ public FileDataQuery(String instanceName, String zooKeepers, AccumuloToken<?,?> token, String tableName, Authorizations auths) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
- conn = instance.getConnector(user, password);
+ conn = instance.getConnector(token);
lastRefs = new ArrayList<Entry<Key,Value>>();
cis = new ChunkInputStream();
scanner = conn.createScanner(tableName, auths);
Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java (original)
+++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java Fri Jan 25 07:04:25 2013
@@ -90,7 +90,7 @@ public class ContinuousQuery {
}
long t2 = System.currentTimeMillis();
- System.out.printf(" %s %,d %6.3f%n", Arrays.asList(columns), count, (t2 - t1) / 1000.0);
+ System.out.printf(" %s %,d %6.3f\n", Arrays.asList(columns), count, (t2 - t1) / 1000.0);
}
bs.close();
Modified: accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java (original)
+++ accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java Fri Jan 25 07:04:25 2013
@@ -18,6 +18,7 @@ package org.apache.accumulo.examples.sim
import java.util.ArrayList;
import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
import junit.framework.TestCase;
@@ -32,6 +33,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.examples.simple.dirlist.FileCount.Opts;
import org.apache.hadoop.io.Text;
@@ -39,9 +41,9 @@ import org.apache.hadoop.io.Text;
public class CountTest extends TestCase {
{
try {
- Connector conn = new MockInstance("counttest").getConnector("root", "".getBytes());
+ Connector conn = new MockInstance("counttest").getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("dirlisttable");
- BatchWriter bw = conn.createBatchWriter("dirlisttable", new BatchWriterConfig());
+ BatchWriter bw = conn.createBatchWriter("dirlisttable", new BatchWriterConfig().setMaxMemory(1000000l).setMaxLatency(100l, TimeUnit.SECONDS).setMaxWriteThreads(1));
ColumnVisibility cv = new ColumnVisibility();
// / has 1 dir
// /local has 2 dirs 1 file
@@ -60,7 +62,7 @@ public class CountTest extends TestCase
}
public void test() throws Exception {
- Scanner scanner = new MockInstance("counttest").getConnector("root", "".getBytes()).createScanner("dirlisttable", new Authorizations());
+ Scanner scanner = new MockInstance("counttest").getConnector(new UserPassToken("root", "")).createScanner("dirlisttable", new Authorizations());
scanner.fetchColumn(new Text("dir"), new Text("counts"));
assertFalse(scanner.iterator().hasNext());
Modified: accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java (original)
+++ accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java Fri Jan 25 07:04:25 2013
@@ -18,10 +18,10 @@ package org.apache.accumulo.examples.sim
import java.io.IOException;
import java.io.InputStream;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
import junit.framework.TestCase;
@@ -34,6 +34,7 @@ import org.apache.accumulo.core.data.Mut
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.mapreduce.Job;
@@ -198,7 +199,7 @@ public class ChunkInputFormatTest extend
job.setInputFormatClass(ChunkInputFormat.class);
- ChunkInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
+ ChunkInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
ChunkInputFormat.setInputTableName(job, table);
ChunkInputFormat.setScanAuthorizations(job, AUTHS);
ChunkInputFormat.setMockInstance(job, instance);
@@ -224,9 +225,9 @@ public class ChunkInputFormatTest extend
public void test() throws Exception {
MockInstance instance = new MockInstance("instance1");
- Connector conn = instance.getConnector("root", "".getBytes());
+ Connector conn = instance.getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("test");
- BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig());
+ BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig().setMaxMemory(1000000l).setMaxLatency(100l, TimeUnit.SECONDS).setMaxWriteThreads(5));
for (Entry<Key,Value> e : data) {
Key k = e.getKey();
@@ -243,9 +244,9 @@ public class ChunkInputFormatTest extend
public void testErrorOnNextWithoutClose() throws Exception {
MockInstance instance = new MockInstance("instance2");
- Connector conn = instance.getConnector("root", "".getBytes());
+ Connector conn = instance.getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("test");
- BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig());
+ BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig().setMaxMemory(1000000l).setMaxLatency(100l, TimeUnit.SECONDS).setMaxWriteThreads(5));
for (Entry<Key,Value> e : data) {
Key k = e.getKey();
@@ -263,9 +264,9 @@ public class ChunkInputFormatTest extend
public void testInfoWithoutChunks() throws Exception {
MockInstance instance = new MockInstance("instance3");
- Connector conn = instance.getConnector("root", "".getBytes());
+ Connector conn = instance.getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("test");
- BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig());
+ BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig().setMaxMemory(1000000l).setMaxLatency(100l, TimeUnit.SECONDS).setMaxWriteThreads(5));
for (Entry<Key,Value> e : baddata) {
Key k = e.getKey();
Mutation m = new Mutation(k.getRow());
Modified: accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java (original)
+++ accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java Fri Jan 25 07:04:25 2013
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
import junit.framework.TestCase;
@@ -38,6 +39,7 @@ import org.apache.accumulo.core.data.Mut
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.PeekingIterator;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Logger;
@@ -221,9 +223,9 @@ public class ChunkInputStreamTest extend
}
public void testWithAccumulo() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException, IOException {
- Connector conn = new MockInstance().getConnector("root", "".getBytes());
+ Connector conn = new MockInstance().getConnector(new UserPassToken("root", ""));
conn.tableOperations().create("test");
- BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig());
+ BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig().setMaxMemory(1000000l).setMaxLatency(100l, TimeUnit.SECONDS).setMaxWriteThreads(5));
for (Entry<Key,Value> e : data) {
Key k = e.getKey();
Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
Merged /accumulo/branches/ACCUMULO-259/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1343822-1438343
Merged /accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1343822-1355480
Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
Merged /accumulo/branches/1.4/src/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1398393,1398399
Merged /accumulo/branches/ACCUMULO-259/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1343822-1438343
Merged /accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1343822-1355480
Merged /accumulo/branches/1.4/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1398393,1398399
Propchange: accumulo/trunk/packages/
------------------------------------------------------------------------------
Reverse-merged /incubator/accumulo/trunk/src/packages:r1296160-1296495
Merged /accumulo/branches/ACCUMULO-259/packages:r1343822-1438343
Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1438354&r1=1438353&r2=1438354&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Fri Jan 25 07:04:25 2013
@@ -63,6 +63,7 @@ import org.apache.accumulo.core.security
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.accumulo.proxy.thrift.AccumuloProxy;
@@ -142,7 +143,7 @@ public class ProxyServer implements Accu
}
protected Connector getConnector(UserPass userpass) throws Exception {
- Connector connector = instance.getConnector(userpass.getUsername(), userpass.bufferForPassword());
+ Connector connector = instance.getConnector(new UserPassToken(userpass.getUsername(), userpass.bufferForPassword()));
return connector;
}
@@ -588,7 +589,7 @@ public class ProxyServer implements Accu
@Override
public boolean authenticateUser(UserPass userpass, String user, ByteBuffer password) throws TException {
try {
- return getConnector(userpass).securityOperations().authenticateUser(user, password.array());
+ return getConnector(userpass).securityOperations().authenticateUser(new UserPassToken(user, password.array()));
} catch (Exception e) {
throw translateException(e);
}
@@ -610,7 +611,7 @@ public class ProxyServer implements Accu
@Override
public void changeUserPassword(UserPass userpass, String user, ByteBuffer password) throws TException {
try {
- getConnector(userpass).securityOperations().changeUserPassword(user, password.array());
+ getConnector(userpass).securityOperations().changeUserPassword(new UserPassToken(user, password.array()));
} catch (Exception e) {
throw translateException(e);
}
@@ -619,7 +620,7 @@ public class ProxyServer implements Accu
@Override
public void createUser(UserPass userpass, String user, ByteBuffer password) throws TException {
try {
- getConnector(userpass).securityOperations().createUser(user, password.array());
+ getConnector(userpass).securityOperations().createUser(new UserPassToken(user, password));
} catch (Exception e) {
throw translateException(e);
}