You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2010/04/09 04:10:03 UTC

svn commit: r932214 [3/4] - in /hadoop/hbase/branches/0.20_pre_durability: ./ src/contrib/stargate/ src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/ src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/ src/contrib/stargat...

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/VersionResource.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/VersionResource.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/VersionResource.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/VersionResource.java Fri Apr  9 02:10:02 2010
@@ -1,94 +1,94 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.stargate;
-
-import java.io.IOException;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import javax.ws.rs.core.Response.ResponseBuilder;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.stargate.model.VersionModel;
-
-/**
- * Implements Stargate software version reporting via
- * <p>
- * <tt>/version/stargate</tt>
- * <p>
- * <tt>/version</tt> (alias for <tt>/version/stargate</tt>)
- */
-public class VersionResource implements Constants {
-  private static final Log LOG = LogFactory.getLog(VersionResource.class);
-
-  private CacheControl cacheControl;
-  private RESTServlet servlet;
-
-  public VersionResource() throws IOException {
-    servlet = RESTServlet.getInstance();
-    cacheControl = new CacheControl();
-    cacheControl.setNoCache(true);
-    cacheControl.setNoTransform(false);
-  }
-
-  /**
-   * Build a response for a version request.
-   * @param context servlet context
-   * @param uriInfo (JAX-RS context variable) request URL
-   * @return a response for a version request 
-   */
-  @GET
-  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
-  public Response get(@Context ServletContext context, 
-      @Context UriInfo uriInfo) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("GET " + uriInfo.getAbsolutePath());
-    }
-    servlet.getMetrics().incrementRequests(1);
-    ResponseBuilder response = Response.ok(new VersionModel(context));
-    response.cacheControl(cacheControl);
-    return response.build();
-  }
-
-  /**
-   * Dispatch to StorageClusterVersionResource
-   */
-  @Path("cluster")
-  public StorageClusterVersionResource getClusterVersionResource() 
-      throws IOException {
-    return new StorageClusterVersionResource();
-  }
-
-  /**
-   * Dispatch <tt>/version/stargate</tt> to self.
-   */
-  @Path("stargate")
-  public VersionResource getVersionResource() {
-    return this;
-  }
-}
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.stargate;
+
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.stargate.model.VersionModel;
+
+/**
+ * Implements Stargate software version reporting via
+ * <p>
+ * <tt>/version/stargate</tt>
+ * <p>
+ * <tt>/version</tt> (alias for <tt>/version/stargate</tt>)
+ */
+public class VersionResource implements Constants {
+  private static final Log LOG = LogFactory.getLog(VersionResource.class);
+
+  private CacheControl cacheControl;
+  private RESTServlet servlet;
+
+  public VersionResource() throws IOException {
+    servlet = RESTServlet.getInstance();
+    cacheControl = new CacheControl();
+    cacheControl.setNoCache(true);
+    cacheControl.setNoTransform(false);
+  }
+
+  /**
+   * Build a response for a version request.
+   * @param context servlet context
+   * @param uriInfo (JAX-RS context variable) request URL
+   * @return a response for a version request 
+   */
+  @GET
+  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  public Response get(final @Context ServletContext context, 
+      final @Context UriInfo uriInfo) {
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("GET " + uriInfo.getAbsolutePath());
+    }
+    servlet.getMetrics().incrementRequests(1);
+    ResponseBuilder response = Response.ok(new VersionModel(context));
+    response.cacheControl(cacheControl);
+    return response.build();
+  }
+
+  /**
+   * Dispatch to StorageClusterVersionResource
+   */
+  @Path("cluster")
+  public StorageClusterVersionResource getClusterVersionResource() 
+      throws IOException {
+    return new StorageClusterVersionResource();
+  }
+
+  /**
+   * Dispatch <tt>/version/stargate</tt> to self.
+   */
+  @Path("stargate")
+  public VersionResource getVersionResource() {
+    return this;
+  }
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/Authenticator.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/Authenticator.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/Authenticator.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/Authenticator.java Fri Apr  9 02:10:02 2010
@@ -1,7 +1,29 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.hadoop.hbase.stargate.auth;
 
 import java.io.IOException;
 
