accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ott, Charles H." <>
Subject RE: Using Java7, fetch instance name or uuid WITHOUT Connector class?
Date Tue, 28 Jan 2014 18:59:07 GMT
That'll work.  I'm already prompting the user to enter the zookeeper
host when adding the 'server' to the tool, so I'll just add a field to
support the instance name as well.  Thanks.


On Behalf Of Keith Turner
Sent: Tuesday, January 28, 2014 1:41 PM
Subject: Re: Using Java7, fetch instance name or uuid WITHOUT Connector




On Tue, Jan 28, 2014 at 12:26 PM, Ott, Charles H.
<> wrote:

I am making a more user friendly (Swing) tool for performing
import/exports of table data via (Currently
using Accumulo 1.5.0 w/ cdh4u5)

The first thing I do is load a list of tables into a swing component
using the http://monitorURL/xml URL and JAXB:

    private void loadTables() {
        try {
            jaxbContext = JAXBContext.newInstance(Stats.class);
            jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            jaxbMarshaller = jaxbContext.createMarshaller();

            Stats stats = (Stats) jaxbUnmarshaller.unmarshal(
                    new URL("http://"
                            + associatedHost.getHostname()
                            + ":"
                            + associatedHost.getUi_port()
                            + "/xml"));
            String results = new String();
            for (Table t : stats.getTables().getTable()) {
                results = results.concat(t.getTablename() + "\r\n");
        } catch (Exception err) {

Then I create a ZooKeeperInstance, and call the 'getConnector' method to
get a connector used for scanning:
        try {
            connector = zooInstance.getConnector(username,
        } catch (Exception err) {

Since, I now have the connector, I can get the 'user' Authorizations
class for the export tool's client.Scanner:

        this.authorizations =

The part I am not sure how to do is automatically determine the
'instance name' or 'instance uuid' when constructing the
ZooKeeperInstance.  I can see both strings displayed on the header of
the Accumulo Monitor:


But I do not see any 'clean' way to retrieve it using the Java API,
without doing a parse of the monitor's HTML.  Which feels dirty.

This leaves me with one option, for the user to specify the instance
name before clicking 'Export Tables'.  Which I think is a bit silly
considering the user has already entered and saved the MonitorURL,
dbUsername and dbPassword within the tool.  Thoughts?


Maybe start off asking the user for the instance name and zookeepers
instead of the monitor URL.  Once you create a connector you can use
connector.tableOperations() to get a list of tables w/o accessing the



	Thanks in advance to anyone who read this far!


View raw message