Java Content Repository - The Best Of Both Worlds
Click to rate this post!
[Total: 0 Average: 0]

What is JCR?

JCR the Java Content Repository, JSR-170 says that a content repository composed of a no. of workspaces, which should normally contain similar to fulfilled at all. A Java Content Repository – The Best Of Both Worlds having one or more workspaces. Each workspace has a single rooted tree of items. An item is either a node or a property. Each node has zero or more than child nodes & child properties. Only the root node does not have parent and all other nodes have exactly one parent. Every workspace has only one root node. Leaf node as a parent of Properties and it doesn’t have children; they are leaves of the trees. There all repository stored within the values of the properties.

java online course at onlineitguruCR combines the aspect of file systems and databases, and equally provides the best of both worlds using paths to locate atoms of contents, creating small trees to manage units of content, and still having database features like the structured transactions & etc..  that’s quite different in the world of content management.

Know more about Java from OnlineITGuru through Java online course.

 Actually, First JSR 170 released then after JSR 283 released in 2009.but here repository  Only supports JSR 170. The JCR  Have tree of nodes and properties nodes used to organize the content. Named properties used to store the actual data, either as simple types strings or as binary streams for storing files of random size.

The API:  Nodes and Properties

The main elements of the APIs,  ones we can do to create and retrieve the content, sending those under the hood to the process of HTTP requests.

First, we need to acquire an object of Repository. There are various ways of doing this, in Jackrabbit’s case we can use a Transient Repository class to simplify setup for simple experiments.

The Repository class allows then getting to log in and get a Session, which in turn allows and we can create and retrieve the content. The Session tied to a Workspace each workspace can store a distinct tree of nodes and properties, but We will use the default workspace sometimes.

Repository repository = new Transient Repository(); Session session = repository.login(…);

Now that we have to get a Session and create a simple subtree with certain output we are giving a/hello/world node then we are getting output is hello, JCR World!.

The JCR API add much more than the few simple interfaces but those by far the most widely used parts of the API.  The content management products involve just the Node and Property interfaces.

Unstructured content:

We Having correct definitions of content models, for example file storage, it very useful for content that has a well defined and stable structure.

Having to define such node types for all type of content would be painful, especially when we are prototyping or analyze JCR. The unstructured node type comes to the recovery by allowing a node to have any properties and child nodes of any type. For example, we can use Sling’s HTTP interface to create content.

$ curl -D – -F “title=hello,
JCR” http://admin:admin@localhost:8888/fooHTTP/1.1 200 OKContent-Type: text/html;
charset=utf-8…$ curl
http://admin:admin@localhost:8888/foo.tidy.infinity.json{ “title”: “Hello, JCR”, “jcr:primaryType”: “nt:unstructured”}

Sling’s HTTP interface via curl -F it single title property. To read the node, we make an HTTP GET request by /foo.tidy.infinity.json path, which tells Sling to return a formatted JSON, JSON represents the /foo node and all it child nodes and properties.

Scratched the surface of JCR:

  • Whenever the combination of structured & unstructured in content then it will provide a lot of flexibility, and content model coercion can be used selectively where they make sensibility.
  • The storage model can use simple Property interfaces and Node, no need to study tons of documentation to use it.
  • The API leads to fairly plain code. And although object to content mappers are available for JCR they are usually not necessary. Working directly with micro trees straightforward and close to the domain model of structured content

The total concept explains the various ways in which Nodes and properties accessed. Using tree navigation.Good content models allow going a long way without using queries, obviously needed at some point. When content created or modified very powerful and might bit incredible.

Recommended Audience :

Software Developer

Team Lead’s

Project Managers


Java you can get started by understanding Concepts. It’s good if the people have knowledge of programming and some IT operations. Trainers of Online IT Guru will teach you if you don’t have knowledge of Java Concepts.

Master in Java from onlineITGuru through Java Online Course

Drop Us A Query

100% Secure Payments. All major credit & debit cards accepted.

Call Now Button