What is JCR?

JCR is the Java Content Repository, JSR-170 says that a content repository is 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 is all repository is 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 was released then after JSR 283 was released in 2009.but here repository  Only supports JSR 170. The JCR  Having tree of nodes and properties here nodes are used to organize the content, and named properties are 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 is 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 TransientRepository(); 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 are by far the most widely used parts of the API.  The content management products involve just the Node and Property interfaces.

Unstructured content:

We are Having correct definitions of content models, as the for example file storage, it is 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 is single title property, To read the node, we make an HTTP GET request using the /foo.tidy.infinity.json path, which tells Sling to return a formatted JSON, here JSON represents the /foo node and all its 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 is straightforward and close to the domain model of structured content

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

Recommended Audience :

Software Developer

Team Lead’s

Project Managers

Prerequisites:

Java you can get started by understanding its 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 Bangalore.

 
Drop Us A Query

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