Re: [CONF] Apache Sling Website: Discover Sling in 15 minutes (page edited)

2009-06-03 Thread pub cog
sure thanks

On Thu, May 28, 2009 at 11:13 PM, Mike Müller  wrote:
> Hi Benjamin
>
> Thank you for your corrections. I took it over to the Sling website.
> If you have more updates/corrections or even new documenations/examples
> feel free to contact me.
>
> best regards
> mike
>
>> -----Original Message-
>> From: pub cog [mailto:pub@gmail.com]
>> Sent: Thursday, May 28, 2009 3:53 PM
>> To: sling-dev@incubator.apache.org
>> Subject: Re: [CONF] Apache Sling Website: Discover Sling in 15 minutes
>> (page edited)
>>
>>
>> Done. You can review changes
>> http://cwiki.apache.org/confluence/display/SLING/Discover+Slin
>> g+in+15+minutes
>> ;)
>> http://cwiki.apache.org/confluence/pages/viewpreviouspageversi
> ons.action?pageId=118769
>
> Also, in http://incubator.apache.org/sling/site/architecture.html:
>
> "... Web Applications with Sling, *a an* API has been defined..."
> there is an extra "a"
> "... Web Applications with Sling, *an* API has been defined..."
>
> as I said minor ;)
>
>


Re: Geographical Datastore and Posgis integration

2009-06-03 Thread pub cog
Thanks a lot, that's exactly the information I was looking for :)

I'll dive into this and try to make a first prototype.

Thanks again :)

On Thu, May 28, 2009 at 11:52 PM, Paul Mietz Egli  wrote:
> Regarding importing KML into JCR:
>
>> If that's what you meant, I didn't thought of this, why not... I need
>> to think about it...
>> search may be easier but that means I need to make some kind of
>> automatic parsing transformation to jcr ,nodes ?
>
> Try using Session.importXML() first and see if that meets your needs:
>
> http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Session.html#importXML(java.lang.String,%20java.io.InputStream,%20int)
>
> From the javadocs:
>
> "The tree of new items is built in the transient storage of the Session. In
> order to persist the new content, save must be called. The advantage of this
> through-the-session method is that (depending on what constraint checks the
> implementation leaves until save) structures that violate node type
> constraints can be imported, fixed and then saved. The disadvantage is that
> a large import will result in a large cache of pending nodes in the session.
> See Workspace.importXML(java.lang.String, java.io.InputStream, int) for a
> version of this method that does not go through the Session."
>
>> On an architectural point of view, I thought about having a Sling
>> server and a postgis database separate.
>>  - Sling:  will actually store files and properties associated with them
>>  - Postgis: will store only a jcr path and 'geom' informations
>>  - Java: code some java component(s) (osgi bundle ?) to synchronize both
>
>
> In Postgres, I'd suggest using a UUID of the root of the KML doc instead of
> a JCR path since paths can change.  You can then use Session.getNodeByUUID()
> to look up the KML node.
>
>> Step n°1: I was thinking to use some kind of 'hook' on ressource
>> creation/update to compute the geom and store a couple
>> (path_in_jcr/geom) in postgres/postgis
>> Should I do such a hook by "Extending the SlingPostServlet" describe
>> in "Advanced Topic" (5) ?!
>
> Sounds like your KML is arriving in the body of an HTTP POST request.  You
> could extend the SlingPostServlet as described in the docs to handle
> importing the KML (e.g. by passing the servlet input stream into
> Session.importXML).  If your geometry computations take more than a few
> hundred milliseconds, you should consider doing them in a JCR EventListener
> that gets called after your nodes are created rather than in-process with
> the HTTP request.  Rough code would be:
>
>
> /**
>  * @scr.component metatype="false" enabled="true" immediate="true"
>  * @scr.service
> interface="org.apache.sling.servlets.post.SlingPostOperation"
>  * @scr.property name="sling.post.operation" value="myoperation"
>  *
>  * @author Paul Mietz Egli
>  */
> public class MyPostOperation extends AbstractSlingPostOperation {
>   �...@override
>    protected void doRun(SlingHttpServletRequest request, HtmlResponse
> response, List changes) throws RepositoryException {
>        String basepath = "/content/kml"; // TODO use @scr.property to set
> actual value
>        Session session =
> request.getResourceResolver().adaptTo(Session.class);
>        session.importXML(basepath, request.getInputStream(),
> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
>        // TODO maybe set a custom node type on the root of your KML doc that
> you can use in the event listener
>    }
> }
>
>  * @scr.component metatype="true" enabled="true" immediate="true"
>  * @scr.service interface="javax.jcr.observation.EventListener"
>  *
>  * @author Paul Mietz Egli
>  */
> public class GeometryComputationEventListener implements EventListener {
>    /**
>     * @scr.reference
>     */
>    private SlingRepository     repository;
>
>    protected void activate(ComponentContext context) {
>        try {
>            String path = "/content/kml";
>            String[] nodeTypes = new String[] { "nt:unstructured" };
>            session = repository.loginAdministrative(null);
>            ObservationManager observationManager =
> session.getWorkspace().getObservationManager();
>            observationManager.addEventListener(this, Event.NODE_ADDED, path,
> true, null, nodeTypes, false);
>        }
>        catch (RepositoryException e) {}
>    }
>
>    public void onEvent(EventIterator eventIterator) {
>        while (eventIterator.hasNext()) {
>            Event event = (Event) eventIterator.next();
>            switch (event.getType()) {
>                case Event.NODE_ADDED:
>                    // TODO test node type/location to make sure you're
> seeing the root of the KML tree
>                    // TODO pull placemarks out of KML tree and convert to
> WKT for PostGIS
>                }
>            }
>        }
>    }
> }
>
>
>
>
> p.


