accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1471130 - in /accumulo/branches/1.5/proxy: ./ src/main/java/org/apache/accumulo/proxy/ src/test/java/org/apache/accumulo/proxy/
Date Tue, 23 Apr 2013 20:17:30 GMT
Author: kturner
Date: Tue Apr 23 20:17:29 2013
New Revision: 1471130

URL: http://svn.apache.org/r1471130
Log:
ACCUMULO-1305 shortened proxy property names

Modified:
    accumulo/branches/1.5/proxy/README
    accumulo/branches/1.5/proxy/proxy.properties
    accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
    accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
    accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
    accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
    accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
    accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java

Modified: accumulo/branches/1.5/proxy/README
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/README?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/README (original)
+++ accumulo/branches/1.5/proxy/README Tue Apr 23 20:17:29 2013
@@ -30,7 +30,7 @@ This will compile the thrift and java fi
 
 Please note that the proxy can only function correctly when connected to an Accumulo 1.5
instance, or when run standalone in the Mock configuration.
 To run the server, edit the configuration file with parameters suited for your Accumulo installation.
If you wish to instead use an in-memory Mock instance, set:
-org.apache.accumulo.proxy.ProxyServer.useMockInstance=true
+ useMockInstance=true
 This option will override any "real" Accumulo instance information.
 
 Once the properties file is configured correctly, run this command:

Modified: accumulo/branches/1.5/proxy/proxy.properties
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/proxy.properties?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/proxy.properties (original)
+++ accumulo/branches/1.5/proxy/proxy.properties Tue Apr 23 20:17:29 2013
@@ -13,12 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-org.apache.accumulo.proxy.ProxyServer.useMockInstance=false
-org.apache.accumulo.proxy.ProxyServer.useMiniAccumulo=true
-org.apache.accumulo.proxy.ProxyServer.protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory
-org.apache.accumulo.proxy.ProxyServer.tokenClass=org.apache.accumulo.core.client.security.tokens.PasswordToken
-org.apache.accumulo.proxy.ProxyServer.port=42424
+useMockInstance=false
+useMiniAccumulo=false
+protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory
+tokenClass=org.apache.accumulo.core.client.security.tokens.PasswordToken
+port=42424
 
-org.apache.accumulo.proxy.ProxyServer.instancename=test
-org.apache.accumulo.proxy.ProxyServer.zookeepers=localhost:2181
+instance=test
+zookeepers=localhost:2181
 

Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java (original)
+++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java Tue Apr
23 20:17:29 2013
@@ -28,6 +28,7 @@ import org.apache.accumulo.proxy.thrift.
 import org.apache.accumulo.test.MiniAccumuloCluster;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TProcessor;
+import org.apache.thrift.protocol.TCompactProtocol;
 import org.apache.thrift.protocol.TProtocolFactory;
 import org.apache.thrift.server.THsHaServer;
 import org.apache.thrift.server.TServer;
