Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

The JCR browser is a tool for exploring the Java Content Repository (JCR) used by XperienCentral to store website data. It allows you to browse through the repository by expanding/collapsing sub trees in the same way as with File Explorer in Microsoft Windows. You can perform the following operations on JCR tree items:

  • Nodes - you can create, move and delete.
  • Properties - you can create, edit and delete.

Due to node type definitions, the JCR browser cannot perform all operations on every node. If you try to create an improper child node or property, the JCR browser will return an error. Additonally, you can perform queries on the JCR tree. With queries you can search for specific content.d read it. The JCR browser supports the XPath and SQL syntaxes.

 

In This Topic

 


Introduction to JCR

 

 Click here for an introduction to the Content Repository API for Java (JCR)

A Java Content Repository (JCR) is a database with a standardized Java Application Programming Interface (API). A JCR allows different applications to access one centralized database. Other technologies that are comparable to JCR are JDBC, Hibernate and WebDAV. Unlike relational databases, a JCR has a hierarchical tree structure. The tree consists of nodes and properties. The properties are the leaves of the tree and represent the actual pieces of database content. A property is of one of the following types: string, binary, date, a number type, boolean, name, path or reference.

 

 

 

In addition, a node contains attributes that are related to the node itself, for example the name of the node, its path in the tree, its depth in the tree and its type. Therefore, a node has attributes and it contains properties. The organization of the repository into a tree structure is done by the JCR Browser: Internally the content may be stored in a relational database.

Node Types

Every node has one primary node type. The primary node type defines the properties and child nodes that it is allowed or required to have. Every node has a special property called jcr:primaryType that records the name of its primary node type. In addition to its primary node type, a node may also have one or more mixin types. A mixin node type can mandate more child nodes and properties in addition to those enforced by its primary node type.

Multi-value Properties

In some cases, a property may have more than one value. A property that may have more than one value is referred to as a multi-value property. The property definition determines whether a particular property is a multi-value property.

Standardized by JCP

JCR has been standardized by the Java Community Process (JCP) in JSR 170 (API version 1.0) and JSR 283 (API version 2.0). Depending on the API version and compliance level, a JCR may support the following:

  • Read-only or read/write access
  • Different types of nodes and properties
  • Simple or full versioning and multiple languages
  • Query languages like XPath, SQL, SQL2, AQM, JQOM
  • Locking
  • Observation of content changes
  • Export and import of content via XML files
  • JTA (XA transactions)

 

See also: http://jcp.org

 


Using the XperienCentral JCR Browser

To start and use the JCR Browser, follow these steps:

  1. Navigate to Configuration -> JCR Browser.
  2. Select the [JCR Browser] tab.
  3. Browse through the tree by expanding or collapsing node sub trees in the "JCR Repository" section.. To expand click + (plus) and to collapse click – (minus).
  4. To select a node, click its icon or name. The attributes of the selected node and the properties it contains, are shown at the right.

Display Tree Property

In the tree view, the name of each node is shown. However, in certain cases the actual node name may be irrelevant. For these cases, you can view a property of the node instead of its name. The property is shown in the "Display tree property" field. By default it is set to wm:name. This means that for each node the tree viewer tries to find a wm:name property. If a property is present, the value of this property will be shown. If not, the actual node name will be shown.

For example: when you execute the XPath query //element(*, wo:global), the result may be a node that is labeled as follows:

  • If the "Display tree property" field is empty, you may see something similar to 751b14124e9caf40ed6c7822d6de. If you expand the tree, you may see something like wo:edit for the child node.
  • If the "Display tree property" field is set to wm:name, you may see something like global. If you expand the tree, you may see something like edit for the child node.

Sort by Name

Select "Sort by name" to view the nodes in the tree in alphabetical order.

Following a Tree Reference

If a property is a reference in the JCR tree, its value is shown as a link. Click on the link to navigate to the referenced node in the JCR tree.



Back to top


Operations with Nodes

Creating a Node

  1. Select the node in which the new (sub) node is to be created.
  2. Press the [Add node] button. The ‘Create node’ dialog is added to the screen.



  3. From the pull-down menu, select the node type to be created.
  4. Enter the node name.
  5. Press the [Create node] button. The node is added.

Moving a Node

  1. Select the node to be moved.
  2. Press the [Cut] button.
  3. Select the destination node.
  4. Press the[Paste] button. The node including its properties and subtrees is moved to the destination.

Deleting a Node

  1. Select the node to be deleted.
  2. In the ‘Actions’ dialog, press the[Delete]button. You are prompted to confirm.
  3. Press [OK]. The node including its properties and subtrees is deleted.



Back to top


Operations with Properties

Creating a Property

  1. Select the node in which the property is to be created.
  2. Press the [Add property] button. The ‘Add property’ dialog is added to the screen.
  3. From the pull-down menu, select the definition of the property to be created.
  4. Enter the name of the property.
  5. From the pull-down menu, select the type of the property to be created.
  6. To define a multi-value property, check ‘Multiple’ (see also: Multi-value properties). The [Add value] button will be added.
  7. Enter the (first) value of the property.
  8. Press the [Add] button. The property is added.
  9. In the case of a multi-value property: to add an other value (instance), enter the other value and press [Add value]. The other value is added.

