Re: Geographical Datastore and Posgis integration

2009-05-28 Thread pub cog
On Wed, May 27, 2009 at 7:45 PM, Vidar Ramdal vi...@idium.no 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:

kml
Folder
Folder
Placemark.../Placemark
/Folder
/Folder
/kml

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-28 Thread pub cog
thanks for the explanation :)

On Wed, May 27, 2009 at 6:25 PM, Alexander Klimetschek aklim...@day.com wrote:
 On Wed, May 27, 2009 at 6:04 PM, pub cog pub@gmail.com 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: [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 mike...@mysign.ch 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 Mike Müller
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 ;)



[jira] Commented: (SLING-77) Provide an easy-to-use Javascript API for JCR

2009-05-28 Thread Hendy Irawan (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12714185#action_12714185
 ] 

Hendy Irawan commented on SLING-77:
---

Is this a JavaScript implementation of JCR API usable with Sling, or a 
JavaScript implementation of proprietary Sling API?

I'd suggest taking a look at or integrating with Dojo Data and Dojo Store.

Or perhaps, expose a Sling/JCR Dojo Store implementation to the Sling JCR, so 
Dojo+Dojo Store+Sling Dojo Store implementation can be run on the Sling 
container.

See: http://www.sitepen.com/blog/2009/01/14/store-explorer/

 Provide an easy-to-use Javascript API for JCR
 -

 Key: SLING-77
 URL: https://issues.apache.org/jira/browse/SLING-77
 Project: Sling
  Issue Type: Improvement
  Components: Servlets Post
Reporter: Lars Trieloff
 Attachments: sling-77.patch


 As discussed here, I propose a Javascript-tailor-made wrapper API to make 
 JCRNodes more accessible to script and template authors
 http://thread.gmane.org/gmane.comp.apache.sling.devel/491

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: Geographical Datastore and Posgis integration

2009-05-28 Thread Paul Mietz Egli

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, ListModification 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.