Re: [CONF] Apache Sling Website: Discover Sling in 15 minutes (page edited)

2009-05-28 Thread pub cog
Done. You can review changes
http://cwiki.apache.org/confluence/display/SLING/Discover+Sling+in+15+minutes
;)
http://cwiki.apache.org/confluence/pages/viewpreviouspageversions.action?pageId=118769

Also, in http://incubator.apache.org/sling/site/architecture.html:

"... Web Applications with Sling, *a an* API has been defined..."
there is an extra "a"
"... Web Applications with Sling, *an* API has been defined..."

as I said minor ;)



On Wed, May 27, 2009 at 10:43 PM, Mike Müller  wrote:
> Hi again
>
 snip snap
>> You're very welcome to contribute to the documentation.
>> I duplicated the "Discover Sling in 15 minutes" page in the public
>> wiki under [1].
>> Please put your enhancements and corrections there and let me
>> know if you have finished. I will take the new version over to
>> the Sling website after that.
>>
>
> sorry forgot the link:
> [1] 
> http://cwiki.apache.org/confluence/display/SLING/Discover+Sling+in+15+minutes
>
>> best regards
>> mike
>>
>


Re: [CONF] Apache Sling Website: Discover Sling in 15 minutes (page edited)

2009-05-28 Thread pub cog
thanks for the explanation :)

On Wed, May 27, 2009 at 6:25 PM, Alexander Klimetschek  wrote:
> On Wed, May 27, 2009 at 6:04 PM, pub cog  wrote:
>> I sneak into this thread to ask how does the official website is
>> created ? http://incubator.apache.org/sling/site/
>
> It is created by exporting a separate confluence wiki:
>
> http://cwiki.apache.org/confluence/display/SLINGxSITE
>
> Write access is restricted.
>
> This is different from the public Sling wiki at:
>
> http://cwiki.apache.org/confluence/display/SLING
>
>
>> I'd like to provide minor enhancements patches to the documentation
>> but I couldn't find it under svn ?
>> http://svn.apache.org/repos/asf/incubator/sling/trunk/site/ ?
>> http://svn.apache.org/repos/asf/incubator/sling/site/ ?
>
> Note that a cleanup of the docs is just on it's way, you might ask
> Mike Müller on how you can provide improvements for the documentation
> to him:
>
> http://markmail.org/message/7vu63i7rketgdozi
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetsc...@day.com
>


Re: Geographical Datastore and Posgis integration

2009-05-28 Thread pub cog
On Wed, May 27, 2009 at 7:45 PM, Vidar Ramdal  wrote:
>
> Just a quick thought. I don't know much about KML, but from the docs
> it looks like a fairly simple XML format.

exactly it's just xml.

> Have you considered storing the KML data as JCR nodes, and not as KML files?
> That would certainly make it easier to implement advanced search
> features, as you describe.
>

You mean instead of creating a node /path/my_file.kml and store the
content there.
creates nodes like they are in the kml, for example, if kml looks like:




...




store them as jcr node like this ?
kml
|__ Folder
|__Folder
|__ Placemark
...


If that's what you meant, I didn't thought of this, why not... I need
to think about it...
search may be easier but that means I need to make some kind of
automatic parsing transformation to jcr ,nodes ?


Re: [CONF] Apache Sling Website: Discover Sling in 15 minutes (page edited)

