Author: vines Date: Wed Mar 6 23:56:41 2013 New Revision: 1453624 URL: http://svn.apache.org/r1453624 Log: ACCUMULO-1156 - a good start on killing use of deprecated code
Modified: accumulo/trunk/ (props changed) accumulo/trunk/conf/examples/1GB/native-standalone/accumulo-site.xml accumulo/trunk/conf/examples/1GB/standalone/accumulo-site.xml accumulo/trunk/conf/examples/2GB/native-standalone/accumulo-site.xml accumulo/trunk/conf/examples/2GB/standalone/accumulo-site.xml accumulo/trunk/conf/examples/3GB/native-standalone/accumulo-site.xml accumulo/trunk/conf/examples/3GB/standalone/accumulo-site.xml accumulo/trunk/conf/examples/512MB/native-standalone/accumulo-site.xml accumulo/trunk/conf/examples/512MB/standalone/accumulo-site.xml accumulo/trunk/core/ (props changed) accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java accumulo/trunk/server/ (props changed) accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java Propchange: accumulo/trunk/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5:r1453613-1453623 Modified: accumulo/trunk/conf/examples/1GB/native-standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/1GB/native-standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/1GB/native-standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/1GB/native-standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -59,13 +59,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/1GB/standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/1GB/standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/1GB/standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/1GB/standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -59,13 +59,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/2GB/native-standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/2GB/native-standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/2GB/native-standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/2GB/native-standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -59,13 +59,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/2GB/standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/2GB/standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/2GB/standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/2GB/standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -65,15 +65,15 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/3GB/native-standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/3GB/native-standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/3GB/native-standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/3GB/native-standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -59,13 +59,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/3GB/standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/3GB/standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/3GB/standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/3GB/standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -59,13 +59,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/512MB/native-standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/512MB/native-standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/512MB/native-standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/512MB/native-standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -59,13 +59,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Modified: accumulo/trunk/conf/examples/512MB/standalone/accumulo-site.xml URL: http://svn.apache.org/viewvc/accumulo/trunk/conf/examples/512MB/standalone/accumulo-site.xml?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/conf/examples/512MB/standalone/accumulo-site.xml (original) +++ accumulo/trunk/conf/examples/512MB/standalone/accumulo-site.xml Wed Mar 6 23:56:41 2013 @@ -65,13 +65,13 @@ </property> <property> - <name>trace.password</name> + <name>trace.login.password</name> <!-- change this to the root user's password, and/or change the user below --> - <value>secret</value> + <value>password=secret</value> </property> <property> - <name>trace.user</name> + <name>trace.principal</name> <value>root</value> </property> Propchange: accumulo/trunk/core/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/core:r1453613-1453623 Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java Wed Mar 6 23:56:41 2013 @@ -224,9 +224,14 @@ public enum Property { TRACE_PREFIX("trace.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of distributed tracing."), TRACE_PORT("trace.port.client", "12234", PropertyType.PORT, "The listening port for the trace server"), TRACE_TABLE("trace.table", "trace", PropertyType.STRING, "The name of the table to store distributed traces"), + @Deprecated TRACE_USER("trace.user", "root", PropertyType.STRING, "The name of the user to store distributed traces"), + TRACE_PRINCIPAL("trace.principal", "root", PropertyType.STRING, "The principal to store distributed traces"), + @Deprecated TRACE_PASSWORD("trace.password", "secret", PropertyType.STRING, "The password for the user used to store distributed traces"), - + TRACE_LOGIN_PROPERTIES("trace.login", null, PropertyType.PREFIX, "The login credentials prefix for the principal used to store distributed traces"), + +>>>>>>> .merge-right.r1453623 // per table properties TABLE_PREFIX("table.", null, PropertyType.PREFIX, "Properties in this category affect tablet server treatment of tablets, but can be configured " + "on a per-table basis. Setting these properties in the site file will override the default globally " Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java Wed Mar 6 23:56:41 2013 @@ -57,7 +57,7 @@ public enum PropertyType { return new Path(value).isAbsolute(); } }, - + CLASSNAME("java class", "[\\w$.]*", "A fully qualified java class name representing a class on the classpath.<br />" + "An example is 'java.lang.String', rather than 'String'"), Propchange: accumulo/trunk/server/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/server:r1453519-1453623 Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java?rev=1453624&r1=1453623&r2=1453624&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java Wed Mar 6 23:56:41 2013 @@ -17,6 +17,8 @@ package org.apache.accumulo.server.monitor.servlets.trace; import java.util.Date; +import java.util.Map; +import java.util.Properties; import javax.servlet.http.HttpServletRequest; @@ -25,6 +27,8 @@ import org.apache.accumulo.core.client.A import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.trace.TraceFormatter; @@ -61,17 +65,28 @@ abstract class Basic extends BasicServle return TraceFormatter.formatDate(new Date(millis)); } - protected Scanner getScanner(StringBuilder sb) throws AccumuloException { + protected Scanner getScanner(StringBuilder sb) throws AccumuloException, AccumuloSecurityException { AccumuloConfiguration conf = Monitor.getSystemConfiguration(); - String user = conf.get(Property.TRACE_USER); - byte[] passwd = conf.get(Property.TRACE_PASSWORD).getBytes(); + String principal = conf.get(Property.TRACE_PRINCIPAL); + if (principal == null) + principal = conf.get(Property.TRACE_USER); + AuthenticationToken at; + Map<String, String> loginMap = conf.getAllPropertiesWithPrefix(Property.TRACE_LOGIN_PROPERTIES); + if (loginMap == null) + at = new PasswordToken(conf.get(Property.TRACE_PASSWORD).getBytes()); + else{ + Properties props = new Properties(); + props.putAll(loginMap); + at = HdfsZooInstance.getInstance().getAuthenticator().login(props); + } + String table = conf.get(Property.TRACE_TABLE); try { - Connector conn = HdfsZooInstance.getInstance().getConnector(user, passwd); + Connector conn = HdfsZooInstance.getInstance().getConnector(principal, at); if (!conn.tableOperations().exists(table)) { return new NullScanner(); } - Scanner scanner = conn.createScanner(table, conn.securityOperations().getUserAuthorizations(user)); + Scanner scanner = conn.createScanner(table, conn.securityOperations().getUserAuthorizations(principal)); return scanner; } catch (AccumuloSecurityException ex) { sb.append("<h2>Unable to read trace table: check trace username and password configuration.</h2>\n");