Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Accumulo >> mail # user >> Setting authorizations in code


+
Benjamin Parrish 2013-09-23, 13:24
+
Eric Newton 2013-09-23, 16:06
+
Josh Elser 2013-09-23, 16:22
+
Benjamin Parrish 2013-09-23, 16:28
+
Michael Wall 2013-09-23, 18:46
+
Benjamin Parrish 2013-09-23, 19:34
Copy link to this message
-
Re: Setting authorizations in code
When you say "GORM", are you talking about Apache GORA? If so, see
https://github.com/medined/gora-with-accumulo for a few examples. Nothing
very elaborate, I'm afraid.
On Mon, Sep 23, 2013 at 3:34 PM, Benjamin Parrish <
[EMAIL PROTECTED]> wrote:

> yeah, I think I found the error when trying to add a Range to the Scanner
> object when doing 'Plate plate = new Plate(Plate.getMap(rowId, scanner));'
>  I modified the Scanner in the getMap() method, but the data wasn't
> persisting correctly.
>
> Side question.  Has anyone started a helper library or GORM for Accumulo?
>
> On Sep 23, 2013, at 2:46 PM, Michael Wall <[EMAIL PROTECTED]> wrote:
>
> > Without seeing all your code, I notice that both setAuthorizations and
> > getScanner return null.  Are you sure whatever _db is in the filter
> > method is getting setup as you expect?
> >
> > On Mon, Sep 23, 2013 at 12:28 PM, Benjamin Parrish
> > <[EMAIL PROTECTED]> wrote:
> >> This is on a stand-alone instance.  Stepping through the code I can see
> that
> >> it is getting the correct Authorizations from getAuthorizations() method
> >> that I have, and it propagates to the Scanner object, but the Scanner
> object
> >> is not pulling in the data associated with that column visibility.  I
> can
> >> run a setauths on the shell and see all the data with the same
> >> Authorization.
> >>
> >> On Sep 23, 2013, at 12:06 PM, Eric Newton <[EMAIL PROTECTED]>
> wrote:
> >>
> >> Authorizations, like all settings, take a moment to propagate to all
> >> servers.
> >>
> >> -Eric
> >>
> >>
> >>
> >> On Mon, Sep 23, 2013 at 9:24 AM, Benjamin Parrish
> >> <[EMAIL PROTECTED]> wrote:
> >>>
> >>> I am trying to set authorizations in code, but the scanner is always
> >>> returning the previous fetch of data using the previous
> authorizations.  I
> >>> am setting the Authorizations on the Connector, and then I get a new
> Scanner
> >>> after setting the Authorizations.
> >>>
> >>> public Authorizations setAuthorizations(SecurityGroup[]
> authorizations) {
> >>> List<byte[]> authorizationList = new ArrayList<byte[]>();
> >>>
> >>> for (SecurityGroup auth : authorizations) {
> >>> String groupString = Security.getName(auth);
> >>>
> >>> byte[] groupBytes = groupString.getBytes();
> >>>
> >>> authorizationList.add(groupBytes);
> >>> }
> >>>
> >>> Authorizations auths = new Authorizations(authorizationList);
> >>>
> >>> try {
> >>> connector.securityOperations().changeUserAuthorizations(_loggedInUser,
> >>> auths);
> >>>
> >>> return auths;
> >>> } catch (AccumuloException e) {
> >>> // TODO Auto-generated catch block
> >>> e.printStackTrace();
> >>> } catch (AccumuloSecurityException e) {
> >>> // TODO Auto-generated catch block
> >>> e.printStackTrace();
> >>> }
> >>>
> >>> return null;
> >>> }
> >>>
> >>> public Scanner getScanner() {
> >>>        try {
> >>>        Authorizations auths = this.getAuthorizations();
> >>>
> >>> return connector.createScanner(TABLE, auths);
> >>> } catch (TableNotFoundException e) {
> >>> // TODO Auto-generated catch block
> >>> e.printStackTrace();
> >>> }
> >>>
> >>>        return null;
> >>> }
> >>>
> >>> @Override
> >>> public Collection<Plate> filter(SecurityGroup[] authorizations, String
> >>> regEx) {
> >>> _db.setAuthorizations(authorizations);
> >>>
> >>> Scanner scanner = _db.getScanner();
> >>>
> >>> String valueRegex = (regEx.equals("")) ? ".*" : regEx + ".*";
> >>>
> >>> scanner.fetchColumn(Plate.COLUMN_FAMILY, new
> Text(Plate.PLATE_QUALIFIER));
> >>>
> >>> IteratorSetting iter = new IteratorSetting(1, "regexfilter",
> >>> RegExFilter.class);
> >>>
> >>>        iter.addOption(RegExFilter.VALUE_REGEX, valueRegex);
> >>>
> >>>        scanner.addScanIterator(iter);
> >>>
> >>> Iterator<Entry<Key, Value>> it = scanner.iterator();
> >>>
> >>> Map<Text, Plate> map = new HashMap<Text, Plate>();
> >>>
> >>>    while (it.hasNext()) {
> >>>    Entry<Key,Value> entry = it.next();
> >>>
> >>>    Text rowId = entry.getKey().getRow();
> >
+
Benjamin Parrish 2013-09-24, 01:28
+
Josh Elser 2013-09-23, 14:37
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB