You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/11/20 02:10:16 UTC

svn commit: r719147 [2/2] - in /lenya/sandbox/access_control_redesign/src: java/org/apache/lenya/ac/ modules-core/ac/config/ modules-core/ac/java/src/org/apache/lenya/ac/attr/antlr/ modules-core/ac/java/src/org/apache/lenya/ac/file/ modules-core/ac/jav...

Modified: lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java (original)
+++ lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java Wed Nov 19 17:10:15 2008
@@ -17,7 +17,7 @@
  */
 package org.apache.lenya.cms.ac.usecases;
 
-import org.apache.lenya.ac.User;
+import org.apache.lenya.ac.ManagedUser;
 
 /**
  * Usecase to delete a user.
@@ -33,7 +33,7 @@
         super.doExecute();
 
         String userId = getParameterAsString(UserProfile.USER_ID);
-        User user = getUserManager().getUser(userId);
+        ManagedUser user = getUserManager().getUser(userId);
         if (user == null) {
             throw new RuntimeException("User [" + userId + "] not found.");
         }

Modified: lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java (original)
+++ lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java Wed Nov 19 17:10:15 2008
@@ -23,6 +23,7 @@
 
 import org.apache.lenya.ac.Group;
 import org.apache.lenya.ac.Groupable;
+import org.apache.lenya.ac.ManagedUser;
 import org.apache.lenya.ac.User;
 import org.apache.lenya.cms.usecase.UsecaseException;
 
@@ -79,7 +80,7 @@
 
         List groupUsers = (List) getParameter(GROUP_USERS);
         for (Iterator i = groupUsers.iterator(); i.hasNext();) {
-            User user = (User) i.next();
+            ManagedUser user = (ManagedUser) i.next();
             group.add(user);
             user.save();
         }

Modified: lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java (original)
+++ lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java Wed Nov 19 17:10:15 2008
@@ -23,7 +23,8 @@
 import java.util.List;
 
 import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.User;
+import org.apache.lenya.ac.Groupable;
+import org.apache.lenya.ac.ManagedUser;
 import org.apache.lenya.cms.usecase.UsecaseException;
 
 /**
@@ -44,13 +45,13 @@
     protected void doExecute() throws Exception {
         super.doExecute();
 
-        User user = getUser();
+        ManagedUser user = getUser();
         user.removeFromAllGroups();
 
         List userGroups = (List) getParameter(USER_GROUPS);
         for (Iterator i = userGroups.iterator(); i.hasNext();) {
             Group group = (Group) i.next();
-            group.add(user);
+            group.add((Groupable) user);
         }
         user.save();
     }
@@ -100,9 +101,9 @@
 
     }
 
-    protected User getUser() {
+    protected ManagedUser getUser() {
         String userId = getParameterAsString(UserProfile.USER_ID);
-        User user = getUserManager().getUser(userId);
+        ManagedUser user = getUserManager().getUser(userId);
         if (user == null) {
             throw new RuntimeException("User [" + userId + "] not found.");
         }
@@ -112,7 +113,7 @@
     protected void initParameters() {
         super.initParameters();
         
-        Group[] userGroupArray = getUser().getGroups();
+        Group[] userGroupArray = ((Groupable) getUser()).getGroups();
         List userGroups = new ArrayList(Arrays.asList(userGroupArray));
         setParameter(USER_GROUPS, userGroups);
         

Modified: lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java (original)
+++ lenya/sandbox/access_control_redesign/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java Wed Nov 19 17:10:15 2008
@@ -17,7 +17,7 @@
  */
 package org.apache.lenya.cms.ac.usecases;
 
-import org.apache.lenya.ac.User;
+import org.apache.lenya.ac.ManagedUser;
 import org.apache.lenya.ac.ItemUtil;
 
 /**
@@ -71,13 +71,13 @@
         
     }
     
-    private User user;
+    private ManagedUser user;
     
     /**
      * Returns the currently edited user.
      * @return A user.
      */
