You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/08/16 20:00:58 UTC
svn commit: r1158404 -
/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Author: mduerig
Date: Tue Aug 16 18:00:57 2011
New Revision: 1158404
URL: http://svn.apache.org/viewvc?rev=1158404&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
Modified:
jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1158404&r1=1158403&r2=1158404&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java Tue Aug 16 18:00:57 2011
@@ -332,49 +332,28 @@ public class RepositoryServiceImpl exten
public Iterator<? extends ItemInfo> getItemInfos(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException {
try {
- if (!itemId.denotesNode()) {
- PropertyInfo info = getPropertyInfo(sessionInfo, (PropertyId) itemId);
- return Iterators.singleton(info);
- }
- else {
- NodeId nodeId = (NodeId) itemId;
- String wspName = sessionInfo.getWorkspaceName();
- Path path = getPath(nodeId);
- String mkPath = Paths.pathToString(wspName, path);
- String rev = microKernel.getHeadRevision();
-
- if (microKernel.nodeExists(mkPath, rev)) {
- String json = microKernel.getNodes(mkPath, rev);
- return buildItemInfos(path, json, readFromDataStore);
- }
- else {
- throw new PathNotFoundException(path.toString());
- }
- }
- }
- catch (MicroKernelException e) {
- throw new RepositoryException(e.getMessage(), e);
- }
- }
-
- public PropertyInfo getPropertyInfo(SessionInfo sessionInfo, PropertyId propertyId) throws RepositoryException {
- try {
String wspName = sessionInfo.getWorkspaceName();
- Path path = getPath(propertyId);
- String mkPath = Paths.pathToString(wspName, path.getAncestor(1));
+ Path path = getPath(itemId);
String rev = microKernel.getHeadRevision();
+ String mkPath = Paths.pathToString(wspName, itemId.denotesNode() ? path : path.getAncestor(1));
- PropertyInfo info = null;
- if (microKernel.nodeExists(mkPath, rev)) {
- String json = microKernel.getNodes(mkPath, rev);
- info = buildPropertyInfo(path, json, readFromDataStore);
+ if (!microKernel.nodeExists(mkPath, rev)) {
+ throw new PathNotFoundException(path.toString());
}
- if (info == null) {
- throw new PathNotFoundException(path.toString());
+ String json = microKernel.getNodes(mkPath, rev);
+
+ if (!itemId.denotesNode()) {
+ PropertyInfo info = buildPropertyInfo(path, json, readFromDataStore);
+ if (info == null) {
+ throw new PathNotFoundException(path.toString());
+ }
+ else {
+ return Iterators.singleton(info);
+ }
}
else {
- return info;
+ return buildItemInfos(path, json, readFromDataStore);
}
}
catch (MicroKernelException e) {