|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.graph.request.processor.RequestProcessor org.modeshape.connector.store.jpa.model.basic.BasicRequestProcessor
@NotThreadSafe public class BasicRequestProcessor
A RequestProcessor
implementation for the JPA connector.
Nested Class Summary | |
---|---|
protected static class |
BasicRequestProcessor.ActualLocation
|
protected class |
BasicRequestProcessor.LargeValueSerializer
|
protected class |
BasicRequestProcessor.NextChildIndexes
|
protected class |
BasicRequestProcessor.RecordingLargeValues
|
protected class |
BasicRequestProcessor.References
|
protected class |
BasicRequestProcessor.SkippedLargeValues
|
Nested classes/interfaces inherited from class org.modeshape.graph.request.processor.RequestProcessor |
---|
RequestProcessor.LocationWithDepth |
Field Summary | |
---|---|
protected RequestProcessorCache |
cache
|
protected boolean |
compressData
|
protected boolean |
creatingWorkspacesAllowed
|
protected boolean |
enforceReferentialIntegrity
|
protected javax.persistence.EntityManager |
entities
|
protected long |
largeValueMinimumSizeInBytes
|
protected Logger |
logger
|
protected NameFactory |
nameFactory
|
protected String |
nameOfDefaultWorkspace
|
protected Namespaces |
namespaces
|
protected PathFactory |
pathFactory
|
protected String[] |
predefinedWorkspaceNames
|
protected PropertyFactory |
propertyFactory
|
protected UUID |
rootNodeUuid
|
protected String |
rootNodeUuidString
|
protected Serializer |
serializer
|
protected ValueFactory<String> |
stringFactory
|
protected UuidFactory |
uuidFactory
|
protected Workspaces |
workspaces
|
Constructor Summary | |
---|---|
BasicRequestProcessor(String sourceName,
ExecutionContext context,
Observer observer,
javax.persistence.EntityManager entityManager,
UUID rootNodeUuid,
String nameOfDefaultWorkspace,
String[] predefinedWorkspaceNames,
long largeValueMinimumSizeInBytes,
boolean creatingWorkspacesAllowed,
boolean compressData,
boolean enforceReferentialIntegrity)
|
Method Summary | |
---|---|
protected BasicRequestProcessor.ActualLocation |
addNewChild(Long workspaceId,
BasicRequestProcessor.ActualLocation parent,
String childUuid,
Name childName,
boolean allowSameNameChildrenInNewNode)
Create a new child with the supplied UUID and name under the supplied parent. |
void |
close()
Close this processor, allowing it to clean up any open resources. |
protected Map<String,Location> |
computeDeletedLocations(WorkspaceEntity workspace,
Location topNodeLocation,
boolean deleteTopOfBranch)
|
protected Collection<String> |
createHexValues(String hexValuesString)
|
protected String |
createHexValuesString(Collection<String> hexValues)
|
protected String |
createProperties(WorkspaceEntity workspace,
String uuidString,
Collection<Property> properties)
|
protected Location |
delete(Request request,
Location location,
String workspaceName,
boolean deleteTopOfBranch)
|
protected ChildEntity |
findByPathSegment(Long workspaceId,
String parentUuid,
Path.Segment pathSegment)
Find the node with the supplied path segment that is a child of the supplied parent. |
protected ChildEntity |
findNode(long workspaceId,
String uuidString)
|
protected BasicRequestProcessor.ActualLocation |
getActualLocation(WorkspaceEntity workspace,
Location original)
Utility method to look up the actual information given a supplied location. |
protected LinkedList<Location> |
getAllChildren(Long workspaceId,
BasicRequestProcessor.ActualLocation parent)
Utility method to obtain all of the children for a node, either from the cache (if all children are known to this processor) or by querying the database (and caching the list of children). |
protected WorkspaceEntity |
getExistingWorkspace(String workspaceName,
Request request)
|
void |
process(CloneBranchRequest request)
Process a request to clone a branch into a new workspace. |
void |
process(CloneWorkspaceRequest request)
Process a request to clone an existing workspace as a new workspace. |
void |
process(CopyBranchRequest request)
Process a request to copy a branch into another location. |
void |
process(CreateNodeRequest request)
Process a request to create a node at a specified location. |
void |
process(CreateWorkspaceRequest request)
Process a request to create a new workspace. |
void |
process(DeleteBranchRequest request)
Process a request to delete a branch at a specified location. |
void |
process(DeleteChildrenRequest request)
Process a request to delete all of the child nodes under the supplied existing node. |
void |
process(DestroyWorkspaceRequest request)
Process a request to permanently destroy a workspace. |
void |
process(GetWorkspacesRequest request)
Process a request to get the information about the available workspaces. |
void |
process(MoveBranchRequest request)
Process a request to move a branch at a specified location into a different location. |
void |
process(ReadAllChildrenRequest request)
Process a request to read all of the children of a node. |
void |
process(ReadAllPropertiesRequest request)
Process a request to read the properties of a node at the supplied location. |
void |
process(ReadBlockOfChildrenRequest request)
Process a request to read a block of the children of a node. |
void |
process(ReadBranchRequest request)
Process a request to read a branch or subgraph that's below a node at a specified location. |
void |
process(ReadNextBlockOfChildrenRequest request)
Process a request to read the next block of the children of a node, starting after a previously-retrieved child. |
void |
process(ReadNodeRequest request)
Process a request to read the properties and children of a node at the supplied location. |
void |
process(ReadPropertyRequest request)
Process a request to read a single property of a node at the supplied location. |
void |
process(UpdatePropertiesRequest request)
Process a request to remove the specified properties from a node. |
void |
process(VerifyWorkspaceRequest request)
Process a request to verify a named workspace. |
protected String |
resolveToUuid(WorkspaceEntity workspace,
Reference reference)
Attempt to resolve the reference. |
protected void |
verifyReferences()
Reference entities are added and removed in the appropriate process(...) |
Methods inherited from class org.modeshape.graph.request.processor.RequestProcessor |
---|
completeRequest, getChanges, getDefaultCachePolicy, getExecutionContext, getNowInUtc, getSourceName, notifyObserverOfChanges, process, process, process, process, process, process, process, process, process, process, process, processUnknownRequest, recordChange, setCacheableInfo, setCacheableInfo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final javax.persistence.EntityManager entities
protected final ValueFactory<String> stringFactory
protected final PathFactory pathFactory
protected final PropertyFactory propertyFactory
protected final NameFactory nameFactory
protected final UuidFactory uuidFactory
protected final Namespaces namespaces
protected final Workspaces workspaces
protected final UUID rootNodeUuid
protected final String rootNodeUuidString
protected final String nameOfDefaultWorkspace
protected final String[] predefinedWorkspaceNames
protected final boolean creatingWorkspacesAllowed
protected final Serializer serializer
protected final long largeValueMinimumSizeInBytes
protected final boolean compressData
protected final Logger logger
protected final RequestProcessorCache cache
protected final boolean enforceReferentialIntegrity
Constructor Detail |
---|
public BasicRequestProcessor(String sourceName, ExecutionContext context, Observer observer, javax.persistence.EntityManager entityManager, UUID rootNodeUuid, String nameOfDefaultWorkspace, String[] predefinedWorkspaceNames, long largeValueMinimumSizeInBytes, boolean creatingWorkspacesAllowed, boolean compressData, boolean enforceReferentialIntegrity)
sourceName
- context
- observer
- entityManager
- rootNodeUuid
- nameOfDefaultWorkspace
- predefinedWorkspaceNames
- largeValueMinimumSizeInBytes
- creatingWorkspacesAllowed
- compressData
- enforceReferentialIntegrity
- Method Detail |
---|
public void process(CreateNodeRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the create requestRequestProcessor.process(org.modeshape.graph.request.CreateNodeRequest)
protected BasicRequestProcessor.ActualLocation addNewChild(Long workspaceId, BasicRequestProcessor.ActualLocation parent, String childUuid, Name childName, boolean allowSameNameChildrenInNewNode)
workspaceId
- the ID of the workspace in which the child is to be createdparent
- the actual location of the parent, or null if the child is to be the root of the workspacechildUuid
- the UUID of the childchildName
- the name of the childallowSameNameChildrenInNewNode
-
public void process(ReadNodeRequest request)
This method does nothing if the request is null. Unless overridden, this method converts the single request into a
ReadAllChildrenRequest
and a ReadAllPropertiesRequest
.
process
in class RequestProcessor
request
- the read requestRequestProcessor.process(org.modeshape.graph.request.ReadNodeRequest)
public void process(ReadAllChildrenRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the read requestRequestProcessor.process(org.modeshape.graph.request.ReadAllChildrenRequest)
protected LinkedList<Location> getAllChildren(Long workspaceId, BasicRequestProcessor.ActualLocation parent)
workspaceId
- the ID of the workspace; may not be nullparent
- the actual location of the parent node; may not be null
public void process(ReadBlockOfChildrenRequest request)
starting index
and a maximum
number of children to include in the block
.
This method does nothing if the request is null. The default implementation converts the command to a
ReadAllChildrenRequest
, and then finds the children within the block. Obviously for large numbers of children, this
implementation may not be efficient and may need to be overridden.
process
in class RequestProcessor
request
- the read requestRequestProcessor.process(org.modeshape.graph.request.ReadBlockOfChildrenRequest)
public void process(ReadNextBlockOfChildrenRequest request)
This method does nothing if the request is null. The default implementation converts the command to a
ReadAllChildrenRequest
, and then finds the children within the block. Obviously for large numbers of children, this
implementation may not be efficient and may need to be overridden.
process
in class RequestProcessor
request
- the read requestRequestProcessor.process(org.modeshape.graph.request.ReadNextBlockOfChildrenRequest)
public void process(ReadAllPropertiesRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the read requestRequestProcessor.process(org.modeshape.graph.request.ReadAllPropertiesRequest)
public void process(ReadPropertyRequest request)
This method does nothing if the request is null. Unless overridden, this method converts the request that
reads the node
and simply returns the one property.
process
in class RequestProcessor
request
- the read requestRequestProcessor.process(org.modeshape.graph.request.ReadPropertyRequest)
public void process(UpdatePropertiesRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the remove requestRequestProcessor.process(org.modeshape.graph.request.UpdatePropertiesRequest)
public void process(ReadBranchRequest request)
This method does nothing if the request is null. The default implementation processes the branch by submitting the
equivalent requests to read the nodes
and the children
. It starts by
doing this for the top-level node, then proceeds for each of the children of that node, and so forth.
process
in class RequestProcessor
request
- the request to read the branchRequestProcessor.process(org.modeshape.graph.request.ReadBranchRequest)
public void process(CopyBranchRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the copy requestRequestProcessor.process(org.modeshape.graph.request.CopyBranchRequest)
public void process(CloneBranchRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.CloneBranchRequest)
public void process(DeleteBranchRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the delete requestRequestProcessor.process(org.modeshape.graph.request.DeleteBranchRequest)
public void process(DeleteChildrenRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the delete requestRequestProcessor.process(org.modeshape.graph.request.DeleteChildrenRequest)
protected Location delete(Request request, Location location, String workspaceName, boolean deleteTopOfBranch)
protected Map<String,Location> computeDeletedLocations(WorkspaceEntity workspace, Location topNodeLocation, boolean deleteTopOfBranch)
public void process(MoveBranchRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the move requestRequestProcessor.process(org.modeshape.graph.request.MoveBranchRequest)
public void process(VerifyWorkspaceRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.VerifyWorkspaceRequest)
public void process(GetWorkspacesRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.GetWorkspacesRequest)
public void process(CreateWorkspaceRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.CreateWorkspaceRequest)
public void process(CloneWorkspaceRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.CloneWorkspaceRequest)
public void process(DestroyWorkspaceRequest request)
This method does nothing if the request is null.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.DestroyWorkspaceRequest)
public void close()
close
in class RequestProcessor
ReferentialIntegrityException
- if the integrity of the references has been compromisedRequestProcessor.close()
protected WorkspaceEntity getExistingWorkspace(String workspaceName, Request request)
protected void verifyReferences() throws ReferentialIntegrityException
Reference entities
are added and removed in the appropriate process(...)
methods.
However, this method is typically called in close()
and performs the following steps:
ReferentialIntegrityException
- if the integrity of the references has been compromisedprotected String createProperties(WorkspaceEntity workspace, String uuidString, Collection<Property> properties) throws IOException
IOException
protected String resolveToUuid(WorkspaceEntity workspace, Reference reference)
workspace
- the workspace in which the reference occurs; may not be nullreference
- the reference
protected BasicRequestProcessor.ActualLocation getActualLocation(WorkspaceEntity workspace, Location original) throws PathNotFoundException
PathNotFoundException
. In all cases, the resulting information contains
the correct path and the correct UUID.
Note that this method sometimes performs "unnecessary" work when the location contains both a path to a node and the node's
corresponding UUID. Strictly speaking, this method would need to do very little. However, in such cases, this method does
verify that the information is still correct (ensuring that calls to use the ChildEntity
will be correct). So,
while this work may be unnecessary, it does ensure that the location is consistent and correct (something that is
not unnecessary).
There are cases when a request containing a Path and a UUID are no longer correct. The node may have been just moved by another request (perhaps from a different client), or there may be an error in the component making the request. In these cases, this method assumes that the path is incorrect (since paths may change) and finds the correct path given the UUID.
This method will also find the path when the location contains just the UUID.
workspace
- the workspace; may not be nulloriginal
- the original location; may not be null
PathNotFoundException
- if the location does not represent a location that could be foundprotected ChildEntity findNode(long workspaceId, String uuidString)
protected ChildEntity findByPathSegment(Long workspaceId, String parentUuid, Path.Segment pathSegment)
workspaceId
- the ID of the workspaceparentUuid
- the UUID of the parent node, in string formpathSegment
- the path segment of the child
IllegalArgumentException
- if the manager or URI are nullprotected String createHexValuesString(Collection<String> hexValues)
protected Collection<String> createHexValues(String hexValuesString)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |