Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] Request to make Grouper API easier to work with from scripting REPLs

Subject: Grouper Developers Forum

List archive

[grouper-dev] Request to make Grouper API easier to work with from scripting REPLs


Chronological Thread 
  • From: "Waldbieser, Carl" <>
  • To:
  • Subject: [grouper-dev] Request to make Grouper API easier to work with from scripting REPLs
  • Date: Fri, 6 May 2016 12:14:31 -0400 (EDT)


I have a request related to Bill Thompson's "Groovy Shell For Grouper" aka
"Grouper Shell Wrappers" project [1].
This project basically uses Java-based scripting environments to import parts
of the Grouper API. These
environments have their own REPLs with readline, history, tab-complete, help,
etc. Each language has its own
pros and cons, and it is a way to engage more people with the project who
don't have a strong Java background.

I did the programming for the Jython and Clojure wrappers, and one thing that
I was reminded of recently was
that it was not particularly straightforward to pull the existing Grouper
Shell functions into these environments
because of the way they were implemented in the main Grouper code base.

To pick on a function at random, take `obliterateStem`. In an ideal world, I
could just do the following to
import the function into a Jython REPL session:

>>> from edu.internet2.middleware.grouper.app.gsh import obliterateStem
>>> obliterateStem(session, stem="path:to:stem", testOnly=False,
>>> deleteFromPointInTime=False)

But in practice this doesn't work because
`edu.internet2.middleware.grouper.app.gsh.obliterateStem`
is not a static function I can import-- it is a class that requires me to
pass in an interpreter, a
call stack, etc. to its `invoke` method.

So I end up emulating the guts of the class in my scripted function
definitions.

This is workable, but it would be nice if there were some "pure functions"
that could be imported
into scripting environments that didn't require the GSH specific arguments.

Any guidance or help the Grouper project could provide in this direction
would be great!

Thanks,
Carl Waldbieser
ITS Systems Programmer
Lafayette College


[1] https://github.com/wgthom/groovysh4grouper



Archive powered by MHonArc 2.6.16.

Top of Page