javax.jcr.Repository
from a configuration file. After that, you just use
- the standard JCR API throughout your application.
+ JcrEngine
. After that, you obtain the
+ javax.jcr.Repository
instance for a named repository and just use the standard JCR API throughout your
+ application.
file:relativePathToConfigFile?repositoryName=yourRepositoryName
. In this example,
- the configuration file that specifies the repository setup will be loaded from the file path relativePathToConfigFile
and the repository named yourRepositoryName
- will be returned. If there is no repository with that name or the configuration file does not exist at that path, getRepository(Map)
will return null.
+ Obtaining a &JcrEngine; instance is very easy - assuming that you have a valid &JcrConfiguration; instance. We'll see
+ how to get one of those in a little bit, but if you have one then all you have to do is build and start the engine:
+ shutdown()
method is called, the &Repository; instances managed by the engine are marked as being shut down,
+ and they will not be able to create new &Session;s. However, any existing &Session;s or ongoing operations (e.g., event notifications)
+ present at the time of the shutdown()
call will be allowed to finish.
+ In essence, shutdown()
is a awaitTermination(...)
as shown above.
+ This method will block until the engine has indeed shutdown or until the supplied time duration has passed (whichever comes first).
+ And, yes, you can call the awaitTermination(...)
method repeatedly if needed.
Repository sources
Repositories
getRepository(String)
+ method, but each repository definition also can include the predefined namespaces (other than those automatically defined by
ModeShape), various options, and the node types that are to be available in the repository without explicit registration
through the JCR API.Loading from a file
Loading from a configuration repository
Programmatic configuration
file
parameter can actually be a &File; instance, a &URL; to the file, an &InputStream;
+ containing the contents of the file, or even a &String; containing the path to the file.
+ loadFrom(...)
methods can be called multiple times, but each time it completely wipes
+ out any current notion of the configuration and replaces it with the configuration found in the file.
+ loadFrom(&RepositorySource; source)
+ method:
+ save()
on the &JcrConfiguration; to store the configuration in the repository sources. To use that
+ configuration, just create &JcrConfiguration; objects using a &RepositorySource; pointed to the same persistent store,
+ and you're done. For more information, consult the &ReferenceGuide;.
+ loadFrom(&RepositorySource;,&Path;)
form, you can control where the configuration content is
+ stored in the repository. This is useful if you want to store multiple configurations in the same repository.
+ repositorySource(String)
is called, it will either load the existing definition with the supplied
+ name or will create a new definition if one does not already exist. To remove a definition, simply call remove()
+ on the result of repositorySource(String)
.
+ The set of existing definitions can be accessed with the repositorySources()
method.
+ sequencer(String)
is called, it will either load the existing definition with the supplied
+ name or will create a new definition if one does not already exist. To remove a definition, simply call remove()
+ on the result of sequencer(String)
.
+ The set of existing definitions can be accessed with the sequencers()
method.
+ mimeTypeDetector(String)
is called, it will either load the existing definition with the supplied
+ name or will create a new definition if one does not already exist. To remove a definition, simply call remove()
+ on the result of mimeTypeDetector(String)
.
+ The set of existing definitions can be accessed with the mimeTypeDetectors()
method.
+ repositoryName
JcrEngine
. After that, you obtain the
javax.jcr.Repository
instance for a named repository and just use the standard JCR API throughout your
- application. Alternatively, you can use the ModeShape implementation of the &RepositoryFactory; interface to access
- your repository.
+ application.
getRepository(Map)
method from the
- org.modeshape.jcr.api.RepositoryFactory
interface.
- configUrl
in the code snippets above would be something like file:relativePathToConfigFile?repositoryName=yourRepositoryName
.
- In this example, the configuration file that specifies the repository setup will be loaded from the file path relativePathToConfigFile
and
- the repository named yourRepositoryName
will be returned. If there is no repository with that name or the configuration file does not exist
- at that path, getRepository(Map)
will return null. The format for the configuration file is the same as used above
- when loading a &JcrConfiguration; object from a configuration file.
- configUrl
like file:///absolutePathToConfigFile?repositoryName=yourRepositoryName
- could have been used instead. Note the addition of the three forward slashes after the protocol portion of the URL (i.e., file:
). this indicates that the
- following path is an absolute path.
- jndi:///nameOfJndiResource?repositoryName=yourRepositoryName
. The nameOfJndiResource
is passed directly to
- a JNDI lookup
. If no &JcrEngine; exists at the given name, the getRepository(Map)
method will return null
. Also, any additional
- parameters besides JcrRepositoryFactory.URL
that are provided in the parameters map in the getRepository(Map)
method will be used
- in the constructor for the InitialContext
used to look up the JNDI reference.
- getRepository
invocation with a JNDI URL.
- shutdown(long, TimeUnit)
method is iterating over an internal
- collection of &JcrEngine;s and calling shutdown
and awaitTermination(long, TimeUnit)
on each engine.
- Long.MAX_VALUE
is returned.
- *
- * @return the number of seconds remaining until this lock times out.
- * @throws RepositoryException if an error occurs.
- * @since JCR 2.0
- */
- public long getSecondsRemaining() throws RepositoryException;
-
- /**
- * Returns true
if the current session is the owner of this lock, either because it is session-scoped and bound
- * to this session or open-scoped and this session currently holds the token for this lock. Returns false
- * otherwise.
- *
- * @return a boolean
.
- * @since JCR 2.0
- */
- public boolean isLockOwningSession();
-
-}
Index: modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/LockManager.java
deleted file mode 100644
===================================================================
--- modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/LockManager.java (revision 1860)
+++ /dev/null (working copy)
@@ -1,184 +0,0 @@
-/*
- * ModeShape (http://www.modeshape.org)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * ModeShape is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.modeshape.jcr.api;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-import javax.jcr.lock.Lock;
-import javax.jcr.lock.LockException;
-
-/**
- * Placeholder for the JCR 2.0 LockManager interface
- */
-public interface LockManager {
-
- /**
- * Adds the specified lock token to the current Session
. Holding a lock token makes the current
- * Session
the owner of the lock specified by that particular lock token.
- *
- * @param lockToken a lock token (a string).
- * @throws LockException if the specified lock token is already held by another Session
and the implementation
- * does not support simultaneous ownership of open-scoped locks.
- * @throws RepositoryException if another error occurs.
- */
- public void addLockToken( String lockToken ) throws LockException, RepositoryException;
-
- /**
- * Returns the Lock
object that applies to the node at the specified absPath
. This may be either a
- * lock on that node itself or a deep lock on a node above that node.
- *
- *
- * @param absPath absolute path of node for which to obtain the lock
- * @return The applicable Lock
object.
- * @throws LockException if no lock applies to this node.
- * @throws AccessDeniedException if the current session does not have sufficent access to get the lock.
- * @throws PathNotFoundException if no node is found at absPath
- * @throws RepositoryException if another error occurs.
- */
- public Lock getLock( String absPath ) throws PathNotFoundException, LockException, AccessDeniedException, RepositoryException;
-
- /**
- * Returns an array containing all lock tokens currently held by the current Session
. Note that any such tokens
- * will represent open-scoped locks, since session-scoped locks do not have tokens.
- *
- * @return an array of lock tokens (strings)
- * @throws RepositoryException if an error occurs.
- */
- public String[] getLockTokens() throws RepositoryException;
-
- /**
- * Returns true
if the node at absPath
holds a lock; otherwise returns false
. To
- * hold a lock means that this node has actually had a lock placed on it specifically, as opposed to just having a lock
- * apply to it due to a deep lock held by a node above.
- *
- * @param absPath absolute path of node
- * @return a boolean
.
- * @throws PathNotFoundException if no node is found at absPath
- * @throws RepositoryException if an error occurs.
- */
- public boolean holdsLock( String absPath ) throws PathNotFoundException, RepositoryException;
-
- /**
- *
- * Places a lock on the node at absPath
. If successful, the node is said to hold the lock.
- *
- * If isDeep
is true
then the lock applies to the specified node and all its descendant nodes; if
- * false
, the lock applies only to the specified node. On a successful lock, the jcr:lockIsDeep
- * property of the locked node is set to this value.
- *
- * If isSessionScoped
is true
then this lock will expire upon the expiration of the current session
- * (either through an automatic or explicit Session.logout
); if false, this lock does not expire until it is
- * explicitly unlocked, it times out, or it is automatically unlocked due to a implementation-specific limitation.
- *
- * The timeout parameter specifies the number of seconds until the lock times out (if it is not refreshed with
- * Lock.refresh
in the meantime). An implementation may use this information as a hint or ignore it altogether.
- * Clients can discover the actual timeout by inspecting the returned Lock
object.
- *
- * The ownerInfo
parameter can be used to pass a string holding owner information relevant to the client. An
- * implementation may either use or ignore this parameter. If it uses the parameter it must set the jcr:lockOwner
- * property of the locked node to this value and return this value on Lock.getLockOwner
. If it ignores this
- * parameter the jcr:lockOwner
property (and the value returned by Lock.getLockOwner
) is set to
- * either the value returned by Session.getUserID
of the owning session or an implementation-specific string
- * identifying the owner.
- *
- * The method returns a Lock
object representing the new lock. If the lock is open-scoped the returned lock will
- * include a lock token. The lock token is also automatically added to the set of lock tokens held by the current session.
- *
- * The addition or change of the properties jcr:lockIsDeep
and jcr:lockOwner
are persisted
- * immediately; there is no need to call save
.
- *
- * It is possible to lock a node even if it is checked-in.
- *
- * @param absPath absolute path of node to be locked
- * @param isDeep if true
this lock will apply to this node and all its descendants; if false
, it
- * applies only to this node.
- * @param isSessionScoped if true
, this lock expires with the current session; if false
it expires
- * when explicitly or automatically unlocked for some other reason.
- * @param timeoutHint desired lock timeout in seconds (servers are free to ignore this value); specify {@link Long#MAX_VALUE}
- * for no timeout.
- * @param ownerInfo a string containing owner information supplied by the client; servers are free to ignore this value.
- * @return A Lock
object containing a lock token.
- * @throws LockException if this node is not mix:lockable
or this node is already locked or isDeep
- * is true
and a descendant node of this node already holds a lock.
- * @throws AccessDeniedException if this session does not have sufficent access to lock this node.
- * @throws InvalidItemStateException if this node has pending unsaved changes.
- * @throws PathNotFoundException if no node is found at absPath
- * @throws RepositoryException if another error occurs.
- */
- public Lock lock( String absPath,
- boolean isDeep,
- boolean isSessionScoped,
- long timeoutHint,
- String ownerInfo )
- throws LockException, PathNotFoundException, AccessDeniedException, InvalidItemStateException, RepositoryException;
-
- /**
- * Returns true
if the node at absPath
is locked either as a result of a lock held by that node or
- * by a deep lock on a node above that node; otherwise returns false
.
- *
- * @param absPath absolute path of node
- * @return a boolean
.
- * @throws PathNotFoundException if no node is found at absPath
- * @throws RepositoryException if an error occurs.
- */
- public boolean isLocked( String absPath ) throws PathNotFoundException, RepositoryException;
-
- /**
- * Removes the specified lock token from this Session
.
- *
- * @param lockToken a lock token (a string)
- * @throws LockException if the current Session
does not hold the specified lock token.
- * @throws RepositoryException if another error occurs.
- */
- public void removeLockToken( String lockToken ) throws LockException, RepositoryException;
-
- /**
- * Removes the lock on the node at absPath
. Also removes the properties jcr:lockOwner
and
- * jcr:lockIsDeep
from that node. As well, the corresponding lock token is removed from the set of lock tokens
- * held by the current Session
.
- *
- * If the node does not currently hold a lock or holds a lock for which this Session
is not the owner and is not
- * a "lock-superuser", then a LockException
is thrown. Note that the system may give permission to a non-owning
- * session to unlock a lock. Typically, such "lock-superuser" capability is intended to facilitate administrational clean-up
- * of orphaned open-scoped locks.
- *
- * Note that it is possible to unlock a node even if it is checked-in (the lock-related properties will be changed despite the - * checked-in status). - *
- * If the current session does not have sufficient privileges to remove the lock, an AccessDeniedException
is
- * thrown.
- *
- * @param absPath absolute path of node to be unlocked
- * @throws LockException if this node does not currently hold a lock or holds a lock for which this Session does not have the
- * correct lock token.
- * @throws AccessDeniedException if the current session does not have permission to unlock this node.
- * @throws InvalidItemStateException if this node has pending unsaved changes.
- * @throws PathNotFoundException if no node is found at absPath
- * @throws RepositoryException if another error occurs.
- */
- public void unlock( String absPath )
- throws PathNotFoundException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException;
-}
Index: modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/Repository.java
===================================================================
--- modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/Repository.java (revision 1860)
+++ modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/Repository.java (working copy)
@@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import javax.jcr.Value;
/**
* Replicates JCR 2.0's Repository interface.
@@ -12,433 +11,6 @@ import javax.jcr.Value;
public interface Repository extends javax.jcr.Repository {
/**
- * Key to a boolean
descriptor. Returns true
if and only if repository content can be updated
- * through the JCR API (as opposed to having read-only access).
- *
- * @since JCR 2.0
- */
- public static final String WRITE_SUPPORTED = "write.supported";
-
- /**
- * Key to a String
descriptor. Returns one of the following javax.jcr.Repository
constants
- * indicating the stability of identifiers:
- *
- *
- *
- *
- *
- *
IDENTIFIER_STABILITY
. Indicates that identifiers may change
- * between method calls.
- *
- * @since JCR 2.0
- */
- public static final String IDENTIFIER_STABILITY_METHOD_DURATION = "identifier.stability.method.duration";
-
- /**
- * One of four possible values for the descriptor IDENTIFIER_STABILITY
. Indicates that identifiers are guaranteed
- * stable within a single save/refresh cycle.
- *
- * @since JCR 2.0
- */
- public static final String IDENTIFIER_STABILITY_SAVE_DURATION = "identifier.stability.save.duration";
-
- /**
- * One of four possible values for the descriptor IDENTIFIER_STABILITY
. Indicates that identifiers are guaranteed
- * stable within a single session.
- *
- * @since JCR 2.0
- */
- public static final String IDENTIFIER_STABILITY_SESSION_DURATION = "identifier.stability.session.duration";
-
- /**
- * One of four possible values for the descriptor IDENTIFIER_STABILITY
. Indicates that identifiers are guaranteed
- * to be stable forever.
- *
- * @since JCR 2.0
- */
- public static final String IDENTIFIER_STABILITY_INDEFINITE_DURATION = "identifier.stability.indefinite.duration";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if XML export is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_XML_EXPORT_SUPPORTED = "option.xml.export.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if XML import is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_XML_IMPORT_SUPPORTED = "option.xml.import.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if unfiled content is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_UNFILED_CONTENT_SUPPORTED = "option.unfiled.content.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if full versioning is supported.
- */
- public static final String OPTION_VERSIONING_SUPPORTED = "option.versioning.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if simple versioning is supported.
- */
- public static final String OPTION_SIMPLE_VERSIONING_SUPPORTED = "option.simple.versioning.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if activities are supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_ACTIVITIES_SUPPORTED = "option.activities.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if configurations and baselines are
- * supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_BASELINES_SUPPORTED = "option.baselines.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if access control is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_ACCESS_CONTROL_SUPPORTED = "option.access.control.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if journaled observation is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_JOURNALED_OBSERVATION_SUPPORTED = "option.journaled.observation.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if retention and hold are supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_RETENTION_SUPPORTED = "option.retention.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if lifecycles are supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_LIFECYCLE_SUPPORTED = "option.lifecycle.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if workspace management is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_WORKSPACE_MANAGEMENT_SUPPORTED = "option.workspace.management.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if the primary node type of an existing
- * node can be updated.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED = "option.update.primary.node.type.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if the mixin node types of an existing node
- * can be added and removed.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED = "option.update.mixin.node.types.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if the creation of shareable nodes is
- * supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_SHAREABLE_NODES_SUPPORTED = "option.shareable.nodes.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if node type management is supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED = "option.node.type.management.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if node and property with same name is
- * supported.
- *
- * @since JCR 2.0
- */
- public static final String OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED = "option.node.and.property.with.same.name.supported";
-
- /**
- * Key to String
descriptor. Returns one of the following javax.jcr.Repository
constants indicating
- * the level of support for node type inheritance:
- * NODE_TYPE_MANAGEMENT_INHERITANCE
. Indicates that registration
- * of primary node types is limited to those which have only nt:base as supertype. Registration of mixin node types is limited
- * to those without any supertypes.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_INHERITANCE_MINIMAL = "node.type.management.inheritance.minimal";
-
- /**
- * One of three possible values for the descriptor NODE_TYPE_MANAGEMENT_INHERITANCE
. Indicates that registration
- * of primary node types is limited to those with exactly one supertype. Registration of mixin node types is limited to those
- * with at most one supertype.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE = "node.type.management.inheritance.single";
-
- /**
- * One of three possible values for the descriptor NODE_TYPE_MANAGEMENT_INHERITANCE
. Indicates that primary node
- * types can be registered with one or more supertypes. Mixin node types can be registered with zero or more supertypes.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_INHERITANCE_MULTIPLE = "node.type.management.inheritance.multiple";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if override of inherited property or child
- * node definitions is supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED = "node.type.management.overrides.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if primary items are supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED = "node.type.management.primary.item.name.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if preservation of child node ordering is
- * supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED = "node.type.management.orderable.child.nodes.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if residual property and child node
- * definitions are supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED = "node.type.management.residual.definitions.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if autocreated properties and child nodes
- * are supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED = "node.type.management.autocreated.definitions.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if same-name sibling child nodes are
- * supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED = "node.type.management.same.name.siblings.supported";
-
- /**
- * Key to a long[]
descriptor. Returns an array holding the javax.jcr.PropertyType
constants for the
- * property types (including UNDEFINED
, if supported) that a registered node type can specify, or a zero-length
- * array if registered node types cannot specify property definitions.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_PROPERTY_TYPES = "node.type.management.property.types";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if multivalue properties are supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED = "node.type.management.multivalued.properties.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if registration of a node types with more
- * than one BINARY
property is permitted.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED = "node.type.management.multiple.binary.properties.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true if and only value-constraints are supported.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED = "node.type.management.value.constraints.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true if and only the update of node types is supported for node types
- * currently in use as the type of an existing node in the repository.
- *
- * @since JCR 2.0
- */
- public static final String NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED = "node.type.management.update.in.use.suported";
-
- /**
- * Key to a String[]
descriptor. Returns an array holding the constants representing the supported query
- * languages, or a zero-length if query is not supported.
- *
- * @since JCR 2.0
- */
- public static final String QUERY_LANGUAGES = "query.languages";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if stored queries are supported.
- *
- * @since JCR 2.0
- */
- public static final String QUERY_STORED_QUERIES_SUPPORTED = "query.stored.queries.supported";
-
- /**
- * Key to a boolean
descriptor. Returns true
if and only if full-text search is supported.
- *
- * @since JCR 2.0
- */
- public static final String QUERY_FULL_TEXT_SEARCH_SUPPORTED = "query.full.text.search.supported";
-
- /**
- * Key to String
descriptor. Returns one of the following javax.jcr.Repository
constants indicating
- * the level of support for joins in queries:
- * QUERY_JOINS
- *
. Indicates that joins are not supported. Queries are limited to a
- * single selector.
- *
- * @since JCR 2.0
- */
- public static final String QUERY_JOINS_NONE = "query.joins.none";
-
- /**
- * One of three possible values for the descriptor QUERY_JOINS
- *
. Indicates that inner joins are supported.
- *
- * @since JCR 2.0
- */
- public static final String QUERY_JOINS_INNER = "query.joins.inner";
-
- /**
- * One of three possible values for the descriptor QUERY_JOINS
- *
. Indicates that inner and outer joins are supported.
- *
- * @since JCR 2.0
- */
- public static final String QUERY_JOINS_INNER_OUTER = "query.joins.inner.outer";
-
- /**
- * Returns a string array holding all descriptor keys available for this implementation, both the standard descriptors defined
- * by the string constants in this interface and any implementation-specific descriptors. Used in conjunction with
- * {@link #getDescriptorValue(String key)} and {@link #getDescriptorValues(String key)} to query information about this
- * repository implementation.
- *
- * @return a string array holding all descriptor keys.
- */
- public String[] getDescriptorKeys();
-
- /**
- * Returns true
if key
is a standard descriptor defined by the string constants in this interface
- * and false
if it is either a valid implementation-specific key or not a valid key.
- *
- * @param key a descriptor key.
- * @return whether key
is a standard descriptor.
- * @since JCR 2.0
- */
- public boolean isStandardDescriptor( String key );
-
- /**
- * Returns true
if key
is a valid single-value descriptor; otherwise returns false
.
- *
- * @param key a descriptor key.
- * @return whether the specified desdfriptor is multi-valued.
- * @since JCR 2.0
- */
- public boolean isSingleValueDescriptor( String key );
-
- /**
- * The value of a single-value descriptor is found by passing the key for that descriptor to this method. If key
- * is the key of a multi-value descriptor or not a valid key this method returns null
.
- *
- * @param key a descriptor key.
- * @return The value of the indicated descriptor
- * @since JCR 2.0
- */
- public Value getDescriptorValue( String key );
-
- /**
- * The value array of a multi-value descriptor is found by passing the key for that descriptor to this method. If
- * key
is the key of a single-value descriptor then this method returns that value as an array of size one. If
- * key
is not a valid key this method returns null
.
- *
- * @param key a descriptor key.
- * @return the value array for the indicated descriptor
- * @since JCR 2.0
- */
- public Value[] getDescriptorValues( String key );
-
- /**
* An immutable collection of "standard" descriptors, as defined in the JSR-283 specification.
*/
public static final Set
* This design is patterned after the similar funcationality in the JCR 2.0 Public Final Draft (PFD), and will
* eventually be migrated to implement the specification when ModeShape supports the final JCR 2.0 final specification.
Index: modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrNodeTest.java
===================================================================
--- modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrNodeTest.java (revision 1860)
+++ modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractJcrNodeTest.java (working copy)
@@ -48,15 +48,14 @@ import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.Workspace;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeDefinitionTemplate;
import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeTemplate;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.modeshape.graph.Graph;
import org.modeshape.graph.connector.inmemory.InMemoryRepositorySource;
-import org.modeshape.jcr.nodetype.NodeDefinitionTemplate;
-import org.modeshape.jcr.nodetype.NodeTypeTemplate;
-import org.modeshape.jcr.nodetype.PropertyDefinitionTemplate;
/**
*
@@ -833,7 +832,7 @@ public class AbstractJcrNodeTest extends AbstractJcrTest {
}
NodeTypeTemplate ntt = nodeTypes.createNodeTypeTemplate();
- PropertyDefinitionTemplate pdt = nodeTypes.createPropertyDefinitionTemplate();
+ JcrPropertyDefinitionTemplate pdt = (JcrPropertyDefinitionTemplate)nodeTypes.createPropertyDefinitionTemplate();
NodeDefinitionTemplate ndt = nodeTypes.createNodeDefinitionTemplate();
pdt.setName("autoProp");
@@ -842,8 +841,8 @@ public class AbstractJcrNodeTest extends AbstractJcrTest {
pdt.setAutoCreated(true);
ndt.setName("autoChild");
- ndt.setRequiredPrimaryTypes(new String[] {"nt:base"});
- ndt.setDefaultPrimaryType("nt:unstructured");
+ ndt.setRequiredPrimaryTypeNames(new String[] {"nt:base"});
+ ndt.setDefaultPrimaryTypeName("nt:unstructured");
ndt.setAutoCreated(true);
ntt.setName("autocreateTest");
Index: modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractSessionTest.java
===================================================================
--- modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractSessionTest.java (revision 1860)
+++ modeshape-jcr/src/test/java/org/modeshape/jcr/AbstractSessionTest.java (working copy)
@@ -35,6 +35,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeTypeTemplate;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
@@ -52,7 +54,6 @@ import org.modeshape.graph.property.NamespaceRegistry;
import org.modeshape.graph.property.Path;
import org.modeshape.graph.property.PathFactory;
import org.modeshape.graph.query.parse.QueryParsers;
-import org.modeshape.jcr.nodetype.NodeTypeTemplate;
import org.modeshape.jcr.xpath.XPathQueryParser;
/**
@@ -187,7 +188,7 @@ public abstract class AbstractSessionTest {
registry = session.getExecutionContext().getNamespaceRegistry();
}
- protected List