Connection creation and reuse should be a thread safe operation. Connection provides CRUD operations support on the storage.
Read ItemData
from the storage by item identifier.
ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException;
Find Item
by parent (Id) and name (with the path index) of a given
type.
ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException, IllegalStateException;
Get child Nodes of the parent node.
List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException;
Get child Nodes of the parent node. ItemDataFilter
is used to
reduce count of returned items, but it does not guarantee that only items
matching filter will be returned.
List<NodeData> getChildNodesData(NodeData parent, ListList<QPathEntryFilter> pattern) throws RepositoryException, IllegalStateException;
Read List
of PropertyData
from the storage by using the
parent location of the item.
List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException;
Get child properties of the parent node. ItemDataFilter
is used
to reduce count of returned items, but it does not guarantee that only items
matching filter will be returned.
List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException, IllegalStateException;
Read List
of PropertyData
with the empty ValueData
from the
storage by using the parent location of the item.
This method is specially dedicated for non-content modification operations (for example, Items delete).
List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException;
Read List
of PropertyData
from the storage by using the
parent location of the item.
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;
Get child Nodes of the parent node whose value of order number
is between fromOrderNum
and toOrderNum
. Return "true" if there are
data to retrieve for the next request and "false" in other case.
boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int toOrderNum, List<NodeData> childs) throws RepositoryException;
Get children nodes count of the parent node.
int getChildNodesCount(NodeData parent) throws RepositoryException;
Get order number of parent's last child node.
int getLastOrderNumber(NodeData parent) throws RepositoryException;
Add single NodeData
.
void add(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Add single PropertyData
.
void add(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Update NodeData
.
void update(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Update PropertyData
.
void update(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Rename NodeData
by using a Node identifier, a new name and
indexing from the data.
void rename(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Delete NodeData
.
void delete(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Delete PropertyData
.
void delete(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
Prepare the commit phase.
void prepare() throws IllegalStateException, RepositoryException;
Persist changes and closes connection. It can be database transaction commit for instance.
void commit() throws IllegalStateException, RepositoryException;
Refuse persistent changes and closes connection. It can be database transaction rollback for instance.
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.
Return true if connection can be used.
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:
On ADD errors
Parent not found. Condition: Parent ID (Item with ID does not exists).
Item already exists. Condition: ID (Item with ID already exists).
Item already exists. Condition: Parent ID, Name, Index (Item with parent ID, name and index already exists).
On DELETE errors
Item not found. Condition ID.
Cannot delete parent until its children exist.
On UPDATE errors
Item not found. Condition ID.
Item already exists with the higher Version. Condition: ID, Version (Some Session had updated Item with ID prior to this update).
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.