jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r156946 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: PropertyImpl.java RepositoryImpl.java SearchManager.java SystemSession.java WorkspaceImpl.java XASessionImpl.java
Date Thu, 10 Mar 2005 13:04:18 GMT
Author: stefan
Date: Thu Mar 10 05:04:16 2005
New Revision: 156946

URL: http://svn.apache.org/viewcvs?view=rev&rev=156946
Log:
mis. minor changes & bug fixes

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java?view=diff&r1=156945&r2=156946
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java Thu Mar
10 05:04:16 2005
@@ -139,11 +139,9 @@
         }
         ArrayList list = new ArrayList();
         // compact array (purge null entries)
-        if (values != null) {
-            for (int i = 0; i < values.length; i++) {
-                if (values[i] != null) {
-                    list.add(values[i]);
-                }
+        for (int i = 0; i < values.length; i++) {
+            if (values[i] != null) {
+                list.add(values[i]);
             }
         }
         values = (InternalValue[]) list.toArray(new InternalValue[list.size()]);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java?view=diff&r1=156945&r2=156946
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java Thu
Mar 10 05:04:16 2005
@@ -52,6 +52,7 @@
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
 import javax.security.auth.login.LoginContext;
+import javax.security.auth.Subject;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -63,6 +64,8 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
+import java.security.AccessControlContext;
+import java.security.AccessController;
 
 /**
  * A <code>RepositoryImpl</code> ...
@@ -83,7 +86,7 @@
     private static final String PROPERTIES_RESOURCE = "rep.properties";
     private final Properties repProps;
 
-    // names of well known repository properties
+    // names of well-known repository properties
     public static final String STATS_NODE_COUNT_PROPERTY = "jcr.repository.stats.nodes.count";
     public static final String STATS_PROP_COUNT_PROPERTY = "jcr.repository.stats.properties.count";
 
@@ -666,11 +669,27 @@
         if (workspaceName == null) {
             workspaceName = repConfig.getDefaultWorkspaceName();
         }
+
         WorkspaceInfo wspInfo = (WorkspaceInfo) wspInfos.get(workspaceName);
         if (wspInfo == null) {
             throw new NoSuchWorkspaceException(workspaceName);
         }
-
+/*
+        if (credentials == null) {
+            // null credentials, obtain the identity of the already-authenticated
+            // user from access control context
+            AccessControlContext acc  = AccessController.getContext();
+            Subject subject;
+            try {
+                subject = Subject.getSubject(acc);
+            } catch (SecurityException se) {
+                throw new LoginException(se.getMessage());
+            }
+            Session ses = new XASessionImpl(this, subject, wspInfo.getConfig());
+            activeSessions.put(ses, ses);
+            return ses;
+        }
+*/
         CredentialsCallbackHandler cbHandler =
                 new CredentialsCallbackHandler(credentials);
         LoginContext lc;
@@ -680,6 +699,8 @@
         } catch (javax.security.auth.login.LoginException le) {
             throw new LoginException(le.getMessage());
         }
+
+        // @todo check access rights for given workspace
 
         Session ses = new XASessionImpl(this, lc, wspInfo.getConfig());
         activeSessions.put(ses, ses);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java?view=diff&r1=156945&r2=156946
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java Thu
Mar 10 05:04:16 2005
@@ -130,7 +130,7 @@
         try {
             Class handlerClass = Class.forName(config.getHandlerClassName());
             handler = (QueryHandler) handlerClass.newInstance();
-            NodeId rootId = (NodeId) session.hierMgr.resolvePath(Path.ROOT);
+            NodeId rootId = (NodeId) session.getHierarchyManager().resolvePath(Path.ROOT);
             handler.init(fs, session.getItemStateManager(), rootId.getUUID(), propRegistry);
         } catch (Exception e) {
             throw new RepositoryException(e.getMessage(), e);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java?view=diff&r1=156945&r2=156946
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SystemSession.java Thu
Mar 10 05:04:16 2005
@@ -31,7 +31,7 @@
 import java.util.Set;
 
 /**
- * A <code>SystemTicket</code> ...
+ * A <code>SystemSession</code> ...
  */
 class SystemSession extends SessionImpl {
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&r1=156945&r2=156946
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Thu
Mar 10 05:04:16 2005
@@ -923,6 +923,8 @@
         // check state of this instance
         sanityCheck();
 
+        // @todo filter workspaces according to access rights
+
         return session.getWorkspaceNames();
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java?view=diff&r1=156945&r2=156946
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/XASessionImpl.java Thu
Mar 10 05:04:16 2005
@@ -24,6 +24,7 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
+import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
@@ -61,17 +62,32 @@
      * Create a new instance of this class.
      *
      * @param rep          repository
-     * @param loginContext credentials
+     * @param loginContext login context containing authenticated subject
      * @param wspConfig    workspace configuration
      * @throws RepositoryException if an error occurs
      */
-    public XASessionImpl(RepositoryImpl rep, LoginContext loginContext,
-                         WorkspaceConfig wspConfig)
+    protected XASessionImpl(RepositoryImpl rep, LoginContext loginContext,
+                            WorkspaceConfig wspConfig)
             throws RepositoryException {
 
         super(rep, loginContext, wspConfig);
     }
 
+    /**
+     * Create a new instance of this class.
+     *
+     * @param rep       repository
+     * @param subject   authenticated subject
+     * @param wspConfig workspace configuration
+     * @throws RepositoryException if an error occurs
+     */
+    protected XASessionImpl(RepositoryImpl rep, Subject subject,
+                            WorkspaceConfig wspConfig)
+            throws RepositoryException {
+
+        super(rep, subject, wspConfig);
+    }
+
     //-------------------------------------------------------------< XASession >
     /**
      * {@inheritDoc}
@@ -128,7 +144,7 @@
             throw new XAException(XAException.XAER_PROTO);
         }
 
-        TransactionContext tx = null;
+        TransactionContext tx;
         if (flags == TMNOFLAGS) {
             tx = (TransactionContext) txGlobal.get(xid);
             if (tx != null) {



Mime
View raw message