@@ -70,21 +71,33 @@ public class Proxy {
     Opts opts = new Opts();
     opts.parseArgs(Proxy.class.getName(), args);
     
-    String api = ProxyServer.class.getName();
+    boolean useMini = Boolean.parseBoolean(opts.prop.getProperty("useMiniAccumulo", "false"));
+    boolean useMock = Boolean.parseBoolean(opts.prop.getProperty("useMockInstance", "false"));
+    String instance = opts.prop.getProperty("instance");
+    String zookeepers = opts.prop.getProperty("zookeepers");
     
-    if (!opts.prop.containsKey(api + ".port")) {
-      System.err.println("No port in the " + api + ".port property");
+    if (!useMini && !useMock && instance == null) {
+      System.err.println("Properties file must contain one of : useMiniAccumulo=true, useMockInstance=true,
or instance=<instance name>");
       System.exit(1);
     }
     
-    String useMini = opts.prop.getProperty(api + ".useMiniAccumulo"); 
-    if (useMini != null && Boolean.parseBoolean(useMini)) {
+    if (instance != null && zookeepers == null) {
+      System.err.println("When instance is set in properties file, zookeepers must also be
set.");
+      System.exit(1);
+    }
+    
+    if (!opts.prop.containsKey("port")) {
+      System.err.println("No port property");
+      System.exit(1);
+    }
+    
+    if (useMini) {
       log.info("Creating mini cluster");
       final File folder = Files.createTempDir();
       final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder, "secret");
       accumulo.start();
-      opts.prop.setProperty(api+".instancename", accumulo.getInstanceName());
-      opts.prop.setProperty(api+".zookeepers", accumulo.getZooKeepers());
+      opts.prop.setProperty("instance", accumulo.getInstanceName());
+      opts.prop.setProperty("zookeepers", accumulo.getZooKeepers());
       Runtime.getRuntime().addShutdownHook(new Thread() {
         public void start() {
           try {
@@ -98,8 +111,9 @@ public class Proxy {
       });
     }
 
-    Class<? extends TProtocolFactory> protoFactoryClass = Class.forName(opts.prop.getProperty(api
+ ".protocolFactory")).asSubclass(TProtocolFactory.class);
-    int port = Integer.parseInt(opts.prop.getProperty(api + ".port"));
+    Class<? extends TProtocolFactory> protoFactoryClass = Class.forName(opts.prop.getProperty("protocolFactory",
TCompactProtocol.Factory.class.getName()))
+        .asSubclass(TProtocolFactory.class);
+    int port = Integer.parseInt(opts.prop.getProperty("port"));
     TServer server = createProxyServer(AccumuloProxy.class, ProxyServer.class, port, protoFactoryClass,
opts.prop);
     server.serve();
   }
@@ -110,7 +124,7 @@ public class Proxy {
     
     // create the implementor
     Object impl = implementor.getConstructor(Properties.class).newInstance(properties);
-    
+
     Class<?> proxyProcClass = Class.forName(api.getName() + "$Processor");
     Class<?> proxyIfaceClass = Class.forName(api.getName() + "$Iface");
     @SuppressWarnings("unchecked")
@@ -124,5 +138,4 @@ public class Proxy {
     args.protocolFactory(protoClass.newInstance());
     return new THsHaServer(args);
   }
-  
 }

Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Tue
Apr 23 20:17:29 2013
@@ -152,17 +152,14 @@ public class ProxyServer implements Accu
   
   public ProxyServer(Properties props) {
     
-    String useMock = props.getProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance");
+    String useMock = props.getProperty("useMockInstance");
     if (useMock != null && Boolean.parseBoolean(useMock))
       instance = new MockInstance();
     else
-      instance = new ZooKeeperInstance(props.getProperty("org.apache.accumulo.proxy.ProxyServer.instancename"),
-          props.getProperty("org.apache.accumulo.proxy.ProxyServer.zookeepers"));
+      instance = new ZooKeeperInstance(props.getProperty("instance"), props.getProperty("zookeepers"));
     
     try {
-      String tokenProp = props.getProperty("org.apache.accumulo.proxy.ProxyServer.tokenClass");
-      if (tokenProp == null)
-        throw new IllegalArgumentException("Missing property : org.apache.accumulo.proxy.ProxyServer.tokenClass");
+      String tokenProp = props.getProperty("tokenClass", PasswordToken.class.getName());
       tokenClass = Class.forName(tokenProp).asSubclass(AuthenticationToken.class);
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(e);

Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Tue
Apr 23 20:17:29 2013
@@ -139,9 +139,9 @@ public class SimpleTest {
     accumulo.start();
     
     Properties props = new Properties();
-    props.put("org.apache.accumulo.proxy.ProxyServer.instancename", accumulo.getInstanceName());
-    props.put("org.apache.accumulo.proxy.ProxyServer.zookeepers", accumulo.getZooKeepers());
-    props.put("org.apache.accumulo.proxy.ProxyServer.tokenClass", PasswordToken.class.getName());
+    props.put("instance", accumulo.getInstanceName());
+    props.put("zookeepers", accumulo.getZooKeepers());
+    props.put("tokenClass", PasswordToken.class.getName());
     
     protocolClass = getRandomProtocol();
     System.out.println(protocolClass.getName());

Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
(original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
Tue Apr 23 20:17:29 2013
@@ -43,8 +43,8 @@ public class TestProxyInstanceOperations
   @BeforeClass
   public static void setup() throws Exception {
     Properties prop = new Properties();
-    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
-    prop.put("org.apache.accumulo.proxy.ProxyServer.tokenClass", PasswordToken.class.getName());
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
     
     proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
         port, TCompactProtocol.Factory.class, prop);

Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
(original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
Tue Apr 23 20:17:29 2013
@@ -60,8 +60,8 @@ public class TestProxyReadWrite {
   @BeforeClass
   public static void setup() throws Exception {
     Properties prop = new Properties();
-    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
-    prop.put("org.apache.accumulo.proxy.ProxyServer.tokenClass", PasswordToken.class.getName());
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
     
     proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
         port, TCompactProtocol.Factory.class, prop);

Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
(original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
Tue Apr 23 20:17:29 2013
@@ -55,8 +55,8 @@ public class TestProxySecurityOperations
   @BeforeClass
   public static void setup() throws Exception {
     Properties prop = new Properties();
-    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
-    prop.put("org.apache.accumulo.proxy.ProxyServer.tokenClass", PasswordToken.class.getName());
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
     
     proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
         port, TCompactProtocol.Factory.class, prop);

Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java?rev=1471130&r1=1471129&r2=1471130&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
(original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
Tue Apr 23 20:17:29 2013
@@ -56,8 +56,8 @@ public class TestProxyTableOperations {
   @BeforeClass
   public static void setup() throws Exception {
     Properties prop = new Properties();
-    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
-    prop.put("org.apache.accumulo.proxy.ProxyServer.tokenClass", PasswordToken.class.getName());
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
     
     proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
         port, TCompactProtocol.Factory.class, prop);



Mime
View raw message