Archive

Archive for September, 2010

Italian popular gestures

30 September 2010 Leave a comment



I think it should be better with animated images, but anyway they looks funny :) Thanks to Alfredo Cassano

Tags:

JSON, graphs and Apache Sling

28 September 2010 2 comments

Yesterday I was looking an interesting javascript library, JIT (JavaScript InfoVis Toolkit), that is really useful to create some cool rappresentation of your data with graphs, trees, charts and so on.

This toolkit creates different data rappresentation using JSON as input, so I thought it could be funny to integrate with Apache Sling to have a new rappresentation of my repository.

Unfortunately JSON translation in Apache Sling is a bit different from the one used in JIT, because it needs children node rappresented as an array (not in every demo contained in JIT but in the one I want so integrate with Sling).

So I modified org.apache.sling.commons.json.jcr.JsonItemWriter , to encapsulate the nodes in a JSON array

Iterator children = resource.listChildren();
if (children.hasNext()) {
	w.key("children");
	w.array();
	while (children.hasNext()) {
		Resource n = children.next();
		log.info("Giro "+n.getName());
		dump(n);
	}
	w.endArray();
}

Now I have to load some data on my instance of Apache Sling, so I create a simple JSON.

{
	"id": "node01",
	"name": "0.2",
	"data": "",
	"jcr:primaryType":"sling:Folder",
	"node11": {
		"id": "node13",
		"name": "1.3",
		"data": "",
		"jcr:primaryType":"sling:Folder",
		"node111": {
...
...

Finally I have to load this data into JIT, so I modified an example to load JSON data from an external source

function init() {
	$.ajax({
		url: "http://localhost:8080/repository.infinity.json",
		success: postInit
	});
}

So I got a very cool rappresentation of my data stored with JCR


A volte ritornano…

16 September 2010 Leave a comment

Non che se ne sentisse troppo la mancanza, ma sono finalmente riuscito a recuperare le sciocchezze scritte in questo blog.

Un ringraziamento speciale a Feedburner che chissà per quale strano motivo memorizza il feed a tempo indeterminato :)

Tags:
Follow

Get every new post delivered to your Inbox.