jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1306358 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/ oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-jcr/src/main/java/org/apache/ja...
Date Wed, 28 Mar 2012 14:13:58 GMT
Author: angela
Date: Wed Mar 28 14:13:58 2012
New Revision: 1306358

URL: http://svn.apache.org/viewvc?rev=1306358&view=rev
Log:
OAK-18 : Define Oak API (WIP, initial draft)

- initial draft of RepositoryService interface
- initial draft of Connection interface
- dummy impl (temporary in order not to break the current setup)

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/RepositoryService.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SessionInfoImpl.java
      - copied, changed from r1305860, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/SessionInfoImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TmpRepositoryService.java
      - copied, changed from r1305860, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/AuthenticationServiceImpl.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/AuthenticationService.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/SessionInfo.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java?rev=1306358&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/CommitFailedException.java
Wed Mar 28 14:13:58 2012
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.api;
+
+/**
+ * Main exception thrown by methods defined on the {@code Connection} interface
+ * indicating that commiting a given set of changes failed.
+ *
+ * TODO: define mechanism to inform the oak-jcr level about the specific type of exception
+ *       possible ways:
+ *       - CommitFailedException contains nested jcr exceptions
+ *       - CommitFailedException extends from repository exception
+ *       - CommitFailedException transports status code that are then converted to jcr exceptions
+ */
+public class CommitFailedException extends Exception {
+}

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java?rev=1306358&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Connection.java
Wed Mar 28 14:13:58 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.api;
+
+import org.apache.jackrabbit.mk.model.NodeBuilder;
+import org.apache.jackrabbit.mk.model.NodeState;
+
+/**
+ * The {@code Connection} interface ...
+ *
+ * TODO: define whether this is a repository-level connection or just bound to a single workspace.
+ * TODO: describe how this interface is intended to handle validation: nt, names, ac, constraints...
+ */
+public interface Connection {
+
+    NodeState getCurrentRoot();
+
+    NodeState commit(NodeState newRoot) throws CommitFailedException;
+
+    NodeBuilder getNodeBuilder(NodeState state);
+
+    // TODO : add versioning operations
+
+    // TODO : add query execution operations
+
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/RepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/RepositoryService.java?rev=1306358&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/RepositoryService.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/RepositoryService.java
Wed Mar 28 14:13:58 2012
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.api;
+
+import javax.jcr.NoSuchWorkspaceException;
+import javax.security.auth.login.LoginException;
+
+/**
+ * TODO:
+ * The {@code RepositoryService} is the main access point of the oak-api. It
+ * serves the following purposes:
+ *
+ * - validating a given login request and providing SessionInfo object
+ *   that is used for further communication with the persistent layer (MK).
+ *
+ * - retrieving information from persistent layer (MK) that are accessible to
+ *   a given session
+ *
+ * - validate information being written back to the persistent layer. this includes
+ *   permission evaluation, node type and name constraints etc.
+ *
+ * - update the revision ID a given session is operating on.
+ *
+ * The implementation of this and all related interfaces are intended to only
+ * hold the state of the persistent layer at a given revision without any
+ * session-related state modifications.
+ */
+public interface RepositoryService {
+
+    SessionInfo login(Object credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException;
+
+    Connection getConnection(SessionInfo sessionInfo);
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/SessionInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/SessionInfo.java?rev=1306358&r1=1306357&r2=1306358&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/SessionInfo.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/SessionInfo.java
Wed Mar 28 14:13:58 2012
@@ -55,6 +55,8 @@ public interface SessionInfo {
      * latest state after successful commit of modifications or if the associated
      * session is being refreshed.
      *
+     * TODO: review. maybe this isn't needed any more in oak-jcr once we got rid of all mk-dependencies.
+     *
      * @return the revision The current revision.
      */
     String getRevision();

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SessionInfoImpl.java
(from r1305860, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/SessionInfoImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SessionInfoImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SessionInfoImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/SessionInfoImpl.java&r1=1305860&r2=1306358&rev=1306358&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/SessionInfoImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SessionInfoImpl.java
Wed Mar 28 14:13:58 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.api.impl;
+package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.oak.api.SessionInfo;
 import org.slf4j.Logger;
@@ -73,11 +73,4 @@ public class SessionInfoImpl implements 
         // TODO
 
     }
-
-    //--------------------------------------------------------------------------
-    // TODO: tmp solution as long as oak-jcr still writes to MK directly
-    public void setRevision(String revision) {
-        this.revision = revision;
-    }
-
 }
\ No newline at end of file

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TmpRepositoryService.java
(from r1305860, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/AuthenticationServiceImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TmpRepositoryService.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TmpRepositoryService.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/AuthenticationServiceImpl.java&r1=1305860&r2=1306358&rev=1306358&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/impl/AuthenticationServiceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TmpRepositoryService.java
Wed Mar 28 14:13:58 2012
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.api.impl;
+package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.api.AuthenticationService;
+import org.apache.jackrabbit.oak.api.Connection;
+import org.apache.jackrabbit.oak.api.RepositoryService;
 import org.apache.jackrabbit.oak.api.SessionInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -28,21 +29,21 @@ import javax.jcr.SimpleCredentials;
 import javax.security.auth.login.LoginException;
 
 /**
- * AuthenticationServiceImpl...
+ * TmpRepositoryService...
  */
-public class AuthenticationServiceImpl implements AuthenticationService {
+public class TmpRepositoryService implements RepositoryService {
 
     /**
      * logger instance
      */
-    private static final Logger log = LoggerFactory.getLogger(AuthenticationServiceImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(TmpRepositoryService.class);
 
     // TODO: retrieve default wsp-name from configuration
     private static final String DEFAULT_WORKSPACE_NAME = "default";
 
     private final MicroKernel mk;
 
-    public AuthenticationServiceImpl(MicroKernel mk) {
+    public TmpRepositoryService(MicroKernel mk) {
         this.mk = mk;
 
         // FIXME: default mk-setup must be done elsewhere...
@@ -77,6 +78,12 @@ public class AuthenticationServiceImpl i
         }
     }
 
+    @Override
+    public Connection getConnection(SessionInfo sessionInfo) {
+        // TODO
+        return null;
+    }
+
     /**
      * @param credentials The credentials object used for authentication.
      * @return The microkernal revision. If the give credentials don't specify

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java?rev=1306358&r1=1306357&r2=1306358&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
Wed Mar 28 14:13:58 2012
@@ -21,8 +21,8 @@ package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.mk.MicroKernelFactory;
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.api.AuthenticationService;
-import org.apache.jackrabbit.oak.api.impl.AuthenticationServiceImpl;
+import org.apache.jackrabbit.oak.api.RepositoryService;
+import org.apache.jackrabbit.oak.core.TmpRepositoryService;
 import org.apache.jackrabbit.oak.jcr.configuration.RepositoryConfiguration;
 import org.apache.jackrabbit.oak.jcr.util.Unchecked;
 
@@ -46,9 +46,9 @@ public class GlobalContext {
     
     public GlobalContext(RepositoryConfiguration repositoryConfiguration) throws RepositoryException
{
         MicroKernel mk = MicroKernelFactory.getInstance(repositoryConfiguration.getMicrokernelUrl());
-        AuthenticationService authenticationService = new AuthenticationServiceImpl(mk);
+        RepositoryService repositoryService = new TmpRepositoryService(mk);
         put(RepositoryConfiguration.class, repositoryConfiguration);
-        put(AuthenticationService.class, authenticationService);
+        put(RepositoryService.class, repositoryService);
         put(MicroKernel.class, mk);
         put(Repository.class, new RepositoryImpl(this));
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1306358&r1=1306357&r2=1306358&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Wed Mar 28 14:13:58 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.oak.api.AuthenticationService;
+import org.apache.jackrabbit.oak.api.RepositoryService;
 import org.apache.jackrabbit.oak.api.SessionInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -88,9 +88,9 @@ public class RepositoryImpl implements R
     public Session login(Credentials credentials, String workspaceName) throws RepositoryException
{
         // TODO: needs complete refactoring
 
-        AuthenticationService authentication = context.getInstance(AuthenticationService.class);
+        RepositoryService service = context.getInstance(RepositoryService.class);
         try {
-            SessionInfo sessionInfo = authentication.login(credentials, workspaceName);
+            SessionInfo sessionInfo = service.login(credentials, workspaceName);
             return new SessionImpl(context, sessionInfo);
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage());



Mime
View raw message