You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/01/22 22:03:06 UTC
svn commit: r1437167 [1/3] - in /accumulo/trunk/proxy/src:
main/java/org/apache/accumulo/proxy/
main/java/org/apache/accumulo/proxy/thrift/ main/thrift/
test/java/org/apache/accumulo/
Author: ecn
Date: Tue Jan 22 21:03:05 2013
New Revision: 1437167
URL: http://svn.apache.org/viewvc?rev=1437167&view=rev
Log:
ACCUMULO-978 found a few things we still could not do via the proxy
Added:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/PTimeType.java (with props)
Modified:
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
accumulo/trunk/proxy/src/main/thrift/proxy.thrift
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyReadWrite.java
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxySecurityOperations.java
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyTableOperations.java
Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1437167&r1=1437166&r2=1437167&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Tue Jan 22 21:03:05 2013
@@ -45,6 +45,7 @@ import org.apache.accumulo.core.client.S
import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.admin.ActiveCompaction;
import org.apache.accumulo.core.client.admin.ActiveScan;
+import org.apache.accumulo.core.client.admin.TimeType;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.data.Column;
import org.apache.accumulo.core.data.Key;
@@ -84,6 +85,7 @@ import org.apache.accumulo.proxy.thrift.
import org.apache.accumulo.proxy.thrift.PScanType;
import org.apache.accumulo.proxy.thrift.PSystemPermission;
import org.apache.accumulo.proxy.thrift.PTablePermission;
+import org.apache.accumulo.proxy.thrift.PTimeType;
import org.apache.accumulo.proxy.thrift.TableExistsException;
import org.apache.accumulo.proxy.thrift.TableNotFoundException;
import org.apache.accumulo.proxy.thrift.UserPass;
@@ -162,19 +164,27 @@ public class ProxyServer implements Accu
}
@Override
- public void tableOperations_compact(UserPass userpass, String tableName, ByteBuffer start, ByteBuffer end, boolean flush, boolean wait)
+ public void tableOperations_compact(UserPass userpass, String tableName, ByteBuffer start, ByteBuffer end, List<PIteratorSetting> iterators, boolean flush, boolean wait)
throws AccumuloSecurityException, TableNotFoundException, AccumuloException, TException {
try {
- getConnector(userpass).tableOperations().compact(tableName, ByteBufferUtil.toText(start), ByteBufferUtil.toText(end), flush, wait);
+ getConnector(userpass).tableOperations().compact(tableName, ByteBufferUtil.toText(start), ByteBufferUtil.toText(end), getPIteratorSettings(iterators), flush, wait);
} catch (Exception e) {
throw new TException(e);
}
}
+ private List<IteratorSetting> getPIteratorSettings(List<PIteratorSetting> iterators) {
+ List<IteratorSetting> result = new ArrayList<IteratorSetting>();
+ for (PIteratorSetting is : iterators) {
+ result.add(getIteratorSetting(is));
+ }
+ return result;
+ }
+
@Override
- public void tableOperations_create(UserPass userpass, String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException, TException {
+ public void tableOperations_create(UserPass userpass, String tableName, boolean versioningIter, PTimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException, TException {
try {
- getConnector(userpass).tableOperations().create(tableName);
+ getConnector(userpass).tableOperations().create(tableName, versioningIter, TimeType.valueOf(timeType.toString()));
} catch (Exception e) {
e.printStackTrace();
throw new TException(e);
@@ -576,11 +586,10 @@ public class ProxyServer implements Accu
}
@Override
- public void securityOperations_createUser(UserPass userpass, String user, ByteBuffer password, Set<String> authorizations) throws AccumuloException,
+ public void securityOperations_createUser(UserPass userpass, String user, ByteBuffer password) throws AccumuloException,
AccumuloSecurityException, TException {
try {
getConnector(userpass).securityOperations().createUser(user, password.array());
- getConnector(userpass).securityOperations().changeUserAuthorizations(user, new Authorizations(authorizations.toArray(new String[] {})));
} catch (Exception e) {
throw new TException(e);
}
@@ -1087,5 +1096,14 @@ public class ProxyServer implements Accu
Key followingKey = key_.followingKey(part_);
return getPKey(followingKey);
}
+
+ @Override
+ public void instanceOperations_pingTabletServer(UserPass userpass, String tserver) throws AccumuloException, AccumuloSecurityException, TException {
+ try {
+ getConnector(userpass).instanceOperations().ping(tserver);
+ } catch (Exception e) {
+ throw new TException(e);
+ }
+ }
}
Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java?rev=1437167&r1=1437166&r2=1437167&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java Tue Jan 22 21:03:05 2013
@@ -31,6 +31,8 @@ import org.apache.accumulo.proxy.thrift.
import org.apache.accumulo.proxy.thrift.PColumnUpdate;
import org.apache.accumulo.proxy.thrift.PKey;
import org.apache.accumulo.proxy.thrift.PScanResult;
+import org.apache.accumulo.proxy.thrift.PTablePermission;
+import org.apache.accumulo.proxy.thrift.PTimeType;
import org.apache.accumulo.proxy.thrift.UserPass;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
@@ -66,8 +68,7 @@ public class TestProxyClient {
System.out.println("Creating user: ");
if (!tpc.proxy().securityOperations_listUsers(userpass).contains("testuser")) {
- Set<String> auths = new HashSet<String>();
- tpc.proxy().securityOperations_createUser(userpass, "testuser", ByteBuffer.wrap("testpass".getBytes()), auths);
+ tpc.proxy().securityOperations_createUser(userpass, "testuser", ByteBuffer.wrap("testpass".getBytes()));
}
System.out.println("UserList: " + tpc.proxy().securityOperations_listUsers(userpass));
@@ -82,7 +83,7 @@ public class TestProxyClient {
if (tpc.proxy().tableOperations_exists(userpass, testTable))
tpc.proxy().tableOperations_delete(userpass, testTable);
- tpc.proxy().tableOperations_create(userpass, testTable);
+ tpc.proxy().tableOperations_create(userpass, testTable, true, PTimeType.MILLIS);
System.out.println("Listing: " + tpc.proxy().tableOperations_list(userpass));
@@ -108,7 +109,7 @@ public class TestProxyClient {
System.out.println(" End of writing: " + (end.getTime() - start.getTime()));
tpc.proxy().tableOperations_delete(userpass, testTable);
- tpc.proxy().tableOperations_create(userpass, testTable);
+ tpc.proxy().tableOperations_create(userpass, testTable, true, PTimeType.MILLIS);
// Thread.sleep(1000);