GObject Introspection Content Repository

Piotr Pokora by Piotr Pokora on 07.11.2011

GICR is an effort to provide set of common API based on JCR one. It's written in vala, so it's fully introspectable by any language which supports GObject Introspection.

The part of project's readme summarizes it well:

By using GICR APIs, a GObject-based application can use the standard interfaces for nodes, tree management, versioning and structured queries regardless of how the data is actually stored.

There's gicr-midgard2 which is first and initial implementation of GICR.

Simple examples demonstrate easy of use:

Initialize repository:

Repository repository = get_repository ();

Create new session:

var credentials = new SimpleCredentials ("admin", "password");
Session session = repository.login (credentials, null);

From external xml file, import data to repository

session.import_xml ("/", Environment.get_current_dir () + "/import_example.xml", 0);

Persist data

session.save ();

You can create new session for the same repository

Session readSession = repository.login (null, null);

And get stored node by its path

GICR.Node exampleNode = readSession.get_node ("/tests_general_base/idExample");

And finally, read node's properties

stdout.printf ("Node type '%s' created at '%s' \n",
    exampleNode.get_node_property ("jcr:primaryType").get_string (),
    exampleNode.get_node_property ("jcr:created").get_string ()
);

Takaisin