Editing a Property

  1. Press the Edit button of the property to be edited. The ‘Edit property’ dialog is added to the screen.
  2. Make the desired changes.
  3. Press [Set]. The property is changed.

By pressing [Add value] instead of [Set] you create a new instance of the property.

Deleting a Property

  1. Check the Delete checkbox of the property to be deleted.
  2. Press the[Delete]button. You are prompted to confirm.
  3. Press [OK]. The property is deleted.



Back to top


Using JCR Queries

By way of example, the JCR browser is provided with a list of preprogrammed XPath and SQL queries. To this list, you can add your own queries. Your queries are saved and you can edit them afterwards. To execute a query, you just select one from the list, make some adaptations if you like and then execute it.

Creating or Editing a Query

  1. Select the JCR Queries tab.
  2. From the Queries pull-down menu, select ‘New query’, or an existing query. Notice that you cannot edit preprogrammed queries.
  3. Enter or change the name of the query.
  4. Select the query syntax type ‘Xpath’ or ‘SQL’.
  5. Enter or change the actual query. See also: Query examples: SQL versus XPath)
  6. Press [Apply] to save the query on the list.

Query Examples: SQL Versus XPath

SQLXPath
SELECT * FROM nt:base//*
SELECT * FROM my:type//element(*, my:type)
SELECT my:title FROM my:type//element(*, my:type)/@my:title
SELECT my:title, my:text FROM my:type//element(*, my:type)/ (@my:title | @my:text)
SELECT * FROM my:type WHERE jcr:path LIKE '/nodes[%]/%'/jcr:root/nodes// element(*, my:type)
SELECT * FROM my:type WHERE my:title='JSR 170'//element(*, my:type) [@my:title = 'JSR 170']
SELECT * FROM my:type WHERE my:title <> 'JSR 170'//element(*, my:type) [@my:title != 'JSR 170']
SELECT * FROM my:type WHERE my:title = 'JSR 170' AND my:author = 'David'//element(*, my:type) [@my:title = 'JSR 170' and @my:author = 'David']
SELECT * FROM my:type WHERE NOT (my:title = 'JSR 170')//element(*, my:type) [not(@my:title = 'JSR 170')]
SELECT * FROM my:type WHERE my:title IS NOT NULL//element(*, my:type) [@my:title]
SELECT * FROM my:type WHERE my:title IS NULL//element(*, my:type) [not(@my:title)]
SELECT * FROM my:type WHERE my:title LIKE 'JSR 170%'//element(*, my:type) [jcr:like(@my:title, 'JSR 170%')]
SELECT * FROM my:type WHERE CONTAINS(*, 'JSR 170')//element(*, my:type) [jcr:contains(., 'JSR 170')]
SELECT * FROM my:type WHERE jcr:path LIKE'/some[%]/nodes[%]'/jcr:root/some/ element(nodes, my:type)
SELECT * FROM my:type WHERE jcr:path = '/some/nodes'/jcr:root/some[1]/element(nodes, my:type)[1]
SELECT * FROM my:type WHERE jcr:path LIKE '/some[%]/nodes[%]/%' AND NOT jcr:path LIKE '/some[%]/nodes[%]/%/%'/jcr:root/some/nodes/ element(*, my:type)
SELECT * FROM my:type WHERE jcr:path LIKE '/some/nodes/%' AND NOT jcr:path LIKE '/some/nodes/%/%'/jcr:root/some[1]/nodes[1]/ element(*, my:type)
SELECT * FROM my:type WHERE jcr:path LIKE '/some[%]/nodes[%]/%'/jcr:root/some/nodes// element(*, my:type)
SELECT * FROM my:type WHERE jcr:path LIKE '/some/nodes/%'/jcr:root/some[1]/nodes[1]// element(*, my:type)
SELECT * FROM my:type WHERE jcr:path LIKE '/some[%]/nodes[%]' OR jcr:path LIKE '/some[%]/nodes[%]/%'/jcr:root/some/nodes// element(*, my:type)
SELECT * FROM my:type WHERE jcr:path = '/some/nodes' OR jcr:path LIKE '/some/nodes/%'/jcr:root/some[1]/nodes[1]// element(*, my:type)

Deleting a Query from the List

  1. Select the JCR Queries tab.
  2. From the Queries pull-down menu, select the query you want to delete. Notice that you cannot delete preprogrammed queries.
  3. Press [Delete query]. The query is removed from the list.

Executing a Query

  1. Select the JCR Browser tab.
  2. Press the [More] button. The ‘Query execution’ dialog is added to the screen.
  3. From the pull-down menu, select the query, for instance ‘MyNodeTypes XPath’.
  4. If desired, adapt the query to your needs.
  5. Press the [Execute query] button. The results appear on the Query results tab.



Back to top

 

 

 

 

 

 

  • No labels