3.2.2.1. Requirements

Connection creation and reuse should be a thread safe operation. Connection provides CRUD operations support on the storage.

Read operations

ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException;
ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException, IllegalStateException;
List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException;
List<NodeData> getChildNodesData(NodeData parent, ListList<QPathEntryFilter> pattern) throws RepositoryException, IllegalStateException;
List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException;
List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException, IllegalStateException;

This method is specially dedicated for non-content modification operations (for example, Items delete).

List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException;

It is the REFERENCE type: Properties referencing Node with the given nodeIdentifier. See more in javax.jcr.Node.getReferences().

List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException, IllegalStateException, UnsupportedOperationException;
boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int toOrderNum, List<NodeData> childs) throws RepositoryException;
int getChildNodesCount(NodeData parent) throws RepositoryException;
int getLastOrderNumber(NodeData parent) throws RepositoryException;

Write operations

void add(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void add(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void update(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void update(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void rename(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void delete(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void delete(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
void prepare() throws IllegalStateException, RepositoryException;
void commit() throws IllegalStateException, RepositoryException;
void rollback() throws IllegalStateException, RepositoryException;

All methods throw IllegalStateException if connection is closed, UnsupportedOperationException if the method is not supported (for example, JCR Level 1 implementation) and RepositoryException if some errors occur during preparation, validation or persistence.

State operations

boolean isOpened();

Validation of write operations

Container has to care about storage consistency (JCR constraints) on write operations: (InvalidItemStateException should be thrown according the specification). At least, the following checks should be performed:

Consistency of save

The container (connection) should implement consistency of Commit (Rollback) in transaction manner. For example, if a set of operations was performed before the future Commit and another next operation fails. It should be possible to rollback applied changes using the Rollback command.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus