[ 
https://issues.apache.org/jira/browse/ACCUMULO-1399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13663158#comment-13663158
 ] 

Eric Newton edited comment on ACCUMULO-1399 at 5/21/13 7:57 PM:
----------------------------------------------------------------

And copy jython.jar into the lib directory, and you can write this:

{noformat}
import org.apache.accumulo.core.Constants as Constants
import org.apache.accumulo.core.data.Mutation as Mutation
import org.apache.accumulo.core.data.Value as Value
import org.apache.hadoop.io.Text as Text
import org.apache.accumulo.core.client.BatchWriterConfig as BatchWriterConfig
connection.tableOperations().create('foo')
bs = connection.createBatchWriter('foo', BatchWriterConfig())
m = Mutation(Text('foo'))
m.put("cf", "cq", Value("foo"))
bs.addMutation(m)
bs.close()
for kv in connection.createScanner('foo', Constants.NO_AUTHS):
   print kv
{noformat}

Run it like this:
{noformat}
$ ./bin/accumulo shell --fake -u root -p '' -e 'script -e python -f test.py'
{noformat}
                
      was (Author: ecn):
    And copy jython.jar into the lib directory, and you can write this:

{noformat}
import org.apache.accumulo.core.Constants as Constants
import org.apache.accumulo.core.data.Mutation as Mutation
import org.apache.accumulo.core.data.Mutation as Mutation
import org.apache.accumulo.core.data.Value as Value
import org.apache.hadoop.io.Text as Text
import org.apache.accumulo.core.client.BatchWriterConfig as BatchWriterConfig
connection.tableOperations().create('foo')
bs = connection.createBatchWriter('foo', BatchWriterConfig())
m = Mutation(Text('foo'))
m.put("cf", "cq", Value("foo"))
bs.addMutation(m)
bs.close()
for kv in connection.createScanner('foo', Constants.NO_AUTHS):
   print kv
{noformat}

Run it like this:
{noformat}
$ ./bin/accumulo shell --fake -u root -p '' -e 'script -e python -f test.py'
{noformat}
                  
> Pluggable commands for the shell
> --------------------------------
>
>                 Key: ACCUMULO-1399
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-1399
>             Project: Accumulo
>          Issue Type: New Feature
>          Components: shell
>            Reporter: Dave Marion
>            Assignee: Dave Marion
>            Priority: Minor
>             Fix For: 1.6.0
>
>         Attachments: ACCUMULO-1399-1.patch, ACCUMULO-1399-2.patch
>
>
> Proposing modification to the Shell to allow applications to create their own 
> set of commands. This might be accomplished using java.util.ServiceLoader or 
> something like it. Specifically, I'm thinking of a case where I have a create 
> table command that is different than the one provided by the Shell. In my 
> case, my create table command may create one or more tables and setup 
> iterators on them.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to