本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.TableListModel类的典型用法代码示例。如果您正苦于以下问题:Java TableListModel类的具体用法?Java TableListModel怎么用?Java TableListModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableListModel类属于org.apache.hadoop.hbase.rest.model包,在下文中一共展示了TableListModel类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpBeforeClass
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
TEST_UTIL.startMiniCluster();
REST_TEST_UTIL.startServletContainer(conf);
client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort()));
testNamespacesInstanceModel = new TestNamespacesInstanceModel();
context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class);
jsonMapper = new JacksonProvider()
.locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE);
NAMESPACE1_PROPS.put("key1", "value1");
NAMESPACE2_PROPS.put("key2a", "value2a");
NAMESPACE2_PROPS.put("key2b", "value2b");
NAMESPACE3_PROPS.put("key3", "value3");
NAMESPACE4_PROPS.put("key4a", "value4a");
NAMESPACE4_PROPS.put("key4b", "value4b");
}
示例2: setUpBeforeClass
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
TEST_UTIL.startMiniCluster();
REST_TEST_UTIL.startServletContainer(conf);
client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort()));
testNamespacesInstanceModel = new TestNamespacesInstanceModel();
context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class);
jsonMapper = new JacksonJaxbJsonProvider()
.locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE);
NAMESPACE1_PROPS.put("key1", "value1");
NAMESPACE2_PROPS.put("key2a", "value2a");
NAMESPACE2_PROPS.put("key2b", "value2b");
NAMESPACE3_PROPS.put("key3", "value3");
NAMESPACE4_PROPS.put("key4a", "value4a");
NAMESPACE4_PROPS.put("key4b", "value4b");
}
示例3: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
/**
* @return string representing the cluster's version
* @throws IOException
* if the endpoint does not exist, there is a timeout, or some other
* general failure mode
*/
public TableListModel getTableList() throws IOException {
StringBuilder path = new StringBuilder();
path.append('/');
if (accessToken != null) {
path.append(accessToken);
path.append('/');
}
int code = 0;
for (int i = 0; i < maxRetries; i++) {
// Response response = client.get(path.toString(),
// Constants.MIMETYPE_XML);
Response response = client.get(path.toString(),
Constants.MIMETYPE_PROTOBUF);
code = response.getCode();
switch (code) {
case 200:
TableListModel t = new TableListModel();
return (TableListModel) t.getObjectFromMessage(response.getBody());
case 404:
throw new IOException("Table list not found");
case 509:
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
}
break;
default:
throw new IOException("get request to " + path.toString()
+ " request returned " + code);
}
}
throw new IOException("get request to " + path.toString()
+ " request timed out");
}
示例4: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
private final TableListModel getTableList() throws IOException {
TableListModel tableList = new TableListModel();
TableName[] tableNames = servlet.getAdmin().listTableNames();
for (TableName name: tableNames) {
tableList.add(new TableModel(name.getNameAsString()));
}
return tableList;
}
示例5: checkTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
private static void checkTableList(TableListModel model) {
boolean found = false;
Iterator<TableModel> tables = model.getTables().iterator();
assertTrue(tables.hasNext());
while (tables.hasNext()) {
TableModel table = tables.next();
if (table.getName().equals(TABLE.getNameAsString())) {
found = true;
break;
}
}
assertTrue(found);
}
示例6: testTableListXML
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
@Test
public void testTableListXML() throws IOException, JAXBException {
Response response = client.get("/", Constants.MIMETYPE_XML);
assertEquals(response.getCode(), 200);
assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
TableListModel model = (TableListModel)
context.createUnmarshaller()
.unmarshal(new ByteArrayInputStream(response.getBody()));
checkTableList(model);
}
示例7: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
/**
* @return string representing the cluster's version
* @throws IOEXception
* if the endpoint does not exist, there is a timeout, or some other
* general failure mode
*/
public TableListModel getTableList() throws IOException {
StringBuilder path = new StringBuilder();
path.append('/');
if (accessToken != null) {
path.append(accessToken);
path.append('/');
}
int code = 0;
for (int i = 0; i < maxRetries; i++) {
// Response response = client.get(path.toString(),
// Constants.MIMETYPE_XML);
Response response = client.get(path.toString(),
Constants.MIMETYPE_PROTOBUF);
code = response.getCode();
switch (code) {
case 200:
TableListModel t = new TableListModel();
return (TableListModel) t.getObjectFromMessage(response.getBody());
case 404:
throw new IOException("Table list not found");
case 509:
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
}
break;
default:
throw new IOException("get request to " + path.toString()
+ " request returned " + code);
}
}
throw new IOException("get request to " + path.toString()
+ " request timed out");
}
示例8: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
private final TableListModel getTableList() throws IOException {
TableListModel tableList = new TableListModel();
String[] tableNames = servlet.getAdmin().getTableNames();
for (String name: tableNames) {
tableList.add(new TableModel(name));
}
return tableList;
}
示例9: checkTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
private static void checkTableList(TableListModel model) {
boolean found = false;
Iterator<TableModel> tables = model.getTables().iterator();
assertTrue(tables.hasNext());
while (tables.hasNext()) {
TableModel table = tables.next();
if (table.getName().equals(TABLE)) {
found = true;
break;
}
}
assertTrue(found);
}
示例10: testTableListXML
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
@Test
public void testTableListXML() throws IOException, JAXBException {
Response response = client.get("/", Constants.MIMETYPE_XML);
assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
TableListModel model = (TableListModel)
context.createUnmarshaller()
.unmarshal(new ByteArrayInputStream(response.getBody()));
checkTableList(model);
}
示例11: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
private final TableListModel getTableList() throws IOException {
TableListModel tableList = new TableListModel();
HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
HTableDescriptor[] list = admin.listTables();
for (HTableDescriptor htd: list) {
tableList.add(new TableModel(htd.getNameAsString()));
}
return tableList;
}
示例12: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
/**
* @return string representing the cluster's version
* @throws IOEXception
* if the endpoint does not exist, there is a timeout, or some other
* general failure mode
*/
public TableListModel getTableList() throws IOException {
StringBuilder path = new StringBuilder();
path.append('/');
if (accessToken != null) {
path.append(accessToken);
path.append('/');
}
int code = 0;
for (int i = 0; i < maxRetries; i++) {
// Response response = client.get(path.toString(),
// Constants.MIMETYPE_XML);
Response response = client.get(path.toString(),
Constants.MIMETYPE_PROTOBUF);
code = response.getCode();
switch (code) {
case 200:
TableListModel t = new TableListModel();
return (TableListModel) t.getObjectFromMessage(response.getBody());
case 404:
throw new IOException("Table list not found");
case 509:
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
}
break;
default:
throw new IOException("get request to " + path.toString()
+ " request returned " + code);
}
}
throw new IOException("get request to " + path.toString()
+ " request timed out");
}
示例13: getTableList
import org.apache.hadoop.hbase.rest.model.TableListModel; //导入依赖的package包/类
private final TableListModel getTableList() throws IOException {
TableListModel tableList = new TableListModel();
HTableDescriptor[] list = servlet.getAdmin().listTables();
for (HTableDescriptor htd: list) {
tableList.add(new TableModel(htd.getNameAsString()));
}
return tableList;
}