Latest Posts

Archives [+]

Archive for 'December 2007'

    Posted by Michael Marth DEC 20, 2007

    Posted in everything is content, jcr and rest Comments 2

    A while ago Stefano Mazzocchi has written an excellent post titled "Data First vs. Structure First". In it he describes a strategy called "Data First" where the data structures of an information system are, well, not structured in advance, but allow for data structures to emerge over time.

    He proclaims that:

    1. Data First is how we learn and how languages evolve. We build rules, models, abstractions and categories in our minds after we have collected information, not before. This is why it's easier to learn a computer language from examples than from its theory, or a natural language by just being exposed to it instead of knowing all rules and exceptions.

    2. Data First is more incrementally reversible, complexity in the system is added more gradually and it's more easily rolled back.

    3. Because of the above, Data First's Return on Investment is more immediately perceivable, thus lends itself to be more easily bootstrappable.

    And gives these real-life examples for Data First approaches:

    But look around now: the examples of 'data emergence' are multiplying and we use them every day. Google's PageRank, Amazon's co-shopping, Citeseer's co-citation, del.icio.us and Flickr co-tagging, Clusty clustering, these are all examples of systems that try to make structure emerge from data, instead of imposing the structure and pretend that people fill it up with data.

    The opposite approach is Structure First. Stefano asks:

    But then, one might ask, why is everybody so obsessed with design and order? Why is it so hard to believe that self-organization could be used outside the biological realm as a way to manage complex information systems?

    One important thing can be noted:

    On a local time-scale and once established, "Structure First" systems are more efficient.

    This is a great and thought-provoking post, because I am, like many others, trained to think about data in terms of structures (first). But I realize that this way of thinking can also be a limitation in what can be achieved.

    I would actually like to add one more aspect to Stefan's question why we are "so obsessed with design and order": our tools. In many developer minds thinking about data is equivalent to mentally setting up tables and rows in a relational model. In a good part it is the tools that shape our thinking.

    But actually there are tools that do NOT force us to structure the data in advance or, even better, that allow us to structure as much as we like. As you might expect on this blog one tool to mention is a Java Content Repository like CRX. In a JCR you can go along the full structure route and fully define node types, but you can also leave all your data unstructured (like David suggests in his model) or do anything in between. That is why I have been suggesting that JCRs are well-suited for rapid application development. The structure is allowed to emerge as you go along.

    (see Stefano again:)

    But there is more: we all know that a complete mess is not a very good way to find stuff, so "data first" has to imply "structure later" to be able to achieve any useful capacity to manage information. Here is where things broke down in the past: not many believed that useful structures could emerge out of collected data.

    Now, I am pleased to see that these ideas are gaining traction within the IT industry. Only recently two alternative implementations of these concepts have surfaced:

    Amazon SimpleDB

    Like all of the Amazon web services SimpleDB is a large (massively scalable, I presume) hosted service. Amazon describes it as a spreadsheet, but to me it looks more like hash map. What is important, the value part of the key-value hash map relation can take multiple attributes:

    In Amazon SimpleDB, to add the items above, you would PUT the three itemIDs into your domain along with the attribute-value pairs for each of the items. Without the specific syntax, it would look something like this:

    - PUT (item, 123), (description, sweater), (color, blue), (color, red)
    - PUT (item, 456), (description, dress shirt), (color, white), (color, blue)
    - PUT (item, 789), (description, shoes), (color, black), (material, leather)

    Amazon SimpleDB differs from tables of traditional databases in several important ways. First, you have the flexibility to easily go back later on and add new attributes that only apply to certain items - for example, sleeve length for dress shirts. Additionally there is no need to pre-define data types.[...]

    Amazon SimpleDB automatically indexes all of your data, enabling you to easily query for an item based on attributes and their values. In the above example, you could submit a query for items where (color = blue AND description = dress shirt), and Amazon SimpleDB would quickly return item 456 as the result.

    Note that there is no schema or data structure to set up. In fact, it is even impossible (as opposed to a JCR).

    David Dossot had the same idea I had when I stumbled across this: there should be a JCR interface to SimpleDB.

    I would personally be interested in a JCR adapter for SimpleDB: this would enable a semantically meaningful data storage layer to be plugged on top of the Amazon service. Think about massively distributed content management system...

    CouchDB

    If you want to put big corporate Amazon at one end of the IT spectrum you might put CouchDB at quite the opposite end: it is an experimental geeky project in alpha state. It describes itself like:

    What CouchDB is

    - A document database server, accessible via a RESTful JSON API.
    - Ad-hoc and schema-free with a flat address space.

    And further:

    Unlike SQL databases which are designed to store and report on highly structured, interrelated data, CouchDB is designed to store and report on large amounts of semi-structured, document oriented data.[...].

    In an SQL database, as needs evolve the schema and storage of the existing data must be updated. This often causes problems as new needs arise that simply weren't anticipated in the initial database designs, and makes distributed "upgrades" a problem for every host that needs to go through a schema update.

    With CouchDB, no schema is enforced, so new document types with new meaning can be safely added alongside the old. [...]

    You get the picture. The key word is "no schema" again.

    I welcome these new(*) approaches to storing data. While they will certainly not make relational data bases obsolete by any means they will broaden our minds when it comes to thinking about data. And they provide an additional tool in our tool chest.

    (*) Well, "new". JCRs have been around for quite a while. The rest of the industry has woken up. I am tempted to quote "Imitation is the sincerest form of flattery" :)

    REST

    While we are at "watching industry trends": it should also be noted that the two persistence technologies form above both expose a REST interface to applications. For JCRs this is implemented through Apache Sling or Microjax.

    While this is not a real surprise given the REST's success it is still worth noting. Compare it to the situation a few years ago, when accessing data invariably meant installing a driver and opening a socket connection.

    Update (3/1/2008)

    Seems like IBM has "bought" CouchDB and plans to donate the code to Apache.

    Posted by Michael Marth DEC 20, 2007

    Posted in dev.day.com Comments 2

    I have implemented a servlet filter that checks incoming requests against the Akismet service. Their REST API is conveniently wrapped by this little Java library: http://sourceforge.net/projects/akismet-java/

    It is really easy to implement: One needs an API key from Akismet and simply checks an incoming comment with :

    Akismet akismet = new Akismet(MY_KEY, "http://dev.day.com");

    boolean isSpam = akismet.commentCheck(
         my_ip,
         userAgent,
         referer,
         getPermaLink(httpRequest),
         "comment",
         commenterName,
         "",
         comment,
         commenterUrl,
         request.getParameterMap());

    Comments are now enabled again. If you cannot post although you do not try to sell car insurances please drop me a line (my email address is mmarth, the domain is day dot com).

    Update

    It turns out that there are spam comments that are not caught by Akismet (most of them are, though). As an additional measure I now check that the commenter executed Javascript (which makes it more likely that the commenter is human). Unfortunately, humans that turned off Javascript in their browser cannot comment anymore.

    Posted by Michael Marth DEC 18, 2007

    Posted in ask the community and jcr Add comment

    In my opinion, there is a certain shortage of established community wisdom in the JCR world. There is not too much information on topics like architectural design patterns, decision guidelines, implementation gotchas and pitfalls etc. Therefore, I thought I should go out and ask some of the JCR users what they learned. This is the first part of this endeavor, which will result in a mini-series of blog posts tagged "ask the community".

    Well, actually, for this first post I did not have to go out at all. Only a couple of days ago, Lars Trieloff, Alexander Klimetschek and Alexander Saar have joined Day. The three guys constituted the development team of Mindquarry which is a collaboration suite based on Apache Jackrabbit. So I went to ask the three guys about their experiences with JCR.

    Q: Back at the time when you were designing your persistence architecture what potential choices were you considering and what influenced your decision towards Jackrabbit?

    L.T.: We had decided on Apache Cocoon as a web framework and REST as an architecture model and were looking for a storage that allowed us to store XML files, binary documents and folders and provide us querying,transactions, and a standardized API. At first we had a look at XML database systems, but found no open source XML database that matched our requirements. When we found Jackrabbit and JCR, we knew it could provide us what we needed for storing binary data and folders, but that we needed to invest some time to allow for querying of XML files.

    A.S.: From the beginning we decided that Mindquarry has to be very flexible in terms of data storage and structure. With that in mind we decided that relational databases will not have the capabilities to provide what we need on the development side. Sure they perform very well if you know you data model, but as a collaboration solution that allows community members to create content, you can not rely on a certain data model and you surely don't want to restrict your users.
    But what are the alternatives? As Lars says, we first looked at several open source XML databases, but none of them provided what we needed like XPath, versioning, transactions and so on. After a while we found Jackrabbit which provides all the flexibility we needed plus the standards features like versioning and transactions I expect from a good data storage.

    A.K.: That's true. We wanted the schema flexibility of an XML database including versioning, but unfortunately the OpenSource XML DBs either didn't offer all features we needed or were not maintained anymore. So we came across JCR and with a bit of thinking we saw that it provides exactly what we need.

    Q: Did your expectations regarding the JCR come true or did you have to overcome some difficulties you did not expect? Were there any pleasant or not so pleasant surprises after working with Jackrabbit for a while?

    L.T.: First we had to overcome the difficulty we did expect: JCR is not an XML-database, but it was fairly easy to develop an one-to-one mapping of JCR node types and XML elements, attributes and text nodes. The next issue for us was the XPath-implementation in Jackrabbit that only supported a very limited subset of XPath 1.0, while we were expecting full XPath 1.0, if not XQuery support. Fortunately we could solve this relatively quickly by implementing a custom Query Handler that is based on Jaxen, an open source XPath engine.

    A.K.: In my opinion, the most unpleasant surprise was the FileSystem persistence manager because we didn't know about its limitations. The main problems at the end were scalability because of that and a missing import and export including version history - we needed that for a full backup for our customer data on our hosting environment. Eventually we used a PostgreSQL DB with a BundleDBPersistenceManager and did the backup with SQL dumps.

    A.S.: I also think at that time it was a very optimistic decision and we don't really realized how much this will affect our application. But once we started with extending Jackrabbit for our needs, e.g. a direct mapping of XML elements to nodes we realized how much flexibility we can get.
    One thing that was missing was proper tool support and best practices on how to design content centric applications. This issue is much more in the scope today and I think this will help others to start with such an approach.
    The biggest problem was probably the lack of high performance persistence managers in the open source Jackrabbit version. We started with the file system persistence manager, but soon we had problems with too many inodes on Linux file systems. Then we switched to DB persistence management, but this has introduced another layer for the application. While Jackrabbit itself is a kind of database, it shouldn't be necessary to run it on another database.

    Q: What tools did you use for your JCR-related development work?

    A.S.: Mostly a JCR command line client and a small eclipse plugin that allows to browse Jackrabbit repositories..

    Q: You surely must have learned some important lessons about JCR from building such a complex product as Mindquarry. Would you like to share some of them with us?

    L.T.: The most important lesson I learned about JCR is that it provides a very powerful framework for content-centric applications, and with powerful JCR implementations such as Apache Jackrabbit or CRX you get much more than just an API. But this powerful framework should also have implications on your application design, as the more you abstract from JCR, by mapping content to XML, to relations or by object-relational mapping, you are losing a lot of the power and flexibility that JCR gives you.

    A.K.: Using a tree-based content structure now looks much more intuitive to me compared to relational database schemas. But the JCR API has a very fine-grained data access, which is a performance issue if the database (aka Jackrabbit) lies on a different server. So an important point to solve is the implementation of getting a set of nodes with one query across the wire, so that the individual access to subnodes and properties doesn't involve network access anymore.
    On the other hand it's useful to have even simpler APIs on top of JCR, eg. for dynamic languages. I think Lars has already done such a thing for microsling. But until those two things are solved by Jackrabbit and co. in general, the content access model is very, very good. No need for additional object-to-relational or other mappings.

    A.S.: I agree, you should not try to handle your JCR based content by another abstraction like objects and relations. Take it as it is, unstructured content, and live with it. This will reduce efforts and at the end of the day it will make you more flexible.

    Q: If you had one wish regarding JCR and the JCR community, what would it be?

    A.S.: Better file system based persistence managers for the open source Jackrabbit, XQuery support

    L.T.: Yes, regarding JCR my wish would be better query support and this means XQuery. XQuery is a very powerful language when it comes to querying tree-structured data such as XML, but it is not limited to XML. Regarding the JCR community, I see it as too fragmented: we have communities for the various open source JCR implementations and JCR-related projects like Jackrabbit, Alfresco, Exo Platform, we have vendor communities, but not enough sharing of best practices when it comes to application architecture and content modeling. Especially content modeling is a topic where we could get the maximum benefit from a standardized API, because it would allow for content mash-ups at the repository level.

    A.K.: I also think XQuery would help in retrieving those sets of nodes I described for improving performance. And a set of tools like it is available for CRX, eg. a full-featured web-based JCR browser with editing capabilites, would improve development enormously.

    Posted by Michael Marth DEC 18, 2007

    Posted in dev.day.com Add comment

    Comments on this blog have been disabled due to a spam attack. I will implement a spam filter (or find another method of stopping it) and bring comments back up.

    To make this is excercise a bit more constructive I would like to mention that disabling the comments was done by creating an empty file POST.esp at /sling/scripts/blogPost (see the request processing overview)

    Posted by David Nuescheler DEC 14, 2007

    Posted in javapolis, microsling, ujax and usling Add comment

    Posted by Michael Marth DEC 14, 2007

    Posted in crx, davids model, microsling, sling and tutorial Comment 1

    If you followed the previous parts of this little microsling tutorial (here, here and here) you should now have microsling up and running. It’s time to move on and create a real web application with microsling. In this post I will explain how this blog system that you are currently reading has been built.

    Content model

    There is not too much information about structuring JCR content available (I hope to address this issue in the future). But one thing that is available is "David’s Model". I took it as the basis for structuring the blog.

    Let’s see, there are blog posts, a blog entity to hold the posts, comments posted by readers and file attachments to blog posts. Now for the rules:

    Rule #1: Data First, Structure Later. Maybe.

    OK, that’s easy. I will store everything as nt:unstructured. Sounds good, did not want to think about node types anyway.

    Rule #2: Drive the content hierarchy, don't let it happen.

    This is a really good rule IMO. Especially, if one has done some relational DB modeling it is a bit hard to get into. But in our case it is easy and natural enough: blog posts will be children of the blog they belong to. Comments and attachments will be children of the post they belong to.

    Rule #3: Workspaces are for clone(), merge() and update().

    Actually, workspaces would be really useful for a staging area. However, I will not use them here in order to keep things simple.

    Rule #4: Beware of Same Name Siblings.

    This is no problem for the posts (I can just name them any way I like and there should not be too many), but I will come back to this regarding the user generated comments.

    Rule #5: References considered harmful.

    OK, I do not think I need them here.

    Rule #6: Files are Files are Files.

    I will use nt:file for attachments. Attachments are files after all.

    Rule #7: ID's are evil.

    I do not want to be evil. Hence, I do not use IDs (and I have not needed them so far).

    Right, so the model looks something like this:

    blog [nt:unstructured]
    |  +sling:resourceType[string]
    |--post [nt:unstructured]
    |    +title[string]
    |    +body[string]
    |    +sling:resourceType[string]
    |----comment [nt:unstructured]
    |      +body[string]
    |      +sling:resourceType[string]
    |----attachment [nt:file]

    Most of the properties should be self-explanatory (well, a blog post needs a title), but not the "sling:resourceType" properties. Since all nodes are unstructured (apart from the files) this additional property is needed for script resolution (see the post about microsling’s request processing). Microsling determines the resource type through this property (and indirectly the script to execute).

    Display a blog post

    Let’s now display a blog post. First, you need to create a post using CRX’s Content Explorer (see the last part of this tutorial if you are not sure how to do this). Create a blog node named "myblog". It shall contain a post node named "firstpost". Add a title and a body property.

    The property "sling:resourceType" of the post shall have the value "blogPost". For the blog node the value shall be "blog".

    You should get something like this:

    Next, you need to put a script to display this node into the repository. The script must be placed in the directory "/sling/scripts/blogPost" and called "html.esp" (the server-side JavaScript processor will be used). The file shall contain:

    <html>
      <body>
        <h1><%=resource.node.title%></h1>
        <%=resource.node.body%>
      </body>
    </html>

    To see the output of the script point your browser to http://localhost:7402/microsling/myblog/firstpost.html. As you already know, the bit between the <%= %> brackets is executed on the server and the result is inserted into the output. The resource object has a property node which represents the JCR node that was requested. This node has the two properties "title" and "body" which are accessed using JavaScript’s dot notation.

    Display the whole blog

    For displaying the whole blog you need to put a script called "html.esp" into "/sling/scripts/blog". The file shall contain:

    <html>
      <body>
      <%
      for (var prop in resource.node) {
        if (resource.node[prop]["sling:resourceType"] == "blogPost") {
      %>
          <h1><%= resource.node[prop].title%></h1>
          <p><%= resource.node[prop].body%>
          </p>
      <%
        }
      }
      %>
      </body>
    </html>

    The parts between <% %>, (without the equals sign as opposed to above) denote JavaScript that is executed on the server without having the results being written into the output stream (that is just like JSPs again).

    In the line

    for (var prop in resource.node) {

    the script iterates over the children of the blog node and looks for children of (Sling) resource type "blogPost" in this line:

    if (resource.node[prop]["sling:resourceType"] == "blogPost") {

    The square-bracket syntax for accessing a property (in this case ["sling:resourceType"]) is an alternative to the dot notation used above for title and body.

    To see the output of the script point your browser to http://localhost:7402/microsling/myblog.html

    An RSS feed and includes

    Now that you have the list of posts it is really easy to add an additional feature: an RSS feed. For this, create a new script called xml.esp (i.e. it shall respond to requests ending in ".xml") and place it in "/sling/scripts/blog". The logic is almost the same as above, just the markup is different. Simply iterate over the blog posts and produce xml instead of html. So the file should contain:

    <?xml version="1.0"?>
    <rss version="2.0">
    <channel>
    <title>My blog </title>
    <description>My blog</description>
    <link>http://mydomain.com/microsling<%= resource %>.html"</link>
    <%
      for (var prop in resource.node) {
        if (resource.node[prop]["sling:resourceType"] == "blogPost") {
          %><%=sling.include("/microsling"+\\
          resource.node[prop]+".rssitem.xml")%><%
        }
      }
    %>
    </channel>
    </rss>

    (The \\ characters shall denote that the line continues. Delete them from your code.)

    The first new bit in this code is the expression <%= resource %>. This evaluates to the node name including the full path. It is useful e.g. for generating links as above.

    The second new bit is the line

    %><%=sling.include("/microsling"+\\
    resource.node[prop]+".rssitem.xml")%><%

    The include method generates a new request on the server-side. The result of this request is included into the output stream. This includes an alternative "view" of a blog post. "resource.node[prop]" is the node that contains the post. "rssitem" is a selector on this node. With a selector you can render a certain resource type in alternative ways. In this case you need to render a blog post as an rss feed item. Thus, create a script at "sling/scripts/blogPost/rssitem/xml.esp" that contains:

    <item>
    <title><%= resource.node.title %></title>
    <description><%= resource.node.body%></description>
    <link>http://mydomain.com/microsling<%= resource%>.html</link>
    </item>

    Now point your browser at http://localhost:7402/microsling/myblog.xml to see the resulting RSS feed.

    OK, that’s all for today. In the next part, we will look at user-generated comments and attachments.

    (For your convenience all the scripts have been added as an attachment to this post.)

    Posted by Michael Marth DEC 13, 2007

    Posted in crx, microsling, sling and tutorial Comment 1

     

    As promised, here’s a little tutorial on how to get started with microsling. Before we dive in, one word of caution though. Microsling is a really young project so there are still some rough edges. Even worse, it is still undergoing quite some changes so it is a bit of a moving target. But don’t worry, in this tutorial I will guide you along a safe path.

    First of all, you need a JCR. Microsling works with Jackrabbit and CRX. In this tutorial we will use CRX, because its Content Explorer makes it much easier to observe what is going on inside the repository. If you do not have a CRX installed yet, follow these steps, otherwise skip this section (but have a look at the third point below).

     

    1. Install a Java SDK version 1.5. It is actually necessary to use 1.5, because with 1.4 microsling will not work and with 1.6 CRX will not work. (### deleted comment about versions, dll hell etc... ###)
    2. Download CRX’s free trial version from here
    3. Run the installer, but not with the default settings. You need to point the Java virtual machine to the 1.5 version from above. However, leave the admin password set to admin (in case you want to know why: currently, microsling connects to the repository by default as the admin user and the connection credentials can only be changed by recompiling microsling, but for simplicity, I do not want to get into that right now)
    4. Start the Communiqué Manager and point your browser to http://localhost:7402/crx
    5. Click "Content Explorer" and, voila, there is your repository.

     

    The next step is to mount the repository as a WebDAV drive. On Windows the steps are:

     

    1. Open the Windows Explorer and select Tools > Map Network Drive. In the dialog that comes up click "Sign up for online storage or connect to a network server".
    2. A wizard appears, select "Choose another network location".
    3. When you are prompted for the address use: "http://localhost:7402/crx/repository/crx.default". The connection credentials are admin/admin again.

     

    In your Windows Explorer’s Network Places you should now see the repository (given that you do not run Windows 2003. If you do see this Windows bug). Give it a try and create a folder and a new text file. The second and last step is installing the microsling web application. Microsling is deployed as a war file. We will deploy it in CRX’s servlet engine so that microsling and CRX run within the same virtual machine.

    Now, there’s one thing: since microsling is very young the usual way to get your hands on it is to check out from Apache’s svn and compile. However, currently this will produce a build working with Jackrabbit. There is a slight modification needed to run microsling with CRX. This extension is currently not available in a public svn, but only within Day (I guess this will change pretty soon though). Therefore, I have built and attached the war file to this blog entry. Just download it from here for now.

    To deploy this war file point your browser to the admin interface of Communiqué’s servlet engine http://localhost:7402/admin. Choose "/" for the context, select the war file and press "Add". Start the application. Congratulations, microsling is now up and running. So let’s start to play.

    Some test content

    First, we need some content to display. Open CRX’s Content Explorer, right-click on the root node and select "New Node". Let’s call it "hello". The default type "nt:unstructured" is fine, leave it like that. You should not forget to press "Save All" in the upper left corner to persist your changes. Next, right-click on the "hello" node and add two String properties to the node: one property named "sling:resourceType" with value "tutorial" and another "content" with value "hello world". The node’s properties should now look like this:

    (again, please do not forget to press "Save All"). If you are surprised by this peculiar property name "sling:resourceType" have another look at the general overview on how microsling request processing works.

    Checking if it worked

    OK, so how do we display this fabulous node? Open Windows Explorer and head to the repositories WebDAV drive. We need to create a couple of folders; add the folders sling > scripts > tutorial.

     

     

    In the tutorial folder add a new file called "html.esp". It should contain:

    <html>
        <body>
            <%=resource.node.content%>
        </body>
    </html>

    If your text editor cannot edit files in a WebDAV drive you might have to create the file "html.esp" somewhere else and copy it to the tutorials folder. Now point your browser to http://localhost:7402/microsling/hello.html and you should see a beautiful "hello world".

    What has gone on? Microsling has selected the node "/hello" and injected it into the script "tutorial/html.esp" (remember the script resolution algorithm?). The script was executed by the server-side JavaScript engine (because its extension is ".esp"). The syntax of server-side JavaScript is much like that of JSPs so the bit between the <%= %> brackets was executed and written into the output stream. In the context of the script the requested node is available as "resource.node" and properties of the node can be accessed like object properties, i.e. with a simple dot notation. Hence, "resource.node.content" evaluates to the value of the property "content".

    If something went wrong with the script execution there will be an error in the server log. You can find them in your CRX installation at"server\logs".

    Great stuff. Your first microsling application is up and running. In the next post we will explore how to build something a tad more complex.

    PS: a little comment about WebDAV drives on Windows

    As discussed above coding microsling applications involves editing files (scripts) that reside in a WebDAV drive. That is not an issue if your text editor is capable of dealing with WebDAV. However, a number of editors are not capable of just that. Many of them can only deal with files that reside on drives that are mapped onto regular Windows drives.

    But there are tools to the rescue. They map WebDAV drives onto regular Windows drives (so your WebDAV drive shows up like D:\, E:\ etc). One of them is called WebDrive. You can get a demo version here: http://www.webdrive.com/download/index.html. Once this mapping is achieved you can use any text editor to edit the templates that render the content.

    PS: a little comment about namespaces

    Make sure that you have the "sling" namespace installed in CRX. For this, open the NodeType Administration application. In the upper right corner there is a button to open the Namespace dialog. Make sure it contains the Namespace URI "http://jackrabbit.apache.org/sling/1.0" with the prefix "sling". If not, please add this namespace.

    Posted by David Nuescheler DEC 12, 2007

    Posted in crx, microjax, microsling, sling and tutorial Comments 9

    µjax (microjax or ujax) is a client sided javascript persistence layer that leverages the symbiosis of a (JCR compliant) Content Repository and the agilepatterns of browser based ajax development, to form a completely new wayof developing applications.

    microjax is a part of Apache Sling which is currently in incubation.

    As an important differentiator to other Ajax frameworks µjax focuses onadding an attractive server-sided persistence and does not focuson providing a rich application framework with components, widgets or visual effects.µjax can be combined with any Ajax framework of your choosing.

    µjax uses XHR & JSON based AJAX techniques to retrieve contentand uses regular form input to write content.

     

    Download, Register & Install


    Prerequisites

    Knowledge of Javascript and HTML are required.

    An understanding of JCR is certainlyvery helpful to quickly start developing in µjax.

     

    Download

    The µjax pre-release can be downloaded attached (below) to this post pre-packed with the attached CRX builds.(Windows, Unix, Linux & macosx)

    Keep in mind:

    Nightly builds are intended to provide CRX Developers with the latestenhancements and bug fixes. A NIGHTLY BUILD IS NOT AN OFFICIAL RELEASEAND IT IS NOT TESTED BY QA. USE IT AT YOUR OWN RISK. IT IS RECOMMENDEDNOT TO USE A NIGHTLY BUILD ON A PRODUCTION SYSTEM, BUT TO USE IT FORDEVELOPMENT PURPOSES ONLY. DAY MANAGEMENT AG CANNOT BE HELD RESPONSIBLEFOR ANY DAMAGE THAT COULD BE CAUSED BY A NIGHTLY BUILD.

     

    Register

    To be able to install CRX you will have to get an evaluation license, which can beobtained by filling out the following form.

     

    Install

    µjax is only installed in the default installation of CRX, so pleaseselect that option in your downloaded CRX installer.

    The installation is very straight forward and does not have dependencies beyonda JDK 1.4 or greater.

     

    Mount your workspace

    To be able to interact with the content repository for development purposesit is recommended to use webdav and connect to
    http://localhost:7402/crx/repository/crx.default

    On Windows use "My Network Places" / "Add new network place"

    On macosx use "Go" / "Connect to Server" in Finder

     

    Look around

    Explore you content repository athttp://localhost:7402/crx, as soon as you start developing your applications you will find both your code and also the content your applicationscreate in the "Content Explorer".

    First Steps

    To get started please either use the test application below orjust extract the "firststeps.zip" (below) and drag and drop the "apps" folder into root folder of your webdav mount.

     

    Test application:

    Put the source code below into a test.html file and drag this into your mounted webdav drive:

    <html><head><title>Hello World</title><script src="/ujax/ujax.js"></script></head><body><script>var welcomeNode=ujax.getContent("/content/welcome");</script><h1>Welcome String:<script>if(welcomeNode)
    { document.write(welcomeNode.hello); }
    </script></h1><form action="/content/welcome" method="POST"><input name="hello" value="" /><input type="submit"></form><script>ujax.wizard();</script></body></html>

    and hit http://localhost:7402/test.html

    in your browser.

     

    µjax Version of "Stefano's Linotype"

    To get a feeling of a more real-life application feel free to downloadan µjax-ed version of Stefano's Linotypeyou can simply extract the "linotype.zip" (attached below)into the /apps folder of your webdav drive pointing at http://localhost:7402/

    After the installation hit http://localhost:7402/content/linotype/posts/*.post.htmland hit the save button to create your first blogentry. After creating the post you can surf to http://localhost:7402/content/linotype.html

    Please keep in mind that this is really just prototype to explain the µjaxbasic concepts and how they could be applied to existing web applicationswithout a lot of effort.

    * crx-ujax_windows_installer.exe
    crx-ujax_windows_installer.exe
    * crx-ujax_unix_macosx_installer.sh
    crx-ujax_unix_macosx_installer.sh
    * linotype.zip
    linotype.zip
    * firststeps.zip
    firststeps.zip

    Posted by Michael Marth DEC 12, 2007

    Posted in communique and link of the day Add comment

    Link of the day: David Dossot has left a comment on hist post "Jung Juggles Data Jungles" which shows a graph of the components and templates for a Day CQ application.
    (scroll to the the second comment of the post or see the image right here)

    Posted by Teresa Mulvihill DEC 12, 2007

    Posted in documentation and standards Comment 1

    I have been a documentation specialist for over eleven years and a steadfast supporter of DocBook for over six years. I'd tried my hand at DITA and gave it up as a fad; lots of bells and whistles, but too complicated to integrate. And couldn't DocBook do everything DITA promised anyway?

    So when Allette Systems contacted me to speak on XML standards in Sydney Australia, I jumped at the chance to prove to the documentation world just how wonderful DocBook is and how DITA falls short. Fortunately, my in-depth research opened my eyes to the benefits and limitations of both. Are these two seemingly rival standards really that different? My presentation answers this question with comparative examples, and allows you, the audience, to decide for yourselves.


    Posted by David Nuescheler DEC 09, 2007

    Posted in announcements, crx, microjax and microsling Add comment

    I am happy to be back at Javapolis this year, I will show "microjax" for the first time. microjax is developed as a part of microsling in the Apache Sling Project which is currently in the incubator. Javapolis is probably the largest european Java Developer conference and also great fun that I can whole-heartedly recommend.


    View Larger Map

    I think microjax is huge for two reasons:

    1. It grants direct a mash-up experience to client side developers that work with JCR based content repository infrastructure. This takes all the J2EE-heavyweight pain out of the application development experience.
    2. It is mind-boggling to think that all your code is executed on the client. I have been working for with microjax for the last couple of days to prepare, I am happy to report that its agility is mind blowing. I think this really changes the game in the sense that it completely removes changes the role of a traditional application server.

    Anyway, if you happen to be in Belgium please join me for the session on Kick starting the Content Repository. AJAX meets JCR.

    I am convinced that if you have any interest in Content Repositories this introduction to microjax is time very well spent.

    Posted by Michael Marth DEC 07, 2007

    Posted in jcr, modelling and poll Comments 2

    While writing about how this blog was built (soon to be published) I stumbled over a little question: how should I describe the way the content is structured. Sure, the blog has only a tiny content model, but still I wondered what would be the "right" way.

    One difficulty in describing a content model lies in the fact that you can structure your content with node types or you can use unstructured nodes and utilize the content hierarchy. Well, and then there is all sorts of mixtures of the two in between. This gives you basically two separate hierarchies (the node type hierarchy and the content hierarchy) that might be partially interwoven (ahm, no cms pun intended).

    There are also some communication aspects of describing the model. One aspect is the audience one tries to address. For example the documentation of a project might require a very formal way of describing the model. On the other hand, in a blog or in an email the main purpose of describing the model is getting across the essence, rather than being 100% accurate. Also, it probably makes a difference if one is concerned with a very large model with, say, 30 different node types or a very small one. However, these two aspects are not specific to content repository models, but also present in e.g. relational data modeling.

    So I started to investigate this question a bit and look around what others are doing to describe their content models. On one end of the spectrum there is the Compact Namespace and Node Type Definition (CND) is used. It is suitable for formally describing the node type hierarchy, but not the content hierarchy. The CRX Node Type Admin application exports definitions in this format. The CND is an offspring of the description language used in the JSR 170 specs which is considered to be more verbose.

    An obvious advantage of using this formal approach is that there is no room for interpretation and that it can be used by machines.

    On the other end of the spectrum is some ad-hoc ascii art like this:

    blog [nt:unstructured]
    |  +sling:resourceType[string]
    |--post [nt:unstructured]
    |    +title[string]
    |    +body[string]
    |    +sling:resourceType[string]
    |----comment [nt:unstructured]
    |      +body[string]
    |      +sling:resourceType[string]
    |----attachment [nt:file]

    It is not formalized but has the advantage that it is to understand. It is also capable of explaining a structure of interwoven hierarchies (node type and node hierarchy) at least for small content models. For larger or more models this approach will break down.

    Jukka Zitting has used a graphical ad-hoc method in this presentation (see slides 8-10):

    He displays both, node type hierarchy and content hierarchy. I like this approach, it is quite easy to understand (and will take you further regarding complex models than ascii art, I guess).

    I would really like to know what you people are using for communication your content models. Below, there is a little poll. Please let us know what you do. Cheers.

    Posted by Michael Marth DEC 06, 2007

    Posted in fud busting and jcr Comments 2

    This morning I came across this post on CMS watch where some alleged implications of using a JCR are discussed. It made me realize again that there are some misconceptions about JCRs out there. So I decided to start a little series of blog posts (with the heroic tag "FUD busting") where I try to shed some light on these misconceptions.

    The part of the CMS watch post that I would like to discuss:

    Gupta's comments weren't aimed specifically at JCR (the Java Content Repository initiative, also known as JSR 170 and now JSR 283), but he speculated that JCR, which effectively hides repositories behind one unified API, could be understood in the context of yet-another-hub-and-spoke-system. His point wasn't that JCR is evil or that abstraction layers aren't good, but that we know content exists in mini-silos all over the network, in heterogeneous systems, under non-centralized control. (And usually for good reasons.) Like it or not, the edges of the network tend to build out organically, resulting in what might be called "accidental architecture."

    The author describes JCR in the context of an enterprise architecture, implying that implementing a JCR would require a certain architecture or that it would prevent certain types of architecture. While he does not explicitly say so, he gives this impression.

    However, JCR does not at all dictate any kind of architecture. There is nothing that says you must have centralized control or similar. It is just an interface. Given the example above with many mini-silos some of them could be JCR repositories and some could not. Why should that be a problem? It might be a hassle due to the different interfaces that must be dealt with, but it is not an architectural problem for JCR.

    So, rather than thinking of JCR in terms of an architecture (like SOA) think of it as an interface (like HTTP). Really convenient to use, but without a penalty if you decide not to use it from time to time.

    Posted by Michael Marth DEC 05, 2007

    Posted in announcements and dev.day.com Add comment

    I am happy to announce a new feature of dev.day.com: an events calendar with public events of Day's R&D team. If you would like to get notified of upcoming events just subscribe your calendar or your RSS feed reader to the calendar. The calendar and the feed URLs can be found here: http://dev.day.com/microsling/content/blogs/main/calendar.html