JBoss Community Archive (Read Only)

ModeShape 5


The JCR 2.0 specification organizes the various features of the specification into several categories. The first are the mandatory features:

The specification then outlines some of the optional features:

ModeShape 5.x supports all of these JCR features except: content lifecycles and retention and hold.

Discovering support

The JCR API also provides a way for a user to dynamically discover which of these features a repository supports. Each Repository instance exposes descriptors for each of these behavioral features. The descriptor keys for a repository instance are accessible as are the individual values for each descriptor. Standard descriptor keys are defined by constants on the javax.jcr.Repository interface.

Here's a small sample of code that gets the various descriptors for a repository:

javax.jcr.Repository repository = ...
String[] keys = repository.getDescriptorKeys();
for ( String key : keys ) {
    boolean std = repository.isStandardDescriptor(key);
    boolean singleValued = repository.isSingleValueDescriptor(key);
    if ( singleValued ) {
        Value value = repository.getDescriptorValue(key);
    } else {
        Value[] values = repository.getDescriptorValues(key);

Note that the Value object is the same as what's used for property values, and the Value class has methods to obtain the value in the form of a String, boolean, long, double, java.util.Calendar, java.match.BigDecimal, java.io.InputStream, and javax.jcr.Binary objects.

Here's another example that shows how to determine the languages that are supported by a repository:

javax.jcr.Repository repository = ...
Value[] languages = repository.getDescriptorValues(Repository.QUERY_LANGUAGES);
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:12:18 UTC, last content change 2016-04-04 10:03:00 UTC.