accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Drob <mad...@cloudera.com>
Subject Re: Using Java7, fetch instance name or uuid WITHOUT Connector class?
Date Tue, 28 Jan 2014 20:17:42 GMT
Tangential note - In Java 7, I thought that Swing was deprecated in favour
of JavaFX[1][2]?

[1]: http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html
[2]: http://docs.oracle.com/javafx/2/swing/jfxpub-swing.htm


On Tue, Jan 28, 2014 at 1:59 PM, Ott, Charles H.
<CHARLES.H.OTT@leidos.com>wrote:

> 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.
>
>
>
> *From:* user-return-3667-CHARLES.H.OTT=leidos.com@accumulo.apache.org[mailto:
> user-return-3667-CHARLES.H.OTT=leidos.com@accumulo.apache.org] *On Behalf
> Of *Keith Turner
> *Sent:* Tuesday, January 28, 2014 1:41 PM
> *To:* user@accumulo.apache.org
> *Subject:* Re: Using Java7, fetch instance name or uuid WITHOUT Connector
> class?
>
>
>
>
>
>
>
> On Tue, Jan 28, 2014 at 12:26 PM, Ott, Charles H. <
> CHARLES.H.OTT@leidos.com> wrote:
>
> I am making a more user friendly (Swing) tool for performing
> import/exports of table data via hadoop.io.sequencefile. (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");
>             }
>             jEditorPane1.setText(results);
>         } catch (Exception err) {
>             err.printStackTrace();
>         }
>     }
>
> Then I create a ZooKeeperInstance, and call the 'getConnector' method to
> get a connector used for scanning:
>         try {
>             connector = zooInstance.getConnector(username,
> password.getBytes());
>             getUserAuths();
>         } catch (Exception err) {
>             err.printStackTrace();
>         }
>
> Since, I now have the connector, I can get the 'user' Authorizations class
> for the export tool's client.Scanner:
>
>         this.authorizations =
> connector.securityOperations().getUserAuthorizations(username);
>
> 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:
>
> <div
> id='subheader'>Instance&nbsp;Name:&nbsp;gm&nbsp;&nbsp;&nbsp;Version:&nbsp;1.5.0
> <br><span
> class='smalltext'>Instance&nbsp;ID:&nbsp;a85286bf-031c-4e24-9b47-f6aca34401b8</span>
> <br><span
> class='smalltext'>Tue&nbsp;Jan&nbsp;28&nbsp;12:15:41&nbsp;EST&nbsp;2014</span></div>
> </div>
>
> 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
> monitor.
>
>
>
>
>
>
> Thanks in advance to anyone who read this far!
>
>
>

Mime
View raw message