+import org.apache.hadoop.hbase.stargate.User;
+
 public abstract class Authenticator {
 
   public abstract User getUserForToken(String token) throws IOException;

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HBCAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HBCAuthenticator.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HBCAuthenticator.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HBCAuthenticator.java Fri Apr  9 02:10:02 2010
@@ -1,6 +1,27 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.hadoop.hbase.stargate.auth;
 
 import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.stargate.User;
 
 public class HBCAuthenticator extends Authenticator {
 

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HTableAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HTableAuthenticator.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HTableAuthenticator.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/HTableAuthenticator.java Fri Apr  9 02:10:02 2010
@@ -1,14 +1,37 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.hadoop.hbase.stargate.auth;
 
 import java.io.IOException;
 
 import org.apache.hadoop.hbase.HBaseConfiguration;
+
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.stargate.Constants;
+import org.apache.hadoop.hbase.stargate.User;
 import org.apache.hadoop.hbase.util.Bytes;
 
-public class HTableAuthenticator extends Authenticator {
+public class HTableAuthenticator extends Authenticator implements Constants {
 
   static final byte[] USER = Bytes.toBytes("user");
   static final byte[] NAME = Bytes.toBytes("name");
@@ -31,9 +54,7 @@ public class HTableAuthenticator extends
    * @param conf
    */
   public HTableAuthenticator(HBaseConfiguration conf) {
-    this.conf = conf;
-    this.tableName = conf.get("stargate.auth.htable.name",
-      "stargate.users");
+    this(conf, conf.get("stargate.auth.htable.name", USERS_TABLE));
   }
 
   /**

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/JDBCAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/JDBCAuthenticator.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/JDBCAuthenticator.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/JDBCAuthenticator.java Fri Apr  9 02:10:02 2010
@@ -1,3 +1,23 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.hadoop.hbase.stargate.auth;
 
 import java.io.IOException;
@@ -7,12 +27,16 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.stargate.User;
 import org.apache.hadoop.util.StringUtils;
-import org.mortbay.log.Log;
 
 public class JDBCAuthenticator extends Authenticator {
 
+  static final Log LOG = LogFactory.getLog(JDBCAuthenticator.class);
   static final int MAX_RETRIES = 5;
   static final long RETRY_SLEEP_TIME = 1000 * 2;
 
@@ -73,7 +97,7 @@ public class JDBCAuthenticator extends A
       if (++retries > MAX_RETRIES) {
         throw new IOException(e);
       } else try {
-        Log.warn(StringUtils.stringifyException(e));
+        LOG.warn(StringUtils.stringifyException(e));
         Thread.sleep(RETRY_SLEEP_TIME);
       } catch (InterruptedException ex) {
         // ignore

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/ZooKeeperAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/ZooKeeperAuthenticator.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/ZooKeeperAuthenticator.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/auth/ZooKeeperAuthenticator.java Fri Apr  9 02:10:02 2010
@@ -25,7 +25,9 @@ import java.io.IOException;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.stargate.Constants;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.stargate.User;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
+
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Client.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Client.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Client.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Client.java Fri Apr  9 02:10:02 2010
@@ -64,10 +64,13 @@ public class Client {
    */
   public Client(Cluster cluster) {
     this.cluster = cluster;
-    httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
-    HttpConnectionManagerParams managerParams =
-      httpClient.getHttpConnectionManager().getParams();
+    MultiThreadedHttpConnectionManager manager = 
+      new MultiThreadedHttpConnectionManager();
+    HttpConnectionManagerParams managerParams = manager.getParams();
     managerParams.setConnectionTimeout(2000); // 2 s
+    managerParams.setDefaultMaxConnectionsPerHost(10);
+    managerParams.setMaxTotalConnections(100);
+    this.httpClient = new HttpClient(manager);
     HttpClientParams clientParams = httpClient.getParams();
     clientParams.setVersion(HttpVersion.HTTP_1_1);
   }
@@ -106,7 +109,7 @@ public class Client {
     do {
       cluster.lastHost = cluster.nodes.get(i);
       try {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("http://");
         sb.append(cluster.lastHost);
         sb.append(path);
@@ -200,10 +203,13 @@ public class Client {
   public Response head(Cluster cluster, String path, Header[] headers) 
       throws IOException {
     HeadMethod method = new HeadMethod();
-    int code = execute(cluster, method, null, path);
-    headers = method.getResponseHeaders();
-    method.releaseConnection();
-    return new Response(code, headers, null);
+    try {
+      int code = execute(cluster, method, null, path);
+      headers = method.getResponseHeaders();
+      return new Response(code, headers, null);
+    } finally {
+      method.releaseConnection();
+    }
   }
 
   /**
@@ -276,11 +282,14 @@ public class Client {
   public Response get(Cluster c, String path, Header[] headers) 
       throws IOException {
     GetMethod method = new GetMethod();
-    int code = execute(c, method, headers, path);
-    headers = method.getResponseHeaders();
-    byte[] body = method.getResponseBody();
-    method.releaseConnection();
-    return new Response(code, headers, body);
+    try {
+      int code = execute(c, method, headers, path);
+      headers = method.getResponseHeaders();
+      byte[] body = method.getResponseBody();
+      return new Response(code, headers, body);
+    } finally {
+      method.releaseConnection();
+    }
   }
 
   /**
@@ -339,12 +348,15 @@ public class Client {
   public Response put(Cluster cluster, String path, Header[] headers, 
       byte[] content) throws IOException {
     PutMethod method = new PutMethod();
-    method.setRequestEntity(new ByteArrayRequestEntity(content));
-    int code = execute(cluster, method, headers, path);
-    headers = method.getResponseHeaders();
-    content = method.getResponseBody();
-    method.releaseConnection();
-    return new Response(code, headers, content);
+    try {
+      method.setRequestEntity(new ByteArrayRequestEntity(content));
+      int code = execute(cluster, method, headers, path);
+      headers = method.getResponseHeaders();
+      content = method.getResponseBody();
+      return new Response(code, headers, content);
+    } finally {
+      method.releaseConnection();
+    }
   }
 
   /**
@@ -403,12 +415,15 @@ public class Client {
   public Response post(Cluster cluster, String path, Header[] headers, 
       byte[] content) throws IOException {
     PostMethod method = new PostMethod();
-    method.setRequestEntity(new ByteArrayRequestEntity(content));
-    int code = execute(cluster, method, headers, path);
-    headers = method.getResponseHeaders();
-    content = method.getResponseBody();
-    method.releaseConnection();
-    return new Response(code, headers, content);
+    try {
+      method.setRequestEntity(new ByteArrayRequestEntity(content));
+      int code = execute(cluster, method, headers, path);
+      headers = method.getResponseHeaders();
+      content = method.getResponseBody();
+      return new Response(code, headers, content);
+    } finally {
+      method.releaseConnection();
+    }
   }
 
   /**
@@ -430,9 +445,14 @@ public class Client {
    */
   public Response delete(Cluster cluster, String path) throws IOException {
     DeleteMethod method = new DeleteMethod();
-    int code = execute(cluster, method, null, path);
-    Header[] headers = method.getResponseHeaders();
-    method.releaseConnection();
-    return new Response(code, headers);
+    try {
+      int code = execute(cluster, method, null, path);
+      Header[] headers = method.getResponseHeaders();
+      byte[] content = method.getResponseBody();
+      return new Response(code, headers, content);
+    } finally {
+      method.releaseConnection();
+    }
   }
+
 }

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Cluster.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Cluster.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Cluster.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/Cluster.java Fri Apr  9 02:10:02 2010
@@ -47,6 +47,13 @@ public class Cluster {
   }
 
   /**
+   * @return true if no locations have been added, false otherwise
+   */
+  public boolean isEmpty() {
+    return nodes.isEmpty();
+  }
+
+  /**
    * Add a node to the cluster
    * @param node the service location in 'host:port' format
    */

Added: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteAdmin.java?rev=932214&view=auto
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteAdmin.java (added)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteAdmin.java Fri Apr  9 02:10:02 2010
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.stargate.client;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.stargate.Constants;
+import org.apache.hadoop.hbase.stargate.model.TableSchemaModel;
+import org.apache.hadoop.hbase.util.Bytes;
+
+public class RemoteAdmin {
+
+  final Client client;
+  final HBaseConfiguration conf;
+  final String accessToken;
+  final int maxRetries;
+  final long sleepTime;
+
+  /**
+   * Constructor
+   * @param client
+   * @param conf
+   */
+  public RemoteAdmin(Client client, HBaseConfiguration conf) {
+    this(client, conf, null);
+  }
+
+  /**
+   * Constructor
+   * @param client
+   * @param conf
+   * @param accessToken
+   */
+  public RemoteAdmin(Client client, HBaseConfiguration conf, String accessToken) {
+    this.client = client;
+    this.conf = conf;
+    this.accessToken = accessToken;
+    this.maxRetries = conf.getInt("stargate.client.max.retries", 10);
+    this.sleepTime = conf.getLong("stargate.client.sleep", 1000);
+  }
+
+  /**
+   * @param tableName name of table to check
+   * @return true if all regions of the table are available
+   * @throws IOException if a remote or network exception occurs
+   */
+  public boolean isTableAvailable(String tableName) throws IOException {
+    return isTableAvailable(Bytes.toBytes(tableName));
+  }
+
+  /**
+   * @param tableName name of table to check
+   * @return true if all regions of the table are available
+   * @throws IOException if a remote or network exception occurs
+   */
+  public boolean isTableAvailable(byte[] tableName) throws IOException {
+    StringBuilder sb = new StringBuilder();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');
+    }
+    sb.append(Bytes.toStringBinary(tableName));
+    sb.append('/');
+    sb.append("exists");
+    int code = 0;
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.get(sb.toString());
+      code = response.getCode();
+      switch (code) {
+      case 200:
+        return true;
+      case 404:
+        return false;
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("exists request returned " + code);
+      }
+    }
+    throw new IOException("exists request timed out");
+  }
+
+  /**
+   * Creates a new table.
+   * @param desc table descriptor for table
+   * @throws IOException if a remote or network exception occurs
+   */
+  public void createTable(HTableDescriptor desc)
+      throws IOException {
+    TableSchemaModel model = new TableSchemaModel(desc);
+    StringBuilder sb = new StringBuilder();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');
+    }
+    sb.append(Bytes.toStringBinary(desc.getName()));
+    sb.append('/');
+    sb.append("schema");
+    int code = 0;
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
+        model.createProtobufOutput());
+      code = response.getCode();
+      switch (code) {
+      case 201:
+        return;
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("create request returned " + code);
+      }
+    }
+    throw new IOException("create request timed out");
+  }
+
+  /**
+   * Deletes a table.
+   * @param tableName name of table to delete
+   * @throws IOException if a remote or network exception occurs
+   */
+  public void deleteTable(final String tableName) throws IOException {
+    deleteTable(Bytes.toBytes(tableName));
+  }
+
+  /**
+   * Deletes a table.
+   * @param tableName name of table to delete
+   * @throws IOException if a remote or network exception occurs
+   */
+  public void deleteTable(final byte [] tableName) throws IOException {
+    StringBuilder sb = new StringBuilder();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');
+    }
+    sb.append(Bytes.toStringBinary(tableName));
+    sb.append('/');
+    sb.append("schema");
+    int code = 0;
+    for (int i = 0; i < maxRetries; i++) { 
+      Response response = client.delete(sb.toString());
+      code = response.getCode();
+      switch (code) {
+      case 200:
+        return;
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("delete request returned " + code);
+      }
+    }
+    throw new IOException("delete request timed out");
+  }
+
+}

Added: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteHTable.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteHTable.java?rev=932214&view=auto
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteHTable.java (added)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/client/RemoteHTable.java Fri Apr  9 02:10:02 2010
@@ -0,0 +1,593 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.stargate.client;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.hadoop.util.StringUtils;
+
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.RowLock;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.io.TimeRange;
+import org.apache.hadoop.hbase.stargate.Constants;
+import org.apache.hadoop.hbase.stargate.model.CellModel;
+import org.apache.hadoop.hbase.stargate.model.CellSetModel;
+import org.apache.hadoop.hbase.stargate.model.RowModel;
+import org.apache.hadoop.hbase.stargate.model.ScannerModel;
+import org.apache.hadoop.hbase.stargate.model.TableSchemaModel;
+import org.apache.hadoop.hbase.util.Bytes;
+
+/**
+ * HTable interface to remote tables accessed via Stargate
+ */
+public class RemoteHTable {
+
+  private static final Log LOG = LogFactory.getLog(RemoteHTable.class);
+
+  final Client client;
+  final HBaseConfiguration conf;
+  final byte[] name;
+  final String accessToken;
+  final int maxRetries;
+  final long sleepTime;
+
+  @SuppressWarnings("unchecked")
+  protected String buildRowSpec(final byte[] row, final Map familyMap, 
+      final long startTime, final long endTime, final int maxVersions) {
+    StringBuffer sb = new StringBuffer();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');
+    }
+    sb.append(Bytes.toStringBinary(name));
+    sb.append('/');
+    sb.append(Bytes.toStringBinary(row));
+    Set families = familyMap.entrySet();
+    if (families != null) {
+      Iterator i = familyMap.entrySet().iterator();
+      if (i.hasNext()) {
+        sb.append('/');
+      }
+      while (i.hasNext()) {
+        Map.Entry e = (Map.Entry)i.next();
+        Collection quals = (Collection)e.getValue();
+        if (quals != null && !quals.isEmpty()) {
+          Iterator ii = quals.iterator();
+          while (ii.hasNext()) {
+            sb.append(Bytes.toStringBinary((byte[])e.getKey()));
+            sb.append(':');
+            Object o = ii.next();
+            // Puts use byte[] but Deletes use KeyValue
+            if (o instanceof byte[]) {
+              sb.append(Bytes.toStringBinary((byte[])o));
+            } else if (o instanceof KeyValue) {
+              sb.append(Bytes.toStringBinary(((KeyValue)o).getQualifier()));
+            } else {
+              throw new RuntimeException("object type not handled");
+            }
+            if (ii.hasNext()) {
+              sb.append(',');
+            }
+          }
+        } else {
+          sb.append(Bytes.toStringBinary((byte[])e.getKey()));
+          sb.append(':');
+        }
+        if (i.hasNext()) {
+          sb.append(',');
+        }
+      }
+    }
+    if (startTime != 0 && endTime != Long.MAX_VALUE) {
+      sb.append('/');
+      sb.append(startTime);
+      if (startTime != endTime) {
+        sb.append(',');
+        sb.append(endTime);
+      }
+    } else if (endTime != Long.MAX_VALUE) {
+      sb.append('/');
+      sb.append(endTime);
+    }
+    if (maxVersions > 1) {
+      sb.append("?v=");
+      sb.append(maxVersions);
+    }
+    return sb.toString();
+  }
+
+  protected Result[] buildResultFromModel(final CellSetModel model) {
+    List<Result> results = new ArrayList<Result>();
+    for (RowModel row: model.getRows()) {
+      List<KeyValue> kvs = new ArrayList<KeyValue>();
+      for (CellModel cell: row.getCells()) {
+        byte[][] split = KeyValue.parseColumn(cell.getColumn());
+        byte[] column = split[0];
+        byte[] qualifier = split.length > 1 ? split[1] : null;
+        kvs.add(new KeyValue(row.getKey(), column, qualifier, 
+          cell.getTimestamp(), cell.getValue()));
+      }
+      results.add(new Result(kvs));
+    }
+    return results.toArray(new Result[results.size()]);
+  }
+
+  protected CellSetModel buildModelFromPut(Put put) {
+    RowModel row = new RowModel(put.getRow());
+    long ts = put.getTimeStamp();
+    for (List<KeyValue> kvs: put.getFamilyMap().values()) {
+      for (KeyValue kv: kvs) {
+        row.addCell(new CellModel(kv.getFamily(), kv.getQualifier(),
+          ts != HConstants.LATEST_TIMESTAMP ? ts : kv.getTimestamp(),
+          kv.getValue()));
+      }
+    }
+    CellSetModel model = new CellSetModel();
+    model.addRow(row);
+    return model;
+  }
+
+  /**
+   * Constructor
+   * @param client
+   * @param name
+   */
+  public RemoteHTable(Client client, String name) {
+    this(client, new HBaseConfiguration(), Bytes.toBytes(name), null);
+  }
+
+  /**
+   * Constructor
+   * @param client
+   * @param name
+   * @param accessToken
+   */
+  public RemoteHTable(Client client, String name, String accessToken) {
+    this(client, new HBaseConfiguration(), Bytes.toBytes(name), accessToken);
+  }
+
+  /**
+   * Constructor
+   * @param client
+   * @param conf
+   * @param name
+   * @param accessToken
+   */
+  public RemoteHTable(Client client, HBaseConfiguration conf, String name,
+      String accessToken) {
+    this(client, conf, Bytes.toBytes(name), accessToken);
+  }
+
+  /**
+   * Constructor
+   * @param conf
+   */
+  public RemoteHTable(Client client, HBaseConfiguration conf, byte[] name,
+      String accessToken) {
+    this.client = client;
+    this.conf = conf;
+    this.name = name;
+    this.accessToken = accessToken;
+    this.maxRetries = conf.getInt("stargate.client.max.retries", 10);
+    this.sleepTime = conf.getLong("stargate.client.sleep", 1000);
+  }
+
+  public byte[] getTableName() {
+    return name.clone();
+  }
+
+  public HBaseConfiguration getConfiguration() {
+    return conf;
+  }
+
+  public HTableDescriptor getTableDescriptor() throws IOException {
+    StringBuilder sb = new StringBuilder();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');
+    }
+    sb.append(Bytes.toStringBinary(name));
+    sb.append('/');
+    sb.append("schema");
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.get(sb.toString(), Constants.MIMETYPE_PROTOBUF);
+      int code = response.getCode();
+      switch (code) {
+      case 200:
+        TableSchemaModel schema = new TableSchemaModel();
+        schema.getObjectFromMessage(response.getBody());
+        return schema.getTableDescriptor();
+      case 509: 
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("schema request returned " + code);
+      }
+    }
+    throw new IOException("schema request timed out");
+  }
+
+  public void close() throws IOException {
+    client.shutdown();
+  }
+
+  public Result get(Get get) throws IOException {
+    TimeRange range = get.getTimeRange();
+    String spec = buildRowSpec(get.getRow(), get.getFamilyMap(),
+      range.getMin(), range.getMax(), get.getMaxVersions());
+    if (get.getFilter() != null) {
+      LOG.warn("filters not supported on gets");
+    }
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.get(spec, Constants.MIMETYPE_PROTOBUF);
+      int code = response.getCode();
+      switch (code) {
+      case 200:
+        CellSetModel model = new CellSetModel();
+        model.getObjectFromMessage(response.getBody());
+        Result[] results = buildResultFromModel(model);
+        if (results.length > 0) {
+          if (results.length > 1) {
+            LOG.warn("too many results for get (" + results.length + ")");
+          }
+          return results[0];
+        }
+        // fall through
+      case 404:
+        return new Result();
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("get request returned " + code);
+      }
+    }
+    throw new IOException("get request timed out");
+  }
+
+  public boolean exists(Get get) throws IOException {
+    LOG.warn("exists() is really get(), just use get()");
+    Result result = get(get);
+    return (result != null && !(result.isEmpty()));
+  }
+
+  public void put(Put put) throws IOException {
+    CellSetModel model = buildModelFromPut(put);
+    StringBuilder sb = new StringBuilder();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');      
+    }
+    sb.append(Bytes.toStringBinary(name));
+    sb.append('/');
+    sb.append(Bytes.toStringBinary(put.getRow()));
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
+        model.createProtobufOutput());
+      int code = response.getCode();
+      switch (code) {
+      case 200:
+        return;
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("put request failed with " + code);
+      }
+    }
+    throw new IOException("put request timed out");
+  }
+
+  public void put(List<Put> puts) throws IOException {
+    // this is a trick: Stargate accepts multiple rows in a cell set and
+    // ignores the row specification in the URI
+
+    // separate puts by row
+    TreeMap<byte[],List<KeyValue>> map =
+      new TreeMap<byte[],List<KeyValue>>(Bytes.BYTES_COMPARATOR);
+    for (Put put: puts) {
+      byte[] row = put.getRow();
+      List<KeyValue> kvs = map.get(row);
+      if (kvs == null) {
+        kvs = new ArrayList<KeyValue>();
+        map.put(row, kvs);
+      }
+      for (List<KeyValue> l: put.getFamilyMap().values()) {
+        kvs.addAll(l);
+      }
+    }
+
+    // build the cell set
+    CellSetModel model = new CellSetModel();
+    for (Map.Entry<byte[], List<KeyValue>> e: map.entrySet()) {
+      RowModel row = new RowModel(e.getKey());
+      for (KeyValue kv: e.getValue()) {
+        row.addCell(new CellModel(kv));
+      }
+      model.addRow(row);
+    }
+
+    // build path for multiput
+    StringBuilder sb = new StringBuilder();
+    sb.append('/');
+    if (accessToken != null) {
+      sb.append(accessToken);
+      sb.append('/');      
+    }
+    sb.append(Bytes.toStringBinary(name));
+    sb.append("/$multiput"); // can be any nonexistent row
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
+        model.createProtobufOutput());
+      int code = response.getCode();
+      switch (code) {
+      case 200:
+        return;
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("multiput request failed with " + code);
+      }
+    }
+    throw new IOException("multiput request timed out");
+  }
+
+  public void delete(Delete delete) throws IOException {
+    String spec = buildRowSpec(delete.getRow(), delete.getFamilyMap(),
+      delete.getTimeStamp(), delete.getTimeStamp(), 1);
+    for (int i = 0; i < maxRetries; i++) {
+      Response response = client.delete(spec);
+      int code = response.getCode();
+      switch (code) {
+      case 200:
+        return;
+      case 509:
+        try {
+          Thread.sleep(sleepTime);
+        } catch (InterruptedException e) { }
+        break;
+      default:
+        throw new IOException("delete request failed with " + code);
+      }
+    }
+    throw new IOException("delete request timed out");
+  }
+
+  public void delete(List<Delete> deletes) throws IOException {
+    for (Delete delete: deletes) {
+      delete(delete);
+    }
+  }
+
+  public void flushCommits() throws IOException {
+    // no-op
+  }
+
+  class Scanner implements ResultScanner {
+
+    String uri;
+
+    public Scanner(Scan scan) throws IOException {
+      ScannerModel model;
+      try {
+        model = ScannerModel.fromScan(scan);
+      } catch (Exception e) {
+        throw new IOException(e);
+      }
+      StringBuffer sb = new StringBuffer();
+      sb.append('/');
+      if (accessToken != null) {
+        sb.append(accessToken);
+        sb.append('/');
+      }
+      sb.append(Bytes.toStringBinary(name));
+      sb.append('/');
+      sb.append("scanner");
+      for (int i = 0; i < maxRetries; i++) {
+        Response response = client.post(sb.toString(),
+          Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
+        int code = response.getCode();
+        switch (code) {
+        case 201:
+          uri = response.getLocation();
+          return;
+        case 509:
+          try {
+            Thread.sleep(sleepTime);
+          } catch (InterruptedException e) { }
+          break;
+        default:
+          throw new IOException("scan request failed with " + code);
+        }
+      }
+      throw new IOException("scan request timed out");
+    }
+
+    @Override
+    public Result[] next(int nbRows) throws IOException {
+      StringBuilder sb = new StringBuilder(uri);
+      sb.append("?n=");
+      sb.append(nbRows);
+      for (int i = 0; i < maxRetries; i++) {
+        Response response = client.get(sb.toString(),
+          Constants.MIMETYPE_PROTOBUF);
+        int code = response.getCode();
+        switch (code) {
+        case 200:
+          CellSetModel model = new CellSetModel();
+          model.getObjectFromMessage(response.getBody());
+          return buildResultFromModel(model);
+        case 204:
+        case 206:
+          return null;
+        case 509:
+          try {
+            Thread.sleep(sleepTime);
+          } catch (InterruptedException e) { }
+          break;
+        default:
+          throw new IOException("scanner.next request failed with " + code);
+        }
+      }
+      throw new IOException("scanner.next request timed out");
+    }
+
+    @Override
+    public Result next() throws IOException {
+      Result[] results = next(1);
+      if (results == null || results.length < 1) {
+        return null;
+      }
+      return results[0];
+    }
+    
+    class Iter implements Iterator<Result> {
+
+      Result cache;
+
+      public Iter() {
+        try {
+          cache = Scanner.this.next();
+        } catch (IOException e) {
+          LOG.warn(StringUtils.stringifyException(e));
+        }
+      }
+
+      @Override
+      public boolean hasNext() {
+        return cache != null;
+      }
+
+      @Override
+      public Result next() {
+        Result result = cache;
+        try {
+          cache = Scanner.this.next();
+        } catch (IOException e) {
+          LOG.warn(StringUtils.stringifyException(e));
+          cache = null;
+        }
+        return result;
+      }
+
+      @Override
+      public void remove() {
+        throw new RuntimeException("remove() not supported");
+      }
+      
+    }
+
+    @Override
+    public Iterator<Result> iterator() {
+      return new Iter();
+    }
+
+    @Override
+    public void close() {
+      try {
+        client.delete(uri);
+      } catch (IOException e) {
+        LOG.warn(StringUtils.stringifyException(e));
+      }
+    }
+
+  }
+
+  public ResultScanner getScanner(Scan scan) throws IOException {
+    return new Scanner(scan);
+  }
+
+  public ResultScanner getScanner(byte[] family) throws IOException {
+    Scan scan = new Scan();
+    scan.addFamily(family);
+    return new Scanner(scan);
+  }
+
+  public ResultScanner getScanner(byte[] family, byte[] qualifier)
+      throws IOException {
+    Scan scan = new Scan();
+    scan.addColumn(family, qualifier);
+    return new Scanner(scan);
+  }
+
+  public boolean isAutoFlush() {
+    return true;
+  }
+
+  public Result getRowOrBefore(byte[] row, byte[] family) throws IOException {
+    throw new IOException("getRowOrBefore not supported");
+  }
+
+  public RowLock lockRow(byte[] row) throws IOException {
+    throw new IOException("lockRow not implemented");
+  }
+
+  public void unlockRow(RowLock rl) throws IOException {
+    throw new IOException("unlockRow not implemented");
+  }
+
+  public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
+      byte[] value, Put put) throws IOException {
+    throw new IOException("checkAndPut not supported");
+  }
+
+  public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
+      long amount) throws IOException {
+    throw new IOException("incrementColumnValue not supported");
+  }
+
+  public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
+      long amount, boolean writeToWAL) throws IOException {
+    throw new IOException("incrementColumnValue not supported");
+  }
+
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/CellModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/CellModel.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/CellModel.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/CellModel.java Fri Apr  9 02:10:02 2010
@@ -29,8 +29,10 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlValue;
 
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.stargate.ProtobufMessageHandler;
 import org.apache.hadoop.hbase.stargate.protobuf.generated.CellMessage.Cell;
