incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1084356 [1/2] - in /incubator/isis/trunk/viewer/scimpi: dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ dispatcher/src/main/java/org/apache/isis/v...
Date Tue, 22 Mar 2011 21:27:40 GMT
Author: rmatthews
Date: Tue Mar 22 21:27:39 2011
New Revision: 1084356

URL: http://svn.apache.org/viewvc?rev=1084356&view=rev
Log:
Improved in-application debugging.

Added:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java   (with props)
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugWriter.java
      - copied, changed from r1082942, incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java   (with props)
Removed:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java
Modified:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/HibernateOidObjectMapping.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/SerialOidObjectMapping.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
    incubator/isis/trunk/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java Tue Mar 22 21:27:39 2011
@@ -22,8 +22,8 @@ package org.apache.isis.viewer.scimpi.di
 
 import java.io.IOException;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 
 public interface Action extends Names {
 
@@ -33,7 +33,7 @@ public interface Action extends Names {
 
     void init();
 
-    void debug(DebugView view);
+    void debug(DebugBuilder debug);
 
 }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java Tue Mar 22 21:27:39 2011
@@ -37,7 +37,9 @@ import java.util.Stack;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.commons.debug.DebugTee;
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.commons.factory.InstanceUtil;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -53,7 +55,7 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Debug;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugAction;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugWriter;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.EditAction;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.RemoveAction;
 import org.apache.isis.viewer.scimpi.dispatcher.logon.LogonAction;
@@ -87,105 +89,128 @@ public class Dispatcher {
 
     public void process(RequestContext context, String servletPath) {
         LOG.info("processing request " + servletPath);
+        AuthenticationSession session = UserManager.startRequest(context);
+        LOG.debug("exsiting session: " + session);
+        
+        IsisContext.getPersistenceSession().getTransactionManager().startTransaction();
+        context.setRequestPath(servletPath);
+        context.startRequest();
+                
         try {
-            AuthenticationSession session = UserManager.startRequest(context);
-            LOG.debug("exsiting session: " + session);
-            
-            IsisContext.getPersistenceSession().getTransactionManager().startTransaction();
-            context.setRequestPath(servletPath);
-            context.startRequest();
-            
-            String loginName = IsisContext.getAuthenticationSession().getUserName();
-            boolean userLoggedIn = loginName != null && !loginName.equals("__web_default");
-            // TODO determine if app can run methods unauthorized
-            boolean allowActions = userLoggedIn;
-
-            // TODO review how session should start 
-            // if (!newSession || servletPath.endsWith(context.getContextPath() + "/logon.app")) {
-            // sessions should not start of with an action
-            
-            processActions(context, allowActions, servletPath);
-            IsisTransactionManager transactionManager = IsisContext.getPersistenceSession().getTransactionManager();
-            if (transactionManager.getTransaction().getState().canFlush()) {
-                transactionManager.flushTransaction();
-            }
-            processView(context);
-            // Note - the session will have changed since the earlier call if a user has logged in or out in the action processing above.
-            transactionManager = IsisContext.getPersistenceSession().getTransactionManager();
-            if (transactionManager.getTransaction().getState().canCommit()) {
-                IsisContext.getPersistenceSession().getTransactionManager().endTransaction();
+            processActions(context, false, servletPath);
+            processTheView(context);
+        } catch (ScimpiNotFoundException e) {
+            if (context.isInternalRequest()) {
+                LOG.error("invalid page request (from within application): "+ e.getMessage());
+            } else {
+                LOG.info("invalid page request (from outside application): "+ e.getMessage());
             }
             
-            context.endRequest();
-            UserManager.endRequest(context.getSession());
-
-            context.isInternalRequest();
+            try {
+                // TODO pick this up from configuration
+                // context.raiseError(404);
+                //context.setRequestPath("/error/notfound_404.shtml");
+                IsisContext.getMessageBroker().addWarning("Failed to find page....");
+                context.setRequestPath("/index.shtml");
+                processTheView(context);
+            } catch (IOException e1) {
+                throw new ScimpiException(e);
+            }
             
-        } catch (ScimpiNotFoundException e) {
-            LOG.info("invalid page request "+ e.getMessage());
+        } catch (NotLoggedInException e) {
+            IsisContext.getMessageBroker().addWarning("You are not currently logged in! Please log in so you can continue.");
+            context.setRequestPath("/login.shtml");
             try {
-                UserManager.endRequest(context.getSession());
-            } catch (Exception e1) {
-                LOG.error("endRequest call failed", e1);
+                processTheView(context);
+            } catch (IOException e1) {
+                throw new ScimpiException(e);
             }
-            context.addVariable("_error-message", e.getHtmlMessage(), Scope.REQUEST);
-            //context.addVariable("_error-details", e.getHtmlMessage(), Scope.REQUEST);
-            context.raiseError(404);
+            
         } catch (Throwable e) {
             LOG.debug(e.getMessage(), e);
             LOG.info("testing");
             
             DebugString error = new DebugString();
-            if (IsisContext.getCurrentTransaction() != null) {
-                List<String> messages =  IsisContext.getMessageBroker().getMessages();
-                for (String message : messages) {
-                    context.getWriter().append("<div class=\"message\">message: " + message + "</div>");
-                    error.appendln("message", message);
-                }
-                messages =  IsisContext.getMessageBroker().getWarnings();
-                for (String message : messages) {
-                    context.getWriter().append("<div class=\"message\">warning: " + message + "</div>");
-                    error.appendln("warning", message);
-                }
-            }
-            
             generateErrorPage(e, context, error);
+            String message = "failed while processing " + servletPath;
+            LOG.error(message + "\n" + error + "\n" + message);
              
             PersistenceSession checkSession = IsisContext.getPersistenceSession();
             IsisTransactionManager transactionManager = checkSession.getTransactionManager();
             if (transactionManager.getTransaction() != null && transactionManager.getTransaction().getState().canAbort()) {
                 transactionManager.abortTransaction();
+                transactionManager.startTransaction();
             }
-            
-            String message = "failed while processing " + servletPath;
-            LOG.error(message + "\n" + error + "\n" + message);
 
-            
-            try {
-                UserManager.endRequest(context.getSession());
-            } catch (Exception e1) {
-                LOG.error("endRequest call failed", e1);
-            }
-
-            Throwable ex;
-            if (e instanceof TagProcessingException) {
-                ex = e.getCause();
-            } else {
-                ex = e;
-            }
+            Throwable ex = e instanceof TagProcessingException ? e.getCause() : e;
             if (ex instanceof ForbiddenException) {
                 context.addVariable("_security_error", ex.getMessage(), Scope.REQUEST); 
                 context.addVariable("_security_identifier", ((ForbiddenException) ex).getIdentifier(), Scope.REQUEST);
                 context.addVariable("_security_roles", ((ForbiddenException) ex).getRoles(), Scope.REQUEST);
-                context.raiseError(403);
+
+                // TODO allow these values to be got configuration
+                // context.raiseError(403);
+                // context.setRequestPath("/error/security_403.shtml");
+                IsisContext.getMessageBroker().addWarning("You did not have the right permissions to perform this.....");
+                context.setRequestPath("/index.shtml");
+                try {
+                    processTheView(context);
+                } catch (IOException e1) {
+                    throw new ScimpiException(e);
+                }
             } else {
-                context.raiseError(500);    
+                // TODO allow these values to be got configuration
+                // context.raiseError(500);    
+                context.setRequestPath("/error/server_500.shtml");
+                //IsisContext.getMessageBroker().addWarning("There was a error while processing this request....");
+                //context.setRequestPath("/index.shtml");
+                try {
+                    processTheView(context);
+                } catch (IOException e1) {
+                    throw new ScimpiException(e);
+                }
+            }
+        } finally {
+            try {
+                UserManager.endRequest(context.getSession());
+            } catch (Exception e1) {
+                LOG.error("endRequest call failed", e1);
             }
         }
     }
 
 
+    protected void processTheView(RequestContext context) throws IOException {
+        IsisTransactionManager transactionManager = IsisContext.getPersistenceSession().getTransactionManager();
+        if (transactionManager.getTransaction().getState().canFlush()) {
+            transactionManager.flushTransaction();
+        }
+        processView(context);
+        // Note - the session will have changed since the earlier call if a user has logged in or out in the action processing above.
+        transactionManager = IsisContext.getPersistenceSession().getTransactionManager();
+        if (transactionManager.getTransaction().getState().canCommit()) {
+            IsisContext.getPersistenceSession().getTransactionManager().endTransaction();
+        }
+        
+        context.endRequest();
+        UserManager.endRequest(context.getSession());
+    }
+
+
     private void generateErrorPage(Throwable exception, RequestContext requestContext, DebugString error) {
+        if (IsisContext.getCurrentTransaction() != null) {
+            List<String> messages =  IsisContext.getMessageBroker().getMessages();
+            for (String message : messages) {
+                requestContext.getWriter().append("<div class=\"message\">message: " + message + "</div>");
+                error.appendln("message", message);
+            }
+            messages =  IsisContext.getMessageBroker().getWarnings();
+            for (String message : messages) {
+                requestContext.getWriter().append("<div class=\"message\">warning: " + message + "</div>");
+                error.appendln("warning", message);
+            }
+        }
+        
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         writeErrorContent(requestContext, exception, error, new PrintWriter(out), false);
         
@@ -215,25 +240,17 @@ public class Dispatcher {
             DebugString error,
             PrintWriter writer,
             boolean includeHeader) {
-        DebugView errorView = new DebugView(writer, error);
-        if (includeHeader) {
-            errorView.header();
-        }
-        errorView.startTable();
-        
+        DebugBuilder errorView = new DebugTee(error, new DebugWriter(writer, includeHeader));
         try {
-            errorView.exception(exception);
+            errorView.appendException(exception);
             requestContext.append(errorView);
         } catch (RuntimeException e) {
             errorView.appendln("NOTE - an exception occurred while dumping an exception!");
-            errorView.exception(e);
-        }
-        errorView.divider("Processing"); 
-        errorView.appendDebugTrace(requestContext.getDebugTrace()); 
-        errorView.endTable();
-        if (includeHeader) {
-            errorView.footer();
+            errorView.appendException(e);
         }
+        errorView.appendTitle("Processing"); 
+        errorView.appendln(requestContext.getDebugTrace()); 
+        errorView.close();
         writer.close();
     }
 
@@ -246,16 +263,8 @@ public class Dispatcher {
         return parameters.get(name);
     }
 
-    private void processActions(RequestContext context, boolean allowAction, String actionName) throws IOException {
+    private void processActions(RequestContext context, boolean userLoggedIn, String actionName) throws IOException {
         if (actionName.endsWith(COMMAND_ROOT)) {
-            // TODO do the same thing (redirect to login page) if the action is not-authorized and the user is
-            // not logged in; if they are logged in then it is a security violation.
-            if (!allowAction && !actionName.endsWith(context.getContextPath() + "/logon.app")) {
-                IsisContext.getMessageBroker().addWarning("You are not currently logged in! Please log in so you can continue.");
-                context.setRequestPath("/login.shtml");
-                return;
-            }
-            
             int pos = actionName.lastIndexOf('/');
             Action action = actions.get(actionName.substring(pos, actionName.length() - COMMAND_ROOT.length()));
             if (action == null) {
@@ -302,12 +311,11 @@ public class Dispatcher {
             throw e;
         }
         String page = request.popBuffer();
-        context.getWriter().write(page);
+        PrintWriter writer = context.getWriter();
+        writer.write(page);
         if (context.getDebug() == Debug.PAGE) {
-            DebugView view = new DebugView(context.getWriter(), new DebugString());
-            view.startTable();
+            DebugWriter view = new DebugWriter(writer, false);
             context.append(view);
-            view.endTable();
         }
     }
 
@@ -413,6 +421,8 @@ public class Dispatcher {
 
     public void init(String dir) {
         addAction(new ActionAction());
+        
+        // TODO remove
         addAction(new DebugAction(this));
         addAction(new EditAction());
         addAction(new RemoveAction());
@@ -430,6 +440,7 @@ public class Dispatcher {
         }
 
         processors.init();
+        processors.addElementProcessor(new org.apache.isis.viewer.scimpi.dispatcher.view.debug.Debug(this));
     }
 
     private void loadConfigFile(File file) {
@@ -473,13 +484,13 @@ public class Dispatcher {
         action.init();
     }
 
-    public void debug(DebugView view) {
-        view.divider("Actions");
+    public void debug(DebugBuilder debug) {
+        debug.appendTitle("Actions");
         Set<String> keySet = actions.keySet();
         ArrayList<String> list = new ArrayList<String>(keySet);
         Collections.sort(list);
         for (String name : list) {
-            view.appendRow(name, actions.get(name));            
+            debug.appendln(name, actions.get(name));            
         }
         /*
         new ArrayList<E>(actions.keySet().iterator())
@@ -491,10 +502,10 @@ public class Dispatcher {
         */
         Iterator<Action> iterator = actions.values().iterator();
         while (iterator.hasNext()) {
-            iterator.next().debug(view);
+            iterator.next().debug(debug);
         }
 
-        processors.debug(view);
+        processors.debug(debug);
     }
 }
 

Added: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java?rev=1084356&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java (added)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java Tue Mar 22 21:27:39 2011
@@ -0,0 +1,33 @@
+/*
+ *  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.isis.viewer.scimpi.dispatcher;
+
+
+
+/**
+ * Indicates that request could not complete as a user was not logged in.
+ */
+public class NotLoggedInException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+
+    public NotLoggedInException() {
+    }
+
+}

Propchange: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java Tue Mar 22 21:27:39 2011
@@ -23,6 +23,8 @@ package org.apache.isis.viewer.scimpi.di
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
 import org.apache.isis.core.metamodel.consent.Veto;
@@ -36,9 +38,10 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.NotLoggedInException;
+import org.apache.isis.viewer.scimpi.dispatcher.UserlessSession;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.FieldEditState;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
 import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
@@ -72,6 +75,11 @@ public class ActionAction implements Act
             // FIXME need to find method based on the set of parameters. otherwise overloaded method may be incorrectly selected.
             ObjectAction action = MethodsUtils.findAction(object, methodName);
             entryState = validateParameters(context, action, object);
+
+            AuthenticationSession session = context.getSession();
+            if (session == null && action.isUsable(new UserlessSession(), object).isVetoed()) {
+                throw new NotLoggedInException();
+            }
             
             object.checkLock(context.getVersion(version));
        /*     
@@ -264,6 +272,6 @@ public class ActionAction implements Act
     public void init() {}
 
     @Override
-    public void debug(DebugView view) {}
+    public void debug(DebugBuilder debug) {}
 }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java Tue Mar 22 21:27:39 2011
@@ -29,8 +29,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.log4j.Logger;
-
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.encoding.DataOutputExtended;
 import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
 import org.apache.isis.core.commons.exceptions.IsisException;
@@ -38,12 +37,12 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification.CreationMode;
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.simple.SerialOid;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.log4j.Logger;
 
 
 public class DefaultOidObjectMapping implements ObjectMapping {
@@ -52,23 +51,23 @@ public class DefaultOidObjectMapping imp
     private final Map<String, TransientObjectMapping> sessionTransients = new HashMap<String, TransientObjectMapping>();
     private Class<? extends Oid> oidType;
 
-    public void append(DebugView view) {
-        append(view, requestTransients, "request");
-        append(view, sessionTransients, "session");
+    public void append(DebugBuilder debug) {
+        append(debug, requestTransients, "request");
+        append(debug, sessionTransients, "session");
     }
 
-    protected void append(DebugView view, Map<String, TransientObjectMapping> transients, String type) {
+    protected void append(DebugBuilder debug, Map<String, TransientObjectMapping> transients, String type) {
         Iterator<String> ids = new HashSet(transients.keySet()).iterator();
         if (ids.hasNext()) {
-            view.divider("Transient objects (" + type + ")");
+            debug.appendTitle("Transient objects (" + type + ")");
             while (ids.hasNext()) {
                 String key = ids.next();
-                view.appendRow(key, transients.get(key).debug());
+                debug.appendln(key, transients.get(key).debug());
             }
         }
     }
 
-    public void appendMappings(Request request) {}
+    public void appendMappings(DebugBuilder request) {}
 
     public void clear(Scope scope) {
         requestTransients.clear();
@@ -109,9 +108,9 @@ public class DefaultOidObjectMapping imp
                 int element = -1; // aoid.getElement();
                 
                 object = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(parentOid);
-                encodedOid = Long.toHexString(((SerialOid) parentOid).getSerialNo()) + "@" + fieldName + (element == -1 ? "" : "@" + element);
+                encodedOid = Long.toString(((SerialOid) parentOid).getSerialNo(), 16) + "@" + fieldName + (element == -1 ? "" : "@" + element);
             } else  if (oid instanceof SerialOid) {
-                encodedOid = Long.toHexString(((SerialOid) oid).getSerialNo());
+                encodedOid = Long.toString(((SerialOid) oid).getSerialNo(), 16);
             } else {
                 ByteArrayOutputStream output = new ByteArrayOutputStream();
                 DataOutputExtended outputStream = new DataOutputStreamExtended(output);
@@ -147,7 +146,14 @@ public class DefaultOidObjectMapping imp
                 mapping = requestTransients.get(id);
             }
             if (mapping == null) {
-                return null;
+                String[] split = id.split("@");
+                ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(split[0].substring(1));
+                Object pojo = spec.createObject(CreationMode.NO_INITIALIZE);
+                String oidData = split[1];
+                SerialOid oid = SerialOid.createTransient(Long.valueOf(oidData, 16).longValue());
+                return IsisContext.getPersistenceSession().recreateAdapter(oid, pojo);
+                
+//                return null;
             }
             ObjectAdapter mappedTransientObject = mapping.getObject();
             LOG.debug("retrieved " + mappedTransientObject.getOid() + " for " + id);

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/HibernateOidObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/HibernateOidObjectMapping.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/HibernateOidObjectMapping.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/HibernateOidObjectMapping.java Tue Mar 22 21:27:39 2011
@@ -27,14 +27,13 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.encoding.DataOutputExtended;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 
 public class HibernateOidObjectMapping implements ObjectMapping {
@@ -82,18 +81,18 @@ public class HibernateOidObjectMapping i
     
     private final Map<String, TransientObjectMapping> transients = new HashMap<String, TransientObjectMapping>();
 
-    public void append(DebugView view) {
+    public void append(DebugBuilder debug) {
         Iterator<String> ids = new HashSet(transients.keySet()).iterator();
         if (ids.hasNext()) {
-            view.divider("Transient objects");
+            debug.appendTitle("Transient objects");
             while (ids.hasNext()) {
                 String key = ids.next();
-                view.appendRow(key, transients.get(key).debug());
+                debug.appendln(key, transients.get(key).debug());
             }
         }
     }
 
-    public void appendMappings(Request request) {}
+    public void appendMappings(DebugBuilder request) {}
 
     public void clear(Scope scope) {
         Iterator<TransientObjectMapping> mapping = transients.values().iterator();

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java Tue Mar 22 21:27:39 2011
@@ -26,10 +26,9 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.TreeSet;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 
 public class IndirectObjectMapping implements ObjectMapping {
@@ -50,7 +49,6 @@ public class IndirectObjectMapping imple
 
     public void endSession() {
         scopedMappings.get(Scope.SESSION).clear();
-//        scopedMappings.get(Scope.INTERACTION).clear();
         nextId = 0;
     }
 
@@ -58,7 +56,6 @@ public class IndirectObjectMapping imple
         reloadIdentityMap(Scope.GLOBAL);
         reloadIdentityMap(Scope.SESSION);
         reloadIdentityMap(Scope.INTERACTION);
-   //     reloadIdentityMap(Scope.REQUEST);
         
         Map<String, Mapping> map = scopedMappings.get(Scope.INTERACTION);
         scopedMappings.put(Scope.REQUEST, map);
@@ -84,29 +81,29 @@ public class IndirectObjectMapping imple
         scopedMappings.get(scope).remove(id);
     }
 
-    public void appendMappings(Request content) {
-        appendMappings(content, scopedMappings.get(Scope.INTERACTION));
+    public void appendMappings(DebugBuilder debug) {
+        appendMappings(debug, scopedMappings.get(Scope.INTERACTION));
     }
 
-    private void appendMappings(Request content, Map<String, Mapping> map) {
+    private void appendMappings(DebugBuilder debug, Map<String, Mapping> map) {
         Iterator<String> names = map.keySet().iterator();
         while (names.hasNext()) {
             String id = names.next();
             ObjectAdapter object = mappedObject(id);
-            content.appendHtml(id + " -> " + object + "\n");
+            debug.appendln(id, object);
         }
     }
 
-    private void appendMappings(DebugView view, Scope scope) {
-        view.divider("Objects for " + scope);
+    private void appendMappings(DebugBuilder debug, Scope scope) {
+        debug.appendTitle("Objects for " + scope);
         Map<String, Mapping> map = scopedMappings.get(scope);
         Iterator<String> ids = new TreeSet(map.keySet()).iterator();
         if (!ids.hasNext()) {
-            view.appendRow("None", "");
+            debug.appendln("None", "");
         }
         while (ids.hasNext()) {
             String key = ids.next();
-            view.appendRow(key, map.get(key).debug());
+            debug.appendln(key, map.get(key).debug());
         }
     }
 
@@ -175,13 +172,13 @@ public class IndirectObjectMapping imple
         return null;
     }
 
-    public void append(DebugView view) {
-        view.appendRow("Next ID", nextId);
+    public void append(DebugBuilder debug) {
+        debug.appendln("Next ID", nextId);
 
-        appendMappings(view, Scope.GLOBAL);
-        appendMappings(view, Scope.SESSION);
-        appendMappings(view, Scope.INTERACTION);
-        appendMappings(view, Scope.REQUEST);
+        appendMappings(debug, Scope.GLOBAL);
+        appendMappings(debug, Scope.SESSION);
+        appendMappings(debug, Scope.INTERACTION);
+        appendMappings(debug, Scope.REQUEST);
     }
 
 }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java Tue Mar 22 21:27:39 2011
@@ -20,10 +20,9 @@
 
 package org.apache.isis.viewer.scimpi.dispatcher.context;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 
 public interface ObjectMapping {
@@ -37,12 +36,12 @@ public interface ObjectMapping {
 
     void unmapObject(ObjectAdapter object, Scope scope);
 
-    void appendMappings(Request content);
+    void appendMappings(DebugBuilder content);
 
     ObjectAdapter mappedObject(String id);
 
     String mapObject(ObjectAdapter obj, Scope scope);
 
-    void append(DebugView view);
+    void append(DebugBuilder debug);
 
 }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java Tue Mar 22 21:27:39 2011
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
 import java.util.TreeSet;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.factory.InstanceUtil;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
@@ -42,8 +43,6 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.action.PropertyException;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 import org.apache.log4j.Logger;
 
 
@@ -244,70 +243,64 @@ public abstract class RequestContext {
     // ////////////////////////////
     // Debug
     // ////////////////////////////
-    public void append(DebugView view) {
-        view.divider("User");
+    public void append(DebugBuilder view) {
+        view.appendTitle("User");
         AuthenticationSession session = getSession();
-        view.appendRow("Session", session);
+        view.appendln("Session", session);
         if (session != null) {
-            view.appendRow("Name", session.getUserName());
-            view.appendRow("Roles", session.getRoles());
+            view.appendln("Name", session.getUserName());
+            view.appendln("Roles", session.getRoles());
         }
 
-        view.divider("context");
-        view.appendRow("Parent request path", requestedParentPath);
-        view.appendRow("Requested file", requestedFile);
-        view.appendRow("Parent resource path", resourceParentPath);
-        view.appendRow("Resource file", resourceFile);
+        view.appendTitle("context");
+        view.appendln("Parent request path", requestedParentPath);
+        view.appendln("Requested file", requestedFile);
+        view.appendln("Parent resource path", resourceParentPath);
+        view.appendln("Resource file", resourceFile);
 
         append(view, Scope.GLOBAL);
         append(view, Scope.SESSION);
         append(view, Scope.INTERACTION);
         append(view, Scope.REQUEST);
-        view.endTable();
+        view.endSection();
 
-        view.startTable();
+        view.startSection("Object Mapping");
         objectMapping.append(view);
     }
 
-    private void append(DebugView view, Scope scope) {
+    private void append(DebugBuilder view, Scope scope) {
         Map<String, Object> map = variables.get(scope);
         Iterator<String> keys = new TreeSet(map.keySet()).iterator();
         if (keys.hasNext()) {
-            view.divider(scope + " scoped variables");
+            view.appendTitle(scope + " scoped variables");
             while (keys.hasNext()) {
                 String key = keys.next();
                 Object object = map.get(key);
                 String mappedTo = "";
-                /*
-                if (object instanceof String) {
-                    ObjectAdapter mappedObject = mappedObject((String) object);
-                    mappedTo = mappedObject == null ? "" : " - " + mappedObject.toString();
-                }
-                */
-                view.appendRow(key, object + mappedTo);
+                view.appendln(key, object + mappedTo);
             }
         }
     }
 
-    public void append(Request content, String list) {
+    public void append(DebugBuilder content, String list) {
         if (list.equals("variables")) {
             appendVariables(content, Scope.GLOBAL);
-            content.appendHtml("\n");
+            content.blankLine();
             appendVariables(content, Scope.SESSION);
-            content.appendHtml("\n");
+            content.blankLine();
             appendVariables(content, Scope.INTERACTION);
-            content.appendHtml("\n");
+            content.blankLine();
             appendVariables(content, Scope.REQUEST);
         } else if (list.equals("mappings")) {
             objectMapping.appendMappings(content);
         }
     }
 
-    private void appendVariables(Request content, Scope scope) {
+    private void appendVariables(DebugBuilder content, Scope scope) {
         Map<String, Object> map = variables.get(scope);
         Iterator<String> names = new TreeSet(map.keySet()).iterator();
         if (names.hasNext()) {
-            content.appendHtml(scope.toString() + "\n");
+            content.appendTitle(scope.toString());
             while (names.hasNext()) {
                 String name = names.next();
                 try {
@@ -319,10 +312,9 @@ public abstract class RequestContext {
                             details = mappedObject.toString();
                         }
                     }
-                    content.appendHtml(name + " -> " + object + "  " + details + "\n");
+                    content.appendln(name, object + "  " + details);
                 } catch (Exception e) {
-                    content.appendHtml(name + " -> " + map.get(name) + "\n");
-                    //content.appendHtml(e.printStackTrace())
+                    content.appendln(name, map.get(name));
                 }
             }
         }
@@ -729,10 +721,6 @@ public abstract class RequestContext {
         return session;
     }
 
-    public Debug getDebug() {
-        return debug;
-    }
-
     public abstract String getUri();
 
     public void raiseError(int status) {}
@@ -749,6 +737,13 @@ public abstract class RequestContext {
     }
 
     
+    
+    
+   
+    public Debug getDebug() {
+        return debug;
+    }
+
     public boolean isDebugDisabled() {
         if (debugLevel == null) {
             String property = System.getProperties().getProperty("debug");
@@ -766,6 +761,14 @@ public abstract class RequestContext {
     public boolean isDebug() { 
         return getDebug() == Debug.ON; 
     }
+
+    public boolean showDebugData() {
+     //   getDebug() == RequestContext.Debug.ON
+        
+        Object variable = getVariable("debug");
+        return variable != null && ((Boolean) variable).booleanValue();
+    }
+
     
     public String getDebugTrace() { 
         return debugTrace.toString().replace('<', '[').replace('>', ']'); 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/SerialOidObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/SerialOidObjectMapping.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/SerialOidObjectMapping.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/SerialOidObjectMapping.java Tue Mar 22 21:27:39 2011
@@ -25,13 +25,12 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.simple.SerialOid;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 /**
  * @Deprecated
@@ -41,18 +40,18 @@ public class SerialOidObjectMapping impl
     private static final int RADIX = Character.MAX_RADIX;
     private final Map<String, TransientObjectMapping> transients = new HashMap<String, TransientObjectMapping>();
 
-    public void append(DebugView view) {
+    public void append(DebugBuilder debug) {
         Iterator<String> ids = new HashSet(transients.keySet()).iterator();
         if (ids.hasNext()) {
-            view.divider("Transient objects");
+            debug.appendTitle("Transient objects");
             while (ids.hasNext()) {
                 String key = ids.next();
-                view.appendRow(key, transients.get(key).debug());
+                debug.appendln(key, transients.get(key).debug());
             }
         }
     }
 
-    public void appendMappings(Request request) {}
+    public void appendMappings(DebugBuilder request) {}
 
     public void clear(Scope scope) {
         Iterator<TransientObjectMapping> mapping = transients.values().iterator();

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java Tue Mar 22 21:27:39 2011
@@ -28,6 +28,7 @@ import java.util.Comparator;
 import java.util.List;
 
 import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.debug.DebugString;
 import org.apache.isis.core.commons.debug.DebuggableWithTitle;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -46,6 +47,7 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 
 import com.google.common.base.Function;
 import com.google.common.collect.Collections2;
@@ -65,7 +67,7 @@ public class DebugAction implements Acti
     }
 
     @Override
-    public void debug(DebugView view) {}
+    public void debug(DebugBuilder debug) {}
 
     @Override
     public void process(RequestContext context) throws IOException {
@@ -74,13 +76,21 @@ public class DebugAction implements Acti
         }
         
         String action = context.getParameter("action");
-        if ("i18n".equals(action)) {
+        if ("list-i18n".equals(action)) {
             i18n(context, null);            
-        } else if ("authorization".equals(action)) {
-            authorization(context, null);            
+        } else if ("list-authorization".equals(action)) {
+            authorization(context, null);      
+        } else if (context.getParameter("mode") != null) {            
+            boolean isDebugOn = context.getParameter("mode").equals("debug");
+            context.addVariable("debug", isDebugOn, Scope.SESSION);
+            // TODO need to use configuration to find path
+            context.setRequestPath("/debug/debug.shtml");
         } else {
-            DebugView view = new DebugView(context.getWriter(), new DebugString());
-            view.header();
+            
+            
+            
+            // TODO remove - replaced by Debug tag
+            DebugWriter view = new DebugWriter(context.getWriter(), true);
             view.appendln("<div class=\"links\">");
             view.appendln("<a href=\"debug.app?action=system\">System</a>");
             view.appendln(" | <a href=\"debug.app?action=specifications\">List specifications</a>");
@@ -89,12 +99,11 @@ public class DebugAction implements Acti
             view.appendln(" | <a href=\"debug.app?action=context\">Context</a>");
             view.appendln(" | <a href=\"debug.app?action=dispatcher\">Dispatcher</a>");
             view.appendln("</div>");
-            view.startTable();
             
             if ("specifications".equals(action)) {
                 listSpecifications(view);
             } else   if ("specification".equals(action)) {
-                specification(context, view);            
+          //      specification(context, view);            
             } else   if ("object".equals(action)) {
                 object(context, view);            
             } else   if ("system".equals(action)) {
@@ -104,34 +113,32 @@ public class DebugAction implements Acti
             } else   if ("dispatcher".equals(action)) {
                 dispatcher.debug(view);
             }
-            
-            view.endTable();
-            view.footer();
+
             context.clearRequestedPath();
         }
     }
 
-    private void object(RequestContext context, DebugView view) {
+    private void object(RequestContext context, DebugWriter view) {
         ObjectAdapter object = context.getMappedObjectOrResult(context.getParameter("object"));
         DebugString str = new DebugString();
         Dump.adapter(object, str);
         Dump.graph(object, str, IsisContext.getAuthenticationSession());
-        view.divider(object.getSpecification().getFullIdentifier());
-        view.appendRow("<pre class=\"debug\">" + str + "</pre>");
+        view.appendTitle(object.getSpecification().getFullIdentifier());
+        view.appendln("<pre class=\"debug\">" + str + "</pre>");
     }
 
-    private void system(RequestContext context, DebugView view) {
+    private void system(RequestContext context, DebugWriter view) {
         DebuggableWithTitle[] debug = IsisContext.debugSystem();
-        view.divider("System");
+        view.appendTitle("System");
         for (int i = 0; i < debug.length; i++) {
             DebugString str = new DebugString();
             debug[i].debugData(str);
-            view.divider(debug[i].debugTitle());
-            view.appendRow("<pre class=\"debug\">" + str + "</pre>");
+            view.appendTitle(debug[i].debugTitle());
+            view.appendln("<pre class=\"debug\">" + str + "</pre>");
         }
     }
 
-    private void i18n(RequestContext context, DebugView view) {
+    private void i18n(RequestContext context, DebugWriter view) {
         Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
         final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications);
         Collections.sort(specs, new Comparator<ObjectSpecification>() {
@@ -162,7 +169,7 @@ public class DebugAction implements Acti
         }
     }
 
-    private void authorization(RequestContext context, DebugView view) {
+    private void authorization(RequestContext context, DebugWriter view) {
         Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
         final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications);
         Collections.sort(specs, new Comparator<ObjectSpecification>() {
@@ -194,156 +201,13 @@ public class DebugAction implements Acti
         }
     }
 
-    private void specification(RequestContext context, DebugView view) {
-        String name = context.getParameter("name");
-        ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
-        DebugString str = new DebugString();
-        Dump.specification(spec, str);
-        view.divider(spec.getFullIdentifier());
-        view.appendRow("Hash code", "#" + Integer.toHexString(spec.hashCode()));
-        view.appendRow("ID", spec.getIdentifier());
-        view.appendRow("Full name", spec.getFullIdentifier());
-        view.appendRow("Short name", spec.getShortIdentifier());
-        view.appendRow("Singular name", spec.getSingularName());
-        view.appendRow("Plural name", spec.getPluralName());
-        view.appendRow("Description", spec.getDescription());
-
-        view.appendRow("Type", "?");
-        view.appendRow("Value/aggregated", String.valueOf(!spec.isValueOrIsAggregated()));
-
-        
-        view.appendRow("Parent specification", specificationLink(spec.superclass()));
-        specificationClasses(view, "Child specifications",  spec.subclasses());
-        specificationClasses(view, "Implemented interfaces", spec.interfaces());
-        speficationFacets(view, spec);
-        
-        
-        List<ObjectAssociation> fields = spec.getAssociations();
-        specificationMembers(view, "Fields", fields);
-        List<ObjectAction> userActions = spec.getObjectActions(ActionType.USER);
-        specificationMembers(view, "User Actions", userActions);
-        specificationMembers(view, "Exploration Actions", spec.getObjectActions(ActionType.EXPLORATION));
-        specificationMembers(view, "Prototype Actions", spec.getObjectActions(ActionType.PROTOTYPE));
-        specificationMembers(view, "Debug Actions", spec.getObjectActions(ActionType.DEBUG));
-
-        
-        for (int i = 0; i < fields.size(); i++) {
-            ObjectAssociation field = fields.get(i);
-            view.divider("<span id=\"" + field.getId() + "\"><em>Field:</em> " + field.getId() + "</span>");
-            view.appendRow("ID", field.getIdentifier());
-            view.appendRow("Short ID", field.getId());
-            view.appendRow("Name", field.getName());
-            view.appendRow("Specification", specificationLink(field.getSpecification()));
-
-            view.appendRow("Type",  field.isOneToManyAssociation() ? "Collection" : field.isOneToOneAssociation() ? "Object" : "Unknown");
-            view.appendRow("Flags", (field.isAlwaysHidden() ? "": "Visible ") + (field.isNotPersisted() ? "Not Persisted": " ")
-                    + (field.isMandatory() ? "Mandatory " : ""));
-
-            speficationFacets(view, field);
-        }
-        
-        for (int i = 0; i < userActions.size(); i++) {
-            final ObjectAction action = userActions.get(i);
-            view.divider("<span id=\"" + action.getId() + "\"><em>Action:</em> " + action.getId() + "</span>");
-            view.appendRow("ID", action.getIdentifier());
-            view.appendRow("Short ID", action.getId());
-            view.appendRow("Name", action.getName());
-            view.appendRow("Specification", specificationLink(action.getSpecification()));
-
-            view.appendRow("Target", action.getTarget());
-            view.appendRow("On type", specificationLink(action.getOnType()));
-
-            ObjectSpecification returnType = action.getReturnType();
-            view.appendRow("Returns", returnType == null ? "VOID" : specificationLink(returnType));
-            
-            speficationFacets(view, action);
-
-            List<ObjectActionParameter> parameters = action.getParameters();
-            StringBuffer buffer = new StringBuffer();
-            if (parameters.size() == 0) {
-                buffer.append("none");
-            } else {
-                List<ObjectActionParameter> p = action.getParameters();
-                for (int j = 0; j < parameters.size(); j++) {
-                    buffer.append(p.get(j).getName());
-                    buffer.append(" (");
-                    buffer.append(specificationLink(parameters.get(j).getSpecification()));
-                    buffer.append(")<br>");
-                    Class<? extends Facet>[] parameterFacets = p.get(j).getFacetTypes();
-                    for (int k = 0; k < parameterFacets.length; k++) {
-                        buffer.append("&nbsp;&nbsp;" + p.get(j).getFacet(parameterFacets[k]).toString() + "<br>");
-                    }
-                }
-            }
-            view.appendRow("Parameters", buffer.toString());
-        }
-        
-        /*
-        
-        view.divider(spec.getFullName());
-        view.appendRow("<pre class=\"debug\">" + str + "</pre>");
-        */
-    }
-
-    private void specificationMembers(DebugView view, String label, List<? extends ObjectMember> members) {
-        StringBuffer buffer = new StringBuffer();
-        if (members.size() == 0) {
-            buffer.append("none");
-        } else {
-            for (int i = 0; i < members.size(); i++) {
-                buffer.append("<a href=\"#" + members.get(i).getId() + "\">" + members.get(i).getId() + "</a><br>");
-            }
-        }
-        view.appendRow(label, buffer.toString());
-    }
-
-    private void speficationFacets(DebugView view, FacetHolder facetHolder) {
-        Facet[] facets = facetHolder.getFacets(new Filter<Facet>() {
-            @Override
-            public boolean accept(Facet facet) {
-                return true;
-            }
-        });
-        StringBuffer buffer = new StringBuffer();
-        if (facets == null || facets.length == 0) {
-            buffer.append("none");
-        } else {
-            for (int i = 0; i < facets.length; i++) {
-                String facetType = facets[i].facetType().getName();
-                buffer.append("<span class=\"facet-type\">" + facetType .substring(facetType.lastIndexOf('.') + 1)  + "</span>:  " + facets[i] + "<br>");
-            }
-        }
-        view.appendRow("Facets", buffer.toString());
-    }
-
-    private void specificationClasses(DebugView view, String label, List<ObjectSpecification> subclasses) {
-        StringBuffer buffer = new StringBuffer();
-        if (subclasses.size() == 0) {
-            buffer.append("none");
-        } else {
-            for (int i = 0; i < subclasses.size(); i++) {
-                buffer.append(specificationLink(subclasses.get(i)) + "<br>");
-            }
-        }
-        view.appendRow(label, buffer.toString());
-    }
-
-    private String specificationLink(ObjectSpecification specification) {
-        if (specification == null) {
-            return "none";
-        } else {
-            String name = specification.getFullIdentifier();
-            return "<a href=\"debug.app?action=specification&name=" + name + "\">" + name + "</a>";
-        }
-    }
-    
-    private void listSpecifications(DebugView view) {
+    private void listSpecifications(DebugWriter view) {
         List<ObjectSpecification> fullIdentifierList = new ArrayList<ObjectSpecification>(getSpecificationLoader().allSpecifications());
         Collections.sort(fullIdentifierList, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
-        view.divider("Specifications");
+        view.appendTitle("Specifications");
         for (ObjectSpecification spec : fullIdentifierList) {
             String name = spec.getSingularName();
-            view.appendRow(name, specificationLink(spec));
+      //      view.appendln(name, specificationLink(spec));
         }
 
         

Copied: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugWriter.java (from r1082942, incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugWriter.java?p2=incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugWriter.java&p1=incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java&r1=1082942&r2=1084356&rev=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugWriter.java Tue Mar 22 21:27:39 2011
@@ -17,107 +17,28 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.debug;
 
 import java.io.PrintWriter;
-import java.io.StringWriter;
 
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.core.commons.debug.DebugHtmlStringAbstract;
+
 
+public class DebugWriter extends DebugHtmlStringAbstract {
 
-public class DebugView {
     private final PrintWriter writer;
-    private final DebugString debug;
 
-    public DebugView(PrintWriter writer, DebugString debug) {
+    public DebugWriter(PrintWriter writer, boolean createPage) {
+        super(createPage);
         this.writer = writer;
-        this.debug = debug;
-    }
-    
-    public void header() {
-        appendln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
-        appendln("<html>");
-        appendln("<head>");
-        appendln("<title>Debug Details</title>");
-        appendln("<style type=\"text/css\">");
-        appendln("body { margin: 15px; }\n" +
-                "links { font-size: 80%; padding-bottom:5px; }\n" +  
-                "td {vertical-align: top; margin-left: 15px;}\n" +  
-                "td.error {color: red; font-style: italic; }\n" +  
-                "td.code {white-space: pre; font-family: monospace;}\n" +  
-                "th.title {text-align: left; padding: 0.3em 1em; font-style: italic; background: #AED1FF; }\n" +  
-                "td.label {width: 14em; text-align: right; padding-right: 1.5em; padding-top: 0.2em; font-size: 80%; font-weight: bold; }\n" +  
-                "span.facet-type { font-weight: bold; padding-right: 10px; }\n");
-        appendln("</style>");
-        appendln("</head>");
-        appendln("<body>");
-    }
-
-
-    public void startTable() {
-        writer.flush();
-        writer.println("<table class=\"debug\" width=\"100%\" summary=\"Debug details\" >");
-    }
-
-    public void exception(Throwable e) {
-        divider("Exception");
-        String message = e instanceof  ScimpiException ? ((ScimpiException) e).getHtmlMessage() : e.getMessage();
-        if (message != null) {
-            writer.println("<tr><td class=\"error\" colspan=\"2\" >" + message + "<td></tr>");
-        }
-        causingException(e);
-        writer.println("<tr><td class=\"code\" colspan=\"2\" >");
-        e.printStackTrace(writer);
-        writer.println("<td></tr>");
-        
-        StringWriter stringWriter = new StringWriter();
-        PrintWriter printWriter = new PrintWriter(stringWriter);
-        e.printStackTrace(printWriter);
-        debug.appendln(stringWriter.toString());
-    }
-
-    private void causingException(Throwable throwable) {
-        Throwable cause = throwable.getCause();
-        if (cause != null && cause != throwable) {
-            writer.println("<tr><td colspan=\"2\" >" + cause.getMessage() + "<td></tr>");
-            debug.appendln(cause.getMessage());
-            causingException(cause);
-        }
+        header();
     }
 
-    public void divider(String title) {
-        writer.println("<tr><th class=\"title\" colspan=\"2\" >" + title + "</th></tr>");
-        debug.appendTitle(title);
+    protected void appendHtml(String html) {
+        writer.println(html);
     }
 
-    public void endTable() {
-        writer.println("</table>");
-    }
-
-    public void appendRow(String name, Object object) {
-        String value = object == null ? "null" : object.toString();
-        writer.println("<tr><td class=\"label\">" + name + "</td><td>" + value + "<td></tr>");
-        debug.appendln(name, value);
-    }
-
-    public void appendRow(Object object) {
-        writer.println("<tr><td colspan=\"2\">" + object.toString() + "<td></tr>"); 
-        debug.appendln(object.toString());
-    } 
-
-    public void appendDebugTrace(String text) { 
-        writer.println("<tr><td colspan=\"2\"><pre>" + text + "</pre><td></tr>"); 
-    }
-
-    public void appendln(Object object) {
-        writer.println(object.toString());
-    }
-
-    public void footer() {
-        appendln("</body>");
-        appendln("</html>");
+    protected void doClose() {
+        footer();
     }
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java Tue Mar 22 21:27:39 2011
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.version.Version;
 import org.apache.isis.core.metamodel.consent.Consent;
@@ -38,9 +39,9 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.NotLoggedInException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 
 
 public class EditAction implements Action {
@@ -53,6 +54,11 @@ public class EditAction implements Actio
 
     @Override
     public void process(RequestContext context) throws IOException {
+        AuthenticationSession session = context.getSession();
+        if (session == null) {
+            throw new NotLoggedInException();
+        }
+        
         try {
             String objectId = context.getParameter(OBJECT);
             String version = context.getParameter(VERSION);
@@ -62,7 +68,47 @@ public class EditAction implements Actio
             String message = context.getParameter(MESSAGE);
             
             ObjectAdapter adapter = context.getMappedObject(objectId);
-            AuthenticationSession session= IsisContext.getAuthenticationSession();
+            
+            if (adapter.isTransient()) {
+                //restore object state first
+                List<ObjectAssociation> fields = adapter.getSpecification().getAssociations();
+                for (int i = 0; i < fields.size(); i++) {
+                    ObjectAssociation field = fields.get(i);
+                    String fieldId = field.getId();
+                    String newEntry = context.getParameter(fieldId);
+                    if (fields.get(i).isOneToManyAssociation()) {
+                        continue;
+                    }
+                    if (newEntry != null && newEntry.equals("-OTHER-")) {
+                        newEntry = context.getParameter(fieldId + "-other");
+                    }
+                    if (newEntry == null) {
+                        // TODO duplicated in EditObject; line 97
+                        ObjectSpecification spec = field.getSpecification();
+                        if (spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(boolean.class))
+                                        || spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(Boolean.class))) {
+                            newEntry = FALSE;
+                        } else {
+                           continue;
+                        }
+                    }
+                    
+                    ObjectAdapter originalValue = null; // fields.get(i).get(adapter);
+                    if (fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
+                        ParseableFacet facet = fields.get(i).getSpecification().getFacet(ParseableFacet.class);
+                        ObjectAdapter newValue =  facet.parseTextEntry(originalValue, newEntry);
+                        ((OneToOneAssociation) fields.get(i)).setAssociation(adapter, newValue);
+                    } else {
+                        ObjectAdapter associate = context.getMappedObject(newEntry);
+                        if (associate != null) {
+                            IsisContext.getPersistenceSession().resolveImmediately(associate);
+                        }
+                        ((OneToOneAssociation) fields.get(i)).setAssociation(adapter, associate);
+                    }
+                }
+
+            }
+            
             List<ObjectAssociation> fields = adapter.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, adapter));
             FormState entryState = validateObject(context, adapter, fields);
             Version adapterVersion = adapter.getVersion();
@@ -245,6 +291,6 @@ public class EditAction implements Actio
     public void init() {}
 
     @Override
-    public void debug(DebugView view) {}
+    public void debug(DebugBuilder debug) {}
 }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java Tue Mar 22 21:27:39 2011
@@ -22,16 +22,18 @@ package org.apache.isis.viewer.scimpi.di
 
 import java.io.IOException;
 
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.NotLoggedInException;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 
 /**
  * Remove an element from a collection. 
@@ -44,6 +46,11 @@ public class RemoveAction implements Act
     }
 
     public void process(RequestContext context) throws IOException {
+        AuthenticationSession session = context.getSession();
+        if (session == null) {
+            throw new NotLoggedInException();
+        }
+        
         String parentId = context.getParameter(OBJECT);
         String rowId = context.getParameter(ELEMENT);
 
@@ -99,6 +106,6 @@ public class RemoveAction implements Act
 
     public void init() {}
 
-    public void debug(DebugView view) {}
+    public void debug(DebugBuilder debug) {}
 }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java Tue Mar 22 21:27:39 2011
@@ -23,13 +23,13 @@ package org.apache.isis.viewer.scimpi.di
 import java.io.IOException;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.runtimes.dflt.runtime.authentication.AuthenticationRequestPassword;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.UserManager;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.FieldEditState;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
 
@@ -79,6 +79,6 @@ public class LogonAction implements Acti
 
     public void init() {}
 
-    public void debug(DebugView view) {}
+    public void debug(DebugBuilder debug) {}
 }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java Tue Mar 22 21:27:39 2011
@@ -22,11 +22,11 @@ package org.apache.isis.viewer.scimpi.di
 import java.io.IOException;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.UserManager;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 
 
 public class LogoutAction implements Action {
@@ -52,6 +52,6 @@ public class LogoutAction implements Act
         context.redirectTo(view);
     }
 
-    public void debug(DebugView view) {}
+    public void debug(DebugBuilder debug) {}
 
 }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java Tue Mar 22 21:27:39 2011
@@ -25,8 +25,8 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.TreeSet;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugView;
 import org.apache.isis.viewer.scimpi.dispatcher.view.History;
 import org.apache.isis.viewer.scimpi.dispatcher.view.RevisionNumber;
 import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionButton;
@@ -37,8 +37,8 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.action.RunAction;
 import org.apache.isis.viewer.scimpi.dispatcher.view.action.Services;
 import org.apache.isis.viewer.scimpi.dispatcher.view.collection.Collection;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Debug;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.DebugAccessCheck;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.DebuggerLink;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Diagnostics;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Members;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.PrintAuthorizationClause;
@@ -126,8 +126,8 @@ public class ProcessorLookup {
         addElementProcessor(new ContentTag()); 
         addElementProcessor(new CountElements());
         addElementProcessor(new Diagnostics());
-        addElementProcessor(new Debug());
         addElementProcessor(new DebugAccessCheck());
+        addElementProcessor(new DebuggerLink());
         addElementProcessor(new DefaultValue()); 
         addElementProcessor(new EditLink());
         addElementProcessor(new EditObject());
@@ -203,12 +203,12 @@ public class ProcessorLookup {
         swfElementProcessors.put("SWF:" + action.getName().toUpperCase(), action);
     }
 
-    public void debug(DebugView view) {
-        view.divider("Recognised tags");
+    public void debug(DebugBuilder debug) {
+        debug.appendTitle("Recognised tags");
         Iterator<String> it2 = new TreeSet<String>(swfElementProcessors.keySet()).iterator();
         while (it2.hasNext()) {
             String name = it2.next();
-            view.appendRow(name.toLowerCase(), swfElementProcessors.get(name));
+            debug.appendln(name.toLowerCase(), swfElementProcessors.get(name));
         }
     }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java?rev=1084356&r1=1084355&r2=1084356&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java Tue Mar 22 21:27:39 2011
@@ -1,5 +1,6 @@
 package org.apache.isis.viewer.scimpi.dispatcher.view;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -20,7 +21,8 @@ public class History extends AbstractEle
         String link;
     }
 
-    static class Crumbs {
+    static class Crumbs implements Serializable {
+        private static final long serialVersionUID = 1L;
         private static final int MAXIMUM_SIZE = 10;
         private List<Crumb> crumbs = new ArrayList<Crumb>();
 



Mime
View raw message