-    protected User getUser() {
+    protected ManagedUser getUser() {
         return this.user;
     }
     

Modified: lenya/sandbox/access_control_redesign/src/modules/lucene/java/src/org/apache/cocoon/transformation/LuceneIndexTransformer2.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/modules/lucene/java/src/org/apache/cocoon/transformation/LuceneIndexTransformer2.java?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/modules/lucene/java/src/org/apache/cocoon/transformation/LuceneIndexTransformer2.java (original)
+++ lenya/sandbox/access_control_redesign/src/modules/lucene/java/src/org/apache/cocoon/transformation/LuceneIndexTransformer2.java Wed Nov 19 17:10:15 2008
@@ -45,8 +45,6 @@
 import org.apache.lenya.ac.Identity;
 import org.apache.lenya.ac.User;
 import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
 import org.apache.lenya.modules.lucene.MetaDataFieldRegistry;
 import org.apache.lenya.notification.Address;
 import org.apache.lenya.notification.Message;
@@ -64,23 +62,20 @@
 /**
  * Another lucene index transformer.</br> allow
  * <ul>
- * <li>index function (update indexing or add indexing if clear attribute is
- * true)</li>
+ * <li>index function (update indexing or add indexing if clear attribute is true)</li>
  * <li>lucene field boosting</li>
  * <li>delete function</li>
  * </ul>
  * 
  * <p>
- * This tranformer used several avalon components, but you can use them
- * separatly :
+ * This tranformer used several avalon components, but you can use them separatly :
  * <ul>
- * <li>AnalyzerManager: you can setup a analyzer (configurable) in the
- * analyzer_manager tag in cocoon.xconf file</li>
- * <li>IndexManager: you can setup a index in a the /WEB-INF/index.xml (default
- * location , but you can specify the location in the IndexManager component
- * configuration in cocoon.xconf file)</li>
- * <li>Indexer (2 implementations: default (with update optimization) and
- * parallel implementation for multiple cpu)</li>
+ * <li>AnalyzerManager: you can setup a analyzer (configurable) in the analyzer_manager tag in
+ * cocoon.xconf file</li>
+ * <li>IndexManager: you can setup a index in a the /WEB-INF/index.xml (default location , but you
+ * can specify the location in the IndexManager component configuration in cocoon.xconf file)</li>
+ * <li>Indexer (2 implementations: default (with update optimization) and parallel implementation
+ * for multiple cpu)</li>
  * </p>
  * <p>
  * <strong>Example of input source: </strong>
@@ -90,20 +85,18 @@
  * <li>to Index <br>
  * &lt;lucene:index xmlns:lucene=&quot;http://apache.org/cocoon/lucene/1.0&quot
  * <br/>indexid=&quot;myindex&quot; <br>
- * clear="true" (optinal attribute: clear index) <br/>merge-factor="100"&gt;
- * (optinal attribute: see lucene doc) <br>
- * <br/>&lt;lucene:document uid="http://myhost/myfile1.data"&gt; <br/>
- * &lt;lucene:field name="tile" &gt; sqdqsdq &lt;/lucene:field&gt; <br>
- * &lt;lucene:field name="description" &gt; a text bla bal blalael
- * balbal&lt;/lucene:field&gt; <br>
- * &lt;lucene:field name="date" &gt;10/12/2002&lt;/lucene:field&gt; <br/>
- * &lt;/lucene:document&gt; <br>
+ * clear="true" (optinal attribute: clear index) <br/>merge-factor="100"&gt; (optinal attribute: see
+ * lucene doc) <br>
+ * <br/>&lt;lucene:document uid="http://myhost/myfile1.data"&gt; <br/> &lt;lucene:field name="tile"
+ * &gt; sqdqsdq &lt;/lucene:field&gt; <br>
+ * &lt;lucene:field name="description" &gt; a text bla bal blalael balbal&lt;/lucene:field&gt; <br>
+ * &lt;lucene:field name="date" &gt;10/12/2002&lt;/lucene:field&gt; <br/> &lt;/lucene:document&gt; <br>
  * 
  * <p>
  * &lt;lucene:document uid="http://myhost/myfile2.data" &gt; <br>
  * &lt;lucene:field name="author" boost="2" &gt;Mr Author &lt;/lucene:field&gt;
- * <em>(boost the field for the search (see Lucene documentation))</em> <br/>
- * &lt;lucene:field name="langage" &gt;french&lt;/lucene:field&gt; <br>
+ * <em>(boost the field for the search (see Lucene documentation))</em> <br/> &lt;lucene:field
+ * name="langage" &gt;french&lt;/lucene:field&gt; <br>
  * &lt;/lucene:document&gt; <br>
  * &lt; /lucene:index&gt;
  * </p>
@@ -121,17 +114,15 @@
  * <strong>Example of Output Source </strong>
  * </p>
  * <p>
- * &lt;page xmlns:lucene=&quot;http://apache.org/cocoon/lucene/1.0&quot;&gt;
- * <br>
+ * &lt;page xmlns:lucene=&quot;http://apache.org/cocoon/lucene/1.0&quot;&gt; <br>
  * &lt; lucene:index &gt; <br>
- * &lt;lucene:document uid="http://myhost/myfile1.data"/&gt; <br/>
- * &lt;lucene:document uid="http://myhost/myfile2.data"/&gt; <br/>
- * &lt;/lucene:index&gt;
+ * &lt;lucene:document uid="http://myhost/myfile1.data"/&gt; <br/> &lt;lucene:document
+ * uid="http://myhost/myfile2.data"/&gt; <br/> &lt;/lucene:index&gt;
  * </p>
  * <p>
- * &lt;lucene:delete &gt; &lt;lucene:document
- * uid="http://myhost/myfile1.data"/&gt; <br/>&lt;lucene:document
- * uid="EODOED-EFE"/&gt; <br/>&lt;/lucene:delete &gt;</br></li>
+ * &lt;lucene:delete &gt; &lt;lucene:document uid="http://myhost/myfile1.data"/&gt;
+ * <br/>&lt;lucene:document uid="EODOED-EFE"/&gt; <br/>&lt;/lucene:delete &gt;</br>
+ * </li>
  * </ul>
  * 
  * @author Nicolas Maisonneuve
@@ -167,14 +158,14 @@
     public static final String LUCENE_INDEXING_CREATE_ATTRIBUTE = "clear";
 
     /**
-     * Optional attribute: Analyzer identity: see analyzerManager Component
-     * (default: the analyer of the index declared in the index definition)
+     * Optional attribute: Analyzer identity: see analyzerManager Component (default: the analyer of
+     * the index declared in the index definition)
      */
     public static final String LUCENE_INDEXING_ANALYZER_ATTRIBUTE = "analyzer";
 
     /**
-     * Optional attribute: MergeFactor number (default 10): improve the indexing
-     * speed for large indexing (see Lucene docs)
+     * Optional attribute: MergeFactor number (default 10): improve the indexing speed for large
+     * indexing (see Lucene docs)
      */
     public static final String LUCENE_INDEXING_MERGE_FACTOR_ATTRIBUTE = "mergefactor";
 
@@ -372,9 +363,10 @@
                 if (LUCENE_FIELD_ELEMENT.equals(localName)) {
                     final String namespace = atts.getValue(NAMESPACE_ATTRIBUTE);
                     final String name = atts.getValue(LUCENE_FIELD_NAME_ATTRIBUTE);
-                    
+
                     // set the field name
-                    this.fieldname = namespace == null ? name : getMetaDataFieldName(namespace, name);
+                    this.fieldname = namespace == null ? name : getMetaDataFieldName(namespace,
+                            name);
                     if (this.fieldname == null || this.fieldname.equals("")) {
                         handleError("<lucene:field> element must contain name attribute");
                     }
@@ -404,7 +396,8 @@
     protected String getMetaDataFieldName(String namespace, String elementName) {
         if (this.registry == null) {
             try {
-                this.registry = (MetaDataFieldRegistry) this.manager.lookup(MetaDataFieldRegistry.ROLE);
+                this.registry = (MetaDataFieldRegistry) this.manager
+                        .lookup(MetaDataFieldRegistry.ROLE);
             } catch (ServiceException e) {
                 throw new RuntimeException(e);
             }
@@ -492,7 +485,7 @@
                     try {
                         Field f = index.createField(fieldname, fieldvalue.toString());
                         f.setBoost(fieldboost);
-                        
+
                         // add field to the lucene document
                         bodyDocument.add(f);
                         processing = IN_DOCUMENT_PROCESS;
@@ -505,7 +498,8 @@
                 break;
 
             default:
-                handleError("Inappropriate element '" + localName + "' in state '" + processing  + "'!");
+                handleError("Inappropriate element '" + localName + "' in state '" + processing
+                        + "'!");
             }
         } else {
             super.endElement(namespaceURI, localName, qName);
@@ -514,7 +508,8 @@
 
     protected void handleUnexpectedClosingElement(String localName, String expectedLocalName)
             throws SAXException {
-        handleError("</lucene:" + expectedLocalName + "> was expected instead of </lucene:" + localName + ">!");
+        handleError("</lucene:" + expectedLocalName + "> was expected instead of </lucene:"
+                + localName + ">!");
     }
 
     protected boolean canIndex() {
@@ -549,10 +544,10 @@
         setIndexer(indexId);
 
         if (canIndex()) {
-            
+
             String analyzerId = atts.getValue(LUCENE_URI, LUCENE_INDEXING_ANALYZER_ATTRIBUTE);
             setAnalyzer(analyzerId);
-            
+
             // set clear mode
             boolean new_index = (clear != null && clear.toLowerCase().equals("true")) ? true
                     : false;
@@ -585,8 +580,7 @@
             index = indexManager.getIndex(indexId);
             if (index == null) {
                 handleError("index [" + indexId + "] no found in the index definition");
-            }
-            else {
+            } else {
                 indexer = index.getIndexer();
                 if (indexer == null) {
                     handleError("Index [" + indexId + "] did return a null indexer.");
@@ -621,13 +615,12 @@
                 handleError(ex1);
             } catch (ConfigurationException ex2) {
                 handleError("error setting analyzer for index [" + this.index.getID() + "]", ex2);
-            }
-            finally {
+            } finally {
                 manager.release(analyzerManager);
             }
         }
     }
-    
+
     void handleError(String message, Exception ex) throws SAXException {
         handleError(message + ": " + getExceptionMessage(ex));
     }
@@ -656,11 +649,9 @@
         closeIndexer();
 
         try {
-            Session session = RepositoryUtil.getSession(this.manager, this.request);
             User user = getErrorMessageRecipient();
             Address sender = new UserAddress(user);
-            UserManager userManager = (UserManager) user.getItemManager();
-            User recipient = userManager.getUser(this.notificationRecipient);
+            User recipient = getUserManager().getUser(this.notificationRecipient);
             Address[] recipients = { new UserAddress(recipient) };
 
             Text subject = new Text("indexing-failed-subject", true);
@@ -680,48 +671,54 @@
         }
 
         /*
-         * if (ex == null) { // this.getLogger().error(msg); throw new
-         * SAXException(msg); } else { // this.getLogger().error(msg, ex); throw
-         * new SAXException(msg, ex); }
+         * if (ex == null) { // this.getLogger().error(msg); throw new SAXException(msg); } else {
+         * // this.getLogger().error(msg, ex); throw new SAXException(msg, ex); }
          */
     }
-    
-    protected User getErrorMessageRecipient() {
 
-        ServiceSelector selector = null;
-        AccessControllerResolver acResolver = null;
-        AccessController accessController = null;
-        try {
-            selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
-                    + "Selector");
-            acResolver = (AccessControllerResolver) selector
-                    .select(AccessControllerResolver.DEFAULT_RESOLVER);
-            String webappUrl = ServletHelper.getWebappURI(this.request);
-            accessController = acResolver.resolveAccessController(webappUrl);
-
-            UserManager userManager = accessController.getAccreditableManager().getUserManager();
-            Identity identity = (Identity) this.request.getSession().getAttribute(Identity.class.getName());
-            String userId = identity.getUserReference().getId();
-            User user = userManager.getUser(userId);
-            if (user == null) {
-                throw new RuntimeException("The user '" + userId + "' doesn't exist.");
-            }
-            return user;
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        } finally {
-            if (selector != null) {
-                if (acResolver != null) {
-                    if (accessController != null) {
-                        acResolver.release(accessController);
+    private UserManager userManager;
+
+    protected UserManager getUserManager() {
+        if (this.userManager == null) {
+            AccessController accessController = null;
+            ServiceSelector selector = null;
+            AccessControllerResolver resolver = null;
+            try {
+                selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
+                        + "Selector");
+                resolver = (AccessControllerResolver) selector
+                        .select(AccessControllerResolver.DEFAULT_RESOLVER);
+
+                String url = ServletHelper.getWebappURI(this.request);
+                accessController = resolver.resolveAccessController(url);
+                this.userManager = accessController.getAccreditableManager().getUserManager();
+            } catch (Exception e) {
+                throw new RuntimeException("Could not obtain user manager: ", e);
+            } finally {
+                if (selector != null) {
+                    if (resolver != null) {
+                        if (accessController != null) {
+                            resolver.release(accessController);
+                        }
+                        selector.release(resolver);
                     }
-                    selector.release(acResolver);
+                    this.manager.release(selector);
                 }
-                this.manager.release(selector);
             }
         }
+        return this.userManager;
     }
 
+    protected User getErrorMessageRecipient() {
+        Identity identity = (Identity) this.request.getSession().getAttribute(
+                Identity.class.getName());
+        String userId = identity.getUserReference().getId();
+        User user = getUserManager().getUser(userId);
+        if (user == null) {
+            throw new RuntimeException("The user '" + userId + "' doesn't exist.");
+        }
+        return user;
+    }
 
     /**
      * Close the indexer

Modified: lenya/sandbox/access_control_redesign/src/modules/notification/java/src/org/apache/lenya/inbox/xml/XmlSourceInbox.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/modules/notification/java/src/org/apache/lenya/inbox/xml/XmlSourceInbox.java?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/modules/notification/java/src/org/apache/lenya/inbox/xml/XmlSourceInbox.java (original)
+++ lenya/sandbox/access_control_redesign/src/modules/notification/java/src/org/apache/lenya/inbox/xml/XmlSourceInbox.java Wed Nov 19 17:10:15 2008
@@ -23,11 +23,17 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.axis.components.uuid.UUIDGen;
 import org.apache.axis.components.uuid.UUIDGenFactory;
+import org.apache.cocoon.environment.Request;
 import org.apache.lenya.ac.AccessControlException;
+import org.apache.lenya.ac.AccessController;
+import org.apache.lenya.ac.AccessControllerResolver;
+import org.apache.lenya.ac.AccreditableManager;
 import org.apache.lenya.ac.Group;
 import org.apache.lenya.ac.User;
+import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
 import org.apache.lenya.cms.cocoon.source.SourceUtil;
 import org.apache.lenya.inbox.Inbox;
 import org.apache.lenya.inbox.InboxMessage;
@@ -38,6 +44,7 @@
 import org.apache.lenya.notification.Text;
 import org.apache.lenya.notification.UserAddress;
 import org.apache.lenya.util.Assert;
+import org.apache.lenya.util.ServletHelper;
 import org.apache.lenya.xml.DocumentHelper;
 import org.apache.lenya.xml.NamespaceHelper;
 import org.w3c.dom.Document;
@@ -50,6 +57,7 @@
 
     private ServiceManager manager;
     private User user;
+    private AccreditableManager accrMgr;
 
     /**
      * @param manager The service manager.
@@ -60,6 +68,45 @@
         this.user = user;
     }
 
+    protected AccreditableManager getAccreditableManager() {
+        if (this.accrMgr == null) {
+            AccessController accessController = null;
+            ServiceSelector selector = null;
+            AccessControllerResolver resolver = null;
+            ContextUtility context = null;
+
+            try {
+                selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
+                        + "Selector");
+                resolver = (AccessControllerResolver) selector
+                        .select(AccessControllerResolver.DEFAULT_RESOLVER);
+                context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
+                Request request = context.getRequest();
+                String url = ServletHelper.getWebappURI(request);
+                accessController = resolver.resolveAccessController(url);
+                this.accrMgr = accessController.getAccreditableManager();
+
+            } catch (Exception e) {
+                throw new RuntimeException("Could not obtain accreditable manager: ", e);
+            } finally {
+                if (selector != null) {
+                    if (resolver != null) {
+                        if (accessController != null) {
+                            resolver.release(accessController);
+                        }
+                        selector.release(resolver);
+                    }
+                    this.manager.release(selector);
+                }
+                if (context != null) {
+                    this.manager.release(context);
+                }
+            }
+
+        }
+        return this.accrMgr;
+    }
+
     public synchronized InboxMessage add(Message message) {
         InboxMessage msg = new XmlSourceInboxMessage(this, generateId(), message, false);
         messages().add(msg);
@@ -110,15 +157,14 @@
 
                 Element[] messageElements = helper.getChildren(xml.getDocumentElement(), "message");
                 for (int i = 0; i < messageElements.length; i++) {
-                    
+
                     String id;
                     if (messageElements[i].hasAttribute("id")) {
                         id = messageElements[i].getAttribute("id");
-                    }
-                    else {
+                    } else {
                         id = generateId();
                     }
-                    
+
                     String senderId = messageElements[i].getAttribute("sender");
                     Address sender = new UserAddress(getUser(senderId));
 
@@ -128,8 +174,7 @@
                     Element[] userElements = helper.getChildren(recipientElement, "user");
                     Element[] groupElements = helper.getChildren(recipientElement, "group");
 
-                    Address[] recipients = new Address[userElements.length
-                            + groupElements.length];
+                    Address[] recipients = new Address[userElements.length + groupElements.length];
 
                     for (int u = 0; u < userElements.length; u++) {
                         String userId = userElements[u].getAttribute("id");
@@ -159,15 +204,15 @@
                         subjectParams[p] = DocumentHelper
                                 .getSimpleElementText(subjectParamElements[p]);
                     }
-                    
+
                     String readString = "false";
                     if (messageElements[i].hasAttribute("read")) {
                         readString = messageElements[i].getAttribute("read");
                     }
                     boolean read = Boolean.valueOf(readString).booleanValue();
 
-                    Message message = new Message(new Text(subject, subjectParams), new Text(body, bodyParams), sender,
-                            recipients);
+                    Message message = new Message(new Text(subject, subjectParams), new Text(body,
+                            bodyParams), sender, recipients);
                     InboxMessage msg = new XmlSourceInboxMessage(this, id, message, read);
                     this.messages.add(msg);
                 }
@@ -179,18 +224,18 @@
     }
 
     protected User getUser(String id) throws AccessControlException {
-        return this.user.getAccreditableManager().getUserManager().getUser(id);
+        return getAccreditableManager().getUserManager().getUser(id);
     }
 
     protected Group getGroup(String id) throws AccessControlException {
-        return this.user.getAccreditableManager().getGroupManager().getGroup(id);
+        return getAccreditableManager().getGroupManager().getGroup(id);
     }
 
     private String sourceUri;
 
     protected String getSourceUri() {
         if (this.sourceUri == null) {
-            String configUri = this.user.getAccreditableManager().getConfigurationCollectionUri();
+            String configUri = getAccreditableManager().getConfigurationCollectionUri();
             if (configUri.endsWith("/")) {
                 configUri = configUri.substring(0, configUri.length() - 1);
             }
@@ -221,9 +266,9 @@
 
         InboxMessage[] messages = getMessages();
         for (int i = 0; i < messages.length; i++) {
-            
+
             Message message = messages[i].getMessage();
-            
+
             Element messageElement = helper.createElement("message");
             helper.getDocument().getDocumentElement().appendChild(messageElement);
             Address sender = message.getSenderAddress();
@@ -247,7 +292,8 @@
 
             Element subjectElement = helper.createElement("subject");
             messageElement.appendChild(subjectElement);
-            Element subjectTextElement = helper.createElement("text", message.getSubjectText().getText());
+            Element subjectTextElement = helper.createElement("text", message.getSubjectText()
+                    .getText());
             subjectElement.appendChild(subjectTextElement);
             Text[] subjectParams = message.getSubjectText().getParameters();
             for (int p = 0; p < subjectParams.length; p++) {
@@ -264,7 +310,7 @@
                 Element paramElement = helper.createElement("param", bodyParams[p].getText());
                 bodyElement.appendChild(paramElement);
             }
-            
+
             messageElement.setAttribute("read", Boolean.toString(messages[i].isMarkedAsRead()));
             messageElement.setAttribute("id", messages[i].getId());
         }

Modified: lenya/sandbox/access_control_redesign/src/webapp/lenya/config/sitemap/pipelines.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/webapp/lenya/config/sitemap/pipelines.xmap?rev=719147&r1=719146&r2=719147&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/webapp/lenya/config/sitemap/pipelines.xmap (original)
+++ lenya/sandbox/access_control_redesign/src/webapp/lenya/config/sitemap/pipelines.xmap Wed Nov 19 17:10:15 2008
@@ -97,7 +97,7 @@
       <map:act type="authorizer">
         <map:mount uri-prefix="" src="global-sitemap.xmap" check-reload="true" reload-method="synchron"/>
       </map:act>
-      <map:redirect-to session="true" uri="{proxy:/{1}}?lenya.usecase=ac.login&amp;referrerQueryString={url-encode:{request:queryString}}"/>        
+      <map:redirect-to session="true" uri="{proxy:{access-control:login-uri}}&amp;referrerQueryString={url-encode:{request:queryString}}"/>        
     </map:match>
 
     </map:pipeline>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org