+import org.apache.hadoop.hbase.util.Bytes;
 
 import com.google.protobuf.ByteString;
 
@@ -79,6 +81,24 @@ public class CellModel implements Protob
   /**
    * Constructor
    * @param column
+   * @param qualifier
+   * @param value
+   */
+  public CellModel(byte[] column, byte[] qualifier, byte[] value) {
+    this(column, qualifier, HConstants.LATEST_TIMESTAMP, value);
+  }
+
+  /**
+   * Constructor from KeyValue
+   * @param kv
+   */
+  public CellModel(KeyValue kv) {
+    this(kv.getFamily(), kv.getQualifier(), kv.getTimestamp(), kv.getValue());
+  }
+
+  /**
+   * Constructor
+   * @param column
    * @param timestamp
    * @param value
    */
@@ -87,6 +107,21 @@ public class CellModel implements Protob
     this.timestamp = timestamp;
     this.value = value;
   }
+
+  /**
+   * Constructor
+   * @param column
+   * @param qualifier
+   * @param timestamp
+   * @param value
+   */
+  public CellModel(byte[] column, byte[] qualifier, long timestamp,
+      byte[] value) {
+    this.column = Bytes.add(column, KeyValue.COLUMN_FAMILY_DELIM_ARRAY,
+      qualifier);
+    this.timestamp = timestamp;
+    this.value = value;
+  }
   
   /**
    * @return the column

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd Fri Apr  9 02:10:02 2010
@@ -1,3 +1,23 @@
+<!--
+  Copyright 2010 The Apache Software Foundation
+ 
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
 <?xml version="1.0" encoding="UTF-8"?>
 <schema targetNamespace="ModelSchema" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="ModelSchema">
 

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java Fri Apr  9 02:10:02 2010
@@ -110,11 +110,11 @@ public class ScannerModel implements Pro
   private byte[] startRow = HConstants.EMPTY_START_ROW;
   private byte[] endRow = HConstants.EMPTY_END_ROW;;
   private List<byte[]> columns = new ArrayList<byte[]>();
-  private int batch = 1;
+  private int batch = Integer.MAX_VALUE;
   private long startTime = 0;
   private long endTime = Long.MAX_VALUE;
-  private String filter;
-  private int maxVersions = 1;
+  private String filter = null;
+  private int maxVersions = Integer.MAX_VALUE;
 
   /**
    * @param o the JSONObject under construction
@@ -346,8 +346,14 @@ public class ScannerModel implements Pro
     }
     model.setStartTime(scan.getTimeRange().getMin());
     model.setEndTime(scan.getTimeRange().getMax());
-    model.setBatch(scan.getCaching());
-    model.setMaxVersions(scan.getMaxVersions());
+    int caching = scan.getCaching();
+    if (caching > 0) {
+      model.setBatch(caching);
+    }
+    int maxVersions = scan.getMaxVersions();
+    if (maxVersions > 0) {
+      model.setMaxVersions(maxVersions);
+    }
     Filter filter = scan.getFilter();
     if (filter != null) {
       model.setFilter(stringifyFilter(new JSONStringer(), filter).toString());

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableRegionModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableRegionModel.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableRegionModel.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableRegionModel.java Fri Apr  9 02:10:02 2010
@@ -65,6 +65,18 @@ public class TableRegionModel implements
    * @param id the encoded id of the region
    * @param startKey the start key of the region
    * @param endKey the end key of the region
+   */
+  public TableRegionModel(String table, long id, byte[] startKey,
+      byte[] endKey) {
+    this(table, id, startKey, endKey, null);
+  }
+
+  /**
+   * Constructor
+   * @param table the table name
+   * @param id the encoded id of the region
+   * @param startKey the start key of the region
+   * @param endKey the end key of the region
    * @param location the name and port of the region server hosting the region
    */
   public TableRegionModel(String table, long id, byte[] startKey,
@@ -173,8 +185,10 @@ public class TableRegionModel implements
     sb.append(Bytes.toString(startKey));
     sb.append("'\n  endKey='");
     sb.append(Bytes.toString(endKey));
-    sb.append("'\n  location='");
-    sb.append(location);
+    if (location != null) {
+      sb.append("'\n  location='");
+      sb.append(location);
+    }
     sb.append("'\n]\n");
     return sb.toString();
   }

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableSchemaModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableSchemaModel.java?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableSchemaModel.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/TableSchemaModel.java Fri Apr  9 02:10:02 2010
@@ -38,9 +38,11 @@ import javax.xml.namespace.QName;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.stargate.ProtobufMessageHandler;
 import org.apache.hadoop.hbase.stargate.protobuf.generated.ColumnSchemaMessage.ColumnSchema;
 import org.apache.hadoop.hbase.stargate.protobuf.generated.TableSchemaMessage.TableSchema;
