You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2012/04/21 11:26:05 UTC
svn commit: r1328623 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java
Author: jukka
Date: Sat Apr 21 09:26:05 2012
New Revision: 1328623
URL: http://svn.apache.org/viewvc?rev=1328623&view=rev
Log:
OAK-18: Define Oak API
Fix workspace initialization in KernelContentRepository.
Drop getRevision() method, as we always access latest state
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java?rev=1328623&r1=1328622&r2=1328623&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/KernelContentRepository.java Sat Apr 21 09:26:05 2012
@@ -51,11 +51,23 @@ public class KernelContentRepository imp
public KernelContentRepository(MicroKernel mk) {
microKernel = mk;
nodeStore = new KernelNodeStore(microKernel);
+
+ // FIXME: workspace setup must be done elsewhere...
+ NodeState root = nodeStore.getRoot();
+ NodeState wspNode = root.getChildNode(DEFAULT_WORKSPACE_NAME);
+ if (wspNode == null) {
+ Branch branch = nodeStore.branch(root);
+ branch.getNode("/").addNode(DEFAULT_WORKSPACE_NAME);
+ nodeStore.merge(branch);
+ }
}
@Override
public ContentSession login(Object credentials, String workspaceName)
throws LoginException, NoSuchWorkspaceException {
+ if (workspaceName == null) {
+ workspaceName = DEFAULT_WORKSPACE_NAME;
+ }
// TODO: add proper implementation
// TODO - authentication against configurable spi-authentication
@@ -74,20 +86,6 @@ public class KernelContentRepository imp
throw new LoginException("login failed");
}
- final String wspName = (workspaceName == null) ? DEFAULT_WORKSPACE_NAME : workspaceName;
- final String revision = getRevision(credentials);
-
- // FIXME: workspace setup must be done elsewhere...
- if (wspName.equals(DEFAULT_WORKSPACE_NAME)) {
- NodeState root = nodeStore.getRoot();
- NodeState wspNode = root.getChildNode(wspName);
- if (wspNode == null) {
- Branch branch = nodeStore.branch(root);
- branch.getNode("/").addNode(wspName);
- nodeStore.merge(branch);
- }
- }
-
QueryEngine queryEngine = new QueryEngineImpl(microKernel);
// TODO set revision!?
NodeState wspRoot = nodeStore.getRoot().getChildNode(workspaceName);
@@ -99,14 +97,4 @@ public class KernelContentRepository imp
sc, workspaceName, nodeStore, wspRoot, queryEngine);
}
- /**
- * @param credentials The credentials object used for authentication.
- * @return The microkernel revision or {@code null} if the give credentials doesn't
- * specify a specific revision number.
- */
- private String getRevision(Object credentials) {
- // TODO: define if/how desired revision can be passed in by the credentials object.
- return null;
- }
-
}