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 [8/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/accumul...
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 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.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
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, InstanceTokenWrapper credentials) {
+ public static SortedMap<Text,SortedMap<ColumnFQ,Value>> getTabletEntries(Instance instance, KeyExtent ke, List<ColumnFQ> columns, Credentials 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, InstanceTokenWrapper credentials) {
+ public static void getTabletAndPrevTabletKeyValues(Instance instance, SortedMap<Key,Value> tkv, KeyExtent ke, List<ColumnFQ> columns, Credentials credentials) {
Text startRow;
Text endRow = ke.getMetadataEntry();
@@ -236,11 +236,11 @@ public class MetadataTable {
}
}
- public static void getEntries(Instance instance, InstanceTokenWrapper credentials, String table, boolean isTid, Map<KeyExtent,String> locations,
+ public static void getEntries(Instance instance, Credentials 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.getToken()).createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
+ Scanner scanner = instance.getConnector(credentials.getPrincipal(), 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -21,6 +21,7 @@ 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;
@@ -52,8 +53,7 @@ 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.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.UserPassToken;
+import org.apache.accumulo.core.security.thrift.Credentials;
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 SecurityToken credentials;
+ private Credentials 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,7 +276,9 @@ public class Shell extends ShellOptions
pass = passw.getBytes();
this.setTableName("");
- this.credentials = updateUser(user, pass);
+ connector = instance.getConnector(user, pass);
+ this.credentials = new Credentials(user, ByteBuffer.wrap(pass), connector.getInstance().getInstanceID());
+
} catch (Exception e) {
printException(e);
configError = true;
@@ -315,8 +317,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);
@@ -516,7 +518,7 @@ public class Shell extends ShellOptions
} // user canceled
try {
- authFailed = !connector.securityOperations().authenticateUser(credentials);
+ authFailed = !connector.securityOperations().authenticateUser(connector.whoami(), pwd.getBytes());
} catch (Exception e) {
++exitCode;
printException(e);
@@ -776,7 +778,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 --";
@@ -931,30 +933,12 @@ public class Shell extends ShellOptions
return reader;
}
- public SecurityToken updateUser(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
- SecurityToken token;
- try {
- String tokenClass = instance.getSecurityTokenClass();
- 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 void updateUser(Credentials authInfo) throws AccumuloException, AccumuloSecurityException {
+ connector = instance.getConnector(authInfo);
+ credentials = authInfo;
}
- public SecurityToken getCredentials() {
+ public Credentials getCredentials() {
return credentials;
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java Mon Feb 4 18:09:38 2013
@@ -22,7 +22,6 @@ import java.util.Set;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
-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.accumulo.core.util.shell.Token;
@@ -38,7 +37,7 @@ public class AuthenticateCommand extends
return 0;
} // user canceled
final byte[] password = p.getBytes();
- final boolean valid = shellState.getConnector().securityOperations().authenticateUser(new UserPassToken(user, password));
+ final boolean valid = shellState.getConnector().securityOperations().authenticateUser(user, password);
shellState.getReader().printString((valid ? "V" : "Not v") + "alid\n");
return 0;
}
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -22,7 +22,6 @@ 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;
@@ -48,7 +47,7 @@ public class CreateUserCommand extends C
if (!password.equals(passwordConfirm)) {
throw new IllegalArgumentException("Passwords do not match");
}
- shellState.getConnector().securityOperations().createUser(new UserPassToken(user, password));
+ shellState.getConnector().securityOperations().createUser(user, password.getBytes());
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -17,11 +17,12 @@
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.Credentials;
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;
@@ -46,7 +47,7 @@ public class PasswdCommand extends Comma
return 0;
} // user canceled
- if (!shellState.getConnector().securityOperations().authenticateUser(new UserPassToken(currentUser, oldPassword)))
+ if (!shellState.getConnector().securityOperations().authenticateUser(currentUser, oldPassword.getBytes()))
throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
@@ -64,11 +65,11 @@ public class PasswdCommand extends Comma
throw new IllegalArgumentException("Passwords do not match");
}
byte[] pass = password.getBytes();
- shellState.getConnector().securityOperations().changeUserPassword(new UserPassToken(user, pass));
+ shellState.getConnector().securityOperations().changeUserPassword(user, pass);
// update the current credentials if the password changed was for
// the current user
if (shellState.getConnector().whoami().equals(user)) {
- shellState.updateUser(user, pass);
+ shellState.updateUser(new Credentials(user, ByteBuffer.wrap(pass), shellState.getConnector().getInstance().getInstanceID()));
}
Shell.log.debug("Changed password for user " + user);
return 0;
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -17,11 +17,13 @@
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.Credentials;
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;
@@ -42,7 +44,7 @@ public class UserCommand extends Command
return 0;
} // user canceled
pass = p.getBytes();
- shellState.updateUser(user, pass);
+ shellState.updateUser(new Credentials(user, ByteBuffer.wrap(pass), shellState.getConnector().getInstance().getInstanceID()));
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=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/client.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/client.thrift Mon Feb 4 18:09:38 2013
@@ -71,26 +71,26 @@ service ClientService {
string getInstanceId()
string getZooKeepers()
- list<string> bulkImportFiles(1:trace.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);
+ list<string> bulkImportFiles(1:trace.TInfo tinfo, 2:security.Credentials 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:trace.TInfo tinfo, 2:i64 tid),
- void ping(1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ void ping(1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
// user management methods
- bool authenticateUser(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 3:binary Token) throws (1:security.ThriftSecurityException sec)
- set<string> listUsers(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
- void createUser(5:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:binary token, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
- void dropUser(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user) throws (1:security.ThriftSecurityException sec)
- void changePassword(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:binary token) throws (1:security.ThriftSecurityException sec)
- void changeAuthorizations(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
- list<binary> getUserAuthorizations(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user) throws (1:security.ThriftSecurityException sec)
- bool hasSystemPermission(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:byte sysPerm) throws (1:security.ThriftSecurityException sec)
- bool hasTablePermission(5:trace.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:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:byte permission) throws (1:security.ThriftSecurityException sec)
- void revokeSystemPermission(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:byte permission) throws (1:security.ThriftSecurityException sec)
- void grantTablePermission(5:trace.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:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string user, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ bool authenticateUser(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:binary token) throws (1:security.ThriftSecurityException sec)
+ set<string> listUsers(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
+ void createUser(5:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal 3:binary token, 4:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
+ void dropUser(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal) throws (1:security.ThriftSecurityException sec)
+ void changePassword(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:binary token) throws (1:security.ThriftSecurityException sec)
+ void changeAuthorizations(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
+ list<binary> getUserAuthorizations(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal) throws (1:security.ThriftSecurityException sec)
+ bool hasSystemPermission(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:byte sysPerm) throws (1:security.ThriftSecurityException sec)
+ bool hasTablePermission(5:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:string tableName, 4:byte tblPerm) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ void grantSystemPermission(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:byte permission) throws (1:security.ThriftSecurityException sec)
+ void revokeSystemPermission(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:byte permission) throws (1:security.ThriftSecurityException sec)
+ void grantTablePermission(5:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ void revokeTablePermission(5:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string principal, 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);
Modified: accumulo/trunk/core/src/main/thrift/gc.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/gc.thrift?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/gc.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/gc.thrift Mon Feb 4 18:09:38 2013
@@ -38,5 +38,5 @@ struct GCStatus {
service GCMonitorService {
- GCStatus getStatus(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec);
+ GCStatus getStatus(2:trace.TInfo tinfo, 1:security.Credentials 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=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/master.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/master.thrift Mon Feb 4 18:09:38 2013
@@ -132,31 +132,31 @@ enum TableOperation {
service MasterClientService {
// table management methods
- i64 initiateFlush(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableName) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void waitForFlush(5:trace.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)
+ i64 initiateFlush(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string tableName) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void waitForFlush(5:trace.TInfo tinfo, 1:security.Credentials 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:trace.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:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableName, 3:string property) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void setTableProperty(5:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string tableName, 3:string property, 4:string value) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void removeTableProperty(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string tableName, 3:string property) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
// system management methods
- void setMasterGoalState(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:MasterGoalState state) throws (1:security.ThriftSecurityException sec);
- void shutdown(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:bool stopTabletServers) throws (1:security.ThriftSecurityException sec)
- void shutdownTabletServer(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tabletServer, 4:bool force) throws (1: security.ThriftSecurityException sec)
- void setSystemProperty(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string property, 3:string value) throws (1:security.ThriftSecurityException sec)
- void removeSystemProperty(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string property) throws (1:security.ThriftSecurityException sec)
+ void setMasterGoalState(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:MasterGoalState state) throws (1:security.ThriftSecurityException sec);
+ void shutdown(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:bool stopTabletServers) throws (1:security.ThriftSecurityException sec)
+ void shutdownTabletServer(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string tabletServer, 4:bool force) throws (1: security.ThriftSecurityException sec)
+ void setSystemProperty(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string property, 3:string value) throws (1:security.ThriftSecurityException sec)
+ void removeSystemProperty(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string property) throws (1:security.ThriftSecurityException sec)
// system monitoring methods
- MasterMonitorInfo getMasterStats(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
+ MasterMonitorInfo getMasterStats(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
// tablet server reporting
- oneway void reportSplitExtent(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string serverName, 3:TabletSplit split)
- oneway void reportTabletStatus(5:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string serverName, 3:TabletLoadState status, 4:data.TKeyExtent tablet)
+ oneway void reportSplitExtent(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string serverName, 3:TabletSplit split)
+ oneway void reportTabletStatus(5:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string serverName, 3:TabletLoadState status, 4:data.TKeyExtent tablet)
//table operations
- i64 beginTableOperation(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
- void executeTableOperation(7:trace.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:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void finishTableOperation(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec)
- string getSecurityTokenClass();
+ i64 beginTableOperation(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
+ void executeTableOperation(7:trace.TInfo tinfo, 1:security.Credentials 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:trace.TInfo tinfo, 1:security.Credentials credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void finishTableOperation(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec)
+ string getAuthenticatorClassName() throws (1:security.ThriftSecurityException tse);
}
Modified: accumulo/trunk/core/src/main/thrift/security.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/thrift/security.thrift?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/security.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/security.thrift Mon Feb 4 18:09:38 2013
@@ -36,21 +36,18 @@ enum SecurityErrorCode {
TOKEN_EXPIRED = 15
}
-struct ThriftUserPassToken {
+struct AuthInfo {
1:string user,
- 2:binary password
+ 2:binary password,
+ 3:string instanceId
}
-struct ThriftKerberosToken {
- 1:string user,
- 2:binary ticket
+struct Credentials {
+ 1:string principal,
+ 2:binary token,
+ 3:string instanceId
}
-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=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/thrift/tabletserver.thrift (original)
+++ accumulo/trunk/core/src/main/thrift/tabletserver.thrift Mon Feb 4 18:09:38 2013
@@ -130,7 +130,7 @@ struct IteratorConfig {
service TabletClientService extends client.ClientService {
// scan a range of keys
data.InitialScan startScan(11:trace.TInfo tinfo,
- 1:security.ThriftInstanceTokenWrapper credentials,
+ 1:security.Credentials 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:trace.TInfo tinfo,
- 1:security.ThriftInstanceTokenWrapper credentials,
+ 1:security.Credentials 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:trace.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:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec),
+ data.UpdateID startUpdate(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec),
oneway void applyUpdates(1:trace.TInfo tinfo, 2:data.UpdateID updateID, 3:data.TKeyExtent keyExtent, 4:list<data.TMutation> mutations),
data.UpdateErrors closeUpdate(2:trace.TInfo tinfo, 1:data.UpdateID updateID) throws (1:NoSuchScanIDException nssi),
//the following call supports making a single update to a tablet
- void update(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:data.TKeyExtent keyExtent, 3:data.TMutation mutation)
+ void update(4:trace.TInfo tinfo, 1:security.Credentials 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:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 4:i64 tid, 2:data.TabletFiles files, 5:bool setTime) throws (1:security.ThriftSecurityException sec),
+ list<data.TKeyExtent> bulkImport(3:trace.TInfo tinfo, 1:security.Credentials credentials, 4:i64 tid, 2:data.TabletFiles files, 5:bool setTime) throws (1:security.ThriftSecurityException sec),
- void splitTablet(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:data.TKeyExtent extent, 3:binary splitPoint) throws (1:security.ThriftSecurityException sec, 2:NotServingTabletException nste)
+ void splitTablet(4:trace.TInfo tinfo, 1:security.Credentials credentials, 2:data.TKeyExtent extent, 3:binary splitPoint) throws (1:security.ThriftSecurityException sec, 2:NotServingTabletException nste)
- oneway void loadTablet(5:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 4:string lock, 2:data.TKeyExtent extent),
- oneway void unloadTablet(5:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 4:string lock, 2:data.TKeyExtent extent, 3:bool save),
- oneway void flush(4:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 2:string tableId, 5:binary startRow, 6:binary endRow),
- oneway void flushTablet(1:trace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 4:data.TKeyExtent extent),
- oneway void chop(1:trace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 4:data.TKeyExtent extent),
- oneway void compact(1:trace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:string lock, 4:string tableId, 5:binary startRow, 6:binary endRow),
+ oneway void loadTablet(5:trace.TInfo tinfo, 1:security.Credentials credentials, 4:string lock, 2:data.TKeyExtent extent),
+ oneway void unloadTablet(5:trace.TInfo tinfo, 1:security.Credentials credentials, 4:string lock, 2:data.TKeyExtent extent, 3:bool save),
+ oneway void flush(4:trace.TInfo tinfo, 1:security.Credentials credentials, 3:string lock, 2:string tableId, 5:binary startRow, 6:binary endRow),
+ oneway void flushTablet(1:trace.TInfo tinfo, 2:security.Credentials credentials, 3:string lock, 4:data.TKeyExtent extent),
+ oneway void chop(1:trace.TInfo tinfo, 2:security.Credentials credentials, 3:string lock, 4:data.TKeyExtent extent),
+ oneway void compact(1:trace.TInfo tinfo, 2:security.Credentials credentials, 3:string lock, 4:string tableId, 5:binary startRow, 6:binary endRow),
- master.TabletServerStatus getTabletServerStatus(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
- list<TabletStats> getTabletStats(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string tableId) throws (1:security.ThriftSecurityException sec)
- TabletStats getHistoricalStats(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
- void halt(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string lock) throws (1:security.ThriftSecurityException sec)
- oneway void fastHalt(3:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials, 2:string lock);
+ master.TabletServerStatus getTabletServerStatus(3:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
+ list<TabletStats> getTabletStats(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string tableId) throws (1:security.ThriftSecurityException sec)
+ TabletStats getHistoricalStats(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
+ void halt(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string lock) throws (1:security.ThriftSecurityException sec)
+ oneway void fastHalt(3:trace.TInfo tinfo, 1:security.Credentials credentials, 2:string lock);
- list<ActiveScan> getActiveScans(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
- list<ActiveCompaction> getActiveCompactions(2:trace.TInfo tinfo, 1:security.ThriftInstanceTokenWrapper credentials) throws (1:security.ThriftSecurityException sec)
- oneway void removeLogs(1:trace.TInfo tinfo, 2:security.ThriftInstanceTokenWrapper credentials, 3:list<string> filenames)
+ list<ActiveScan> getActiveScans(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
+ list<ActiveCompaction> getActiveCompactions(2:trace.TInfo tinfo, 1:security.Credentials credentials) throws (1:security.ThriftSecurityException sec)
+ oneway void removeLogs(1:trace.TInfo tinfo, 2:security.Credentials 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 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.password.value);
+ assertArrayEquals("secret".getBytes(), args.getPassword());
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.password.value);
+ assertArrayEquals("foo".getBytes(), args.getPassword());
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -30,7 +30,6 @@ 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 {
@@ -50,7 +49,7 @@ public class FindMaxTest extends TestCas
public void test1() throws Exception {
MockInstance mi = new MockInstance();
- Connector conn = mi.getConnector(new UserPassToken("root", ""));
+ Connector conn = mi.getConnector("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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -47,15 +47,11 @@ import org.apache.accumulo.core.data.Mut
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.accumulo.core.security.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.UserPassToken;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
-@SuppressWarnings("deprecation")
public class TabletLocatorImplTest extends TestCase {
private static final KeyExtent RTE = Constants.ROOT_TABLET_EXTENT;
@@ -421,23 +417,12 @@ 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();
}
@@ -454,29 +439,20 @@ 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(Credentials auth) throws AccumuloException, AccumuloSecurityException {
+ return getConnector(auth.getPrincipal(), auth.getToken());
}
-
- public Connector getConnector(SecurityToken token) throws AccumuloException, AccumuloSecurityException {
- throw new UnsupportedOperationException();
- }
-
+
@Override
- public String getSecurityTokenClass() throws AccumuloException {
- return UserPassToken.class.getCanonicalName();
+ public String getAuthenticatorClassName() throws AccumuloException {
+ return null;
+ // Doesn't matter
}
}
@@ -604,7 +580,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/mapred/AccumuloFileOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java Mon Feb 4 18:09:38 2013
@@ -35,7 +35,6 @@ 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;
@@ -68,7 +67,7 @@ public class AccumuloFileOutputFormatTes
folder.create();
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
- Connector c = mockInstance.getConnector(new UserPassToken("root", new byte[0]));
+ Connector c = mockInstance.getConnector("root", new byte[0]);
c.tableOperations().create(EMPTY_TABLE);
c.tableOperations().create(TEST_TABLE);
c.tableOperations().create(BAD_TABLE);
@@ -152,7 +151,7 @@ public class AccumuloFileOutputFormatTes
job.setInputFormat(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass.getBytes(Constants.UTF8)));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Constants.UTF8));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
AccumuloFileOutputFormat.setOutputPath(job, new Path(args[3]));
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java Mon Feb 4 18:09:38 2013
@@ -35,7 +35,6 @@ 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.Configured;
@@ -245,7 +244,7 @@ public class AccumuloInputFormatTest {
job.setInputFormat(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes());
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -267,7 +266,7 @@ public class AccumuloInputFormatTest {
@Test
public void testMap() throws Exception {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
- Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
+ Connector c = mockInstance.getConnector("root", "");
c.tableOperations().create(TEST_TABLE_1);
BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
for (int i = 0; i < 100; i++) {
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java Mon Feb 4 18:09:38 2013
@@ -36,7 +36,6 @@ 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.fs.FileSystem;
@@ -110,7 +109,7 @@ public class AccumuloOutputFormatTest {
job.setInputFormat(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes());
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -121,7 +120,7 @@ public class AccumuloOutputFormatTest {
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
- AccumuloOutputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloOutputFormat.setConnectorInfo(job, user, pass.getBytes());
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -179,7 +178,7 @@ public class AccumuloOutputFormatTest {
@Test
public void testMR() throws Exception {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
- Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
+ Connector c = mockInstance.getConnector("root", "");
c.tableOperations().create(TEST_TABLE_1);
c.tableOperations().create(TEST_TABLE_2);
BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java Mon Feb 4 18:09:38 2013
@@ -36,7 +36,6 @@ 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;
@@ -164,7 +163,7 @@ public class AccumuloRowInputFormatTest
job.setInputFormat(AccumuloRowInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes());
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -186,7 +185,7 @@ public class AccumuloRowInputFormatTest
@Test
public void test() throws Exception {
final MockInstance instance = new MockInstance(INSTANCE_NAME);
- final Connector conn = instance.getConnector(new UserPassToken("root", ""));
+ final Connector conn = instance.getConnector("root", "");
conn.tableOperations().create(TEST_TABLE_1);
BatchWriter writer = null;
try {
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -34,7 +34,6 @@ 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;
@@ -63,7 +62,7 @@ public class AccumuloFileOutputFormatTes
folder.create();
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
- Connector c = mockInstance.getConnector(new UserPassToken("root", new byte[0]));
+ Connector c = mockInstance.getConnector("root", new byte[] {});
c.tableOperations().create(EMPTY_TABLE);
c.tableOperations().create(TEST_TABLE);
c.tableOperations().create(BAD_TABLE);
@@ -142,7 +141,7 @@ public class AccumuloFileOutputFormatTes
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -23,6 +23,7 @@ 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;
@@ -35,7 +36,6 @@ 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;
@@ -280,7 +280,7 @@ public class AccumuloInputFormatTest {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -304,7 +304,7 @@ public class AccumuloInputFormatTest {
@Test
public void testMap() throws Exception {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
- Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
+ Connector c = mockInstance.getConnector("root", new byte[] {});
c.tableOperations().create(TEST_TABLE_1);
BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -23,6 +23,7 @@ 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;
@@ -36,7 +37,6 @@ 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;
@@ -101,7 +101,7 @@ public class AccumuloOutputFormatTest {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -112,7 +112,7 @@ public class AccumuloOutputFormatTest {
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
- AccumuloOutputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloOutputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -172,7 +172,7 @@ public class AccumuloOutputFormatTest {
@Test
public void testMR() throws Exception {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
- Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
+ Connector c = mockInstance.getConnector("root", new byte[] {});
c.tableOperations().create(TEST_TABLE_1);
c.tableOperations().create(TEST_TABLE_2);
BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -21,6 +21,7 @@ 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;
@@ -36,7 +37,6 @@ 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;
@@ -157,7 +157,7 @@ public class AccumuloRowInputFormatTest
job.setInputFormatClass(AccumuloRowInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, new UserPassToken(user, pass));
+ AccumuloInputFormat.setConnectorInfo(job, user, pass.getBytes(Charset.forName("UTF-8")));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -181,7 +181,7 @@ public class AccumuloRowInputFormatTest
@Test
public void test() throws Exception {
final MockInstance instance = new MockInstance(INSTANCE_NAME);
- final Connector conn = instance.getConnector(new UserPassToken("root", ""));
+ final Connector conn = instance.getConnector("root", "".getBytes());
conn.tableOperations().create(TEST_TABLE_1);
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -44,7 +44,6 @@ 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;
@@ -84,7 +83,7 @@ public class MockConnectorTest {
@Test
public void testChangeAuths() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
- c.securityOperations().createUser(new UserPassToken("greg", new byte[0]));
+ c.securityOperations().createUser("greg", new byte[] {});
assertTrue(c.securityOperations().getUserAuthorizations("greg").isEmpty());
c.securityOperations().changeUserAuthorizations("greg", new Authorizations("A".getBytes()));
assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
@@ -96,7 +95,7 @@ public class MockConnectorTest {
@Test
public void testAggregation() throws Exception {
MockInstance mockInstance = new MockInstance();
- Connector c = mockInstance.getConnector(new UserPassToken("root", ""));
+ Connector c = mockInstance.getConnector("root", new byte[] {});
String table = "perDayCounts";
c.tableOperations().create(table);
IteratorSetting is = new IteratorSetting(10, "String Summation", SummingCombiner.class);
@@ -344,8 +343,8 @@ public class MockConnectorTest {
AccumuloSecurityException{
String name = "an-interesting-instance-name";
Instance mockInstance = new MockInstance(name);
- assertEquals(mockInstance, mockInstance.getConnector(new UserPassToken("foo", "bar")).getInstance());
- assertEquals(name, mockInstance.getConnector(new UserPassToken("foo", "bar")).getInstance().getInstanceName());
+ assertEquals(mockInstance, mockInstance.getConnector("foo", "bar").getInstance());
+ assertEquals(name, mockInstance.getConnector("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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -18,6 +18,7 @@ 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;
@@ -52,7 +53,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.tokens.UserPassToken;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -66,7 +67,7 @@ public class MockTableOperationsTest {
@Test
public void testCreateUseVersions() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
Instance instance = new MockInstance("topstest");
- Connector conn = instance.getConnector(new UserPassToken("root", ""));
+ Connector conn = instance.getConnector("user", "pass");
String t = "tableName1";
{
@@ -128,7 +129,7 @@ public class MockTableOperationsTest {
@Test
public void testTableNotFound() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
Instance instance = new MockInstance("topstest");
- Connector conn = instance.getConnector(new UserPassToken("root", ""));
+ Connector conn = instance.getConnector("user", "pass");
String t = "tableName";
try {
conn.tableOperations().attachIterator(t, null);
@@ -187,7 +188,8 @@ public class MockTableOperationsTest {
public void testImport() throws Throwable {
ImportTestFilesAndData dataAndFiles = prepareTestFiles();
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(new UserPassToken("root", ""));
+ Connector connector = instance.getConnector(new Credentials("user", ByteBuffer
+ .wrap(new byte[0]), "foo"));
TableOperations tableOperations = connector.tableOperations();
tableOperations.create("a_table");
tableOperations.importDirectory("a_table",
@@ -240,7 +242,8 @@ public class MockTableOperationsTest {
@Test(expected = TableNotFoundException.class)
public void testFailsWithNoTable() throws Throwable {
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(new UserPassToken("root", ""));
+ Connector connector = instance.getConnector(new Credentials("user", ByteBuffer
+ .wrap(new byte[0]), "foo"));
TableOperations tableOperations = connector.tableOperations();
ImportTestFilesAndData testFiles = prepareTestFiles();
tableOperations.importDirectory("doesnt_exist_table",
@@ -251,7 +254,8 @@ public class MockTableOperationsTest {
@Test(expected = IOException.class)
public void testFailsWithNonEmptyFailureDirectory() throws Throwable {
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(new UserPassToken("root", ""));
+ Connector connector = instance.getConnector(new Credentials("user", ByteBuffer
+ .wrap(new byte[0]), "foo"));
TableOperations tableOperations = connector.tableOperations();
ImportTestFilesAndData testFiles = prepareTestFiles();
FileSystem fs = testFiles.failurePath.getFileSystem(new Configuration());
@@ -264,7 +268,7 @@ public class MockTableOperationsTest {
@Test
public void testDeleteRows() throws Exception {
Instance instance = new MockInstance("rows");
- Connector connector = instance.getConnector(new UserPassToken("root", ""));
+ Connector connector = instance.getConnector("user", "foo");
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -31,7 +31,6 @@ 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 {
@@ -39,7 +38,7 @@ public class TestBatchScanner821 {
@Test
public void test() throws Exception {
MockInstance inst = new MockInstance();
- Connector conn = inst.getConnector(new UserPassToken("root", ""));
+ Connector conn = inst.getConnector("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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -45,7 +45,6 @@ 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;
@@ -273,7 +272,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(new UserPassToken("user", "pass"));
+ Connector connector = inst.getConnector("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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -36,7 +36,6 @@ 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;
/**
@@ -83,7 +82,7 @@ public class RowFilterTest extends TestC
public void test1() throws Exception {
MockInstance instance = new MockInstance("rft1");
- Connector conn = instance.getConnector(new UserPassToken("", ""));
+ Connector conn = instance.getConnector("", "".getBytes());
conn.tableOperations().create("table1");
BatchWriter bw = conn.createBatchWriter("table1", new BatchWriterConfig());
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java Mon Feb 4 18:09:38 2013
@@ -54,7 +54,6 @@ import org.apache.accumulo.core.iterator
import org.apache.accumulo.core.iterators.WrappingIterator;
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.hadoop.io.Text;
import org.junit.Before;
import org.junit.Test;
@@ -68,7 +67,7 @@ public class TransformingIteratorTest {
@Before
public void setUpMockAccumulo() throws Exception {
MockInstance instance = new MockInstance("test");
- connector = instance.getConnector(new UserPassToken("user", "password"));
+ connector = instance.getConnector("user", "password");
connector.securityOperations().changeUserAuthorizations("user", authorizations);
if (connector.tableOperations().exists(TABLE_NAME))
@@ -277,7 +276,7 @@ public class TransformingIteratorTest {
@Test
public void testDeepCopy() throws Exception {
MockInstance instance = new MockInstance("test");
- Connector connector = instance.getConnector(new UserPassToken("user", "password"));
+ Connector connector = instance.getConnector("user", "password");
connector.tableOperations().create("shard_table");
Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
Reverse-merged /accumulo/branches/ACCUMULO-259/examples:r1343822-1438352
Modified: accumulo/trunk/examples/instamo/src/main/java/org/apache/accumulo/instamo/AccumuloApp.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/instamo/src/main/java/org/apache/accumulo/instamo/AccumuloApp.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/examples/instamo/src/main/java/org/apache/accumulo/instamo/AccumuloApp.java (original)
+++ accumulo/trunk/examples/instamo/src/main/java/org/apache/accumulo/instamo/AccumuloApp.java Mon Feb 4 18:09:38 2013
@@ -28,7 +28,6 @@ import org.apache.accumulo.core.client.Z
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;
public class AccumuloApp {
@@ -37,7 +36,7 @@ public class AccumuloApp {
Instance instance = new ZooKeeperInstance(instanceName, zookeepers);
- Connector conn = instance.getConnector(new UserPassToken("root", rootPassword));
+ Connector conn = instance.getConnector("root", rootPassword);
conn.tableOperations().create("foo");
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -66,12 +66,14 @@ 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 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.getAccumuloToken(), opts.dataTable, opts.auths);
+ fdq = new FileDataQuery(opts.instance, opts.zookeepers, opts.user, opts.getPassword(), 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -76,15 +76,22 @@ public class FileDataIngest {
// read through file once, calculating hashes
md5digest.reset();
- InputStream fis = new FileInputStream(filename);
- int numRead = fis.read(buf);
- while (numRead >= 0) {
- if (numRead > 0) {
- md5digest.update(buf, 0, numRead);
+ 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();
}
- numRead = fis.read(buf);
}
- fis.close();
String hash = hexString(md5digest.digest());
Text row = new Text(hash);
@@ -100,28 +107,30 @@ 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 {
- fis.close();
+ if (fis != null) {
+ fis.close();
+ }
}
m = new Mutation(row);
Text chunkCQ = new Text(chunkSizeBytes);
@@ -162,16 +171,17 @@ 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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -31,7 +31,6 @@ 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.SecurityToken;
import org.apache.accumulo.core.util.PeekingIterator;
/**
@@ -44,10 +43,10 @@ public class FileDataQuery {
private ChunkInputStream cis;
Scanner scanner;
- public FileDataQuery(String instanceName, String zooKeepers, SecurityToken token, String tableName, Authorizations auths) throws AccumuloException,
+ public FileDataQuery(String instanceName, String zooKeepers, String user, byte[] password, String tableName, Authorizations auths) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
- conn = instance.getConnector(token);
+ conn = instance.getConnector(user, password);
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 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();