+import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * A representation of HBase table descriptors.
@@ -78,6 +80,29 @@ public class TableSchemaModel implements
   public TableSchemaModel() {}
 
   /**
+   * Constructor
+   * @param htd the table descriptor
+   */
+  public TableSchemaModel(HTableDescriptor htd) {
+    setName(htd.getNameAsString());
+    for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
+        htd.getValues().entrySet()) {
+      addAttribute(Bytes.toString(e.getKey().get()), 
+        Bytes.toString(e.getValue().get()));
+    }
+    for (HColumnDescriptor hcd: htd.getFamilies()) {
+      ColumnSchemaModel columnModel = new ColumnSchemaModel();
+      columnModel.setName(hcd.getNameAsString());
+      for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
+          hcd.getValues().entrySet()) {
+        columnModel.addAttribute(Bytes.toString(e.getKey().get()), 
+            Bytes.toString(e.getValue().get()));
+      }
+      addColumnFamily(columnModel);
+    }
+  }
+
+  /**
    * Add an attribute to the table descriptor
    * @param name attribute name
    * @param value attribute value
@@ -308,4 +333,23 @@ public class TableSchemaModel implements
     }
     return this;
   }
+
+  /**
+   * @return a table descriptor
+   */
+  public HTableDescriptor getTableDescriptor() {
+    HTableDescriptor htd = new HTableDescriptor(getName());
+    for (Map.Entry<QName, Object> e: getAny().entrySet()) {
+      htd.setValue(e.getKey().getLocalPart(), e.getValue().toString());
+    }
+    for (ColumnSchemaModel column: getColumns()) {
+      HColumnDescriptor hcd = new HColumnDescriptor(column.getName());
+      for (Map.Entry<QName, Object> e: column.getAny().entrySet()) {
+        hcd.setValue(e.getKey().getLocalPart(), e.getValue().toString());
+      }
+      htd.addFamily(hcd);
+    }
+    return htd;
+  }
+
 }

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,26 +1,26 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message Cell {
-  optional bytes row = 1;       // unused if Cell is in a CellSet
-  optional bytes column = 2;
-  optional int64 timestamp = 3;
-  optional bytes data = 4;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message Cell {
+  optional bytes row = 1;       // unused if Cell is in a CellSet
+  optional bytes column = 2;
+  optional int64 timestamp = 3;
+  optional bytes data = 4;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellSetMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellSetMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellSetMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/CellSetMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,29 +1,29 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import "CellMessage.proto";
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message CellSet {
-  message Row {
-    required bytes key = 1;
-    repeated Cell values = 2;
-  }
-  repeated Row rows = 1;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import "CellMessage.proto";
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message CellSet {
+  message Row {
+    required bytes key = 1;
+    repeated Cell values = 2;
+  }
+  repeated Row rows = 1;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ColumnSchemaMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ColumnSchemaMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ColumnSchemaMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ColumnSchemaMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,32 +1,32 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message ColumnSchema {
-  optional string name = 1;
-  message Attribute {
-    required string name = 1;
-    required string value = 2;
-  }
-  repeated Attribute attrs = 2;
-  // optional helpful encodings of commonly used attributes
-  optional int32 ttl = 3;
-  optional int32 maxVersions = 4;
-  optional string compression = 5;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message ColumnSchema {
+  optional string name = 1;
+  message Attribute {
+    required string name = 1;
+    required string value = 2;
+  }
+  repeated Attribute attrs = 2;
+  // optional helpful encodings of commonly used attributes
+  optional int32 ttl = 3;
+  optional int32 maxVersions = 4;
+  optional string compression = 5;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ScannerMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ScannerMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ScannerMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/ScannerMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,30 +1,30 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message Scanner {
-  optional bytes startRow = 1;
-  optional bytes endRow = 2;
-  repeated bytes columns = 3;
-  optional int32 batch = 4;
-  optional int64 startTime = 5;
-  optional int64 endTime = 6;
-  optional int32 maxVersions = 7;
-  optional string filter = 8;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message Scanner {
+  optional bytes startRow = 1;
+  optional bytes endRow = 2;
+  repeated bytes columns = 3;
+  optional int32 batch = 4;
+  optional int64 startTime = 5;
+  optional int64 endTime = 6;
+  optional int32 maxVersions = 7;
+  optional string filter = 8;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/StorageClusterStatusMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/StorageClusterStatusMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/StorageClusterStatusMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/StorageClusterStatusMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,45 +1,45 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message StorageClusterStatus {
-  message Region {
-    required bytes name = 1;
-    optional int32 stores = 2;
-    optional int32 storefiles = 3;
-    optional int32 storefileSizeMB = 4;
-    optional int32 memstoreSizeMB = 5;
-    optional int32 storefileIndexSizeMB = 6;
-  }
-  message Node {
-    required string name = 1;    // name:port
-    optional int64 startCode = 2;
-    optional int32 requests = 3;
-    optional int32 heapSizeMB = 4;
-    optional int32 maxHeapSizeMB = 5;
-    repeated Region regions = 6;
-  }
-  // node status
-  repeated Node liveNodes = 1;
-  repeated string deadNodes = 2;
-  // summary statistics
-  optional int32 regions = 3; 
-  optional int32 requests = 4; 
-  optional double averageLoad = 5;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message StorageClusterStatus {
+  message Region {
+    required bytes name = 1;
+    optional int32 stores = 2;
+    optional int32 storefiles = 3;
+    optional int32 storefileSizeMB = 4;
+    optional int32 memstoreSizeMB = 5;
+    optional int32 storefileIndexSizeMB = 6;
+  }
+  message Node {
+    required string name = 1;    // name:port
+    optional int64 startCode = 2;
+    optional int32 requests = 3;
+    optional int32 heapSizeMB = 4;
+    optional int32 maxHeapSizeMB = 5;
+    repeated Region regions = 6;
+  }
+  // node status
+  repeated Node liveNodes = 1;
+  repeated string deadNodes = 2;
+  // summary statistics
+  optional int32 regions = 3; 
+  optional int32 requests = 4; 
+  optional double averageLoad = 5;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableInfoMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableInfoMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableInfoMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableInfoMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,31 +1,31 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message TableInfo {
-  required string name = 1;
-  message Region {
-    required string name = 1;
-    optional bytes startKey = 2;
-    optional bytes endKey = 3;
-    optional int64 id = 4;
-    optional string location = 5;
-  }
-  repeated Region regions = 2;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message TableInfo {
+  required string name = 1;
+  message Region {
+    required string name = 1;
+    optional bytes startKey = 2;
+    optional bytes endKey = 3;
+    optional int64 id = 4;
+    optional string location = 5;
+  }
+  repeated Region regions = 2;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableSchemaMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableSchemaMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableSchemaMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/TableSchemaMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,34 +1,34 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import "ColumnSchemaMessage.proto";
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message TableSchema {
-  optional string name = 1;
-  message Attribute {
-    required string name = 1;
-    required string value = 2;
-  }  
-  repeated Attribute attrs = 2;
-  repeated ColumnSchema columns = 3;
-  // optional helpful encodings of commonly used attributes
-  optional bool inMemory = 4;
-  optional bool readOnly = 5;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import "ColumnSchemaMessage.proto";
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message TableSchema {
+  optional string name = 1;
+  message Attribute {
+    required string name = 1;
+    required string value = 2;
+  }  
+  repeated Attribute attrs = 2;
+  repeated ColumnSchema columns = 3;
+  // optional helpful encodings of commonly used attributes
+  optional bool inMemory = 4;
+  optional bool readOnly = 5;
+}

Modified: hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/VersionMessage.proto
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/VersionMessage.proto?rev=932214&r1=932213&r2=932214&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/VersionMessage.proto (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/protobuf/VersionMessage.proto Fri Apr  9 02:10:02 2010
@@ -1,27 +1,27 @@
-// Copyright 2010 The Apache Software Foundation
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.hadoop.hbase.stargate.protobuf.generated;
-
-message Version {
-  optional string stargateVersion = 1;
-  optional string jvmVersion = 2;
-  optional string osVersion = 3;
-  optional string serverVersion = 4;
-  optional string jerseyVersion = 5;
-}
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hadoop.hbase.stargate.protobuf.generated;
+
+message Version {
+  optional string stargateVersion = 1;
+  optional string jvmVersion = 2;
+  optional string osVersion = 3;
+  optional string serverVersion = 4;
+  optional string jerseyVersion = 5;
+}