View Javadoc

1   /*
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package org.apache.hadoop.hbase.rest;
22  
23  import java.io.IOException;
24  
25  import javax.ws.rs.Path;
26  import javax.ws.rs.PathParam;
27  import javax.ws.rs.QueryParam;
28  
29  public class TableResource extends ResourceBase {
30  
31    String table;
32  
33    /**
34     * Constructor
35     * @param table
36     * @throws IOException
37     */
38    public TableResource(String table) throws IOException {
39      super();
40      this.table = table;
41    }
42  
43    @Path("exists")
44    public ExistsResource getExistsResource() throws IOException {
45      return new ExistsResource(table);
46    }
47  
48    @Path("regions")
49    public RegionsResource getRegionsResource() throws IOException {
50      return new RegionsResource(table);
51    }
52  
53    @Path("scanner")
54    public ScannerResource getScannerResource() throws IOException {
55      return new ScannerResource(table);
56    }
57  
58    @Path("schema")
59    public SchemaResource getSchemaResource() throws IOException {
60      return new SchemaResource(table);
61    }
62  
63    @Path("{rowspec: .+}")
64    public RowResource getRowResource(
65        final @PathParam("rowspec") String rowspec,
66        final @QueryParam("v") String versions) throws IOException {
67      return new RowResource(table, rowspec, versions);
68    }
69  }