tag:blogger.com,1999:blog-76039055574308541042024-03-13T07:30:47.176-07:00Nice One!(Yet) another perspective on cutting edge software technologyChrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-7603905557430854104.post-26486175235453928762011-09-04T10:56:00.000-07:002011-09-04T10:56:41.969-07:00Easy In Place Editing with Apache Sling and jQuery jEditable<ol>
<li>Download & reference <a href="http://jquery.org/">jquery</a> and <a href="http://www.appelsiini.net/projects/jeditable">jeditable</a> </li>
<li>Create a scriplet to be included
<pre class="prettyprint">$(document).ready(function () {
$("[class^='edit']").each(function () {
var param = $(this).attr('class').substring(4).toLowerCase();
$(this).editable('<%=currentNode.path%>', {
type: 'textarea',
name: param,
submitdata: {
'_charset_': 'utf-8',
':redirect': '<%=currentNode.path%>.html'
},
cancel: 'Cancel',
submit: 'OK',
event: "dblclick",
tooltip: 'Click to edit...'
});
});
});</pre>
</li>
<li>Use this scriplet in your respective script file, and create an editable textare with a css class named "editXY" where XY is the name of the property to be edited
<pre class="prettyprint"> <div class="editProperty">
<div class="editFirstname">
<%=currentNode.firstname%></div>
</div>
</pre>
</li>
</ol>
That's it. The redirect doesn't work too well, but hey ... :)Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-76568395884068047162009-06-30T12:42:00.000-07:002010-04-10T15:13:04.752-07:00Playing a website with JFugueOk, had to do this:<br />
<br />
<br />
<code class="prettyprint"><br />
import org.jfugue.*<br />
<br />
def munge(s) {<br />
s.findAll { it ==~ /[A-Ga-g]/ }.join(' ')<br />
}<br />
<br />
String.metaClass.play = { new Player().play(new Pattern(munge(delegate.toString()))) }<br />
<br />
"http://www.google.com".toURL().getText().play()<br />
<br />
</code><br />
<br />
All credits go to <a href="http://www.transentia.com.au/flatpress/index.php/2009/06/30/curiosity-killed-the-catdunno-what-its-doing-to-me/">transentia</a>Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com1tag:blogger.com,1999:blog-7603905557430854104.post-50978970607406617082009-05-24T04:43:00.000-07:002009-05-24T11:24:49.488-07:00Sling/Groovy Development with OSGIAfter having evaded this whole OSGI/Maven topic, I think it is time that I delve into the whole issue. Lars Trieloff and other helpful people alredy gave me a <a href="http://n1ceone.blogspot.com/2008/08/controls-managment-project-desiding-for.html">hint </a>about when to change from webdav/scripting mode to OSGI/Maven bundles.<br /><br />After several hours and reading several blogs and webpages, I came up with the following pom.xml:<br /><br /><br /><code class="prettyprint"><br /><?xml version="1.0" encoding="UTF-8"?><br /><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br /> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><br /><modelVersion>4.0.0</modelVersion><br /><groupId>SlingControlmanagement</groupId><br /><artifactId>SlingControlmanagement</artifactId><br /><version>1.0</version><br /><packaging>bundle</packaging><br /><build><br /> <plugins><br /> <!--<br /> <plugin><br /> <groupId>org.apache.felix</groupId><br /> <artifactId>maven-scr-plugin</artifactId><br /> <version>1.0.8</version><br /> </plugin><br /> --><br /> <plugin><br /> <groupId>org.apache.felix</groupId><br /> <artifactId>maven-bundle-plugin</artifactId><br /> <extensions>true</extensions><br /> <configuration><br /> <instructions><br /> <Export-Package><br /> test;version=1.0.0<br /> </Export-Package><br /> <Bundle-SymbolicName>controlmanagement</Bundle-SymbolicName><br /> <Bundle-Name>controlmanagement</Bundle-Name><br /> <Import-Package><br /> org.osgi.framework;version="1.3.0",groovy.lang;version=1.6.0,org.codehaus.groovy.reflection;version=1.6.0,org.codehaus.groovy.runtime;version=1.6.0,org.codehaus.groovy.runtime.callsite;version=1.6.0<br /> </Import-Package><br /> <Sling-Initial-Content><br /> SLING-INF/initial-content/libs/myapp;overwrite:=true;path:=/libs/myapp<br /> </Sling-Initial-Content><br /> </instructions><br /> </configuration><br /> </plugin><br /> <plugin><br /> <groupId>org.apache.sling</groupId><br /> <artifactId>maven-sling-plugin</artifactId><br /> <executions><br /> <execution><br /> <id>install-bundle</id><br /> <goals><br /> <goal>validate</goal><br /> <goal>install</goal><br /> </goals><br /> <configuration><br /> <mountByFS>true</mountByFS><br /> </configuration><br /> </execution><br /> </executions><br /> </plugin><br /> <plugin><br /> <groupId>org.codehaus.groovy.maven</groupId><br /> <artifactId>gmaven-plugin</artifactId><br /> <executions><br /> <execution><br /> <goals><br /> <goal>generateStubs</goal><br /> <goal>compile</goal><br /> <goal>generateTestStubs</goal><br /> <goal>testCompile</goal><br /> </goals><br /> </execution><br /> </executions><br /> </plugin><br /><br /> </plugins><br /></build><br /><repositories><br /> <repository><br /> <id>apache.incubating</id><br /> <name>Apache Incubating Repository</name><br /> <url>http://people.apache.org/repo/m2-incubating-repository</url><br /> </repository><br /></repositories><br /><pluginRepositories><br /> <pluginRepository><br /> <id>apache.incubating.plugins</id><br /> <name>Apache Incubating Plugin Repository</name><br /> <url>http://people.apache.org/repo/m2-incubating-repository</url><br /> </pluginRepository><br /></pluginRepositories><br /><dependencies><br /> <dependency><br /> <groupId>org.codehaus.groovy</groupId><br /> <artifactId>groovy-all</artifactId><br /> <version>1.6.3</version><br /> </dependency><br /></dependencies><br /></project><br /></code><br /><br />There are several things to point out:<br /><ol><li>I am by no means a OSGI/Maven expert, so consider this to be a first draft</li><li>the commented out scr plugin is used for declarative OSGI services, details <a href="http://felix.apache.org/site/apache-felix-maven-scr-plugin.html">here</a>.</li><li>the groovy version used for compilation (1.6.3) and within OSGI (1.6.0) are different. This might lead to problem. Best thing to do would be to reinstall groovy-all.jar into the OSGI environment</li><li>the "Sling-Inital-Content" tag is a convenience used to supply initial content to sling</li><li>the <mountByFS>true</mountByFS> tag should theoretically allow to have all changes done within the filesystem be propagated to sling. Doesn't work atm, although, unsure why<br /><br /></li></ol>Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com1tag:blogger.com,1999:blog-7603905557430854104.post-53539243475965271112009-05-20T13:29:00.000-07:002009-05-20T14:12:21.857-07:00So where in REST is the MVC?Still trying to get my head around REST. Looking at <a href="http://incubator.apache.org/sling">sling</a>, I do see two different approaches:<br /><ul><li>view/model combined: a resource is represented by a markup (html), which contains both view and model information. The controller (browser) is responsible for the correct representation and the hypermedia functionality (hyperlinks, forms), which allows navigation and manipulation of the represented data<br /></li><li>model exclusively: the resource is represented by a data structure (json), which is both rendered to the controllers (browser) taste as view</li></ul>Now, from a design point of view, the second one seems cleaner, and very compatible with the MVC pattern. But the first approach is the one the web is build upon, soooo there has to be something about it ...<br /><br />The idea spinning around in my head is to implement the first approach with <a href="http://griffon.codhaus.org">Griffon </a>and Sling: Sling will deliver SwingBuilder fragments which then will be interpreted by Griffon. Stay tuned...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com1tag:blogger.com,1999:blog-7603905557430854104.post-60798463474975617102009-05-12T21:22:00.000-07:002009-05-12T21:27:00.026-07:00Apache's mime-type listJust stumbled on <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types">this</a> while reading the sling mailing list:<br /><br />Apache's web server default mime-type list, together with associated extensions: might come handy, includes the relevant RFCs in the commentChrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-27102731274537209452009-04-25T06:38:00.000-07:002009-04-25T06:50:40.612-07:00This must be the quote of the weekHaving read the (german) news post on <a href="http://www.heise.de/newsticker/BKA-Chef-Produktpiraterie-traegt-Zuege-der-organisierten-Kriminalitaet--/meldung/136781">heise.de<br /></a> regarding the issue of prodcut piratry one quote struck me:<br />According to the article (no source is quoted there!), Peer Laslo of SAP is supposed to have made this statement:<br />" ...<br />Wir sind nicht betroffen. Unseres Software ist so kompliziert, dass man sie schlecht fälschen kann.<br />..."<br /><br />eng:<br /><br />"...<br />We are not affected. Our software is that complicated that it hardly can be imitated.<br />..."<br /><br />Now, I do not have any context information for this statement. Put like this, it sounds really weird. And wrong too: A software can simply be pirated by copy and paste, or reverse engineering.<br /><br />So the only thing protecting this particular product is the complexity to enhance/change and lastly to use it. Looks like not only security but whole businesses can be built with obscurity in mind....Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-23930437866907177212009-04-18T08:40:00.000-07:002009-04-18T14:00:10.865-07:00Deploying a Groovlet Application to the AppEngine with AntBuilderJust a quick & dirty info: you can easily use the <a href="http://code.google.com/appengine/docs/java/tools/ant.html">already defined tasks </a>for Google AppEngine with your Groovlet-based application (as <a href="http://blog.springsource.com/2009/04/07/write-your-google-app-engine-applications-in-groovy/">described</a> by Guillaume Laforge on his SpringSource blog)<br /><br /><br /><code class="prettyprint"><br />def ant = new AntBuilder()<br />def webinf = "war/WEB-INF"<br />def aesdk = "appengine" //change this to the location of AppEngine SDK<br /><br />ant."import" (file: "${aesdk}/config/user/ant-macros.xml")<br />ant.sequential() {<br /> taskdef name: "groovyc", classname: "org.codehaus.groovy.ant.Groovyc"<br /> groovyc srcdir: "src", destdir: "${webinf}/classes", {<br /> classpath {<br /> fileset dir: "${webinf}/lib", {<br /> include name: "*.jar"<br /> }<br /> pathelement path: "${webinf}/classes"<br /> }<br /> javac source: "1.5", target: "1.5", debug: "on"<br /> }<br /> copy toDir: "${webinf}/groovy", {<br /> fileset dir:"groovlets"<br /> }<br /> if(args.find{it.startsWith("-u")}) {<br /> appcfg action:"update", war:"war"<br /> }<br />}<br /><br /></code><br />Please note that appcfg is a task defined in the GAE SDK. By importing the relevant xml file (and having the respective jar files on classpath), this and all other ant tasks become available to groovy scripts.<br /><br />If you run this script with <code>"groovy build -u</code>" 3 things will happen:<ol><li>all stuff in "src" will get compiled</li><li>all stuff in "groovlets" will get copied over to the appropriate directory (no need to compile those, if you follow Guillaume's hints regarding web.xml configuration<br /></li><li>all stuff will get pushed to the AppEngine</li></ol>If you use strictly Groovlets, nothing needs to be compiled and step 1 might become obsolete.Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-7161279977325523502009-03-12T12:05:00.000-07:002009-03-12T12:15:08.503-07:00What is your LOCBUT?How many <span style="font-weight: bold;">l</span>ines <span style="font-weight: bold;">o</span>f <span style="font-weight: bold;">c</span>ode do you write <span style="font-weight: bold;">b</span>efore having the <span style="font-weight: bold;">u</span>rge to <span style="font-weight: bold;">t</span>est if it is working? Does this count go up or down when you know that there are solid tests backing it?<br /><br />For me personally, it is about 5, and going down if tests are around.<br /><br />I have of course no metrics, but I have the feeling that this is not depending on the programming language. Which leads to some interesting conclusions:<br /><ul><li>strive for fast round-trip cycles in your development process<br /></li><li>prefer expressive languages which allow to more in less LOC</li></ul>Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-50556102630626706572009-02-28T12:50:00.000-08:002009-02-28T13:16:08.750-08:00Checking the RadarWell, about time this blog gets some content added.<br /><br />Quick check on my radar: what technologies am I watching, where they are heading, what else I would like to have a look at etc.<br /><br /><a href="http://tapestry.apache.org/"><span style="font-weight: bold;">Tapestry</span></a>:<br />Wasn't able to play around with it. Currently V5.0, looks very very good, but I will take it off the radar, since I do not see an opportunity to test it out.<br /><br /><a href="http://grails.org/"><span style="font-weight: bold;">Grails</span></a>:<br />About same as Tapestry. I personally would choose one of those two as Web Framework.<br /><br /><a href="http://groovy.codehaus.org/"><span style="font-weight: bold;">Groovy</span></a>:<br />This has become my home language. Just makes sense. Just good. Use it. Will be on Main Road by 2011 (and might get boring then :))<br /><br /><a style="font-weight: bold;" href="http://incubator.apache.org/sling">Sling</a><span style="font-weight: bold;"> (and <a href="http://jackrabbit.apache.org/">Jackrabbit</a>)</span>:<br />Still much work going on there. Sling (and Jackrabbit) are not only superb technologies, but more than that, have become inspiration for modeling content and thinking about data and their respective handling.<br /><br /><a href="http://griffon.codehaus.org/"><span style="font-weight: bold;">Griffon:</span></a><br />Everyone and their mum does that AJAX-Flex-JavaFX-RIA-thingie. Everyone? No, there are some stubborn, backward-oriented guys (did not spot any ladies up to now), which, basically, say, screw it: we are doing SWING! Yeah baby. Do it right by using Groovy, be inspired by Grails, and well, use some major brain power. This one is hot, mark my words...<br /><br />What are possible new candidates for the Radar?<br />Well, there is <a href="http://www.clojure.org">Clojure</a>, but I do not yet have any use case for it at the moment. I will first read the book. Suggestions welcome...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-47844601652729496502008-12-11T21:41:00.000-08:002008-12-11T21:50:40.066-08:00Apache Jackrabbit 1.5Apache Jackrabbit was just released in version <a href="http://jackrabbit.apache.org/downloads.html">1.5</a>.<br /><br />It looks that this is the "yes, we heard you" release, and is a huge jump forward for straightforward usage:<br />1) grab the jar-file<br />2) java -jar jackrabbit-....jar<br /> <br />And... there is no step 3 :).<br /><br />I can't stress out enough the importance of such easy usage. While it already has been more or less simple to use Jackrabbit in, say, semi-professional setups, it now has the chance to hit the Main Street. "Want webdav? Well, you'd better use that jackrabbit thingie".<br /><br />Ok, there may be some steps 3, but I will write about those laterChrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-12986754905081864302008-11-18T21:53:00.000-08:002008-11-18T22:14:55.173-08:00Fun with annotations in Groovy/GriffonThe 1.6 version of Groovy seems to have full-fledged annotation support.<br /><br />I took the occasion to finally learn to create some annotations on my own, and wrote an annotation which can be used in a Griffon model to give the controller some hints about how to best display its data.<br /><br />I might have taken this a little bit too far, but it is also possible to declare strings in annotations which can later be evaluated.<br /><br />Take this annotation as an example:<br /><br /><code class="prettyprint"><br />package annotations<br /><br />import java.lang.annotation.*<br /><br />@Retention(RetentionPolicy.RUNTIME)<br />public @interface TableModelInformation {<br /> boolean displayed() default true<br /> String displayName() default ""<br /> String displayValue() default ""<br />}<br /></code><br /><br />This can be used in the model like this:<br /><br /><code class="prettyprint"><br />...<br /> @TableModelInformation(displayValue='"Total Subprocesses: ${object.subprocesses.size()}"')<br /> List subprocesses = []<br />...<br /></code><br />(Note the weird string syntax: only double quotes (i.e. GString) are rightfully not interpreted as Strings. Furthermore it expects to receive an instance of the object in a variable named (tadaaa) "object".<br /><br />This can be evaluated later in the controller:<br /><code class="prettyprint"><br />return new GroovyShell(new Binding([object:object])).evaluate(object.class.getDeclaredField(field).getAnnotation(annotations.TableModelInformation).displayValue())<br /></code><br />("object" and "field" are available in the context of the controller)<br /><br />I am not sure how to optimize this code, especially the verbosity of annotation retrieval. It nevertheless is kind of funny to see groovy behavior in an (at least from me) unexpected way...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com2tag:blogger.com,1999:blog-7603905557430854104.post-87869915200280594542008-11-14T00:17:00.000-08:002008-11-15T06:04:13.262-08:00Using ocmgroovy as Persistance Layer for Griffon<a href="http://griffon.codehaus.org/">Griffon</a> is a very interessting approach to create an agile and fun framework for building Swing applications. Currently a very shy version numeration is used (0.0.1 is current), but the whole package is built using large know-how.<br /><br />One thing missing is the persistance layer. It is planned to use <a href="http://grails.org/GORM">GORM</a>, the hibernate-based layer of <a href="http://grails.org/">Grails</a>.<br /><br />This situation is an opportunity for <a href="http://ocmgroovy.googlecode.com/">ocmgroovy</a>, my "framework"(*) for persisting Groovy objects into a JCR. While beeing a little ugly hack atm, the basic things like save() and get() seem to work, at least for my basic test cases.<br /><br />Using ocmgroovy in grails is one annoying and 2 easy steps<br /><ol><li>download ocmgroovy (either create the project via pom.xml or download all dependencies manually, which basically means to download all jackrabbit dependencies and xstream with its dependencies) and install it into {griffon_project}/lib directory</li><li>declare the class to be persisted in {griffon_project/lifecycle}/Startup.groovy</li><li>use it in your Griffon mvc<br /></li></ol><br /><br />Step 2 looks like this<br /><code class="prettyprint"><br />TransientRepository repository = new TransientRepository()<br />def session = repository.login(<br /> new SimpleCredentials("threatmanagment", "password".toCharArray()))<br />JcrPersister strategy = new JcrPersister()<br />strategy.session = session<br />strategy.instanceRoot ="threatmanagment"<br /><br />strategy.instrumentate(ThreatModel, "name")<br />strategy.instrumentate(Dataflow,"id")<br /><br /></code>This makes model classes ThreatModel and Dataflow persistable, i.e. currently mostly adds save() and get() methods to instance and class, respectively<br /><br />And Step 3: about as easy<br /><code class="prettyprint"><br />ThreatModel model = new ThreatModel("name": "TestModel")<br />model.save()<br />...<br />ThreatModel model2 = ThreatModel.get("TestModel")<br /></code><br />Please note that this is all very shaky at the moment (and therefore will create a black hole if you try it at home ;)), but might prove usable in the future.<br /><br />I probably will release a PoC-project in the near future.<br /><br />===<br />(*): ocmgroovy is very alpha and only used by myself. Therefore I do not consider this to be a frameworkChrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-91760620181041651422008-09-17T08:15:00.000-07:002008-09-17T08:29:38.214-07:00Ditching Flex ... for nowWell, killing another fairie: I am dissing Flex for my pet project. There are several reasons:<br /><ol><li>not too good Flex-Support in IDEA<br /></li><li>roundtrips are slow (create compile load)<br /></li><li>open source built on closed source doesn't work</li><li>mxml: simply don't like those</li><li>actionscript will not be the next ecmascript</li><li>verbosity: too much to write while using MVC frameworks. Convention over Configuration is not there yet (?)<br /></li><li>HTTP support is kind of crippled<br /></li></ol>There are very good reasons to love Flex:<br /><ol><li>the looks: I am no expert, but I got the feeling Flex just looks great out of the box</li><li>components: component based UIs are great.<br /></li><li>event models<br /></li><li>ubiquity</li></ol>I am sure that some of the points are due to the fact that I am a novice. I might come back to it, but now it is time to move on...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-52295031157244619002008-09-11T07:03:00.000-07:002008-09-13T02:53:48.094-07:00An "in between" review of SlingNow that I have been using Apache <a href="http://incubator.apache.org/sling">Sling </a>for a pet project for some weeks now, I thought I could share some insights on it. The spaghetti western way, of course :). And all utterly subjective.<br /><h2>The Good</h2><ul><li>java -jar sling.jar -> http://localhost:8080 and dav://localhost:8080. This is fantastic.</li><li>Scripting support<br /></li><li>REST: learn it the Sling way<br /></li><li>webdav-support<br /></li><li>A good community<br /></li><li>best-of-breed technologies: OSGI (with Felix), JCR (with Jackrabbit)</li><li>JCR muscle flexing included: query, hierarchies, versioning</li><li>semi-structured data approach<br /></li><li>it's fun<br /></li></ul><h2>The Bad</h2>Nothing bad, just great stuff with some edges:<br /><h2>The Ugly</h2><ul><li>Docu. Yeah I know. Is getting better, but should be more (please kill those "out of sync" pages)<br /></li><li>After a fast start, there still is a learning curve (OSGI, REST, JCR, Maven, ...). Since these are hot topics anyway, this is no big deal, expect when you want something fast and nownownow :)<br /></li><li>bootstrapping problem: despite the available <a href="http://incubator.apache.org/sling/site/discover-sling-in-15-minutes.html">help</a>, I still did struggle with the question whether controls (scripts) or data should be created first. But this is just me, I guess :)<br /></li><li>JCR Editor support: Days eclipse plugin is great, but unfortunately doesn't work on my Ubuntu-system</li><li>No out-of-the-box solution for rich applications (Except dojo, which is a beast on its own...)<br /></li></ul>All in all, Sling holds its head up high in a tight, competitive market. I am looking forward to do more stuff with it. The rough spots are being addressed, therefore I am positive and quite impressed. Most important thing now would be to flesh out the documentation....<br /><br /><span style="font-weight: bold;">update 13th Sept:</span> The <a href="http://www.day.com/eclipse">JCR Plugin</a> for eclipse works after a fresh install, using Eclipse Ganymede and JCR Plugin version 3.6.6. Nice thing is, that Eclipse editors seem to work, e.g. when editing a HTML file. Have to check if this works with the groovy editor too ...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com5tag:blogger.com,1999:blog-7603905557430854104.post-81629428129108030722008-09-07T23:47:00.000-07:002008-09-08T05:55:35.417-07:00Flex/Flash wasn't made for RESTWell, it did take longer than <a href="http://michaelmarth.blogspot.com/2008/08/flex-open-source-right.html">others</a>, but I finally got the message: Flash was not built with HTTP in mind. There are other <a href="http://bugs.adobe.com/jira/browse/FP-201">issues</a> flying around, but I think it all boils down to HTTP not being treated as first-class-citizen in the Flex/Flash environment.<br /><br />I guess that the reason is a historical one: all remote connection protocols where proprietary, only in the last years Adobe opened itself a little bit (by <a href="http://www.techcrunch.com/2007/12/12/adobe-releases-blazeds-open-source-version-of-livecycle-data-services/">releasing</a> BlazeDS and open sourcing Flex). Now I think Adobe should go 2 steps further:<br /><ol><li>implement standards (e.g. using HTTP how it was meant to be used)</li><li>open source the whole stack</li></ol>This is highly speculative, but perhaps the "<a href="http://www.mikechambers.com/blog/2008/08/14/actionscript-3-and-ecmascript-4/">Nay</a>" to EcmaScript4 was due to the apparent closeness of the Flash ecosystem.<br /><br />The saddest thing is that Flex is great! Real good default (looks nice out of the box), a real component model, just plain fun! Next stop: <a href="http://www.dojotoolkit.org/">Dojo</a>, I think ...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-69509545409312281772008-09-04T01:02:00.000-07:002008-09-08T05:56:00.904-07:00Using Groovy Builders in Sling<a href="http://incubator.apache.org/sling">Sling</a> is a new approach in web development. It is, amongst other, a thin REST layer onto a JCR repository.<br /><br />Sling also makes use of the language neutral <a href="https://scripting.dev.java.net/">scripting features</a> of the java platform. Out of the box, several scripting languages are supported, like javascript and jruby. Since Groovy does have JSR 223 support, it is rather easy to create a groovy module to be used inside Sling. The only pity is that the Groovy Scripting Engine is not available via maven. See <a href="https://issues.apache.org/jira/browse/SLING-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576587#action_12576587">this</a> Jira issue for some hints on creating a Groovy OSGI-module for Sling.<br /><br />The thing I like most about Groovy is the real cool builder support. Using the MarkupBuilder, it is a snap to generate HTML or XML documents. I personally started to like MarkupBuilder syntax more than the templating approach.<br /><br />The first time I saw something similar was at a demonstration of the excellent <a href="http://www.seaside.st/">Seaside</a> framework, where everything, including layout, is done in smalltalk. I am not sure wether the Groovy builders have been inspired by smalltalk or even Seaside, but both are sexy (I cannot speak for Seaside, haven't had the chance to play with it).<br /><br />Anyways, on to some comparisons:<br /><br />First a piece of jsp:<br /><br /><code class="prettyprint"><br /><%@page import="javax.jcr.query.Query"%><br /><%@page import="javax.jcr.NodeIterator"%><br /><%@page import="javax.jcr.Node"%><br /><br /><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%><br /><sling:defineobjects/><br /><div class="blueprint detail"><br /><a href="">.details.html"><%= currentNode.getName() %></a><br /><h2>Properties</h2><br /><h2>Controls</h2><br /><div id="List"><br /><%<br />String q = "/jcr:root"+currentNode.getPath()+ "//*[@sling:resourceType='secmanagment/control']";<br />Query query = currentNode.getSession().getWorkspace().getQueryManager().createQuery(q, "xpath");<br />NodeIterator result = query.execute().getNodes();<br />%>Total <%=result.getSize()%><br /><ul><%<br />while(result.hasNext()) {<br /> Node n = result.nextNode();<br />%><li><%<br />out.flush();<br />sling.include(n.getPath() + ".overview.html");<br />%> </li><%<br />}<br />%><br /></ul><br /></div><br /><div class="new"><br /><form action="">/controls/" method="POST"><br /><input type="text" name="name" value="Name"><br /><input type="hidden" name="sling:resourceType" value="secmanagment/control"><br /><input type="hidden" name="jcr:primaryType" value="nt:unstructured"><br /><input type="submit" value="create"><br /></form><br /></div><br /></code><br /><br />The same using Groovy with MarkupBuilder:<br /><code class="prettyprint"><br />import groovy.xml.MarkupBuilder<br />import javax.jcr.query.Query<br />import javax.jcr.NodeIterator<br />import javax.jcr.Node<br /><br /><br />def q = "/jcr:root${currentNode.path}//*[@sling:resourceType='secmanagment/controls']";<br />def query = currentNode.session.workspace.queryManager.createQuery(q, "xpath");<br />def result = query.execute().nodes;<br /><br />def builder = new MarkupBuilder(out)<br />builder.div(class:"blueprint detail") {<br /> a(class:"blueprint details", href:"${currentNode.path}.details.html", currentNode.name)<br /> h2("Properties")<br /> h2("Controls") {<br /> ul(class:"List") {<br /> result.each { node -><br />//this is necessary: need to put the outer tags explicitely <br /> mkp.yieldUnescaped "<li>"<br /> sling.include(node.path)<br /> mkp.yieldUnescaped "</li>"<br /> }<br /> }<br /> h3("Create new")<br /> div(class:"new") {<br /> form(action:"${currentNode.path}/controls/", method:"POST") {<br /> input(type:"text", name:"name", value:"Name")<br /> input(type:"hidden", name:"sling:resourceType", value:"secmanagment/controls")<br /> input(type:"hidden", name:"jcr:primaryType", value:"nt:unstructured")<br /> input(type:"submit", value:"create")<br /> }<br /> }<br /> }<br />}<br /><br /></code><br /><br />While not being too different, those 2 samples (hopefully) show the usage of MarkupBuilders as valid alternative to a templating engine like jsp or gsp.Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com2tag:blogger.com,1999:blog-7603905557430854104.post-46200655148276504572008-08-19T13:56:00.000-07:002008-08-19T14:03:20.014-07:00Oh what ironySo, after some years of java-programming I am getting used to dynamic, loosely typed languages, walk like a duck, y'know the drill.<br /><br />Then enters Flex, enters AS3 and you know what? Explicit type declarations all the way (Not mandatory at all, but, you know, the compiler complains and stuff, so you better behave...)<br /><br />This is not a problem and all, but something about the whole thing just made me smile :).Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-81741255638125076202008-08-11T04:01:00.001-07:002008-08-12T07:54:06.377-07:00Controls Managment Project: Desiding for JCR/SlingI am pondering for a half year on the idea of creating a piece of software which allows to manage (security) controls. There are several programs which allow to manage risks, but they assume the existence of a complete business services catalogue, broken down to hardware installations and software instances. Which I do not have atm.<br /><br />What we do have is a set of controls, together with measures which describe how to implement those controls. The very basic model is:<br /><blockquote>1 control <-> m measures<br />1 measure <-> m implementations</blockquote>A set of controls can be packet together in a workbook (haven't found a better word for it), which then can be assigned to someone (e.g. infrastructure guys) to define the implementations and their respective fulfillment.<br /><br />This is all kind of vague, and it will probably will remain to be vague and not 100% defined in a strict (relational) domain model. It might for example be possible that some controls have more attributes than others. This is of course possible to be modeled with object compositions, but this is always the point where ORM starts to produce to much friction heat...<br /><br />And this vagueness is imho a indicator for the need of a kind of <a href="http://en.wikipedia.org/wiki/Semi-structured_model">semi structured</a> data model. And this again is a good sign for using the <a href="http://www.betaversion.org/%7Estefano/linotype/news/93/">data first</a> approach: use the hierarchy as structuring model, and, well, see to more structure later. Maybe :). Therefore JCR is the weapon of choice....<br /><br />As for Sling: I am still completely indecisive regarding the right client technology. Therefore it makes sense to have a REST-full interface to the business domain.<br /><br />And Sling is sexy. Want to use it. 'Nuff said.<br /><br />Next steps would be to answer some questions regarding Sling development. Currently I am scouting the message boards and the (way too sparse) documentation...<br /><ul><li>what's the best way to setup a Sling project? Use webdav for deployment?<br /></li><li>How to backup/restore work?</li><li>How to design a JCR/Sling project? Top down? Paralell development of content model and functionality?</li><li>OSGI Best Practises<br /></li><li>Which client-side technology to choose?</li></ul>Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com6tag:blogger.com,1999:blog-7603905557430854104.post-15637788054689172842008-08-05T01:16:00.000-07:002008-08-05T01:47:33.451-07:00A first view at Sling<a href="http://incubator.apache.org/sling/site/index.html">Sling </a>is, well Yet Another Java Web Framework. But it adds some unique aspects, which might turn out to be a game changer:<br /><ul><li>it focuses on resources<br /></li><li>it uses JCR as backend API (see <a href="http://jackrabbit.apache.org">jackrabbit</a> as implementation)<br /></li><li>it adds a thin layer of REST over JCR</li><li>it adds a dash of custom behavior by allowing dynamic languages (javascript, jruby, amongst others) to manipulate the REST request processing flow<br /></li><li>it uses <a href="http://en.wikipedia.org/wiki/OSGi">OSGI </a>and its plugin-mechanism for more heavyweight and/or integration stuff</li></ul>Besides being rather hype compliant (JCR, jruby, osgi, REST, thank you), the most interesting feature is that it's inspiring: it makes me <span style="font-style: italic;">think</span>, and this in a constructive way. It kind of makes REST more approachable as an architectural <span style="font-style: italic;">style </span>rather than a framework.<br /><br />In a sense, it is like learning a new programming language: it opens your horizons, and questions some established thought routines.<br /><br />Go ahead and check it out, it might trickle in...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-54127322234229145412008-07-10T03:29:00.000-07:002008-07-12T00:02:39.988-07:00Grails, Flex, SoapToday I have written a small PoC for Grails, Flex, SOAP. The initial task was (and still is) to find out which communication takes place in a Flex application.<br /><br />Having no clue about Flex, a little understandig of Web Services and some minor understanding of Grails, it took me no more than 3 hours, including googling for web service usage in Flex and hunting of really stupid beginners bug.<br /><br />This shows the real muscles of Grails and its really awesome plugin ecosystem.<br /><br /><code><br />grails create-app HelloFlex<br />cd HelloFlex<br />grails install-plugin flex<br />grails install-plugin xfire<br />grails create-service hello<br /></code><br />Ok, everything needed is installed. 2 more things to do. in HelloFlex\services\HelloService.groovy:<br /><code class="prettyprint"><br />class HelloService {<br />static expose=['xfire', 'flex-remoting']<br />def hello(String echo) { return echo.reverse() }<br />}<br /></code><br /><br />Note the use of expose: this service is both available via flex-remoting and via SOAP.<br /><br />Second: create HelloFlex\web-app\test.mxml<br /><br /><code class="prettyprint"><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"><br /><mx:WebService<br /> id="userRequest"<br /> wsdl="http://localhost:8080/HelloFlex/services/hello?wsdl"><br /> <mx:operation name="hello" resultFormat="object"<br /> fault="mx.controls.Alert.show(event.fault.faultString)"<br /> result="showResult(event)"/><br /></mx:WebService><br /><mx:Script><br /><![CDATA[<br />import mx.rpc.events.ResultEvent;<br />import mx.rpc.events.FaultEvent;<br />import mx.controls.Alert;<br />[Bindable] private var passage:String;<br />private var options:Object = {"output-format": "plain-text"};<br />private function showResult(e:ResultEvent):void {<br />passage = userRequest.hello.lastResult;<br />}<br />private function send_data(input:String):void {<br />userRequest.hello(input);<br />}<br />]]><br /></mx:Script><br /><br /><mx:Text text="Echo Service" fontSize="16" fontWeight="bold"/><br /><mx:Text text="Input" fontSize="12"/><br /><mx:TextInput id="lookupPsg" textAlign="center"/><br /><mx:Button label="Submit" click="send_data(lookupPsg.text)"/><br /> <mx:TextArea height="352" width="590" id="psg" text="{passage}" editable="false" fontSize="11"/><br /></mx:Application><br /></code><br />(sorry for the mess, dunno how to format this better )<br /><br />Hitting <code>http://localhost:8080/HelloFlex/test.mxml</code> displays the Flex application which uses SOAP protocol to consume the webservice.<br /><br />Built on the shoulder of giants...<br /><br /><span style="font-weight: bold;">Update 12th Jul:</span> Marcel Overdijk has already <a href="http://marceloverdijk.blogspot.com/2008/01/blazeds-test-drive-sample-in-grails.html">written</a> a similar (well, actually better:)) example back in january.Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-43046666028307223502008-07-07T00:22:00.001-07:002008-07-09T12:30:10.759-07:00Complex Swing Widgets, where art thou?I am currently looking at creating something with a good ol' Swing interface.<br /><br />A typical use case is the following scenario: a <span style="font-style: italic;">drag-and-droppable, sortable, pageable treetable with editable fields</span>. Datatype aware editors, subtrees, master-detail views would be considered as added value. Such a treetable always<br /><br />I did find the respective contributions of <a href="http://extjs.com/deploy/dev/examples/samples.html">ext-js</a> and jquery quite usable, albeit both need some customizing and/or (more or less) programming.<br /><br />Coming back to Swing after several years, I naively expected to have a plethora of tree table implementations. Well, at the moment the only thing I have found is the SwingX <a href="http://www.java2s.com/Code/Java/Swing-Components/TreeTable.htm">Treetable</a>. I will have a look at it in near future.<br /><br />The question I ask myself is wether the HTML/js way is the way to go also for complex GUIs? I would still think that this platform has its limitations. But when I do see how sparse complex Swing widgets are, I really am unsure to use the right technology. Also things like autocompletion and other Web2.0 goodies should be easily available.<br /><br />What is your opinion? Are there other Swing (or SWT, whatever) widgets collections with advanced components available? Does the Flex ecosystem provide more components?<br /><br /><span style="font-weight: bold;">update 9th Jul</span><br />Well, I guess I was right with not finding a Swing TreeTable: <a href="http://weblogs.java.net/blog/timboudreau/archive/2008/06/egads_an_actual.html">others</a> have been waiting for it, too...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com2tag:blogger.com,1999:blog-7603905557430854104.post-16338394359960416172008-06-29T12:34:00.000-07:002008-06-29T13:03:57.018-07:00Comments on an interesting Wired ArticleChris Anderson has written an <a href="http://www.wired.com/science/discoveries/magazine/16-07/pb_theory/">interesting</a> article. While the title is rather placative ("The End of Thery") there are some thoughts worth beeing mentioned.<br /><br />First "All models are wrong, and increasingly you can succeed without them". True, so true: models are just that: models. Also nothing against succeeding without them: data mining can be made without models.<br /><br />But: is the Peta-Age really the end of theories? Interestingly, the article mentioned Craig Venters huge task to "sequence the air". This creates vast amounts data, and makes it almost ridiculously simple to find new species, or make correlations between species. To analyse this, to explain and understand it, there needs to be a model. Or doesn't it?<br /><br />There is absolute nothing against the idea to look for unexpected correlations in huge datasets. But to make it really scientific, results or rather conclusions out of those results need to be falsificable. This falsification cannot be done in the dataset beeing used, but in a larger context. In a model, extrapolated from the dataset.<br /><br />All mho...Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-79511045734935440272008-06-22T05:45:00.000-07:002008-06-23T03:45:58.330-07:00ocmgroovy: Design ConsiderationsI have put some design consideration <a href="http://code.google.com/p/ocmgroovy/wiki/DesignConsiderations">thoughts </a>on the ocmgroovy site.<br />Feel free to comment on it, feedback is appreciated :).Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-76958026197333432072008-06-12T00:10:00.000-07:002008-06-12T00:16:12.699-07:00JCR Builder and JCR Query code now hosted on googlecodeThe source code mentioned on <a href="http://n1ceone.blogspot.com/2008/05/groovy-builders-jcr-and-miglayout-to_26.html">this </a>blog and on the Day dev-<a href="http://dev.day.com/microsling/content/blogs/main/groovyjcr.html">site </a>is now <a href="http://code.google.com/p/ocmgroovy">hosted </a>by the octopus. The project ist named "ocmgroovy" and you may expect more from that department in the near future.Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0tag:blogger.com,1999:blog-7603905557430854104.post-70029169756906625262008-06-06T03:19:00.000-07:002008-06-06T03:37:34.842-07:00Groovy in TapestryGood news on the <a href="http://tapestryjava.blogspot.com/2008/06/tapestry-with-groovy.html">Tapestry</a> front: Using groovy seems to be trivial in T5, according to H.L. Ship. Also the hint regarding Groovy becoming a first choice for Tapestry development is good to hear, and makes perfect sense!<br /><br />This opens up a loads of options: Tapestry Builders (Tapestry is all about components ...), Usage of GORM as ORM layer, and all the goodness of the Groovy language at your fingertips. And a rock solid foundation like T5 to build applications upon. Wow.<br /><br />No excuse to not try it out now, aaah so much to do, so little time ....Chrigelhttp://www.blogger.com/profile/05227615949751525227noreply@blogger.com0