First of all, awesome work Justin!

I took the python module for a test drive today, and after getting it
to build and pass the tests in eclipse, I wanted to play with it on a
real python shell.

Here is the journey's log:

Destination
========

What I want to do is create a geoserver-admin.py command similar to
django-admin.py to be able to quickly call actions script or shells.

geoserver-admin.py createuser bob

geoserver-admin.py addshapefile myshapefile.shp --workspace sf

geoserver-admin.py runscript mystuff.py

geoserver-admin.py shell
>>> from geoserver import catalog
>>> if "sf" in catalog.stores:
>>>     print catalog.stores.get("sf").size

Roadblocks
=========

Before going for a standalon script, I decided to create a maven
plugin to get access to the shell.

Started by modifying a module called maven-jython-plugin, renamed it
to maven-geoscript-plugin and did something like this:

public class JythonShellMojo extends AbstractMojo
{
    public void execute() throws MojoExecutionException, MojoFailureException
    {
        Python python = new Python(new GeoServerResourceLoader(new
File( System.getenv("GEOSERVER_DATA_DIR"))));
        String path =  python.getLibRoot().getCanonicalPath();
        Py.getSystemState().path.insert(0, new PyString( path ));
        jython.main(new String[]{});
    }
}

Then enabled the plugin in the python community module and ran:

mvn geoscript:shell

but got the following error:

SEVERE: Extension lokup occured, but ApplicationContext is unset [1]

So my question is: "is it possible to get Geoserver up with just
GEOSERVER_DATA_DIR and GEOSERVER_HOME set, without using jetty or
tomcat?" I have the feeling that code similar to the one used in the
Test Suite could be used to enable this, but would like to hear
thoughts on it.

Conclusion
========

In any case, the new Python community module made my day, and I'm
looking forward to help bringing it to extension status.

Ariel.

[1] http://img.skitch.com/20100217-e98c6yj4f9j6eswykg7k33jpjg.png

--
Ariel Núñez // GeoSolutions S.A.S

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to