CR combines the aspect of file systems and databases, and equally offer 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 Content Repository through Java online course
Actually, First JSR 170 released then after JSR 283 released in 2009. But here repository supports JSR 170. The JCR Has a 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.
Java Content Repository
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 many ways to do this, in Jackrabbit's case, we can use a Transient Repository class to simplify setup for simple experiments.
The Repository class allows 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 = new Transient Repository(); Session session = repository.login(...);
Now we have to get a Session and, create a simple subtree with a certain output, when we give a/hello/world node then, we get output is hello, JCR World!.
The JCR API adds more than the few simple interfaces, but those by most widely used parts of the API. The content management products involve just the Node and Property interfaces.
Unstructured content:
We Have to correct definitions of content models, 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 types of content would be painful, especially when we are prototyping or analyzing JCR. The unstructured node type comes to 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...$ curlhttp://admin:admin@localhost:8888/foo.tidy.infinity.json{ "title": "Hello, JCR", "jcr:primary type": "nt:unstructured"}
Sling's HTTP interface via curl -Fit, a single title property. To read the node, we make an HTTP GET request by /foo.tidy.infinity.json path. That which tells Sling to return a formatted JSON, JSON represents the /foo node, and all its child nodes and properties.
Scratched the surface of JCR:
1.Whenever the combination of structured & unstructured data in content, then it will provide a lot of flexibility, and content model coercion, can use selectively where they make sense.2. The storage model uses simple Property interfaces and Node, no need to study tons of documentation to use it.3. Java API leads to fairly plain code. And although objects to content mappers are available for JCR they usually not necessary. Working directly with micro trees straightforward and close to the domain model of structured content.The total concept explains many 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.
These are the best-known facts about Java Content Repository, in upcoming blogs, we will update more Data on it.