2009-05-27 Thread pub cog
I sneak into this thread to ask how does the official website is
created ? http://incubator.apache.org/sling/site/

I'd like to provide minor enhancements patches to the documentation
but I couldn't find it under svn ?
http://svn.apache.org/repos/asf/incubator/sling/trunk/site/ ?
http://svn.apache.org/repos/asf/incubator/sling/site/ ?

I can provide them as plain text in a Jira but I think integration job
will be easier if I can provided them as svn diff... ;)


On Wed, May 27, 2009 at 5:54 PM, Jukka Zitting  wrote:
> Hi,
>
> On Fri, Apr 24, 2009 at 8:57 AM,   wrote:
>> Reviewed 2009-09-24, this page's information is in sync with the current
>> Sling codebase.
>
> As noted by Tako Schotanus in a chat, this does seem to prove that
> Sling's really the future!
>
> BR,
>
> Jukka Zitting
>


Geographical Datastore and Posgis integration

2009-05-27 Thread pub cog
Hi,

I'm building a datastore to hold geographical informations (kml files)
providing REST webservices to store, retrieve and search those
informations.

As a first iteration, I build my own datastore from scratch using
postgres/postgis (1), the restlet framework (2) and some old school
jdbc.

For the second iteration, new features appeared: versionning, unique
id generation on creation, update a ressource etc...

Many of those features are already addressed by Sling/JCR:
1- 'versionning' JCR is suppose to provide sch a thing, but I didn't
find how to use it in Sling; any link is welcome ;)
2- 'uid' using wildcards (path/*) as explain in the tutorial (3)
3- 'update' builtin Sling


My main concern is about Posgis :(


In my current datastore, I have geographical search functionnality,
meaning I have a webservice like this:
http://www.domain.com/rest/search?south=43.52&north=43.67&west=1.36&east=1.55
returning a list of resources urls like this:
  http://www.domain.com/.../1.kml
  http://www.domain.com/.../2.kml
  http://www.domain.com/.../3.kml

The actual search is based on postgis sql builtin function.

Currently the process has 2 main steps:
  Step n°1- on ressource creation/update, I parse the provided kml
file to extract geographical informations > create a 'geom' (4) using
postgis function and store it in a database table column
  Step n°2- on search I transform query coordinnates into a 'geom' and
use it against the computed geom(s) created above > I found rows in
the db and return them as a list


How could I do this with Sling ?


I have some ideas, could you tell me if it's possible or even the
right direction ?

On an architectural point of view, I thought about having a Sling
server and a postgis database separate.
  - Sling:  will actually store files and properties associated with them
  - Postgis: will store only a jcr path and 'geom' informations
  - Java: code some java component(s) (osgi bundle ?) to synchronize both

Step n°1: I was thinking to use some kind of 'hook' on ressource
creation/update to compute the geom and store a couple
(path_in_jcr/geom) in postgres/postgis
Should I do such a hook by "Extending the SlingPostServlet" describe
in "Advanced Topic" (5) ?!

Step n°2: tricky :(
I've read about resources search in "Querying Resources" (6), but it's
still blury :(


Additionnal information:
- I don't care about portability accross different jcr backend, at
least not at the moment ;)


Thanks
__
Benjamin Francisoud
http://francisoud.blogspot.com


[1] http://postgis.refractions.net/
[2] http://www.restlet.org/
[3] 
http://incubator.apache.org/sling/site/discover-sling-in-15-minutes.html#Additional
examples: "Let Sling generate the path of a newly created node."
[4]geom: 
http://postgis.refractions.net/documentation/manual-1.3/ch04.html#RefObject
[5] 
http://incubator.apache.org/sling/site/manipulating-content-the-slingpostservlet.html
[6] http://incubator.apache.org/sling/site/resources.html


New to Sling

2009-05-27 Thread pub cog
Hi list,

I'm new to Sling and currently evaluating it for a new project.

First of all, thank for making Sling. It's really a great product.
I heard about it from Bertrand Delacrétaz's Blog (1).
I set it up in a few minutes and the tutorial (2) went nicely :)

It's funny because there seems to be many cocoon commiters working on
this project, I've seen familiar names (on the wiki/mailing lists)
back from the days when I used cocoon at Anyware Tech (3) :)

Sling fulfill (almost) all my needs ...
But I have some feasibility questions to answer before starting to use
Sling for good, so expect other mails from me :)

cheers.
--
Benjamin Francisoud
http://francisoud.blogspot.com

[1] http://grep.codeconsult.ch/
[2] http://incubator.apache.org/sling/site/discover-sling-in-15-minutes.html
[3] http://www.anyware-tech.com