You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/03/30 14:56:30 UTC

[01/22] isis git commit: ISIS-720: mothballing scimpi

Repository: isis
Updated Branches:
  refs/heads/master afc5cad2c -> 2c7cfbfec


http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
new file mode 100644
index 0000000..9b01b60
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
@@ -0,0 +1,373 @@
+/*
+ *  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.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+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.viewer.scimpi.dispatcher.DispatchException;
+import org.apache.isis.viewer.scimpi.dispatcher.ErrorCollator;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiNotFoundException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUsers;
+
+public class ServletRequestContext extends RequestContext {
+    private HttpServletRequest request;
+    private HttpServletResponse response;
+    private ServletContext servletContext;
+    private boolean isAborted;
+
+    public ServletRequestContext(final DebugUsers debugUsers) {
+        super(debugUsers);
+    }
+
+    public void append(final DebugBuilder view) {
+        super.append(view);
+
+        /*
+         * view.divider("System"); Runtime.getRuntime().
+         */
+        view.startSection("HTTP Serviet Request");
+        view.appendTitle("General");
+        view.appendln("Auth type", request.getAuthType());
+        view.appendln("Character encoding", request.getCharacterEncoding());
+        view.appendln("Class", request.getClass());
+        view.appendln("Content type", request.getContentType());
+        view.appendln("Context path", getContextPath());
+        view.appendln("Locale", request.getLocale());
+        view.appendln("Method", request.getMethod());
+        view.appendln("Path info", request.getPathInfo());
+        view.appendln("Path translated", request.getPathTranslated());
+        view.appendln("Protocol", request.getProtocol());
+        view.appendln("Query string", request.getQueryString());
+        view.appendln("Remote host", request.getRemoteHost());
+        view.appendln("Remote user", request.getRemoteUser());
+        view.appendln("Real path", servletContext.getRealPath("/"));
+        view.appendln("Scheme", request.getScheme());
+        view.appendln("Server name", request.getServerName());
+        view.appendln("Servlet path", request.getServletPath());
+        view.appendln("Session", request.getSession());
+        view.appendln("Session ID", request.getRequestedSessionId());
+        view.appendln("URI", request.getRequestURI());
+        view.appendln("URL", request.getRequestURL());
+        view.appendln("User principle", request.getUserPrincipal());
+
+        
+        final Cookie[] cookies = request.getCookies();
+        if (cookies != null) {
+            view.appendTitle("Cookies");
+            for (final Cookie cookie : cookies) {
+                view.appendln(cookie.getName(), cookie.getValue());
+            }
+        }
+        
+        final Enumeration attributeNames = request.getAttributeNames();
+        if (attributeNames.hasMoreElements()) {
+            view.appendTitle("Attributes");
+            while (attributeNames.hasMoreElements()) {
+                final String name = (String) attributeNames.nextElement();
+                view.appendln(name, request.getAttribute(name));
+            }
+        }
+
+        view.appendTitle("Headers");
+        final Enumeration headerNames = request.getHeaderNames();
+        while (headerNames.hasMoreElements()) {
+            final String name = (String) headerNames.nextElement();
+            view.appendln(name, request.getHeader(name));
+        }
+
+        view.appendTitle("Parameters");
+        final Enumeration parameterNames = request.getParameterNames();
+        while (parameterNames.hasMoreElements()) {
+            final String name = (String) parameterNames.nextElement();
+            view.appendln(name, request.getParameter(name));
+        }
+
+        view.appendTitle("Servlet Context");
+        final ServletContext context = getServletContext();
+        view.appendln("Name", context.getServletContextName());
+        view.appendln("Server Info", context.getServerInfo());
+        view.appendln("Version", context.getMajorVersion() + "." + context.getMinorVersion());
+        view.appendln("Attributes", getAttributes(context));
+        view.appendln("Init parameters", getParameters(context));
+        view.appendln("Real path", context.getRealPath("/"));
+    }
+
+    private String getAttributes(final ServletContext context) {
+        final StringBuffer buf = new StringBuffer();
+        final Enumeration names = context.getAttributeNames();
+        while (names.hasMoreElements()) {
+            final String name = (String) names.nextElement();
+            buf.append(name + "=" + context.getAttribute(name));
+        }
+        return buf.toString();
+    }
+
+    private String getParameters(final ServletContext context) {
+        final StringBuffer buf = new StringBuffer();
+        final Enumeration names = context.getInitParameterNames();
+        while (names.hasMoreElements()) {
+            final String name = (String) names.nextElement();
+            buf.append(name + "=" + context.getInitParameter(name));
+        }
+        return buf.toString();
+    }
+
+    public void startRequest(final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext) {
+        this.request = request;
+        this.response = response;
+        this.servletContext = servletContext;
+        final Enumeration parameterNames = request.getParameterNames();
+        while (parameterNames.hasMoreElements()) {
+            final String name = (String) parameterNames.nextElement();
+            addParameter(name, request.getParameter(name));
+        }
+        initSession();
+    }
+
+    public HttpServletRequest getRequest() {
+        return request;
+    }
+
+    public HttpServletResponse getResponse() {
+        return response;
+    }
+
+    public ServletContext getServletContext() {
+        return servletContext;
+    }
+
+    @Override
+    public PrintWriter getWriter() {
+        try {
+            return response.getWriter();
+        } catch (final IOException e) {
+            throw new ScimpiException(e);
+        }
+    }
+
+    @Override
+    public String findFile(final String fileName) {
+        try {
+            if (getServletContext().getResource(fileName) == null) {
+                return null;
+            } else {
+                return fileName;
+            }
+        } catch (final MalformedURLException e) {
+            throw new ScimpiException(e);
+        }
+    }
+
+    @Override
+    public String getErrorDetails() {
+        return (String) getRequest().getAttribute("com.planchaser.error.details");
+    }
+
+    @Override
+    public String getErrorMessage() {
+        return (String) getRequest().getAttribute("com.planchaser.error.message");
+    }
+
+    @Override
+    public String getErrorReference() {
+        return (String) getRequest().getAttribute("com.planchaser.error.reference");
+    }
+
+    @Override
+    public InputStream openStream(final String path) {
+        final InputStream in = servletContext.getResourceAsStream(path);
+
+        if (in == null) {
+            servletContext.getResourcePaths("/");
+            try {
+                servletContext.getResource(path);
+            } catch (final MalformedURLException e) {
+                throw new ScimpiException(e);
+            }
+
+            throw new ScimpiNotFoundException("Cannot find file " + path);
+        }
+        return in;
+    }
+    
+    @Override
+    public void startHttpSession() {
+        addVariable("_auth_session", getSession(), Scope.SESSION); 
+    }
+
+    private void initSession(){
+        final HttpSession httpSession = request.getSession(true);
+        // TODO when using version 3.0 of Servlet API use the HttpOnly setting for improved security
+        if (httpSession.getAttribute("scimpi-context") == null) {
+            final Map<String, Object> sessionData = getSessionData();
+            httpSession.setAttribute("scimpi-context", sessionData);
+        } else {
+            final HashMap<String, Object> data = (HashMap<String, Object>) httpSession.getAttribute("scimpi-context");
+            if (data != null) {
+                setSessionData(data);
+            }
+        }
+    }
+
+    @Override
+    protected String getSessionId() {
+        return request.getSession().getId();
+    }
+
+    @Override
+    public String clearSession() {
+        request.getSession().invalidate();
+        return null;
+    }
+
+    @Override
+    public void reset() {
+        try {
+            response.getWriter().print("<h1>RESET</h1>");
+        } catch (final IOException e) {
+            throw new DispatchException(e);
+        }
+        response.reset();
+    }
+
+    @Override
+    public void forward(final String view) {
+        try {
+            isAborted = true;
+            getRequest().getRequestDispatcher(view).forward(getRequest(), getResponse());
+        } catch (final IOException e) {
+            throw new DispatchException(e);
+        } catch (final ServletException e) {
+            throw new DispatchException(e);
+        }
+    }
+
+    @Override
+    public void redirectTo(final String view) {
+        try {
+            isAborted = true;
+            getResponse().sendRedirect(view);
+        } catch (final IOException e) {
+            throw new DispatchException(e);
+        }
+    }
+
+    @Override
+    public void raiseError(final int status, final ErrorCollator errorDetails) {
+        try {
+            isAborted = true;
+            getRequest().setAttribute("com.planchaser.error.reference", errorDetails.getReference()); 
+            getRequest().setAttribute("com.planchaser.error.message", errorDetails.getMessage());
+            getRequest().setAttribute("com.planchaser.error.details", errorDetails.getDetails());
+            getResponse().sendError(status);
+        } catch (final IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public boolean isAborted() {
+        return isAborted;
+    }
+
+    @Override
+    public void setContentType(final String string) {
+        getResponse().setContentType(string);
+    }
+
+    @Override
+    public String imagePath(final ObjectAdapter object) {
+        final String contextPath = getContextPath();
+        return ImageLookup.imagePath(object, contextPath);
+    }
+
+    @Override
+    public String imagePath(final ObjectSpecification specification) {
+        final String contextPath = getContextPath();
+        return ImageLookup.imagePath(specification, contextPath);
+    }
+
+    @Override
+    public String getContextPath() {
+        return request.getContextPath();
+    }
+
+    @Override
+    public String getHeader(final String name) {
+        return request.getHeader(name);
+    }
+
+    @Override
+    public String getQueryString() {
+        return request.getQueryString();
+    }
+
+    @Override
+    public String getUri() {
+        return request.getRequestURI() + "?" + request.getQueryString();
+    }
+
+    @Override
+    public String getUrlBase() {
+        // return request.getScheme() + request.getServerName() +
+        // request.getServerPort();
+        final StringBuffer url = request.getRequestURL();
+        url.setLength(url.length() - request.getRequestURI().length());
+        return url.toString();
+    }
+
+    @Override
+    public void addCookie(final String name, final String value, final int minutesUtilExpires) {
+        final Cookie cookie = new Cookie(name, value);
+        cookie.setMaxAge(minutesUtilExpires * 60);
+        response.addCookie(cookie);
+    }
+
+    @Override
+    public String getCookie(final String name) {
+        final Cookie[] cookies = request.getCookies();
+        if (cookies != null) {
+            for (final Cookie cookie : cookies) {
+                if (cookie.getName().equals(name)) {
+                    return cookie.getValue();
+                }
+            }
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml b/mothballed/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml
new file mode 100644
index 0000000..ecd3906
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<supplementalDataModels xmlns="http://maven.apache.org/supplemental-model/1.0.0"
+                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                        xsi:schemaLocation="http://maven.apache.org/supplemental-model/1.0.0 http://maven.apache.org/xsd/supplemental-model-1.0.0.xsd">
+
+  <supplement>
+    <project>
+      <groupId>aopalliance</groupId>
+      <artifactId>aopalliance</artifactId>
+      <version>1.0</version>
+      <licenses>
+          <license>
+              <name>Public Domain</name>
+          </license>
+      </licenses>
+    </project>
+  </supplement>
+
+  <supplement>
+   	<!-- not quite sure why licenses:download-license flags this, since license info seems to be in its POM -->
+    <project>
+		<groupId>org.datanucleus</groupId>
+	    <artifactId>datanucleus-jodatime</artifactId>
+	    <version>3.1.1</version>
+          <licenses>
+			<license>
+	            <name>The Apache Software License, Version 2.0</name>
+	            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+	        </license>
+	    </licenses>
+    </project>
+  </supplement>
+
+  <supplement>
+    <project>
+      <groupId>org.scannotation</groupId>
+      <artifactId>scannotation</artifactId>
+      <version>1.0.3</version>
+      <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>          
+        </license>
+      </licenses>
+    </project>
+  </supplement>
+    
+  <supplement>
+    <project>
+      <groupId>dom4j</groupId>
+      <artifactId>dom4j</artifactId>
+      <version>1.6.1</version>
+      <licenses>
+        <license>
+            <name>BSD License</name>
+            <url>http://dom4j.sourceforge.net/dom4j-1.6.1/license.html</url>
+            <distribution>repo</distribution>          
+        </license>
+      </licenses>
+    </project>
+  </supplement>
+
+  <supplement>
+    <project>
+      <groupId>net.jcip</groupId>
+      <artifactId>jcip-annotations</artifactId>
+      <version>1.0</version>
+      <licenses>
+        <license>
+            <name>Creative Commons Attribution 2.5 License</name>
+            <url>http://creativecommons.org/licenses/by/2.5/</url>
+            <distribution>repo</distribution>          
+        </license>
+      </licenses>
+    </project>
+  </supplement>
+  
+
+  <supplement>
+    <project>
+      <groupId>xalan</groupId>
+      <artifactId>xalan</artifactId>
+      <version>2.7.0</version>
+      <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>          
+        </license>
+      </licenses>
+    </project>
+  </supplement>
+
+ 
+</supplementalDataModels>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/pom.xml b/mothballed/component/viewer/scimpi/tck/pom.xml
new file mode 100644
index 0000000..0c71d86
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/pom.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.isis.tck</groupId>
+        <artifactId>isis-tck</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+        <relativePath>../../../../tck/pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.apache.isis.viewer</groupId>
+	<artifactId>isis-viewer-scimpi-tck</artifactId>
+	<name>Isis Scimpi Viewer TCK tests</name>
+	
+	<properties>
+        <isis-viewer-scimpi.version>1.0.0-SNAPSHOT</isis-viewer-scimpi.version>
+        <isis-objectstore-xml.version>1.0.0-SNAPSHOT</isis-objectstore-xml.version>
+        <isis-profilestore-xml.version>1.0.0-SNAPSHOT</isis-profilestore-xml.version>
+        <isis-security-file.version>1.6.0-SNAPSHOT</isis-security-file.version>
+
+        <siteBaseDir>..</siteBaseDir>
+        <relativeUrl>scimpi-tck/</relativeUrl>
+        <!-- until someone comes up with a better solution -->
+        <distMgmtSiteUrl>file:///tmp/m2-sites/isis/viewer/scimpi</distMgmtSiteUrl>
+    </properties>
+
+        <packaging>war</packaging>
+
+	<build>
+		<plugins>
+            <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>maven-jetty-plugin</artifactId>
+            </plugin>
+		</plugins>
+	</build>
+
+	<dependencies>
+	
+        <!-- other modules in this project -->
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-tck-dom</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-tck-fixture</artifactId>
+        </dependency>
+
+
+        <!-- isis non-core components -->
+        <dependency>
+            <groupId>org.apache.isis.viewer</groupId>
+            <artifactId>isis-viewer-scimpi-servlet</artifactId>
+            <version>${isis-viewer-scimpi.version}</version>
+        </dependency>
+
+
+        <!-- isis runtime -->
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-security</artifactId>
+        </dependency>
+        
+        <!-- to run using WebServer -->
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-webserver</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/resources/images/Default.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/resources/images/Default.png b/mothballed/component/viewer/scimpi/tck/src/main/resources/images/Default.png
new file mode 100644
index 0000000..8409e46
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/resources/images/Default.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml
new file mode 100644
index 0000000..724ac7a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title>Edit <swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2>Edit <swf:title /></h2>
+<swf:edit>
+	<swf:selector field="claimant" object="service:claimants" method="findEmployees" title="Employees..."/>
+	<swf:selector field="approver" object="service:claimants" method="findEmployees" title="Employees..."/>
+</swf:edit>
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml
new file mode 100644
index 0000000..406f42c
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title><swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2><swf:title /></h2>
+<swf:short-form>
+	<swf:link name="claimant"/>
+</swf:short-form>
+
+<swf:methods/>
+
+
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml
new file mode 100644
index 0000000..deb6d66
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title><swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2><swf:title /></h2>
+
+<swf:long-form />
+
+<swf:methods />
+
+
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml
new file mode 100644
index 0000000..f1865ce
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title><swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2><swf:title /></h2>
+<swf:short-form>
+	<swf:exclude name="approver"/>
+</swf:short-form>
+
+<swf:methods>
+	<swf:exclude name="submit"/>
+</swf:methods>
+
+
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml
new file mode 100644
index 0000000..f07c718
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title><swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2><swf:title /></h2>
+<swf:short-form>
+</swf:short-form>
+
+<swf:methods>
+</swf:methods>
+
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties
new file mode 100644
index 0000000..d8aab34
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties
@@ -0,0 +1,54 @@
+#  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.
+isis.services.prefix = org.apache.isis.tck.objstore.dflt
+isis.services =\
+    scalars.ApplibValuedEntityRepositoryDefault,\
+    scalars.JdkValuedEntityRepositoryDefault,\
+    scalars.PrimitiveValuedEntityRepositoryDefault,\
+    scalars.WrapperValuedEntityRepositoryDefault, \
+    simples.SimpleEntityRepositoryDefault,\
+    assocs.ParentEntityRepositoryDefault
+
+isis.fixtures.prefix= org.apache.isis.tck.fixture
+isis.fixtures=\
+    LogonAsSvenFixture,\
+    scalars.ApplibValuedEntityFixture,\
+    scalars.JdkValuedEntityFixture,\
+    scalars.PrimitiveValuedEntityFixture,\
+    scalars.WrapperValuedEntityFixture,\
+    simples.SimpleEntityFixture,\
+    assocs.ParentAndChildEntityFixture
+
+isis.exploration.users=sven, dick, bob
+
+
+
+isis.persistor.object-factory=org.apache.isis.runtimes.dflt.bytecode.dflt.objectfactory.CglibObjectFactory
+#isis.persistor.object-factory=org.apache.isis.runtimes.dflt.bytecode.javassist.objectfactory.JavassistObjectFactory
+#isis.persistor.object-factory=org.apache.isis.runtimes.dflt.bytecode.identity.objectfactory.ObjectFactoryBasic
+
+
+isis.persistor.domain-object-container=org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault
+#isis.persistor.domain-object-container=org.apache.isis.progmodel.wrapper.metamodel.DomainObjectContainerWrapperFactory
+
+
+#isis.reflector.facets.include=org.apache.isis.runtimes.dflt.runtime.authorization.standard.AuthorizationFacetFactoryImpl
+#isis.authorization.learn=true
+
+
+isis.persistor=in-memory
+#isis.xmlos.dir=/tmp/xml
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties
new file mode 100644
index 0000000..f2d65e6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties
@@ -0,0 +1,30 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#         http://www.apache.org/licenses/LICENSE-2.0
+#         
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+# apache's log4j is used to provide system logging.
+log4j.rootCategory=INFO, Console
+
+# The console appender
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.target=System.out
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE}  [%-20c{1} %-10t %-5p]  %m%n
+
+log4j.appender.File=org.apache.log4j.RollingFileAppender
+log4j.appender.File.file=isis.log
+log4j.appender.File.append=false
+log4j.appender.File.layout=org.apache.log4j.PatternLayout
+log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p]  %m%n

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow
new file mode 100644
index 0000000..928983a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow
@@ -0,0 +1,16 @@
+#  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.

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords
new file mode 100644
index 0000000..7f07af5
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords
@@ -0,0 +1,20 @@
+#  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.
+sven:pass
+dick:pass
+bob:pass
+joe:pass

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..3e61f54
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<web-app id="WebApp_ID" version="2.4"
+    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+    <display-name>Apache Isis S Viewer</display-name>
+
+    <welcome-file-list>
+        <welcome-file>index.shtml</welcome-file>
+    </welcome-file-list>
+
+    <listener>
+        <listener-class>org.apache.isis.core.webapp.IsisWebAppBootstrapper</listener-class>
+    </listener>
+
+    <context-param>
+        <param-name>isis.viewers</param-name>
+        <param-value>scimpi</param-value>
+    </context-param>
+
+    <servlet>
+        <servlet-name>dispatcher</servlet-name>
+        <servlet-class>org.apache.isis.viewer.scimpi.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>dispatcher</servlet-name>
+        <url-pattern>*.shtml</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>dispatcher</servlet-name>
+        <url-pattern>*.app</url-pattern>
+    </servlet-mapping>
+
+</web-app>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/debug.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/debug.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/debug.shtml
new file mode 100644
index 0000000..93550cf
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/debug.shtml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:template file="style/template.shtml"/>
+
+<swf:services/>
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml
new file mode 100644
index 0000000..b72bb04
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title>Action <swf:action-name method="${method}"/></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2>${title}</h2>
+<swf:action-form method="${method}" view="_generic.shtml"/>
+
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml
new file mode 100644
index 0000000..823046f
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title><swf:element-type /> Listing</swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2>${title}</h2>
+<swf:table link="_generic.shtml" />
+ 
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml
new file mode 100644
index 0000000..6d47bfc
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title>Edit <swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2>Edit <swf:title /></h2>
+<swf:edit />
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml
new file mode 100644
index 0000000..18fa5da
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title><swf:title icon="no" /></swf:page-title>
+<swf:template  file="../style/template.shtml" />
+
+<h2><swf:title /></h2>
+<swf:long-form link="_generic.shtml" />
+
+<swf:methods />
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png
new file mode 100644
index 0000000..478f115
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png
new file mode 100644
index 0000000..d85fd82
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png
new file mode 100644
index 0000000..6cf2bd4
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png
new file mode 100644
index 0000000..830e843
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner.png b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner.png
new file mode 100644
index 0000000..f81e331
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/banner.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/logo.png
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/logo.png b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/logo.png
new file mode 100644
index 0000000..ea4cbc1
Binary files /dev/null and b/mothballed/component/viewer/scimpi/tck/src/main/webapp/images/logo.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/index.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/index.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/index.shtml
new file mode 100644
index 0000000..e9281cf
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/index.shtml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:page-title>Claims App</swf:page-title>
+
+<swf:template  file="style/template.shtml" />
+
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/login.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/login.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/login.shtml
new file mode 100644
index 0000000..a427a54
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/login.shtml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<swf:template  file="style/template.shtml" />
+
+<h2>Please Log On</h2>
+<swf:logon/>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/screen.css
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/screen.css b/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/screen.css
new file mode 100644
index 0000000..f990946
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/screen.css
@@ -0,0 +1,394 @@
+/*
+ *  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.
+ */
+BODY {
+	font-family: Arial, Sans-Serif;
+	margin: 0 0 10px 0;
+	color: black;
+	background-color: #f0f0f0;
+}
+
+/*
+* Banner
+*/
+div#banner {
+	background-image: url(../images/banner-bg.png);
+	background-repeat: repeat-x; 
+	width: 100%;
+	height: 120px;
+}
+
+/*
+* Content below banner
+*/
+div#content {
+	display: block;
+}
+
+div#content div#side {
+	display: inline;
+	float: left;
+	width: 150px;
+	padding: 25px 10px;
+}
+
+div#side ul {
+	margin: 0;
+	padding: 0;
+}
+
+div#side li {
+	display: block;
+	font-size: 80%;
+	padding: 4px 0;
+}
+
+div#content div#main{
+	padding: 1em;
+	float:left;
+	width:70%;
+}
+
+/*
+* Feedback area
+*/
+.feedback {
+	border: 2px solid red;
+	background-color: #ffccff;
+	padding: 20px 10px;
+}
+
+.warning {
+	color: red;
+	font-style:  italic;
+}
+
+.message {
+	color: blue;
+}
+
+.error {
+	color: red;
+	font-size: 80%;
+	padding-left:  6px;	
+}
+
+/*
+* Debug
+*/
+
+div.debug {
+	display: block;
+	padding: 10px;
+	border: 1px solid gray;
+	background-color: #ddd;
+}
+
+/*
+* Headings
+*/
+h1, h2, h3, h4 {
+	color: blue;
+}
+
+
+/*
+* Hyper links
+*/
+a {
+	color: blue;
+	text-decoration: none;
+}
+
+a:hover {
+	text-decoration: underline;
+}
+
+a:visted {
+	color: blue;
+	text-decoration: none;
+}
+
+/*
+* Icons
+*/
+img.title-icon {
+	height: 32px;
+	padding-right: 6px;
+}
+
+img.small-icon {
+	height: 16px;
+	padding-right: 6px;
+	vertical-align: text-bottom;
+}
+
+
+/*
+* Actions
+*/
+div.actions {
+	
+}
+
+div.actions div.actions {
+	border: 0px;
+	padding: 0px;
+}
+
+div.actions h2 {
+	font-size: 90%;
+}
+
+div.actions h3 {
+	font-size: 80%;
+}
+
+div.actions div.action,
+a.action
+{
+	padding 2px;
+	margin: 4px 0;
+	height: 1.6em;
+}
+
+div.action INPUT,
+div.action a,
+a.action,
+div.action span.disabled
+{
+	font-size: 80%;
+	background-color: silver;
+	border: 1px solid #333399;
+	background: url(../images/bg-button.gif);
+	background-repeat: repeat-x;
+}
+
+div.action INPUT[type="hidden"]
+{
+	background: none;
+	border: none;
+}
+
+div.action a,
+a.action,
+div.action span.disabled {
+	padding: 1px 10px;
+}
+
+.action INPUT, 
+a.action,
+.action a:link {
+	color: #000000;
+}
+
+.action INPUT, 
+a.action,
+.action a:visited {
+	color: #000000;
+}
+
+.action INPUT, 
+a.action,
+.action a:hover {
+	color: #000000;
+	text-decoration: none;
+}
+
+div.action span.disabled {
+	color: #555;
+}
+
+/*
+* Edit forms
+*/
+fieldset {
+	padding: 5px 10px;
+}
+
+fieldset div.field {
+	padding: 4px 0px;
+	min-height: 1.3em;
+}
+
+fieldset label {
+	float: left;
+	width:140px;
+	font-weight: bold;
+}
+
+fieldset input {
+	padding: 0px 0;
+}
+
+fieldset textarea {
+	font-family: Arial, Sans-Serif;
+}
+
+form input.button {
+	font-size: 80%;
+	background-color: silver;
+	border: 1px solid #333399;
+	background: url(../images/bg-button.gif);
+	background-repeat: repeat-x;
+	padding: 1px 0;
+}
+
+/*
+* Display forms
+*/
+div.form {
+	padding: 5px 0;
+}
+
+XXdiv.form * {
+	border: 1px solid red;
+}
+
+div.form div.field {
+	padding: 4px 6px;
+	min-height: 1.3em;
+}
+
+div.form div.odd-row {
+	background-color: #e7e7e7;
+}
+
+div.form div.even-row {
+	background-color:  #eee;
+}
+
+div.form span.label {
+	float: left;
+	font-weight: bold;
+}
+
+div.form span.value {
+	display: block;
+	padding-left: 12em;
+	max-width: 45em;
+}
+
+
+
+/*
+* collections
+*/
+
+#store .entry {
+	border-bottom: 1px dotted #7745FF;
+	padding: 10px 0;
+}
+	
+table {
+	border: 0px;
+	padding-bottom: 10px;
+}
+	
+th {
+	background-color: #bbb;
+}
+
+tr.odd-row {
+	background-color: #eee;
+}
+
+tr.even-row {
+	background-color: #e7e7e7;
+}
+
+td {
+	vertical-align: top;
+	padding: 4px 10px;
+}
+
+tr:hover {
+	border: 1px solid black; 
+	background-color: #eea;
+}
+
+
+
+
+
+/*
+* Application specific
+*/
+div.book {
+	padding-bottom: 10px;
+	border-bottom: 2px dashed;
+}
+
+div.cover {
+	float: left;
+	padding-right: 30px;
+	padding-bottom: 8px;
+}
+
+
+.title {
+	color: white;
+	font-size: 120%;
+	font-weight: bold;
+	margin-left: 5px;
+}
+	
+.description {}
+
+.price {
+	display: inline;
+	font-weight: bold;
+	text-align: left;
+	margin-right: 20px;
+}
+
+form, input {
+	display: inline;
+}
+
+
+div#cart {
+	float: 	right;
+	width: 160px;
+	font-size: 70%;
+	border: 1px solid gray;
+	margin: 10px;
+	padding: 10px;
+}
+
+div#cart ul {
+	padding: 0;
+	
+}
+
+div#cart li {
+	display: block;
+	padding-bottom: 4px;
+}
+
+
+
+form.selector fieldset {
+	margin-left: 45px;	
+	font-size: 80%;
+}
+
+form.selector legend {
+	font-style: italic;
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml b/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml
new file mode 100644
index 0000000..0774613
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>${title}</title>
+<link rel="stylesheet" title="Style 1" href="${_context}/style/screen.css" type="text/css" media="all" />
+</head>
+
+<body id="demo">
+
+<div id="banner">
+	<div class="logo"><img src="images/logo.png"/></div>
+	<div class="title">To-Do App</div>
+</div>
+
+<div id="content">
+	<div id="side">
+        <swf:services />
+	</div>
+	<div id="main">
+        <swf:feedback />
+		<swf:content />
+		
+		<swf:diagnostics/>
+	</div>
+</div>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1fa8060..23293a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,8 +55,6 @@
 
                 <module>example/application/simpleapp</module>
                 <module>example/archetype/simpleapp</module>
-        
-                <module>component/viewer/scimpi</module>
             </modules>
         </profile>
         


[18/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
deleted file mode 100644
index 6b097bb..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *  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.view;
-
-import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
-
-public class SwfTag implements Snippet {
-
-    public static final int END = 0;
-    public static final int EMPTY = 1;
-    public static final int START = 2;
-    private final String tagName;
-    private final int type;
-    private final Attributes attributes;
-    private final String lineNumbers;
-    private final String path;
-
-    public SwfTag(final String tagName, final Attributes attributes, final int type, final String lineNumbers, final String path) {
-        this.tagName = tagName;
-        this.attributes = attributes;
-        this.type = type;
-        this.lineNumbers = lineNumbers;
-        this.path = path;
-    }
-
-    @Override
-    public String getHtml() {
-        return tagName;
-    }
-    
-    public String getPath() { 
-        return path; 
-    } 
-
-    public int getType() {
-        return type;
-    }
-
-    public String getName() {
-        return tagName;
-    }
-
-    public Attributes getAttributes() {
-        return attributes;
-    }
-
-    @Override
-    public String errorAt() {
-        return path + ":" + lineNumbers;
-    }
-
-    public String debug() {
-        return path + ":" + lineNumbers + " - " + getAttributes();
-    }
-
-    @Override
-    public String toString() {
-        String t = null;
-        switch (type) {
-        case EMPTY:
-            t = "empty";
-            break;
-        case START:
-            t = "start";
-            break;
-        case END:
-            t = "end";
-            break;
-        }
-        return "SwfTag[name=" + tagName + ",path=" + path + ",line=" + lineNumbers + ",type=" + t + "]";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java
deleted file mode 100644
index 6b054b1..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  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.view;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class VersionNumber extends AbstractElementProcessor {
-
-    private static final String MARKER = "Implementation-Build: ";
-    private static final String FILE = "/META-INF/MANIFEST.MF";
-    private String version;
-
-    @Override
-    public String getName() {
-        return "version-number";
-    }
-
-    @Override
-    public void process(final Request request) {
-        if (version == null) {
-            version = "0000"; // default revision number
-            loadRevisonNumber(request.getContext());
-        }
-        request.appendHtml(version);
-    }
-
-    private void loadRevisonNumber(final RequestContext context) {
-        BufferedReader reader;
-        try {
-            String file = FILE;
-
-            file = context.findFile(FILE);
-            reader = new BufferedReader(new InputStreamReader(context.openStream(file)));
-            String line;
-            while ((line = reader.readLine()) != null) {
-                if (line.startsWith(MARKER)) {
-                    version = line.substring(MARKER.length());
-                    break;
-                }
-            }
-            reader.close();
-        } catch (final IOException e) {
-            throw new ScimpiException(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
deleted file mode 100644
index 740de00..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- *  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.view.action;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-
-public class ActionButton extends AbstractElementProcessor {
-    private static final Logger LOG = LoggerFactory.getLogger(ActionButton.class);
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final static Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String objectId = request.getOptionalProperty(OBJECT);
-        final String methodName = request.getRequiredProperty(METHOD);
-        final String forwardResultTo = request.getOptionalProperty(VIEW);
-        final String forwardVoidTo = request.getOptionalProperty(VOID);
-        final String forwardErrorTo = request.getOptionalProperty(ERROR);
-        final String variable = request.getOptionalProperty(RESULT_NAME);
-        final String scope = request.getOptionalProperty(SCOPE);
-        final String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
-        String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        final String idName = request.getOptionalProperty(ID, methodName);
-        final String className = request.getOptionalProperty(CLASS);
-        final boolean showMessage = request.isRequested(SHOW_MESSAGE, false);
-        final String completionMessage = request.getOptionalProperty(MESSAGE);
-
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-        final String version = request.getContext().mapVersion(object);
-        final ObjectAction action = MethodsUtils.findAction(object, methodName);
-
-        final ActionContent parameterBlock = new ActionContent(action);
-        request.setBlockContent(parameterBlock);
-        request.processUtilCloseTag();
-        final String[] parameters = parameterBlock.getParameters();
-        final ObjectAdapter[] objectParameters;
-        
-        final ObjectAdapter target;
-        if (false /*action.isContributed()*/) {
-//            objectParameters= null;
-//            System.arraycopy(parameters, 0, parameters, 1, parameters.length - 1);
-//            parameters[0] = request.getContext().mapObject(object, Scope.REQUEST);
-//            target =  action.realTarget(object);
-//            if (!action.hasReturn() && resultOverride == null) {
-//                resultOverride = parameters[0];
-//            }
-        } else {
-            objectParameters = new ObjectAdapter[parameters.length];
-            target = object;
-            int i = 0;
-            for (final ObjectActionParameter spec : action.getParameters()) {
-                final ObjectSpecification type = spec.getSpecification();
-                if (parameters[i] == null) {
-                    objectParameters[i] = null;
-                } else if (type.getFacet(ParseableFacet.class) != null) {
-                    final ParseableFacet facet = type.getFacet(ParseableFacet.class);
-                    Localization localization = IsisContext.getLocalization(); 
-                    objectParameters[i] = facet.parseTextEntry(null, parameters[i], localization); 
-                } else {
-                    objectParameters[i] = MethodsUtils.findObject(request.getContext(), parameters[i]);
-                }
-                i++;
-            }
-        }
-
-        if (MethodsUtils.isVisibleAndUsable(object, action, where) && MethodsUtils.canRunMethod(object, action, objectParameters).isAllowed()) {
-            // TODO use the form creation mechanism as used in ActionForm
-            write(request, target, action, parameters, version, forwardResultTo, forwardVoidTo, forwardErrorTo, variable, scope, buttonTitle, completionMessage, resultOverride, idName, className);
-        }
-
-        if (showMessage) {
-            final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object, where);
-            if (usable.isVetoed()) {
-                final String notUsable = usable.getReason();
-                if (notUsable != null) {
-                    String title = buttonTitle == null ? action.getName() : buttonTitle;
-                    disabledButton(request, title, notUsable, idName, className);
-                }
-            } else {
-                final Consent valid = action.isProposedArgumentSetValid(object, objectParameters);
-                final String notValid = valid.getReason();
-                if (notValid != null) {
-                    String title = buttonTitle == null ? action.getName() : buttonTitle;
-                    disabledButton(request, title, notValid, idName, className);
-                }
-            }
-        }
-
-        request.popBlockContent();
-    }
-
-    private void disabledButton(final Request request, final String buttonTitle, String message, String id, String className) {
-        if (className == null) {
-            className = "access";
-        }
-        request.appendHtml("<div id=\"" + id + "\" class=\"" + className + " disabled-form\">");
-        request.appendHtml("<div class=\"button disabled\" title=\"");
-        request.appendAsHtmlEncoded(message);
-        request.appendHtml("\" >" + buttonTitle);
-        request.appendHtml("</div>");
-        request.appendHtml("</div>");
-    }
-
-    public static void write(
-            final Request request,
-            final ObjectAdapter object,
-            final ObjectAction action,
-            final String[] parameters,
-            final String version,
-            String forwardResultTo,
-            String forwardVoidTo,
-            String forwardErrorTo,
-            final String variable,
-            final String scope,
-            String buttonTitle,
-            final String completionMessage,
-            final String resultOverride,
-            final String idName,
-            final String className) {
-        final RequestContext context = request.getContext();
-
-        buttonTitle = buttonTitle != null ? buttonTitle : action.getName();
-
-        if (action.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-            LOG.info("action not visible " + action.getName());
-            return;
-        }
-        final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object, where);
-        if (usable.isVetoed()) {
-            LOG.info("action not available: " + usable.getReason());
-            return;
-        }
-
-        /*
-         * 
-         * TODO this mechanism fails as it tries to process tags - which we dont
-         * need! Also it calls action 'edit' (not 'action'). Field[] fields =
-         * new Field[0]; HiddenField[] hiddenFields = new HiddenField[] { new
-         * HiddenField("service", serviceId), new HiddenField("method",
-         * methodName), new HiddenField("view", forwardToView), variable == null
-         * ? null : new HiddenField("variable", variable), };
-         * Form.createForm(request, buttonTitle, fields, hiddenFields, false);
-         */
-
-        final String objectId = context.mapObject(object, Scope.INTERACTION);
-        final String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
-        final String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
-        request.appendHtml("\n<form " + idSegment + classSegment + " action=\"action.app\" method=\"post\">\n");
-        if (objectId == null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + context.getVariable(RequestContext.RESULT) + "\" />\n");
-        } else {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" +  StringEscapeUtils.escapeHtml(objectId) + "\" />\n");
-        }
-        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VERSION + "\" value=\"" + version + "\" />\n");
-        if (scope != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + SCOPE + "\" value=\"" + scope + "\" />\n");
-        }
-        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + METHOD + "\" value=\"" + action.getId() + "\" />\n");
-        if (forwardResultTo != null) {
-            forwardResultTo = context.fullFilePath(forwardResultTo);
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VIEW + "\" value=\"" + forwardResultTo + "\" />\n");
-        }
-        if (forwardErrorTo == null) {
-            forwardErrorTo = request.getContext().getResourceFile();
-        }
-        forwardErrorTo = context.fullFilePath(forwardErrorTo);
-        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + ERROR + "\" value=\"" + forwardErrorTo + "\" />\n");
-        if (forwardVoidTo == null) {
-            forwardVoidTo = request.getContext().getResourceFile();
-        }
-        forwardVoidTo = context.fullFilePath(forwardVoidTo);
-        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VOID + "\" value=\"" + forwardVoidTo + "\" />\n");
-        if (variable != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_NAME + "\" value=\"" + variable + "\" />\n");
-        }
-        if (resultOverride != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_OVERRIDE + "\" value=\"" + resultOverride + "\" />\n");
-        }
-        if (completionMessage != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + MESSAGE + "\" value=\"" + completionMessage + "\" />\n");
-        }
-
-        for (int i = 0; i < parameters.length; i++) {
-            request.appendHtml("  <input type=\"hidden\" name=\"param" + (i + 1) + "\" value=\"" + parameters[i] + "\" />\n");
-        }
-        request.appendHtml(request.getContext().interactionFields());
-        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"" + buttonTitle + "\" name=\"execute\" title=\"" + action.getDescription() + "\" />");
-        HelpLink.append(request, action.getDescription(), action.getHelp());
-        request.appendHtml("\n</form>\n");
-    }
-
-    @Override
-    public String getName() {
-        return "action-button";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
deleted file mode 100644
index 2466726..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  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.view.action;
-
-import java.util.List;
-
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ActionContent implements BlockContent {
-    private final ObjectAction action;
-    private final String[] parameters;
-    private int next;
-
-    public ActionContent(final ObjectAction action) {
-        this.action = action;
-        this.parameters = new String[action.getParameterCount()];
-    }
-
-    public void setParameter(final String field, final String value) {
-        int index;
-        if (field == null) {
-            index = next++;
-        } else {
-            index = Integer.valueOf(field).intValue() - 1;
-        }
-        if (index < 0 || index >= parameters.length) {
-            throw new ScimpiException("Parameter numbers should be between 1 and " + parameters.length + ": " + index);
-        }
-        parameters[index] = value;
-    }
-
-    public ObjectAdapter[] getParameters(final Request request) {
-        final ObjectAdapter[] params = new ObjectAdapter[parameters.length];
-        final List<ObjectActionParameter> pars = action.getParameters();
-        for (int i = 0; i < parameters.length; i++) {
-            final ObjectSpecification typ = pars.get(i).getSpecification();
-            if (typ.getFacet(ParseableFacet.class) != null) {
-                final ParseableFacet facet = typ.getFacet(ParseableFacet.class);
-                Localization localization = IsisContext.getLocalization(); 
-                params[i] = facet.parseTextEntry(null, parameters[i], localization);            
-            } else {
-                params[i] = request.getContext().getMappedObject(parameters[i]);
-            }
-        }
-        return params;
-    }
-
-    public String[] getParameters() {
-        return parameters;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
deleted file mode 100644
index 469b99d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- *  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.view.action;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.action.ActionAction;
-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.edit.FieldEditState;
-import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FieldFactory;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FormFieldBlock;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class ActionForm extends AbstractElementProcessor {
-
-    // REVIEW: confirm this rendering context
-    private final static Where where = Where.OBJECT_FORMS;
-
-    @Override
-    public void process(final Request request) {
-        final CreateFormParameter parameters = new CreateFormParameter();
-        parameters.objectId = request.getOptionalProperty(OBJECT);
-        parameters.methodName = request.getRequiredProperty(METHOD);
-        parameters.forwardResultTo = request.getOptionalProperty(VIEW);
-        parameters.forwardVoidTo = request.getOptionalProperty(VOID);
-        parameters.forwardErrorTo = request.getOptionalProperty(ERROR);
-        parameters.cancelTo = request.getOptionalProperty(CANCEL_TO); 
-        parameters.showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
-        parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
-        parameters.formTitle = request.getOptionalProperty(FORM_TITLE);
-        parameters.labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
-        parameters.formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
-        parameters.resultName = request.getOptionalProperty(RESULT_NAME);
-        parameters.resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        parameters.scope = request.getOptionalProperty(SCOPE);
-        parameters.className = request.getOptionalProperty(CLASS, "action full");
-        parameters.showMessage = request.isRequested(SHOW_MESSAGE, false);
-        parameters.completionMessage = request.getOptionalProperty(MESSAGE);
-        parameters.id = request.getOptionalProperty(ID, parameters.methodName);
-        createForm(request, parameters);
-    }
-
-    public static void createForm(final Request request, final CreateFormParameter parameterObject) {
-        createForm(request, parameterObject, false);
-    }
-
-    protected static void createForm(final Request request, final CreateFormParameter parameterObject, final boolean withoutProcessing) {
-        final RequestContext context = request.getContext();
-        final ObjectAdapter object = MethodsUtils.findObject(context, parameterObject.objectId);
-        final String version = request.getContext().mapVersion(object);
-        final ObjectAction action = MethodsUtils.findAction(object, parameterObject.methodName);
-        // TODO how do we distinguish between overloaded methods?
-
-        // REVIEW Is this useful?
-        if (action.getParameterCount() == 0) {
-            throw new ScimpiException("Action form can only be used for actions with parameters");
-        }
-        if (parameterObject.showMessage && MethodsUtils.isVisible(object, action, where)) {
-            final String notUsable = MethodsUtils.isUsable(object, action, where);
-            if (notUsable != null) {
-                if (!withoutProcessing) {
-                    request.skipUntilClose();
-                }
-                request.appendHtml("<div class=\"" + parameterObject.className + "-message\" >");
-                request.appendAsHtmlEncoded(notUsable);
-                request.appendHtml("</div>");
-                return;
-            }
-        }
-        if (!MethodsUtils.isVisibleAndUsable(object, action, where)) {
-            if (!withoutProcessing) {
-                request.skipUntilClose();
-            }
-            return;
-        }
-        final String objectId = context.mapObject(object, Scope.INTERACTION);
-        final String errorView = context.fullFilePath(parameterObject.forwardErrorTo == null ? context.getResourceFile() : parameterObject.forwardErrorTo);
-        final String voidView = context.fullFilePath(parameterObject.forwardVoidTo == null ? context.getResourceFile() : parameterObject.forwardVoidTo);
-        if (false /* action.isContributed() && !action.hasReturn() && parameterObject.resultOverride == null */) {
-            parameterObject.resultOverride = objectId;
-        }
-        final HiddenInputField[] hiddenFields = new HiddenInputField[] { new HiddenInputField("_" + OBJECT, objectId), new HiddenInputField("_" + VERSION, version), new HiddenInputField("_" + FORM_ID, parameterObject.formId), new HiddenInputField("_" + METHOD, parameterObject.methodName),
-                parameterObject.forwardResultTo == null ? null : new HiddenInputField("_" + VIEW, context.fullFilePath(parameterObject.forwardResultTo)), new HiddenInputField("_" + VOID, voidView), new HiddenInputField("_" + ERROR, errorView),
-                parameterObject.completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, parameterObject.completionMessage), parameterObject.scope == null ? null : new HiddenInputField("_" + SCOPE, parameterObject.scope),
-                parameterObject.resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, parameterObject.resultOverride), parameterObject.resultName == null ? null : new HiddenInputField("_" + RESULT_NAME, parameterObject.resultName),
-                parameterObject.resultName == null ? null : new HiddenInputField(RequestContext.RESULT, (String) request.getContext().getVariable(RequestContext.RESULT)) };
-
-        // TODO when the block contains a selector tag it doesn't disable it if
-        // the field cannot be edited!!!
-        final FormFieldBlock containedBlock = new FormFieldBlock() {
-            @Override
-            public boolean isNullable(final String name) {
-                final int index = Integer.parseInt(name.substring(5)) - 1;
-                final ObjectActionParameter param = action.getParameters().get(index);
-                return param.isOptional();
-            }
-        };
-        request.setBlockContent(containedBlock);
-        if (!withoutProcessing) {
-            request.processUtilCloseTag();
-        }
-
-        final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
-
-        // TODO the list of included fields should be considered in the next
-        // method (see EditObject)
-        final InputField[] formFields = createFields(action, object);
-        containedBlock.hideExcludedParameters(formFields);
-        containedBlock.setUpValues(formFields);
-        initializeFields(context, object, action, formFields);
-        setDefaults(context, object, action, formFields, entryState, parameterObject.showIcon);
-        String errors = null;
-        if (entryState != null && entryState.isForForm(parameterObject.formId)) {
-            copyEntryState(context, object, action, formFields, entryState);
-            errors = entryState.getError();
-        }
-        overrideWithHtml(context, containedBlock, formFields);
-
-        String formTitle;
-        if (parameterObject.formTitle == null) {
-            formTitle = action.getName();
-        } else {
-            formTitle = parameterObject.formTitle;
-        }
-
-        String buttonTitle = parameterObject.buttonTitle;
-        if (buttonTitle == null) {
-            buttonTitle = action.getName();
-        } else if (buttonTitle.equals("")) {
-            buttonTitle = "Ok";
-        }
-
-        HtmlFormBuilder.createForm(request, ActionAction.ACTION + ".app", hiddenFields, formFields, parameterObject.className,
-                parameterObject.id, formTitle, parameterObject.labelDelimiter, action.getDescription(), action.getHelp(), buttonTitle, errors, parameterObject.cancelTo);
-
-        request.popBlockContent();
-    }
-
-    private static InputField[] createFields(final ObjectAction action, final ObjectAdapter object) {
-        final int parameterCount = action.getParameterCount();
-        final InputField[] fields = new InputField[parameterCount];
-        for (int i = 0; i < fields.length; i++) {
-            fields[i] = new InputField(ActionAction.parameterName(i));
-        }
-        return fields;
-    }
-
-    private static void initializeFields(final RequestContext context, final ObjectAdapter object, final ObjectAction action, final InputField[] fields) {
-        final List<ObjectActionParameter> parameters = action.getParameters();
-        for (int i = 0; i < fields.length; i++) {
-            final InputField field = fields[i];
-            final ObjectActionParameter param = parameters.get(i);
-            if (false /*action.isContributed() && i == 0*/) {
-                // fields[i].setValue(context.mapObject(object,
-                // Scope.INTERACTION));
-                fields[i].setType(InputField.REFERENCE);
-                fields[i].setHidden(true);
-            } else {
-
-                fields[i].setHelpReference("xxxhelp");
-                final ObjectAdapter[] optionsForParameter = action.getChoices(object)[i];
-                FieldFactory.initializeField(context, object, param, optionsForParameter, !param.isOptional(), field);
-            }
-        }
-    }
-
-    /**
-     * Sets up the fields with their initial values
-     * 
-     * @param showIcon
-     */
-    private static void setDefaults(final RequestContext context, final ObjectAdapter object, final ObjectAction action, final InputField[] fields, final FormState entryState, final boolean showIcon) {
-        final ObjectAdapter[] defaultValues = action.getDefaults(object);
-        if (defaultValues == null) {
-            return;
-        }
-
-        for (int i = 0; i < fields.length; i++) {
-            final InputField field = fields[i];
-            final ObjectAdapter defaultValue = defaultValues[i];
-
-            final String title = defaultValue == null ? "" : defaultValue.titleString();
-            if (field.getType() == InputField.REFERENCE) {
-                final ObjectSpecification objectSpecification = action.getParameters().get(i).getSpecification();
-                if (defaultValue != null) {
-                    final String imageSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
-                    final String html = imageSegment + title;
-                    final String value = context.mapObject(defaultValue, Scope.INTERACTION);
-                    field.setValue(value);
-                    field.setHtml(html);
-                }
-            } else {
-                field.setValue(title);
-            }
-        }
-    }
-
-    private static void copyEntryState(final RequestContext context, final ObjectAdapter object, final ObjectAction action, final InputField[] fields, final FormState entryState) {
-
-        for (final InputField field : fields) {
-            final FieldEditState fieldState = entryState.getField(field.getName());
-            if (fieldState != null) {
-                if (field.isEditable()) {
-                    String entry;
-                    entry = fieldState.getEntry();
-                    field.setValue(entry);
-                }
-
-                field.setErrorText(fieldState.getError());
-            }
-        }
-    }
-
-    private static void overrideWithHtml(final RequestContext context, final FormFieldBlock containedBlock, final InputField[] formFields) {
-        for (int i = 0; i < formFields.length; i++) {
-            final String id = ActionAction.parameterName(i);
-            if (containedBlock.hasContent(id)) {
-                final String content = containedBlock.getContent(id);
-                if (content != null) {
-                    formFields[i].setHtml(content);
-                    formFields[i].setType(InputField.HTML);
-                }
-            }
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "action-form";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java
deleted file mode 100644
index 520e2bc..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *  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.view.action;
-
-import java.net.URLEncoder;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-
-public class ActionLink extends AbstractElementProcessor {
-
-    // REVIEW: confirm this rendering context
-    private final Where where = Where.OBJECT_FORMS;
-
-    @Override
-    public void process(final Request request) {
-        String objectId = request.getOptionalProperty(OBJECT);
-        final String method = request.getOptionalProperty(METHOD);
-        final String forwardResultTo = request.getOptionalProperty(VIEW);
-        final String forwardVoidTo = request.getOptionalProperty(VOID);
-        String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        
-        final String resultName = request.getOptionalProperty(RESULT_NAME);
-        final String resultNameSegment = resultName == null ? "" : "&amp;" + RESULT_NAME + "=" + resultName;
-        final String scope = request.getOptionalProperty(SCOPE);
-        final String scopeSegment = scope == null ? "" : "&amp;" + SCOPE + "=" + scope;
-        final String confirm = request.getOptionalProperty(CONFIRM);
-        final String completionMessage = request.getOptionalProperty(MESSAGE);
-        final String idName = request.getOptionalProperty(ID, method);
-        final String className = request.getOptionalProperty(CLASS);
-
-        
-        // TODO need a mechanism for globally dealing with encoding; then use
-        // the new encode method
-        final String confirmSegment = confirm == null ? "" : "&amp;" + "_" + CONFIRM + "=" + URLEncoder.encode(confirm);
-        final String messageSegment = completionMessage == null ? "" : "&amp;" + "_" + MESSAGE + "=" + URLEncoder.encode(completionMessage);
-
-        final RequestContext context = request.getContext();
-        final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
-        final String version = context.mapVersion(object);
-        final ObjectAction action = MethodsUtils.findAction(object, method);
-
-        final ActionContent parameterBlock = new ActionContent(action);
-        request.setBlockContent(parameterBlock);
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        final String text = request.popBuffer();
-        
-        final String[] parameters = parameterBlock.getParameters();
-        final String target;
-        /*
-        if (action.isContributed()) {
-            System.arraycopy(parameters, 0, parameters, 1, parameters.length - 1);
-            parameters[0] = request.getContext().mapObject(object, Scope.REQUEST);
-            target =  request.getContext().mapObject(action.realTarget(object), Scope.REQUEST);
-            if (!action.hasReturn() && resultOverride == null) {
-                resultOverride = parameters[0];
-            }
-        } else {
-            target =  StringEscapeUtils.escapeHtml(request.getContext().mapObject(object, Scope.INTERACTION));
-        }
-         */
-        
-        final ObjectAdapter[] objectParameters;
-        
-        // TODO copied from ActionButton
-        //final ObjectAdapter target;
-        if (false /*action.isContributed() */) {
-//            objectParameters= null;
-//            System.arraycopy(parameters, 0, parameters, 1, parameters.length - 1);
-//            parameters[0] = request.getContext().mapObject(object, Scope.REQUEST);
-//            target =  request.getContext().mapObject(action.realTarget(object), Scope.REQUEST);
-//            if (!action.hasReturn() && resultOverride == null) {
-//                resultOverride = parameters[0];
-//            }
-        } else {
-            objectParameters = new ObjectAdapter[parameters.length];
-            // target = object;
-            target =  StringEscapeUtils.escapeHtml(request.getContext().mapObject(object, Scope.INTERACTION));
-            int i = 0;
-            for (final ObjectActionParameter spec : action.getParameters()) {
-                final ObjectSpecification type = spec.getSpecification();
-                if (parameters[i] == null) {
-                    objectParameters[i] = null;
-                } else if (type.getFacet(ParseableFacet.class) != null) {
-                    final ParseableFacet facet = type.getFacet(ParseableFacet.class);
-                    Localization localization = IsisContext.getLocalization(); 
-                    objectParameters[i] = facet.parseTextEntry(null, parameters[i], localization); 
-                } else {
-                    objectParameters[i] = MethodsUtils.findObject(request.getContext(), parameters[i]);
-                }
-                i++;
-            }
-        }
-
-        if (MethodsUtils.isVisibleAndUsable(object, action, where)  && MethodsUtils.canRunMethod(object, action, objectParameters).isAllowed()) {
-            writeLink(request, idName, className, target, version, method, forwardResultTo, forwardVoidTo, resultNameSegment, resultOverride, scopeSegment,
-                    confirmSegment, messageSegment, context, action, parameters, text);
-        }
-        request.popBlockContent();
-    }
-
-    public static void writeLink(
-            final Request request,
-            final String idName,
-            final String className,
-            final String objectId,
-            final String version,
-            final String method,
-            final String forwardResultTo,
-            final String forwardVoidTo,
-            final String resultNameSegment,
-            final String resultOverride,
-            final String scopeSegment,
-            final String confirmSegment,
-            final String messageSegment,
-            final RequestContext context,
-            final ObjectAction action,
-            final String[] parameters,
-            String text) {
-        text = text == null || text.trim().equals("") ? action.getName() : text;
-
-        String parameterSegment = "";
-        for (int i = 0; i < parameters.length; i++) {
-            parameterSegment += "&param" + (i + 1) + "=" + parameters[i];
-        }
-
-        final String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
-        final String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
-        final String interactionParamters = context.encodedInteractionParameters();
-        final String forwardResultSegment = forwardResultTo == null ? "" : "&amp;" + "_" + VIEW + "=" + context.fullFilePath(forwardResultTo);
-        final String resultOverrideSegment = resultOverride == null ? "" : "&amp;" + "_" + RESULT_OVERRIDE + "=" + resultOverride;
-        final String voidView = context.fullFilePath(forwardVoidTo == null ? context.getResourceFile() : forwardVoidTo);
-        final String forwardVoidSegment = "&amp;" + "_" + VOID + "=" + voidView;
-        request.appendHtml("<a " + idSegment + classSegment + " href=\"action.app?" + "_" + OBJECT + "=" + objectId + "&amp;" + "_" + VERSION + "=" + version
-                + "&amp;" + "_" + METHOD + "=" + method + resultOverrideSegment + forwardResultSegment + forwardVoidSegment + resultNameSegment
-                + parameterSegment + scopeSegment + confirmSegment + messageSegment + interactionParamters + "\">");
-        request.appendHtml(text);
-        request.appendHtml("</a>");
-        HelpLink.append(request, action.getDescription(), action.getHelp());
-    }
-
-    @Override
-    public String getName() {
-        return "action-link";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
deleted file mode 100644
index 2628449..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  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.view.action;
-
-public class CreateFormParameter {
-    public String methodName;
-    public String forwardResultTo;
-    public String forwardVoidTo;
-    public String forwardErrorTo;
-    public String buttonTitle;
-    public String formTitle;
-    public String formId;
-    public String resultName;
-    public String scope;
-    public String objectId;
-    public String description;
-    public String helpReference;
-    public String className;
-    public String id;
-    public String resultOverride;
-    public boolean showMessage;
-    public boolean showIcon;
-    public String completionMessage;
-    public String cancelTo;
-    public String labelDelimiter;
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java
deleted file mode 100644
index 21cff4e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *  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.view.action;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
-
-public class Methods extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final static Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        String objectId = request.getOptionalProperty(OBJECT);
-        final String view = request.getOptionalProperty(VIEW, "_generic_action." + Dispatcher.EXTENSION);
-        final String cancelTo = request.getOptionalProperty(CANCEL_TO);
-        final boolean showForms = request.isRequested(FORMS, false);
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-        if (objectId == null) {
-            objectId = request.getContext().mapObject(object, null);
-        }
-
-        final InclusionList inclusionList = new InclusionList();
-        request.setBlockContent(inclusionList);
-        request.processUtilCloseTag();
-
-        request.appendHtml("<div class=\"actions\">");
-        if (inclusionList.includes("edit") && !object.getSpecification().isService()) {
-            request.appendHtml("<div class=\"action\">");
-            request.appendHtml("<a class=\"button\" href=\"_generic_edit." + Dispatcher.EXTENSION + "?_result=" + objectId + "\">Edit...</a>");
-            request.appendHtml("</div>");
-        }
-        writeMethods(request, objectId, object, showForms, inclusionList, view, "_generic.shtml?_result=" + objectId);
-        request.popBlockContent();
-        request.appendHtml("</div>");
-    }
-
-    public static void writeMethods(
-            final Request request,
-            final String objectId,
-            final ObjectAdapter adapter,
-            final boolean showForms,
-            final InclusionList inclusionList,
-            final String view,
-            final String cancelTo) {
-        List<ObjectAction> actions = adapter.getSpecification().getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
-        writeMethods(request, adapter, actions, objectId, showForms, inclusionList, view, cancelTo);
-        // TODO determine if system is set up to display exploration methods
-        if (true) {
-            actions = adapter.getSpecification().getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            writeMethods(request, adapter, actions, objectId, showForms, inclusionList, view, cancelTo);
-        }
-        // TODO determine if system is set up to display debug methods
-        if (true) {
-            actions = adapter.getSpecification().getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            writeMethods(request, adapter, actions, objectId, showForms, inclusionList, view, cancelTo);
-        }
-    }
-
-    private static void writeMethods(
-            final Request request,
-            final ObjectAdapter adapter,
-            List<ObjectAction> actions,
-            final String objectId,
-            final boolean showForms,
-            final InclusionList inclusionList,
-            final String view,
-            final String cancelTo) {
-        actions = inclusionList.includedActions(actions);
-        for (int j = 0; j < actions.size(); j++) {
-            final ObjectAction action = actions.get(j);
-            if (false /* action instanceof ObjectActionSet */) {
-//                request.appendHtml("<div class=\"actions\">");
-//                writeMethods(request, adapter, action.getActions(), objectId, showForms, inclusionList, view, cancelTo);
-//                request.appendHtml("</div>");
-            } else if (false /*action.isContributed()*/) {
-//                if (action.getParameterCount() == 1 && adapter.getSpecification().isOfType(action.getParameters().get(0).getSpecification())) {
-//                    if (objectId != null) {
-//                        final ObjectAdapter target = request.getContext().getMappedObject(objectId);
-//                        final ObjectAdapter realTarget = action.realTarget(target);
-//                        final String realTargetId = request.getContext().mapObject(realTarget, Scope.INTERACTION);
-//                        writeMethod(request, adapter, new String[] { objectId }, action, realTargetId, showForms, view, cancelTo);
-//                    } else {
-//                        request.appendHtml("<div class=\"action\">");
-//                        request.appendAsHtmlEncoded(action.getName());
-//                        request.appendHtml("???</div>");
-//                    }
-//                } else if (!adapter.getSpecification().isService()) {
-//                    writeMethod(request, adapter, new String[0], action, objectId, showForms, view, cancelTo);
-//                }
-            } else {
-                writeMethod(request, adapter, new String[0], action, objectId, showForms, view, cancelTo);
-            }
-        }
-    }
-
-    private static void writeMethod(
-            final Request request,
-            final ObjectAdapter adapter,
-            final String[] parameters,
-            final ObjectAction action,
-            final String objectId,
-            final boolean showForms,
-            final String view,
-            final String cancelTo) {
-        // if (action.isVisible(IsisContext.getSession(), null) &&
-        // action.isVisible(IsisContext.getSession(), adapter))
-        // {
-        if (action.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isAllowed()) {
-            request.appendHtml("<div class=\"action\">");
-            if (IsisContext.getSession() == null) {
-                request.appendHtml("<span class=\"disabled\" title=\"no user logged in\">");
-                request.appendAsHtmlEncoded(action.getName());
-                request.appendHtml("</span>");
-                /*
-                 * } else if (action.isUsable(IsisContext.getSession(),
-                 * null).isVetoed()) {
-                 * request.appendHtml("<span class=\"disabled\" title=\"" +
-                 * action.isUsable(IsisContext.getSession(), null).getReason() +
-                 * "\">"); request.appendHtml(action.getName());
-                 * request.appendHtml("</span>");
-                 */} else if (action.isUsable(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
-                request.appendHtml("<span class=\"disabled\" title=\"" + action.isUsable(IsisContext.getAuthenticationSession(), adapter, where).getReason() + "\">");
-                request.appendAsHtmlEncoded(action.getName());
-                request.appendHtml("</span>");
-            } else {
-                final String version = request.getContext().mapVersion(adapter);
-                if (action.getParameterCount() == 0 || (false /*action.isContributed() && action.getParameterCount() == 1*/ )) {
-                    ActionButton.write(request, adapter, action, parameters, version, "_generic." + Dispatcher.EXTENSION, null, null, null, null, null, null, null, null, null);
-                } else if (showForms) {
-                    final CreateFormParameter params = new CreateFormParameter();
-                    params.objectId = objectId;
-                    params.methodName = action.getId();
-                    params.forwardResultTo = "_generic." + Dispatcher.EXTENSION;
-                    params.buttonTitle = "OK";
-                    params.formTitle = action.getName();
-                    ActionForm.createForm(request, params, true);
-                } else {
-                    request.appendHtml("<a class=\"button\" href=\"" + view + "?_result=" + objectId + "&amp;_" + VERSION + "=" + version + "&amp;_" + METHOD + "=" + action.getId());
-                    if (cancelTo != null) {
-                        request.appendHtml("&amp;_cancel-to=");
-                        request.appendAsHtmlEncoded("cancel-to=\"" + cancelTo + "\"");
-                    }
-                    request.appendHtml("\" title=\"" + action.getDescription() + "\">");
-                    request.appendAsHtmlEncoded(action.getName() + "...");
-                    request.appendHtml("</a>");
-                }
-            }
-            request.appendHtml("</div>");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "methods";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java
deleted file mode 100644
index 69be5c5..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  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.view.action;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.TagOrderException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Parameter extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final BlockContent blockContent = request.getBlockContent();
-        if (!(blockContent instanceof ActionContent)) {
-            throw new TagOrderException(request);
-        }
-
-        final String field = request.getOptionalProperty(PARAMETER_NUMBER);
-        final String value = request.getRequiredProperty(VALUE);
-        final ActionContent block = (ActionContent) blockContent;
-        block.setParameter(field, value);
-    }
-
-    @Override
-    public String getName() {
-        return "parameter";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
deleted file mode 100644
index 9610457..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *  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.view.action;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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 org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class RunAction extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final RequestContext context = request.getContext();
-
-        final String objectId = request.getOptionalProperty(OBJECT);
-        final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
-
-        final String methodName = request.getRequiredProperty(METHOD);
-        final ObjectAction action = MethodsUtils.findAction(object, methodName);
-
-        final String variableName = request.getOptionalProperty(RESULT_NAME);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-
-        final ActionContent parameterBlock = new ActionContent(action);
-        request.setBlockContent(parameterBlock);
-        request.processUtilCloseTag();
-        final ObjectAdapter[] parameters = parameterBlock.getParameters(request);
-
-        if (!MethodsUtils.isVisibleAndUsable(object, action, where)) {
-            throw new ForbiddenException(action, ForbiddenException.VISIBLE_AND_USABLE);
-        }
-
-        // swap null parameter of the object's type to run a contributed method
-        if (false /*action.isContributed()*/) {
-            final List<ObjectActionParameter> parameterSpecs = action.getParameters();
-            for (int i = 0; i < parameters.length; i++) {
-                if (parameters[i] == null && object.getSpecification().isOfType(parameterSpecs.get(i).getSpecification())) {
-                    parameters[i] = object;
-                    break;
-                }
-            }
-        }
-
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-        MethodsUtils.runMethod(context, action, object, parameters, variableName, scope);
-        request.popBlockContent();
-    }
-
-    @Override
-    public String getName() {
-        return "run-action";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java
deleted file mode 100644
index 2a621f1..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  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.view.action;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
-
-public class Services extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final boolean showForms = request.isRequested(FORMS, false);
-        final String view = request.getOptionalProperty(VIEW, "_generic_action." + Dispatcher.EXTENSION);
-        final String cancelTo = request.getOptionalProperty(CANCEL_TO);
-
-        final InclusionList inclusionList = new InclusionList();
-        request.setBlockContent(inclusionList);
-        request.processUtilCloseTag();
-
-        final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
-        for (final ObjectAdapter adapter : serviceAdapters) {
-            final String serviceId = request.getContext().mapObject(adapter, Scope.REQUEST);
-            request.appendHtml("<div class=\"actions\">");
-            request.appendHtml("<h3>");
-            request.appendAsHtmlEncoded(adapter.titleString());
-            request.appendHtml("</h3>");
-            Methods.writeMethods(request, serviceId, adapter, showForms, inclusionList, view, cancelTo);
-            request.appendHtml("</div>");
-        }
-        request.popBlockContent();
-    }
-
-    @Override
-    public String getName() {
-        return "services";
-    }
-
-    private static PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
deleted file mode 100644
index 1002c9f..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *  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.view.collection;
-
-import java.util.Iterator;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class Collection extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final RequestContext context = request.getContext();
-
-        ObjectAdapter collection;
-
-        final String field = request.getOptionalProperty(FIELD);
-        if (field != null) {
-            final String id = request.getOptionalProperty(OBJECT);
-            final ObjectAdapter object = context.getMappedObjectOrResult(id);
-            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
-            if (!objectField.isOneToManyAssociation()) {
-                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
-            }
-            ResolveFieldUtil.resolveField(object, objectField);
-            collection = objectField.get(object);
-        } else {
-            final String id = request.getOptionalProperty(COLLECTION);
-            collection = context.getMappedObjectOrResult(id);
-        }
-
-        final RepeatMarker marker = request.createMarker();
-
-        final String variable = request.getOptionalProperty(ELEMENT_NAME);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-        final String rowClassesList = request.getOptionalProperty(ROW_CLASSES, ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
-        String[] rowClasses = new String[0];
-        if (rowClassesList != null) {
-            rowClasses = rowClassesList.split("[,|/]");
-        }
-
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-        if (facet.size(collection) == 0) {
-            request.skipUntilClose();
-        } else {
-            final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-            int row = 0;
-            while (iterator.hasNext()) {
-                final ObjectAdapter element = iterator.next();
-                context.addVariable("row", "" + (row + 1), Scope.REQUEST);
-                if (rowClassesList != null) {
-                    context.addVariable("row-class", rowClasses[row % rowClasses.length], Scope.REQUEST);
-                }
-                context.addVariable(variable, context.mapObject(element, scope), scope);
-                marker.repeat();
-                request.processUtilCloseTag();
-                row++;
-            }
-        }
-    }
-
-    @Override
-    public String getName() {
-        return COLLECTION;
-    }
-
-}


[05/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
new file mode 100644
index 0000000..1efad45
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
@@ -0,0 +1,84 @@
+/*
+ *  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.view.display;
+
+import java.util.List;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableView.SimpleTableBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+
+public class LongFormView extends AbstractFormView {
+
+    @Override
+    protected void addField(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
+        if (field.isOneToManyAssociation()) {
+            final String noColumnsString = request.getOptionalProperty("no-columns", "3");
+            final String tableClass = request.getOptionalProperty("table-class");
+            final String rowClassesList = request.getOptionalProperty("row-classes", ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
+            String[] rowClasses = new String[0];
+            if (rowClassesList != null) {
+                rowClasses = rowClassesList.split("[,|/]");
+            }
+            int noColumns;
+            ResolveFieldUtil.resolveField(object, field);
+            final ObjectAdapter collection = field.get(object);
+            final ObjectSpecification elementSpec = collection.getElementSpecification();
+            final List<ObjectAssociation> fields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
+            if (noColumnsString.equalsIgnoreCase("all")) {
+                noColumns = fields.size();
+            } else {
+                noColumns = Math.min(fields.size(), Integer.valueOf(noColumnsString));
+            }
+            // final boolean isFieldEditable = field.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
+            final String summary = "Table of elements in " + field.getName();
+            // TableView.write(request, summary, object, field, collection, noColumns, fields, isFieldEditable, showIconByDefault(), tableClass, rowClasses, linkedObject);
+            
+            
+            final String headers[] = new String[fields.size()];
+            int h = 0;
+            for (int i = 0; i < noColumns; i++) {
+                if (fields.get(i).isOneToManyAssociation()) {
+                    continue;
+                }
+                headers[h++] = fields.get(i).getName();
+            }
+            
+            final LinkedObject[] linkedFields = new LinkedObject[fields.size()];
+
+
+            final TableContentWriter rowBuilder =new SimpleTableBuilder(object.titleString(), true, false, "", noColumns, headers, fields, false,
+                    showIcons, false, false, false, field.getName(), linkedFields, null);
+            TableView.write(request, collection, summary, rowBuilder, null, tableClass, rowClasses);
+        } else {
+            super.addField(request, object, field, linkedObject, showIcons);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "long-form";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
new file mode 100644
index 0000000..8ec1420
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
@@ -0,0 +1,59 @@
+/*
+ *  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.view.display;
+
+import java.util.List;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Messages extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String cls = request.getOptionalProperty(CLASS);
+        final StringBuffer buffer = new StringBuffer();
+        write(cls, buffer);
+        if (buffer.length() > 0) {
+            request.appendHtml("<div class=\"feedback\">");
+            request.appendHtml(buffer.toString());
+            request.appendHtml("</div>");
+        }
+
+    }
+
+    public static void write(String cls, final StringBuffer buffer) {
+        if (cls == null) {
+            cls = "message";
+        }
+        final MessageBroker messageBroker = IsisContext.getMessageBroker();
+        final List<String> messages = messageBroker.getMessages();
+        for (final String message : messages) {
+            buffer.append("<div class=\"" + cls + "\">" + message + "</div>");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "messages";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
new file mode 100644
index 0000000..7af46ab
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
@@ -0,0 +1,55 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+/**
+ * <swf:selected name="selected" object="${action}" equals="${subaction}" />
+ */
+public class SelectedObject extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getOptionalProperty(NAME, "selected");
+        final String objectId = request.getRequiredProperty(OBJECT);
+        final String equalsId = request.getOptionalProperty("equals");
+        final String title = request.getOptionalProperty(BUTTON_TITLE);
+
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(objectId);
+        final ObjectAdapter other = request.getContext().getMappedObjectOrResult(equalsId);
+        if (object == other || object.equals(title)) {
+            // TODO title is not being used!
+            request.getContext().addVariable(ID, " id=\"" + name + "\" ", Scope.INTERACTION);
+        } else {
+            request.getContext().addVariable(ID, "", Scope.INTERACTION);
+        }
+        request.closeEmpty();
+    }
+
+    @Override
+    public String getName() {
+        return "selected";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
new file mode 100644
index 0000000..31e903b
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
@@ -0,0 +1,36 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+
+public class ShortFormView extends AbstractFormView {
+
+    @Override
+    protected boolean ignoreField(final ObjectAssociation field) {
+        return field.isOneToManyAssociation();
+    }
+
+    @Override
+    public String getName() {
+        return "short-form";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
new file mode 100644
index 0000000..2927fab
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
@@ -0,0 +1,86 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
+
+public class TableBlock implements BlockContent {
+
+    // {{ collection
+    private ObjectAdapter collection;
+
+    public void setCollection(final ObjectAdapter collection) {
+        this.collection = collection;
+    }
+
+    public ObjectAdapter getCollection() {
+        return collection;
+    }
+    // }}
+    
+    // {{ linkView
+    private String linkView;
+
+    public String getlinkView() {
+        return linkView;
+    }
+
+    public void setlinkView(final String linkView) {
+        this.linkView = linkView;
+    }
+    // }}
+    
+    // {{ linkName
+    private String linkName;
+
+    public String getlinkName() {
+        return linkName;
+    }
+
+    public void setlinkName(final String linkName) {
+        this.linkName = linkName;
+    }
+    // }}
+
+    // {{ elementName
+    private String elementName;
+
+    public String getElementName() {
+        return elementName;
+    }
+
+    public void setElementName(final String linkObject) {
+        this.elementName = linkObject;
+    }
+    // }}
+
+    private RepeatMarker marker;
+
+    public RepeatMarker getMarker() {
+        return marker;
+    }
+
+    public void setMarker(final RepeatMarker marker) {
+        this.marker = marker;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
new file mode 100644
index 0000000..e726e29
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
@@ -0,0 +1,92 @@
+/*
+ *  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.view.display;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+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.processor.PageWriter;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
+
+public class TableBuilder extends AbstractTableView {
+
+    @Override
+    protected TableContentWriter createRowBuilder(final Request request, final RequestContext context, final String parent, final List<ObjectAssociation> allFields, final ObjectAdapter collection) {
+
+        final String title = request.getOptionalProperty(TABLE_TITLE);
+        final String variable = request.getOptionalProperty(ELEMENT_NAME, ELEMENT);
+        final String headerClass = request.getOptionalProperty("head-" + CLASS);
+
+        final TableBlock block = new TableBlock();
+        block.setCollection(collection);
+        block.setElementName(variable);
+        request.setBlockContent(block);
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        final String headers = request.popBuffer();       
+        return new TableContentWriter() {
+
+            @Override
+            public void writeFooters(final PageWriter writer) {
+            }
+
+            public void tidyUp() {
+                request.popBlockContent();
+            }
+            
+            @Override
+            public void writeCaption(PageWriter writer) {
+                if (title != null) {
+                    writer.appendHtml("<caption>");
+                    writer.appendHtml(title);
+                    writer.appendHtml("</thead>");
+                }
+            }
+            
+            @Override
+            public void writeHeaders(final PageWriter writer) {
+                final String headerSegment = headerClass == null ? "" : (" class=\"" + headerClass + "\"");
+                writer.appendHtml("<thead" + headerSegment + ">");
+                writer.appendHtml(headers);
+                writer.appendHtml("</thead>");
+            }
+
+            @Override
+            public void writeElement(final Request request, final RequestContext context, final ObjectAdapter element) {
+                context.addVariable(variable, context.mapObject(element, Scope.REQUEST), Scope.REQUEST);
+                final RepeatMarker end = request.createMarker();
+                final RepeatMarker marker = block.getMarker();
+                marker.repeat();
+                request.processUtilCloseTag();
+                end.repeat();
+            }
+        };
+    }
+
+    @Override
+    public String getName() {
+        return "table-builder";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
new file mode 100644
index 0000000..3f99218
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
@@ -0,0 +1,94 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class TableCell extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with
+    // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
+    // be hidden from all tables but will be visible/enabled (perhaps incorrectly) 
+    // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
+    private final Where where = Where.ALL_TABLES;
+
+    @Override
+    public void process(final Request request) {
+        final TableBlock tableBlock = (TableBlock) request.getBlockContent();
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getRequiredProperty(FIELD);
+        final String linkView = request.getOptionalProperty(LINK_VIEW);
+        String className = request.getOptionalProperty(CLASS);
+        className = className == null ? "" : " class=\"" + className + "\"";
+        RequestContext context = request.getContext();
+        final ObjectAdapter object = context.getMappedObjectOrVariable(id, tableBlock.getElementName());
+        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+        if (field == null) {
+            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
+        }
+        request.appendHtml("<td" + className + ">");
+        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
+            final ObjectAdapter fieldReference = field.get(object);
+            final String source = fieldReference == null ? "" : context.mapObject(fieldReference, Scope.REQUEST);
+            final String name = request.getOptionalProperty(RESULT_NAME, fieldName);
+            context.addVariable(name, Request.getEncoder().encoder(source), Scope.REQUEST);
+
+            if (linkView != null) {
+                final String linkId = context.mapObject(object, Scope.REQUEST);
+                final String linkName = request.getOptionalProperty(LINK_NAME, RequestContext.RESULT);
+                final String linkObject = request.getOptionalProperty(LINK_OBJECT, linkId);
+                request.appendHtml("<a href=\"" + linkView + "?" + linkName + "=" + linkObject + context.encodedInteractionParameters() + "\">");
+            } else if(tableBlock.getlinkView() != null) {
+                String linkObjectInVariable = tableBlock.getElementName();
+                final String linkId = (String) context.getVariable(linkObjectInVariable);
+                request.appendHtml("<a href=\"" + tableBlock.getlinkView() + "?" + tableBlock.getlinkName() + "=" + linkId + context.encodedInteractionParameters() + "\">");                
+            }
+            request.pushNewBuffer();
+            request.processUtilCloseTag();
+            final String buffer = request.popBuffer();
+            if (buffer.trim().length() == 0) {
+                request.appendAsHtmlEncoded(fieldReference == null ? "" : fieldReference.titleString());
+            } else {
+                request.appendHtml(buffer);
+            }
+            if (linkView != null) {
+                request.appendHtml("</a>");
+            }
+        } else {
+            request.skipUntilClose();
+        }
+        request.appendHtml("</td>");
+    }
+
+    @Override
+    public String getName() {
+        return "table-cell";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
new file mode 100644
index 0000000..10da109
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
@@ -0,0 +1,39 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public interface TableContentWriter {
+
+    void writeCaption(PageWriter writer);
+
+    void writeHeaders(PageWriter writer);
+
+    void writeFooters(PageWriter writer);
+
+    void writeElement(Request request, RequestContext context, ObjectAdapter element);
+
+    void tidyUp();
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
new file mode 100644
index 0000000..5595207
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
@@ -0,0 +1,53 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class TableEmpty extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final TableBlock tableBlock = (TableBlock) request.getBlockContent();
+        final ObjectAdapter collection = tableBlock.getCollection();
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+        if (facet.size(collection) == 0) {
+            String className = request.getOptionalProperty(CLASS);
+            className = className == null ? "" : " class=\"" + className + "\"";
+            request.appendHtml("<tr" + className + ">");
+            request.pushNewBuffer();
+            request.processUtilCloseTag();
+            final String buffer = request.popBuffer();
+            request.appendHtml(buffer);
+            request.appendHtml("</td>");
+        } else {
+            request.skipUntilClose();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "table-empty";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
new file mode 100644
index 0000000..ff04389
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
@@ -0,0 +1,39 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class TableHeader extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "table-header";
+    }
+
+    @Override
+    public void process(final Request request) {
+        request.appendHtml("<thead><tr>");
+        request.processUtilCloseTag();
+        request.appendHtml("</tr></thead>");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
new file mode 100644
index 0000000..eb92656
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
@@ -0,0 +1,49 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
+
+public class TableRow extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "table-row";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final TableBlock block = (TableBlock) request.getBlockContent();
+        
+        final RepeatMarker start = request.createMarker();
+        block.setMarker(start);
+        
+        final String linkView = request.getOptionalProperty(LINK_VIEW);
+        if (linkView != null) {
+            block.setlinkView(linkView);
+            block.setlinkName(request.getOptionalProperty(LINK_NAME, RequestContext.RESULT));
+        }
+        
+        request.skipUntilClose();
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
new file mode 100644
index 0000000..caf984f
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
@@ -0,0 +1,329 @@
+/*
+ *  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.view.display;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+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.processor.PageWriter;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedFieldsBlock;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.RemoveElement;
+
+public class TableView extends AbstractTableView {
+
+   static final class SimpleTableBuilder implements TableContentWriter {
+        private final String parent;
+        private final boolean includeHeader;
+        private final boolean includeFooter;
+        private final String title;
+        private final String[] headers;
+        private final List<ObjectAssociation> fields;
+        private final boolean showTitle;
+        private final boolean showIcons;
+        private final boolean showSelectOption;
+        private final boolean showDeleteOption;
+        private final boolean showEditOption;
+        private final String fieldName;
+        private final LinkedObject[] linkedFields;
+        private final LinkedObject linkRow;
+        private final int noColumns;
+
+        SimpleTableBuilder(
+                final String parent,
+                final boolean includeHeader,
+                final boolean includeFooter,
+                final String title,
+                final int noColumns,
+                final String[] headers,
+                final List<ObjectAssociation> fields,
+                final boolean showTitle,
+                final boolean showIcons,
+                final boolean showSelectOption,
+                final boolean showDeleteOption,
+                final boolean showEditOption,
+                final String fieldName,
+                final LinkedObject[] linkedFields,
+                final LinkedObject linkRow) {
+            this.parent = parent;
+            this.includeHeader = includeHeader;
+            this.includeFooter = includeFooter;
+            this.title = title;
+            this.showTitle = showTitle;
+            this.noColumns = noColumns < 1 ? fields.size() : noColumns;
+            this.headers = headers;
+            this.fields = fields;
+            this.showIcons = showIcons;
+            this.showSelectOption = showSelectOption;
+            this.showDeleteOption = showDeleteOption;
+            this.showEditOption = showEditOption;
+            this.fieldName = fieldName;
+            this.linkedFields = linkedFields;
+            this.linkRow = linkRow;
+        }
+
+        @Override
+        public void writeFooters(final PageWriter writer) {
+            if (includeFooter) {
+                writer.appendHtml("<tfoot>");
+                columnHeaders(writer, headers);
+                writer.appendHtml("</tfoot>");
+            }
+        }
+
+        @Override
+        public void writeCaption(PageWriter writer) {
+            if (title != null) {
+                writer.appendHtml("<caption>");
+                writer.appendHtml(title);
+                writer.appendHtml("</caption>");
+            }
+        }
+        
+        @Override
+        public void writeHeaders(final PageWriter writer) {
+            if (includeHeader) {
+                writer.appendHtml("<thead>");
+                columnHeaders(writer, headers);
+                writer.appendHtml("</thead>");
+            }
+        }
+
+        private void columnHeaders(final PageWriter writer, final String[] headers) {
+            writer.appendHtml("<tr class=\"column-headers\">");
+            if (showTitle) {
+                writer.appendHtml("<th></th>");
+            }
+            final String[] columnHeaders = headers;
+            for (final String columnHeader : columnHeaders) {
+                if (columnHeader != null) {
+                    writer.appendHtml("<th>");
+                    writer.appendAsHtmlEncoded(columnHeader);
+                    writer.appendHtml("</th>");
+                }
+            }
+            writer.appendHtml("<th class=\"controls\"></th>");
+            writer.appendHtml("</tr>");
+        }
+
+        public void tidyUp() {
+       //     request.popBlockContent();
+            
+        //    Is it the block that is left over, or is the collection form not being closed?
+        }
+        
+        @Override
+        public void writeElement(final Request request, final RequestContext context, final ObjectAdapter element) {
+            final String rowId = context.mapObject(element, Scope.INTERACTION);
+            final String scope = linkRow == null ? "" : "&amp;" + SCOPE + "=" + linkRow.getScope();
+            String result = "";
+            result = context.encodedInteractionParameters();
+
+            if (noColumns == 0) {
+                request.appendHtml("<td>");
+                if (linkRow != null) {
+                    request.appendHtml("<td><a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
+                    request.appendAsHtmlEncoded(element.titleString());
+                    request.appendHtml("</a>");
+                } else {
+                    request.appendAsHtmlEncoded(element.titleString());
+                }
+                request.appendHtml("</td>");
+
+            } else {
+                if (showTitle) {
+                    request.appendHtml("<td>");
+                    request.appendAsHtmlEncoded(element.titleString());
+                    request.appendHtml("</td>");
+                }
+
+                for (int i = 0; i < noColumns; i++) {
+                    if (fields.get(i).isOneToManyAssociation()) {
+                        continue;
+                    }
+                    request.appendHtml("<td>");
+                    final ObjectAdapter field = fields.get(i).get(element);
+                    if (field != null) {
+                        if (showIcons && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
+                            request.appendHtml("<img class=\"" + "small-icon" + "\" src=\"" + request.getContext().imagePath(field) + "\" alt=\"" + fields.get(i).getSpecification().getShortIdentifier() + "\"/>");
+                        }
+                        if (linkRow != null) {
+                            request.appendHtml("<a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
+                        } else if (linkedFields[i] != null) {
+                            final ObjectAdapter fieldObject = fields.get(i).get(element);
+                            final String id = context.mapObject(fieldObject, Scope.INTERACTION);
+                            request.appendHtml("<a href=\"" + linkedFields[i].getForwardView() + "?" + linkedFields[i].getVariable() + "=" + id + "\">");
+                            context.mapObject(fieldObject, RequestContext.scope(linkedFields[i].getScope()));
+
+                        }
+                        try {
+                            request.appendAsHtmlEncoded(field.titleString());
+                        } catch (final ObjectNotFoundException e) {
+                            request.appendAsHtmlEncoded(e.getMessage());
+                        }
+                        if (linkRow != null || linkedFields[i] != null) {
+                            request.appendHtml("</a>");
+                        }
+                    }
+                    request.appendHtml("</td>");
+
+                }
+            }
+            request.appendHtml("<td class=\"controls\">");
+            if (showSelectOption) {
+                request.appendHtml("<a class=\"button element-select\" href=\"" + "_generic." + Dispatcher.EXTENSION + "?" + RequestContext.RESULT + "=" + rowId + result + scope + "\">view</a>");
+            }
+            if (showEditOption) {
+                request.appendHtml(" <a class=\"button element-edit\" href=\"" + "_generic_edit." + Dispatcher.EXTENSION + "?" + RequestContext.RESULT + "=" + rowId + result + scope + "\">edit</a>");
+            }
+
+            if (showDeleteOption && parent != null) {
+                String view = request.getViewPath();
+                view = context.fullFilePath(view == null ? context.getResourceFile() : view);
+                RemoveElement.write(request, context.getMappedObject(parent), fieldName, element, null, view, view, "delete", "action in-line element-delete confirm");
+            }
+
+            request.appendHtml("</td>");
+
+        }
+    }
+
+    @Override
+    protected TableContentWriter createRowBuilder(
+            final Request request,
+            final RequestContext context,
+            final String parent,
+            final List<ObjectAssociation> allFields,
+            final ObjectAdapter collection) {
+        final String fieldName = request.getOptionalProperty(FIELD);
+        final String title = request.getOptionalProperty(FORM_TITLE);
+        return rowBuilder(request, context, title, parent, fieldName, allFields, showIconByDefault());
+    }
+
+    private static TableContentWriter rowBuilder(
+            final Request request,
+            final RequestContext context,
+            final String title,
+            final String object,
+            final String fieldName,
+            final List<ObjectAssociation> allFields,
+            final boolean showIconByDefault) {
+        final String linkRowView = request.getOptionalProperty(LINK_VIEW);
+        final String linkObjectName = request.getOptionalProperty(ELEMENT_NAME, RequestContext.RESULT);
+        final String linkObjectScope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
+        final LinkedObject linkRow = linkRowView == null ? null : new LinkedObject(linkObjectName, linkObjectScope, context.fullUriPath(linkRowView));
+        final boolean includeHeader = request.isRequested(HEADER, true);
+        final boolean includeFooter = request.isRequested(FOOTER, false);
+
+        final boolean linkFields = request.isRequested("link-fields", true);
+        final boolean showTitle = request.isRequested(SHOW_TITLE, false);
+        final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault);
+        final boolean showSelectOption = request.isRequested(SHOW_SELECT, true);
+        final boolean showEditOption = request.isRequested(SHOW_EDIT, true);
+        final boolean showDeleteOption = request.isRequested(SHOW_DELETE, true);
+
+        final String noColumnsString = request.getOptionalProperty("no-columns", "3");
+
+        final LinkedFieldsBlock block = new LinkedFieldsBlock();
+        request.setBlockContent(block);
+        request.processUtilCloseTag();
+        final List<ObjectAssociation> fields = block.includedFields(allFields);
+        final LinkedObject[] linkedFields = block.linkedFields(fields);
+        for (int i = 0; i < linkedFields.length; i++) {
+            if (linkedFields[i] == null && linkFields && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
+                linkedFields[i] = new LinkedObject("_generic.shtml");
+            }
+            if (linkedFields[i] != null) {
+                linkedFields[i].setForwardView(context.fullUriPath(linkedFields[i].getForwardView()));
+            }
+        }
+
+        int noColumns;
+        if (noColumnsString.equalsIgnoreCase("all")) {
+            noColumns = fields.size();
+        } else {
+            noColumns = Math.min(fields.size(), Integer.valueOf(noColumnsString));
+        }
+
+        final String headers[] = new String[noColumns];
+        int h = 0;
+        for (int i = 0; i < noColumns; i++) {
+            if (fields.get(i).isOneToManyAssociation()) {
+                continue;
+            }
+            headers[h++] = fields.get(i).getName();
+        }
+
+        request.popBlockContent();
+
+        return new SimpleTableBuilder(object, includeHeader, includeFooter, title, noColumns, headers, fields, showTitle,
+                showIcons, showSelectOption, showDeleteOption, showEditOption, fieldName, linkedFields, linkRow);
+    }
+
+    public static void write(
+            final Request request,
+            final String summary,
+            final ObjectAdapter object,
+            final ObjectAssociation field,
+            final ObjectAdapter collection,
+            final int noColumns,
+            final List<ObjectAssociation> fields,
+            final boolean linkAllFields,
+            final boolean showIconByDefault,
+            final String tableClass,
+            final String[] rowClasses,
+            LinkedObject linkedObject) {
+        final LinkedObject[] linkedFields = new LinkedObject[fields.size()];
+        if (linkAllFields) {
+            for (int i = 0; i < linkedFields.length; i++) {
+                if (fields.get(i).isOneToOneAssociation()) {
+                    linkedFields[i] = linkedObject == null ? new LinkedObject("_generic.shtml") : linkedObject;  
+                }
+            }
+        }
+        
+        final String headers[] = new String[fields.size()];
+        int h = 0;
+        for (int i = 0; i < fields.size(); i++) {
+            if (fields.get(i).isOneToManyAssociation()) {
+                continue;
+            }
+            headers[h++] = fields.get(i).getName();
+        }
+        
+        final RequestContext context = request.getContext();
+        final TableContentWriter rowBuilder = rowBuilder(request, context, null, context.mapObject(object, Scope.REQUEST), field.getIdentifier().getMemberName(), fields, 
+                showIconByDefault);
+        write(request, collection, summary, rowBuilder, null, null, null);
+    }
+
+    @Override
+    public String getName() {
+        return "table";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
new file mode 100644
index 0000000..d3b6904
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
@@ -0,0 +1,68 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class Title extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getOptionalProperty(FIELD);
+        final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
+        final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
+        String className = request.getOptionalProperty(CLASS);
+        className = className == null ? "title-icon" : className;
+        ObjectAdapter object = MethodsUtils.findObject(request.getContext(), id);
+        if (fieldName != null) {
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE).isVetoed()) {
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+            }
+            object = field.get(object);
+        }
+
+        if (object != null) {
+            request.appendHtml("<span class=\"object\">");
+            IsisContext.getPersistenceSession().resolveImmediately(object);
+            if (isIconShowing) {
+                final String iconPath = request.getContext().imagePath(object);
+                request.appendHtml("<img class=\"" + className + "\" src=\"" + iconPath + "\" />");
+            }
+            request.appendTruncated(object.titleString(), truncateTo);
+            request.appendHtml("</span>");
+        }
+        request.closeEmpty();
+    }
+
+    @Override
+    public String getName() {
+        return "title";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
new file mode 100644
index 0000000..52be7d6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
@@ -0,0 +1,58 @@
+/*
+ *  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.view.display;
+
+import java.util.List;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Warnings extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String cls = request.getOptionalProperty(CLASS);
+        final StringBuffer buffer = new StringBuffer();
+        write(cls, buffer);
+        if (buffer.length() > 0) {
+            request.appendHtml("<div class=\"feedback\">");
+            request.appendHtml(buffer.toString());
+            request.appendHtml("</div>");
+        }
+    }
+
+    public static void write(String cls, final StringBuffer buffer) {
+        if (cls == null) {
+            cls = "warning";
+        }
+        final MessageBroker messageBroker = IsisContext.getMessageBroker();
+        final List<String> warnings = messageBroker.getWarnings();
+        for (final String warning : warnings) {
+            buffer.append("<div class=\"" + cls + "\">" + warning + "</div>");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "warnings";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
new file mode 100644
index 0000000..deafb1a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
@@ -0,0 +1,319 @@
+/*
+ *  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.view.edit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.facets.object.choices.enums.EnumFacet;
+import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
+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.edit.EditAction;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
+
+public class EditObject extends AbstractElementProcessor {
+
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORMS;
+
+    @Override
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
+
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final String forwardEditedTo = request.getOptionalProperty(VIEW);
+        final String forwardErrorTo = request.getOptionalProperty(ERROR);
+        final String cancelTo = request.getOptionalProperty(CANCEL_TO); 
+        final boolean hideNonEditableFields = request.isRequested(HIDE_UNEDITABLE, false);
+        final boolean showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
+        final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
+        String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
+        String formTitle = request.getOptionalProperty(FORM_TITLE);
+        final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
+        final String variable = request.getOptionalProperty(RESULT_NAME);
+        final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        final String scope = request.getOptionalProperty(SCOPE);
+        final String className = request.getOptionalProperty(CLASS, "edit full");
+        final String completionMessage = request.getOptionalProperty(MESSAGE);
+
+        final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
+        final String actualObjectId = context.mapObject(object, Scope.INTERACTION);
+        final String version = context.mapVersion(object);
+
+        final String id = request.getOptionalProperty(ID, object.getSpecification().getShortIdentifier());
+
+        final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
+
+        final ObjectSpecification specification = object.getSpecification();
+        final FormFieldBlock containedBlock = new FormFieldBlock() {
+            @Override
+            public boolean isVisible(final String name) {
+                final ObjectAssociation fld = specification.getAssociation(name);
+                final boolean isVisible = fld.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed();
+                final boolean isUseable = fld.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
+                return isVisible && isUseable;
+            }
+
+            @Override
+            public ObjectAdapter getCurrent(final String name) {
+                ObjectAdapter value = null;
+                if (entryState != null) {
+                    final FieldEditState field2 = entryState.getField(name);
+                    value = field2.getValue();
+                }
+                if (value == null) {
+                    final ObjectAssociation fld = specification.getAssociation(name);
+                    value = fld.get(object);
+                }
+                return value;
+            }
+
+            @Override
+            public boolean isNullable(final String name) {
+                final ObjectAssociation fld = specification.getAssociation(name);
+                return !fld.isMandatory();
+            }
+        };
+
+        request.setBlockContent(containedBlock);
+        request.processUtilCloseTag();
+
+        final AuthenticationSession session = IsisContext.getAuthenticationSession();
+        List<ObjectAssociation> viewFields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, where));
+        viewFields = containedBlock.includedFields(viewFields);
+        final InputField[] formFields = createFields(viewFields);
+
+        initializeFields(context, object, formFields, entryState, !hideNonEditableFields);
+        setDefaults(context, object, formFields, entryState, showIcon);
+
+        copyFieldContent(context, object, formFields, showIcon);
+        overrideWithHtml(context, containedBlock, formFields);
+        String errors = null;
+        if (entryState != null && entryState.isForForm(formId)) {
+            copyEntryState(context, object, formFields, entryState);
+            errors = entryState.getError();
+        }
+
+        final String errorView = context.fullFilePath(forwardErrorTo == null ? context.getResourceFile() : forwardErrorTo);
+        final List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
+        hiddenFields.add(new HiddenInputField("_" + OBJECT, actualObjectId));
+        hiddenFields.add(new HiddenInputField("_" + VERSION, version));
+        hiddenFields.add(new HiddenInputField("_" + FORM_ID, formId));
+        hiddenFields.add(completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, completionMessage));
+        hiddenFields.add(forwardEditedTo == null ? null : new HiddenInputField("_" + VIEW, context.fullFilePath(forwardEditedTo)));
+        hiddenFields.add(new HiddenInputField("_" + ERROR, errorView));
+        hiddenFields.add(variable == null ? null : new HiddenInputField("_" + RESULT_NAME, variable));
+        hiddenFields.add(resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, resultOverride));
+        hiddenFields.add(scope == null ? null : new HiddenInputField("_" + SCOPE, scope));
+
+        if (!object.isTransient()) {
+            // ensure all booleans are included so the pass back TRUE if set.
+            final List<ObjectAssociation> fields2 = object.getSpecification().getAssociations(Contributed.EXCLUDED);
+            for (int i = 0; i < fields2.size(); i++) {
+                final ObjectAssociation field = fields2.get(i);
+                if (!viewFields.contains(field) && field.getSpecification().containsFacet(BooleanValueFacet.class)) {
+                    final String fieldId = field.getId();
+                    final String value = getValue(context, field.get(object));
+                    hiddenFields.add(new HiddenInputField(fieldId, value));
+                }
+            }
+        }
+
+        if (formTitle == null) {
+            formTitle = specification.getSingularName();
+        }
+
+        if (buttonTitle == null) {
+            buttonTitle = "Save " + specification.getSingularName();
+        } else if (buttonTitle.equals("")) {
+            buttonTitle = "Save";
+        }
+
+        final HiddenInputField[] hiddenFieldArray = hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]);
+        HtmlFormBuilder.createForm(request, EditAction.ACTION + ".app", hiddenFieldArray, formFields, className, id, formTitle,
+                labelDelimiter, null, null, buttonTitle, errors, cancelTo);
+     request.popBlockContent();
+    }
+
+    private InputField[] createFields(final List<ObjectAssociation> fields) {
+        final InputField[] formFields = new InputField[fields.size()];
+        int length = 0;
+        for (int i = 0; i < fields.size(); i++) {
+            if (!fields.get(i).isOneToManyAssociation()) {
+                formFields[i] = new InputField(fields.get(i).getId());
+                length++;
+            }
+        }
+        final InputField[] array = new InputField[length];
+        for (int i = 0, j = 0; i < formFields.length; i++) {
+            if (formFields[i] != null) {
+                array[j++] = formFields[i];
+            }
+        }
+        return array;
+    }
+
+    // TODO duplicated in ActionForm#initializeFields
+    private void initializeFields(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean includeUnusableFields) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
+            final AuthenticationSession session = IsisContext.getAuthenticationSession();
+            final Consent usable = field.isUsable(session, object, where);
+            final ObjectAdapter[] options = field.getChoices(object);
+            FieldFactory.initializeField(context, object, field, options, field.isMandatory(), formField);
+
+            final boolean isEditable = usable.isAllowed();
+            if (!isEditable) {
+                formField.setDescription(usable.getReason());
+            }
+            formField.setEditable(isEditable);
+            final boolean hiddenField = field.isVisible(session, object, where).isVetoed();
+            final boolean unusable = usable.isVetoed();
+            final boolean hideAsUnusable = unusable && !includeUnusableFields;
+            if (hiddenField || hideAsUnusable) {
+                formField.setHidden(true);
+            }
+        }
+    }
+
+    private void copyFieldContent(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final boolean showIcon) {
+        for (final InputField inputField : formFields) {
+            final String fieldName = inputField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
+                ResolveFieldUtil.resolveField(object, field);
+                final ObjectAdapter fieldValue = field.get(object);
+                if (inputField.isEditable()) {
+                    final String value = getValue(context, fieldValue);
+                    if (!value.equals("") || inputField.getValue() == null) {
+                        inputField.setValue(value);
+                    }
+                } else {
+                    final String entry = getValue(context, fieldValue);
+                    inputField.setHtml(entry);
+                    inputField.setType(InputField.HTML);
+
+                }
+
+                if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
+                    if (fieldValue != null) {
+                        final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(field.getSpecification()) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>" : "";
+                        final String entry = iconSegment + fieldValue.titleString();
+                        inputField.setHtml(entry);
+                    } else {
+                        final String entry = "<em>none specified</em>";
+                        inputField.setHtml(entry);
+                    }
+                }
+            }
+        }
+    }
+
+    private void setDefaults(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean showIcon) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
+            final ObjectAdapter defaultValue = field.getDefault(object);
+            if (defaultValue == null) {
+                continue;
+            }
+
+            final String title = defaultValue.titleString();
+            if (field.getSpecification().containsFacet(ParseableFacet.class)) {
+                formField.setValue(title);
+            } else if (field.isOneToOneAssociation()) {
+                final ObjectSpecification objectSpecification = field.getSpecification();
+                if (defaultValue != null) {
+                    final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
+                    final String html = iconSegment + title;
+                    formField.setHtml(html);
+                    final String value = defaultValue == null ? null : context.mapObject(defaultValue, Scope.INTERACTION);
+                    formField.setValue(value);
+                }
+            }
+        }
+    }
+
+    private void overrideWithHtml(final RequestContext context, final FormFieldBlock containedBlock, final InputField[] formFields) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            if (containedBlock.hasContent(fieldId)) {
+                final String content = containedBlock.getContent(fieldId);
+                if (content != null) {
+                    formField.setHtml(content);
+                    formField.setValue(null);
+                    formField.setType(InputField.HTML);
+                }
+            }
+        }
+    }
+
+    private void copyEntryState(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() && formField.isEditable()) {
+                final FieldEditState fieldState = entryState.getField(field.getId());
+                final String entry = fieldState == null ? "" : fieldState.getEntry();
+                formField.setValue(entry);
+                final String error = fieldState == null ? "" : fieldState.getError();
+                formField.setErrorText(error);
+            }
+        }
+    }
+
+    private String getValue(final RequestContext context, final ObjectAdapter field) {
+        if (field == null || field.isTransient()) {
+            return "";
+        }
+        final ObjectSpecification specification = field.getSpecification();
+        if (specification.containsFacet(EnumFacet.class)) {
+            return String.valueOf(field.getObject());
+        } else if (specification.getFacet(ParseableFacet.class) == null) {
+            return context.mapObject(field, Scope.INTERACTION);
+        } else {
+            return field.titleString();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "edit";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
new file mode 100644
index 0000000..35a9158
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
@@ -0,0 +1,105 @@
+/*
+ *  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.view.edit;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.all.help.HelpFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.maxlen.MaxLengthFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacet;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectFeature;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
+import org.apache.isis.core.metamodel.facets.value.password.PasswordValueFacet;
+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.view.form.InputField;
+
+public class FieldFactory {
+
+    public static void initializeField(final RequestContext context, final ObjectAdapter object, final ObjectFeature param, final ObjectAdapter[] optionsForParameter, final boolean isRequired, final InputField field) {
+
+        field.setLabel(param.getName());
+        field.setDescription(param.getDescription());
+        field.setDataType(param.getSpecification().getShortIdentifier());
+        if (param instanceof ObjectMember) {
+            field.setHelpReference(((ObjectMember) param).getHelp());
+        } else {
+            final HelpFacet helpFacet = param.getFacet(HelpFacet.class);
+            final String value = helpFacet.value();
+            field.setHelpReference(value);
+        }
+        field.setRequired(isRequired);
+        field.setHidden(false);
+
+        if (param.getSpecification().getFacet(ParseableFacet.class) != null) {
+            final int maxLength = param.getFacet(MaxLengthFacet.class).value();
+            field.setMaxLength(maxLength);
+
+            final TypicalLengthFacet typicalLengthFacet = param.getFacet(TypicalLengthFacet.class);
+            if (typicalLengthFacet.isDerived() && maxLength > 0) {
+                field.setWidth(maxLength);
+            } else {
+                field.setWidth(typicalLengthFacet.value());
+            }
+
+            final MultiLineFacet multiLineFacet = param.getFacet(MultiLineFacet.class);
+            field.setHeight(multiLineFacet.numberOfLines());
+            field.setWrapped(!multiLineFacet.preventWrapping());
+
+            final ObjectSpecification spec = param.getSpecification();
+            if (spec.containsFacet(BooleanValueFacet.class)) {
+                field.setType(InputField.CHECKBOX);
+            } else if (spec.containsFacet(PasswordValueFacet.class)) {
+                field.setType(InputField.PASSWORD);
+            } else {
+                field.setType(InputField.TEXT);
+            }
+
+        } else {
+            field.setType(InputField.REFERENCE);
+        }
+
+        if (optionsForParameter != null) {
+            final int noOptions = optionsForParameter.length;
+            final String[] optionValues = new String[noOptions];
+            final String[] optionTitles = new String[noOptions];
+            for (int j = 0; j < optionsForParameter.length; j++) {
+                final int i = j; // + (field.isRequired() ? 0 : 1);
+                optionValues[i] = getValue(context, optionsForParameter[j]);
+                optionTitles[i] = optionsForParameter[j].titleString();
+            }
+            field.setOptions(optionTitles, optionValues);
+        }
+    }
+
+    private static String getValue(final RequestContext context, final ObjectAdapter field) {
+        if (field == null) {
+            return "";
+        }
+        if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
+            return context.mapObject(field, Scope.INTERACTION);
+        } else {
+            return field.getObject().toString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
new file mode 100644
index 0000000..5d57740
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
@@ -0,0 +1,44 @@
+/*
+ *  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.view.edit;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class FormEntry extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
+        final String value = request.getRequiredProperty(VALUE);
+        final boolean isHidden = request.isRequested(HIDDEN, true);
+        block.exclude(field);
+        // TODO this is replaced because the field is marked as hidden!
+        final String content = "reference <input type=\"" + (isHidden ? "hidden" : "text") + "\" disabled=\"disabled\" name=\"" + field + "\" value=\"" + value + "\" />";
+        block.replaceContent(field, content);
+    }
+
+    @Override
+    public String getName() {
+        return "form-entry";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
new file mode 100644
index 0000000..55c7425
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
@@ -0,0 +1,44 @@
+/*
+ *  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.view.edit;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class FormField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
+        if (block.isVisible(field)) {
+            request.pushNewBuffer();
+            request.processUtilCloseTag();
+            final String content = request.popBuffer();
+            block.replaceContent(field, content);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "form-field";
+    }
+
+}


[11/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
new file mode 100644
index 0000000..82c67c1
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
@@ -0,0 +1,484 @@
+/*
+ *  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;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.TimeZone;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.Identifier;
+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.exceptions.IsisException;
+import org.apache.isis.core.commons.factory.InstanceUtil;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.viewer.scimpi.dispatcher.action.ActionAction;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+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.DebugHtmlWriter;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUserAction;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUsers;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.LogAction;
+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;
+import org.apache.isis.viewer.scimpi.dispatcher.logon.LogoutAction;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Encoder;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.HtmlFileParser;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.ProcessorLookup;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.SimpleEncoder;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessingException;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
+
+public class Dispatcher {
+    private static final String SHOW_UNSHOWN_MESSAGES = ConfigurationConstants.ROOT + "scimpi.show-unshown-messages";
+    public static final String ACTION = "_action";
+    public static final String EDIT = "_edit";
+    public static final String REMOVE = "_remove";
+    public static final String GENERIC = "_generic";
+    public static final String EXTENSION = "shtml";
+    private static final Logger LOG = LoggerFactory.getLogger(Dispatcher.class);
+    public static final String COMMAND_ROOT = ".app";
+    private final Map<String, Action> actions = new HashMap<String, Action>();
+    private final Map<String, String> parameters = new HashMap<String, String>();
+    private final ProcessorLookup processors = new ProcessorLookup();
+    private final HtmlFileParser parser = new HtmlFileParser(processors);
+    private final Encoder encoder = new SimpleEncoder();
+    private boolean showUnshownMessages;
+
+    public void process(final RequestContext context, final String servletPath) {
+        LOG.debug("processing request " + servletPath);
+        final AuthenticationSession session = UserManager.startRequest(context);
+        LOG.debug("exsiting session: " + session);
+        
+        String language = (String) context.getVariable("user-language");
+        if (language != null) {
+            Locale locale = Util.locale(language);
+            TimeZone timeZone = Util.timeZone((String) context.getVariable("user-time-zone"));
+            // IsisContext.getUserProfile().setLocalization(new UserLocalization(locale, timeZone));
+         } 
+        
+        IsisContext.getPersistenceSession().getTransactionManager().startTransaction();
+        context.setRequestPath(servletPath);
+        context.startRequest();
+
+        try {
+            processActions(context, false, servletPath);
+            processTheView(context);
+        } catch (final ScimpiNotFoundException e) {
+            if (context.isInternalRequest()) {
+                LOG.error("invalid page request (from within application): " + e.getMessage());
+                ErrorCollator error = new ErrorCollator(); 
+                error.missingFile("Failed to find page " + servletPath + "."); 
+                show500ErrorPage(context, e, error);             
+            } else {
+                LOG.info("invalid page request (from outside application): " + e.getMessage());
+                show404ErrorPage(context, servletPath); 
+            }
+        } catch (final NotLoggedInException e) {
+            redirectToLoginPage(context); 
+        } catch (final Throwable e) {
+            ErrorCollator error = new ErrorCollator();
+            final PersistenceSession checkSession = IsisContext.getPersistenceSession();
+            final IsisTransactionManager transactionManager = checkSession.getTransactionManager();
+            if (transactionManager.getTransaction() != null && transactionManager.getTransaction().getState().canAbort()) {
+                transactionManager.abortTransaction();
+                transactionManager.startTransaction();
+            }
+
+            final Throwable ex = e instanceof TagProcessingException ? e.getCause() : e;
+            if (ex instanceof ForbiddenException) {
+                LOG.error("invalid access to " + servletPath, e);
+                show403ErrorPage(context, error, e, ex);
+            } else {
+                LOG.error("error procesing " + servletPath, e);
+                if (context.getErrorMessage() != null) {
+                    fallbackToSimpleErrorPage(context, e);
+                } else {
+                    show500ErrorPage(context, e, error);
+                }
+            }
+        } finally {
+            try {
+                UserManager.endRequest(context.getSession());
+            } catch (final Exception e1) {
+                LOG.error("endRequest call failed", e1);
+            }
+        }
+    }
+
+    private void redirectToLoginPage(final RequestContext context) {
+        IsisContext.getMessageBroker().addWarning(
+            "You are not currently logged in! Please log in so you can continue.");
+        context.setRequestPath("/login.shtml");
+        try {
+            processTheView(context);
+        } catch (final IOException e1) {
+            throw new ScimpiException(e1);
+        }
+    }
+
+    private void show404ErrorPage(final RequestContext context, final String servletPath) {
+        ErrorCollator error = new ErrorCollator();
+        error.missingFile("Failed to find page " + servletPath + ".");
+        context.raiseError(404, error);
+    }
+
+    private void show403ErrorPage(final RequestContext context, ErrorCollator error, final Throwable e, final Throwable ex) {
+        DebugBuilder debug = error.getDebug();
+        error.message(e);
+        error.message(ex);
+        
+        final List<String> roles = ((ForbiddenException) ex).getRoles();
+        final StringBuffer roleList = new StringBuffer();
+        for (final String role : roles) {
+            if (roleList.length() > 0) {
+                roleList.append("|");
+            }
+            roleList.append(role);
+        }
+        final Identifier identifier =  ((ForbiddenException) ex).getIdentifier(); 
+        if (identifier != null) {
+            debug.appendln("Class", identifier.toClassIdentityString() + ":" + roleList);
+            debug.appendln("Member",identifier.toClassAndNameIdentityString() + ":" + roleList); 
+            debug.appendln("Other",identifier.toFullIdentityString() + ":" + roleList); 
+        }
+        
+        error.compileError(context);
+        context.raiseError(403, error);
+    }
+
+    private void show500ErrorPage(final RequestContext context, final Throwable e, ErrorCollator error) {
+        error.exception(e);
+        error.compileError(context);
+        context.raiseError(500, error);
+    }
+
+    private void fallbackToSimpleErrorPage(final RequestContext context, final Throwable e) {
+        context.setContentType("text/html");
+        final PrintWriter writer = context.getWriter();
+        writer.write("<html><head><title>Error</title></head>");
+        writer.write("<body><h1>Error</h1>");
+        writer.write("<p>Error while processing error</p><pre>");
+        e.printStackTrace(writer);
+        writer.write("</pre></body></html>");
+        writer.close();
+        LOG.error("Error while processing error", e);
+    }
+
+    protected void processTheView(final 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());
+    }
+
+    public void addParameter(final String name, final String value) {
+        parameters.put(name, value);
+    }
+
+    private String getParameter(final String name) {
+        return parameters.get(name);
+    }
+
+    private void processActions(final RequestContext context, final boolean userLoggedIn, final String actionName) throws IOException {
+        if (actionName.endsWith(COMMAND_ROOT)) {
+            final int pos = actionName.lastIndexOf('/');
+            final Action action = actions.get(actionName.substring(pos, actionName.length() - COMMAND_ROOT.length()));
+            if (action == null) {
+                throw new ScimpiException("No logic for " + actionName);
+            }
+
+            LOG.debug("processing action: " + action);
+            action.process(context);
+            final String fowardTo = context.forwardTo();
+            if (fowardTo != null) {
+                processActions(context, true, fowardTo);
+            }
+        }
+    }
+
+    private void processView(final RequestContext context) throws IOException {
+        String file = context.getRequestedFile();
+        if (file == null) {
+            LOG.warn("No view specified to process");
+            return;
+        }
+        if (file.endsWith(COMMAND_ROOT)) {
+            return;
+        }
+        file = determineFile(context, file);
+        final String fullPath = context.requestedFilePath(file);
+        LOG.debug("processing file " + fullPath);
+        context.setResourcePath(fullPath);
+
+        context.setContentType("text/html");
+
+        context.addVariable("title", "Untitled Page", Scope.REQUEST);
+        final Stack<Snippet> tags = loadPageTemplate(context, fullPath);
+        final Request request = new Request(file, context, encoder, tags, processors);
+        request.appendDebug("processing " + fullPath);
+        try {
+            request.processNextTag();
+            noteIfMessagesHaveNotBeenDisplay(context);
+        } catch (final RuntimeException e) {
+            IsisContext.getMessageBroker().getMessages();
+            IsisContext.getMessageBroker().getWarnings();
+            throw e;
+        }
+        final String page = request.popBuffer();
+        final PrintWriter writer = context.getWriter();
+        writer.write(page);
+        if (context.getDebug() == Debug.PAGE) {
+            final DebugHtmlWriter view = new DebugHtmlWriter(writer, false);
+            context.append(view);
+        }
+    }
+
+    public void noteIfMessagesHaveNotBeenDisplay(final RequestContext context) {
+        final List<String> messages = IsisContext.getMessageBroker().getMessages();
+        if (showUnshownMessages) {
+            if (messages.size() > 0) {
+                context.getWriter().println("<ol class=\"messages forced\">");
+                for (String message : messages) {
+                    context.getWriter().println("<li>" + message + "</li>");                
+                }
+                context.getWriter().println("</ol>");
+            }
+            final List<String> warnings = IsisContext.getMessageBroker().getWarnings();
+            if (warnings.size() > 0) {
+                context.getWriter().println("<ol class=\"warnings forced\">");
+                for (String message : warnings) {
+                    context.getWriter().println("<li>" + message + "</li>");                
+                }
+                context.getWriter().println("</ol>");
+            }
+        }
+    }
+
+    private String determineFile(final RequestContext context, String file) {
+        final String fileName = file.trim();
+        if (fileName.startsWith(GENERIC)) {
+            final Object result = context.getVariable(RequestContext.RESULT);
+            final ObjectAdapter mappedObject = MethodsUtils.findObject(context, (String) result);
+            if (mappedObject == null) {
+                throw new ScimpiException("No object mapping for " + result);
+            }
+            if (fileName.equals(GENERIC + "." + EXTENSION)) {
+                final Facet facet = mappedObject.getSpecification().getFacet(CollectionFacet.class);
+                if (facet != null) {
+                    final ObjectSpecification specification = mappedObject.getSpecification();
+                    final TypeOfFacet facet2 = specification.getFacet(TypeOfFacet.class);
+                    file = findFileForSpecification(context, facet2.valueSpec(), "collection", EXTENSION);
+                } else {
+                    final ObjectAdapter mappedObject2 = mappedObject;
+                    if (mappedObject2.isTransient()) {
+                        file = findFileForSpecification(context, mappedObject.getSpecification(), "edit", EXTENSION);
+                    } else {
+                        file = findFileForSpecification(context, mappedObject.getSpecification(), "object", EXTENSION);
+                    }
+                }
+            } else if (fileName.equals(GENERIC + EDIT + "." + EXTENSION)) {
+                file = findFileForSpecification(context, mappedObject.getSpecification(), "edit", EXTENSION);
+            } else if (fileName.equals(GENERIC + ACTION + "." + EXTENSION)) {
+                final String method = context.getParameter("method");
+                file = findFileForSpecification(context, mappedObject.getSpecification(), method, "action", EXTENSION);
+            }
+        }
+        return file;
+    }
+
+    private String findFileForSpecification(final RequestContext context, final ObjectSpecification specification, final String name, final String extension) {
+        return findFileForSpecification(context, specification, name, name, extension);
+    }
+
+    private String findFileForSpecification(final RequestContext context, final ObjectSpecification specification, final String name, final String defaultName, final String extension) {
+
+        String find = findFile(context, specification, name, extension);
+        if (find == null) {
+            find = "/generic/" + defaultName + "." + extension;
+        }
+        return find;
+    }
+
+    private String findFile(final RequestContext context, final ObjectSpecification specification, final String name, final String extension) {
+        final String className = specification.getShortIdentifier();
+        String fileName = context.findFile("/" + className + "/" + name + "." + extension);
+        if (fileName == null) {
+            final List<ObjectSpecification> interfaces = specification.interfaces();
+            for (int i = 0; i < interfaces.size(); i++) {
+                fileName = findFile(context, interfaces.get(i), name, extension);
+                if (fileName != null) {
+                    return fileName;
+                }
+            }
+            if (specification.superclass() != null) {
+                fileName = findFile(context, specification.superclass(), name, extension);
+            }
+        }
+        return fileName;
+    }
+
+    private Stack<Snippet> loadPageTemplate(final RequestContext context, final String path) throws IOException, FileNotFoundException {
+        // TODO cache stacks and check for them first
+        copyParametersToVariableList(context);
+        LOG.debug("parsing source " + path);
+        return parser.parseHtmlFile(path, context);
+    }
+
+    private void copyParametersToVariableList(final RequestContext context) {
+        /*
+         * Enumeration parameterNames = context.getParameterNames(); while
+         * (parameterNames.hasMoreElements()) { String name = (String)
+         * parameterNames.nextElement(); if (!name.equals("view")) {
+         * context.addVariable(name, context.getParameter(name), Scope.REQUEST);
+         * } }
+         */
+    }
+
+    public void init(final String dir, final DebugUsers debugUsers) {
+        addAction(new ActionAction());
+
+        // TODO remove
+        addAction(new DebugAction(this));
+        addAction(new DebugUserAction(debugUsers));
+        addAction(new EditAction());
+        addAction(new RemoveAction());
+        addAction(new LogonAction());
+        addAction(new LogoutAction());
+        addAction(new LogAction());
+
+        final String configFile = getParameter("config");
+        if (configFile != null) {
+            final File file = new File(dir, configFile);
+            if (file.exists()) {
+                loadConfigFile(file);
+            } else {
+                throw new ScimpiException("Configuration file not found: " + configFile);
+            }
+        }
+
+        processors.init();
+        processors.addElementProcessor(new org.apache.isis.viewer.scimpi.dispatcher.view.debug.Debug(this));
+        
+        showUnshownMessages = IsisContext.getConfiguration().getBoolean(SHOW_UNSHOWN_MESSAGES, true);
+    }
+
+    private void loadConfigFile(final File file) {
+        try {
+            Document document;
+            final SAXReader reader = new SAXReader();
+            document = reader.read(file);
+            final Element root = document.getRootElement();
+            for (final Iterator i = root.elementIterator(); i.hasNext();) {
+                final Element element = (Element) i.next();
+
+                if (element.getName().equals("actions")) {
+                    for (final Iterator actions = element.elementIterator("action"); actions.hasNext();) {
+                        final Element action = (Element) actions.next();
+                        final String className = action.getText();
+                        final Action instance = (Action) InstanceUtil.createInstance(className);
+                        addAction(instance);
+                    }
+                }
+
+                if (element.getName().equals("processors")) {
+                    for (final Iterator processors = element.elementIterator("processor"); processors.hasNext();) {
+                        final Element processor = (Element) processors.next();
+                        final String className = processor.getText();
+                        final ElementProcessor instance = (ElementProcessor) InstanceUtil.createInstance(className);
+                        this.processors.addElementProcessor(instance);
+                    }
+                }
+
+            }
+        } catch (final DocumentException e) {
+            throw new IsisException(e);
+        }
+
+    }
+
+    private void addAction(final Action action) {
+        actions.put("/" + action.getName(), action);
+        action.init();
+    }
+
+    public void debug(final DebugBuilder debug) {
+        debug.startSection("Actions");
+        final Set<String> keySet = actions.keySet();
+        final ArrayList<String> list = new ArrayList<String>(keySet);
+        Collections.sort(list);
+        for (final String name : list) {
+            debug.appendln(name, actions.get(name));
+        }
+        /*
+         * new ArrayList<E>(actions.keySet().iterator()) Iterator<String> names
+         * = Collections.sort().iterator(); while (names.hasNext()) { String
+         * name = names.next(); view.appendRow(name, actions.get(name)); }
+         */
+        final Iterator<Action> iterator = actions.values().iterator();
+        while (iterator.hasNext()) {
+            iterator.next().debug(debug);
+        }
+
+        processors.debug(debug);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java
new file mode 100644
index 0000000..eaae2ac
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java
@@ -0,0 +1,24 @@
+/*
+ *  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;
+
+public interface ElementContentProcessor extends ElementProcessor {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java
new file mode 100644
index 0000000..471ac00
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher;
+
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public interface ElementProcessor {
+
+    String getName();
+
+    void process(Request request);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java
new file mode 100644
index 0000000..97e297e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java
@@ -0,0 +1,148 @@
+/*
+ *  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;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.debug.DebugHtmlString;
+import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.commons.debug.DebugTee;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugHtmlWriter;
+
+public class ErrorCollator {
+    private static final Logger LOG = LoggerFactory.getLogger(ErrorCollator.class);
+
+    private String errorRef;
+    private String message;
+    private final DebugString debugText = new DebugString();
+    private final DebugHtmlString debugHtml = new DebugHtmlString();
+    private final DebugBuilder debug = new DebugTee(debugText, debugHtml);
+ 
+    public void missingFile(String message) {
+        this.message = message;
+    }
+
+    public void message(final Throwable exception) {
+        LOG.debug(exception.getMessage(), exception);
+        message = exception.getMessage();
+        debug.appendPreformatted(message);
+    }
+
+    public void exception(final Throwable exception) {
+        String messageText = exception.getMessage(); 
+        LOG.debug(messageText, exception); 
+        try {
+            debug.startSection("Exception");
+            debug.appendException(exception);
+            debug.endSection();
+        } catch (final RuntimeException e) {
+            debug.appendln("NOTE - an exception occurred while dumping an exception!");
+            debug.appendException(e);
+        }
+        message = messageText == null ? exception.getClass().getName() : messageText; 
+    }
+        
+    public DebugBuilder getDebug() {
+        return debug;
+    }
+    
+    public void compileError(final RequestContext requestContext) {
+        errorRef = Long.toString(System.currentTimeMillis(), 36).toUpperCase();
+        LOG.info("error " + errorRef);
+
+        captureWarningsAndMessages();
+        dumpDebugDetails(requestContext);
+        writeErrorFile();
+    }
+
+    private void captureWarningsAndMessages() {
+        // Capture warnings/messages
+        if (IsisContext.getCurrentTransaction() != null) {
+            final List<String> messages = IsisContext.getMessageBroker().getMessages();
+            final List<String> warnings = IsisContext.getMessageBroker().getWarnings();
+            if (messages.size() > 0 || messages.size() > 0) {
+                debug.startSection("Warnings/Messages");
+                for (final String message : messages) {
+                    debug.appendln("message", message);
+                }
+                for (final String message : warnings) {
+                    debug.appendln("warning", message);
+                }
+            }
+        }
+    }
+
+    private void dumpDebugDetails(final RequestContext requestContext) {
+        // Dump page debug details 
+        requestContext.append(debug);
+
+        debug.startSection("Processing Trace");
+        debug.appendPreformatted(requestContext.getDebugTrace());
+        debug.endSection();
+        debug.close();
+    }
+
+    private void writeErrorFile() {
+        LOG.error(message + "\n" + debugText.toString());
+        
+        
+        PrintWriter writer;
+        try {
+            final String directory =
+                IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.error-snapshots", ".");
+            File dir = new File(directory);
+            if (!dir.exists()) {
+                dir.mkdirs();
+            }
+            writer = new PrintWriter(new File(dir, "error_" + errorRef + ".html"));
+            final DebugHtmlWriter writer2 = new DebugHtmlWriter(writer, true);
+            writer2.concat(debugHtml);
+            writer2.close();
+            writer.close();
+        } catch (final FileNotFoundException e) {
+            LOG.error("Failed to archive error page", e);
+        }
+    }
+
+    public String getReference() {
+        return errorRef;
+    }
+    
+    public String getDetails() {
+        return debugHtml.toString();
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
new file mode 100644
index 0000000..32d0c0c
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
@@ -0,0 +1,68 @@
+/*
+ *  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;
+
+import java.util.List;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+
+/**
+ * Indicates that request could not complete as it could not access (for
+ * security reasons) some of the content.
+ */
+public class ForbiddenException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+    public static final boolean VISIBLE_AND_USABLE = true;
+    public static final boolean VISIBLE = false;
+    private final Identifier identifier;
+    private final AuthenticationSession session;
+
+    public ForbiddenException(final String message) {
+        this(IsisContext.getAuthenticationSession(), message);
+    }
+
+    private ForbiddenException(final AuthenticationSession session, final String message) {
+        super(message + " for " + session.getUserName() + " " + session.getRoles());
+        this.session = session;
+        identifier = null;
+    }
+
+    public ForbiddenException(final IdentifiedHolder target, final boolean isVisibleAndUsabable) {
+        this(target.getIdentifier(), IsisContext.getAuthenticationSession(), isVisibleAndUsabable);
+    }
+
+    private ForbiddenException(final Identifier identifier, final AuthenticationSession session, final boolean isVisibleAndUsabable) {
+        super((identifier.getType() == Identifier.Type.PROPERTY_OR_COLLECTION ? "Field" : "Action") + " '" + identifier.getMemberName() + "' in " + identifier.getClassName() + " is not " + (isVisibleAndUsabable ? "visible/usable " : "visible") + " for " + session.getUserName() + " "
+                + session.getRoles());
+        this.identifier = identifier;
+        this.session = session;
+    }
+
+    public Identifier getIdentifier() {
+        return identifier;
+    }
+
+    public List<String> getRoles() {
+        return session.getRoles();
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java
new file mode 100644
index 0000000..29b15e5
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java
@@ -0,0 +1,91 @@
+/*
+ *  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;
+
+public interface Names {
+    static final String PREFIX = "_logon-";
+
+    static final String BUTTON_TITLE = "button-title";
+    static final String CANCEL_TO = "cancel-to";
+    static final String COLLECTION = "collection";
+    static final String CONFIRM = "confirm";
+    static final String CLASS = "class";
+    static final String CONTAINER_CLASS = "container-" + CLASS;
+    static final String DEFAULT = "default";
+    static final String ELEMENT_NAME = "element-name";
+    static final String ELEMENT = "element";
+    static final String EVEN_ROW_CLASS = "even-row";
+    static final String FALSE = "false";
+    static final String ERROR = "error";
+    static final String FIELD = "field";
+    static final String FIELD_NAME = "field-name";
+    static final String FOOTER = "footer";
+    static final String FORM_ID = "form-id";
+    static final String FORM_TITLE = "title";
+    static final String FORMS = "show-forms";
+    static final String HEADER = "header";
+    static final String ICON_CLASS = "icon";
+    static final String HIDDEN = "hidden";
+    static final String HIDE_UNEDITABLE = "hide-uneditable";
+    static final String HEADER_LEVEL = "header";
+    static final String ID = "id";
+    static final String LABEL_DELIMITER = "label";
+    static final String LINK_VIEW = "link-view";
+    static final String LINK_NAME = "link-name";
+    static final String LINK_OBJECT = "link-object";
+    static final String METHOD = "method";
+    static final String MESSAGE = "message";
+    static final String NAME = "name";
+    static final String ODD_ROW_CLASS = "odd-row";
+    static final String OBJECT = "object";
+    static final String PARAMETER = "param";
+    static final String PARAMETER_NUMBER = "number";
+    static final String PLURAL = "plural";
+    static final String REFERENCE_NAME = "reference-name";
+    static final String RESULT_NAME = "result-name";
+    static final String RESULT_OVERRIDE = "result-override";
+    static final String ROW_CLASSES = "row-classes";
+    static final String SCOPE = "scope";
+    static final String SHOW_ICON = "icon";
+    static final String SHOW_SELECT = "select";
+    static final String SHOW_EDIT = "edit";
+    static final String SHOW_DELETE = "delete";
+    static final String SHOW_MESSAGE = "show-message";
+    static final String SHOW_TITLE = "show-title";
+    static final String TRUNCATE = "truncate";
+    static final String TABLE_TITLE = "title";
+    static final String TYPE = "type";
+    static final String VIEW = "view";
+    static final String VALUE = "value";
+    static final String VERSION = "version";
+    static final String USER = "user";
+    static final String VOID = "void";
+    static final String WHEN = "when";
+    static final String ENTRY_FIELDS = "entry-fields";
+    
+    
+    static final String LOGON_OBJECT = PREFIX + OBJECT;
+    static final String LOGON_METHOD = PREFIX + METHOD;
+    static final String LOGON_SCOPE = PREFIX + SCOPE;
+    static final String LOGON_RESULT_NAME = PREFIX + RESULT_NAME;
+    static final String LOGON_FORM_ID = PREFIX + "form-id";
+    
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
new file mode 100644
index 0000000..9cd54a3
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
@@ -0,0 +1,31 @@
+/*
+ *  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() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
new file mode 100644
index 0000000..a0ae5cf
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
@@ -0,0 +1,71 @@
+/*
+ *  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;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+public final class ResolveFieldUtil {
+
+    private ResolveFieldUtil(){}
+
+    /**
+     * Walking the graph.
+     *
+     * <p>
+     *     This combines the implementations of both the DN Objectstore
+     *     and also the in-memory objectstore.
+     * </p>
+     */
+    public static void resolveField(final ObjectAdapter object, final ObjectAssociation association) {
+
+
+        // DN impl.
+        {
+            final ObjectAdapter referencedCollectionAdapter = association.get(object);
+
+            // this code originally brought in from the JPA impl, but seems reasonable.
+            if (association.isOneToManyAssociation()) {
+                ensureThatState(referencedCollectionAdapter, is(notNullValue()));
+
+                final Object referencedCollection = referencedCollectionAdapter.getObject();
+                ensureThatState(referencedCollection, is(notNullValue()));
+
+                // if a proxy collection, then force it to initialize.  just 'touching' the object is sufficient.
+                // REVIEW: I wonder if this is actually needed; does JDO use proxy collections?
+                referencedCollection.hashCode();
+            }
+
+            // the JPA impl used to also call its lifecycle listener on the referenced collection object, eg List,
+            // itself.  I don't think this makes sense to do for JDO (the collection is not a PersistenceCapable).
+        }
+
+        // In-memory objectstore impl
+        {
+            final ObjectAdapter referenceAdapter = association.get(object);
+            referenceAdapter.markAsResolvedIfPossible();
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
new file mode 100644
index 0000000..18e7646
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
@@ -0,0 +1,44 @@
+/*
+ *  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;
+
+public class ScimpiException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public ScimpiException() {
+    }
+
+    public ScimpiException(final String message) {
+        super(message);
+    }
+
+    public ScimpiException(final Throwable cause) {
+        super(cause);
+    }
+
+    public ScimpiException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public String getHtmlMessage() {
+        return getMessage();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java
new file mode 100644
index 0000000..6b1e77a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java
@@ -0,0 +1,41 @@
+/*
+ *  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;
+
+public class ScimpiNotFoundException extends ScimpiException {
+    public ScimpiNotFoundException() {
+        super();
+    }
+
+    public ScimpiNotFoundException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public ScimpiNotFoundException(final String message) {
+        super(message);
+    }
+
+    public ScimpiNotFoundException(final Throwable cause) {
+        super(cause);
+    }
+
+    private static final long serialVersionUID = 1L;
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java
new file mode 100644
index 0000000..97e00e4
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java
@@ -0,0 +1,31 @@
+/*
+ *  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;
+
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class TagOrderException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+
+    public TagOrderException(final Request request) {
+        super("Invalid tag in this context: " + request.getTag().getName());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java
new file mode 100644
index 0000000..cdb1b04
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java
@@ -0,0 +1,91 @@
+/*
+ *  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;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.commons.authentication.AnonymousSession;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.runtime.authentication.AuthenticationManager;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+
+public class UserManager {
+
+    private static final Logger LOG = LoggerFactory.getLogger(UserManager.class);
+    private static UserManager instance;
+
+    private static AuthenticationManager getAuthenticationManager() {
+        if (instance == null) {
+            throw new IllegalStateException("Server initialisation failed, or not defined as a context listener");
+        }
+        return instance.authenticationManager;
+    }
+
+    public static AuthenticationSession startRequest(final RequestContext context) {
+        AuthenticationSession session = context.getSession();
+        if (session == null) {
+            session = new AnonymousSession();
+            LOG.debug("start anonymous request: " + session);
+        } else {
+            LOG.debug("start request for: " + session.getUserName());
+        }
+        IsisContext.closeSession();
+        IsisContext.openSession(session);
+        return session;
+    }
+
+    public static AuthenticationSession authenticate(final AuthenticationRequestPassword passwordAuthenticationRequest) {
+        final AuthenticationSession session = getAuthenticationManager().authenticate(passwordAuthenticationRequest);
+        if (session != null) {
+            LOG.info("log on user " + session.getUserName());
+            IsisContext.closeSession();
+            IsisContext.openSession(session);
+        }
+        return session;
+    }
+
+    public static void endRequest(final AuthenticationSession session) {
+        if (session == null) {
+            LOG.debug("end anonymous request");
+        } else {
+            LOG.debug("end request for: " + session.getUserName());
+        }
+        IsisContext.closeSession();
+    }
+
+    public static void logoffUser(final AuthenticationSession session) {
+        LOG.info("log off user " + session.getUserName());
+        IsisContext.closeSession();
+        getAuthenticationManager().closeSession(session);
+
+        final AnonymousSession replacementSession = new AnonymousSession();
+        IsisContext.openSession(replacementSession);
+    }
+
+    private final AuthenticationManager authenticationManager;
+
+    public UserManager(final AuthenticationManager authenticationManager) {
+        this.authenticationManager = authenticationManager;
+        UserManager.instance = this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java
new file mode 100644
index 0000000..b485dd0
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java
@@ -0,0 +1,105 @@
+/*
+ *  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;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
+
+class Util {
+    
+    public static final String DEFAULT_TIME_ZONE = "Europe/London";
+    public static final String DEFAULT_LANGUAGE = "English, United Kingdom (en-gb)";
+    
+
+    private Util() {}
+
+    public static boolean hasChanged(String version1, String version2) {
+        return version2 == null && version1 != null || (version2 != null && !version2.equals(version1));
+    }
+
+    public static List<String> languages() {
+        Locale[] locales = DateFormat.getAvailableLocales();
+        List<String> list = new ArrayList<String>(locales.length);
+        for (Locale locale : locales) {
+            list.add(localeName(locale));
+        }
+        Collections.sort(list);
+        return list;
+    }
+    
+    public static List<String> timeZones() {
+        List<String> timezones = Arrays.asList(TimeZone.getAvailableIDs());
+        Collections.sort(timezones);
+        return timezones;
+    }
+
+    public static TimeZone timeZone(String timeZoneEntry) {
+        TimeZone timeZone = TimeZone.getTimeZone(timeZoneEntry);
+        return timeZone;
+    }
+
+    public static Locale locale(String localeCode) {
+        String substring[] = localeCode.trim().split("-");
+        Locale locale;
+        switch (substring.length) {
+        case 1:
+            locale = new Locale(substring[0]);                    
+            break;
+        case 2:
+            locale = new Locale(substring[0], substring[1]);                    
+            break;
+        case 3:
+            locale = new Locale(substring[0], substring[1], substring[3]);                    
+            break;
+        default:
+            locale = Locale.getDefault();
+            break;
+        }
+        return locale;
+    }
+
+    public static String languageName(String languageCode) {
+        Locale locale = locale(languageCode);
+        return localeName(locale);
+    }
+
+    public static String codeForLanguage(String language) {
+        Locale[] locales = DateFormat.getAvailableLocales();
+        for (Locale locale : locales) {
+            String name = localeName(locale);
+            if (name.equals(language)) {
+                return locale.toString().toLowerCase().replace('_', '-');
+            }
+        }
+        return null;
+    }
+
+    public static String localeName(Locale locale) {
+        String language = locale.getDisplayLanguage();
+        String country = locale.getDisplayCountry().length() == 0 ? "" :  ", " + (locale.getDisplayCountry());
+        return language + country + " (" +  locale.toString().toLowerCase().replace('_', '-') + ")";
+    }
+   
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
new file mode 100644
index 0000000..44a9756
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
@@ -0,0 +1,268 @@
+/*
+ *  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.action;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.authentication.AnonymousSession;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.consent.Veto;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.Action;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+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.edit.FieldEditState;
+import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class ActionAction implements Action {
+
+    public static final String ACTION = "action";
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public String getName() {
+        return ACTION;
+    }
+
+    /**
+     * REVIEW - this and EditAction are very similar - refactor out common code.
+     */
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        final String objectId = context.getParameter("_" + OBJECT);
+        final String version = context.getParameter("_" + VERSION);
+        final String formId = context.getParameter("_" + FORM_ID);
+        final String methodName = context.getParameter("_" + METHOD);
+        final String override = context.getParameter("_" + RESULT_OVERRIDE);
+        String resultName = context.getParameter("_" + RESULT_NAME);
+        final String message = context.getParameter("_" + MESSAGE);
+        resultName = resultName == null ? RequestContext.RESULT : resultName;
+
+        FormState entryState = null;
+        try {
+            final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
+            // FIXME need to find method based on the set of parameters.
+            // otherwise overloaded method may be incorrectly
+            // selected.
+            final ObjectAction action = MethodsUtils.findAction(object, methodName);
+            entryState = validateParameters(context, action, object);
+
+            AuthenticationSession session = context.getSession();
+            if (session == null && action.isVisible(new AnonymousSession(), object, where).isVetoed()) {
+                session = new AnonymousSession();
+            }
+
+            final Version originalVersion = context.getVersion(version);
+            object.checkLock(originalVersion);
+            if (entryState.isValid()) {
+                final boolean hasResult = invokeMethod(context, resultName, object, action, entryState);
+                String view = context.getParameter(hasResult ? "_" + VIEW : "_" + VOID);
+
+                final int questionMark = view == null ? -1 : view.indexOf("?");
+                if (questionMark > -1) {
+                    final String params[] = view.substring(questionMark + 1).split("&");
+                    for (final String param : params) {
+                        final int equals = param.indexOf("=");
+                        context.addVariable(param.substring(0, equals), param.substring(equals + 1), Scope.REQUEST);
+                        view = view.substring(0, questionMark);
+                    }
+                }
+                context.setRequestPath(view);
+                if (message != null) {
+                    final MessageBroker messageBroker = getMessageBroker();
+                    messageBroker.addMessage(message);
+                }
+                if (override != null) {
+                    context.addVariable(resultName, override, Scope.REQUEST);
+                }
+                if (!action.hasReturn() && context.getVariable(resultName) == null) {
+                    context.addVariable(resultName, objectId, Scope.REQUEST);
+                }
+            } else {
+                entryState.setForm(formId);
+                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
+                context.addVariable(resultName, objectId, Scope.REQUEST);
+                if (override != null) {
+                    context.addVariable(resultName, override, Scope.REQUEST);
+                }
+                final String error = entryState.getError();
+                final String view = context.getParameter("_" + ERROR);
+                context.setRequestPath(view, Dispatcher.ACTION);
+
+                final MessageBroker messageBroker = getMessageBroker();
+                messageBroker.addWarning(error);
+            }
+        } catch (final ConcurrencyException e) {
+            final ObjectAdapter adapter = getAdapterManager().getAdapterFor(e.getOid()); 
+            String user = adapter.getOid().getVersion().getUser();
+            String errorMessage = "The data for '" + adapter.titleString() + "' was changed by " + user
+                    + ". Please repeat the action based on those changes.";
+            getMessageBroker().addMessage(errorMessage);
+
+            entryState.setForm(formId);
+            context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
+            context.addVariable(resultName, objectId, Scope.REQUEST);
+            if (override != null) {
+                context.addVariable(resultName, override, Scope.REQUEST);
+            }
+            final String error = entryState.getError();
+            if (error != null) {
+                context.addVariable(RequestContext.ERROR, error, Scope.REQUEST);
+            }
+
+            final String view = context.getParameter("_" + ERROR);
+            context.setRequestPath(view, Dispatcher.ACTION);
+
+        } catch (final RuntimeException e) {
+            getMessageBroker().getMessages();
+            getMessageBroker().getWarnings();
+            throw e;
+        }
+    }
+
+    private boolean invokeMethod(final RequestContext context, final String variable, final ObjectAdapter object, final ObjectAction action, final FormState entryState) {
+
+        final ObjectAdapter[] parameters = getParameters(action, entryState);
+        final String scopeName = context.getParameter("_" + SCOPE);
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+        return MethodsUtils.runMethod(context, action, object, parameters, variable, scope);
+    }
+
+    private ObjectAdapter[] getParameters(final ObjectAction action, final FormState entryState) {
+        final int parameterCount = action.getParameterCount();
+        final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];
+        for (int i = 0; i < parameterCount; i++) {
+            parameters[i] = entryState.getField(parameterName(i)).getValue();
+        }
+        return parameters;
+    }
+
+    private FormState validateParameters(final RequestContext context, final ObjectAction action, final ObjectAdapter object) {
+        final FormState formState = new FormState();
+        final List<ObjectActionParameter> parameters2 = action.getParameters();
+        final int parameterCount = action.getParameterCount();
+        for (int i = 0; i < parameterCount; i++) {
+            final String fieldName = parameterName(i);
+            String newEntry = context.getParameter(fieldName);
+
+            if (newEntry != null && newEntry.equals("-OTHER-")) {
+                newEntry = context.getParameter(fieldName + "-other");
+            }
+
+            if (newEntry == null) {
+                // TODO figure out a better way to determine if boolean or a
+                // password
+                final ObjectSpecification spec = parameters2.get(i).getSpecification();
+                if (spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(boolean.class)) || spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(Boolean.class))) {
+                    newEntry = FALSE;
+                } else {
+                    newEntry = "";
+                }
+            }
+            final FieldEditState fieldState = formState.createField(fieldName, newEntry);
+            Consent consent = null;
+
+            if (!parameters2.get(i).isOptional() && newEntry.equals("")) {
+                consent = new Veto(parameters2.get(i).getName() + " required");
+                formState.setError("Not all fields have been set");
+
+            } else if (parameters2.get(i).getSpecification().getFacet(ParseableFacet.class) != null) {
+                try {
+                    final ParseableFacet facet = parameters2.get(i).getSpecification().getFacet(ParseableFacet.class);
+                    Localization localization = IsisContext.getLocalization(); 
+                    final String message = parameters2.get(i).isValid(object, newEntry, localization); 
+                    if (message != null) {
+                        consent = new Veto(message);
+                        formState.setError("Not all fields are valid");
+                    }
+                    final ObjectAdapter entry = facet.parseTextEntry(null, newEntry, localization);
+                    fieldState.setValue(entry);
+                } catch (final TextEntryParseException e) {
+                    consent = new Veto(e.getMessage());
+                    formState.setError("Not all fields are valid");
+                }
+            } else {
+                fieldState.setValue(newEntry == null ? null : context.getMappedObject(newEntry));
+            }
+            if (consent != null && consent.isVetoed()) {
+                fieldState.setError(consent.getReason());
+            }
+        }
+
+        if (formState.isValid()) {
+            final ObjectAdapter[] parameters = getParameters(action, formState);
+            final Consent consent = action.isProposedArgumentSetValid(object, parameters);
+            if (consent != null && consent.isVetoed()) {
+                formState.setError(consent.getReason());
+            }
+        }
+
+        return formState;
+    }
+
+    public static String parameterName(final int index) {
+        return PARAMETER + (index + 1);
+    }
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+    
+
+    ///////////////////////////////////////////////////////////////////////////
+    // from context
+    ///////////////////////////////////////////////////////////////////////////
+    
+    protected MessageBroker getMessageBroker() {
+        return IsisContext.getMessageBroker();
+    }
+
+    protected AdapterManager getAdapterManager() {
+        return IsisContext.getPersistenceSession().getAdapterManager();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
new file mode 100644
index 0000000..67d13e2
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
@@ -0,0 +1,131 @@
+/*
+ *  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.action;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.htmlparser.Attribute;
+import org.htmlparser.nodes.TagNode;
+
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+
+public class Attributes {
+    private static final String TRUE = " true yes on ";
+    private static final String FALSE = " false no off ";
+    private final TagNode tagNode;
+    private final RequestContext context;
+
+    public Attributes(final TagNode tagNode, final RequestContext context) {
+        this.tagNode = tagNode;
+        this.context = context;
+    }
+
+    public boolean isPropertySet(final String name) {
+        final String attribute = tagNode.getAttribute(name);
+        int end = attribute.length() - 1;
+        final int pos = attribute.indexOf(':');
+        end = pos == -1 ? end : pos;
+        final String variabelName = attribute.substring(2, end);
+        final Object value = context.getVariable(variabelName);
+        return value != null;
+        // return attribute != null &&
+        // !context.replaceVariables(attribute).equals("");
+    }
+
+    public boolean isPropertySpecified(final String name) {
+        final String attribute = tagNode.getAttribute(name);
+        return attribute != null;
+    }
+
+    public String getOptionalProperty(final String name, final boolean ensureVariablesExists) {
+        return getOptionalProperty(name, null, ensureVariablesExists);
+    }
+
+    public String getOptionalProperty(final String name, final String defaultValue, final boolean ensureVariablesExists) {
+        final String attribute = tagNode.getAttribute(name);
+        return attribute == null ? defaultValue : context.replaceVariables(attribute);
+    }
+
+    public String getRequiredProperty(final String name, final boolean ensureVariablesExists) {
+        final String attribute = tagNode.getAttribute(name);
+        if (attribute == null) {
+            throw new RequiredPropertyException("Missing property: " + name);
+        } else if (attribute.equals("")) {
+            throw new RequiredPropertyException("Property not set: " + name);
+        } else {
+            return context.replaceVariables(attribute);
+        }
+    }
+
+    public String[] getPropertyNames(final String excluding[]) {
+        final Vector attributes = tagNode.getAttributesEx();
+        final String[] names = new String[attributes.size()];
+        int i = 0;
+        names: for (final Enumeration e = attributes.elements(); e.hasMoreElements();) {
+            final String name = ((Attribute) e.nextElement()).getName();
+            if (name == null) {
+                continue;
+            }
+            for (int j = 0; j < excluding.length; j++) {
+                if (name.equals(excluding[j])) {
+                    continue names;
+                }
+            }
+            if (tagNode.getAttribute(name) != null) {
+                names[i++] = name;
+            }
+        }
+
+        final String[] array = new String[i];
+        System.arraycopy(names, 0, array, 0, i);
+        return array;
+    }
+
+    @Override
+    public String toString() {
+        return tagNode.toHtml(); // getAttributesEx().toString();
+    }
+
+    public boolean isRequested(final String name) {
+        return isRequested(name, false);
+    }
+
+    public boolean isRequested(final String name, final boolean defaultValue) {
+        final String flag = getOptionalProperty(name, true);
+        if (flag == null) {
+            return defaultValue;
+        } else {
+            return isTrue(flag);
+        }
+    }
+
+    public static boolean isTrue(final String flag) {
+        final String value = " " + flag.toLowerCase().trim() + " ";
+        if (TRUE.indexOf(value) >= 0) {
+            return true;
+        } else if (FALSE.indexOf(value) >= 0) {
+            return false;
+        } else {
+            throw new PropertyException("Illegal flag value: " + flag);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java
new file mode 100644
index 0000000..2e42188
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java
@@ -0,0 +1,44 @@
+/*
+ *  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.action;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+
+public class PropertyException extends ScimpiException {
+
+    private static final long serialVersionUID = 1L;
+
+    public PropertyException() {
+        super();
+    }
+
+    public PropertyException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public PropertyException(final String message) {
+        super(message);
+    }
+
+    public PropertyException(final Throwable cause) {
+        super(cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java
new file mode 100644
index 0000000..20430d3
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java
@@ -0,0 +1,43 @@
+/*
+ *  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.action;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+
+public class RequiredPropertyException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+
+    public RequiredPropertyException() {
+        super();
+    }
+
+    public RequiredPropertyException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public RequiredPropertyException(final String message) {
+        super(message);
+    }
+
+    public RequiredPropertyException(final Throwable cause) {
+        super(cause);
+    }
+
+}


[20/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
deleted file mode 100644
index 183a0b2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- *  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.context;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.util.*;
-import java.util.Map.Entry;
-import com.google.common.collect.Maps;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-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;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.ErrorCollator;
-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.DebugUsers;
-
-public abstract class RequestContext {
-    private static final Logger LOG = LoggerFactory.getLogger(RequestContext.class);
-    static final String TRANSIENT_OBJECT_OID_MARKER = "~";
-
-    public enum Scope {
-        GLOBAL, SESSION, INTERACTION, REQUEST, ERROR
-    };
-
-    public enum Debug {
-        ON, OFF, PAGE
-    }
-
-    public static Scope scope(final String scopeName) {
-        final String name = scopeName.toUpperCase();
-        if (name.equals(Scope.GLOBAL.toString())) {
-            return Scope.GLOBAL;
-        } else if (name.equals(Scope.SESSION.toString())) {
-            return Scope.SESSION;
-        } else if (name.equals(Scope.INTERACTION.toString())) {
-            return Scope.INTERACTION;
-        } else if (name.equals(Scope.REQUEST.toString())) {
-            return Scope.REQUEST;
-        }
-        throw new IllegalArgumentException("Invalid scope name: " + scopeName);
-    }
-
-    public static Scope scope(final String scopeName, final Scope defaultScope) {
-        if (scopeName == null || scopeName.trim().equals("")) {
-            return defaultScope;
-        } else {
-            return scope(scopeName);
-        }
-    }
-
-    public static final String RESULT = "_result";
-    public static final String ERROR = "_error";
-    public static final String BACK_TO = "_back_to";
-    private static final Map<String, Object> globalVariables = new HashMap<String, Object>();
-    private static final Scope[] SCOPES = new Scope[] { Scope.ERROR, Scope.REQUEST, Scope.INTERACTION, Scope.SESSION, Scope.GLOBAL };
-
-    private final OidMarshaller oidMarshaller = new OidMarshaller();
-
-
-    private final ObjectMapping objectMapping;
-    private final VersionMapping versionMapping;
-    private final Map<Scope, Map<String, Object>> variables;
-    private final StringBuffer debugTrace = new StringBuffer();
-    private final DebugUsers debugUsers;
-
-    private String forwardTo;
-    private String requestedFile;
-    private String requestedParentPath;
-    private AuthenticationSession session;
-    private Debug debug;
-    private String resourceFile;
-    private String resourceParentPath;
-    private ObjectAdapter collection;
-    private boolean isUserAuthenticated;
-
-    public RequestContext(final DebugUsers debugUsers) {
-        this.debugUsers = debugUsers;
-
-        String className = IsisContext.getConfiguration().getString("scimpi.object-mapping.class", DefaultOidObjectMapping.class.getName());
-        objectMapping = InstanceUtil.createInstance(className, ObjectMapping.class);
-        className = IsisContext.getConfiguration().getString("scimpi.version-mapping.class", DefaultVersionMapping.class.getName());
-        versionMapping = InstanceUtil.createInstance(className, VersionMapping.class);
-        variables = new HashMap<Scope, Map<String, Object>>();
-
-        variables.put(Scope.GLOBAL, globalVariables);
-        variables.put(Scope.SESSION, Maps.<String, Object>newHashMap());
-        variables.put(Scope.INTERACTION, Maps.<String, Object>newHashMap());
-        variables.put(Scope.REQUEST, Maps.<String, Object>newHashMap());
-        variables.put(Scope.ERROR, Maps.<String, Object>newHashMap());
-    }
-
-    public void endHttpSession() {
-        objectMapping.endSession();
-        variables.get(Scope.SESSION).clear();
-        session = null;
-        clearSession();
-    }
-
-    // //////////////////////////////////////////////////////////////////
-    // Mapped objects
-    // //////////////////////////////////////////////////////////////////
-
-    public ObjectAdapter getMappedObject(final String oidStr) {
-        if (oidStr == null || oidStr.trim().equals("") || oidStr.trim().equals("null")) {
-            return null;
-        }
-        if (oidStr.equals("collection")) {
-            return collection;
-        }
-        final ObjectAdapter adapter = mappedObject(oidStr);
-        if (adapter == null) {
-            throw new ScimpiException("No object for " + oidStr);
-        }
-        return adapter;
-    }
-
-    public ObjectAdapter getMappedObjectOrResult(final String id) {
-        return getMappedObjectOrVariable(id, RESULT);
-    }
-
-    public ObjectAdapter getMappedObjectOrVariable(String idOrData, final String name) {
-        if (idOrData == null) {
-            idOrData = (String) getVariable(name);
-            if (idOrData == null) {
-                throw new ScimpiException("No variable for " + name);
-            }
-        }
-        if (idOrData.equals("collection")) {
-            return collection;
-        }
-        return getMappedObject(idOrData);
-    }
-
-    public String mapObject(final ObjectAdapter object, final String scopeName, final Scope defaultScope) {
-        final Scope scope = scopeName == null ? defaultScope : scope(scopeName);
-        LOG.debug("mapping " + object + " " + scope);
-        return objectMapping.mapObject(object, scope);
-    }
-
-    private ObjectAdapter mappedObject(String dataOrOid) {
-        if (dataOrOid != null && dataOrOid.equals("")) {
-            return null;
-        }
-        if (dataOrOid == null) {
-            dataOrOid = RESULT;
-        }
-
-        if (dataOrOid.startsWith(TRANSIENT_OBJECT_OID_MARKER + "{")) {
-            return objectMapping.mappedTransientObject(StringEscapeUtils.unescapeHtml(dataOrOid.substring(TRANSIENT_OBJECT_OID_MARKER.length())));
-        }
-
-        final String oidStr = dataOrOid;
-        final TypedOid typedOid = getOidMarshaller().unmarshal(oidStr, TypedOid.class);
-        if(typedOid instanceof RootOid) {
-//        final String[] idParts = dataOrOid.split("@");
-//        if (idParts.length == 2) {
-            final ObjectAdapter mappedObject = objectMapping.mappedObject(oidStr);
-            if (mappedObject != null) {
-                getPersistenceSession().resolveImmediately(mappedObject);
-            }
-            return mappedObject;
-        }
-
-        //
-        // else, handle aggregate
-        //
-        AggregatedOid aggregatedOid = (AggregatedOid) typedOid;
-        final TypedOid parentOid = aggregatedOid.getParentOid();
-
-        //final ObjectAdapter parentAdapter = objectMapping.mappedObject(idParts[0] + "@" + idParts[1]);
-        final ObjectAdapter parentAdapter = objectMapping.mappedObject(parentOid.enString(getOidMarshaller()));
-        getPersistenceSession().resolveImmediately(parentAdapter);
-
-        //ObjectSpecId objectType = null;
-        //final AggregatedOid aggregatedOid = new AggregatedOid(objectType, (TypedOid) parentAdapter.getOid(), idParts[2]);
-
-        ObjectAdapter aggregatedAdapter = null;
-        outer: for (final ObjectAssociation association : parentAdapter.getSpecification().getAssociations(Contributed.EXCLUDED)) {
-            if (association.getSpecification().isParented()) {
-                final ObjectAdapter objectAdapter = association.get(parentAdapter);
-                if (objectAdapter == null) {
-                    continue;
-                }
-                if (association.isOneToManyAssociation()) {
-                    final ObjectAdapter coll = objectAdapter;
-                    final CollectionFacet facet = coll.getSpecification().getFacet(CollectionFacet.class);
-                    for (final ObjectAdapter element : facet.iterable(coll)) {
-                        if (element.getOid().equals(aggregatedOid)) {
-                            aggregatedAdapter = element;
-                            break outer;
-                        }
-                    }
-                } else {
-                    if (objectAdapter.getOid().equals(aggregatedOid)) {
-                        aggregatedAdapter = objectAdapter;
-                        break;
-                    }
-                }
-            } else if (association.isOneToManyAssociation()) {
-                if (association.getId().equals(aggregatedOid.getLocalId())) {
-                //if (association.getId().equals(idParts[2])) {
-                    return association.get(parentAdapter);
-                }
-            }
-        }
-        return aggregatedAdapter;
-    }
-
-
-    public boolean isInternalRequest() {
-        final String referrer = getHeader("Referer"); // Note spelling mistake
-                                                      // is intentional
-        return referrer != null && referrer.contains("localhost"); // TODO need
-                                                                   // to look
-                                                                   // for actual
-                                                                   // domain
-    }
-
-    // //////////////////////////////////////////////////////////////////
-    // Version
-    // //////////////////////////////////////////////////////////////////
-
-    public String mapVersion(final ObjectAdapter object) {
-        final Version version = object.getVersion();
-        return version == null ? "" : versionMapping.mapVersion(version);
-    }
-
-    public Version getVersion(final String id) {
-        if (id.equals("")) {
-            return null;
-        }
-        return versionMapping.getVersion(id);
-    }
-
-    // ////////////////////////////
-    // Debug
-    // ////////////////////////////
-    public void append(final DebugBuilder debug) {
-        debug.startSection("Scimpi Request");
-
-        debug.appendTitle("User");
-        final AuthenticationSession session = getSession();
-        debug.appendln("Authentication Session", session);
-        if (session != null) {
-            debug.appendln("Name", session.getUserName());
-            debug.appendln("Roles", session.getRoles());
-        }
-
-        debug.appendTitle("context");
-        debug.appendln("Parent request path", requestedParentPath);
-        debug.appendln("Requested file", requestedFile);
-        debug.appendln("Parent resource path", resourceParentPath);
-        debug.appendln("Resource file", resourceFile);
-        debug.endSection();
-
-        debug.startSection("Variables");
-        append(debug, Scope.GLOBAL);
-        append(debug, Scope.SESSION);
-        append(debug, Scope.INTERACTION);
-        append(debug, Scope.REQUEST);
-        append(debug, Scope.ERROR);
-        debug.endSection();
-
-        debug.startSection("Object Mapping");
-        objectMapping.append(debug);
-        debug.endSection();
-    }
-
-    private void append(final DebugBuilder view, final Scope scope) {
-        final Map<String, Object> map = variables.get(scope);
-        final Iterator<String> keys = new TreeSet<String>(map.keySet()).iterator();
-        if (keys.hasNext()) {
-            view.appendTitle(scope + " scoped variables");
-            while (keys.hasNext()) {
-                final String key = keys.next();
-                final Object object = map.get(key);
-                final String mappedTo = "";
-                view.appendln(key, object + mappedTo);
-            }
-        }
-    }
-
-    public void append(final DebugBuilder debug, final String list) {
-        if (list.equals("variables")) {
-            appendVariables(debug, Scope.GLOBAL);
-            appendVariables(debug, Scope.SESSION);
-            appendVariables(debug, Scope.INTERACTION);
-            appendVariables(debug, Scope.REQUEST);
-            appendVariables(debug, Scope.ERROR);
-        } else if (list.equals("mappings")) {
-            objectMapping.appendMappings(debug);
-        }
-    }
-
-    private void appendVariables(final DebugBuilder debug, final Scope scope) {
-        final Map<String, Object> map = variables.get(scope);
-        final Iterator<String> names = new TreeSet(map.keySet()).iterator();
-        if (names.hasNext()) {
-            debug.startSection(scope.toString());
-            while (names.hasNext()) {
-                final String name = names.next();
-                try {
-                    final Object object = map.get(name);
-                    String details = "";
-                    if (object instanceof String) {
-                        final ObjectAdapter mappedObject = mappedObject((String) object);
-                        if (mappedObject != null) {
-                            details = mappedObject.toString();
-                        }
-                    }
-                    debug.appendln(name, object + "  " + details);
-                } catch (final Exception e) {
-                    debug.appendln(name, map.get(name));
-                }
-            }
-            debug.endSection();
-        }
-    }
-
-    public List<String> getDebugUsers() {
-        return debugUsers.getNames();
-    }
-
-    // ////////////////////////////
-    // Variables
-    // ////////////////////////////
-
-    public void clearVariables(final Scope scope) {
-        variables.get(scope).clear();
-    }
-
-    public void changeScope(final String name, final Scope newScope) {
-        for (final Scope element : SCOPES) {
-            final Map<String, Object> map = variables.get(element);
-            final Object object = map.get(name);
-            if (object != null) {
-                map.remove(name);
-                addVariable(name, object, newScope);
-                return;
-            }
-        }
-    }
-
-    public void clearVariable(String name, final Scope scope) {
-        name = name != null ? name : RESULT;
-        variables.get(scope).remove(name);
-    }
-
-    public void addVariable(final String name, final Object value, final String scope) {
-        addVariable(name, value, scope(scope));
-    }
-
-    public void addVariable(String name, final Object value, final Scope scope) {
-        name = name != null ? name : RESULT;
-        if (scope == Scope.SESSION && value != null && !(value instanceof Serializable)) {
-            throw new ScimpiException("SESSION scoped variable (" + name + ") must be serializable: " + value);
-        }
-        removeExistingVariable(name);
-        variables.get(scope).put(name, value);
-    }
-
-    private void removeExistingVariable(final String name) {
-        for (final Scope element : SCOPES) {
-            final Map<String, Object> map = variables.get(element);
-            final Object object = map.get(name);
-            if (object != null) {
-                map.remove(name);
-                break;
-            }
-        }
-    }
-
-    public String getStringVariable(final String name) {
-        final String value = (String) getVariable(name);
-        if (value == null) {
-            return null;
-        } else {
-            return replaceVariables(value);
-        }
-    }
-
-    public Object getVariable(final String name) {
-        for (final Scope element : SCOPES) {
-            final Map<String, Object> map = variables.get(element);
-            final Object object = map.get(name);
-            if (object != null) {
-                return object;
-            }
-        }
-        return null;
-    }
-
-    public String replaceVariables(String value) {
-        final int start = value.indexOf("${");
-        if (start == -1) {
-            return value;
-        } else {
-            final int end = value.indexOf('}');
-            if (end == -1) {
-                throw new PropertyException("No closing brace in " + value.substring(start));
-            } else if (end < start) {
-                throw new PropertyException("Closing brace before opening brace in " + value.substring(end));
-            }
-            final String name = value.substring(start + 2, end);
-            if (name != null) {
-                final int pos = name.indexOf(":");
-                final String variableName = pos == -1 ? name : name.substring(0, pos);
-                final String qualifier = pos == -1 ? "none" : name.substring(pos);
-                Object replacementValue;
-                final boolean embed = qualifier.indexOf("embed") > -1;
-                if (embed) {
-                    replacementValue = "${" + variableName + "}";
-                } else {
-                    replacementValue = getParameter(variableName);
-                    if (replacementValue == null) {
-                        replacementValue = getVariable(variableName);
-                    }
-                    if (replacementValue == null) {
-                        replacementValue = getBuiltIn(variableName);
-                    }
-
-                    if (replacementValue == null) {
-                        final boolean ensureExists = qualifier.indexOf("optional") == -1;
-                        if (ensureExists) {
-                            throw new PropertyException("No value for the variable " + value.substring(start, end + 1));
-                        } else {
-                            replacementValue = "";
-                        }
-                    }
-                }
-                final boolean repeat = qualifier.indexOf("repeat") > -1;
-                if (repeat) {
-                    value = value.substring(0, start) + replacementValue + value.substring(end + 1);
-                    return replaceVariables(value);
-                } else {
-                    final String remainder = replaceVariables(value.substring(end + 1));
-                    value = value.substring(0, start) + replacementValue + remainder;
-                    return value;
-                }
-
-            } else {
-                throw new PropertyException("No variable name speceified");
-            }
-        }
-    }
-
-    private Object getBuiltIn(final String name) {
-        if (name.equals("_session")) {
-            return getSessionId();
-        } else if (name.equals("_context")) {
-            return getContextPath();
-        } else if (name.equals("_this")) {
-            return resourceFile;
-        } else if (name.equals("_directory")) {
-            return resourceParentPath;
-        } else if (name.equals("_base")) {
-            return getUrlBase() + getContextPath() + resourceParentPath + resourceFile;
-            // return "http://localhost:8080" + resourceParentPath +
-            // resourceFile;
-        }
-        return null;
-    }
-
-    public String encodedInteractionParameters() {
-        final StringBuffer buffer = new StringBuffer();
-        final Map<String, Object> map = variables.get(Scope.INTERACTION);
-        final Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();
-        while (iterator.hasNext()) {
-            final Entry<String, Object> entry = iterator.next();
-            buffer.append("&amp;" + entry.getKey() + "=" + entry.getValue());
-        }
-        return buffer.toString();
-    }
-
-    public String interactionFields() {
-        final StringBuffer buffer = new StringBuffer();
-        final Map<String, Object> map = variables.get(Scope.INTERACTION);
-        final Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();
-        while (iterator.hasNext()) {
-            final Entry<String, Object> entry = iterator.next();
-            buffer.append("<input type=\"hidden\" name=\"" + entry.getKey() + "\" value=\"" + entry.getValue() + "\" />\n");
-        }
-        return buffer.toString();
-    }
-
-    protected abstract String getSessionId();
-
-    public abstract void addCookie(String name, String value, int minutesUtilExpires);
-
-    public abstract String getCookie(String name);
-
-
-
-    // /////////////////////////////////////////////////
-    // Start/end request
-    // /////////////////////////////////////////////////
-
-    public void endRequest() throws IOException {
-        getWriter().close();
-        objectMapping.clear();
-        variables.get(Scope.ERROR).clear();
-        variables.get(Scope.REQUEST).clear();
-        variables.get(Scope.INTERACTION).clear();
-    }
-
-    public void startRequest() {
-        debugTrace.setLength(0);
-        objectMapping.reloadIdentityMap();
-        final String debugParameter = getParameter("debug");
-        if (debugParameter != null) {
-            if (debugParameter.equals("off")) {
-                debug = Debug.OFF;
-            } else if (debugParameter.equals("on")) {
-                debug = Debug.ON;
-            } else if (debugParameter.equals("page")) {
-                debug = Debug.PAGE;
-            }
-        }
-    }
-
-    public abstract PrintWriter getWriter();
-
-    // /////////////////////////////
-    // Forwarding
-    // /////////////////////////////
-    public void forwardTo(final String forwardTo) {
-        this.forwardTo = "/" + forwardTo;
-    }
-
-    public String forwardTo() {
-        final String returnForwardTo = forwardTo;
-        forwardTo = null;
-        return returnForwardTo;
-    }
-
-    // /////////////////////////////
-    // Parameters
-    // /////////////////////////////
-    public void addParameter(final String name, final String parameter) {
-        if (name == null) {
-            throw new ScimpiException("Name must be specified for parameter " + parameter);
-        }
-        addVariable(name, parameter, Scope.REQUEST);
-    }
-
-    public String getParameter(final String name) {
-        final Object variable = getVariable(name);
-        if (variable instanceof String || variable == null) {
-            return (String) variable;
-        } else {
-            return variable.toString();
-        }
-    }
-
-    public Iterator<Entry<String, Object>> interactionParameters() {
-        final Map<String, Object> map = variables.get(Scope.REQUEST);
-        final Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();
-        return iterator;
-    }
-
-    // ///////////////////////////////////////
-    // Requested file
-    // ///////////////////////////////////////
-
-    /**
-     * The requested file is the file that the browser requested. This may or
-     * may not be the file that is actually processed and returned; that is the
-     * {@link #getResourceFile()}.
-     */
-    public String getRequestedFile() {
-        return requestedFile;
-    }
-
-    public void setRequestPath(final String filePath) {
-        setRequestPath(filePath, null);
-    }
-
-    public void setRequestPath(final String filePath, String defaultGenericPath) {
-        if (filePath == null) {
-            defaultGenericPath = defaultGenericPath == null ? "" : defaultGenericPath;
-            this.requestedFile = Dispatcher.GENERIC + defaultGenericPath + "." + Dispatcher.EXTENSION;
-        } else if (filePath.startsWith("_generic")) {
-            this.requestedParentPath = "/";
-            LOG.debug("generic file, requested path cleared");
-            this.requestedFile = filePath;
-            LOG.debug("requested file set = " + filePath);
-
-        } else {
-            final int lastSlash = filePath.lastIndexOf('/');
-            if (lastSlash == -1) {
-                throw new ScimpiException("No slash in request path: " + filePath);
-            }
-            final String path = filePath.substring(0, lastSlash + 1);
-            LOG.debug("requested path set = " + path);
-            this.requestedParentPath = path;
-
-            final String file = filePath.substring(lastSlash + 1);
-            LOG.debug("requested file set = " + file);
-            this.requestedFile = file;
-        }
-    }
-
-    public void clearRequestedPath() {
-        this.requestedParentPath = null;
-        this.requestedFile = null;
-    }
-
-    /**
-     * Returns the absolute file system path to the specified resource based on
-     * the path used for the current request during the call to
-     * {@link #setRequestPath(String)}. The return path can then be used to
-     * access the specified resource. If the resource has a leading slash (/)
-     * then that resource string is returned as the path.
-     */
-    public String requestedFilePath(final String resource) {
-        if (resource.startsWith("/")) {
-            return resource;
-        } else {
-            return requestedParentPath + resource;
-        }
-    }
-
-    // ///////////////////////////////////////
-    // Resource file
-    // ///////////////////////////////////////
-
-    /**
-     * The resource file is the file on disk that is processed and returned to
-     * the browser. This may or may not be the file that was actually requested
-     * by the browser; that is the {@link #getRequestedFile()}.
-     */
-    public String getResourceFile() {
-        return resourceFile;
-    }
-
-    public String getResourceParentPath() {
-        return resourceParentPath;
-    }
-
-    public void setResourcePath(final String filePath) {
-        if (filePath == null) {
-            throw new ScimpiException("Path must be specified");
-        } else {
-            final int lastSlash = filePath.lastIndexOf('/');
-            if (lastSlash == -1) {
-                throw new ScimpiException("No slash in request path: " + filePath);
-            }
-            final String path = /* getContextPath() + */filePath.substring(0, lastSlash + 1);
-            LOG.debug("resource path set = " + path);
-            this.resourceParentPath = path;
-
-            final String file = filePath.substring(lastSlash + 1);
-            LOG.debug("resource file set = " + file);
-            this.resourceFile = file;
-        }
-    }
-
-    /**
-     * Returns a uri for the specified resource based on the path used for the
-     * current request (as set up during the call to
-     * {@link #setResourcePath(String)}). Such a uri when used by the browser
-     * will allow access to the specified resource. If the resource has a
-     * leading slash (/) or the resource is for a generic page (starts with
-     * "_generic") then that resource string is returned as the path.
-     */
-    public String fullUriPath(final String resource) {
-        if (resource.startsWith("/") || resource.startsWith("_generic")) {
-            return resource;
-        } else {
-            return getContextPath() + resourceParentPath + resource;
-        }
-    }
-
-    /**
-     * Returns the absolute file system path to the specified resource based on
-     * the path used for the current request (as set up during the call to
-     * {@link #setResourcePath(String)}). The return path can then be used to
-     * access the specified resource. If the resource has a leading slash (/) or
-     * the resource is for a generic page (starts with "_generic") then that
-     * resource string is returned as the path.
-     */
-    public String fullFilePath(final String resource) {
-        if (resource.startsWith("/") || resource.startsWith("_generic")) {
-            return resource;
-        } else {
-            return resourceParentPath + resource;
-        }
-    }
-
-    // //////////////////////////////////////////////////////////////////
-    //
-    // //////////////////////////////////////////////////////////////////
-
-    public String mapObject(final ObjectAdapter object, final Scope scope) {
-        if (object.isValue()) {
-            return object.titleString();
-        } else if (scope == Scope.INTERACTION && object.isTransient()) {
-            return objectMapping.mapTransientObject(object);
-        } else if (object.getOid() != null) {
-            return objectMapping.mapObject(object, scope);
-        } else {
-            collection = object;
-            return "collection";
-        }
-    }
-
-    public void unmapObject(final ObjectAdapter object, final Scope scope) {
-        objectMapping.unmapObject(object, scope);
-    }
-
-    public abstract String findFile(String fileName);
-
-    public abstract InputStream openStream(String path);
-
-    public abstract String imagePath(ObjectAdapter object);
-
-    public abstract String imagePath(ObjectSpecification specification);
-
-    public abstract void forward(String view);
-
-    public abstract void redirectTo(String view);
-
-    public abstract String getContextPath();
-
-    public abstract String getUrlBase();
-
-    public abstract String getHeader(String name);
-
-    public abstract String getQueryString();
-
-    public abstract void startHttpSession();
-
-    public abstract String clearSession();
-
-    public abstract boolean isAborted();
-
-    public abstract String getErrorReference();
-
-    public abstract String getErrorMessage();
-
-    public abstract String getErrorDetails();
-
-    public void setSession(final AuthenticationSession session) {
-        this.session = session;
-        addVariable("_auth_session", session, Scope.SESSION);
-    }
-
-    public AuthenticationSession getSession() {
-        return session;
-    }
-
-    public abstract String getUri();
-
-    public void raiseError(final int status, final ErrorCollator errorDetails) {
-    }
-
-    public void setContentType(final String string) {
-    }
-
-    public void setSessionData(final Map<String, Object> hashMap) {
-        variables.put(Scope.SESSION, hashMap);
-        session = (AuthenticationSession) getVariable("_auth_session");
-        Boolean authenticated = (Boolean) getVariable("_authenticated");
-        isUserAuthenticated = authenticated != null && authenticated.booleanValue();
-    }
-
-    public Map<String, Object> getSessionData() {
-        return variables.get(Scope.SESSION);
-    }
-
-    public Debug getDebug() {
-        return debug;
-    }
-
-    public boolean isDebugDisabled() {
-        return !debugUsers.isDebugEnabled(getSession());
-    }
-
-    public boolean isDebug() {
-        return getDebug() == Debug.ON;
-    }
-
-    public boolean showDebugData() {
-        final Boolean variable = (Boolean) getVariable("debug-on");
-        return variable != null && variable.booleanValue();
-    }
-
-    public String getDebugTrace() {
-        return debugTrace.toString().replace('<', '[').replace('>', ']');
-    }
-
-    public void appendDebugTrace(final String line) {
-        debugTrace.append(line);
-    }
-
-    public void clearTransientVariables() {
-        objectMapping.endSession();
-    }
-
-    public void reset() {
-    }
-
-    public boolean isUserAuthenticated() {
-        return isUserAuthenticated;
-    }
-
-    public void setUserAuthenticated(boolean isUserAuthenticated) {
-        this.isUserAuthenticated = isUserAuthenticated;
-        addVariable("_authenticated", isUserAuthenticated, Scope.SESSION);
-    }
-
-
-    protected PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    protected OidMarshaller getOidMarshaller() {
-        return oidMarshaller;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java
deleted file mode 100644
index 0ce8645..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  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.context;
-
-import org.apache.isis.core.metamodel.adapter.version.Version;
-
-public interface VersionMapping {
-
-    String mapVersion(Version version);
-
-    Version getVersion(String id);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
deleted file mode 100644
index 8e5822d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- *  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.debug;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-
-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;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.util.Dump;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.Action;
-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;
-
-public class DebugAction implements Action {
-    private final Dispatcher dispatcher;
-
-    public DebugAction(final Dispatcher dispatcher) {
-        this.dispatcher = dispatcher;
-    }
-
-    @Override
-    public String getName() {
-        return "debug";
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        if (context.isDebugDisabled()) {
-            throw new ForbiddenException("Can't access debug action when debug is disabled");
-        }
-
-        final String action = context.getParameter("action");
-        if ("list-i18n".equals(action)) {
-            i18n(context, null);
-        } else if ("list-authorization".equals(action)) {
-            authorization(context, null);
-        } else if (context.getParameter("mode") != null) {
-            final boolean isDebugOn = context.getParameter("mode").equals("debug");
-            context.addVariable("debug-on", isDebugOn, Scope.SESSION);
-            // TODO need to use configuration to find path
-            context.setRequestPath("/debug/debug.shtml");
-        } else {
-
-            // TODO remove - replaced by Debug tag
-            final DebugHtmlWriter view = new DebugHtmlWriter(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>");
-            view.appendln(" | <a href=\"debug.app?action=list-i18n\">I18N File</a>");
-            view.appendln(" | <a href=\"debug.app?action=list-authorization\">Authorization File</a>");
-            view.appendln(" | <a href=\"debug.app?action=context\">Context</a>");
-            view.appendln(" | <a href=\"debug.app?action=dispatcher\">Dispatcher</a>");
-            view.appendln("</div>");
-
-            if ("specifications".equals(action)) {
-                listSpecifications(view);
-            } else if ("specification".equals(action)) {
-                // specification(context, view);
-            } else if ("object".equals(action)) {
-                object(context, view);
-            } else if ("system".equals(action)) {
-                system(context, view);
-            } else if ("context".equals(action)) {
-                context.append(view);
-            } else if ("dispatcher".equals(action)) {
-                dispatcher.debug(view);
-            }
-
-            context.clearRequestedPath();
-        }
-    }
-
-    private void object(final RequestContext context, final DebugHtmlWriter view) {
-        final ObjectAdapter object = context.getMappedObjectOrResult(context.getParameter("object"));
-        final DebugString str = new DebugString();
-        Dump.adapter(object, str);
-        Dump.graph(object, IsisContext.getAuthenticationSession(), str);
-        view.appendTitle(object.getSpecification().getFullIdentifier());
-        view.appendln("<pre class=\"debug\">" + str + "</pre>");
-    }
-
-    private void system(final RequestContext context, final DebugHtmlWriter view) {
-        final DebuggableWithTitle[] debug = IsisContext.debugSystem();
-        view.appendTitle("System");
-        for (final DebuggableWithTitle element2 : debug) {
-            final DebugString str = new DebugString();
-            element2.debugData(str);
-            view.appendTitle(element2.debugTitle());
-            view.appendln("<pre class=\"debug\">" + str + "</pre>");
-        }
-    }
-
-    private void i18n(final RequestContext context, final DebugHtmlWriter view) {
-        final Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
-        final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications);
-        Collections.sort(specs, new Comparator<ObjectSpecification>() {
-            @Override
-            public int compare(final ObjectSpecification o1, final ObjectSpecification o2) {
-                return o1.getShortIdentifier().compareTo(o2.getShortIdentifier());
-            }
-        });
-        final Function<ObjectSpecification, String> className = ObjectSpecification.FUNCTION_FULLY_QUALIFIED_CLASS_NAME;
-        final List<String> fullIdentifierList = Lists.newArrayList(Collections2.transform(specs, className));
-        for (final String fullIdentifier : fullIdentifierList) {
-            final ObjectSpecification spec = getSpecificationLoader().loadSpecification(fullIdentifier);
-            if (spec.getAssociations(Contributed.EXCLUDED).size() == 0 && spec.getObjectActions(Contributed.EXCLUDED).size() == 0) {
-                continue;
-            }
-            final String name = spec.getIdentifier().toClassIdentityString();
-            context.getWriter().append("# " + spec.getShortIdentifier() + "\n");
-            for (final ObjectAssociation assoc : spec.getAssociations(Contributed.EXCLUDED)) {
-                context.getWriter().append("#" + name + ".property." + assoc.getId() + ".name" + "=\n");
-                context.getWriter().append("#" + name + ".property." + assoc.getId() + ".description" + "=\n");
-                context.getWriter().append("#" + name + ".property." + assoc.getId() + ".help" + "=\n");
-            }
-            for (final ObjectAction action : spec.getObjectActions(Contributed.EXCLUDED)) {
-                context.getWriter().append("#" + name + ".action." + action.getId() + ".name" + "=\n");
-                context.getWriter().append("#" + name + ".action." + action.getId() + ".description" + "=\n");
-                context.getWriter().append("#" + name + ".action." + action.getId() + ".help" + "=\n");
-            }
-            context.getWriter().append("\n");
-        }
-    }
-
-    private void authorization(final RequestContext context, final DebugHtmlWriter view) {
-        final Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
-        final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications);
-        Collections.sort(specs, new Comparator<ObjectSpecification>() {
-            @Override
-            public int compare(final ObjectSpecification o1, final ObjectSpecification o2) {
-                return o1.getShortIdentifier().compareTo(o2.getShortIdentifier());
-            }
-        });
-        final Function<ObjectSpecification, String> className = ObjectSpecification.FUNCTION_FULLY_QUALIFIED_CLASS_NAME;
-        final List<String> fullIdentifierList = Lists.newArrayList(Collections2.transform(specs, className));
-        
-        for (final String fullIdentifier : fullIdentifierList) {
-            final ObjectSpecification spec = getSpecificationLoader().loadSpecification(fullIdentifier);
-            if (spec.getAssociations(Contributed.EXCLUDED).size() == 0 && spec.getObjectActions(Contributed.EXCLUDED).size() == 0) {
-                continue;
-            }
-            final String name = spec.getIdentifier().toClassIdentityString();
-            boolean isAbstract = spec.isAbstract();
-            context.getWriter().append("### " + spec.getShortIdentifier() + (isAbstract ? " (abstract)" : "") + " ###\n");
-            context.getWriter().append((isAbstract ? "#" : "") + name + ":roles\n\n");
-        }
-        context.getWriter().append("\n\n");
-        
-        for (final String fullIdentifier : fullIdentifierList) {
-            final ObjectSpecification spec = getSpecificationLoader().loadSpecification(fullIdentifier);
-            if (spec.getAssociations(Contributed.EXCLUDED).size() == 0 && spec.getObjectActions(Contributed.EXCLUDED).size() == 0) {
-                continue;
-            }
-            final String name = spec.getIdentifier().toClassIdentityString();
-            boolean isAbstract = spec.isAbstract();
-            context.getWriter().append("### " + spec.getShortIdentifier() + (isAbstract ? " (abstract)" : "") + " ###\n");
-            context.getWriter().append((isAbstract ? "#" : "") + name + ":roles\n");
-            for (final ObjectAssociation assoc : spec.getAssociations(Contributed.EXCLUDED)) {
-                context.getWriter().append("#" + name + "#" + assoc.getId() + ":roles\n");
-                // context.getWriter().append("#" + name + ".property." +
-                // assoc.getId() + ".description" + "=\n");
-                // context.getWriter().append("#" + name + ".property." +
-                // assoc.getId() + ".help" + "=\n");
-            }
-            for (final ObjectAction action : spec.getObjectActions(Contributed.EXCLUDED)) {
-                context.getWriter().append("#" + name + "#" + action.getId() + "():roles\n");
-                // context.getWriter().append("#" + name + ".action." +
-                // action.getId() + ".description" + "=\n");
-                // context.getWriter().append("#" + name + ".action." +
-                // action.getId() + ".help" + "=\n");
-            }
-            context.getWriter().append("\n");
-        }
-    }
-
-    private void listSpecifications(final DebugHtmlWriter view) {
-        final List<ObjectSpecification> fullIdentifierList = new ArrayList<ObjectSpecification>(getSpecificationLoader().allSpecifications());
-        Collections.sort(fullIdentifierList, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
-        view.appendTitle("Specifications");
-        for (final ObjectSpecification spec : fullIdentifierList) {
-            final String name = spec.getSingularName();
-            view.appendln(name, "");
-            // view.appendln(name, specificationLink(spec));
-        }
-
-        /*
-         * new Comparator<ObjectSpecification>() { public int
-         * compare(ObjectSpecification o1, ObjectSpecification o2) { return
-         * o1.getSingularName().compareTo(o2.getSingularName()); }});
-         * 
-         * /* Collection<ObjectSpecification> allSpecifications =
-         * getSpecificationLoader().allSpecifications(); Collection<String> list
-         * = Collections2.transform(allSpecifications,
-         * ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE); final
-         * List<String> fullIdentifierList = Lists.newArrayList(list); /*
-         * Collections.sort(fullIdentifierList, new
-         * Comparator<ObjectSpecification>() { public int
-         * compare(ObjectSpecification o1, ObjectSpecification o2) { return
-         * o1.getSingularName().compareTo(o2.getSingularName()); }});
-         */
-        /*
-         * view.divider("Specifications"); for (String fullIdentifier :
-         * fullIdentifierList) { ObjectSpecification spec =
-         * getSpecificationLoader().loadSpecification(fullIdentifier); String
-         * name = spec.getSingularName(); view.appendRow(name,
-         * specificationLink(spec)); }
-         */
-    }
-
-    protected SpecificationLoaderSpi getSpecificationLoader() {
-        return IsisContext.getSpecificationLoader();
-    }
-
-    @Override
-    public void init() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java
deleted file mode 100644
index 112bc77..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  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.debug;
-
-import java.io.PrintWriter;
-
-import org.apache.isis.core.commons.debug.DebugHtmlStringAbstract;
-
-public class DebugHtmlWriter extends DebugHtmlStringAbstract {
-
-    private final PrintWriter writer;
-
-    public DebugHtmlWriter(final PrintWriter writer, final boolean createPage) {
-        super(createPage);
-        this.writer = writer;
-        header();
-    }
-
-    @Override
-    protected void appendHtml(final String html) {
-        writer.println(html);
-    }
-
-    @Override
-    protected void doClose() {
-        footer();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java
deleted file mode 100644
index 461ce84..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  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.debug;
-
-import java.io.IOException;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.Action;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-
-public class DebugUserAction implements Action {
-
-    private final DebugUsers debugUsers;
-
-    public DebugUserAction(final DebugUsers debugUsers) {
-        this.debugUsers = debugUsers;
-    }
-
-    @Override
-    public String getName() {
-        return "debug-user";
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        if (context.isDebugDisabled()) {
-            throw new ForbiddenException("Can't access debug action when debug is disabled");
-        }
-
-        final String method = context.getParameter(METHOD);
-        final String name = context.getParameter(NAME);
-        final String view = context.getParameter(VIEW);
-
-        if (method != null && method.equals("add")) {
-            debugUsers.add(name);
-        } else if (method != null && method.equals("remove")) {
-            debugUsers.remove(name);
-        } else {
-            throw new ScimpiException("Invalid debug-user action");
-        }
-
-        context.setRequestPath(view);
-    }
-
-    @Override
-    public void init() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java
deleted file mode 100644
index 20497cc..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  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.debug;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-
-public class DebugUsers {
-
-    private static Logger LOG = LoggerFactory.getLogger(DebugUsers.class);
-
-    private enum DebugMode {
-        OFF, ON, NAMED, SYSADMIN_ONLY
-    }
-
-    private static List<String> debugUsers = new ArrayList<String>();
-    private static DebugMode debugMode;
-
-    public void initialize() {
-        if (debugMode != null) {
-            throw new ScimpiException("Debug mode is already set up!");
-        }
-
-        final String debugUserEntry = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.debug.users", "");
-        final String[] users = debugUserEntry.split("\\|");
-        for (final String name : users) {
-            debugUsers.add(name.trim());
-        }
-
-        final String debugModeEntry = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.debug.mode");
-        if (debugModeEntry != null) {
-            try {
-                debugMode = DebugMode.valueOf(debugModeEntry.toUpperCase());
-                LOG.info("Debug mode set to " + debugMode);
-            } catch (final IllegalArgumentException e) {
-                LOG.error("Invalid debug mode - " + debugModeEntry + " - mode set to OFF");
-                debugMode = DebugMode.OFF;
-            }
-        } else {
-            debugMode = DebugMode.OFF;
-        }
-    }
-
-    public boolean isDebugEnabled(final AuthenticationSession session) {
-        if (debugMode == DebugMode.ON) {
-            return true;
-        } else if (session != null && debugMode == DebugMode.SYSADMIN_ONLY && session.getRoles().contains("sysadmin")) {
-            return true;
-        } else if (session != null && debugMode == DebugMode.NAMED && (debugUsers.contains(session.getUserName()) || session.getRoles().contains("sysadmin"))) {
-            return true;
-        }
-        return false;
-    }
-
-    public List<String> getNames() {
-        final ArrayList<String> users = new ArrayList<String>(debugUsers);
-        Collections.sort(users);
-        return users;
-    }
-
-    public void add(final String name) {
-        if (!debugUsers.contains(name)) {
-            debugUsers.add(name);
-            LOG.info("Added '" + debugMode + "' to debug users list");
-        }
-    }
-
-    public void remove(final String name) {
-        debugUsers.remove(name);
-        LOG.info("Removed '" + debugMode + "' from debug users list");
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java
deleted file mode 100644
index 360c48a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  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.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class DebugUsersView extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "debug-users";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String view = request.getContext().getContextPath() + request.getContext().getResourceParentPath() + request.getContext().getResourceFile();
-
-        request.appendHtml("<form class=\"generic action\" action=\"debug-user.app\" method=\"post\" accept-charset=\"ISO-8859-1\">\n");
-        request.appendHtml("<div class=\"title\">Add Debug User</div>\n");
-        request.appendHtml("<div class=\"field\"><label>User Name:</label><input type=\"text\" name=\"name\" size=\"30\" /></div>\n");
-        request.appendHtml("<input type=\"hidden\" name=\"method\" value=\"add\" />\n");
-        request.appendHtml("<input type=\"hidden\" name=\"view\" value=\"" + view + "\" />\n");
-        request.appendHtml("<input class=\"button\" type=\"submit\" value=\"Add User\" />\n");
-        request.appendHtml("</form>\n");
-
-        request.appendHtml("<table class=\"debug\">\n<tr><th class=\"title\">Name</th><th class=\"title\"></th></tr>\n");
-        for (final String name : request.getContext().getDebugUsers()) {
-            request.appendHtml("<tr><th>" + name + "</th><th><a href=\"debug-user.app?method=remove&name=" + name + "&view=" + view + " \">remove</a></th></tr>\n");
-        }
-        request.appendHtml("</table>\n");
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java
deleted file mode 100644
index 3049b26..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  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.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-
-public class ErrorDetails extends AbstractElementProcessor {
-
-    public String getName() {
-        return "error-details";
-    }
-
-    public void process(final Request request) {
-        request.appendHtml(request.getContext().getErrorDetails());
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java
deleted file mode 100644
index 07538ce..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  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.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-
-public class ErrorMessage extends AbstractElementProcessor {
-
-    public String getName() {
-        return "error-message";
-    }
-
-    public void process(final Request request) {
-        request.appendAsHtmlEncoded(request.getContext().getErrorMessage());
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java
deleted file mode 100644
index 75700cc..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  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.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-
-public class ErrorReference extends AbstractElementProcessor {
-
-    public String getName() {
-        return "error-reference";
-    }
-
-    public void process(final Request request) {
-        request.appendAsHtmlEncoded(request.getContext().getErrorReference());
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java
deleted file mode 100644
index 6c30c19..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  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.debug;
-
-import java.io.IOException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.Action;
-import org.apache.isis.viewer.scimpi.dispatcher.NotLoggedInException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-
-public class LogAction implements Action {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LogAction.class);
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-
-        final AuthenticationSession session = context.getSession();
-        if (session == null) {
-            throw new NotLoggedInException();
-        }
-
-        final String levelName = (String) context.getVariable("level");
-
-        final org.apache.log4j.Level level = org.apache.log4j.Level.toLevel(levelName);
-        boolean changeLogged = false;
-        if (org.apache.log4j.Level.INFO.isGreaterOrEqual(org.apache.log4j.LogManager.getRootLogger().getLevel())) {
-            LOG.info("log level changed to " + level);
-            changeLogged = true;
-        }
-        org.apache.log4j.LogManager.getRootLogger().setLevel(level);
-        if (!changeLogged) {
-            LOG.info("log level changed to " + level);
-        }
-        final String view = (String) context.getVariable("view");
-        context.setRequestPath(view);
-
-    }
-
-    @Override
-    public String getName() {
-        return "log";
-    }
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
deleted file mode 100644
index 852ccea..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- *  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.edit;
-
-import java.io.IOException;
-import java.util.List;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-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;
-import org.apache.isis.core.metamodel.consent.Veto;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-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;
-
-public class EditAction implements Action {
-    public static final String ACTION = "edit";
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public String getName() {
-        return ACTION;
-    }
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        AuthenticationSession session = context.getSession();
-        if (session == null) {
-            session = new AnonymousSession();
-        }
-
-        try {
-            final String objectId = context.getParameter("_" + OBJECT);
-            final String version = context.getParameter("_" + VERSION);
-            final String formId = context.getParameter("_" + FORM_ID);
-            String resultName = context.getParameter("_" + RESULT_NAME);
-            resultName = resultName == null ? RequestContext.RESULT : resultName;
-            final String override = context.getParameter("_" + RESULT_OVERRIDE);
-            String message = context.getParameter("_" + MESSAGE);
-
-            final ObjectAdapter adapter = context.getMappedObject(objectId);
-
-            final List<ObjectAssociation> fields = adapter.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where));
-
-            for (final ObjectAssociation objectAssociation : fields) {
-                if (objectAssociation.isVisible(session, adapter, where).isVetoed()) {
-                    throw new NotLoggedInException();
-                }
-            }
-
-            final FormState entryState = validateObject(context, adapter, fields);
-            final Version adapterVersion = adapter.getVersion();
-            final Version formVersion = context.getVersion(version);
-            if (formVersion != null && adapterVersion.different(formVersion)) {
-
-                IsisContext.getMessageBroker().addMessage("The " + adapter.getSpecification().getSingularName() + " was edited " + "by another user (" + adapterVersion.getUser() + "). Please  make your changes based on their changes.");
-
-                final String view = context.getParameter("_" + ERROR);
-                context.setRequestPath(view, Dispatcher.EDIT);
-
-                entryState.setForm(formId);
-                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
-                context.addVariable(resultName, objectId, Scope.REQUEST);
-                if (override != null) {
-                    context.addVariable(resultName, override, Scope.REQUEST);
-                }
-
-            } else if (entryState.isValid()) {
-                changeObject(context, adapter, entryState, fields);
-
-                if (adapter.isTransient()) {
-                    IsisContext.getPersistenceSession().makePersistent(adapter);
-                    context.unmapObject(adapter, Scope.REQUEST);
-                }
-
-                String view = context.getParameter("_" + VIEW);
-
-                final String id = context.mapObject(adapter, Scope.REQUEST);
-                context.addVariable(resultName, id, Scope.REQUEST);
-                if (override != null) {
-                    context.addVariable(resultName, override, Scope.REQUEST);
-                }
-
-                final int questionMark = view == null ? -1 : view.indexOf("?");
-                if (questionMark > -1) {
-                    final String params = view.substring(questionMark + 1);
-                    final int equals = params.indexOf("=");
-                    context.addVariable(params.substring(0, equals), params.substring(equals + 1), Scope.REQUEST);
-                    view = view.substring(0, questionMark);
-                }
-                context.setRequestPath(view);
-                if (message == null) {
-                    message = "Saved changes to " + adapter.getSpecification().getSingularName();
-                } else if (message.equals("")) {
-                    message = null;
-                }
-                if (message != null) {
-                    final MessageBroker messageBroker = IsisContext.getMessageBroker();
-                    messageBroker.addMessage(message);
-                }
-
-            } else {
-                final String view = context.getParameter("_" + ERROR);
-                context.setRequestPath(view, Dispatcher.EDIT);
-
-                entryState.setForm(formId);
-                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
-                context.addVariable(resultName, objectId, Scope.REQUEST);
-                if (override != null) {
-                    context.addVariable(resultName, override, Scope.REQUEST);
-                }
-
-                final MessageBroker messageBroker = IsisContext.getMessageBroker();
-                messageBroker.addWarning(entryState.getError());
-            }
-
-        } catch (final RuntimeException e) {
-            IsisContext.getMessageBroker().getMessages();
-            IsisContext.getMessageBroker().getWarnings();
-            throw e;
-        }
-    }
-
-    private FormState validateObject(final RequestContext context, final ObjectAdapter object, final List<ObjectAssociation> fields) {
-        final FormState formState = new FormState();
-        for (int i = 0; i < fields.size(); i++) {
-            final ObjectAssociation field = fields.get(i);
-            final String fieldId = field.getId();
-            String newEntry = context.getParameter(fieldId);
-            if (fields.get(i).isOneToManyAssociation()) {
-                continue;
-            }
-            if (fields.get(i).isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-                continue;
-            }
-            if (field.isUsable(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-                continue;
-            }
-
-            if (newEntry != null && newEntry.equals("-OTHER-")) {
-                newEntry = context.getParameter(fieldId + "-other");
-            }
-
-            if (newEntry == null) {
-                // TODO duplicated in EditObject; line 97
-                final ObjectSpecification spec = field.getSpecification();
-                if (spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(boolean.class)) || spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(Boolean.class))) {
-                    newEntry = FALSE;
-                } else {
-                    continue;
-                }
-            }
-            final FieldEditState fieldState = formState.createField(fieldId, newEntry);
-
-            Consent consent = null;
-            if (field.isMandatory() && (newEntry.equals("") || newEntry.equals("NULL"))) {
-                consent = new Veto(field.getName() + " required");
-                formState.setError("Not all fields have been set");
-            } else if (field.getSpecification().containsFacet(ParseableFacet.class)) {
-                try {
-                    final ParseableFacet facet = field.getSpecification().getFacet(ParseableFacet.class);
-                    final ObjectAdapter originalValue = field.get(object);
-                    Localization localization = IsisContext.getLocalization(); 
-                    final ObjectAdapter newValue = facet.parseTextEntry(originalValue, newEntry, localization); 
-                    consent = ((OneToOneAssociation) field).isAssociationValid(object, newValue);
-                    fieldState.setValue(newValue);
-                } catch (final TextEntryParseException e) {
-                    consent = new Veto(e.getMessage());
-                    // formState.setError("Not all fields have been entered correctly");
-                }
-
-            } else {
-                final ObjectAdapter associate = newEntry.equals("null") ? null : context.getMappedObject(newEntry);
-                if (associate != null) {
-                    IsisContext.getPersistenceSession().resolveImmediately(associate);
-                }
-                consent = ((OneToOneAssociation) field).isAssociationValid(object, associate);
-                fieldState.setValue(associate);
-
-            }
-            if (consent.isVetoed()) {
-                fieldState.setError(consent.getReason());
-                formState.setError("Not all fields have been entered correctly");
-            }
-        }
-
-        // TODO check the state of the complete object.
-        return formState;
-    }
-
-    private void changeObject(final RequestContext context, final ObjectAdapter object, final FormState editState, final List<ObjectAssociation> fields) {
-        for (int i = 0; i < fields.size(); i++) {
-            final FieldEditState field = editState.getField(fields.get(i).getId());
-            if (field == null) {
-                continue;
-            }
-            final String newEntry = field.getEntry();
-            final ObjectAdapter originalValue = fields.get(i).get(object);
-            final boolean isVisible = fields.get(i).isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed();
-            final boolean isUsable = fields.get(i).isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
-            final boolean bothEmpty = originalValue == null && newEntry.equals("");
-            final boolean bothSame = newEntry.equals(originalValue == null ? "" : originalValue.titleString());
-            if ((!isVisible || !isUsable) || bothEmpty || bothSame) {
-                if (fields.get(i).getSpecification().getFacet(ParseableFacet.class) == null) {
-                    // REVIEW restores object to loader
-                    context.getMappedObject(newEntry);
-                }
-                continue;
-            }
-
-            if (fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
-                final ParseableFacet facet = fields.get(i).getSpecification().getFacet(ParseableFacet.class);
-                Localization localization = IsisContext.getLocalization(); 
-                final ObjectAdapter newValue = facet.parseTextEntry(originalValue, newEntry, localization);
-                ((OneToOneAssociation) fields.get(i)).set(object, newValue);
-            } else {
-                ((OneToOneAssociation) fields.get(i)).set(object, field.getValue());
-            }
-        }
-    }
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java
deleted file mode 100644
index 70e6789..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  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.edit;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public class FieldEditState {
-    private final String entry;
-    private String reason;
-    private ObjectAdapter value;
-
-    public FieldEditState(final String entry) {
-        this.entry = entry;
-    }
-
-    public void setError(final String reason) {
-        this.reason = reason;
-    }
-
-    public boolean isEntryValid() {
-        return reason == null;
-    }
-
-    public String getEntry() {
-        return entry;
-    }
-
-    public String getError() {
-        return reason;
-    }
-
-    public ObjectAdapter getValue() {
-        return value;
-    }
-
-    public void setValue(final ObjectAdapter value) {
-        this.value = value;
-    }
-
-}


[22/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
ISIS-720: mothballing scimpi


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2c7cfbfe
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2c7cfbfe
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2c7cfbfe

Branch: refs/heads/master
Commit: 2c7cfbfecb1d58f4a05ecd6814064baa1ebb20b4
Parents: afc5cad
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sat Mar 28 13:06:13 2015 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Mar 30 13:43:58 2015 +0100

----------------------------------------------------------------------
 component/viewer/scimpi/NOTICE                  |   7 -
 component/viewer/scimpi/dispatcher/pom.xml      |  92 --
 .../dispatcher/AbstractElementProcessor.java    |  55 --
 .../dispatcher/AbstractObjectProcessor.java     |  53 --
 .../isis/viewer/scimpi/dispatcher/Action.java   |  37 -
 .../viewer/scimpi/dispatcher/BlockContent.java  |  23 -
 .../scimpi/dispatcher/DispatchException.java    |  40 -
 .../viewer/scimpi/dispatcher/Dispatcher.java    | 484 -----------
 .../dispatcher/ElementContentProcessor.java     |  24 -
 .../scimpi/dispatcher/ElementProcessor.java     |  30 -
 .../viewer/scimpi/dispatcher/ErrorCollator.java | 148 ----
 .../scimpi/dispatcher/ForbiddenException.java   |  68 --
 .../isis/viewer/scimpi/dispatcher/Names.java    |  91 --
 .../scimpi/dispatcher/NotLoggedInException.java |  31 -
 .../scimpi/dispatcher/ResolveFieldUtil.java     |  71 --
 .../scimpi/dispatcher/ScimpiException.java      |  44 -
 .../dispatcher/ScimpiNotFoundException.java     |  41 -
 .../scimpi/dispatcher/TagOrderException.java    |  31 -
 .../viewer/scimpi/dispatcher/UserManager.java   |  91 --
 .../isis/viewer/scimpi/dispatcher/Util.java     | 105 ---
 .../scimpi/dispatcher/action/ActionAction.java  | 268 ------
 .../scimpi/dispatcher/action/Attributes.java    | 131 ---
 .../dispatcher/action/PropertyException.java    |  44 -
 .../action/RequiredPropertyException.java       |  43 -
 .../context/DefaultOidObjectMapping.java        | 511 -----------
 .../context/DefaultVersionMapping.java          |  40 -
 .../context/IndirectObjectMapping.java          | 204 -----
 .../scimpi/dispatcher/context/Mapping.java      | 205 -----
 .../dispatcher/context/ObjectMapping.java       |  42 -
 .../dispatcher/context/RequestContext.java      | 857 -------------------
 .../dispatcher/context/VersionMapping.java      |  30 -
 .../scimpi/dispatcher/debug/DebugAction.java    | 257 ------
 .../dispatcher/debug/DebugHtmlWriter.java       |  45 -
 .../dispatcher/debug/DebugUserAction.java       |  71 --
 .../scimpi/dispatcher/debug/DebugUsers.java     |  98 ---
 .../scimpi/dispatcher/debug/DebugUsersView.java |  50 --
 .../scimpi/dispatcher/debug/ErrorDetails.java   |  35 -
 .../scimpi/dispatcher/debug/ErrorMessage.java   |  35 -
 .../scimpi/dispatcher/debug/ErrorReference.java |  35 -
 .../scimpi/dispatcher/debug/LogAction.java      |  75 --
 .../scimpi/dispatcher/edit/EditAction.java      | 266 ------
 .../scimpi/dispatcher/edit/FieldEditState.java  |  57 --
 .../scimpi/dispatcher/edit/FormState.java       |  67 --
 .../scimpi/dispatcher/edit/RemoveAction.java    | 114 ---
 .../scimpi/dispatcher/logon/DomainSession.java  |  42 -
 .../scimpi/dispatcher/logon/LogonAction.java    | 175 ----
 .../scimpi/dispatcher/logon/LogoutAction.java   |  70 --
 .../scimpi/dispatcher/processor/Encoder.java    |  26 -
 .../dispatcher/processor/HtmlFileParser.java    | 205 -----
 .../scimpi/dispatcher/processor/PageWriter.java |  28 -
 .../dispatcher/processor/ProcessorLookup.java   | 256 ------
 .../scimpi/dispatcher/processor/Request.java    | 324 -------
 .../dispatcher/processor/SimpleEncoder.java     |  32 -
 .../processor/TagProcessingException.java       |  59 --
 .../scimpi/dispatcher/util/MethodsUtils.java    | 154 ----
 .../viewer/scimpi/dispatcher/view/HelpLink.java |  72 --
 .../viewer/scimpi/dispatcher/view/History.java  | 150 ----
 .../scimpi/dispatcher/view/HtmlSnippet.java     |  51 --
 .../viewer/scimpi/dispatcher/view/Snippet.java  |  27 -
 .../viewer/scimpi/dispatcher/view/SwfTag.java   |  90 --
 .../scimpi/dispatcher/view/VersionNumber.java   |  70 --
 .../dispatcher/view/action/ActionButton.java    | 237 -----
 .../dispatcher/view/action/ActionContent.java   |  77 --
 .../dispatcher/view/action/ActionForm.java      | 262 ------
 .../dispatcher/view/action/ActionLink.java      | 179 ----
 .../view/action/CreateFormParameter.java        |  43 -
 .../scimpi/dispatcher/view/action/Methods.java  | 192 -----
 .../dispatcher/view/action/Parameter.java       |  47 -
 .../dispatcher/view/action/RunAction.java       |  87 --
 .../scimpi/dispatcher/view/action/Services.java |  67 --
 .../dispatcher/view/collection/Collection.java  |  93 --
 .../scimpi/dispatcher/view/debug/Debug.java     | 479 -----------
 .../dispatcher/view/debug/DebugAccessCheck.java |  40 -
 .../view/debug/DebugCollectionView.java         | 110 ---
 .../dispatcher/view/debug/DebugObjectView.java  | 136 ---
 .../dispatcher/view/debug/DebuggerLink.java     |  53 --
 .../dispatcher/view/debug/Diagnostics.java      |  81 --
 .../scimpi/dispatcher/view/debug/Log.java       |  46 -
 .../scimpi/dispatcher/view/debug/LogLevel.java  |  55 --
 .../scimpi/dispatcher/view/debug/Members.java   | 109 ---
 .../scimpi/dispatcher/view/debug/ShowDebug.java |  41 -
 .../dispatcher/view/debug/Specification.java    | 119 ---
 .../dispatcher/view/debug/ThrowException.java   |  43 -
 .../view/display/AbstractFormView.java          | 142 ---
 .../view/display/AbstractTableView.java         | 149 ----
 .../dispatcher/view/display/AddMessage.java     |  44 -
 .../dispatcher/view/display/AddWarning.java     |  44 -
 .../scimpi/dispatcher/view/display/Errors.java  |  65 --
 .../dispatcher/view/display/Feedback.java       |  46 -
 .../dispatcher/view/display/FieldLabel.java     |  77 --
 .../dispatcher/view/display/FieldValue.java     | 118 ---
 .../dispatcher/view/display/GetField.java       | 103 ---
 .../dispatcher/view/display/IncludeObject.java  | 107 ---
 .../dispatcher/view/display/ListView.java       |  94 --
 .../dispatcher/view/display/LongFormView.java   |  84 --
 .../dispatcher/view/display/Messages.java       |  59 --
 .../dispatcher/view/display/SelectedObject.java |  55 --
 .../dispatcher/view/display/ShortFormView.java  |  36 -
 .../dispatcher/view/display/TableBlock.java     |  86 --
 .../dispatcher/view/display/TableBuilder.java   |  92 --
 .../dispatcher/view/display/TableCell.java      |  94 --
 .../view/display/TableContentWriter.java        |  39 -
 .../dispatcher/view/display/TableEmpty.java     |  53 --
 .../dispatcher/view/display/TableHeader.java    |  39 -
 .../dispatcher/view/display/TableRow.java       |  49 --
 .../dispatcher/view/display/TableView.java      | 329 -------
 .../scimpi/dispatcher/view/display/Title.java   |  68 --
 .../dispatcher/view/display/Warnings.java       |  58 --
 .../scimpi/dispatcher/view/edit/EditObject.java | 319 -------
 .../dispatcher/view/edit/FieldFactory.java      | 105 ---
 .../scimpi/dispatcher/view/edit/FormEntry.java  |  44 -
 .../scimpi/dispatcher/view/edit/FormField.java  |  44 -
 .../dispatcher/view/edit/FormFieldBlock.java    |  68 --
 .../dispatcher/view/edit/HiddenField.java       |  48 --
 .../dispatcher/view/edit/RadioListField.java    |  70 --
 .../scimpi/dispatcher/view/edit/Selector.java   | 158 ----
 .../dispatcher/view/field/ExcludeField.java     |  39 -
 .../dispatcher/view/field/IncludeField.java     |  39 -
 .../dispatcher/view/field/InclusionList.java    |  89 --
 .../scimpi/dispatcher/view/field/LinkField.java |  45 -
 .../view/field/LinkedFieldsBlock.java           |  47 -
 .../dispatcher/view/field/LinkedObject.java     |  58 --
 .../dispatcher/view/form/HiddenInputField.java  |  41 -
 .../dispatcher/view/form/HtmlFormBuilder.java   | 214 -----
 .../scimpi/dispatcher/view/form/InputField.java | 224 -----
 .../scimpi/dispatcher/view/logon/Logoff.java    |  38 -
 .../scimpi/dispatcher/view/logon/Logon.java     | 126 ---
 .../dispatcher/view/logon/RestrictAccess.java   |  41 -
 .../scimpi/dispatcher/view/logon/Secure.java    |  45 -
 .../scimpi/dispatcher/view/logon/User.java      |  77 --
 .../view/simple/AbstractConditionalBlock.java   | 565 ------------
 .../dispatcher/view/simple/AbstractLink.java    | 121 ---
 .../dispatcher/view/simple/BlockDefine.java     |  42 -
 .../scimpi/dispatcher/view/simple/BlockUse.java |  46 -
 .../scimpi/dispatcher/view/simple/Commit.java   |  45 -
 .../dispatcher/view/simple/ContentTag.java      |  36 -
 .../dispatcher/view/simple/CookieValue.java     |  46 -
 .../dispatcher/view/simple/DefaultValue.java    |  52 --
 .../scimpi/dispatcher/view/simple/EditLink.java |  71 --
 .../dispatcher/view/simple/EndSession.java      |  36 -
 .../scimpi/dispatcher/view/simple/Forward.java  |  37 -
 .../dispatcher/view/simple/GetCookie.java       |  39 -
 .../scimpi/dispatcher/view/simple/Import.java   |  37 -
 .../view/simple/InitializeFromCookie.java       |  80 --
 .../view/simple/InitializeFromResult.java       |  77 --
 .../dispatcher/view/simple/Localization.java    |  64 --
 .../scimpi/dispatcher/view/simple/Mark.java     |  43 -
 .../dispatcher/view/simple/NewActionLink.java   |  62 --
 .../dispatcher/view/simple/ObjectLink.java      |  68 --
 .../dispatcher/view/simple/PageTitle.java       |  35 -
 .../scimpi/dispatcher/view/simple/Redirect.java |  37 -
 .../dispatcher/view/simple/RemoveElement.java   | 140 ---
 .../scimpi/dispatcher/view/simple/ScopeTag.java |  51 --
 .../dispatcher/view/simple/SetCookie.java       |  53 --
 .../view/simple/SetCookieFromField.java         |  55 --
 .../view/simple/SetFieldFromCookie.java         |  52 --
 .../dispatcher/view/simple/SetLocalization.java |  61 --
 .../dispatcher/view/simple/SimpleButton.java    |  39 -
 .../dispatcher/view/simple/StartSession.java    |  36 -
 .../dispatcher/view/simple/TemplateTag.java     |  40 -
 .../scimpi/dispatcher/view/simple/Unless.java   |  41 -
 .../scimpi/dispatcher/view/simple/Variable.java |  64 --
 .../scimpi/dispatcher/view/simple/When.java     |  41 -
 .../dispatcher/view/value/ActionName.java       |  47 -
 .../dispatcher/view/value/CountElements.java    |  54 --
 .../dispatcher/view/value/ElementType.java      |  61 --
 .../scimpi/dispatcher/view/value/FieldName.java |  65 --
 .../dispatcher/view/value/ParameterName.java    |  62 --
 .../dispatcher/view/value/TitleString.java      |  68 --
 .../scimpi/dispatcher/view/value/Type.java      |  57 --
 component/viewer/scimpi/pom.xml                 | 131 ---
 component/viewer/scimpi/servlet/pom.xml         |  77 --
 .../scimpi/servlet/DispatchException.java       |  42 -
 .../scimpi/servlet/DispatcherServlet.java       |  89 --
 .../isis/viewer/scimpi/servlet/ImageLookup.java | 174 ----
 .../scimpi/servlet/ServletRequestContext.java   | 373 --------
 .../appended-resources/supplemental-models.xml  | 106 ---
 component/viewer/scimpi/tck/pom.xml             |  98 ---
 .../tck/src/main/resources/images/Default.png   | Bin 3016 -> 0 bytes
 .../main/webapp/ToDoItem/edit-selector.shtml    |  29 -
 .../src/main/webapp/ToDoItem/object-link.shtml  |  32 -
 .../src/main/webapp/ToDoItem/object-orig.shtml  |  31 -
 .../tck/src/main/webapp/ToDoItem/object.shtml   |  34 -
 .../tck/src/main/webapp/ToDoItem/object2.shtml  |  31 -
 .../tck/src/main/webapp/WEB-INF/isis.properties |  54 --
 .../src/main/webapp/WEB-INF/logging.properties  |  30 -
 .../src/main/webapp/WEB-INF/security_file.allow |  16 -
 .../main/webapp/WEB-INF/security_file.passwords |  20 -
 .../scimpi/tck/src/main/webapp/WEB-INF/web.xml  |  55 --
 .../scimpi/tck/src/main/webapp/debug.shtml      |  23 -
 .../tck/src/main/webapp/generic/action.shtml    |  27 -
 .../src/main/webapp/generic/collection.shtml    |  26 -
 .../tck/src/main/webapp/generic/edit.shtml      |  26 -
 .../tck/src/main/webapp/generic/object.shtml    |  28 -
 .../scimpi/tck/src/main/webapp/images/Claim.png | Bin 2708 -> 0 bytes
 .../tck/src/main/webapp/images/ClaimItem.png    | Bin 2316 -> 0 bytes
 .../tck/src/main/webapp/images/Employee.png     | Bin 1986 -> 0 bytes
 .../tck/src/main/webapp/images/banner-bg.png    | Bin 384 -> 0 bytes
 .../tck/src/main/webapp/images/banner.png       | Bin 18951 -> 0 bytes
 .../scimpi/tck/src/main/webapp/images/logo.png  | Bin 7183 -> 0 bytes
 .../scimpi/tck/src/main/webapp/index.shtml      |  25 -
 .../scimpi/tck/src/main/webapp/login.shtml      |  23 -
 .../scimpi/tck/src/main/webapp/style/screen.css | 394 ---------
 .../tck/src/main/webapp/style/template.shtml    |  47 -
 mothballed/component/viewer/scimpi/NOTICE       |   7 +
 .../component/viewer/scimpi/dispatcher/pom.xml  |  92 ++
 .../dispatcher/AbstractElementProcessor.java    |  55 ++
 .../dispatcher/AbstractObjectProcessor.java     |  53 ++
 .../isis/viewer/scimpi/dispatcher/Action.java   |  37 +
 .../viewer/scimpi/dispatcher/BlockContent.java  |  23 +
 .../scimpi/dispatcher/DispatchException.java    |  40 +
 .../viewer/scimpi/dispatcher/Dispatcher.java    | 484 +++++++++++
 .../dispatcher/ElementContentProcessor.java     |  24 +
 .../scimpi/dispatcher/ElementProcessor.java     |  30 +
 .../viewer/scimpi/dispatcher/ErrorCollator.java | 148 ++++
 .../scimpi/dispatcher/ForbiddenException.java   |  68 ++
 .../isis/viewer/scimpi/dispatcher/Names.java    |  91 ++
 .../scimpi/dispatcher/NotLoggedInException.java |  31 +
 .../scimpi/dispatcher/ResolveFieldUtil.java     |  71 ++
 .../scimpi/dispatcher/ScimpiException.java      |  44 +
 .../dispatcher/ScimpiNotFoundException.java     |  41 +
 .../scimpi/dispatcher/TagOrderException.java    |  31 +
 .../viewer/scimpi/dispatcher/UserManager.java   |  91 ++
 .../isis/viewer/scimpi/dispatcher/Util.java     | 105 +++
 .../scimpi/dispatcher/action/ActionAction.java  | 268 ++++++
 .../scimpi/dispatcher/action/Attributes.java    | 131 +++
 .../dispatcher/action/PropertyException.java    |  44 +
 .../action/RequiredPropertyException.java       |  43 +
 .../context/DefaultOidObjectMapping.java        | 511 +++++++++++
 .../context/DefaultVersionMapping.java          |  40 +
 .../context/IndirectObjectMapping.java          | 204 +++++
 .../scimpi/dispatcher/context/Mapping.java      | 205 +++++
 .../dispatcher/context/ObjectMapping.java       |  42 +
 .../dispatcher/context/RequestContext.java      | 857 +++++++++++++++++++
 .../dispatcher/context/VersionMapping.java      |  30 +
 .../scimpi/dispatcher/debug/DebugAction.java    | 257 ++++++
 .../dispatcher/debug/DebugHtmlWriter.java       |  45 +
 .../dispatcher/debug/DebugUserAction.java       |  71 ++
 .../scimpi/dispatcher/debug/DebugUsers.java     |  98 +++
 .../scimpi/dispatcher/debug/DebugUsersView.java |  50 ++
 .../scimpi/dispatcher/debug/ErrorDetails.java   |  35 +
 .../scimpi/dispatcher/debug/ErrorMessage.java   |  35 +
 .../scimpi/dispatcher/debug/ErrorReference.java |  35 +
 .../scimpi/dispatcher/debug/LogAction.java      |  75 ++
 .../scimpi/dispatcher/edit/EditAction.java      | 266 ++++++
 .../scimpi/dispatcher/edit/FieldEditState.java  |  57 ++
 .../scimpi/dispatcher/edit/FormState.java       |  67 ++
 .../scimpi/dispatcher/edit/RemoveAction.java    | 114 +++
 .../scimpi/dispatcher/logon/DomainSession.java  |  42 +
 .../scimpi/dispatcher/logon/LogonAction.java    | 175 ++++
 .../scimpi/dispatcher/logon/LogoutAction.java   |  70 ++
 .../scimpi/dispatcher/processor/Encoder.java    |  26 +
 .../dispatcher/processor/HtmlFileParser.java    | 205 +++++
 .../scimpi/dispatcher/processor/PageWriter.java |  28 +
 .../dispatcher/processor/ProcessorLookup.java   | 256 ++++++
 .../scimpi/dispatcher/processor/Request.java    | 324 +++++++
 .../dispatcher/processor/SimpleEncoder.java     |  32 +
 .../processor/TagProcessingException.java       |  59 ++
 .../scimpi/dispatcher/util/MethodsUtils.java    | 154 ++++
 .../viewer/scimpi/dispatcher/view/HelpLink.java |  72 ++
 .../viewer/scimpi/dispatcher/view/History.java  | 150 ++++
 .../scimpi/dispatcher/view/HtmlSnippet.java     |  51 ++
 .../viewer/scimpi/dispatcher/view/Snippet.java  |  27 +
 .../viewer/scimpi/dispatcher/view/SwfTag.java   |  90 ++
 .../scimpi/dispatcher/view/VersionNumber.java   |  70 ++
 .../dispatcher/view/action/ActionButton.java    | 237 +++++
 .../dispatcher/view/action/ActionContent.java   |  77 ++
 .../dispatcher/view/action/ActionForm.java      | 262 ++++++
 .../dispatcher/view/action/ActionLink.java      | 179 ++++
 .../view/action/CreateFormParameter.java        |  43 +
 .../scimpi/dispatcher/view/action/Methods.java  | 192 +++++
 .../dispatcher/view/action/Parameter.java       |  47 +
 .../dispatcher/view/action/RunAction.java       |  87 ++
 .../scimpi/dispatcher/view/action/Services.java |  67 ++
 .../dispatcher/view/collection/Collection.java  |  93 ++
 .../scimpi/dispatcher/view/debug/Debug.java     | 479 +++++++++++
 .../dispatcher/view/debug/DebugAccessCheck.java |  40 +
 .../view/debug/DebugCollectionView.java         | 110 +++
 .../dispatcher/view/debug/DebugObjectView.java  | 136 +++
 .../dispatcher/view/debug/DebuggerLink.java     |  53 ++
 .../dispatcher/view/debug/Diagnostics.java      |  81 ++
 .../scimpi/dispatcher/view/debug/Log.java       |  46 +
 .../scimpi/dispatcher/view/debug/LogLevel.java  |  55 ++
 .../scimpi/dispatcher/view/debug/Members.java   | 109 +++
 .../scimpi/dispatcher/view/debug/ShowDebug.java |  41 +
 .../dispatcher/view/debug/Specification.java    | 119 +++
 .../dispatcher/view/debug/ThrowException.java   |  43 +
 .../view/display/AbstractFormView.java          | 142 +++
 .../view/display/AbstractTableView.java         | 149 ++++
 .../dispatcher/view/display/AddMessage.java     |  44 +
 .../dispatcher/view/display/AddWarning.java     |  44 +
 .../scimpi/dispatcher/view/display/Errors.java  |  65 ++
 .../dispatcher/view/display/Feedback.java       |  46 +
 .../dispatcher/view/display/FieldLabel.java     |  77 ++
 .../dispatcher/view/display/FieldValue.java     | 118 +++
 .../dispatcher/view/display/GetField.java       | 103 +++
 .../dispatcher/view/display/IncludeObject.java  | 107 +++
 .../dispatcher/view/display/ListView.java       |  94 ++
 .../dispatcher/view/display/LongFormView.java   |  84 ++
 .../dispatcher/view/display/Messages.java       |  59 ++
 .../dispatcher/view/display/SelectedObject.java |  55 ++
 .../dispatcher/view/display/ShortFormView.java  |  36 +
 .../dispatcher/view/display/TableBlock.java     |  86 ++
 .../dispatcher/view/display/TableBuilder.java   |  92 ++
 .../dispatcher/view/display/TableCell.java      |  94 ++
 .../view/display/TableContentWriter.java        |  39 +
 .../dispatcher/view/display/TableEmpty.java     |  53 ++
 .../dispatcher/view/display/TableHeader.java    |  39 +
 .../dispatcher/view/display/TableRow.java       |  49 ++
 .../dispatcher/view/display/TableView.java      | 329 +++++++
 .../scimpi/dispatcher/view/display/Title.java   |  68 ++
 .../dispatcher/view/display/Warnings.java       |  58 ++
 .../scimpi/dispatcher/view/edit/EditObject.java | 319 +++++++
 .../dispatcher/view/edit/FieldFactory.java      | 105 +++
 .../scimpi/dispatcher/view/edit/FormEntry.java  |  44 +
 .../scimpi/dispatcher/view/edit/FormField.java  |  44 +
 .../dispatcher/view/edit/FormFieldBlock.java    |  68 ++
 .../dispatcher/view/edit/HiddenField.java       |  48 ++
 .../dispatcher/view/edit/RadioListField.java    |  70 ++
 .../scimpi/dispatcher/view/edit/Selector.java   | 158 ++++
 .../dispatcher/view/field/ExcludeField.java     |  39 +
 .../dispatcher/view/field/IncludeField.java     |  39 +
 .../dispatcher/view/field/InclusionList.java    |  89 ++
 .../scimpi/dispatcher/view/field/LinkField.java |  45 +
 .../view/field/LinkedFieldsBlock.java           |  47 +
 .../dispatcher/view/field/LinkedObject.java     |  58 ++
 .../dispatcher/view/form/HiddenInputField.java  |  41 +
 .../dispatcher/view/form/HtmlFormBuilder.java   | 214 +++++
 .../scimpi/dispatcher/view/form/InputField.java | 224 +++++
 .../scimpi/dispatcher/view/logon/Logoff.java    |  38 +
 .../scimpi/dispatcher/view/logon/Logon.java     | 126 +++
 .../dispatcher/view/logon/RestrictAccess.java   |  41 +
 .../scimpi/dispatcher/view/logon/Secure.java    |  45 +
 .../scimpi/dispatcher/view/logon/User.java      |  77 ++
 .../view/simple/AbstractConditionalBlock.java   | 565 ++++++++++++
 .../dispatcher/view/simple/AbstractLink.java    | 121 +++
 .../dispatcher/view/simple/BlockDefine.java     |  42 +
 .../scimpi/dispatcher/view/simple/BlockUse.java |  46 +
 .../scimpi/dispatcher/view/simple/Commit.java   |  45 +
 .../dispatcher/view/simple/ContentTag.java      |  36 +
 .../dispatcher/view/simple/CookieValue.java     |  46 +
 .../dispatcher/view/simple/DefaultValue.java    |  52 ++
 .../scimpi/dispatcher/view/simple/EditLink.java |  71 ++
 .../dispatcher/view/simple/EndSession.java      |  36 +
 .../scimpi/dispatcher/view/simple/Forward.java  |  37 +
 .../dispatcher/view/simple/GetCookie.java       |  39 +
 .../scimpi/dispatcher/view/simple/Import.java   |  37 +
 .../view/simple/InitializeFromCookie.java       |  80 ++
 .../view/simple/InitializeFromResult.java       |  77 ++
 .../dispatcher/view/simple/Localization.java    |  64 ++
 .../scimpi/dispatcher/view/simple/Mark.java     |  43 +
 .../dispatcher/view/simple/NewActionLink.java   |  62 ++
 .../dispatcher/view/simple/ObjectLink.java      |  68 ++
 .../dispatcher/view/simple/PageTitle.java       |  35 +
 .../scimpi/dispatcher/view/simple/Redirect.java |  37 +
 .../dispatcher/view/simple/RemoveElement.java   | 140 +++
 .../scimpi/dispatcher/view/simple/ScopeTag.java |  51 ++
 .../dispatcher/view/simple/SetCookie.java       |  53 ++
 .../view/simple/SetCookieFromField.java         |  55 ++
 .../view/simple/SetFieldFromCookie.java         |  52 ++
 .../dispatcher/view/simple/SetLocalization.java |  61 ++
 .../dispatcher/view/simple/SimpleButton.java    |  39 +
 .../dispatcher/view/simple/StartSession.java    |  36 +
 .../dispatcher/view/simple/TemplateTag.java     |  40 +
 .../scimpi/dispatcher/view/simple/Unless.java   |  41 +
 .../scimpi/dispatcher/view/simple/Variable.java |  64 ++
 .../scimpi/dispatcher/view/simple/When.java     |  41 +
 .../dispatcher/view/value/ActionName.java       |  47 +
 .../dispatcher/view/value/CountElements.java    |  54 ++
 .../dispatcher/view/value/ElementType.java      |  61 ++
 .../scimpi/dispatcher/view/value/FieldName.java |  65 ++
 .../dispatcher/view/value/ParameterName.java    |  62 ++
 .../dispatcher/view/value/TitleString.java      |  68 ++
 .../scimpi/dispatcher/view/value/Type.java      |  57 ++
 mothballed/component/viewer/scimpi/pom.xml      | 131 +++
 .../component/viewer/scimpi/servlet/pom.xml     |  77 ++
 .../scimpi/servlet/DispatchException.java       |  42 +
 .../scimpi/servlet/DispatcherServlet.java       |  89 ++
 .../isis/viewer/scimpi/servlet/ImageLookup.java | 174 ++++
 .../scimpi/servlet/ServletRequestContext.java   | 373 ++++++++
 .../appended-resources/supplemental-models.xml  | 106 +++
 mothballed/component/viewer/scimpi/tck/pom.xml  |  98 +++
 .../tck/src/main/resources/images/Default.png   | Bin 0 -> 3016 bytes
 .../main/webapp/ToDoItem/edit-selector.shtml    |  29 +
 .../src/main/webapp/ToDoItem/object-link.shtml  |  32 +
 .../src/main/webapp/ToDoItem/object-orig.shtml  |  31 +
 .../tck/src/main/webapp/ToDoItem/object.shtml   |  34 +
 .../tck/src/main/webapp/ToDoItem/object2.shtml  |  31 +
 .../tck/src/main/webapp/WEB-INF/isis.properties |  54 ++
 .../src/main/webapp/WEB-INF/logging.properties  |  30 +
 .../src/main/webapp/WEB-INF/security_file.allow |  16 +
 .../main/webapp/WEB-INF/security_file.passwords |  20 +
 .../scimpi/tck/src/main/webapp/WEB-INF/web.xml  |  55 ++
 .../scimpi/tck/src/main/webapp/debug.shtml      |  23 +
 .../tck/src/main/webapp/generic/action.shtml    |  27 +
 .../src/main/webapp/generic/collection.shtml    |  26 +
 .../tck/src/main/webapp/generic/edit.shtml      |  26 +
 .../tck/src/main/webapp/generic/object.shtml    |  28 +
 .../scimpi/tck/src/main/webapp/images/Claim.png | Bin 0 -> 2708 bytes
 .../tck/src/main/webapp/images/ClaimItem.png    | Bin 0 -> 2316 bytes
 .../tck/src/main/webapp/images/Employee.png     | Bin 0 -> 1986 bytes
 .../tck/src/main/webapp/images/banner-bg.png    | Bin 0 -> 384 bytes
 .../tck/src/main/webapp/images/banner.png       | Bin 0 -> 18951 bytes
 .../scimpi/tck/src/main/webapp/images/logo.png  | Bin 0 -> 7183 bytes
 .../scimpi/tck/src/main/webapp/index.shtml      |  25 +
 .../scimpi/tck/src/main/webapp/login.shtml      |  23 +
 .../scimpi/tck/src/main/webapp/style/screen.css | 394 +++++++++
 .../tck/src/main/webapp/style/template.shtml    |  47 +
 pom.xml                                         |   2 -
 409 files changed, 18449 insertions(+), 18451 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/NOTICE
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/NOTICE b/component/viewer/scimpi/NOTICE
deleted file mode 100644
index ba21d0c..0000000
--- a/component/viewer/scimpi/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2013 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/pom.xml b/component/viewer/scimpi/dispatcher/pom.xml
deleted file mode 100644
index 3805c10..0000000
--- a/component/viewer/scimpi/dispatcher/pom.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-        <groupId>org.apache.isis.viewer</groupId>
-	    <artifactId>isis-viewer-scimpi</artifactId>
-		<version>1.0.0-SNAPSHOT</version>
-	</parent>
-
-	<artifactId>isis-viewer-scimpi-dispatcher</artifactId>
-
-	<name>Isis Scimpi Viewer Dispatcher</name>
-
-	<properties>
-        <siteBaseDir>..</siteBaseDir>
-		<relativeUrl>dispatcher/</relativeUrl>
-	</properties>
-
-    <!-- used in Site generation for relative references. -->
-    <url>http://isis.apache.org/${relativeUrl}</url>
-
-    <reporting>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-project-info-reports-plugin</artifactId>
-                <inherited>false</inherited>
-                <configuration>
-                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
-                </configuration>
-                <reportSets>
-                    <reportSet>
-                        <inherited>false</inherited>
-                        <reports>
-                            <report>dependencies</report>
-                            <report>dependency-convergence</report>
-                            <report>plugins</report>
-                            <report>summary</report>
-                        </reports>
-                    </reportSet>
-                </reportSets>
-            </plugin>
-        </plugins>
-    </reporting>
-
-	<dependencies>
-
-		<dependency>
-			<groupId>org.apache.isis.core</groupId>
-			<artifactId>isis-core-runtime</artifactId>
-		</dependency>
-
-        <dependency>
-            <groupId>dom4j</groupId>
-            <artifactId>dom4j</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.json</groupId>
-            <artifactId>json</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.htmlparser</groupId>
-            <artifactId>htmlparser</artifactId>
-        </dependency>
-            
-	</dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java
deleted file mode 100644
index 4869cc4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  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;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public abstract class AbstractElementProcessor implements ElementProcessor, Names {
-
-    private static final String SHOW_ICONS_BY_DEFAULT = ConfigurationConstants.ROOT + "scimpi.show-icons";
-
-    private final boolean showIconByDefault;
-
-    public AbstractElementProcessor() {
-        showIconByDefault = IsisContext.getConfiguration().getBoolean(SHOW_ICONS_BY_DEFAULT, false);
-    }
-
-    /**
-     * Return the Class for the class specified in the type attribute.
-     */
-    protected Class<?> forClass(final Request request) {
-        Class<?> cls = null;
-        final String className = request.getOptionalProperty(TYPE);
-        if (className != null) {
-            try {
-                cls = Class.forName(className);
-            } catch (final ClassNotFoundException e) {
-                throw new ScimpiException("No class for " + className, e);
-            }
-        }
-        return cls;
-    }
-
-    protected boolean showIconByDefault() {
-        return showIconByDefault;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
deleted file mode 100644
index 97dd1ed..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  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;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public abstract class AbstractObjectProcessor extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-        ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-
-        final String field = request.getOptionalProperty(FIELD);
-        if (field != null) {
-            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
-            final String error = checkFieldType(objectField);
-            if (error != null) {
-                throw new ScimpiException("Field " + objectField.getId() + " " + error);
-            }
-            ResolveFieldUtil.resolveField(object, objectField);
-            object = objectField.get(object);
-        }
-
-        process(request, object);
-    }
-
-    protected String checkFieldType(final ObjectAssociation objectField) {
-        return null;
-    }
-
-    protected abstract void process(Request request, ObjectAdapter object);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
deleted file mode 100644
index 7bd6b26..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  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;
-
-import java.io.IOException;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-
-public interface Action extends Names {
-
-    void process(RequestContext context) throws IOException;
-
-    String getName();
-
-    void init();
-
-    void debug(DebugBuilder debug);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java
deleted file mode 100644
index 836ae60..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  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;
-
-public interface BlockContent {
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java
deleted file mode 100644
index cc679ae..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  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;
-
-public class DispatchException extends ScimpiException {
-    private static final long serialVersionUID = 1L;
-
-    public DispatchException() {
-    }
-
-    public DispatchException(final String message) {
-        super(message);
-    }
-
-    public DispatchException(final Throwable cause) {
-        super(cause);
-    }
-
-    public DispatchException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
deleted file mode 100644
index 82c67c1..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- *  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;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import java.util.TimeZone;
-
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.Identifier;
-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.exceptions.IsisException;
-import org.apache.isis.core.commons.factory.InstanceUtil;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.viewer.scimpi.dispatcher.action.ActionAction;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-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.DebugHtmlWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUserAction;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUsers;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.LogAction;
-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;
-import org.apache.isis.viewer.scimpi.dispatcher.logon.LogoutAction;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Encoder;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.HtmlFileParser;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.ProcessorLookup;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.SimpleEncoder;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessingException;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
-
-public class Dispatcher {
-    private static final String SHOW_UNSHOWN_MESSAGES = ConfigurationConstants.ROOT + "scimpi.show-unshown-messages";
-    public static final String ACTION = "_action";
-    public static final String EDIT = "_edit";
-    public static final String REMOVE = "_remove";
-    public static final String GENERIC = "_generic";
-    public static final String EXTENSION = "shtml";
-    private static final Logger LOG = LoggerFactory.getLogger(Dispatcher.class);
-    public static final String COMMAND_ROOT = ".app";
-    private final Map<String, Action> actions = new HashMap<String, Action>();
-    private final Map<String, String> parameters = new HashMap<String, String>();
-    private final ProcessorLookup processors = new ProcessorLookup();
-    private final HtmlFileParser parser = new HtmlFileParser(processors);
-    private final Encoder encoder = new SimpleEncoder();
-    private boolean showUnshownMessages;
-
-    public void process(final RequestContext context, final String servletPath) {
-        LOG.debug("processing request " + servletPath);
-        final AuthenticationSession session = UserManager.startRequest(context);
-        LOG.debug("exsiting session: " + session);
-        
-        String language = (String) context.getVariable("user-language");
-        if (language != null) {
-            Locale locale = Util.locale(language);
-            TimeZone timeZone = Util.timeZone((String) context.getVariable("user-time-zone"));
-            // IsisContext.getUserProfile().setLocalization(new UserLocalization(locale, timeZone));
-         } 
-        
-        IsisContext.getPersistenceSession().getTransactionManager().startTransaction();
-        context.setRequestPath(servletPath);
-        context.startRequest();
-
-        try {
-            processActions(context, false, servletPath);
-            processTheView(context);
-        } catch (final ScimpiNotFoundException e) {
-            if (context.isInternalRequest()) {
-                LOG.error("invalid page request (from within application): " + e.getMessage());
-                ErrorCollator error = new ErrorCollator(); 
-                error.missingFile("Failed to find page " + servletPath + "."); 
-                show500ErrorPage(context, e, error);             
-            } else {
-                LOG.info("invalid page request (from outside application): " + e.getMessage());
-                show404ErrorPage(context, servletPath); 
-            }
-        } catch (final NotLoggedInException e) {
-            redirectToLoginPage(context); 
-        } catch (final Throwable e) {
-            ErrorCollator error = new ErrorCollator();
-            final PersistenceSession checkSession = IsisContext.getPersistenceSession();
-            final IsisTransactionManager transactionManager = checkSession.getTransactionManager();
-            if (transactionManager.getTransaction() != null && transactionManager.getTransaction().getState().canAbort()) {
-                transactionManager.abortTransaction();
-                transactionManager.startTransaction();
-            }
-
-            final Throwable ex = e instanceof TagProcessingException ? e.getCause() : e;
-            if (ex instanceof ForbiddenException) {
-                LOG.error("invalid access to " + servletPath, e);
-                show403ErrorPage(context, error, e, ex);
-            } else {
-                LOG.error("error procesing " + servletPath, e);
-                if (context.getErrorMessage() != null) {
-                    fallbackToSimpleErrorPage(context, e);
-                } else {
-                    show500ErrorPage(context, e, error);
-                }
-            }
-        } finally {
-            try {
-                UserManager.endRequest(context.getSession());
-            } catch (final Exception e1) {
-                LOG.error("endRequest call failed", e1);
-            }
-        }
-    }
-
-    private void redirectToLoginPage(final RequestContext context) {
-        IsisContext.getMessageBroker().addWarning(
-            "You are not currently logged in! Please log in so you can continue.");
-        context.setRequestPath("/login.shtml");
-        try {
-            processTheView(context);
-        } catch (final IOException e1) {
-            throw new ScimpiException(e1);
-        }
-    }
-
-    private void show404ErrorPage(final RequestContext context, final String servletPath) {
-        ErrorCollator error = new ErrorCollator();
-        error.missingFile("Failed to find page " + servletPath + ".");
-        context.raiseError(404, error);
-    }
-
-    private void show403ErrorPage(final RequestContext context, ErrorCollator error, final Throwable e, final Throwable ex) {
-        DebugBuilder debug = error.getDebug();
-        error.message(e);
-        error.message(ex);
-        
-        final List<String> roles = ((ForbiddenException) ex).getRoles();
-        final StringBuffer roleList = new StringBuffer();
-        for (final String role : roles) {
-            if (roleList.length() > 0) {
-                roleList.append("|");
-            }
-            roleList.append(role);
-        }
-        final Identifier identifier =  ((ForbiddenException) ex).getIdentifier(); 
-        if (identifier != null) {
-            debug.appendln("Class", identifier.toClassIdentityString() + ":" + roleList);
-            debug.appendln("Member",identifier.toClassAndNameIdentityString() + ":" + roleList); 
-            debug.appendln("Other",identifier.toFullIdentityString() + ":" + roleList); 
-        }
-        
-        error.compileError(context);
-        context.raiseError(403, error);
-    }
-
-    private void show500ErrorPage(final RequestContext context, final Throwable e, ErrorCollator error) {
-        error.exception(e);
-        error.compileError(context);
-        context.raiseError(500, error);
-    }
-
-    private void fallbackToSimpleErrorPage(final RequestContext context, final Throwable e) {
-        context.setContentType("text/html");
-        final PrintWriter writer = context.getWriter();
-        writer.write("<html><head><title>Error</title></head>");
-        writer.write("<body><h1>Error</h1>");
-        writer.write("<p>Error while processing error</p><pre>");
-        e.printStackTrace(writer);
-        writer.write("</pre></body></html>");
-        writer.close();
-        LOG.error("Error while processing error", e);
-    }
-
-    protected void processTheView(final 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());
-    }
-
-    public void addParameter(final String name, final String value) {
-        parameters.put(name, value);
-    }
-
-    private String getParameter(final String name) {
-        return parameters.get(name);
-    }
-
-    private void processActions(final RequestContext context, final boolean userLoggedIn, final String actionName) throws IOException {
-        if (actionName.endsWith(COMMAND_ROOT)) {
-            final int pos = actionName.lastIndexOf('/');
-            final Action action = actions.get(actionName.substring(pos, actionName.length() - COMMAND_ROOT.length()));
-            if (action == null) {
-                throw new ScimpiException("No logic for " + actionName);
-            }
-
-            LOG.debug("processing action: " + action);
-            action.process(context);
-            final String fowardTo = context.forwardTo();
-            if (fowardTo != null) {
-                processActions(context, true, fowardTo);
-            }
-        }
-    }
-
-    private void processView(final RequestContext context) throws IOException {
-        String file = context.getRequestedFile();
-        if (file == null) {
-            LOG.warn("No view specified to process");
-            return;
-        }
-        if (file.endsWith(COMMAND_ROOT)) {
-            return;
-        }
-        file = determineFile(context, file);
-        final String fullPath = context.requestedFilePath(file);
-        LOG.debug("processing file " + fullPath);
-        context.setResourcePath(fullPath);
-
-        context.setContentType("text/html");
-
-        context.addVariable("title", "Untitled Page", Scope.REQUEST);
-        final Stack<Snippet> tags = loadPageTemplate(context, fullPath);
-        final Request request = new Request(file, context, encoder, tags, processors);
-        request.appendDebug("processing " + fullPath);
-        try {
-            request.processNextTag();
-            noteIfMessagesHaveNotBeenDisplay(context);
-        } catch (final RuntimeException e) {
-            IsisContext.getMessageBroker().getMessages();
-            IsisContext.getMessageBroker().getWarnings();
-            throw e;
-        }
-        final String page = request.popBuffer();
-        final PrintWriter writer = context.getWriter();
-        writer.write(page);
-        if (context.getDebug() == Debug.PAGE) {
-            final DebugHtmlWriter view = new DebugHtmlWriter(writer, false);
-            context.append(view);
-        }
-    }
-
-    public void noteIfMessagesHaveNotBeenDisplay(final RequestContext context) {
-        final List<String> messages = IsisContext.getMessageBroker().getMessages();
-        if (showUnshownMessages) {
-            if (messages.size() > 0) {
-                context.getWriter().println("<ol class=\"messages forced\">");
-                for (String message : messages) {
-                    context.getWriter().println("<li>" + message + "</li>");                
-                }
-                context.getWriter().println("</ol>");
-            }
-            final List<String> warnings = IsisContext.getMessageBroker().getWarnings();
-            if (warnings.size() > 0) {
-                context.getWriter().println("<ol class=\"warnings forced\">");
-                for (String message : warnings) {
-                    context.getWriter().println("<li>" + message + "</li>");                
-                }
-                context.getWriter().println("</ol>");
-            }
-        }
-    }
-
-    private String determineFile(final RequestContext context, String file) {
-        final String fileName = file.trim();
-        if (fileName.startsWith(GENERIC)) {
-            final Object result = context.getVariable(RequestContext.RESULT);
-            final ObjectAdapter mappedObject = MethodsUtils.findObject(context, (String) result);
-            if (mappedObject == null) {
-                throw new ScimpiException("No object mapping for " + result);
-            }
-            if (fileName.equals(GENERIC + "." + EXTENSION)) {
-                final Facet facet = mappedObject.getSpecification().getFacet(CollectionFacet.class);
-                if (facet != null) {
-                    final ObjectSpecification specification = mappedObject.getSpecification();
-                    final TypeOfFacet facet2 = specification.getFacet(TypeOfFacet.class);
-                    file = findFileForSpecification(context, facet2.valueSpec(), "collection", EXTENSION);
-                } else {
-                    final ObjectAdapter mappedObject2 = mappedObject;
-                    if (mappedObject2.isTransient()) {
-                        file = findFileForSpecification(context, mappedObject.getSpecification(), "edit", EXTENSION);
-                    } else {
-                        file = findFileForSpecification(context, mappedObject.getSpecification(), "object", EXTENSION);
-                    }
-                }
-            } else if (fileName.equals(GENERIC + EDIT + "." + EXTENSION)) {
-                file = findFileForSpecification(context, mappedObject.getSpecification(), "edit", EXTENSION);
-            } else if (fileName.equals(GENERIC + ACTION + "." + EXTENSION)) {
-                final String method = context.getParameter("method");
-                file = findFileForSpecification(context, mappedObject.getSpecification(), method, "action", EXTENSION);
-            }
-        }
-        return file;
-    }
-
-    private String findFileForSpecification(final RequestContext context, final ObjectSpecification specification, final String name, final String extension) {
-        return findFileForSpecification(context, specification, name, name, extension);
-    }
-
-    private String findFileForSpecification(final RequestContext context, final ObjectSpecification specification, final String name, final String defaultName, final String extension) {
-
-        String find = findFile(context, specification, name, extension);
-        if (find == null) {
-            find = "/generic/" + defaultName + "." + extension;
-        }
-        return find;
-    }
-
-    private String findFile(final RequestContext context, final ObjectSpecification specification, final String name, final String extension) {
-        final String className = specification.getShortIdentifier();
-        String fileName = context.findFile("/" + className + "/" + name + "." + extension);
-        if (fileName == null) {
-            final List<ObjectSpecification> interfaces = specification.interfaces();
-            for (int i = 0; i < interfaces.size(); i++) {
-                fileName = findFile(context, interfaces.get(i), name, extension);
-                if (fileName != null) {
-                    return fileName;
-                }
-            }
-            if (specification.superclass() != null) {
-                fileName = findFile(context, specification.superclass(), name, extension);
-            }
-        }
-        return fileName;
-    }
-
-    private Stack<Snippet> loadPageTemplate(final RequestContext context, final String path) throws IOException, FileNotFoundException {
-        // TODO cache stacks and check for them first
-        copyParametersToVariableList(context);
-        LOG.debug("parsing source " + path);
-        return parser.parseHtmlFile(path, context);
-    }
-
-    private void copyParametersToVariableList(final RequestContext context) {
-        /*
-         * Enumeration parameterNames = context.getParameterNames(); while
-         * (parameterNames.hasMoreElements()) { String name = (String)
-         * parameterNames.nextElement(); if (!name.equals("view")) {
-         * context.addVariable(name, context.getParameter(name), Scope.REQUEST);
-         * } }
-         */
-    }
-
-    public void init(final String dir, final DebugUsers debugUsers) {
-        addAction(new ActionAction());
-
-        // TODO remove
-        addAction(new DebugAction(this));
-        addAction(new DebugUserAction(debugUsers));
-        addAction(new EditAction());
-        addAction(new RemoveAction());
-        addAction(new LogonAction());
-        addAction(new LogoutAction());
-        addAction(new LogAction());
-
-        final String configFile = getParameter("config");
-        if (configFile != null) {
-            final File file = new File(dir, configFile);
-            if (file.exists()) {
-                loadConfigFile(file);
-            } else {
-                throw new ScimpiException("Configuration file not found: " + configFile);
-            }
-        }
-
-        processors.init();
-        processors.addElementProcessor(new org.apache.isis.viewer.scimpi.dispatcher.view.debug.Debug(this));
-        
-        showUnshownMessages = IsisContext.getConfiguration().getBoolean(SHOW_UNSHOWN_MESSAGES, true);
-    }
-
-    private void loadConfigFile(final File file) {
-        try {
-            Document document;
-            final SAXReader reader = new SAXReader();
-            document = reader.read(file);
-            final Element root = document.getRootElement();
-            for (final Iterator i = root.elementIterator(); i.hasNext();) {
-                final Element element = (Element) i.next();
-
-                if (element.getName().equals("actions")) {
-                    for (final Iterator actions = element.elementIterator("action"); actions.hasNext();) {
-                        final Element action = (Element) actions.next();
-                        final String className = action.getText();
-                        final Action instance = (Action) InstanceUtil.createInstance(className);
-                        addAction(instance);
-                    }
-                }
-
-                if (element.getName().equals("processors")) {
-                    for (final Iterator processors = element.elementIterator("processor"); processors.hasNext();) {
-                        final Element processor = (Element) processors.next();
-                        final String className = processor.getText();
-                        final ElementProcessor instance = (ElementProcessor) InstanceUtil.createInstance(className);
-                        this.processors.addElementProcessor(instance);
-                    }
-                }
-
-            }
-        } catch (final DocumentException e) {
-            throw new IsisException(e);
-        }
-
-    }
-
-    private void addAction(final Action action) {
-        actions.put("/" + action.getName(), action);
-        action.init();
-    }
-
-    public void debug(final DebugBuilder debug) {
-        debug.startSection("Actions");
-        final Set<String> keySet = actions.keySet();
-        final ArrayList<String> list = new ArrayList<String>(keySet);
-        Collections.sort(list);
-        for (final String name : list) {
-            debug.appendln(name, actions.get(name));
-        }
-        /*
-         * new ArrayList<E>(actions.keySet().iterator()) Iterator<String> names
-         * = Collections.sort().iterator(); while (names.hasNext()) { String
-         * name = names.next(); view.appendRow(name, actions.get(name)); }
-         */
-        final Iterator<Action> iterator = actions.values().iterator();
-        while (iterator.hasNext()) {
-            iterator.next().debug(debug);
-        }
-
-        processors.debug(debug);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java
deleted file mode 100644
index eaae2ac..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementContentProcessor.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  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;
-
-public interface ElementContentProcessor extends ElementProcessor {
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java
deleted file mode 100644
index 471ac00..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ElementProcessor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  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;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public interface ElementProcessor {
-
-    String getName();
-
-    void process(Request request);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java
deleted file mode 100644
index 97e297e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ErrorCollator.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- *  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;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.PrintWriter;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebugHtmlString;
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.debug.DebugTee;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugHtmlWriter;
-
-public class ErrorCollator {
-    private static final Logger LOG = LoggerFactory.getLogger(ErrorCollator.class);
-
-    private String errorRef;
-    private String message;
-    private final DebugString debugText = new DebugString();
-    private final DebugHtmlString debugHtml = new DebugHtmlString();
-    private final DebugBuilder debug = new DebugTee(debugText, debugHtml);
- 
-    public void missingFile(String message) {
-        this.message = message;
-    }
-
-    public void message(final Throwable exception) {
-        LOG.debug(exception.getMessage(), exception);
-        message = exception.getMessage();
-        debug.appendPreformatted(message);
-    }
-
-    public void exception(final Throwable exception) {
-        String messageText = exception.getMessage(); 
-        LOG.debug(messageText, exception); 
-        try {
-            debug.startSection("Exception");
-            debug.appendException(exception);
-            debug.endSection();
-        } catch (final RuntimeException e) {
-            debug.appendln("NOTE - an exception occurred while dumping an exception!");
-            debug.appendException(e);
-        }
-        message = messageText == null ? exception.getClass().getName() : messageText; 
-    }
-        
-    public DebugBuilder getDebug() {
-        return debug;
-    }
-    
-    public void compileError(final RequestContext requestContext) {
-        errorRef = Long.toString(System.currentTimeMillis(), 36).toUpperCase();
-        LOG.info("error " + errorRef);
-
-        captureWarningsAndMessages();
-        dumpDebugDetails(requestContext);
-        writeErrorFile();
-    }
-
-    private void captureWarningsAndMessages() {
-        // Capture warnings/messages
-        if (IsisContext.getCurrentTransaction() != null) {
-            final List<String> messages = IsisContext.getMessageBroker().getMessages();
-            final List<String> warnings = IsisContext.getMessageBroker().getWarnings();
-            if (messages.size() > 0 || messages.size() > 0) {
-                debug.startSection("Warnings/Messages");
-                for (final String message : messages) {
-                    debug.appendln("message", message);
-                }
-                for (final String message : warnings) {
-                    debug.appendln("warning", message);
-                }
-            }
-        }
-    }
-
-    private void dumpDebugDetails(final RequestContext requestContext) {
-        // Dump page debug details 
-        requestContext.append(debug);
-
-        debug.startSection("Processing Trace");
-        debug.appendPreformatted(requestContext.getDebugTrace());
-        debug.endSection();
-        debug.close();
-    }
-
-    private void writeErrorFile() {
-        LOG.error(message + "\n" + debugText.toString());
-        
-        
-        PrintWriter writer;
-        try {
-            final String directory =
-                IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.error-snapshots", ".");
-            File dir = new File(directory);
-            if (!dir.exists()) {
-                dir.mkdirs();
-            }
-            writer = new PrintWriter(new File(dir, "error_" + errorRef + ".html"));
-            final DebugHtmlWriter writer2 = new DebugHtmlWriter(writer, true);
-            writer2.concat(debugHtml);
-            writer2.close();
-            writer.close();
-        } catch (final FileNotFoundException e) {
-            LOG.error("Failed to archive error page", e);
-        }
-    }
-
-    public String getReference() {
-        return errorRef;
-    }
-    
-    public String getDetails() {
-        return debugHtml.toString();
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    
-}
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
deleted file mode 100644
index 32d0c0c..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  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;
-
-import java.util.List;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-/**
- * Indicates that request could not complete as it could not access (for
- * security reasons) some of the content.
- */
-public class ForbiddenException extends ScimpiException {
-    private static final long serialVersionUID = 1L;
-    public static final boolean VISIBLE_AND_USABLE = true;
-    public static final boolean VISIBLE = false;
-    private final Identifier identifier;
-    private final AuthenticationSession session;
-
-    public ForbiddenException(final String message) {
-        this(IsisContext.getAuthenticationSession(), message);
-    }
-
-    private ForbiddenException(final AuthenticationSession session, final String message) {
-        super(message + " for " + session.getUserName() + " " + session.getRoles());
-        this.session = session;
-        identifier = null;
-    }
-
-    public ForbiddenException(final IdentifiedHolder target, final boolean isVisibleAndUsabable) {
-        this(target.getIdentifier(), IsisContext.getAuthenticationSession(), isVisibleAndUsabable);
-    }
-
-    private ForbiddenException(final Identifier identifier, final AuthenticationSession session, final boolean isVisibleAndUsabable) {
-        super((identifier.getType() == Identifier.Type.PROPERTY_OR_COLLECTION ? "Field" : "Action") + " '" + identifier.getMemberName() + "' in " + identifier.getClassName() + " is not " + (isVisibleAndUsabable ? "visible/usable " : "visible") + " for " + session.getUserName() + " "
-                + session.getRoles());
-        this.identifier = identifier;
-        this.session = session;
-    }
-
-    public Identifier getIdentifier() {
-        return identifier;
-    }
-
-    public List<String> getRoles() {
-        return session.getRoles();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java
deleted file mode 100644
index 29b15e5..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Names.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  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;
-
-public interface Names {
-    static final String PREFIX = "_logon-";
-
-    static final String BUTTON_TITLE = "button-title";
-    static final String CANCEL_TO = "cancel-to";
-    static final String COLLECTION = "collection";
-    static final String CONFIRM = "confirm";
-    static final String CLASS = "class";
-    static final String CONTAINER_CLASS = "container-" + CLASS;
-    static final String DEFAULT = "default";
-    static final String ELEMENT_NAME = "element-name";
-    static final String ELEMENT = "element";
-    static final String EVEN_ROW_CLASS = "even-row";
-    static final String FALSE = "false";
-    static final String ERROR = "error";
-    static final String FIELD = "field";
-    static final String FIELD_NAME = "field-name";
-    static final String FOOTER = "footer";
-    static final String FORM_ID = "form-id";
-    static final String FORM_TITLE = "title";
-    static final String FORMS = "show-forms";
-    static final String HEADER = "header";
-    static final String ICON_CLASS = "icon";
-    static final String HIDDEN = "hidden";
-    static final String HIDE_UNEDITABLE = "hide-uneditable";
-    static final String HEADER_LEVEL = "header";
-    static final String ID = "id";
-    static final String LABEL_DELIMITER = "label";
-    static final String LINK_VIEW = "link-view";
-    static final String LINK_NAME = "link-name";
-    static final String LINK_OBJECT = "link-object";
-    static final String METHOD = "method";
-    static final String MESSAGE = "message";
-    static final String NAME = "name";
-    static final String ODD_ROW_CLASS = "odd-row";
-    static final String OBJECT = "object";
-    static final String PARAMETER = "param";
-    static final String PARAMETER_NUMBER = "number";
-    static final String PLURAL = "plural";
-    static final String REFERENCE_NAME = "reference-name";
-    static final String RESULT_NAME = "result-name";
-    static final String RESULT_OVERRIDE = "result-override";
-    static final String ROW_CLASSES = "row-classes";
-    static final String SCOPE = "scope";
-    static final String SHOW_ICON = "icon";
-    static final String SHOW_SELECT = "select";
-    static final String SHOW_EDIT = "edit";
-    static final String SHOW_DELETE = "delete";
-    static final String SHOW_MESSAGE = "show-message";
-    static final String SHOW_TITLE = "show-title";
-    static final String TRUNCATE = "truncate";
-    static final String TABLE_TITLE = "title";
-    static final String TYPE = "type";
-    static final String VIEW = "view";
-    static final String VALUE = "value";
-    static final String VERSION = "version";
-    static final String USER = "user";
-    static final String VOID = "void";
-    static final String WHEN = "when";
-    static final String ENTRY_FIELDS = "entry-fields";
-    
-    
-    static final String LOGON_OBJECT = PREFIX + OBJECT;
-    static final String LOGON_METHOD = PREFIX + METHOD;
-    static final String LOGON_SCOPE = PREFIX + SCOPE;
-    static final String LOGON_RESULT_NAME = PREFIX + RESULT_NAME;
-    static final String LOGON_FORM_ID = PREFIX + "form-id";
-    
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
deleted file mode 100644
index 9cd54a3..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/NotLoggedInException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  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() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
deleted file mode 100644
index a0ae5cf..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  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;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-
-public final class ResolveFieldUtil {
-
-    private ResolveFieldUtil(){}
-
-    /**
-     * Walking the graph.
-     *
-     * <p>
-     *     This combines the implementations of both the DN Objectstore
-     *     and also the in-memory objectstore.
-     * </p>
-     */
-    public static void resolveField(final ObjectAdapter object, final ObjectAssociation association) {
-
-
-        // DN impl.
-        {
-            final ObjectAdapter referencedCollectionAdapter = association.get(object);
-
-            // this code originally brought in from the JPA impl, but seems reasonable.
-            if (association.isOneToManyAssociation()) {
-                ensureThatState(referencedCollectionAdapter, is(notNullValue()));
-
-                final Object referencedCollection = referencedCollectionAdapter.getObject();
-                ensureThatState(referencedCollection, is(notNullValue()));
-
-                // if a proxy collection, then force it to initialize.  just 'touching' the object is sufficient.
-                // REVIEW: I wonder if this is actually needed; does JDO use proxy collections?
-                referencedCollection.hashCode();
-            }
-
-            // the JPA impl used to also call its lifecycle listener on the referenced collection object, eg List,
-            // itself.  I don't think this makes sense to do for JDO (the collection is not a PersistenceCapable).
-        }
-
-        // In-memory objectstore impl
-        {
-            final ObjectAdapter referenceAdapter = association.get(object);
-            referenceAdapter.markAsResolvedIfPossible();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
deleted file mode 100644
index 18e7646..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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;
-
-public class ScimpiException extends RuntimeException {
-    private static final long serialVersionUID = 1L;
-
-    public ScimpiException() {
-    }
-
-    public ScimpiException(final String message) {
-        super(message);
-    }
-
-    public ScimpiException(final Throwable cause) {
-        super(cause);
-    }
-
-    public ScimpiException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public String getHtmlMessage() {
-        return getMessage();
-    }
-
-}


[14/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
deleted file mode 100644
index facd79d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  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.view.logon;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.edit.FieldEditState;
-import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class Logon extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        String view = request.getOptionalProperty(VIEW);
-        RequestContext context = request.getContext();
-        if (view == null) {
-            view = (String) context.getVariable("login-path");
-        }
-
-        final boolean isNotLoggedIn = IsisContext.getSession().getAuthenticationSession() instanceof AnonymousSession;
-        if (isNotLoggedIn) {            
-            loginForm(request, view);
-        }
-    }
-
-    public static void loginForm(final Request request, final String view) {
-        final String object = request.getOptionalProperty(OBJECT);
-        final String method = request.getOptionalProperty(METHOD, "logon");
-        final String result = request.getOptionalProperty(RESULT_NAME, "_user");
-        final String resultScope = request.getOptionalProperty(SCOPE, Scope.SESSION.name());
-        final String role = request.getOptionalProperty("field", "roles");
-//        final String isisUser = request.getOptionalProperty("isis-user", "_web_default");
-        final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
-        final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
-
-        // TODO error if all values are not set (not if use type is not set and all others are still defaults);
-
-        if (object != null) {
-            RequestContext context = request.getContext();
-            context.addVariable(LOGON_OBJECT, object, Scope.SESSION);
-            context.addVariable(LOGON_METHOD, method, Scope.SESSION);
-            context.addVariable(LOGON_RESULT_NAME, result, Scope.SESSION);
-            context.addVariable(LOGON_SCOPE, resultScope, Scope.SESSION);
-            context.addVariable(PREFIX + "roles-field", role, Scope.SESSION);
-//            context.addVariable(PREFIX + "isis-user", isisUser, Scope.SESSION);
-            context.addVariable(LOGON_FORM_ID, formId, Scope.SESSION);
-        }
-        
-        final String error = request.getOptionalProperty(ERROR, request.getContext().getRequestedFile());
-        final List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
-        hiddenFields.add(new HiddenInputField(ERROR, error));
-        if (view != null) {
-            hiddenFields.add(new HiddenInputField(VIEW, view));
-        }
-        hiddenFields.add(new HiddenInputField("_" + FORM_ID, formId));
-
-        final FormState entryState = (FormState) request.getContext().getVariable(ENTRY_FIELDS);
-        boolean isforThisForm = entryState != null && entryState.isForForm(formId);
-        if (entryState != null && entryState.isForForm(formId)) {
-        }
-        final InputField nameField = createdField("username", "User Name", InputField.TEXT, isforThisForm ? entryState : null);
-        final String width = request.getOptionalProperty("width");
-        if (width != null) {
-            final int w = Integer.valueOf(width).intValue();
-            nameField.setWidth(w);
-        }
-        final InputField passwordField = createdField("password", "Password", InputField.PASSWORD, isforThisForm ? entryState : null);
-        final InputField[] fields = new InputField[] { nameField, passwordField, };
-
-        final String formTitle = request.getOptionalProperty(FORM_TITLE);
-        final String loginButtonTitle = request.getOptionalProperty(BUTTON_TITLE, "Log in");
-        final String className = request.getOptionalProperty(CLASS, "login");
-        final String id = request.getOptionalProperty(ID, "logon");
-
-        HtmlFormBuilder.createForm(request, "logon.app", hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]), fields,
-                className, id, formTitle, labelDelimiter, null, null, loginButtonTitle,
-                isforThisForm && entryState != null ? entryState.getError() : null , null);        
-    }
-
-    protected static InputField createdField(final String fieldName, final String fieldLabel, final int type, final FormState entryState) {
-        final InputField nameField = new InputField(fieldName);
-        nameField.setType(type);
-        nameField.setLabel(fieldLabel);
-        if (entryState != null) {
-            final FieldEditState fieldState = entryState.getField(fieldName);
-            final String entry = fieldState == null ? "" : fieldState.getEntry();
-            nameField.setValue(entry);
-            final String error = fieldState == null ? "" : fieldState.getError();
-            nameField.setErrorText(error);
-        }
-        return nameField;
-    }
-
-    @Override
-    public String getName() {
-        return "logon";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java
deleted file mode 100644
index 83f2597..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  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.view.logon;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class RestrictAccess extends AbstractElementProcessor {
-    private static final String LOGIN_VIEW = "login-view";
-    private static final String DEFAULT_LOGIN_VIEW = "login." + Dispatcher.EXTENSION;
-
-    public String getName() {
-        return "restrict-access";
-    }
-
-    public void process(Request request) {
-        if (!request.getContext().isUserAuthenticated()) { 
-            final String view = request.getOptionalProperty(LOGIN_VIEW, DEFAULT_LOGIN_VIEW);
-            request.getContext().redirectTo(view);
-        }
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java
deleted file mode 100644
index 17cd472..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  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.view.logon;
-
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Secure extends AbstractElementProcessor {
-    private static final String LOGIN_VIEW = "login-view";
-
-    @Override
-    public void process(final Request request) {
-        final boolean isLoggedIn = !(IsisContext.getSession().getAuthenticationSession() instanceof AnonymousSession);
-        if (!isLoggedIn) {
-            IsisContext.getMessageBroker().addWarning("You are not currently logged in! Please log in so you can continue.");
-            final String view = request.getOptionalProperty(LOGIN_VIEW, "/login.shtml");
-            request.getContext().redirectTo(view);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "secure";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java
deleted file mode 100644
index 4254746..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  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.view.logon;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class User extends AbstractElementProcessor {
-    private static final String LOGIN_VIEW = "login-view";
-    private static final String DEFAULT_LOGIN_VIEW = "login." + Dispatcher.EXTENSION;
-    private static final String LOGOUT_VIEW = "logout-view";
-    private static final String DEFAULT_LOGOUT_VIEW = "logout." + Dispatcher.EXTENSION;
-
-    @Override
-    public void process(final Request request) {
-        final boolean isAuthenticatedn = request.getContext().isUserAuthenticated();
-        request.appendHtml("<div class=\"user\">");
-        if (isAuthenticatedn) {
-            displayUserAndLogoutLink(request);
-        } else {
-            displayLoginForm(request);
-        }
-        request.appendHtml("</div>");
-    }
-
-    public void displayLoginForm(final Request request) {
-        String loginView = request.getOptionalProperty(LOGIN_VIEW);
-        if (loginView == null) {
-            Logon.loginForm(request, ".");
-        } else {
-            if (loginView.trim().length() == 0) {
-                loginView = DEFAULT_LOGIN_VIEW;
-            }
-            request.appendHtml("<a div class=\"link\" href=\"" + loginView + "\">Log in</a>");
-        }
-    }
-
-    public void displayUserAndLogoutLink(final Request request) {
-        String user = request.getOptionalProperty(NAME);
-        if (user == null) {
-            user = (String) request.getContext().getVariable("_username");
-        }
-        if (user == null) {
-            user = IsisContext.getAuthenticationSession().getUserName();
-        }
-        request.appendHtml("Welcome <span class=\"name\">");
-        request.appendAsHtmlEncoded(user);
-        request.appendHtml("</span>, ");
-        final String logoutView = request.getOptionalProperty(LOGOUT_VIEW, DEFAULT_LOGOUT_VIEW);
-        request.appendHtml("<a class=\"link\" href=\"logout.app?view=" + logoutView + "\">Log out</a>");
-    }
-
-    @Override
-    public String getName() {
-        return "user";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
deleted file mode 100644
index dc5b39a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- *  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.view.simple;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public abstract class AbstractConditionalBlock extends AbstractElementProcessor {
-
-    private static Map<String, Test> tests = new HashMap<String, Test>();
-
-    static {
-        addNormal(new TestHasRole(), "has-role");
-        addNegated(new TestHasRole(), "has-not-role");
-
-        addNormal(new TestVariableExists(), "variable-exists");
-        addNegated(new TestVariableExists(), "variable-missing");
-        addNormal(new TestVariableTrue(), "variable-true");
-        addNegated(new TestVariableTrue(), "variable-false");
-
-        addNormal(new TestObjectPersistent(), "object-persistent");
-        addNegated(new TestObjectPersistent(), "object-transient");
-        addNormal(new TestObjectType(), "object-type");
-        /*
-         * addNormal(new TestObjectIs(), "object-is"); addNegated(new
-         * TestObjectIs(), "object-is-not"); addNormal(new TestObjectType(),
-         * "object-type"); addNormal(new TestObjectType(),
-         * "object-title-equals"); addNegated(new TestObjectType(),
-         * "object-title-not-equals"); addNormal(new TestObjectType(),
-         * "object-title-contains"); addNegated(new TestObjectType(),
-         * "object-title-not-contains");
-         */
-        addNormal(new TestCollectionFull(), "collection-full");
-        addNegated(new TestCollectionFull(), "collection-empty");
-        addNormal(new TestCollectionType(), "collection-type");
-        // addNormal(new TestCollectionSize(), "collection-size-equal");
-        // addNormal(new TestCollectionSize(), "collection-size-less-than");
-        // addNormal(new TestCollectionSize(), "collection-size-greater-than");
-
-        addNormal(new TestFieldValue(), "test-field");
-        addNegated(new TestFieldValue(), "test-field");
-           
-        addNormal(new TestFieldExists(), "field-exists");
-        addNegated(new TestFieldExists(), "field-missing");
-        addNormal(new TestFieldVisible(), "field-visible");
-        addNegated(new TestFieldVisible(), "field-hidden");
-        addNormal(new TestFieldEditable(), "field-editable");
-        addNegated(new TestFieldEditable(), "field-not-editable");
-        addNormal(new TestFieldType(), "field-type");
-        addNormal(new TestFieldSet(), "field-set");
-        addNegated(new TestFieldSet(), "field-empty");
-        // empty/set etc
-
-        addNormal(new TestMethodExists(), "method-exists");
-        addNegated(new TestMethodExists(), "method-missing");
-        addNormal(new TestMethodVisible(), "method-visible");
-        addNegated(new TestMethodVisible(), "method-hidden");
-        addNormal(new TestMethodUseable(), "method-useable");
-        addNegated(new TestMethodUseable(), "method-not-useable");
-
-    }
-
-    private static void addNegated(final Test test, final String name) {
-        test.name = name;
-        test.negateResult = true;
-        tests.put(name, test);
-    }
-
-    private static void addNormal(final Test test, final String name) {
-        test.name = name;
-        tests.put(name, test);
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-
-        boolean checkMade = false;
-        boolean allConditionsMet = true;
-
-        final String[] propertyNames = request.getAttributes().getPropertyNames(new String[] { "object", "collection" });
-        for (final String propertyName : propertyNames) {
-            boolean result;
-            if (propertyName.equals("set")) {
-                result = request.isPropertySet("set");
-            } else {
-                final Test test = tests.get(propertyName);
-                if (test == null) {
-                    throw new ScimpiException("No such test: " + propertyName);
-                }
-                final String attributeValue = request.getOptionalProperty(propertyName, false);
-                result = test.test(request, attributeValue, id);
-                if (test.negateResult) {
-                    result = !result;
-                }
-            }
-            checkMade = true;
-            allConditionsMet &= result;
-        }
-
-        /*
-         * 
-         * // Check variables if
-         * (request.isPropertySpecified("variable-exists")) { boolean
-         * valuePresent = request.isPropertySet("variable-exists"); checkMade =
-         * true; allConditionsMet &= valuePresent; }
-         * 
-         * String variable = request.getOptionalProperty("variable-true"); if
-         * (variable != null) { String value = (String)
-         * request.getContext().getVariable(variable); checkMade = true;
-         * allConditionsMet &= Attributes.isTrue(value); }
-         * 
-         * variable = request.getOptionalProperty("variable-equals"); if
-         * (variable != null) { String value = (String)
-         * request.getContext().getVariable(variable); checkMade = true;
-         * allConditionsMet &= variable.equals(value); }
-         */
-        // Check Object
-
-        /*
-         * // Check Collection String collection =
-         * request.getOptionalProperty("collection-" + TYPE); if (collection !=
-         * null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), collection); Class<?>
-         * cls = forClass(request); TypeOfFacet facet =
-         * object.getSpecification().getFacet(TypeOfFacet.class); boolean
-         * hasType = object != null && (cls == null ||
-         * cls.isAssignableFrom(facet.value())); checkMade = true;
-         * allConditionsMet &= hasType;; }
-         * 
-         * collection = request.getOptionalProperty("collection-" + "empty"); if
-         * (collection != null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); CollectionFacet
-         * facet = object.getSpecification().getFacet(CollectionFacet.class);
-         * boolean isEmpty = facet != null && facet.size(object) == 0;
-         * processTags(isEmpty, request); allConditionsMet &= isEmpty; }
-         */
-
-        // Check Methods
-        /*
-         * String method = request.getOptionalProperty(METHOD + "-exists"); if
-         * (method != null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); List<? extends
-         * ObjectAction> objectActions =
-         * object.getSpecification().getObjectActions(ActionType.USER); boolean
-         * methodExists = false; for (ObjectAction objectAssociation :
-         * objectActions) { if (objectAssociation.getId().equals(method)) {
-         * methodExists = true; break; } } checkMade = true; allConditionsMet &=
-         * methodExists; }
-         * 
-         * method = request.getOptionalProperty(METHOD + "-visible"); if (method
-         * != null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); // TODO needs to
-         * work irrespective of parameters ObjectAction objectAction =
-         * object.getSpecification().getObjectAction(ActionType.USER, method,
-         * ObjectSpecification.EMPTY_LIST); Consent visible =
-         * objectAction.isVisible(IsisContext.getAuthenticationSession(),
-         * object); checkMade = true; allConditionsMet &= visible.isAllowed(); }
-         * 
-         * method = request.getOptionalProperty(METHOD + "-usable"); if (method
-         * != null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); // TODO needs to
-         * work irrespective of parameters ObjectAction objectAction =
-         * object.getSpecification().getObjectAction(ActionType.USER, method,
-         * ObjectSpecification.EMPTY_LIST); Consent usable =
-         * objectAction.isUsable(IsisContext.getAuthenticationSession(),
-         * object); checkMade = true; allConditionsMet &= usable.isAllowed(); }
-         * 
-         * 
-         * // Check Fields String field = request.getOptionalProperty(FIELD +
-         * "-exists"); if (field != null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); List<? extends
-         * ObjectAssociation> objectFields =
-         * object.getSpecification().getAssociations(); boolean fieldExists =
-         * false; for (ObjectAssociation objectAssociation : objectFields) { if
-         * (objectAssociation.getId().equals(field)) { fieldExists = true;
-         * break; } } checkMade = true; allConditionsMet &= fieldExists; }
-         * 
-         * field = request.getOptionalProperty(FIELD + "-visible"); if (field !=
-         * null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
-         * objectField = object.getSpecification().getAssociation(field);
-         * Consent visible =
-         * objectField.isVisible(IsisContext.getAuthenticationSession(),
-         * object); checkMade = true; allConditionsMet &= visible.isAllowed(); }
-         * 
-         * field = request.getOptionalProperty(FIELD + "-editable"); if (field
-         * != null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
-         * objectField = object.getSpecification().getAssociation(field);
-         * Consent usable =
-         * objectField.isUsable(IsisContext.getAuthenticationSession(), object);
-         * checkMade = true; allConditionsMet &= usable.isAllowed(); }
-         * 
-         * field = request.getOptionalProperty(FIELD + "-empty"); if (field !=
-         * null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
-         * objectField = object.getSpecification().getAssociation(field);
-         * IsisContext.getPersistenceSession().resolveField(object,
-         * objectField); ObjectAdapter fld = objectField.get(object); if (fld ==
-         * null) { checkMade = true; allConditionsMet &= true; } else {
-         * CollectionFacet facet =
-         * fld.getSpecification().getFacet(CollectionFacet.class); boolean
-         * isEmpty = facet != null && facet.size(fld) == 0; processTags(isEmpty,
-         * request); allConditionsMet &= isEmpty; } }
-         * 
-         * field = request.getOptionalProperty(FIELD + "-set"); if (field !=
-         * null) { ObjectAdapter object =
-         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
-         * objectField = object.getSpecification().getAssociation(field);
-         * IsisContext.getPersistenceSession().resolveField(object,
-         * objectField); ObjectAdapter fld = objectField.get(object); if (fld ==
-         * null) { throw new ScimpiException("No object for field-set " +
-         * field); } Object fieldValue = fld.getObject(); if (fieldValue
-         * instanceof Boolean) { checkMade = true; allConditionsMet &=
-         * ((Boolean) fieldValue).booleanValue(); } else { checkMade = true;
-         * allConditionsMet &= true; } }
-         */
-
-        // Check User
-        /*
-         * String hasRole = request.getOptionalProperty("has-role"); if (hasRole
-         * != null) { AuthenticationSession session =
-         * IsisContext.getSession().getAuthenticationSession(); List<String>
-         * roles = session.getRoles(); boolean hasMatchingRole = false; for
-         * (String role : roles) { if (role.equals(hasRole.trim())) {
-         * hasMatchingRole = true; break; } } checkMade = true; allConditionsMet
-         * &= hasMatchingRole; }
-         */
-
-        final String persistent = request.getOptionalProperty("persistent");
-        if (persistent != null) {
-            final ObjectAdapter object = request.getContext().getMappedObjectOrResult(persistent);
-            checkMade = true;
-            allConditionsMet &= object.representsPersistent();
-        }
-        /*
-         * String type = request.getOptionalProperty(TYPE); if (type != null) {
-         * ObjectAdapter object = MethodsUtils.findObject(request.getContext(),
-         * id); Class<?> cls = forClass(request); boolean hasType = object !=
-         * null && (cls == null ||
-         * cls.isAssignableFrom(object.getObject().getClass())); checkMade =
-         * true; allConditionsMet &= hasType;; }
-         */
-        if (request.isPropertySpecified("empty")) {
-            if (request.isPropertySet("empty")) {
-                final String collection = request.getOptionalProperty("empty");
-                if (collection != null) {
-                    final ObjectAdapter object = request.getContext().getMappedObjectOrResult(collection);
-                    final CollectionFacet facet = object.getSpecification().getFacet(CollectionFacet.class);
-                    checkMade = true;
-                    allConditionsMet &= facet.size(object) == 0;
-                }
-            } else {
-                checkMade = true;
-                allConditionsMet &= true;
-            }
-        }
-
-        if (request.isPropertySpecified("set")) {
-            final boolean valuePresent = request.isPropertySet("set");
-            checkMade = true;
-            allConditionsMet &= valuePresent;
-        }
-
-        if (checkMade) {
-            processTags(allConditionsMet, request);
-        } else {
-            throw new ScimpiException("No condition in " + getName());
-        }
-    }
-
-    protected abstract void processTags(boolean isSet, Request request);
-
-}
-
-abstract class Test {
-    String name;
-    boolean negateResult;
-
-    abstract boolean test(Request request, String attributeName, String targetId);
-
-    protected Class<?> forClass(final String className) {
-        Class<?> cls = null;
-        if (className != null) {
-            try {
-                cls = Class.forName(className);
-            } catch (final ClassNotFoundException e) {
-                throw new ScimpiException("No class for " + className, e);
-            }
-        }
-        return cls;
-    }
-    
-    protected ObjectAction findMethod(final String attributeName, final ObjectAdapter object) {
-        final ObjectAction objectAction = object.getSpecification().getObjectAction(ActionType.USER, attributeName, ObjectSpecification.EMPTY_LIST);
-        if (objectAction == null) {
-            throw new ScimpiException("No such method found in " + object.getSpecification().getIdentifier().getClassName() + " : " + attributeName);
-        }
-        return objectAction;
-    }
-
-    protected ObjectAssociation findProperty(final String attributeName, final ObjectAdapter object) {
-        final ObjectAssociation objectField = object.getSpecification().getAssociation(attributeName);
-        if (objectField == null) {
-            throw new ScimpiException("No such property found in " + object.getSpecification().getIdentifier().getClassName() + ": " + attributeName);
-        }
-        return objectField;
-    }
-
-}
-
-class TestVariableExists extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        Object variable = request.getContext().getVariable(attributeName);
-        if (variable instanceof String && ((String) variable).equals("")) {
-            return false;
-        }
-        return variable != null;
-    }
-}
-
-class TestVariableTrue extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final Object variable = request.getContext().getVariable(attributeName);
-        final Boolean value = variable instanceof Boolean ? (Boolean) variable : Boolean.valueOf((String) variable);
-        return value != null && value.booleanValue();
-    }
-}
-
-class TestObjectPersistent extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(attributeName);
-        return object.representsPersistent();
-    }
-}
-
-class TestObjectType extends TestObjectPersistent {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final Class<?> cls = forClass(attributeName);
-        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(object.getObject().getClass()));
-        return hasType;
-    }
-}
-
-class TestCollectionType extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final Class<?> cls = forClass(attributeName);
-        final TypeOfFacet facet = object.getSpecification().getFacet(TypeOfFacet.class);
-        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(facet.value()));
-        return hasType;
-    }
-}
-
-class TestCollectionFull extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), attributeName);
-        final CollectionFacet facet = object.getSpecification().getFacet(CollectionFacet.class);
-        final boolean isEmpty = facet != null && facet.size(object) == 0;
-        return !isEmpty;
-    }
-}
-
-class TestMethodExists extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final List<? extends ObjectAction> objectActions = object.getSpecification().getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
-        boolean methodExists = false;
-        for (final ObjectAction objectAssociation : objectActions) {
-            if (objectAssociation.getId().equals(attributeName)) {
-                methodExists = true;
-                break;
-            }
-        }
-        return methodExists;
-    }
-}
-
-class TestMethodVisible extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        // TODO needs to work irrespective of parameters
-        final ObjectAction objectAction = findMethod(attributeName, object);
-        final Consent visible = objectAction.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
-        return visible.isAllowed();
-    }
-}
-
-class TestMethodUseable extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        // TODO needs to work irrespective of parameters
-        final ObjectAction objectAction = findMethod(attributeName, object);
-        final Consent usable = objectAction.isUsable(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
-        return usable.isAllowed();
-    }
-}
-
-class TestFieldExists extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final List<? extends ObjectAssociation> objectFields = object.getSpecification().getAssociations(Contributed.EXCLUDED);
-        boolean fieldExists = false;
-        for (final ObjectAssociation objectAssociation : objectFields) {
-            if (objectAssociation.getId().equals(attributeName)) {
-                fieldExists = true;
-                break;
-            }
-        }
-        return fieldExists;
-    }
-}
-
-class TestFieldVisible extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final ObjectAssociation objectField = findProperty(attributeName, object);
-        final Consent visible = objectField.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
-        return visible.isAllowed();
-    }
-}
-
-class TestFieldEditable extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final ObjectAssociation objectField = findProperty(attributeName, object);
-        final Consent usable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
-        return usable.isAllowed();
-    }
-}
-
-class TestFieldType extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final Class<?> cls = forClass(attributeName);
-        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(object.getObject().getClass()));
-        return hasType;
-    }
-}
-
-class TestFieldSet extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final ObjectAssociation objectField = findProperty(attributeName, object);
-
-        ResolveFieldUtil.resolveField(object, objectField);
-        final ObjectAdapter fld = objectField.get(object);
-        if (fld != null) {
-            final Object fieldValue = fld.getObject();
-            if (fieldValue instanceof Boolean) {
-                return ((Boolean) fieldValue).booleanValue();
-            } else if (fld.getSpecification().containsFacet(CollectionFacet.class)) {
-                final CollectionFacet facet = fld.getSpecification().getFacet(CollectionFacet.class);
-                final boolean isEmpty = facet != null && facet.size(fld) == 0;
-                return !isEmpty;
-            } else {
-                return true;
-            }
-        }
-        return false;
-    }
-}
-
-class TestFieldValue extends Test {
-    @Override
-    boolean test(Request request, String attributeName, String targetId) {
-        int pos = attributeName.indexOf("==");
-        // TODO test for other comparators
-        // TODO fail properly if none found
-        String fieldName = attributeName.substring(0, pos);
-        String fieldValue = attributeName.substring(pos + 2);
-        
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
-        final ObjectAssociation objectField = findProperty(fieldName, object);
-        ResolveFieldUtil.resolveField(object, objectField);
-        final ObjectAdapter fld = objectField.get(object);
-        
-        // TODO test for reference or value
-        final ObjectAdapter object2 = MethodsUtils.findObject(request.getContext(), fieldValue);
-        
-        if (fld == object2) {
-            return true;
-        }
-        return false;
-    }
-    
-}
-
-class TestHasRole extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final String[] requiredRoles = attributeName.split("\\|");
-        final AuthenticationSession session = IsisContext.getSession().getAuthenticationSession();
-        final List<String> sessionRoles = session.getRoles();
-        for (final String sessionRole : sessionRoles) {
-            for (final String requiredRole : requiredRoles) {
-                if (requiredRole.trim().equals(sessionRole)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-}
-
-class TestSet extends Test {
-    @Override
-    boolean test(final Request request, final String attributeName, final String targetId) {
-        final boolean valuePresent = request.isPropertySet("set");
-        return valuePresent;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
deleted file mode 100644
index b6798be..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public abstract class AbstractLink extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String title = request.getOptionalProperty(FORM_TITLE);
-        final String name = request.getOptionalProperty(NAME);
-        final boolean showAsButton = request.isRequested("show-as-button", false);
-        final String linkClass = request.getOptionalProperty(CLASS, showAsButton ? "button" : defaultLinkClass());
-        final String containerClass = request.getOptionalProperty(CONTAINER_CLASS, "action");
-        final String object = request.getOptionalProperty(OBJECT);
-        final RequestContext context = request.getContext();
-        String objectId = object != null ? object : (String) context.getVariable(RequestContext.RESULT);
-        ObjectAdapter adapter = MethodsUtils.findObject(context, objectId);
-
-        // REVIEW this is common used code
-        final String fieldName = request.getOptionalProperty(FIELD);
-        if (fieldName != null) {
-            final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
-            if (field == null) {
-                throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
-            }
-            
-            // REVIEW: should provide this rendering context, rather than hardcoding.
-            // the net effect currently is that class members annotated with 
-            // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-            // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-            // for any other value for Where
-            final Where where = Where.ANYWHERE;
-            
-            if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
-                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-            }
-            ResolveFieldUtil.resolveField(adapter, field);
-            adapter = field.get(adapter);
-            if (adapter != null) {
-                objectId = context.mapObject(adapter, Scope.INTERACTION);
-            }
-        }
-
-        if (adapter != null && valid(request, adapter)) {
-            final String variable = request.getOptionalProperty("param-name", RequestContext.RESULT);
-            final String variableSegment = variable + "=" + objectId;
-
-            String view = request.getOptionalProperty(VIEW);
-            if (view == null) {
-                view = defaultView();
-            }
-            view = context.fullUriPath(view);
-            final String classSegment = " class=\"" + linkClass + "\"";
-            final String titleSegment = title == null ? "" : (" title=\"" + title + "\"");
-            String additionalSegment = additionalParameters(request);
-            additionalSegment = additionalSegment == null ? "" : "&amp;" + additionalSegment;
-            if (showAsButton) {
-                request.appendHtml("<div class=\"" + containerClass + "\">");
-            }
-            request.appendHtml("<a" + classSegment + titleSegment + " href=\"" + view + "?" + variableSegment + context.encodedInteractionParameters() + additionalSegment + "\">");
-            request.pushNewBuffer();
-            request.processUtilCloseTag();
-            final String buffer = request.popBuffer();
-            if (buffer.trim().length() > 0) {
-                request.appendHtml(buffer);
-            } else {
-                request.appendAsHtmlEncoded(linkLabel(name, adapter));
-            }
-            request.appendHtml("</a>");
-            if (showAsButton) {
-                request.appendHtml("</div>");
-            }
-        } else {
-            request.skipUntilClose();
-        }
-    }
-
-    private String defaultLinkClass() {
-        return "action";
-    }
-
-    protected abstract String linkLabel(String name, ObjectAdapter object);
-
-    protected String additionalParameters(final Request request) {
-        return null;
-    }
-
-    protected abstract boolean valid(Request request, ObjectAdapter adapter);
-
-    protected abstract String defaultView();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java
deleted file mode 100644
index cea5d11..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class BlockDefine extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "block";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getOptionalProperty(NAME, "unamed");
-        final RepeatMarker start = request.createMarker();
-        request.skipUntilClose();
-        request.getContext().addVariable("_block-" + name, start, Scope.REQUEST);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java
deleted file mode 100644
index efd6128..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class BlockUse extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "use-block";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getOptionalProperty(NAME, "unamed");
-        request.closeEmpty();
-        final RepeatMarker end = request.createMarker();
-
-        final RepeatMarker marker = (RepeatMarker) request.getContext().getVariable("_block-" + name);
-        marker.repeat();
-
-        request.processUtilCloseTag();
-        end.repeat();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java
deleted file mode 100644
index 4106fd9..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Commit extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "commit";
-    }
-
-    @Override
-    public void process(final Request request) {
-        // Note - the session will have changed since the earlier call if a user
-        // has logged in or out in the action
-        // processing above.
-        final IsisTransactionManager transactionManager = IsisContext.getPersistenceSession().getTransactionManager();
-        if (transactionManager.getTransaction().getState().canCommit()) {
-            transactionManager.endTransaction();
-            transactionManager.startTransaction();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java
deleted file mode 100644
index ddda339..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ContentTag implements ElementProcessor {
-
-    @Override
-    public String getName() {
-        return "content";
-    }
-
-    @Override
-    public void process(final Request request) {
-        request.appendHtml("<!--  apply content  -->");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java
deleted file mode 100644
index 09e56b0..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class CookieValue extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        String name = request.getRequiredProperty(NAME);
-        String resultName = request.getOptionalProperty(RESULT_NAME, name);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-        
-        String cookieString = request.getContext().getCookie(name);
-        
-        request.appendDebug("    " + resultName + " (" + scope + ") set to " + cookieString + " from cookie " + name);
-        request.getContext().addVariable(resultName, cookieString, scope);
-    }
-
-    @Override
-    public String getName() {
-        return "cookie-value";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java
deleted file mode 100644
index 2cd9593..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class DefaultValue extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        // String sourceObjectId = objectOrResult(request);
-        final String variableName = request.getRequiredProperty(NAME);
-        final String defaultValue = request.getOptionalProperty(VALUE);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-
-        final RequestContext context = request.getContext();
-        final Object currentValue = context.getVariable(variableName);
-        if (currentValue == null) {
-            request.appendDebug("     " + variableName + " set to " + defaultValue + " (" + scope + ")");
-            context.addVariable(variableName, defaultValue, scope);
-        } else {
-            request.appendDebug("     " + variableName + " alreadt set to " + currentValue);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "default";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java
deleted file mode 100644
index ab43eb6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  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.view.simple;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.When;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.immutable.ImmutableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class EditLink extends AbstractLink {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    protected boolean valid(final Request request, final ObjectAdapter adapter) {
-        final ObjectSpecification specification = adapter.getSpecification();
-        final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        final List<ObjectAssociation> visibleFields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where));
-        final ImmutableFacet facet = specification.getFacet(ImmutableFacet.class);
-        final boolean isImmutable = facet != null && facet.when() == When.ALWAYS;
-        final boolean isImmutableOncePersisted = facet != null && facet.when() == When.ONCE_PERSISTED && adapter.representsPersistent();
-        return visibleFields.size() > 0 && !isImmutable && !isImmutableOncePersisted;
-    }
-
-    @Override
-    protected String linkLabel(final String name, final ObjectAdapter object) {
-        return "edit";
-    }
-
-    @Override
-    protected String defaultView() {
-        return Dispatcher.GENERIC + Dispatcher.EDIT + "." + Dispatcher.EXTENSION;
-    }
-
-    @Override
-    public String getName() {
-        return "edit-link";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java
deleted file mode 100644
index 1a37f99..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class EndSession extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.getContext().endHttpSession();
-    }
-
-    @Override
-    public String getName() {
-        return "end-session";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java
deleted file mode 100644
index e63ec92..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Forward extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "forward";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String view = request.getRequiredProperty(VIEW);
-        request.getContext().forward(view);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java
deleted file mode 100644
index f58b13f..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class GetCookie extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getRequiredProperty("name");
-        final String cookie = request.getContext().getCookie(name);
-
-        request.appendHtml(cookie);
-    }
-
-    @Override
-    public String getName() {
-        return "get-cookie";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java
deleted file mode 100644
index 1b66290..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Import extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.appendHtml("<!-- " + " import " + request.getOptionalProperty("file") + " -->");
-    }
-
-    @Override
-    public String getName() {
-        return "import";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java
deleted file mode 100644
index 1e3f47e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class InitializeFromCookie extends AbstractElementProcessor {
-    private static final String SEVEN_DAYS = Integer.toString(60 * 24 * 7);
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getRequiredProperty(NAME);
-
-        final RequestContext context = request.getContext();
-        if (context.getVariable(name) != null) {
-            request.skipUntilClose();
-        } else {
-            final String scopeName = request.getOptionalProperty(SCOPE);
-            final Scope scope = RequestContext.scope(scopeName, Scope.SESSION);
-
-            final String cookieName = request.getOptionalProperty("cookie", name);
-            final String cookieValue = context.getCookie(cookieName);
-            boolean hasObject;
-            if (cookieValue != null) {
-                try {
-                    context.getMappedObject(cookieValue);
-                    hasObject = true;
-                } catch (final ObjectNotFoundException e) {
-                    hasObject = false;
-                }
-            } else {
-                hasObject = false;
-            }
-
-            if (hasObject) {
-                request.skipUntilClose();
-                context.addVariable(name, cookieValue, scope);
-            } else {
-                final String expiresString = request.getOptionalProperty("expires", SEVEN_DAYS);
-                request.pushNewBuffer();
-                request.processUtilCloseTag();
-                request.popBuffer();
-                final String id = (String) context.getVariable(RequestContext.RESULT);
-                final ObjectAdapter variable = context.getMappedObject(id);
-                if (variable != null) {
-                    context.addCookie(cookieName, id, Integer.valueOf(expiresString));
-                    context.addVariable(name, id, scope);
-                }
-            }
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "initialize-from-cookie";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
deleted file mode 100644
index 375fdd2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class InitializeFromResult extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        disallowSourceAndDefault(request);
-        final String sourceObjectId = objectOrResult(request);
-        final Class<?> cls = forClass(request);
-        final String variableName = request.getRequiredProperty(NAME);
-        final String defaultObjectId = request.getOptionalProperty(DEFAULT);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-
-        final RequestContext context = request.getContext();
-        final ObjectAdapter sourceObject = context.getMappedObject(sourceObjectId);
-        final boolean isSourceSet = sourceObject != null;
-        final boolean isSourceAssignable = isSourceSet && (cls == null || cls.isAssignableFrom(sourceObject.getObject().getClass()));
-        if (isSourceAssignable) {
-            request.appendDebug("     " + variableName + " set to " + sourceObjectId + " (" + scope + ")");
-            context.addVariable(variableName, sourceObjectId, scope);
-        } else {
-            request.appendDebug("     " + variableName + " set to " + sourceObjectId + " (" + scope + ")");
-            if (defaultObjectId != null) {
-                context.addVariable(variableName, defaultObjectId, scope);
-            }
-            context.changeScope(variableName, scope);
-        }
-    }
-
-    private String objectOrResult(final Request request) {
-        final String sourceObjectId = request.getOptionalProperty(OBJECT);
-        if (sourceObjectId == null) {
-            return (String) request.getContext().getVariable(RequestContext.RESULT);
-        } else {
-            return sourceObjectId;
-        }
-    }
-
-    private void disallowSourceAndDefault(final Request request) {
-        if (request.getOptionalProperty(DEFAULT) != null && request.getOptionalProperty(OBJECT) != null) {
-            throw new ScimpiException("Cannot specify both " + OBJECT + " and " + DEFAULT + " for the " + getName() + " element");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "initialize";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java
deleted file mode 100644
index fe1474b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  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.view.simple;
-
-import java.util.Locale;
-import java.util.TimeZone;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * Displays the localization data for the current user.
- */
-public class Localization extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.closeEmpty();
-
-        org.apache.isis.applib.profiles.Localization localization = IsisContext.getLocalization();
-        if (localization != null) {
-            Locale locale = localization.getLocale();
-            String country = locale.getDisplayName();
-         //   country = locale.toString();
-            String timeZone = localization.getTimeZone().getDisplayName();
-            
-            request.appendAsHtmlEncoded(country + ", " + timeZone);
-        } else {
-            request.appendAsHtmlEncoded("No localization data!");
-        }
-        
-        Locale locale = Locale.getDefault();
-        String country = locale.getDisplayName();
-      //  country = locale.toString();
-        String timeZone = TimeZone.getDefault().getDisplayName();
-        
-        request.appendAsHtmlEncoded("\n (Default " + country + ", " + timeZone +")");
-
-    }
-
-    @Override
-    public String getName() {
-        return "alpha-localization";
-    }
-
-}


[17/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
deleted file mode 100644
index c1a01b4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- *  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.view.debug;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebugHtmlString;
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.util.Dump;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Debug extends AbstractElementProcessor {
-
-    private final Dispatcher dispatcher;
-
-    public Debug(final Dispatcher dispatcher) {
-        this.dispatcher = dispatcher;
-    }
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            return;
-        }
-        
-        final String type = request.getOptionalProperty(TYPE);
-
-        final boolean alwaysShow = request.isRequested("force", false);
-        if (type != null) {
-            if (type.equals("system")) {
-                displaySystem(request);
-            } else if (type.equals("session")) {
-                displaySession(request);
-            } else if (type.equals("test")) {
-                final DebugBuilder debug = new DebugHtmlString();
-                debug.appendTitle("Title");
-                debug.appendln("boolean", true);
-                debug.appendln("number", 213);
-                debug.startSection("Section 1");
-                debug.appendln("boolean", false);
-                debug.appendln("number", 12348);
-                debug.endSection();
-                debug.startSection("Section 2");
-                debug.appendln("boolean", false);
-                debug.appendln("number", 12348);
-                debug.appendTitle("Another title");
-                debug.appendln("boolean", false);
-                debug.appendln("number", 12348);
-                debug.endSection();
-
-                debug.startSection("Section 3");
-                debug.appendln("boolean", false);
-                debug.appendln("number", 89878);
-                debug.endSection();
-                debug.startSection("Subsection 2");
-                debug.appendln("boolean", false);
-                debug.appendln("number", 12348);
-                debug.endSection();
-
-                debug.startSection("Section 4");
-                debug.appendln("boolean", false);
-                debug.indent();
-                debug.appendln("boolean", false);
-                debug.appendln("number", 12348);
-                debug.unindent();
-                debug.appendln("number", 12348);
-                debug.appendPreformatted("code", "line 1\nline 2\nline 3");
-                debug.appendln("A lot of text etc.");
-                debug.endSection();
-
-                request.appendHtml(debug.toString());
-                //request.appendHtml("<pre>" + debug.toString() + "</pre>");
-                
-                debug.close();
-                
-            } else if (type.equals("variables")) {
-                displayVariables(request);
-            } else if (type.equals("dispatcher")) {
-                displayDispatcher(request);
-            } else if (type.equals("context")) {
-                displayContext(request);
-            } else if (type.equals("specifications")) {
-                listSpecifications(request);
-            } else if (type.equals("specification-for")) {
-                specificationFor(request);
-            } else if (type.equals("specification")) {
-                specification(request);
-            } else if (type.equals("specification-graph")) {
-                specificationGraph(request);
-            } else if (type.equals("object-graph")) {
-                objectGraph(request);
-
-            } else if (type.equals("object")) {
-                final String value = request.getOptionalProperty(VALUE);
-                final RequestContext context = request.getContext();
-                final ObjectAdapter object = context.getMappedObject(value);
-                final DebugString str = new DebugString();
-                Dump.adapter(object, str);
-                Dump.graph(object, IsisContext.getAuthenticationSession(), str);
-                request.appendHtml("<h2>" + object.getSpecification().getFullIdentifier() + "</h2>");
-                request.appendHtml("<pre class=\"debug\">" + str + "</pre>");
-            }
-
-        }
-
-        if (alwaysShow || request.getContext().getDebug() == RequestContext.Debug.ON) {
-
-            final RequestContext context = request.getContext();
-
-            final String id = request.getOptionalProperty("object");
-            if (id != null) {
-                final ObjectAdapter object = context.getMappedObject(id);
-                if (object instanceof DebuggableWithTitle) {
-                    final DebugString debug = new DebugString();
-                    ((DebuggableWithTitle) object).debugData(debug);
-                    request.appendHtml("<pre class=\"debug\">" + debug + "</pre>");
-                } else {
-                    request.appendHtml(object.toString());
-                }
-            }
-
-            final String variable = request.getOptionalProperty("variable");
-            if (variable != null) {
-                final Object object = context.getVariable(variable);
-                request.appendHtml(variable + " => " + (object == null ? "null" : object.toString()));
-            }
-
-            final String list = request.getOptionalProperty("list");
-            if (list != null) {
-                final DebugString debug = new DebugString();
-                context.append(debug, list);
-                request.appendHtml(debug.toString());
-            }
-
-            final String uri = request.getOptionalProperty("uri");
-            if (uri != null) {
-                request.appendHtml("<pre class=\"debug\">");
-                request.appendHtml(context.getUri());
-                request.appendHtml("</pre>");
-            }
-
-        }
-    }
-
-    protected void objectGraph(final Request request) {
-        final String id = request.getOptionalProperty(VALUE);
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        request.appendHtml("<h1>Object Graph - " + object + "</h1>");
-        request.appendHtml("<pre>");
-        final DebugBuilder debug = new DebugString();
-        Dump.graph(object, null, debug);
-        request.appendHtml(debug.toString());
-        request.appendHtml("</pre>");
-    }
-
-    protected void specificationFor(final Request request) {
-        final String id = request.getOptionalProperty(VALUE);
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        specification(request, object.getSpecification());
-    }
-
-    protected void specification(final Request request) {
-        final String name = request.getOptionalProperty(VALUE);
-        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
-        specification(request, spec);
-    }
-
-    private void specification(final Request request, final ObjectSpecification spec) {
-        request.appendHtml("<h1>Specification - " + spec.getFullIdentifier() + "</h1>");
-        request.appendHtml("<p><a href=\"./debug.shtml?type=specification-graph&value=" + spec.getFullIdentifier() + "\">Specification Graph</a></p>");
-        final DebugBuilder debug = new DebugHtmlString();
-        specification(spec, debug);
-        request.appendHtml(debug.toString());
-    }
-
-    protected void specificationGraph(final Request request) {
-        final String name = request.getOptionalProperty(VALUE);
-        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
-        request.appendHtml("<h1>Specification Graph - " + spec.getFullIdentifier() + "</h1>");
-        request.appendHtml("<p><a href=\"./debug.shtml?type=specification&value=" + spec.getFullIdentifier() + "\">Full Specification</a></p>");
-        request.appendHtml("<pre>");
-        final DebugBuilder debug = new DebugString();
-        debug.appendln(spec.getFullIdentifier());
-        debug.indent();
-        specificationGraph(spec, debug, new ArrayList<ObjectSpecification>());
-        debug.unindent();
-        request.appendHtml(debug.toString());
-        request.appendHtml("</pre>");
-    }
-
-    private void displayContext(final Request request) {
-        request.appendHtml("<h1>Context</h1>");
-        final DebugHtmlString debugString = new DebugHtmlString();
-        request.getContext().append(debugString);
-        debugString.close();
-        request.appendHtml(debugString.toString());
-    }
-
-    private void displayDispatcher(final Request request) {
-        request.appendHtml("<h1>Dispatcher</h1>");
-        final DebugHtmlString debugString = new DebugHtmlString();
-        dispatcher.debug(debugString);
-        debugString.close();
-        request.appendHtml(debugString.toString());
-    }
-
-    protected void displayVariables(final Request request) {
-        request.appendHtml("<h1>Variables</h1>");
-        final DebugHtmlString debug = new DebugHtmlString();
-        final RequestContext context = request.getContext();
-        context.append(debug, "variables");
-        debug.close();
-        request.appendHtml(debug.toString());
-    }
-
-    protected void displaySystem(final Request request) {
-        request.appendHtml("<h1>System</h1>");
-        final DebuggableWithTitle[] debugItems = IsisContext.debugSystem();
-        for (final DebuggableWithTitle debug : debugItems) {
-            final DebugHtmlString debugBuffer = new DebugHtmlString();
-            debugBuffer.startSection(debug.debugTitle());
-            debug.debugData(debugBuffer);
-            debugBuffer.endSection();
-            debugBuffer.close();
-            request.appendHtml(debugBuffer.toString());
-        }
-    }
-
-    protected void displaySession(final Request request) {
-        request.appendHtml("<h1>Session</h1>");
-        final DebuggableWithTitle[] debugItems = IsisContext.debugSession();
-        for (final DebuggableWithTitle debug : debugItems) {
-            final DebugHtmlString debugBuffer = new DebugHtmlString();
-            debugBuffer.startSection(debug.debugTitle());
-            debug.debugData(debugBuffer);
-            debugBuffer.endSection();
-            debugBuffer.close();
-            request.appendHtml(debugBuffer.toString());
-        }
-    }
-
-    protected void listSpecifications(final Request request) {
-        request.appendHtml("<h1>Specifications</h1>");
-        final List<ObjectSpecification> fullIdentifierList = new ArrayList<ObjectSpecification>(getSpecificationLoader().allSpecifications());
-        Collections.sort(fullIdentifierList, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
-        final DebugHtmlString debug = new DebugHtmlString();
-        for (final ObjectSpecification spec : fullIdentifierList) {
-            final String name = spec.getSingularName();
-            debug.appendln(name, specificationLink(spec));
-        }
-        debug.close();
-        request.appendHtml(debug.toString());
-    }
-
-    private String specificationLink(final ObjectSpecification specification) {
-        if (specification == null) {
-            return "none";
-        } else {
-            final String name = specification.getFullIdentifier();
-            return "<a href=\"./debug.shtml?type=specification&value=" + name + "\">" + name + "</a>";
-        }
-    }
-
-    protected SpecificationLoaderSpi getSpecificationLoader() {
-        return IsisContext.getSpecificationLoader();
-    }
-
-    @Override
-    public String getName() {
-        return "debug";
-    }
-
-    private void specificationGraph(final ObjectSpecification spec, final DebugBuilder view, final ArrayList<ObjectSpecification> visited) {
-        final List<ObjectAssociation> fields = new ArrayList<ObjectAssociation>(spec.getAssociations(Contributed.EXCLUDED));
-        Collections.sort(fields, new Comparator<ObjectAssociation>() {
-            @Override
-            public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
-                return o1.getName().compareTo(o2.getName());
-            }
-        });
-        for (int i = 0; i < fields.size(); i++) {
-            final ObjectAssociation field = fields.get(i);
-            final ObjectSpecification specification = field.getSpecification();
-            if (!specification.isValue()) {
-                final boolean contains = visited.contains(specification);
-                final String aggregated = specification.isParented() ? "++" : "";
-                view.appendln(aggregated + field.getName() + "  (<a href=\"./debug.shtml?type=specification-graph&value=" + specification.getFullIdentifier() + "\">" + specification.getFullIdentifier() + "</a>" + (contains ? "..." : "") + ")");
-                if (!contains) {
-                    visited.add(specification);
-                    view.indent();
-                    specificationGraph(specification, view, visited);
-                    view.unindent();
-                }
-            }
-        }
-
-    }
-
-    private void specification(final ObjectSpecification spec, final DebugBuilder view) {
-        view.startSection("Summary");
-        view.appendln("Hash code", "#" + Integer.toHexString(spec.hashCode()));
-        view.appendln("ID", spec.getIdentifier());
-        view.appendln("Full name", spec.getFullIdentifier());
-        view.appendln("Short name", spec.getShortIdentifier());
-        view.appendln("Singular name", spec.getSingularName());
-        view.appendln("Plural name", spec.getPluralName());
-        view.appendln("Description", spec.getDescription());
-
-        view.appendln("Type", "?");
-        view.appendln("Value/aggregated", String.valueOf(!spec.isValueOrIsParented()));
-
-        view.appendln("Parent specification", specificationLink(spec.superclass()));
-        specificationClasses(view, "Child specifications", spec.subclasses());
-        specificationClasses(view, "Implemented interfaces", spec.interfaces());
-        speficationFacets(view, spec);
-
-        final List<ObjectAssociation> fields = spec.getAssociations(Contributed.EXCLUDED);
-        specificationMembers(view, "Fields", fields);
-        final List<ObjectAction> userActions = spec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
-        specificationMembers(view, "User Actions", userActions);
-        specificationMembers(view, "Exploration Actions", spec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any()));
-        specificationMembers(view, "Prototype Actions", spec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any()));
-        specificationMembers(view, "Debug Actions", spec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any()));
-        view.endSection();
-
-        view.startSection("Fields");
-        for (int i = 0; i < fields.size(); i++) {
-            final ObjectAssociation field = fields.get(i);
-            view.appendTitle("<span id=\"" + field.getId() + "\"><em>Field:</em> " + field.getId() + "</span>");
-            view.appendln("ID", field.getIdentifier());
-            view.appendln("Short ID", field.getId());
-            view.appendln("Name", field.getName());
-            view.appendln("Specification", specificationLink(field.getSpecification()));
-
-            view.appendln("Type", field.isOneToManyAssociation() ? "Collection" : field.isOneToOneAssociation() ? "Object" : "Unknown");
-            view.appendln("Flags", (field.isAlwaysHidden() ? "" : "Visible ") + (field.isNotPersisted() ? "Not-Persisted " : " ") + (field.isMandatory() ? "Mandatory " : ""));
-
-            speficationFacets(view, field);
-        }
-        view.endSection();
-
-        view.startSection("Actions");
-        for (int i = 0; i < userActions.size(); i++) {
-            final ObjectAction action = userActions.get(i);
-            view.appendTitle("<span id=\"" + action.getId() + "\"><em>Action:</em> " + action.getId() + "</span>");
-            view.appendln("ID", action.getIdentifier());
-            view.appendln("Short ID", action.getId());
-            view.appendln("Name", action.getName());
-            view.appendln("Specification", specificationLink(action.getSpecification()));
-
-            view.appendln("On type", specificationLink(action.getOnType()));
-
-            final ObjectSpecification returnType = action.getReturnType();
-            view.appendln("Returns", returnType == null ? "VOID" : specificationLink(returnType));
-
-            speficationFacets(view, action);
-
-            final List<ObjectActionParameter> parameters = action.getParameters();
-            if (parameters.size() == 0) {
-                view.appendln("Parameters", "none");
-            } else {
-                final StringBuffer buffer = new StringBuffer();
-                final 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(")");
-                    view.appendln("Parameters", buffer.toString());
-
-                    view.indent();
-                    final Class<? extends Facet>[] parameterFacets = p.get(j).getFacetTypes();
-                    for (final Class<? extends Facet> parameterFacet : parameterFacets) {
-                        view.append(p.get(j).getFacet(parameterFacet).toString());
-                    }
-                    view.unindent();
-                }
-            }
-        }
-    }
-
-    private void specificationClasses(final DebugBuilder view, final String label, final List<ObjectSpecification> subclasses) {
-        final 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.appendln(label, buffer.toString());
-    }
-
-    private void specificationMembers(final DebugBuilder view, final String label, final List<? extends ObjectMember> members) {
-        final StringBuffer buffer = new StringBuffer();
-        if (members.size() == 0) {
-            buffer.append("none");
-        } else {
-            for (int i = 0; i < members.size(); i++) {
-                final ObjectMember member = members.get(i);
-                buffer.append("<a href=\"#" + members.get(i).getId() + "\">" + member.getId() + "</a>   <small>");
-                buffer.append(member.isAlwaysHidden() ? "" : "Visible ");
-                if (member.isPropertyOrCollection()) {
-                    buffer.append(((ObjectAssociation) member).isNotPersisted() ? "Not-Persisted " : " ");
-                    buffer.append(((ObjectAssociation) member).isMandatory() ? "Mandatory " : "");
-                }
-                buffer.append("</small></a><br>");
-            }
-        }
-        view.appendln(label, buffer.toString());
-    }
-
-    private void speficationFacets(final DebugBuilder view, final FacetHolder facetHolder) {
-        final List<Facet> facets = facetHolder.getFacets(new Filter<Facet>() {
-            @Override
-            public boolean accept(final Facet facet) {
-                return true;
-            }
-        });
-        final StringBuffer buffer = new StringBuffer();
-        if (facets == null || facets.size() == 0) {
-            buffer.append("none");
-        } else {
-            Collections.sort(facets, new Comparator<Facet>() {
-                @Override
-                public int compare(final Facet o1, final Facet o2) {
-                    final String facetType1 = o1.facetType().getName();
-                    final String facetType2 = o2.facetType().getName();
-                    return facetType1.substring(facetType1.lastIndexOf('.') + 1).compareTo(facetType2.substring(facetType2.lastIndexOf('.') + 1));
-                }
-            });
-            for (final Facet facet : facets) {
-                final String facetType = facet.facetType().getName();
-                buffer.append("<span class=\"facet-type\">" + facetType.substring(facetType.lastIndexOf('.') + 1) + "</span>:  " + facet + "<br>");
-            }
-        }
-        view.appendln("Facets", buffer.toString());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
deleted file mode 100644
index 796faf0..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class DebugAccessCheck extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            throw new ForbiddenException("Debug is disabled");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "debug-access-check";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
deleted file mode 100644
index 9137783..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  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.view.debug;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class DebugCollectionView extends AbstractObjectProcessor {
-
-    @Override
-    public void process(final Request request, final ObjectAdapter object) {
-        final String cls = request.getOptionalProperty(CLASS, "form");
-        final String classString = " class=\"" + cls + "\"";
-        String title = request.getOptionalProperty(FORM_TITLE);
-        final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
-        final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
-        final boolean showIcons = request.isRequested(SHOW_ICON, true);
-
-    }
-
-    private void write(final Request request, final ObjectAdapter object, final List<ObjectAssociation> fields,
-        final LinkedObject[] linkFields, final String classString, final String title, final String oddRowClass,
-        final String evenRowClass, final boolean showIcons) {
-        request.appendHtml("<div" + classString + ">");
-        if (title != null) {
-            request.appendHtml("<div class=\"title\">");
-            request.appendAsHtmlEncoded(title);
-            request.appendHtml("</div>");
-            HelpLink.append(request, object.getSpecification().getDescription(), object.getSpecification().getHelp());
-        }
-     /*   
-        final List<ObjectAssociation> fields =
-                tag.includedFields(object.getSpecification().getAssociations(
-                    ObjectAssociationFilters.STATICALLY_VISIBLE_ASSOCIATIONS));
-            final LinkedObject[] linkFields = tag.linkedFields(fields);
-
-            String linkAllView = request.getOptionalProperty(LINK);
-            if (linkAllView != null) {
-                linkAllView = request.getContext().fullUriPath(linkAllView);
-                for (int i = 0; i < linkFields.length; i++) {
-                    final boolean isObject = fields.get(i).isOneToOneAssociation();
-                    final boolean isNotParseable =
-                        !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
-                    linkFields[i] = isObject && isNotParseable ? new LinkedObject(linkAllView) : null;
-                }
-            }
-
-        
-        
-        int row = 1;
-        for (int i = 0; i < fields.size(); i++) {
-            final ObjectAssociation field = fields.get(i);
-            if (ignoreField(field)) {
-                continue;
-            }
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-                continue;
-            }
-
-            final String description =
-                field.getDescription().equals("") ? "" : "title=\"" + field.getDescription() + "\"";
-            String cls;
-            if (row++ % 2 == 1) {
-                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
-            } else {
-                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
-            }
-            request.appendHtml("<div " + cls + description + "><span class=\"label\">");
-            request.appendAsHtmlEncoded(field.getName());
-            request.appendHtml(":</span>");
-            final LinkedObject linkedObject = linkFields[i];
-            addField(request, object, field, linkedObject, showIcons);
-            HelpLink.append(request, field.getDescription(), field.getHelp());
-            request.appendHtml("</div>");
-        }
-        */
-        request.appendHtml("</div>");
-        
-    }
-
-
-    @Override
-    public String getName() {
-        return "debug-collection";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
deleted file mode 100644
index 020377d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *  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.view.debug;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldValue;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-
-public class DebugObjectView extends AbstractObjectProcessor {
-
-    @Override
-    public void process(final Request request, final ObjectAdapter object) {
-        final String classString = " class=\"" + request.getOptionalProperty(CLASS, "form debug") + "\"";
-        final String objectLink = request.getOptionalProperty(OBJECT + "-" + LINK_VIEW, request.getViewPath());
-        // final String collectionLink = request.getOptionalProperty(COLLECTION + "-" + LINK_VIEW, request.getViewPath());
-        final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
-        final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
-        final boolean showIcons = request.isRequested(SHOW_ICON, true);
-
-        ObjectSpecification specification = object.getSpecification();
-
-        request.appendHtml("<div" + classString + ">");
-        request.appendHtml("<div class=\"title\">");
-        request.appendAsHtmlEncoded(specification.getSingularName() + " - " + specification.getFullIdentifier());
-        request.appendHtml("</div>");
-
-        Version version = object.getVersion();
-        request.appendHtml("<div class=\"version\">");
-        request.appendAsHtmlEncoded("#" + version.sequence() + " - " + version.getUser() + " (" + version.getTime() + ")" );
-        request.appendHtml("</div>");
-
-        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.ALL);
-
-        int row = 1;
-        for (int i = 0; i < fields.size(); i++) {
-            final ObjectAssociation field = fields.get(i);
-            /*
-             * if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) { continue; }
-             */
-            String cls;
-            if (row++ % 2 == 1) {
-                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
-            } else {
-                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
-            }
-            request.appendHtml("<div " + cls + "><span class=\"label\">");
-            request.appendAsHtmlEncoded(field.getName());
-            request.appendHtml(":</span>");
-            
-            final boolean isNotParseable =
-                !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
-            LinkedObject linkedObject = null;
-            if (isNotParseable) {
-     //           linkedObject = new LinkedObject(field.isOneToManyAssociation() ? collectionLink : objectLink);
-                linkedObject = new LinkedObject(objectLink);
-            }
-            addField(request, object, field, linkedObject, showIcons);
-            
-            if (field.isOneToManyAssociation()) {
-                Collection collection = (Collection) field.get(object).getObject();
-                if (collection.size() == 0) {
-                    request.appendHtml("[empty]");
-                } else {
-                    // request.appendHtml(collection.size() + " elements");
-                   
-                    request.appendHtml("<ol>");
-                    
-                   for (Object element : collection) {
-                       ObjectAdapter adapterFor = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(element);
-                       IsisContext.getPersistenceSession().resolveImmediately(adapterFor);
-
-                       String id = request.getContext().mapObject(adapterFor, linkedObject.getScope(), Scope.INTERACTION);
-
-                       request.appendHtml("<li class=\"element\">");
-                       request.appendHtml("<a href=\"" + linkedObject.getForwardView() + "?" + linkedObject.getVariable() + "="
-                               + id + request.getContext().encodedInteractionParameters() + "\">");
-                       request.appendHtml(element.toString());
-                       request.appendHtml("</a></li>");
-                   }
-                   request.appendHtml("</ol>");
-                }
-            } else {
-                FieldValue.write(request, object, field, linkedObject, "value", showIcons, 0);
-            }
-
-            
-            
-            request.appendHtml("</div>");
-        }
-        request.appendHtml("</div>");
-    }
-
-    protected void addField(
-            final Request request,
-            final ObjectAdapter object,
-            final ObjectAssociation field,
-            final LinkedObject linkedObject,
-            final boolean showIcons) {
-     }
-
-    @Override
-    public String getName() {
-        return "debug-object";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
deleted file mode 100644
index 795d272..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class DebuggerLink extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            request.skipUntilClose();
-            return;
-        }
-
-        final RequestContext context = request.getContext();
-        final Object result = context.getVariable(RequestContext.RESULT);
-        request.appendHtml("<div class=\"debug\">");
-        request.appendHtml("<a class=\"debug-link\" href=\"/debug/debug.shtml\" target=\"debug\" title=\"debug\" >...</a>");
-        if (result != null) {
-            request.appendHtml(" <a href=\"/debug/object.shtml?_result=" + result + "\" target=\"debug\"  title=\"debug instance\">...</a>");
-        }
-        request.appendHtml(" <span class=\"debug-link\" onclick=\"$('#page-debug').toggle()\" alt=\"show/hide debug details\">...</span>");
-        request.appendHtml("</div>");
-
-        request.processUtilCloseTag();
-    }
-
-    @Override
-    public String getName() {
-        return "debugger";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
deleted file mode 100644
index 037812e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.debug.DebugHtmlString;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Diagnostics extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            return;
-        }
-
-        final String type = request.getOptionalProperty(TYPE, "page");
-        final boolean isForced = request.isRequested("force");
-        if (isForced || request.getContext().showDebugData()) {
-            request.appendHtml("<div class=\"debug\">");
-            if ("page".equals(type)) {
-                request.appendHtml("<pre>");
-                final RequestContext context = request.getContext();
-                request.appendHtml("URI:  " + context.getUri());
-                request.appendHtml("\n");
-                request.appendHtml("File: " + context.fullFilePath(context.getResourceFile()));
-                final String result = (String) request.getContext().getVariable(RequestContext.RESULT);
-                if (result != null) {
-                    request.appendHtml("\n");
-                    request.appendHtml("Object: " + result);
-                }
-                request.appendHtml("</pre>");
-            } else if ("session".equals(type)) {
-                request.appendHtml("<pre>");
-                final AuthenticationSession session = IsisContext.getAuthenticationSession();
-                request.appendHtml("Session:  " + session.getUserName() + " " + session.getRoles());
-                request.appendHtml("</pre>");
-            } else if ("variables".equals(type)) {
-                final RequestContext context = request.getContext();
-                final DebugHtmlString debug = new DebugHtmlString();
-                debug.appendln("", "");
-                context.append(debug, "variables");
-                debug.close();
-                request.appendHtml(debug.toString());
-            } else if ("processing".equals(type)) {
-                request.appendHtml("<pre>");
-                request.appendHtml(request.getContext().getDebugTrace());
-                request.appendHtml("</pre>");
-            } else {
-                request.appendHtml("<i>No such type " + type + "</i>");
-            }
-            request.appendHtml("</div>");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "diagnostics";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
deleted file mode 100644
index 92db889..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Log extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        String name = request.getRequiredProperty(NAME);
-        Logger logger = LoggerFactory.getLogger(name);
-        
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        final String message = request.popBuffer();
-        logger.info(message);
-    }
-
-    @Override
-    public String getName() {
-        return "log";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
deleted file mode 100644
index 66e2d6d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class LogLevel extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-
-        String view = request.getOptionalProperty(VIEW, request.getViewPath());
-        view = request.getContext().fullFilePath(view);
-        final org.apache.log4j.Level level = org.apache.log4j.LogManager.getRootLogger().getLevel();
-        final boolean showSelector = request.isRequested(SHOW_SELECT, true);
-        if (showSelector) {
-            request.appendHtml("<form action=\"log.app\" type=\"post\" >");
-            request.appendHtml("<input type=\"hidden\" name=\"view\" value=\"" + view + "\" />");
-            request.appendHtml("<select name=\"level\">");
-            for (final org.apache.log4j.Level l : new org.apache.log4j.Level[] { org.apache.log4j.Level.OFF, org.apache.log4j.Level.FATAL, org.apache.log4j.Level.ERROR, org.apache.log4j.Level.WARN, org.apache.log4j.Level.INFO, org.apache.log4j.Level.DEBUG, org.apache.log4j.Level.TRACE }) {
-                final String settings = level + "\"" + (level == l ? " selected=\"selected\" " : "");
-                request.appendHtml("<option " + settings + ">" + l + "</option>");
-            }
-            request.appendHtml("<input type=\"submit\" value=\"Change Level\" />");
-            request.appendHtml("</select>");
-            request.appendHtml("</form>");
-        } else {
-            request.appendHtml(level.toString());
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "log-level";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
deleted file mode 100644
index 54ff196..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  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.view.debug;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Members extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public String getName() {
-        return "members";
-    }
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            return;
-        }
-
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getOptionalProperty(FIELD);
-        request.appendHtml("<pre class=\"debug\">");
-        try {
-            ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-            ObjectAssociation field = null;
-            if (fieldName != null) {
-                field = object.getSpecification().getAssociation(fieldName);
-                if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-                    throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-                }
-                object = field.get(object);
-            }
-            request.processUtilCloseTag();
-
-            final ObjectSpecification specification = field == null ? object.getSpecification() : field.getSpecification();
-
-            request.appendHtml(specification.getSingularName() + " (" + specification.getFullIdentifier() + ") \n");
-            final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
-            for (final ObjectAssociation fld : fields) {
-                if (!fld.isAlwaysHidden()) {
-                    request.appendHtml("   " + fld.getId() + " - '" + fld.getName() + "' -> " + fld.getSpecification().getSingularName() + (fld.isOneToManyAssociation() ? " (collection of)" : "") + "\n");
-                }
-            }
-            request.appendHtml("   --------------\n");
-            final List<ObjectAction> actions = specification.getObjectActions(
-                    ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            ;
-            for (final ObjectAction action : actions) {
-                request.appendHtml("   " + action.getId() + " (");
-                boolean first = true;
-                for (final ObjectActionParameter parameter : action.getParameters()) {
-                    if (!first) {
-                        request.appendHtml(", ");
-                    }
-                    request.appendHtml(parameter.getSpecification().getSingularName());
-                    first = false;
-                }
-                request.appendHtml(")" + " - '" + action.getName() + "'");
-                if (action.getSpecification() != null) {
-                    request.appendHtml(" -> " + action.getSpecification().getSingularName() + ")");
-                }
-                request.appendHtml("\n");
-            }
-        } catch (final ScimpiException e) {
-            request.appendHtml("Debug failed: " + e.getMessage());
-        }
-        request.appendHtml("</pre>");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
deleted file mode 100644
index 895f9a6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ShowDebug extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            request.skipUntilClose();
-        } else {
-            request.processUtilCloseTag();
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "show-debug";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
deleted file mode 100644
index 0974fe4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *  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.view.debug;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-
-public class Specification extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final RequestContext context = request.getContext();
-        if (context.isDebugDisabled()) {
-            return;
-        }
-
-        if (request.isRequested("always") || context.getDebug() == RequestContext.Debug.ON) {
-            request.appendHtml("<div class=\"debug\">");
-            request.appendHtml("<pre>");
-
-            final String id = request.getOptionalProperty("object");
-            final ObjectAdapter object = context.getMappedObjectOrResult(id);
-            final ObjectSpecification specification = object.getSpecification();
-            String type = request.getOptionalProperty(TYPE, "details");
-
-            if (type.equals("graph")) {
-                specificationGraph(request, specification, null, new ArrayList<ObjectSpecification>(), 0);
-            } else if (type.equals("details")) {
-                specificationDetails(request, specification);
-            } else {
-                request.appendHtml("invalid type: " + type);
-            }
-
-            request.appendHtml("</pre>");
-            request.appendHtml("</div>");
-        }
-    }
-
-    private void specificationDetails(final Request request, final ObjectSpecification specification) {
-        renderName(request, specification);
-        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
-        for (int i = 0; i < fields.size(); i++) {
-            request.appendHtml("    " + fields.get(i).getName() + " (" + fields.get(i).getSpecification().getSingularName()
-                    + ") \n");
-        }
-    }
-
-    private void specificationGraph(
-            Request request,
-            ObjectSpecification specification,
-            String fieldName,
-            List<ObjectSpecification> processed,
-            int level) {
-        if (processed.contains(specification)) {
-            return;
-        }
-
-        request.appendHtml(StringExtensions.repeat("    ", level));
-        if (processed.contains(specification)) {
-            request.appendHtml("* ");
-        }
-        request.appendHtml(specification.getFullIdentifier());
-        if (fieldName != null) {
-            request.appendHtml(" (" + fieldName + ")");
-        }
-        request.appendHtml("\n");
-
-        if (processed.contains(specification)) {
-            return;
-        }
-        processed.add(specification);
-
-        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
-        for (int i = 0; i < fields.size(); i++) {
-            ObjectSpecification fieldSpecification = fields.get(i).getSpecification();
-            if (fieldSpecification.isValue()) {
-                continue;
-            }
-            specificationGraph(request, fieldSpecification, fields.get(i).getName(), processed, level + 1);
-        }
-    }
-
-    private void renderName(final Request request, final ObjectSpecification specification) {
-        request.appendHtml(specification.getSingularName() + " (" + specification.getFullIdentifier() + ") \n");
-    }
-
-    @Override
-    public String getName() {
-        return "specification";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
deleted file mode 100644
index 65af85e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  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.view.debug;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ThrowException extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        if (request.getContext().isDebugDisabled()) {
-            return;
-        }
-
-        final String message = request.getOptionalProperty("message", "Exception throw for testing purposes");
-        throw new IsisException(message);
-    }
-
-    @Override
-    public String getName() {
-        return "debug-exception";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
deleted file mode 100644
index e88f89a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedFieldsBlock;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public abstract class AbstractFormView extends AbstractObjectProcessor {
-
-    @Override
-    public String checkFieldType(final ObjectAssociation objectField) {
-        return objectField.isOneToOneAssociation() ? null : "is not an object";
-    }
-
-    @Override
-    public void process(final Request request, final ObjectAdapter object) {
-        final LinkedFieldsBlock tag = new LinkedFieldsBlock();
-
-        if (object != null) {
-            final String id = request.getOptionalProperty(ID, object.getSpecification().getShortIdentifier()); 
-            final String cls = request.getOptionalProperty(CLASS, "form");
-            final String classString = " id=\"" + id + "\" class=\"" + cls + "\"";
-            String title = request.getOptionalProperty(FORM_TITLE);
-            final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
-            final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
-            final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
-            final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault()); 
-            String linkAllView = request.getOptionalProperty(LINK_VIEW);
-
-            request.setBlockContent(tag);
-            request.processUtilCloseTag();
-
-            final AuthenticationSession session = IsisContext.getAuthenticationSession(); 
-            List<ObjectAssociation> associations = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, Where.OBJECT_FORMS));
-            final List<ObjectAssociation> fields = tag.includedFields(associations);
-            final LinkedObject[] linkFields = tag.linkedFields(fields);
-
-            if (linkAllView != null) {
-                linkAllView = request.getContext().fullUriPath(linkAllView);
-                for (int i = 0; i < linkFields.length; i++) {
-                    final boolean isObject = fields.get(i).isOneToOneAssociation();
-                    final boolean isNotParseable = !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
-                    linkFields[i] = isObject && isNotParseable ? new LinkedObject(linkAllView) : null;
-                }
-            }
-
-            if (title == null) {
-                title = object.getSpecification().getSingularName();
-            } else if (title.equals("")) {
-                title = null;
-            }
-
-            write(request, object, fields, linkFields, classString, title, labelDelimiter, oddRowClass, evenRowClass, showIcons);
-        } else {
-            request.skipUntilClose(); 
-        }
-    }
-
-    private void write(
-            final Request request,
-            final ObjectAdapter object,
-            final List<ObjectAssociation> fields,
-            final LinkedObject[] linkFields,
-            final String classString,
-            final String title,
-            final String labelDelimiter,
-            final String oddRowClass,
-            final String evenRowClass,
-            final boolean showIcons) {
-        request.appendHtml("<div" + classString + ">");
-        if (title != null) {
-            request.appendHtml("<div class=\"title\">");
-            request.appendAsHtmlEncoded(title);
-            request.appendHtml("</div>");
-            HelpLink.append(request, object.getSpecification().getDescription(), object.getSpecification().getHelp());
-        }
-        int row = 1;
-        for (int i = 0; i < fields.size(); i++) {
-            final ObjectAssociation field = fields.get(i);
-            if (ignoreField(field)) {
-                continue;
-            }
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.OBJECT_FORMS).isVetoed()) {
-                continue;
-            }
-
-            final String description = field.getDescription().equals("") ? "" : "title=\"" + field.getDescription() + "\"";
-            String cls;
-            if (row++ % 2 == 1) {
-                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
-            } else {
-                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
-            }
-            request.appendHtml("<div " + cls + description + "><span class=\"label\">");
-            request.appendAsHtmlEncoded(field.getName());
-            request.appendHtml(labelDelimiter + "</span>");
-            final LinkedObject linkedObject = linkFields[i];
-            addField(request, object, field, linkedObject, showIcons);
-            HelpLink.append(request, field.getDescription(), field.getHelp());
-            request.appendHtml("</div>");
-        }
-        request.appendHtml("</div>");
-    }
-
-    protected void addField(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
-        FieldValue.write(request, object, field, linkedObject, null, showIcons, 0);
-    }
-
-    protected boolean ignoreField(final ObjectAssociation objectField) {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
deleted file mode 100644
index 286d84d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.Iterator;
-import java.util.List;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-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.processor.Request;
-
-public abstract class AbstractTableView extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with
-    // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
-    // be hidden from all tables but will be visible/enabled (perhaps incorrectly) 
-    // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
-    private final Where where = Where.ALL_TABLES;
-
-    @Override
-    public void process(final Request request) {
-        final RequestContext context = request.getContext();
-
-        ObjectAdapter collection;
-        String parentObjectId = null;
-        boolean isFieldEditable = false;
-        final String field = request.getOptionalProperty(FIELD);
-        final String tableClass = request.getOptionalProperty(CLASS);
-        ObjectSpecification elementSpec;
-        String tableId;
-        if (field != null) {
-            final String objectId = request.getOptionalProperty(OBJECT);
-            final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
-            if (object == null) {
-                throw new ScimpiException("No object for result or " + objectId);
-            }
-            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
-            if (!objectField.isOneToManyAssociation()) {
-                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
-            }
-            isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
-            ResolveFieldUtil.resolveField(object, objectField);
-            collection = objectField.get(object);
-            final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
-            elementSpec = facet.valueSpec();
-            parentObjectId = objectId == null ? context.mapObject(object, Scope.REQUEST) : objectId;
-            tableId = request.getOptionalProperty(ID, field);
-        } else {
-            final String id = request.getOptionalProperty(COLLECTION);
-            collection = context.getMappedObjectOrResult(id);
-            elementSpec = collection.getElementSpecification();
-            tableId = request.getOptionalProperty(ID, collection.getElementSpecification().getShortIdentifier());
-        }
-
-        final String summary = request.getOptionalProperty("summary");
-        final String rowClassesList = request.getOptionalProperty(ROW_CLASSES, ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
-        String[] rowClasses = null;
-        if (rowClassesList.length() > 0) {
-            rowClasses = rowClassesList.split("[,|/]");
-        }
-
-        final List<ObjectAssociation> allFields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
-        final TableContentWriter rowBuilder = createRowBuilder(request, context, isFieldEditable ? parentObjectId : null, allFields, collection);
-        write(request, collection, summary, rowBuilder, tableId, tableClass, rowClasses);
-
-    }
-
-    protected PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    protected abstract TableContentWriter createRowBuilder(final Request request, RequestContext context, final String parent, final List<ObjectAssociation> allFields, ObjectAdapter collection);
-
-    public static void write(
-            final Request request,
-            final ObjectAdapter collection,
-            final String summary,
-            final TableContentWriter rowBuilder,
-            final String tableId,
-            final String tableClass,
-            final String[] rowClasses) {
-        final RequestContext context = request.getContext();
-
-        final String summarySegment = summary == null ? "" : (" summary=\"" + summary + "\"");
-        final String idSegment = tableId == null ? "" : (" id=\"" + tableId + "\""); 
-        final String classSegment = tableClass == null ? "" : (" class=\"" + tableClass + "\"");
-        request.appendHtml("<table" + idSegment + classSegment + summarySegment + ">");
-        rowBuilder.writeCaption(request);
-        rowBuilder.writeHeaders(request);
-        rowBuilder.writeFooters(request);
-
-        request.appendHtml("<tbody>");
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        int row = 1;
-        while (iterator.hasNext()) {
-            final ObjectAdapter element = iterator.next();
-
-            context.addVariable("row", "" + (row), Scope.REQUEST);
-            String cls = "";
-            if (rowClasses != null) {
-                cls = " class=\"" + rowClasses[row % rowClasses.length] + "\"";
-            }
-            request.appendHtml("<tr" + cls + ">");
-            rowBuilder.writeElement(request, context, element);
-            request.appendHtml("</tr>");
-            row++;
-        }
-        request.appendHtml("</tbody>");
-        request.appendHtml("</table>");
-        
-        rowBuilder.tidyUp();
-    }
-
-    @Override
-    public String getName() {
-        return "table";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
deleted file mode 100644
index 7076f70..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class AddMessage extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        final String content = request.popBuffer();
-
-        final MessageBroker messageBroker = IsisContext.getMessageBroker();
-        messageBroker.addMessage(content);
-    }
-
-    @Override
-    public String getName() {
-        return "add-message";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
deleted file mode 100644
index ac0d240..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class AddWarning extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        final String content = request.popBuffer();
-
-        final MessageBroker messageBroker = IsisContext.getMessageBroker();
-        messageBroker.addWarning(content);
-    }
-
-    @Override
-    public String getName() {
-        return "add-warning";
-    }
-
-}


[12/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java
deleted file mode 100644
index 39a703a..0000000
--- a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *  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.servlet;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.ServletContext;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-/**
- * ImageLookup provides an efficient way of finding the most suitable image to
- * use. It ensures that an image is always available, providing a default image
- * if needed. All requests are cached to improve performance.
- */
-// TODO allow for multiple extension types
-public class ImageLookup {
-    private static final Logger LOG = LoggerFactory.getLogger(ImageLookup.class);
-    private static final String UNKNOWN_IMAGE = "Default";
-    private static final String[] EXTENSIONS = { "png", "gif", "jpg", "jpeg" };
-    private static final Map images = new HashMap();
-    private static String imageDirectory;
-    // private static String unknownImageFile;
-    private static ServletContext context;
-
-    public static void setImageDirectory(final ServletContext context, String imageDirectory) {
-        LOG.debug("image directory required for: " + imageDirectory);
-        ImageLookup.context = context;
-        imageDirectory = (imageDirectory.startsWith("/") ? "" : "/") + imageDirectory + "/";
-        final Set resourcePaths = context.getResourcePaths(imageDirectory);
-        if (resourcePaths == null || resourcePaths.size() == 0) {
-            //throw new IsisException("No image directory found: " + imageDirectory);
-            LOG.warn("No image directory found: " + imageDirectory);
-        }
-        LOG.info("image directory set to: " + imageDirectory);
-        ImageLookup.imageDirectory = imageDirectory;
-    }
-
-    public static void debug(final DebugString debug) {
-        debug.appendTitle("Image Lookup");
-        debug.indent();
-        final Iterator keys = images.keySet().iterator();
-        while (keys.hasNext()) {
-            final Object key = keys.next();
-            final Object value = images.get(key);
-            debug.appendln(key + " -> " + value);
-        }
-        debug.unindent();
-    }
-
-    private static String imageFile(final String imageName, final String contextPath) {
-        for (final String element : EXTENSIONS) {
-            URL resource;
-            try {
-                final String imagePath = imageDirectory + imageName + "." + element;
-                resource = context.getResource(imagePath);
-                if (resource != null) {
-                    LOG.debug("image found at " + contextPath + imagePath);
-                    return contextPath + imagePath;
-                }
-                final URL onClasspath = ImageLookup.class.getResource(imagePath);
-                if (onClasspath != null) {
-                    LOG.debug("image found on classpath " + onClasspath);
-                    return contextPath + imagePath;
-                }
-            } catch (final MalformedURLException ignore) {
-            }
-        }
-        return null;
-    }
-
-    private static String findImage(final ObjectSpecification specification, final String contextPath) {
-        String path = findImageFor(specification, contextPath);
-        if (path == null) {
-            path = imageFile(UNKNOWN_IMAGE, contextPath);
-        }
-        return path;
-    }
-
-    private static String findImageFor(final ObjectSpecification specification, final String contextPath) {
-        final String name = specification.getShortIdentifier();
-        final String fileName = imageFile(name, contextPath);
-        if (fileName != null) {
-            images.put(name, fileName);
-            return fileName;
-        } else {
-            for (final ObjectSpecification interfaceSpec : specification.interfaces()) {
-                final String path = findImageFor(interfaceSpec, contextPath);
-                if (path != null) {
-                    return path;
-                }
-            }
-            final ObjectSpecification superclass = specification.superclass();
-            if (superclass != null) {
-                return findImageFor(superclass, contextPath);
-            } else {
-                return null;
-            }
-        }
-    }
-
-    /**
-     * For an object, the icon name from the object is return if it is not null,
-     * otherwise the specification is used to look up a suitable image name.
-     * 
-     * @param contextPath
-     * 
-     * @see ObjectAdapter#getIconName()
-     * @see #imagePath(ObjectSpecification)
-     */
-    /*
-     * public static String imagePath(ObjectAdapter object) { String iconName =
-     * object.getIconName(); if (iconName != null) { return imagePath(iconName);
-     * } else { return imagePath(object.getSpecification()); } }
-     */
-    public static String imagePath(final ObjectSpecification specification, final String contextPath) {
-        final String name = specification.getShortIdentifier();
-        final String imageName = (String) images.get(name);
-        if (imageName != null) {
-            return imageName;
-        } else {
-            return findImage(specification, contextPath);
-        }
-    }
-
-    /*
-     * public static String imagePath(String name) { String imageName = (String)
-     * images.get(name); if (imageName != null) { return (String) imageName; }
-     * else { String fileName = imageFile(name); return fileName == null ?
-     * unknownImageFile : fileName; } }
-     */
-
-    public static String imagePath(final ObjectAdapter object, final String contextPath) {
-        final String name = object.getIconName();
-        final String imageName = (String) images.get(name);
-        if (imageName != null) {
-            return imageName;
-        } else {
-            final String imageFile = imageFile(name, contextPath);
-            if (imageFile != null) {
-                return imageFile;
-            } else {
-                return findImage(object.getSpecification(), contextPath);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
deleted file mode 100644
index 9b01b60..0000000
--- a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- *  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.servlet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-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.viewer.scimpi.dispatcher.DispatchException;
-import org.apache.isis.viewer.scimpi.dispatcher.ErrorCollator;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiNotFoundException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUsers;
-
-public class ServletRequestContext extends RequestContext {
-    private HttpServletRequest request;
-    private HttpServletResponse response;
-    private ServletContext servletContext;
-    private boolean isAborted;
-
-    public ServletRequestContext(final DebugUsers debugUsers) {
-        super(debugUsers);
-    }
-
-    public void append(final DebugBuilder view) {
-        super.append(view);
-
-        /*
-         * view.divider("System"); Runtime.getRuntime().
-         */
-        view.startSection("HTTP Serviet Request");
-        view.appendTitle("General");
-        view.appendln("Auth type", request.getAuthType());
-        view.appendln("Character encoding", request.getCharacterEncoding());
-        view.appendln("Class", request.getClass());
-        view.appendln("Content type", request.getContentType());
-        view.appendln("Context path", getContextPath());
-        view.appendln("Locale", request.getLocale());
-        view.appendln("Method", request.getMethod());
-        view.appendln("Path info", request.getPathInfo());
-        view.appendln("Path translated", request.getPathTranslated());
-        view.appendln("Protocol", request.getProtocol());
-        view.appendln("Query string", request.getQueryString());
-        view.appendln("Remote host", request.getRemoteHost());
-        view.appendln("Remote user", request.getRemoteUser());
-        view.appendln("Real path", servletContext.getRealPath("/"));
-        view.appendln("Scheme", request.getScheme());
-        view.appendln("Server name", request.getServerName());
-        view.appendln("Servlet path", request.getServletPath());
-        view.appendln("Session", request.getSession());
-        view.appendln("Session ID", request.getRequestedSessionId());
-        view.appendln("URI", request.getRequestURI());
-        view.appendln("URL", request.getRequestURL());
-        view.appendln("User principle", request.getUserPrincipal());
-
-        
-        final Cookie[] cookies = request.getCookies();
-        if (cookies != null) {
-            view.appendTitle("Cookies");
-            for (final Cookie cookie : cookies) {
-                view.appendln(cookie.getName(), cookie.getValue());
-            }
-        }
-        
-        final Enumeration attributeNames = request.getAttributeNames();
-        if (attributeNames.hasMoreElements()) {
-            view.appendTitle("Attributes");
-            while (attributeNames.hasMoreElements()) {
-                final String name = (String) attributeNames.nextElement();
-                view.appendln(name, request.getAttribute(name));
-            }
-        }
-
-        view.appendTitle("Headers");
-        final Enumeration headerNames = request.getHeaderNames();
-        while (headerNames.hasMoreElements()) {
-            final String name = (String) headerNames.nextElement();
-            view.appendln(name, request.getHeader(name));
-        }
-
-        view.appendTitle("Parameters");
-        final Enumeration parameterNames = request.getParameterNames();
-        while (parameterNames.hasMoreElements()) {
-            final String name = (String) parameterNames.nextElement();
-            view.appendln(name, request.getParameter(name));
-        }
-
-        view.appendTitle("Servlet Context");
-        final ServletContext context = getServletContext();
-        view.appendln("Name", context.getServletContextName());
-        view.appendln("Server Info", context.getServerInfo());
-        view.appendln("Version", context.getMajorVersion() + "." + context.getMinorVersion());
-        view.appendln("Attributes", getAttributes(context));
-        view.appendln("Init parameters", getParameters(context));
-        view.appendln("Real path", context.getRealPath("/"));
-    }
-
-    private String getAttributes(final ServletContext context) {
-        final StringBuffer buf = new StringBuffer();
-        final Enumeration names = context.getAttributeNames();
-        while (names.hasMoreElements()) {
-            final String name = (String) names.nextElement();
-            buf.append(name + "=" + context.getAttribute(name));
-        }
-        return buf.toString();
-    }
-
-    private String getParameters(final ServletContext context) {
-        final StringBuffer buf = new StringBuffer();
-        final Enumeration names = context.getInitParameterNames();
-        while (names.hasMoreElements()) {
-            final String name = (String) names.nextElement();
-            buf.append(name + "=" + context.getInitParameter(name));
-        }
-        return buf.toString();
-    }
-
-    public void startRequest(final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext) {
-        this.request = request;
-        this.response = response;
-        this.servletContext = servletContext;
-        final Enumeration parameterNames = request.getParameterNames();
-        while (parameterNames.hasMoreElements()) {
-            final String name = (String) parameterNames.nextElement();
-            addParameter(name, request.getParameter(name));
-        }
-        initSession();
-    }
-
-    public HttpServletRequest getRequest() {
-        return request;
-    }
-
-    public HttpServletResponse getResponse() {
-        return response;
-    }
-
-    public ServletContext getServletContext() {
-        return servletContext;
-    }
-
-    @Override
-    public PrintWriter getWriter() {
-        try {
-            return response.getWriter();
-        } catch (final IOException e) {
-            throw new ScimpiException(e);
-        }
-    }
-
-    @Override
-    public String findFile(final String fileName) {
-        try {
-            if (getServletContext().getResource(fileName) == null) {
-                return null;
-            } else {
-                return fileName;
-            }
-        } catch (final MalformedURLException e) {
-            throw new ScimpiException(e);
-        }
-    }
-
-    @Override
-    public String getErrorDetails() {
-        return (String) getRequest().getAttribute("com.planchaser.error.details");
-    }
-
-    @Override
-    public String getErrorMessage() {
-        return (String) getRequest().getAttribute("com.planchaser.error.message");
-    }
-
-    @Override
-    public String getErrorReference() {
-        return (String) getRequest().getAttribute("com.planchaser.error.reference");
-    }
-
-    @Override
-    public InputStream openStream(final String path) {
-        final InputStream in = servletContext.getResourceAsStream(path);
-
-        if (in == null) {
-            servletContext.getResourcePaths("/");
-            try {
-                servletContext.getResource(path);
-            } catch (final MalformedURLException e) {
-                throw new ScimpiException(e);
-            }
-
-            throw new ScimpiNotFoundException("Cannot find file " + path);
-        }
-        return in;
-    }
-    
-    @Override
-    public void startHttpSession() {
-        addVariable("_auth_session", getSession(), Scope.SESSION); 
-    }
-
-    private void initSession(){
-        final HttpSession httpSession = request.getSession(true);
-        // TODO when using version 3.0 of Servlet API use the HttpOnly setting for improved security
-        if (httpSession.getAttribute("scimpi-context") == null) {
-            final Map<String, Object> sessionData = getSessionData();
-            httpSession.setAttribute("scimpi-context", sessionData);
-        } else {
-            final HashMap<String, Object> data = (HashMap<String, Object>) httpSession.getAttribute("scimpi-context");
-            if (data != null) {
-                setSessionData(data);
-            }
-        }
-    }
-
-    @Override
-    protected String getSessionId() {
-        return request.getSession().getId();
-    }
-
-    @Override
-    public String clearSession() {
-        request.getSession().invalidate();
-        return null;
-    }
-
-    @Override
-    public void reset() {
-        try {
-            response.getWriter().print("<h1>RESET</h1>");
-        } catch (final IOException e) {
-            throw new DispatchException(e);
-        }
-        response.reset();
-    }
-
-    @Override
-    public void forward(final String view) {
-        try {
-            isAborted = true;
-            getRequest().getRequestDispatcher(view).forward(getRequest(), getResponse());
-        } catch (final IOException e) {
-            throw new DispatchException(e);
-        } catch (final ServletException e) {
-            throw new DispatchException(e);
-        }
-    }
-
-    @Override
-    public void redirectTo(final String view) {
-        try {
-            isAborted = true;
-            getResponse().sendRedirect(view);
-        } catch (final IOException e) {
-            throw new DispatchException(e);
-        }
-    }
-
-    @Override
-    public void raiseError(final int status, final ErrorCollator errorDetails) {
-        try {
-            isAborted = true;
-            getRequest().setAttribute("com.planchaser.error.reference", errorDetails.getReference()); 
-            getRequest().setAttribute("com.planchaser.error.message", errorDetails.getMessage());
-            getRequest().setAttribute("com.planchaser.error.details", errorDetails.getDetails());
-            getResponse().sendError(status);
-        } catch (final IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Override
-    public boolean isAborted() {
-        return isAborted;
-    }
-
-    @Override
-    public void setContentType(final String string) {
-        getResponse().setContentType(string);
-    }
-
-    @Override
-    public String imagePath(final ObjectAdapter object) {
-        final String contextPath = getContextPath();
-        return ImageLookup.imagePath(object, contextPath);
-    }
-
-    @Override
-    public String imagePath(final ObjectSpecification specification) {
-        final String contextPath = getContextPath();
-        return ImageLookup.imagePath(specification, contextPath);
-    }
-
-    @Override
-    public String getContextPath() {
-        return request.getContextPath();
-    }
-
-    @Override
-    public String getHeader(final String name) {
-        return request.getHeader(name);
-    }
-
-    @Override
-    public String getQueryString() {
-        return request.getQueryString();
-    }
-
-    @Override
-    public String getUri() {
-        return request.getRequestURI() + "?" + request.getQueryString();
-    }
-
-    @Override
-    public String getUrlBase() {
-        // return request.getScheme() + request.getServerName() +
-        // request.getServerPort();
-        final StringBuffer url = request.getRequestURL();
-        url.setLength(url.length() - request.getRequestURI().length());
-        return url.toString();
-    }
-
-    @Override
-    public void addCookie(final String name, final String value, final int minutesUtilExpires) {
-        final Cookie cookie = new Cookie(name, value);
-        cookie.setMaxAge(minutesUtilExpires * 60);
-        response.addCookie(cookie);
-    }
-
-    @Override
-    public String getCookie(final String name) {
-        final Cookie[] cookies = request.getCookies();
-        if (cookies != null) {
-            for (final Cookie cookie : cookies) {
-                if (cookie.getName().equals(name)) {
-                    return cookie.getValue();
-                }
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml b/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml
deleted file mode 100644
index ecd3906..0000000
--- a/component/viewer/scimpi/src/main/appended-resources/supplemental-models.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- 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. -->
-<supplementalDataModels xmlns="http://maven.apache.org/supplemental-model/1.0.0"
-                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                        xsi:schemaLocation="http://maven.apache.org/supplemental-model/1.0.0 http://maven.apache.org/xsd/supplemental-model-1.0.0.xsd">
-
-  <supplement>
-    <project>
-      <groupId>aopalliance</groupId>
-      <artifactId>aopalliance</artifactId>
-      <version>1.0</version>
-      <licenses>
-          <license>
-              <name>Public Domain</name>
-          </license>
-      </licenses>
-    </project>
-  </supplement>
-
-  <supplement>
-   	<!-- not quite sure why licenses:download-license flags this, since license info seems to be in its POM -->
-    <project>
-		<groupId>org.datanucleus</groupId>
-	    <artifactId>datanucleus-jodatime</artifactId>
-	    <version>3.1.1</version>
-          <licenses>
-			<license>
-	            <name>The Apache Software License, Version 2.0</name>
-	            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-	        </license>
-	    </licenses>
-    </project>
-  </supplement>
-
-  <supplement>
-    <project>
-      <groupId>org.scannotation</groupId>
-      <artifactId>scannotation</artifactId>
-      <version>1.0.3</version>
-      <licenses>
-        <license>
-            <name>The Apache Software License, Version 2.0</name>
-            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-            <distribution>repo</distribution>          
-        </license>
-      </licenses>
-    </project>
-  </supplement>
-    
-  <supplement>
-    <project>
-      <groupId>dom4j</groupId>
-      <artifactId>dom4j</artifactId>
-      <version>1.6.1</version>
-      <licenses>
-        <license>
-            <name>BSD License</name>
-            <url>http://dom4j.sourceforge.net/dom4j-1.6.1/license.html</url>
-            <distribution>repo</distribution>          
-        </license>
-      </licenses>
-    </project>
-  </supplement>
-
-  <supplement>
-    <project>
-      <groupId>net.jcip</groupId>
-      <artifactId>jcip-annotations</artifactId>
-      <version>1.0</version>
-      <licenses>
-        <license>
-            <name>Creative Commons Attribution 2.5 License</name>
-            <url>http://creativecommons.org/licenses/by/2.5/</url>
-            <distribution>repo</distribution>          
-        </license>
-      </licenses>
-    </project>
-  </supplement>
-  
-
-  <supplement>
-    <project>
-      <groupId>xalan</groupId>
-      <artifactId>xalan</artifactId>
-      <version>2.7.0</version>
-      <licenses>
-        <license>
-            <name>The Apache Software License, Version 2.0</name>
-            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-            <distribution>repo</distribution>          
-        </license>
-      </licenses>
-    </project>
-  </supplement>
-
- 
-</supplementalDataModels>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/pom.xml b/component/viewer/scimpi/tck/pom.xml
deleted file mode 100644
index 0c71d86..0000000
--- a/component/viewer/scimpi/tck/pom.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.isis.tck</groupId>
-        <artifactId>isis-tck</artifactId>
-        <version>1.9.0-SNAPSHOT</version>
-        <relativePath>../../../../tck/pom.xml</relativePath>
-    </parent>
-
-    <groupId>org.apache.isis.viewer</groupId>
-	<artifactId>isis-viewer-scimpi-tck</artifactId>
-	<name>Isis Scimpi Viewer TCK tests</name>
-	
-	<properties>
-        <isis-viewer-scimpi.version>1.0.0-SNAPSHOT</isis-viewer-scimpi.version>
-        <isis-objectstore-xml.version>1.0.0-SNAPSHOT</isis-objectstore-xml.version>
-        <isis-profilestore-xml.version>1.0.0-SNAPSHOT</isis-profilestore-xml.version>
-        <isis-security-file.version>1.6.0-SNAPSHOT</isis-security-file.version>
-
-        <siteBaseDir>..</siteBaseDir>
-        <relativeUrl>scimpi-tck/</relativeUrl>
-        <!-- until someone comes up with a better solution -->
-        <distMgmtSiteUrl>file:///tmp/m2-sites/isis/viewer/scimpi</distMgmtSiteUrl>
-    </properties>
-
-        <packaging>war</packaging>
-
-	<build>
-		<plugins>
-            <plugin>
-                <groupId>org.mortbay.jetty</groupId>
-                <artifactId>maven-jetty-plugin</artifactId>
-            </plugin>
-		</plugins>
-	</build>
-
-	<dependencies>
-	
-        <!-- other modules in this project -->
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-tck-dom</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-tck-fixture</artifactId>
-        </dependency>
-
-
-        <!-- isis non-core components -->
-        <dependency>
-            <groupId>org.apache.isis.viewer</groupId>
-            <artifactId>isis-viewer-scimpi-servlet</artifactId>
-            <version>${isis-viewer-scimpi.version}</version>
-        </dependency>
-
-
-        <!-- isis runtime -->
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-runtime</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-security</artifactId>
-        </dependency>
-        
-        <!-- to run using WebServer -->
-        <dependency>
-            <groupId>org.apache.isis.core</groupId>
-            <artifactId>isis-core-webserver</artifactId>
-            <scope>runtime</scope>
-            <optional>true</optional>
-        </dependency>
-
-    </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/resources/images/Default.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/resources/images/Default.png b/component/viewer/scimpi/tck/src/main/resources/images/Default.png
deleted file mode 100644
index 8409e46..0000000
Binary files a/component/viewer/scimpi/tck/src/main/resources/images/Default.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml b/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml
deleted file mode 100644
index 724ac7a..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/edit-selector.shtml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title>Edit <swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2>Edit <swf:title /></h2>
-<swf:edit>
-	<swf:selector field="claimant" object="service:claimants" method="findEmployees" title="Employees..."/>
-	<swf:selector field="approver" object="service:claimants" method="findEmployees" title="Employees..."/>
-</swf:edit>
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml b/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml
deleted file mode 100644
index 406f42c..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-link.shtml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title><swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2><swf:title /></h2>
-<swf:short-form>
-	<swf:link name="claimant"/>
-</swf:short-form>
-
-<swf:methods/>
-
-
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml b/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml
deleted file mode 100644
index deb6d66..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object-orig.shtml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title><swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2><swf:title /></h2>
-
-<swf:long-form />
-
-<swf:methods />
-
-
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml b/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml
deleted file mode 100644
index f1865ce..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object.shtml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title><swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2><swf:title /></h2>
-<swf:short-form>
-	<swf:exclude name="approver"/>
-</swf:short-form>
-
-<swf:methods>
-	<swf:exclude name="submit"/>
-</swf:methods>
-
-
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml b/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml
deleted file mode 100644
index f07c718..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/ToDoItem/object2.shtml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title><swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2><swf:title /></h2>
-<swf:short-form>
-</swf:short-form>
-
-<swf:methods>
-</swf:methods>
-
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties b/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties
deleted file mode 100644
index d8aab34..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/isis.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-#  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.
-isis.services.prefix = org.apache.isis.tck.objstore.dflt
-isis.services =\
-    scalars.ApplibValuedEntityRepositoryDefault,\
-    scalars.JdkValuedEntityRepositoryDefault,\
-    scalars.PrimitiveValuedEntityRepositoryDefault,\
-    scalars.WrapperValuedEntityRepositoryDefault, \
-    simples.SimpleEntityRepositoryDefault,\
-    assocs.ParentEntityRepositoryDefault
-
-isis.fixtures.prefix= org.apache.isis.tck.fixture
-isis.fixtures=\
-    LogonAsSvenFixture,\
-    scalars.ApplibValuedEntityFixture,\
-    scalars.JdkValuedEntityFixture,\
-    scalars.PrimitiveValuedEntityFixture,\
-    scalars.WrapperValuedEntityFixture,\
-    simples.SimpleEntityFixture,\
-    assocs.ParentAndChildEntityFixture
-
-isis.exploration.users=sven, dick, bob
-
-
-
-isis.persistor.object-factory=org.apache.isis.runtimes.dflt.bytecode.dflt.objectfactory.CglibObjectFactory
-#isis.persistor.object-factory=org.apache.isis.runtimes.dflt.bytecode.javassist.objectfactory.JavassistObjectFactory
-#isis.persistor.object-factory=org.apache.isis.runtimes.dflt.bytecode.identity.objectfactory.ObjectFactoryBasic
-
-
-isis.persistor.domain-object-container=org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault
-#isis.persistor.domain-object-container=org.apache.isis.progmodel.wrapper.metamodel.DomainObjectContainerWrapperFactory
-
-
-#isis.reflector.facets.include=org.apache.isis.runtimes.dflt.runtime.authorization.standard.AuthorizationFacetFactoryImpl
-#isis.authorization.learn=true
-
-
-isis.persistor=in-memory
-#isis.xmlos.dir=/tmp/xml
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties b/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties
deleted file mode 100644
index f2d65e6..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/logging.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-#  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.
-# apache's log4j is used to provide system logging.
-log4j.rootCategory=INFO, Console
-
-# The console appender
-log4j.appender.Console=org.apache.log4j.ConsoleAppender
-log4j.appender.Console.target=System.out
-log4j.appender.Console.layout=org.apache.log4j.PatternLayout
-log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE}  [%-20c{1} %-10t %-5p]  %m%n
-
-log4j.appender.File=org.apache.log4j.RollingFileAppender
-log4j.appender.File.file=isis.log
-log4j.appender.File.append=false
-log4j.appender.File.layout=org.apache.log4j.PatternLayout
-log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p]  %m%n

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow b/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow
deleted file mode 100644
index 928983a..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.allow
+++ /dev/null
@@ -1,16 +0,0 @@
-#  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.

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords b/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords
deleted file mode 100644
index 7f07af5..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/security_file.passwords
+++ /dev/null
@@ -1,20 +0,0 @@
-#  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.
-sven:pass
-dick:pass
-bob:pass
-joe:pass

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml b/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 3e61f54..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<web-app id="WebApp_ID" version="2.4"
-    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
-    <display-name>Apache Isis S Viewer</display-name>
-
-    <welcome-file-list>
-        <welcome-file>index.shtml</welcome-file>
-    </welcome-file-list>
-
-    <listener>
-        <listener-class>org.apache.isis.core.webapp.IsisWebAppBootstrapper</listener-class>
-    </listener>
-
-    <context-param>
-        <param-name>isis.viewers</param-name>
-        <param-value>scimpi</param-value>
-    </context-param>
-
-    <servlet>
-        <servlet-name>dispatcher</servlet-name>
-        <servlet-class>org.apache.isis.viewer.scimpi.servlet.DispatcherServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>dispatcher</servlet-name>
-        <url-pattern>*.shtml</url-pattern>
-    </servlet-mapping>
-
-    <servlet-mapping>
-        <servlet-name>dispatcher</servlet-name>
-        <url-pattern>*.app</url-pattern>
-    </servlet-mapping>
-
-</web-app>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/debug.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/debug.shtml b/component/viewer/scimpi/tck/src/main/webapp/debug.shtml
deleted file mode 100644
index 93550cf..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/debug.shtml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:template file="style/template.shtml"/>
-
-<swf:services/>
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml b/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml
deleted file mode 100644
index b72bb04..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/generic/action.shtml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title>Action <swf:action-name method="${method}"/></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2>${title}</h2>
-<swf:action-form method="${method}" view="_generic.shtml"/>
-
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml b/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml
deleted file mode 100644
index 823046f..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/generic/collection.shtml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title><swf:element-type /> Listing</swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2>${title}</h2>
-<swf:table link="_generic.shtml" />
- 
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml b/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml
deleted file mode 100644
index 6d47bfc..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/generic/edit.shtml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title>Edit <swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2>Edit <swf:title /></h2>
-<swf:edit />
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml b/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml
deleted file mode 100644
index 18fa5da..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/generic/object.shtml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title><swf:title icon="no" /></swf:page-title>
-<swf:template  file="../style/template.shtml" />
-
-<h2><swf:title /></h2>
-<swf:long-form link="_generic.shtml" />
-
-<swf:methods />
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png b/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png
deleted file mode 100644
index 478f115..0000000
Binary files a/component/viewer/scimpi/tck/src/main/webapp/images/Claim.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png b/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png
deleted file mode 100644
index d85fd82..0000000
Binary files a/component/viewer/scimpi/tck/src/main/webapp/images/ClaimItem.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png b/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png
deleted file mode 100644
index 6cf2bd4..0000000
Binary files a/component/viewer/scimpi/tck/src/main/webapp/images/Employee.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png b/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png
deleted file mode 100644
index 830e843..0000000
Binary files a/component/viewer/scimpi/tck/src/main/webapp/images/banner-bg.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/images/banner.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/images/banner.png b/component/viewer/scimpi/tck/src/main/webapp/images/banner.png
deleted file mode 100644
index f81e331..0000000
Binary files a/component/viewer/scimpi/tck/src/main/webapp/images/banner.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/images/logo.png
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/images/logo.png b/component/viewer/scimpi/tck/src/main/webapp/images/logo.png
deleted file mode 100644
index ea4cbc1..0000000
Binary files a/component/viewer/scimpi/tck/src/main/webapp/images/logo.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/index.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/index.shtml b/component/viewer/scimpi/tck/src/main/webapp/index.shtml
deleted file mode 100644
index e9281cf..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/index.shtml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:page-title>Claims App</swf:page-title>
-
-<swf:template  file="style/template.shtml" />
-
-
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/login.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/login.shtml b/component/viewer/scimpi/tck/src/main/webapp/login.shtml
deleted file mode 100644
index a427a54..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/login.shtml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<swf:template  file="style/template.shtml" />
-
-<h2>Please Log On</h2>
-<swf:logon/>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/style/screen.css
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/style/screen.css b/component/viewer/scimpi/tck/src/main/webapp/style/screen.css
deleted file mode 100644
index f990946..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/style/screen.css
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- *  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.
- */
-BODY {
-	font-family: Arial, Sans-Serif;
-	margin: 0 0 10px 0;
-	color: black;
-	background-color: #f0f0f0;
-}
-
-/*
-* Banner
-*/
-div#banner {
-	background-image: url(../images/banner-bg.png);
-	background-repeat: repeat-x; 
-	width: 100%;
-	height: 120px;
-}
-
-/*
-* Content below banner
-*/
-div#content {
-	display: block;
-}
-
-div#content div#side {
-	display: inline;
-	float: left;
-	width: 150px;
-	padding: 25px 10px;
-}
-
-div#side ul {
-	margin: 0;
-	padding: 0;
-}
-
-div#side li {
-	display: block;
-	font-size: 80%;
-	padding: 4px 0;
-}
-
-div#content div#main{
-	padding: 1em;
-	float:left;
-	width:70%;
-}
-
-/*
-* Feedback area
-*/
-.feedback {
-	border: 2px solid red;
-	background-color: #ffccff;
-	padding: 20px 10px;
-}
-
-.warning {
-	color: red;
-	font-style:  italic;
-}
-
-.message {
-	color: blue;
-}
-
-.error {
-	color: red;
-	font-size: 80%;
-	padding-left:  6px;	
-}
-
-/*
-* Debug
-*/
-
-div.debug {
-	display: block;
-	padding: 10px;
-	border: 1px solid gray;
-	background-color: #ddd;
-}
-
-/*
-* Headings
-*/
-h1, h2, h3, h4 {
-	color: blue;
-}
-
-
-/*
-* Hyper links
-*/
-a {
-	color: blue;
-	text-decoration: none;
-}
-
-a:hover {
-	text-decoration: underline;
-}
-
-a:visted {
-	color: blue;
-	text-decoration: none;
-}
-
-/*
-* Icons
-*/
-img.title-icon {
-	height: 32px;
-	padding-right: 6px;
-}
-
-img.small-icon {
-	height: 16px;
-	padding-right: 6px;
-	vertical-align: text-bottom;
-}
-
-
-/*
-* Actions
-*/
-div.actions {
-	
-}
-
-div.actions div.actions {
-	border: 0px;
-	padding: 0px;
-}
-
-div.actions h2 {
-	font-size: 90%;
-}
-
-div.actions h3 {
-	font-size: 80%;
-}
-
-div.actions div.action,
-a.action
-{
-	padding 2px;
-	margin: 4px 0;
-	height: 1.6em;
-}
-
-div.action INPUT,
-div.action a,
-a.action,
-div.action span.disabled
-{
-	font-size: 80%;
-	background-color: silver;
-	border: 1px solid #333399;
-	background: url(../images/bg-button.gif);
-	background-repeat: repeat-x;
-}
-
-div.action INPUT[type="hidden"]
-{
-	background: none;
-	border: none;
-}
-
-div.action a,
-a.action,
-div.action span.disabled {
-	padding: 1px 10px;
-}
-
-.action INPUT, 
-a.action,
-.action a:link {
-	color: #000000;
-}
-
-.action INPUT, 
-a.action,
-.action a:visited {
-	color: #000000;
-}
-
-.action INPUT, 
-a.action,
-.action a:hover {
-	color: #000000;
-	text-decoration: none;
-}
-
-div.action span.disabled {
-	color: #555;
-}
-
-/*
-* Edit forms
-*/
-fieldset {
-	padding: 5px 10px;
-}
-
-fieldset div.field {
-	padding: 4px 0px;
-	min-height: 1.3em;
-}
-
-fieldset label {
-	float: left;
-	width:140px;
-	font-weight: bold;
-}
-
-fieldset input {
-	padding: 0px 0;
-}
-
-fieldset textarea {
-	font-family: Arial, Sans-Serif;
-}
-
-form input.button {
-	font-size: 80%;
-	background-color: silver;
-	border: 1px solid #333399;
-	background: url(../images/bg-button.gif);
-	background-repeat: repeat-x;
-	padding: 1px 0;
-}
-
-/*
-* Display forms
-*/
-div.form {
-	padding: 5px 0;
-}
-
-XXdiv.form * {
-	border: 1px solid red;
-}
-
-div.form div.field {
-	padding: 4px 6px;
-	min-height: 1.3em;
-}
-
-div.form div.odd-row {
-	background-color: #e7e7e7;
-}
-
-div.form div.even-row {
-	background-color:  #eee;
-}
-
-div.form span.label {
-	float: left;
-	font-weight: bold;
-}
-
-div.form span.value {
-	display: block;
-	padding-left: 12em;
-	max-width: 45em;
-}
-
-
-
-/*
-* collections
-*/
-
-#store .entry {
-	border-bottom: 1px dotted #7745FF;
-	padding: 10px 0;
-}
-	
-table {
-	border: 0px;
-	padding-bottom: 10px;
-}
-	
-th {
-	background-color: #bbb;
-}
-
-tr.odd-row {
-	background-color: #eee;
-}
-
-tr.even-row {
-	background-color: #e7e7e7;
-}
-
-td {
-	vertical-align: top;
-	padding: 4px 10px;
-}
-
-tr:hover {
-	border: 1px solid black; 
-	background-color: #eea;
-}
-
-
-
-
-
-/*
-* Application specific
-*/
-div.book {
-	padding-bottom: 10px;
-	border-bottom: 2px dashed;
-}
-
-div.cover {
-	float: left;
-	padding-right: 30px;
-	padding-bottom: 8px;
-}
-
-
-.title {
-	color: white;
-	font-size: 120%;
-	font-weight: bold;
-	margin-left: 5px;
-}
-	
-.description {}
-
-.price {
-	display: inline;
-	font-weight: bold;
-	text-align: left;
-	margin-right: 20px;
-}
-
-form, input {
-	display: inline;
-}
-
-
-div#cart {
-	float: 	right;
-	width: 160px;
-	font-size: 70%;
-	border: 1px solid gray;
-	margin: 10px;
-	padding: 10px;
-}
-
-div#cart ul {
-	padding: 0;
-	
-}
-
-div#cart li {
-	display: block;
-	padding-bottom: 4px;
-}
-
-
-
-form.selector fieldset {
-	margin-left: 45px;	
-	font-size: 80%;
-}
-
-form.selector legend {
-	font-style: italic;
-}
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml b/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml
deleted file mode 100644
index 0774613..0000000
--- a/component/viewer/scimpi/tck/src/main/webapp/style/template.shtml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<title>${title}</title>
-<link rel="stylesheet" title="Style 1" href="${_context}/style/screen.css" type="text/css" media="all" />
-</head>
-
-<body id="demo">
-
-<div id="banner">
-	<div class="logo"><img src="images/logo.png"/></div>
-	<div class="title">To-Do App</div>
-</div>
-
-<div id="content">
-	<div id="side">
-        <swf:services />
-	</div>
-	<div id="main">
-        <swf:feedback />
-		<swf:content />
-		
-		<swf:diagnostics/>
-	</div>
-</div>
-
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/NOTICE
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/NOTICE b/mothballed/component/viewer/scimpi/NOTICE
new file mode 100644
index 0000000..ba21d0c
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2013 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/pom.xml b/mothballed/component/viewer/scimpi/dispatcher/pom.xml
new file mode 100644
index 0000000..3805c10
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+        <groupId>org.apache.isis.viewer</groupId>
+	    <artifactId>isis-viewer-scimpi</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>isis-viewer-scimpi-dispatcher</artifactId>
+
+	<name>Isis Scimpi Viewer Dispatcher</name>
+
+	<properties>
+        <siteBaseDir>..</siteBaseDir>
+		<relativeUrl>dispatcher/</relativeUrl>
+	</properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://isis.apache.org/${relativeUrl}</url>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <inherited>false</inherited>
+                <configuration>
+                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>dependencies</report>
+                            <report>dependency-convergence</report>
+                            <report>plugins</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>org.apache.isis.core</groupId>
+			<artifactId>isis-core-runtime</artifactId>
+		</dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.json</groupId>
+            <artifactId>json</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.htmlparser</groupId>
+            <artifactId>htmlparser</artifactId>
+        </dependency>
+            
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java
new file mode 100644
index 0000000..4869cc4
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractElementProcessor.java
@@ -0,0 +1,55 @@
+/*
+ *  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;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public abstract class AbstractElementProcessor implements ElementProcessor, Names {
+
+    private static final String SHOW_ICONS_BY_DEFAULT = ConfigurationConstants.ROOT + "scimpi.show-icons";
+
+    private final boolean showIconByDefault;
+
+    public AbstractElementProcessor() {
+        showIconByDefault = IsisContext.getConfiguration().getBoolean(SHOW_ICONS_BY_DEFAULT, false);
+    }
+
+    /**
+     * Return the Class for the class specified in the type attribute.
+     */
+    protected Class<?> forClass(final Request request) {
+        Class<?> cls = null;
+        final String className = request.getOptionalProperty(TYPE);
+        if (className != null) {
+            try {
+                cls = Class.forName(className);
+            } catch (final ClassNotFoundException e) {
+                throw new ScimpiException("No class for " + className, e);
+            }
+        }
+        return cls;
+    }
+
+    protected boolean showIconByDefault() {
+        return showIconByDefault;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
new file mode 100644
index 0000000..97dd1ed
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
@@ -0,0 +1,53 @@
+/*
+ *  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;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public abstract class AbstractObjectProcessor extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+        ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+
+        final String field = request.getOptionalProperty(FIELD);
+        if (field != null) {
+            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
+            final String error = checkFieldType(objectField);
+            if (error != null) {
+                throw new ScimpiException("Field " + objectField.getId() + " " + error);
+            }
+            ResolveFieldUtil.resolveField(object, objectField);
+            object = objectField.get(object);
+        }
+
+        process(request, object);
+    }
+
+    protected String checkFieldType(final ObjectAssociation objectField) {
+        return null;
+    }
+
+    protected abstract void process(Request request, ObjectAdapter object);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
new file mode 100644
index 0000000..7bd6b26
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Action.java
@@ -0,0 +1,37 @@
+/*
+ *  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;
+
+import java.io.IOException;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+
+public interface Action extends Names {
+
+    void process(RequestContext context) throws IOException;
+
+    String getName();
+
+    void init();
+
+    void debug(DebugBuilder debug);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java
new file mode 100644
index 0000000..836ae60
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/BlockContent.java
@@ -0,0 +1,23 @@
+/*
+ *  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;
+
+public interface BlockContent {
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java
new file mode 100644
index 0000000..cc679ae
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/DispatchException.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher;
+
+public class DispatchException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+
+    public DispatchException() {
+    }
+
+    public DispatchException(final String message) {
+        super(message);
+    }
+
+    public DispatchException(final Throwable cause) {
+        super(cause);
+    }
+
+    public DispatchException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+}


[19/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java
deleted file mode 100644
index 7349837..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  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.edit;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class FormState {
-    private final Map<String, FieldEditState> fields = new HashMap<String, FieldEditState>();
-    private String error;
-    private String formId;
-
-    public FieldEditState createField(final String name, final String entry) {
-        final FieldEditState fieldEditState = new FieldEditState(entry);
-        fields.put(name, fieldEditState);
-        return fieldEditState;
-    }
-
-    public boolean isValid() {
-        final Iterator<FieldEditState> iterator = fields.values().iterator();
-        while (iterator.hasNext()) {
-            if (!iterator.next().isEntryValid()) {
-                return false;
-            }
-        }
-        return error == null;
-    }
-
-    public FieldEditState getField(final String name) {
-        return fields.get(name);
-    }
-
-    public void setError(final String error) {
-        this.error = error;
-    }
-
-    public String getError() {
-        return error;
-    }
-
-    public void setForm(final String formId) {
-        this.formId = formId;
-    }
-
-    public boolean isForForm(final String formId) {
-        return this.formId == null || this.formId.equals(formId);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
deleted file mode 100644
index 919ccc2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *  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.edit;
-
-import java.io.IOException;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-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.core.runtime.system.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.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-
-/**
- * Remove an element from a collection.
- */
-public class RemoveAction implements Action {
-    public static final String ACTION = "remove";
-
-    // REVIEW: confirm this rendering context
-    private final Where where = Where.OBJECT_FORMS;
-
-    @Override
-    public String getName() {
-        return ACTION;
-    }
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        AuthenticationSession session = context.getSession();
-        if (session == null) {
-            session = new AnonymousSession();
-        }
-
-        final String parentId = context.getParameter(OBJECT);
-        final String rowId = context.getParameter(ELEMENT);
-
-        try {
-            final ObjectAdapter parent = context.getMappedObject(parentId);
-            final ObjectAdapter row = context.getMappedObject(rowId);
-
-            final String fieldName = context.getParameter(FIELD);
-            final ObjectAssociation field = parent.getSpecification().getAssociation(fieldName);
-            if (field == null) {
-                throw new ScimpiException("No field " + fieldName + " in " + parent.getSpecification().getFullIdentifier());
-            }
-            if (field.isVisible(IsisContext.getAuthenticationSession(), parent, where).isVetoed()) {
-                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-            }
-
-            ((OneToManyAssociation) field).removeElement(parent, row);
-
-            // TODO duplicated in EditAction
-            String view = context.getParameter(VIEW);
-            final String override = context.getParameter(RESULT_OVERRIDE);
-
-            String resultName = context.getParameter(RESULT_NAME);
-            resultName = resultName == null ? RequestContext.RESULT : resultName;
-
-            final String id = context.mapObject(parent, Scope.REQUEST);
-            context.addVariable(resultName, id, Scope.REQUEST);
-            if (override != null) {
-                context.addVariable(resultName, override, Scope.REQUEST);
-            }
-
-            final int questionMark = view == null ? -1 : view.indexOf("?");
-            if (questionMark > -1) {
-                final String params = view.substring(questionMark + 1);
-                final int equals = params.indexOf("=");
-                context.addVariable(params.substring(0, equals), params.substring(equals + 1), Scope.REQUEST);
-                view = view.substring(0, questionMark);
-            }
-            context.setRequestPath(view);
-            // TODO end of duplication
-
-        } catch (final RuntimeException e) {
-            IsisContext.getMessageBroker().getMessages();
-            IsisContext.getMessageBroker().getWarnings();
-            throw e;
-        }
-    }
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java
deleted file mode 100644
index 55809e0..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  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.logon;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSessionAbstract;
-import org.apache.isis.core.commons.encoding.DataInputExtended;
-
-public class DomainSession extends AuthenticationSessionAbstract {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String CODE = "";
-
-    public DomainSession(final String username, final List<String> roles) {
-        super(username, roles, CODE);
-    }
-    
-    public DomainSession(final DataInputExtended input) throws IOException {
-        super(input);
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
deleted file mode 100644
index e90740a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *  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.logon;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.applib.profiles.Localization;
-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.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.Action;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-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.edit.FieldEditState;
-import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-
-public class LogonAction implements Action {
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        String username = context.getParameter("username");
-        String password = context.getParameter("password");
-        final String actualFormId = context.getParameter("_" + FORM_ID);
-        final String expectedFormId = context.getParameter(LOGON_FORM_ID);
-        boolean isDomainLogon = expectedFormId != null && expectedFormId.equals(actualFormId);
-        boolean isValid;
-
-        if (username == null || password == null) {
-            context.redirectTo("/");
-            return;
-        }
-        AuthenticationSession session = null;
-        if (username.length() == 0 || password.length() == 0) {
-            isValid = false;
-        } else {
-            if (isDomainLogon) {
-                final String objectId = context.getParameter(LOGON_OBJECT);
-                final String scope = context.getParameter(LOGON_SCOPE);
-                final String loginMethodName = context.getParameter(LOGON_METHOD);
-                final String roleFieldName = context.getParameter(PREFIX + "roles-field");
-                String resultName = context.getParameter(LOGON_RESULT_NAME);
-                resultName = resultName == null ? "_" + USER : resultName;
-
-                final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
-                final ObjectAction loginAction = MethodsUtils.findAction(object, loginMethodName);
-                final int parameterCount = loginAction.getParameterCount();
-                final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];
-                List<ObjectActionParameter> parameters2 = loginAction.getParameters();
-                if (parameters.length != 2) {
-                    throw new ScimpiException("Expected two parameters for the log-on method: " + loginMethodName);
-                }
-
-                Localization localization = IsisContext.getLocalization(); 
-                ParseableFacet facet = parameters2.get(0).getSpecification().getFacet(ParseableFacet.class);
-                parameters[0] = facet.parseTextEntry(null, username, localization);
-                facet = parameters2.get(1).getSpecification().getFacet(ParseableFacet.class);
-                parameters[1] = facet.parseTextEntry(null, password, localization);
-                final ObjectAdapter result = loginAction.execute(object, parameters);
-                isValid = result != null;
-                if (isValid) {
-                    ObjectSpecification specification = result.getSpecification();
-                    ObjectAssociation association = specification.getAssociation(roleFieldName);
-                    if (association == null) {
-                        throw new ScimpiException("Expected a role name field called: " + roleFieldName);
-                    }
-                    ObjectAdapter role = association.get(result);
-                    List<String> roles = new ArrayList<String>();
-                    if (role != null) {
-                        String[] split = role.titleString().split("\\|");
-                        for (String r : split) {
-                            roles.add(r);
-                        }
-                    }
-                    //String domainRoleName = role == null ? "" : role.titleString(); 
-                    
-                    
-                    Scope scope2 = scope == null ? Scope.SESSION : RequestContext.scope(scope);
-                    final String resultId = context.mapObject(result, scope2);
-                    context.addVariable(resultName, resultId, scope);
-                    context.addVariable("_username", username, Scope.SESSION);
-                    
-                    context.clearVariable(LOGON_OBJECT, Scope.SESSION);
-                    context.clearVariable(LOGON_METHOD, Scope.SESSION);
-                    context.clearVariable(LOGON_RESULT_NAME, Scope.SESSION);
-                    context.clearVariable(LOGON_SCOPE, Scope.SESSION);
-                    context.clearVariable(PREFIX + "roles-field", Scope.SESSION);
- //                   context.clearVariable(PREFIX + "isis-user", Scope.SESSION);
-                    context.clearVariable(LOGON_FORM_ID, Scope.SESSION);
-
-                    session = new DomainSession(result.titleString(), roles);
-                } else {
-                    session = context.getSession();
-                }
-                
-            } else {
-                session = UserManager.authenticate(new AuthenticationRequestPassword(username, password));
-                isValid = session != null;
-            }
-        }
-
-        String view;
-        if (!isValid) {
-            final FormState formState = new FormState();
-            formState.setForm(actualFormId);
-            formState.setError("Failed to login. Check the username and ensure that your password was entered correctly");
-            FieldEditState fieldState = formState.createField("username", username);
-            if (username.length() == 0) {
-                fieldState.setError("User Name required");
-            }
-            fieldState = formState.createField("password", password);
-            if (password.length() == 0) {
-                fieldState.setError("Password required");
-            }
-            if (username.length() == 0 || password.length() == 0) {
-                formState.setError("Both the user name and password must be entered");
-            }
-            context.addVariable(ENTRY_FIELDS, formState, Scope.REQUEST);
-
-            view = context.getParameter(ERROR);
-            context.setRequestPath("/" + view, Dispatcher.ACTION);
-        } else {
-            context.setSession(session);
-            context.startHttpSession();
-            context.setUserAuthenticated(true);
-            view = context.getParameter(VIEW);
-            if (view == null) {
-                // REVIEW this is duplicated in Logon.java
-                view = "start." + Dispatcher.EXTENSION;
-            }
-            context.redirectTo(view);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "logon";
-    }
-
-    @Override
-    public void init() {}
-
-    @Override
-    public void debug(final DebugBuilder debug) {}
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
deleted file mode 100644
index a6f4730..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  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.logon;
-
-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.runtime.system.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.context.RequestContext.Scope;
-
-public class LogoutAction implements Action {
-
-    public static void logoutUser(final RequestContext context) {
-        if (context.isUserAuthenticated()) {
-            final AuthenticationSession session = context.getSession();
-            if (session != null) {
-                UserManager.logoffUser(session);
-            }
-            context.endHttpSession();
-            context.setUserAuthenticated(false);
-        }
-        context.clearVariables(Scope.SESSION);
-    }
-
-    @Override
-    public String getName() {
-        return "logout";
-    }
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        logoutUser(context);
-        
-        String view = context.getParameter("view");
-        if (view == null) {
-            view = context.getContextPath();
-        }
-        context.redirectTo(view);
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java
deleted file mode 100644
index 1efe91e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  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.processor;
-
-public interface Encoder {
-
-    String encoder(String text);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
deleted file mode 100644
index 6730510..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- *  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.processor;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Stack;
-
-import org.htmlparser.Node;
-import org.htmlparser.Remark;
-import org.htmlparser.lexer.Lexer;
-import org.htmlparser.lexer.Page;
-import org.htmlparser.nodes.TagNode;
-import org.htmlparser.util.ParserException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HtmlSnippet;
-import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
-import org.apache.isis.viewer.scimpi.dispatcher.view.SwfTag;
-
-public class HtmlFileParser {
-    private static final Logger LOG = LoggerFactory.getLogger(HtmlFileParser.class);
-    private final ProcessorLookup processors;
-
-    public HtmlFileParser(final ProcessorLookup processors) {
-        this.processors = processors;
-    }
-
-    public Stack<Snippet> parseHtmlFile(final String filePath, final RequestContext context) {
-        final Stack<Snippet> tagsBeforeContent = new Stack<Snippet>();
-        final Stack<Snippet> tagsAfterContent = new Stack<Snippet>();
-        parseHtmlFile("/", filePath, context, tagsBeforeContent, tagsAfterContent);
-        return tagsBeforeContent;
-    }
-
-    public void parseHtmlFile(final String parentPath, final String filePath, final RequestContext context, final Stack<Snippet> allTags, final Stack<Snippet> tagsForPreviousTemplate) {
-        LOG.debug("parent/file: " + parentPath + " & " + filePath);
-        final File directory = filePath.startsWith("/") ? new File(".") : new File(parentPath);
-        final File loadFile = new File(directory.getParentFile(), filePath);
-        final String loadPath = loadFile.getPath().replace('\\', '/');
-        LOG.debug("loading template '" + loadPath + "'");
-        final InputStream in = context.openStream(loadPath);
-
-        Page page;
-        try {
-            page = new Page(in, null);
-        } catch (final UnsupportedEncodingException e) {
-            throw new ScimpiException(e);
-        }
-        final Lexer lexer = new Lexer(page);
-
-        Node node = null;
-        try {
-            Stack<Snippet> tags = allTags;
-            String lineNumbers = "1";
-            String template = null;
-            tags.push(new HtmlSnippet(lineNumbers, filePath));
-
-            // NOTE done like this the tags can be cached for faster processing
-            while ((node = lexer.nextNode()) != null) {
-                if (node instanceof Remark) {
-                    // TODO need to pick up on comments within tags; at the
-                    // moment this splits a tag into two causing a
-                    // failure later
-                    continue;
-
-                } else if (node instanceof TagNode && ((TagNode) node).getTagName().startsWith("SWF:")) {
-                    final TagNode tagNode = (TagNode) node;
-                    final String tagName = tagNode.getTagName().toUpperCase();
-                    LOG.debug(tagName);
-
-                    // TODO remove context & request from Attributes -- the tags
-                    // will be re-used across
-                    // requests
-                    final Attributes attributes = new Attributes(tagNode, context);
-                    int type = 0;
-                    if (tagNode.isEndTag()) {
-                        type = SwfTag.END;
-                    } else {
-                        type = tagNode.isEmptyXmlTag() ? SwfTag.EMPTY : SwfTag.START;
-                    }
-                    testForProcessorForTag(lexer, tagName);
-                    lineNumbers = lineNumbering(node);
-                    final SwfTag tag = new SwfTag(tagName, attributes, type, lineNumbers, loadFile.getCanonicalPath());
-                    tags.push(tag);
-
-                    if (tagName.equals("SWF:IMPORT")) {
-                        if (!tagNode.isEmptyXmlTag()) {
-                            throw new ScimpiException("Import tag must be empty");
-                        }
-                        String importFile = tagNode.getAttribute("file");
-                        if (context.isDebug()) {
-                            context.getWriter().println("<!-- " + "import file " + importFile + " -->");
-                        }
-                        importFile = context.replaceVariables(importFile);
-                        parseHtmlFile(loadPath, importFile, context, tags, tagsForPreviousTemplate);
-                    }
-
-                    if (tagName.equals("SWF:TEMPLATE")) {
-                        if (!tagNode.isEmptyXmlTag()) {
-                            throw new ScimpiException("Template tag must be empty");
-                        }
-                        if (template != null) {
-                            throw new ScimpiException("Template tag can only be used once within a file");
-                        }
-                        template = tagNode.getAttribute("file");
-                        template = context.replaceVariables(template);
-                        if (context.isDebug()) {
-                            context.getWriter().println("<!-- " + "apply template " + template + " -->");
-                        }
-                        tags = new Stack<Snippet>();
-                    }
-
-                    if (tagName.equals("SWF:CONTENT")) {
-                        if (!tagNode.isEmptyXmlTag()) {
-                            throw new ScimpiException("Content tag must be empty");
-                        }
-                        if (context.isDebug()) {
-                            context.getWriter().println("<!-- " + "insert content into template -->");
-                        }
-                        tags.addAll(tagsForPreviousTemplate);
-                    }
-                } else {
-                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
-                    if (snippet instanceof HtmlSnippet) {
-                        ((HtmlSnippet) snippet).append(node.toHtml());
-                    } else {
-                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
-                        htmlSnippet.append(node.toHtml());
-                        tags.push(htmlSnippet);
-                    }
-                }
-
-            }
-            in.close();
-
-            if (template != null) {
-                final String filePathRoot = loadPath.startsWith("/") ? "" : "/";
-                parseHtmlFile(filePathRoot + loadPath, template, context, allTags, tags);
-            }
-
-        } catch (final ParserException e) {
-            exception(loadPath, node, e);
-            // throw new ScimpiException(e);
-        } catch (final RuntimeException e) {
-            // TODO: extend to deal with other exceptions
-            exception(loadPath, node, e);
-        } catch (final IOException e) {
-            throw new ScimpiException(e);
-        }
-    }
-
-    private void exception(final String filePath, final Node node, final Exception e) {
-        String lineNumbers = "";
-        String element = ("" + node).toLowerCase();
-        if (node instanceof TagNode) {
-            lineNumbers = ":" + lineNumbering(node);
-            element = "tag &lt;" + node.getText() + "&gt;";
-        }
-        throw new ScimpiException("Error processing " + element + " in " + filePath + lineNumbers, e);
-    }
-
-    private String lineNumbering(final Node node) {
-        String lineNumbers;
-        final int startingLine = ((TagNode) node).getStartingLineNumber() + 1;
-        final int endingLine = ((TagNode) node).getStartingLineNumber() + 1;
-        if (startingLine == endingLine) {
-            lineNumbers = "" + startingLine;
-        } else {
-            lineNumbers = startingLine + "-" + endingLine;
-        }
-        return lineNumbers;
-    }
-
-    private void testForProcessorForTag(final Lexer lexer, final String tagName) {
-        final ElementProcessor elementProcessor = processors.getFor(tagName);
-        if (elementProcessor == null) {
-            throw new ScimpiException("No processor for tag " + tagName.toLowerCase());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
deleted file mode 100644
index 4e11481..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  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.processor;
-
-public interface PageWriter {
-
-    void appendAsHtmlEncoded(String string);
-
-    void appendHtml(String string);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
deleted file mode 100644
index 36c1920..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- *  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.processor;
-
-import java.util.HashMap;
-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.DebugUsersView;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.ErrorDetails;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.ErrorMessage;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.ErrorReference;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.History;
-import org.apache.isis.viewer.scimpi.dispatcher.view.VersionNumber;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionButton;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.Methods;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.Parameter;
-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.DebugAccessCheck;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.DebugCollectionView;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.DebugObjectView;
-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.Log;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.LogLevel;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Members;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.ShowDebug;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Specification;
-import org.apache.isis.viewer.scimpi.dispatcher.view.debug.ThrowException;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.AddMessage;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.AddWarning;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.Errors;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.Feedback;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldLabel;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldValue;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.GetField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.IncludeObject;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.ListView;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.LongFormView;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.Messages;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.SelectedObject;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.ShortFormView;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableCell;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableEmpty;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableHeader;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableRow;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableView;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.Title;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.Warnings;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.EditObject;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FormEntry;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FormField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.HiddenField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.RadioListField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.edit.Selector;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.ExcludeField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.IncludeField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.logon.Logoff;
-import org.apache.isis.viewer.scimpi.dispatcher.view.logon.Logon;
-import org.apache.isis.viewer.scimpi.dispatcher.view.logon.RestrictAccess;
-import org.apache.isis.viewer.scimpi.dispatcher.view.logon.Secure;
-import org.apache.isis.viewer.scimpi.dispatcher.view.logon.User;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.BlockDefine;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.BlockUse;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Commit;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.ContentTag;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.CookieValue;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.DefaultValue;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.EditLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.EndSession;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Forward;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.GetCookie;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Import;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.InitializeFromCookie;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.InitializeFromResult;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Localization;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Mark;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.NewActionLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.ObjectLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.PageTitle;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Redirect;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.RemoveElement;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.ScopeTag;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetCookie;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetCookieFromField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetFieldFromCookie;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetLocalization;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SimpleButton;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.StartSession;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.TemplateTag;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Unless;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Variable;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.When;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.ActionName;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.CountElements;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.ElementType;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.FieldName;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.ParameterName;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.TitleString;
-import org.apache.isis.viewer.scimpi.dispatcher.view.value.Type;
-
-public class ProcessorLookup {
-    private final Map<String, ElementProcessor> swfElementProcessors = new HashMap<String, ElementProcessor>();
-
-    public void init() {
-        addElementProcessor(new ActionLink());
-        addElementProcessor(new ActionButton());
-        addElementProcessor(new ActionForm());
-        addElementProcessor(new ActionName());
-        addElementProcessor(new AddMessage());
-        addElementProcessor(new AddWarning());
-        addElementProcessor(new BlockDefine());
-        addElementProcessor(new BlockUse());
-        addElementProcessor(new History());
-        addElementProcessor(new Collection());
-        addElementProcessor(new Commit());
-        addElementProcessor(new ContentTag());
-        addElementProcessor(new CountElements());
-        addElementProcessor(new Diagnostics());
-        addElementProcessor(new DebugAccessCheck());
-        addElementProcessor(new DebugCollectionView()); 
-        addElementProcessor(new DebuggerLink());
-        addElementProcessor(new DebugObjectView()); 
-        addElementProcessor(new DebugUsersView());
-        addElementProcessor(new DefaultValue());
-        addElementProcessor(new EditLink());
-        addElementProcessor(new EditObject());
-        addElementProcessor(new ElementType());
-        addElementProcessor(new Errors());
-        addElementProcessor(new ErrorDetails()); 
-        addElementProcessor(new ErrorMessage()); 
-        addElementProcessor(new ErrorReference());
-        addElementProcessor(new ExcludeField());
-        addElementProcessor(new Feedback());
-        addElementProcessor(new FieldLabel());
-        addElementProcessor(new FieldName());
-        addElementProcessor(new FieldValue());
-        addElementProcessor(new FormField());
-        addElementProcessor(new FormEntry());
-        addElementProcessor(new Forward());
-        addElementProcessor(new GetField());
-        addElementProcessor(new HelpLink());
-        addElementProcessor(new HiddenField());
-        addElementProcessor(new Import());
-        addElementProcessor(new IncludeObject());
-        addElementProcessor(new IncludeField());
-        addElementProcessor(new InitializeFromCookie());
-        addElementProcessor(new InitializeFromResult());
-        addElementProcessor(new Log());
-        addElementProcessor(new LogLevel());
-        addElementProcessor(new Logon());
-        addElementProcessor(new Logoff());
-        addElementProcessor(new LongFormView());
-        addElementProcessor(new LinkField());
-        addElementProcessor(new ListView());
-        addElementProcessor(new NewActionLink());
-        addElementProcessor(new Mark());
-        addElementProcessor(new Members());
-        addElementProcessor(new Messages());
-        addElementProcessor(new Methods());
-        addElementProcessor(new ObjectLink());
-        addElementProcessor(new PageTitle());
-        addElementProcessor(new Parameter());
-        addElementProcessor(new ParameterName());
-        addElementProcessor(new RadioListField());
-        addElementProcessor(new Redirect());
-        addElementProcessor(new RemoveElement());
-        addElementProcessor(new VersionNumber());
-        addElementProcessor(new RunAction());
-        addElementProcessor(new RestrictAccess());
-        addElementProcessor(new ScopeTag());
-        addElementProcessor(new Secure());
-        addElementProcessor(new SelectedObject());
-        addElementProcessor(new Selector());
-        addElementProcessor(new Services());
-        addElementProcessor(new ShortFormView());
-        addElementProcessor(new ShowDebug());
-        addElementProcessor(new SimpleButton());
-        addElementProcessor(new Specification());
-        addElementProcessor(new TableCell());
-        addElementProcessor(new TableView());
-        addElementProcessor(new TableBuilder());
-        addElementProcessor(new TableEmpty());
-        addElementProcessor(new TableRow());
-        addElementProcessor(new TableHeader());
-        addElementProcessor(new TemplateTag());
-        addElementProcessor(new Title());
-        addElementProcessor(new TitleString());
-        addElementProcessor(new ThrowException());
-        addElementProcessor(new Type());
-        addElementProcessor(new User());
-        addElementProcessor(new Unless());
-        addElementProcessor(new Variable());
-        addElementProcessor(new Warnings());
-        addElementProcessor(new When());
-
-        addElementProcessor(new StartSession());
-        addElementProcessor(new EndSession());
-
-        addElementProcessor(new CookieValue());
-        addElementProcessor(new SetCookie());
-        addElementProcessor(new GetCookie());
-        addElementProcessor(new SetCookieFromField());
-        addElementProcessor(new SetFieldFromCookie());
-        
-        // new, alpha, processors
-        addElementProcessor(new Localization());
-        addElementProcessor(new SetLocalization());
-    }
-
-    public void addElementProcessor(final ElementProcessor action) {
-        swfElementProcessors.put("SWF:" + action.getName().toUpperCase(), action);
-    }
-
-    public void debug(final DebugBuilder debug) {
-        debug.startSection("Recognised tags");
-        final Iterator<String> it2 = new TreeSet<String>(swfElementProcessors.keySet()).iterator();
-        while (it2.hasNext()) {
-            final String name = it2.next();
-            debug.appendln(name.toLowerCase(), swfElementProcessors.get(name));
-        }
-        debug.endSection();
-    }
-
-    public ElementProcessor getFor(final String name) {
-        return swfElementProcessors.get(name);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
deleted file mode 100644
index 118ff9b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- *  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.processor;
-
-import java.util.Stack;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HtmlSnippet;
-import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
-import org.apache.isis.viewer.scimpi.dispatcher.view.SwfTag;
-
-public class Request implements PageWriter {
-
-    public class RepeatMarker {
-        private final int index;
-
-        private RepeatMarker(final int index) {
-            this.index = index;
-        }
-
-        public void repeat() {
-            Request.this.index = index;
-        }
-    }
-
-    private static Logger LOG = LoggerFactory.getLogger(Request.class);
-    public static final boolean ENSURE_VARIABLES_EXIST = true;
-    public static final boolean NO_VARIABLE_CHECKING = false;
-    private static Encoder encoder;
-
-    public static Encoder getEncoder() {
-        return encoder;
-    }
-
-    private final RequestContext context;
-    private final Stack<Snippet> snippets;
-    private final Stack<StringBuffer> buffers;
-    private final Stack<BlockContent> blocks;
-    private final ProcessorLookup processors;
-    private int nextFormId;
-    private int index = -1;
-    private final String path;
-
-    public Request(final String path, final RequestContext context, final Encoder encoder, final Stack<Snippet> snippets, final ProcessorLookup processors) {
-        this.path = path;
-        this.context = context;
-        Request.encoder = encoder;
-        this.snippets = snippets;
-        this.processors = processors;
-
-        buffers = new Stack<StringBuffer>();
-        blocks = new Stack<BlockContent>();
-        pushNewBuffer();
-    }
-
-    public void processNextTag() {
-        while (index < snippets.size() - 1) {
-            index++;
-            final Snippet snippet = snippets.get(index);
-            if (snippet instanceof HtmlSnippet) {
-                appendSnippet((HtmlSnippet) snippet);
-            } else {
-                final SwfTag tag = (SwfTag) snippet;
-                final String name = tag.getName();
-                final ElementProcessor processor = processors.getFor(name);
-                process(tag, processor);
-                if (context.isAborted()) {
-                    return;
-                }
-            }
-        }
-    }
-
-    private void appendSnippet(final HtmlSnippet snippet) {
-        String html = snippet.getHtml();
-        try {
-            if (snippet.isContainsVariable()) {
-                html = context.replaceVariables(html);
-            }
-            appendHtml(html);
-        } catch (final TagProcessingException e) {
-            throw e;
-        } catch (final RuntimeException e) {
-            final String replace = "<";
-            final String withReplacement = "&lt;";
-            html = html.replaceAll(replace, withReplacement);
-
-            throw new TagProcessingException("Error while processing html block at " + snippet.errorAt() + " - " + e.getMessage(), html, e);
-        }
-    }
-
-    @Override
-    public void appendAsHtmlEncoded(final String string) {
-        appendHtml(encodeHtml(string));
-        // appendHtml(string);
-    }
-
-    @Override
-    public void appendHtml(final String html) {
-        final StringBuffer buffer = buffers.peek();
-        buffer.append(html);
-    }
-
-    public void appendDebug(final String line) {
-        context.appendDebugTrace(encodeHtml(line));
-    }
-
-    private String encodeHtml(final String text) {
-        return encoder.encoder(text);
-    }
-
-    public void appendTruncated(String text, final int truncateTo) {
-        if (truncateTo > 0 && text.length() > truncateTo) {
-            text = text.substring(0, truncateTo) + "...";
-        }
-        appendAsHtmlEncoded(text);
-    }
-
-    private void process(final SwfTag tag, final ElementProcessor processor) {
-        try {
-            LOG.debug("processing " + processor.getName() + " " + tag);
-            appendDebug("\n" + tag.debug());
-            if (tag.getType() == SwfTag.END) {
-                throw new TagProcessingException(tag.errorAt() + " - end tag mistaken for a start tag", tag.toString());
-            }
-            processor.process(this);
-        } catch (final TagProcessingException e) {
-            throw e;
-        } catch (final RuntimeException e) {
-            throw new TagProcessingException("Error while processing " + tag.getName().toLowerCase() + " element at " + tag.errorAt() + " - " + e.getMessage(), tag.toString(), e);
-        }
-    }
-
-    public void processUtilCloseTag() {
-        final SwfTag tag = getTag();
-        if (tag.getType() == SwfTag.EMPTY) {
-            return;
-        }
-        while (index < snippets.size() - 1) {
-            index++;
-            final Snippet snippet = snippets.get(index);
-            if (snippet instanceof HtmlSnippet) {
-                appendSnippet((HtmlSnippet) snippet);
-            } else {
-                final SwfTag nextTag = (SwfTag) snippet;
-                if (tag.getName().equals(nextTag.getName())) {
-                    if (nextTag.getType() == SwfTag.START) {
-                    } else {
-                        return;
-                    }
-                }
-                final String name = nextTag.getName();
-                if (nextTag.getType() == SwfTag.END && !tag.getName().equals(name)) {
-                    throw new TagProcessingException("Expected " + nextTag.getName().toLowerCase() + " tag but found " + tag.getName().toLowerCase() + " tag at " + nextTag.errorAt(), tag.toString());
-                }
-                final ElementProcessor processor = processors.getFor(name);
-                process(nextTag, processor);
-            }
-        }
-    }
-
-    public void skipUntilClose() {
-        final SwfTag tag = getTag();
-        if (tag.getType() == SwfTag.EMPTY) {
-            if (context.isDebug()) {
-                appendHtml("<!-- " + "skipped " + tag + " -->");
-            }
-            return;
-        }
-        int depth = 1;
-        while (index < snippets.size() - 1) {
-            index++;
-            final Snippet snippet = snippets.get(index);
-            if (snippet instanceof SwfTag) {
-                final SwfTag nextTag = (SwfTag) snippet;
-                if (tag.getName().equals(nextTag.getName())) {
-                    if (nextTag.getType() == SwfTag.START) {
-                        depth++;
-                    } else {
-                        depth--;
-                        if (depth == 0) {
-                            return;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public void closeEmpty() {
-        final SwfTag tag = getTag();
-        if (tag.getType() == SwfTag.EMPTY) {
-            return;
-        }
-        if (index < snippets.size()) {
-            final Snippet snippet = snippets.get(index);
-            if (snippet instanceof SwfTag) {
-                final SwfTag nextTag = (SwfTag) snippet;
-                if (nextTag.getType() == SwfTag.EMPTY) {
-                    return;
-                }
-            }
-        }
-        throw new ScimpiException("Empty tag not closed");
-    }
-
-    public void pushNewBuffer() {
-        final StringBuffer buffer = new StringBuffer();
-        buffers.push(buffer);
-    }
-
-    public String popBuffer() {
-        final String content = buffers.pop().toString();
-        return content;
-    }
-
-    public SwfTag getTag() {
-        return (SwfTag) snippets.get(index);
-    }
-
-    public RequestContext getContext() {
-        return context;
-    }
-
-    // TODO rename to pushBlock()
-    public void setBlockContent(final BlockContent content) {
-        blocks.add(content);
-    }
-
-    public BlockContent popBlockContent() {
-        return blocks.pop();
-    }
-
-    public BlockContent getBlockContent() {
-        return blocks.peek();
-    }
-
-    public String getViewPath() {
-        return path;
-    }
-
-    public String nextFormId() {
-        return String.valueOf(nextFormId++);
-    }
-
-    public String getOptionalProperty(final String name, final String defaultValue) {
-        return getOptionalProperty(name, defaultValue, true);
-    }
-
-    public String getOptionalProperty(final String name, final String defaultValue, final boolean ensureVariablesExists) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.getOptionalProperty(name, defaultValue, ensureVariablesExists);
-    }
-
-    public String getOptionalProperty(final String name) {
-        return getOptionalProperty(name, true);
-    }
-
-    public String getOptionalProperty(final String name, final boolean ensureVariablesExists) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.getOptionalProperty(name, ensureVariablesExists);
-    }
-
-    public Attributes getAttributes() {
-        return getTag().getAttributes();
-    }
-
-    public String getRequiredProperty(final String name) {
-        return getRequiredProperty(name, true);
-    }
-
-    public String getRequiredProperty(final String name, final boolean ensureVariablesExists) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.getRequiredProperty(name, ensureVariablesExists);
-    }
-
-    public boolean isRequested(final String name) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.isRequested(name);
-    }
-
-    public boolean isRequested(final String name, final boolean defaultValue) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.isRequested(name, defaultValue);
-    }
-
-    public boolean isPropertySet(final String name) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.isPropertySet(name);
-    }
-
-    public boolean isPropertySpecified(final String name) {
-        final Attributes attributes = getTag().getAttributes();
-        return attributes.isPropertySpecified(name);
-    }
-
-    public RepeatMarker createMarker() {
-        return new RepeatMarker(index);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java
deleted file mode 100644
index 8b7a2d5..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  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.processor;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-public class SimpleEncoder implements Encoder {
-
-    @Override
-    public String encoder(final String text) {
-        return StringEscapeUtils.escapeHtml(text);
-        // text.replace("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">",
-        // "&gt;").replace("\"", "&quot;");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
deleted file mode 100644
index d9a8a60..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  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.processor;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-
-public class TagProcessingException extends ScimpiException {
-    private static final long serialVersionUID = 1L;
-    private String context;
-
-    public TagProcessingException() {
-        super();
-    }
-
-    public TagProcessingException(final String message, final String context, final Throwable cause) {
-        super(message, cause);
-        this.context = context;
-    }
-
-    public TagProcessingException(final String message, final String context) {
-        super(message);
-        this.context = context;
-    }
-
-    public TagProcessingException(final Throwable cause) {
-        super(cause);
-    }
-
-    public String getContext() {
-        return context;
-    }
-
-    @Override
-    public String getMessage() {
-        return super.getMessage() + "\n" + getContext();
-    }
-
-    @Override
-    public String getHtmlMessage() {
-        return super.getMessage() + "<pre>" + getContext() + "</pre>";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
deleted file mode 100644
index a6ae574..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *  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.util;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.services.ServiceUtil;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.session.IsisSession;
-import org.apache.isis.viewer.scimpi.dispatcher.DispatchException;
-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;
-
-public class MethodsUtils {
-    public static final String SERVICE_PREFIX = "service:";
-
-    public static Consent canRunMethod(final ObjectAdapter target, final ObjectAction action, final ObjectAdapter[] parameters) {
-        final Consent consent = action.isProposedArgumentSetValid(target, parameters == null ? new ObjectAdapter[0] : parameters);
-        return consent;
-    }
-
-    public static boolean runMethod(final RequestContext context, final ObjectAction action, final ObjectAdapter target, final ObjectAdapter[] parameters, String variable, Scope scope) {
-        scope = scope == null ? Scope.REQUEST : scope;
-        variable = variable == null ? RequestContext.RESULT : variable;
-
-        final ObjectAdapter result = action.execute(target, parameters == null ? new ObjectAdapter[0] : parameters);
-        if (result == null) {
-            return false;
-        } else {
-            final String mappedId = context.mapObject(result, scope);
-            context.addVariable(variable, mappedId, scope);
-            // context.addVariable(variable + "_type",
-            // action.getFacet(TypeOfFacet.class), scope);
-            return true;
-        }
-    }
-
-    public static boolean runMethod(final RequestContext context, final ObjectAction action, final ObjectAdapter target, final ObjectAdapter[] parameters) {
-        return runMethod(context, action, target, parameters, null, null);
-    }
-
-    public static ObjectAction findAction(final ObjectAdapter object, final String methodName) {
-        if (object == null) {
-            throw new ScimpiException("Object not specified when looking for " + methodName);
-        }
-
-        final List<ObjectAction> actions = object.getSpecification().getObjectActions(Contributed.INCLUDED);
-        final ObjectAction action = findAction(actions, methodName);
-        /*
-         * if (action == null) { actions =
-         * object.getSpecification().getServiceActionsFor(ObjectActionType.USER,
-         * ObjectActionType.EXPLORATION, ObjectActionType.DEBUG); action =
-         * findAction(actions, methodName); }
-         */
-        if (action == null) {
-            throw new DispatchException("Failed to find action " + methodName + " on " + object);
-        }
-        return action;
-    }
-
-    private static ObjectAction findAction(final List<ObjectAction> actions, final String methodName) {
-        for (int i = 0; i < actions.size(); i++) {
-            final ObjectAction objectAction = actions.get(i);
-            if (objectAction.getId().equals(methodName)) {
-                return objectAction;
-            }
-        }
-        return null;
-    }
-
-    public static ObjectAdapter findObject(final RequestContext context, String objectId) {
-        if (objectId == null) {
-            objectId = context.getStringVariable(RequestContext.RESULT);
-        }
-
-        if (objectId != null && objectId.startsWith(SERVICE_PREFIX)) {
-            final String serviceId = objectId.substring(SERVICE_PREFIX.length());
-            final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
-            for (final ObjectAdapter serviceAdapter : serviceAdapters) {
-                final Object service = serviceAdapter.getObject();
-                if (ServiceUtil.id(service).equals(serviceId.trim())) {
-                    final ObjectAdapter adapter = getAdapterManager().getAdapterFor(service);
-                    return adapter;
-                }
-            }
-            throw new DispatchException("Failed to find service " + serviceId);
-        } else {
-            return context.getMappedObject(objectId);
-        }
-    }
-
-    public static boolean isVisible(final ObjectAdapter object, final ObjectAction action, Where where) {
-        return action.isVisible(getAuthenticationSession(), object, where).isAllowed();
-    }
-
-    public static String isUsable(final ObjectAdapter object, final ObjectAction action, Where where) {
-        final Consent usable = action.isUsable(getAuthenticationSession(), object, where);
-        final boolean isUsable = getSession() != null && usable.isAllowed();
-        return isUsable ? null : usable.getReason();
-    }
-
-    public static boolean isVisibleAndUsable(final ObjectAdapter object, final ObjectAction action, Where where) {
-        AuthenticationSession authenticatedSession = getAuthenticationSession();
-        final boolean isVisible = action.isVisible(authenticatedSession, object, where).isAllowed();
-        final boolean isUsable = getSession() != null && action.isUsable(authenticatedSession, object, where).isAllowed();
-        final boolean isVisibleAndUsable = isVisible && isUsable;
-        return isVisibleAndUsable;
-    }
-
-    private static AuthenticationSession getAuthenticationSession() {
-        return IsisContext.getAuthenticationSession();
-    }
-
-    private static IsisSession getSession() {
-        return IsisContext.getSession();
-    }
-
-    private static AdapterManager getAdapterManager() {
-        return getPersistenceSession().getAdapterManager();
-    }
-
-    private static PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
deleted file mode 100644
index 477828d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  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.view;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class HelpLink extends AbstractElementProcessor {
-
-    private static String site;
-    private static String suffix;
-
-    public static void append(final Request request, final String description, final String helpReference) {
-        request.appendHtml(createHelpSegment(description, helpReference));
-    }
-
-    public static String createHelpSegment(final String description, final String helpReference) {
-        if (site == null) {
-            site = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-site", "/help/");
-        }
-        if (suffix == null) {
-            suffix = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-suffix", "shtml");
-            if (suffix == null || suffix.equals("")) {
-                suffix = "";
-            } else {
-                suffix = "." + suffix;
-            }
-        }
-
-        if (helpReference == null || helpReference.equals("No help available")) {
-            return "";
-        } else {
-            final String elementClass = "help-link";
-            final String link = site + helpReference + suffix;
-            final String linkText = "Help";
-            final String target = "scimpi-help";
-            final String titleSection = description == null ? "" : ("\" title=\"" + description);
-            return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\"" + target + titleSection + "\"><img src=\"/images/help.png\" alt=\"" + linkText + "\" /></a>";
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "help";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String description = null;
-        final String helpReference = request.getRequiredProperty("ref");
-        append(request, description, helpReference);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
deleted file mode 100644
index 2f2a9b7..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *  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.view;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class History extends AbstractElementProcessor {
-
-    private static final String _HISTORY = "_history";
-
-    static class Crumb {
-        String name;
-        String link;
-    }
-
-    static class Crumbs implements Serializable {
-        private static final long serialVersionUID = 1L;
-        private static final int MAXIMUM_SIZE = 10;
-        private final List<Crumb> crumbs = new ArrayList<Crumb>();
-
-        public void add(final String name, final String link) {
-            for (final Crumb crumb : crumbs) {
-                if (crumb.link.equals(link)) {
-                    crumbs.remove(crumb);
-                    crumbs.add(crumb);
-                    return;
-                }
-            }
-
-            final Crumb crumb = new Crumb();
-            crumb.name = name;
-            crumb.link = link;
-            crumbs.add(crumb);
-
-            if (crumbs.size() > MAXIMUM_SIZE) {
-                crumbs.remove(0);
-            }
-        }
-
-        public void clear() {
-            crumbs.clear();
-        }
-
-        public boolean isEmpty() {
-            return crumbs.size() == 0;
-        }
-
-        public int size() {
-            return crumbs.size();
-        }
-
-        public Iterable<Crumb> iterator() {
-            return crumbs;
-        }
-
-    }
-
-    @Override
-    public String getName() {
-        return "history";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String action = request.getOptionalProperty("action", "display");
-        final Crumbs crumbs = getCrumbs(request);
-        if (action.equals("display") && crumbs != null) {
-            write(crumbs, request);
-        } else if (action.equals("link")) {
-            final String name = request.getRequiredProperty(NAME);
-            final String link = request.getRequiredProperty(LINK_VIEW);
-            crumbs.add(name, link);
-        } else if (action.equals("object")) {
-            final String id = request.getOptionalProperty(OBJECT);
-            final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), id);
-            final String name = object.titleString();
-            String link = request.getRequiredProperty(LINK_VIEW);
-            link += "?_result=" + id;
-            crumbs.add(name, link);
-        } else if (action.equals("return")) {
-
-        } else if (action.equals("clear")) {
-            crumbs.clear();
-        }
-
-    }
-
-    public void write(final Crumbs crumbs, final Request request) {
-        if (crumbs.isEmpty()) {
-            return;
-        }
-
-        request.appendHtml("<div id=\"history\">");
-        int i = 0;
-        final int length = crumbs.size();
-        for (final Crumb crumb : crumbs.iterator()) {
-            final String link = crumb.link;
-            if (i > 0) {
-                request.appendHtml("<span class=\"separator\"> | </span>");
-            }
-            if (i == length - 1 || link == null) {
-                request.appendHtml("<span class=\"disabled\">");
-                request.appendHtml(crumb.name);
-                request.appendHtml("</span>");
-            } else {
-                request.appendHtml("<a class=\"linked\" href=\"" + link + "\">");
-                request.appendHtml(crumb.name);
-                request.appendHtml("</a>");
-            }
-            i++;
-        }
-        request.appendHtml("</div>");
-    }
-
-    private Crumbs getCrumbs(final Request request) {
-        final RequestContext context = request.getContext();
-        Crumbs crumbs = (Crumbs) context.getVariable(_HISTORY);
-        if (crumbs == null) {
-            crumbs = new Crumbs();
-            context.addVariable(_HISTORY, crumbs, Scope.SESSION);
-        }
-        return crumbs;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
deleted file mode 100644
index f1807df..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  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.view;
-
-public class HtmlSnippet implements Snippet {
-    private final StringBuffer html = new StringBuffer();
-    private boolean containsVariable;
-    private final String lineNumbers;
-    private final String path;
-
-    public HtmlSnippet(final String lineNumbers, final String path) {
-        this.lineNumbers = lineNumbers;
-        this.path = path;
-    }
-
-    public void append(final String html) {
-        this.html.append(html);
-        containsVariable |= html.indexOf("${") >= 0;
-    }
-
-    @Override
-    public String getHtml() {
-        return html.toString();
-    }
-
-    public boolean isContainsVariable() {
-        return containsVariable;
-    }
-
-    @Override
-    public String errorAt() {
-        return path + ":" + lineNumbers;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
deleted file mode 100644
index b8a7b3e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  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.view;
-
-public interface Snippet {
-
-    String getHtml();
-
-    String errorAt();
-}


[03/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
new file mode 100644
index 0000000..dc5b39a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
@@ -0,0 +1,565 @@
+/*
+ *  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.view.simple;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public abstract class AbstractConditionalBlock extends AbstractElementProcessor {
+
+    private static Map<String, Test> tests = new HashMap<String, Test>();
+
+    static {
+        addNormal(new TestHasRole(), "has-role");
+        addNegated(new TestHasRole(), "has-not-role");
+
+        addNormal(new TestVariableExists(), "variable-exists");
+        addNegated(new TestVariableExists(), "variable-missing");
+        addNormal(new TestVariableTrue(), "variable-true");
+        addNegated(new TestVariableTrue(), "variable-false");
+
+        addNormal(new TestObjectPersistent(), "object-persistent");
+        addNegated(new TestObjectPersistent(), "object-transient");
+        addNormal(new TestObjectType(), "object-type");
+        /*
+         * addNormal(new TestObjectIs(), "object-is"); addNegated(new
+         * TestObjectIs(), "object-is-not"); addNormal(new TestObjectType(),
+         * "object-type"); addNormal(new TestObjectType(),
+         * "object-title-equals"); addNegated(new TestObjectType(),
+         * "object-title-not-equals"); addNormal(new TestObjectType(),
+         * "object-title-contains"); addNegated(new TestObjectType(),
+         * "object-title-not-contains");
+         */
+        addNormal(new TestCollectionFull(), "collection-full");
+        addNegated(new TestCollectionFull(), "collection-empty");
+        addNormal(new TestCollectionType(), "collection-type");
+        // addNormal(new TestCollectionSize(), "collection-size-equal");
+        // addNormal(new TestCollectionSize(), "collection-size-less-than");
+        // addNormal(new TestCollectionSize(), "collection-size-greater-than");
+
+        addNormal(new TestFieldValue(), "test-field");
+        addNegated(new TestFieldValue(), "test-field");
+           
+        addNormal(new TestFieldExists(), "field-exists");
+        addNegated(new TestFieldExists(), "field-missing");
+        addNormal(new TestFieldVisible(), "field-visible");
+        addNegated(new TestFieldVisible(), "field-hidden");
+        addNormal(new TestFieldEditable(), "field-editable");
+        addNegated(new TestFieldEditable(), "field-not-editable");
+        addNormal(new TestFieldType(), "field-type");
+        addNormal(new TestFieldSet(), "field-set");
+        addNegated(new TestFieldSet(), "field-empty");
+        // empty/set etc
+
+        addNormal(new TestMethodExists(), "method-exists");
+        addNegated(new TestMethodExists(), "method-missing");
+        addNormal(new TestMethodVisible(), "method-visible");
+        addNegated(new TestMethodVisible(), "method-hidden");
+        addNormal(new TestMethodUseable(), "method-useable");
+        addNegated(new TestMethodUseable(), "method-not-useable");
+
+    }
+
+    private static void addNegated(final Test test, final String name) {
+        test.name = name;
+        test.negateResult = true;
+        tests.put(name, test);
+    }
+
+    private static void addNormal(final Test test, final String name) {
+        test.name = name;
+        tests.put(name, test);
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+
+        boolean checkMade = false;
+        boolean allConditionsMet = true;
+
+        final String[] propertyNames = request.getAttributes().getPropertyNames(new String[] { "object", "collection" });
+        for (final String propertyName : propertyNames) {
+            boolean result;
+            if (propertyName.equals("set")) {
+                result = request.isPropertySet("set");
+            } else {
+                final Test test = tests.get(propertyName);
+                if (test == null) {
+                    throw new ScimpiException("No such test: " + propertyName);
+                }
+                final String attributeValue = request.getOptionalProperty(propertyName, false);
+                result = test.test(request, attributeValue, id);
+                if (test.negateResult) {
+                    result = !result;
+                }
+            }
+            checkMade = true;
+            allConditionsMet &= result;
+        }
+
+        /*
+         * 
+         * // Check variables if
+         * (request.isPropertySpecified("variable-exists")) { boolean
+         * valuePresent = request.isPropertySet("variable-exists"); checkMade =
+         * true; allConditionsMet &= valuePresent; }
+         * 
+         * String variable = request.getOptionalProperty("variable-true"); if
+         * (variable != null) { String value = (String)
+         * request.getContext().getVariable(variable); checkMade = true;
+         * allConditionsMet &= Attributes.isTrue(value); }
+         * 
+         * variable = request.getOptionalProperty("variable-equals"); if
+         * (variable != null) { String value = (String)
+         * request.getContext().getVariable(variable); checkMade = true;
+         * allConditionsMet &= variable.equals(value); }
+         */
+        // Check Object
+
+        /*
+         * // Check Collection String collection =
+         * request.getOptionalProperty("collection-" + TYPE); if (collection !=
+         * null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), collection); Class<?>
+         * cls = forClass(request); TypeOfFacet facet =
+         * object.getSpecification().getFacet(TypeOfFacet.class); boolean
+         * hasType = object != null && (cls == null ||
+         * cls.isAssignableFrom(facet.value())); checkMade = true;
+         * allConditionsMet &= hasType;; }
+         * 
+         * collection = request.getOptionalProperty("collection-" + "empty"); if
+         * (collection != null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); CollectionFacet
+         * facet = object.getSpecification().getFacet(CollectionFacet.class);
+         * boolean isEmpty = facet != null && facet.size(object) == 0;
+         * processTags(isEmpty, request); allConditionsMet &= isEmpty; }
+         */
+
+        // Check Methods
+        /*
+         * String method = request.getOptionalProperty(METHOD + "-exists"); if
+         * (method != null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); List<? extends
+         * ObjectAction> objectActions =
+         * object.getSpecification().getObjectActions(ActionType.USER); boolean
+         * methodExists = false; for (ObjectAction objectAssociation :
+         * objectActions) { if (objectAssociation.getId().equals(method)) {
+         * methodExists = true; break; } } checkMade = true; allConditionsMet &=
+         * methodExists; }
+         * 
+         * method = request.getOptionalProperty(METHOD + "-visible"); if (method
+         * != null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); // TODO needs to
+         * work irrespective of parameters ObjectAction objectAction =
+         * object.getSpecification().getObjectAction(ActionType.USER, method,
+         * ObjectSpecification.EMPTY_LIST); Consent visible =
+         * objectAction.isVisible(IsisContext.getAuthenticationSession(),
+         * object); checkMade = true; allConditionsMet &= visible.isAllowed(); }
+         * 
+         * method = request.getOptionalProperty(METHOD + "-usable"); if (method
+         * != null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); // TODO needs to
+         * work irrespective of parameters ObjectAction objectAction =
+         * object.getSpecification().getObjectAction(ActionType.USER, method,
+         * ObjectSpecification.EMPTY_LIST); Consent usable =
+         * objectAction.isUsable(IsisContext.getAuthenticationSession(),
+         * object); checkMade = true; allConditionsMet &= usable.isAllowed(); }
+         * 
+         * 
+         * // Check Fields String field = request.getOptionalProperty(FIELD +
+         * "-exists"); if (field != null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); List<? extends
+         * ObjectAssociation> objectFields =
+         * object.getSpecification().getAssociations(); boolean fieldExists =
+         * false; for (ObjectAssociation objectAssociation : objectFields) { if
+         * (objectAssociation.getId().equals(field)) { fieldExists = true;
+         * break; } } checkMade = true; allConditionsMet &= fieldExists; }
+         * 
+         * field = request.getOptionalProperty(FIELD + "-visible"); if (field !=
+         * null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
+         * objectField = object.getSpecification().getAssociation(field);
+         * Consent visible =
+         * objectField.isVisible(IsisContext.getAuthenticationSession(),
+         * object); checkMade = true; allConditionsMet &= visible.isAllowed(); }
+         * 
+         * field = request.getOptionalProperty(FIELD + "-editable"); if (field
+         * != null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
+         * objectField = object.getSpecification().getAssociation(field);
+         * Consent usable =
+         * objectField.isUsable(IsisContext.getAuthenticationSession(), object);
+         * checkMade = true; allConditionsMet &= usable.isAllowed(); }
+         * 
+         * field = request.getOptionalProperty(FIELD + "-empty"); if (field !=
+         * null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
+         * objectField = object.getSpecification().getAssociation(field);
+         * IsisContext.getPersistenceSession().resolveField(object,
+         * objectField); ObjectAdapter fld = objectField.get(object); if (fld ==
+         * null) { checkMade = true; allConditionsMet &= true; } else {
+         * CollectionFacet facet =
+         * fld.getSpecification().getFacet(CollectionFacet.class); boolean
+         * isEmpty = facet != null && facet.size(fld) == 0; processTags(isEmpty,
+         * request); allConditionsMet &= isEmpty; } }
+         * 
+         * field = request.getOptionalProperty(FIELD + "-set"); if (field !=
+         * null) { ObjectAdapter object =
+         * MethodsUtils.findObject(request.getContext(), id); ObjectAssociation
+         * objectField = object.getSpecification().getAssociation(field);
+         * IsisContext.getPersistenceSession().resolveField(object,
+         * objectField); ObjectAdapter fld = objectField.get(object); if (fld ==
+         * null) { throw new ScimpiException("No object for field-set " +
+         * field); } Object fieldValue = fld.getObject(); if (fieldValue
+         * instanceof Boolean) { checkMade = true; allConditionsMet &=
+         * ((Boolean) fieldValue).booleanValue(); } else { checkMade = true;
+         * allConditionsMet &= true; } }
+         */
+
+        // Check User
+        /*
+         * String hasRole = request.getOptionalProperty("has-role"); if (hasRole
+         * != null) { AuthenticationSession session =
+         * IsisContext.getSession().getAuthenticationSession(); List<String>
+         * roles = session.getRoles(); boolean hasMatchingRole = false; for
+         * (String role : roles) { if (role.equals(hasRole.trim())) {
+         * hasMatchingRole = true; break; } } checkMade = true; allConditionsMet
+         * &= hasMatchingRole; }
+         */
+
+        final String persistent = request.getOptionalProperty("persistent");
+        if (persistent != null) {
+            final ObjectAdapter object = request.getContext().getMappedObjectOrResult(persistent);
+            checkMade = true;
+            allConditionsMet &= object.representsPersistent();
+        }
+        /*
+         * String type = request.getOptionalProperty(TYPE); if (type != null) {
+         * ObjectAdapter object = MethodsUtils.findObject(request.getContext(),
+         * id); Class<?> cls = forClass(request); boolean hasType = object !=
+         * null && (cls == null ||
+         * cls.isAssignableFrom(object.getObject().getClass())); checkMade =
+         * true; allConditionsMet &= hasType;; }
+         */
+        if (request.isPropertySpecified("empty")) {
+            if (request.isPropertySet("empty")) {
+                final String collection = request.getOptionalProperty("empty");
+                if (collection != null) {
+                    final ObjectAdapter object = request.getContext().getMappedObjectOrResult(collection);
+                    final CollectionFacet facet = object.getSpecification().getFacet(CollectionFacet.class);
+                    checkMade = true;
+                    allConditionsMet &= facet.size(object) == 0;
+                }
+            } else {
+                checkMade = true;
+                allConditionsMet &= true;
+            }
+        }
+
+        if (request.isPropertySpecified("set")) {
+            final boolean valuePresent = request.isPropertySet("set");
+            checkMade = true;
+            allConditionsMet &= valuePresent;
+        }
+
+        if (checkMade) {
+            processTags(allConditionsMet, request);
+        } else {
+            throw new ScimpiException("No condition in " + getName());
+        }
+    }
+
+    protected abstract void processTags(boolean isSet, Request request);
+
+}
+
+abstract class Test {
+    String name;
+    boolean negateResult;
+
+    abstract boolean test(Request request, String attributeName, String targetId);
+
+    protected Class<?> forClass(final String className) {
+        Class<?> cls = null;
+        if (className != null) {
+            try {
+                cls = Class.forName(className);
+            } catch (final ClassNotFoundException e) {
+                throw new ScimpiException("No class for " + className, e);
+            }
+        }
+        return cls;
+    }
+    
+    protected ObjectAction findMethod(final String attributeName, final ObjectAdapter object) {
+        final ObjectAction objectAction = object.getSpecification().getObjectAction(ActionType.USER, attributeName, ObjectSpecification.EMPTY_LIST);
+        if (objectAction == null) {
+            throw new ScimpiException("No such method found in " + object.getSpecification().getIdentifier().getClassName() + " : " + attributeName);
+        }
+        return objectAction;
+    }
+
+    protected ObjectAssociation findProperty(final String attributeName, final ObjectAdapter object) {
+        final ObjectAssociation objectField = object.getSpecification().getAssociation(attributeName);
+        if (objectField == null) {
+            throw new ScimpiException("No such property found in " + object.getSpecification().getIdentifier().getClassName() + ": " + attributeName);
+        }
+        return objectField;
+    }
+
+}
+
+class TestVariableExists extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        Object variable = request.getContext().getVariable(attributeName);
+        if (variable instanceof String && ((String) variable).equals("")) {
+            return false;
+        }
+        return variable != null;
+    }
+}
+
+class TestVariableTrue extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final Object variable = request.getContext().getVariable(attributeName);
+        final Boolean value = variable instanceof Boolean ? (Boolean) variable : Boolean.valueOf((String) variable);
+        return value != null && value.booleanValue();
+    }
+}
+
+class TestObjectPersistent extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(attributeName);
+        return object.representsPersistent();
+    }
+}
+
+class TestObjectType extends TestObjectPersistent {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final Class<?> cls = forClass(attributeName);
+        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(object.getObject().getClass()));
+        return hasType;
+    }
+}
+
+class TestCollectionType extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final Class<?> cls = forClass(attributeName);
+        final TypeOfFacet facet = object.getSpecification().getFacet(TypeOfFacet.class);
+        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(facet.value()));
+        return hasType;
+    }
+}
+
+class TestCollectionFull extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), attributeName);
+        final CollectionFacet facet = object.getSpecification().getFacet(CollectionFacet.class);
+        final boolean isEmpty = facet != null && facet.size(object) == 0;
+        return !isEmpty;
+    }
+}
+
+class TestMethodExists extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final List<? extends ObjectAction> objectActions = object.getSpecification().getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
+        boolean methodExists = false;
+        for (final ObjectAction objectAssociation : objectActions) {
+            if (objectAssociation.getId().equals(attributeName)) {
+                methodExists = true;
+                break;
+            }
+        }
+        return methodExists;
+    }
+}
+
+class TestMethodVisible extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        // TODO needs to work irrespective of parameters
+        final ObjectAction objectAction = findMethod(attributeName, object);
+        final Consent visible = objectAction.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
+        return visible.isAllowed();
+    }
+}
+
+class TestMethodUseable extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        // TODO needs to work irrespective of parameters
+        final ObjectAction objectAction = findMethod(attributeName, object);
+        final Consent usable = objectAction.isUsable(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
+        return usable.isAllowed();
+    }
+}
+
+class TestFieldExists extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final List<? extends ObjectAssociation> objectFields = object.getSpecification().getAssociations(Contributed.EXCLUDED);
+        boolean fieldExists = false;
+        for (final ObjectAssociation objectAssociation : objectFields) {
+            if (objectAssociation.getId().equals(attributeName)) {
+                fieldExists = true;
+                break;
+            }
+        }
+        return fieldExists;
+    }
+}
+
+class TestFieldVisible extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final ObjectAssociation objectField = findProperty(attributeName, object);
+        final Consent visible = objectField.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
+        return visible.isAllowed();
+    }
+}
+
+class TestFieldEditable extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final ObjectAssociation objectField = findProperty(attributeName, object);
+        final Consent usable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
+        return usable.isAllowed();
+    }
+}
+
+class TestFieldType extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final Class<?> cls = forClass(attributeName);
+        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(object.getObject().getClass()));
+        return hasType;
+    }
+}
+
+class TestFieldSet extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final ObjectAssociation objectField = findProperty(attributeName, object);
+
+        ResolveFieldUtil.resolveField(object, objectField);
+        final ObjectAdapter fld = objectField.get(object);
+        if (fld != null) {
+            final Object fieldValue = fld.getObject();
+            if (fieldValue instanceof Boolean) {
+                return ((Boolean) fieldValue).booleanValue();
+            } else if (fld.getSpecification().containsFacet(CollectionFacet.class)) {
+                final CollectionFacet facet = fld.getSpecification().getFacet(CollectionFacet.class);
+                final boolean isEmpty = facet != null && facet.size(fld) == 0;
+                return !isEmpty;
+            } else {
+                return true;
+            }
+        }
+        return false;
+    }
+}
+
+class TestFieldValue extends Test {
+    @Override
+    boolean test(Request request, String attributeName, String targetId) {
+        int pos = attributeName.indexOf("==");
+        // TODO test for other comparators
+        // TODO fail properly if none found
+        String fieldName = attributeName.substring(0, pos);
+        String fieldValue = attributeName.substring(pos + 2);
+        
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
+        final ObjectAssociation objectField = findProperty(fieldName, object);
+        ResolveFieldUtil.resolveField(object, objectField);
+        final ObjectAdapter fld = objectField.get(object);
+        
+        // TODO test for reference or value
+        final ObjectAdapter object2 = MethodsUtils.findObject(request.getContext(), fieldValue);
+        
+        if (fld == object2) {
+            return true;
+        }
+        return false;
+    }
+    
+}
+
+class TestHasRole extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final String[] requiredRoles = attributeName.split("\\|");
+        final AuthenticationSession session = IsisContext.getSession().getAuthenticationSession();
+        final List<String> sessionRoles = session.getRoles();
+        for (final String sessionRole : sessionRoles) {
+            for (final String requiredRole : requiredRoles) {
+                if (requiredRole.trim().equals(sessionRole)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}
+
+class TestSet extends Test {
+    @Override
+    boolean test(final Request request, final String attributeName, final String targetId) {
+        final boolean valuePresent = request.isPropertySet("set");
+        return valuePresent;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
new file mode 100644
index 0000000..b6798be
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
@@ -0,0 +1,121 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public abstract class AbstractLink extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String title = request.getOptionalProperty(FORM_TITLE);
+        final String name = request.getOptionalProperty(NAME);
+        final boolean showAsButton = request.isRequested("show-as-button", false);
+        final String linkClass = request.getOptionalProperty(CLASS, showAsButton ? "button" : defaultLinkClass());
+        final String containerClass = request.getOptionalProperty(CONTAINER_CLASS, "action");
+        final String object = request.getOptionalProperty(OBJECT);
+        final RequestContext context = request.getContext();
+        String objectId = object != null ? object : (String) context.getVariable(RequestContext.RESULT);
+        ObjectAdapter adapter = MethodsUtils.findObject(context, objectId);
+
+        // REVIEW this is common used code
+        final String fieldName = request.getOptionalProperty(FIELD);
+        if (fieldName != null) {
+            final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
+            if (field == null) {
+                throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
+            }
+            
+            // REVIEW: should provide this rendering context, rather than hardcoding.
+            // the net effect currently is that class members annotated with 
+            // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+            // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+            // for any other value for Where
+            final Where where = Where.ANYWHERE;
+            
+            if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+            }
+            ResolveFieldUtil.resolveField(adapter, field);
+            adapter = field.get(adapter);
+            if (adapter != null) {
+                objectId = context.mapObject(adapter, Scope.INTERACTION);
+            }
+        }
+
+        if (adapter != null && valid(request, adapter)) {
+            final String variable = request.getOptionalProperty("param-name", RequestContext.RESULT);
+            final String variableSegment = variable + "=" + objectId;
+
+            String view = request.getOptionalProperty(VIEW);
+            if (view == null) {
+                view = defaultView();
+            }
+            view = context.fullUriPath(view);
+            final String classSegment = " class=\"" + linkClass + "\"";
+            final String titleSegment = title == null ? "" : (" title=\"" + title + "\"");
+            String additionalSegment = additionalParameters(request);
+            additionalSegment = additionalSegment == null ? "" : "&amp;" + additionalSegment;
+            if (showAsButton) {
+                request.appendHtml("<div class=\"" + containerClass + "\">");
+            }
+            request.appendHtml("<a" + classSegment + titleSegment + " href=\"" + view + "?" + variableSegment + context.encodedInteractionParameters() + additionalSegment + "\">");
+            request.pushNewBuffer();
+            request.processUtilCloseTag();
+            final String buffer = request.popBuffer();
+            if (buffer.trim().length() > 0) {
+                request.appendHtml(buffer);
+            } else {
+                request.appendAsHtmlEncoded(linkLabel(name, adapter));
+            }
+            request.appendHtml("</a>");
+            if (showAsButton) {
+                request.appendHtml("</div>");
+            }
+        } else {
+            request.skipUntilClose();
+        }
+    }
+
+    private String defaultLinkClass() {
+        return "action";
+    }
+
+    protected abstract String linkLabel(String name, ObjectAdapter object);
+
+    protected String additionalParameters(final Request request) {
+        return null;
+    }
+
+    protected abstract boolean valid(Request request, ObjectAdapter adapter);
+
+    protected abstract String defaultView();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java
new file mode 100644
index 0000000..cea5d11
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockDefine.java
@@ -0,0 +1,42 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
+
+public class BlockDefine extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "block";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getOptionalProperty(NAME, "unamed");
+        final RepeatMarker start = request.createMarker();
+        request.skipUntilClose();
+        request.getContext().addVariable("_block-" + name, start, Scope.REQUEST);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java
new file mode 100644
index 0000000..efd6128
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/BlockUse.java
@@ -0,0 +1,46 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
+
+public class BlockUse extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "use-block";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getOptionalProperty(NAME, "unamed");
+        request.closeEmpty();
+        final RepeatMarker end = request.createMarker();
+
+        final RepeatMarker marker = (RepeatMarker) request.getContext().getVariable("_block-" + name);
+        marker.repeat();
+
+        request.processUtilCloseTag();
+        end.repeat();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java
new file mode 100644
index 0000000..4106fd9
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Commit.java
@@ -0,0 +1,45 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Commit extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "commit";
+    }
+
+    @Override
+    public void process(final Request request) {
+        // Note - the session will have changed since the earlier call if a user
+        // has logged in or out in the action
+        // processing above.
+        final IsisTransactionManager transactionManager = IsisContext.getPersistenceSession().getTransactionManager();
+        if (transactionManager.getTransaction().getState().canCommit()) {
+            transactionManager.endTransaction();
+            transactionManager.startTransaction();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java
new file mode 100644
index 0000000..ddda339
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ContentTag.java
@@ -0,0 +1,36 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ContentTag implements ElementProcessor {
+
+    @Override
+    public String getName() {
+        return "content";
+    }
+
+    @Override
+    public void process(final Request request) {
+        request.appendHtml("<!--  apply content  -->");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java
new file mode 100644
index 0000000..09e56b0
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/CookieValue.java
@@ -0,0 +1,46 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class CookieValue extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        String name = request.getRequiredProperty(NAME);
+        String resultName = request.getOptionalProperty(RESULT_NAME, name);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+        
+        String cookieString = request.getContext().getCookie(name);
+        
+        request.appendDebug("    " + resultName + " (" + scope + ") set to " + cookieString + " from cookie " + name);
+        request.getContext().addVariable(resultName, cookieString, scope);
+    }
+
+    @Override
+    public String getName() {
+        return "cookie-value";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java
new file mode 100644
index 0000000..2cd9593
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/DefaultValue.java
@@ -0,0 +1,52 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class DefaultValue extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        // String sourceObjectId = objectOrResult(request);
+        final String variableName = request.getRequiredProperty(NAME);
+        final String defaultValue = request.getOptionalProperty(VALUE);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+
+        final RequestContext context = request.getContext();
+        final Object currentValue = context.getVariable(variableName);
+        if (currentValue == null) {
+            request.appendDebug("     " + variableName + " set to " + defaultValue + " (" + scope + ")");
+            context.addVariable(variableName, defaultValue, scope);
+        } else {
+            request.appendDebug("     " + variableName + " alreadt set to " + currentValue);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "default";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java
new file mode 100644
index 0000000..ab43eb6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EditLink.java
@@ -0,0 +1,71 @@
+/*
+ *  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.view.simple;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.immutable.ImmutableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class EditLink extends AbstractLink {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    protected boolean valid(final Request request, final ObjectAdapter adapter) {
+        final ObjectSpecification specification = adapter.getSpecification();
+        final AuthenticationSession session = IsisContext.getAuthenticationSession();
+        final List<ObjectAssociation> visibleFields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where));
+        final ImmutableFacet facet = specification.getFacet(ImmutableFacet.class);
+        final boolean isImmutable = facet != null && facet.when() == When.ALWAYS;
+        final boolean isImmutableOncePersisted = facet != null && facet.when() == When.ONCE_PERSISTED && adapter.representsPersistent();
+        return visibleFields.size() > 0 && !isImmutable && !isImmutableOncePersisted;
+    }
+
+    @Override
+    protected String linkLabel(final String name, final ObjectAdapter object) {
+        return "edit";
+    }
+
+    @Override
+    protected String defaultView() {
+        return Dispatcher.GENERIC + Dispatcher.EDIT + "." + Dispatcher.EXTENSION;
+    }
+
+    @Override
+    public String getName() {
+        return "edit-link";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java
new file mode 100644
index 0000000..1a37f99
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/EndSession.java
@@ -0,0 +1,36 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class EndSession extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.getContext().endHttpSession();
+    }
+
+    @Override
+    public String getName() {
+        return "end-session";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java
new file mode 100644
index 0000000..e63ec92
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Forward.java
@@ -0,0 +1,37 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Forward extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "forward";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String view = request.getRequiredProperty(VIEW);
+        request.getContext().forward(view);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java
new file mode 100644
index 0000000..f58b13f
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/GetCookie.java
@@ -0,0 +1,39 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class GetCookie extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getRequiredProperty("name");
+        final String cookie = request.getContext().getCookie(name);
+
+        request.appendHtml(cookie);
+    }
+
+    @Override
+    public String getName() {
+        return "get-cookie";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java
new file mode 100644
index 0000000..1b66290
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Import.java
@@ -0,0 +1,37 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Import extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.appendHtml("<!-- " + " import " + request.getOptionalProperty("file") + " -->");
+    }
+
+    @Override
+    public String getName() {
+        return "import";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java
new file mode 100644
index 0000000..1e3f47e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromCookie.java
@@ -0,0 +1,80 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class InitializeFromCookie extends AbstractElementProcessor {
+    private static final String SEVEN_DAYS = Integer.toString(60 * 24 * 7);
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getRequiredProperty(NAME);
+
+        final RequestContext context = request.getContext();
+        if (context.getVariable(name) != null) {
+            request.skipUntilClose();
+        } else {
+            final String scopeName = request.getOptionalProperty(SCOPE);
+            final Scope scope = RequestContext.scope(scopeName, Scope.SESSION);
+
+            final String cookieName = request.getOptionalProperty("cookie", name);
+            final String cookieValue = context.getCookie(cookieName);
+            boolean hasObject;
+            if (cookieValue != null) {
+                try {
+                    context.getMappedObject(cookieValue);
+                    hasObject = true;
+                } catch (final ObjectNotFoundException e) {
+                    hasObject = false;
+                }
+            } else {
+                hasObject = false;
+            }
+
+            if (hasObject) {
+                request.skipUntilClose();
+                context.addVariable(name, cookieValue, scope);
+            } else {
+                final String expiresString = request.getOptionalProperty("expires", SEVEN_DAYS);
+                request.pushNewBuffer();
+                request.processUtilCloseTag();
+                request.popBuffer();
+                final String id = (String) context.getVariable(RequestContext.RESULT);
+                final ObjectAdapter variable = context.getMappedObject(id);
+                if (variable != null) {
+                    context.addCookie(cookieName, id, Integer.valueOf(expiresString));
+                    context.addVariable(name, id, scope);
+                }
+            }
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "initialize-from-cookie";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
new file mode 100644
index 0000000..375fdd2
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
@@ -0,0 +1,77 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class InitializeFromResult extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        disallowSourceAndDefault(request);
+        final String sourceObjectId = objectOrResult(request);
+        final Class<?> cls = forClass(request);
+        final String variableName = request.getRequiredProperty(NAME);
+        final String defaultObjectId = request.getOptionalProperty(DEFAULT);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+
+        final RequestContext context = request.getContext();
+        final ObjectAdapter sourceObject = context.getMappedObject(sourceObjectId);
+        final boolean isSourceSet = sourceObject != null;
+        final boolean isSourceAssignable = isSourceSet && (cls == null || cls.isAssignableFrom(sourceObject.getObject().getClass()));
+        if (isSourceAssignable) {
+            request.appendDebug("     " + variableName + " set to " + sourceObjectId + " (" + scope + ")");
+            context.addVariable(variableName, sourceObjectId, scope);
+        } else {
+            request.appendDebug("     " + variableName + " set to " + sourceObjectId + " (" + scope + ")");
+            if (defaultObjectId != null) {
+                context.addVariable(variableName, defaultObjectId, scope);
+            }
+            context.changeScope(variableName, scope);
+        }
+    }
+
+    private String objectOrResult(final Request request) {
+        final String sourceObjectId = request.getOptionalProperty(OBJECT);
+        if (sourceObjectId == null) {
+            return (String) request.getContext().getVariable(RequestContext.RESULT);
+        } else {
+            return sourceObjectId;
+        }
+    }
+
+    private void disallowSourceAndDefault(final Request request) {
+        if (request.getOptionalProperty(DEFAULT) != null && request.getOptionalProperty(OBJECT) != null) {
+            throw new ScimpiException("Cannot specify both " + OBJECT + " and " + DEFAULT + " for the " + getName() + " element");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "initialize";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java
new file mode 100644
index 0000000..fe1474b
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Localization.java
@@ -0,0 +1,64 @@
+/*
+ *  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.view.simple;
+
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+/**
+ * Displays the localization data for the current user.
+ */
+public class Localization extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.closeEmpty();
+
+        org.apache.isis.applib.profiles.Localization localization = IsisContext.getLocalization();
+        if (localization != null) {
+            Locale locale = localization.getLocale();
+            String country = locale.getDisplayName();
+         //   country = locale.toString();
+            String timeZone = localization.getTimeZone().getDisplayName();
+            
+            request.appendAsHtmlEncoded(country + ", " + timeZone);
+        } else {
+            request.appendAsHtmlEncoded("No localization data!");
+        }
+        
+        Locale locale = Locale.getDefault();
+        String country = locale.getDisplayName();
+      //  country = locale.toString();
+        String timeZone = TimeZone.getDefault().getDisplayName();
+        
+        request.appendAsHtmlEncoded("\n (Default " + country + ", " + timeZone +")");
+
+    }
+
+    @Override
+    public String getName() {
+        return "alpha-localization";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java
new file mode 100644
index 0000000..febafb6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java
@@ -0,0 +1,43 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class Mark extends AbstractElementProcessor {
+
+    // TODO the return points should be pushed on to a stack so that there is
+    // traceable history.
+    @Override
+    public void process(final Request request) {
+        // String name = request.getOptionalProperty(NAME);
+        final RequestContext context = request.getContext();
+        context.addVariable("_return-to", context.getUri(), Scope.SESSION);
+    }
+
+    @Override
+    public String getName() {
+        return "mark";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java
new file mode 100644
index 0000000..5929f81
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java
@@ -0,0 +1,62 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class NewActionLink extends AbstractLink {
+
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORMS;
+
+    @Override
+    protected boolean valid(final Request request, final ObjectAdapter object) {
+        final String method = request.getRequiredProperty(METHOD);
+        final ObjectAction action = MethodsUtils.findAction(object, method);
+        return MethodsUtils.isVisibleAndUsable(object, action, where);
+    }
+
+    @Override
+    protected String linkLabel(final String name, final ObjectAdapter object) {
+        return "run";
+    }
+
+    @Override
+    protected String defaultView() {
+        return "_generic_action." + Dispatcher.EXTENSION;
+    }
+
+    @Override
+    protected String additionalParameters(final Request request) {
+        final String method = request.getRequiredProperty(METHOD);
+        return "method=" + method;
+    }
+
+    @Override
+    public String getName() {
+        return "new-action-link";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java
new file mode 100644
index 0000000..f2726bf
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java
@@ -0,0 +1,68 @@
+/*
+ *  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.view.simple;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ObjectLink extends AbstractLink {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    protected boolean valid(final Request request, final ObjectAdapter object) {
+        final AuthenticationSession session = IsisContext.getAuthenticationSession();
+        final List<ObjectAssociation> visibleFields = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, where));
+        return visibleFields.size() > 0;
+    }
+
+    @Override
+    protected String linkLabel(final String name, final ObjectAdapter object) {
+        if (name == null) {
+            return object.titleString();
+        } else {
+            return name;
+        }
+    }
+
+    @Override
+    protected String defaultView() {
+        return Dispatcher.GENERIC + "." + Dispatcher.EXTENSION;
+    }
+
+    @Override
+    public String getName() {
+        return "object-link";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java
new file mode 100644
index 0000000..10c3b13
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java
@@ -0,0 +1,35 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class PageTitle extends Variable {
+    @Override
+    public void process(final Request request) {
+        process(request, "title", null, null, false, Scope.REQUEST);
+    }
+
+    @Override
+    public String getName() {
+        return "page-title";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java
new file mode 100644
index 0000000..6f3b0d8
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java
@@ -0,0 +1,37 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Redirect extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "redirect";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String view = request.getRequiredProperty(VIEW);
+        request.getContext().redirectTo(view);
+    }
+
+}


[15/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
deleted file mode 100644
index 52be7d6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.List;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Warnings extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String cls = request.getOptionalProperty(CLASS);
-        final StringBuffer buffer = new StringBuffer();
-        write(cls, buffer);
-        if (buffer.length() > 0) {
-            request.appendHtml("<div class=\"feedback\">");
-            request.appendHtml(buffer.toString());
-            request.appendHtml("</div>");
-        }
-    }
-
-    public static void write(String cls, final StringBuffer buffer) {
-        if (cls == null) {
-            cls = "warning";
-        }
-        final MessageBroker messageBroker = IsisContext.getMessageBroker();
-        final List<String> warnings = messageBroker.getWarnings();
-        for (final String warning : warnings) {
-            buffer.append("<div class=\"" + cls + "\">" + warning + "</div>");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "warnings";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
deleted file mode 100644
index deafb1a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- *  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.view.edit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.facets.object.choices.enums.EnumFacet;
-import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-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.edit.EditAction;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class EditObject extends AbstractElementProcessor {
-
-    // REVIEW: confirm this rendering context
-    private final Where where = Where.OBJECT_FORMS;
-
-    @Override
-    public void process(final Request request) {
-        final RequestContext context = request.getContext();
-
-        final String objectId = request.getOptionalProperty(OBJECT);
-        final String forwardEditedTo = request.getOptionalProperty(VIEW);
-        final String forwardErrorTo = request.getOptionalProperty(ERROR);
-        final String cancelTo = request.getOptionalProperty(CANCEL_TO); 
-        final boolean hideNonEditableFields = request.isRequested(HIDE_UNEDITABLE, false);
-        final boolean showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
-        final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
-        String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
-        String formTitle = request.getOptionalProperty(FORM_TITLE);
-        final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
-        final String variable = request.getOptionalProperty(RESULT_NAME);
-        final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        final String scope = request.getOptionalProperty(SCOPE);
-        final String className = request.getOptionalProperty(CLASS, "edit full");
-        final String completionMessage = request.getOptionalProperty(MESSAGE);
-
-        final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
-        final String actualObjectId = context.mapObject(object, Scope.INTERACTION);
-        final String version = context.mapVersion(object);
-
-        final String id = request.getOptionalProperty(ID, object.getSpecification().getShortIdentifier());
-
-        final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
-
-        final ObjectSpecification specification = object.getSpecification();
-        final FormFieldBlock containedBlock = new FormFieldBlock() {
-            @Override
-            public boolean isVisible(final String name) {
-                final ObjectAssociation fld = specification.getAssociation(name);
-                final boolean isVisible = fld.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed();
-                final boolean isUseable = fld.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
-                return isVisible && isUseable;
-            }
-
-            @Override
-            public ObjectAdapter getCurrent(final String name) {
-                ObjectAdapter value = null;
-                if (entryState != null) {
-                    final FieldEditState field2 = entryState.getField(name);
-                    value = field2.getValue();
-                }
-                if (value == null) {
-                    final ObjectAssociation fld = specification.getAssociation(name);
-                    value = fld.get(object);
-                }
-                return value;
-            }
-
-            @Override
-            public boolean isNullable(final String name) {
-                final ObjectAssociation fld = specification.getAssociation(name);
-                return !fld.isMandatory();
-            }
-        };
-
-        request.setBlockContent(containedBlock);
-        request.processUtilCloseTag();
-
-        final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        List<ObjectAssociation> viewFields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, where));
-        viewFields = containedBlock.includedFields(viewFields);
-        final InputField[] formFields = createFields(viewFields);
-
-        initializeFields(context, object, formFields, entryState, !hideNonEditableFields);
-        setDefaults(context, object, formFields, entryState, showIcon);
-
-        copyFieldContent(context, object, formFields, showIcon);
-        overrideWithHtml(context, containedBlock, formFields);
-        String errors = null;
-        if (entryState != null && entryState.isForForm(formId)) {
-            copyEntryState(context, object, formFields, entryState);
-            errors = entryState.getError();
-        }
-
-        final String errorView = context.fullFilePath(forwardErrorTo == null ? context.getResourceFile() : forwardErrorTo);
-        final List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
-        hiddenFields.add(new HiddenInputField("_" + OBJECT, actualObjectId));
-        hiddenFields.add(new HiddenInputField("_" + VERSION, version));
-        hiddenFields.add(new HiddenInputField("_" + FORM_ID, formId));
-        hiddenFields.add(completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, completionMessage));
-        hiddenFields.add(forwardEditedTo == null ? null : new HiddenInputField("_" + VIEW, context.fullFilePath(forwardEditedTo)));
-        hiddenFields.add(new HiddenInputField("_" + ERROR, errorView));
-        hiddenFields.add(variable == null ? null : new HiddenInputField("_" + RESULT_NAME, variable));
-        hiddenFields.add(resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, resultOverride));
-        hiddenFields.add(scope == null ? null : new HiddenInputField("_" + SCOPE, scope));
-
-        if (!object.isTransient()) {
-            // ensure all booleans are included so the pass back TRUE if set.
-            final List<ObjectAssociation> fields2 = object.getSpecification().getAssociations(Contributed.EXCLUDED);
-            for (int i = 0; i < fields2.size(); i++) {
-                final ObjectAssociation field = fields2.get(i);
-                if (!viewFields.contains(field) && field.getSpecification().containsFacet(BooleanValueFacet.class)) {
-                    final String fieldId = field.getId();
-                    final String value = getValue(context, field.get(object));
-                    hiddenFields.add(new HiddenInputField(fieldId, value));
-                }
-            }
-        }
-
-        if (formTitle == null) {
-            formTitle = specification.getSingularName();
-        }
-
-        if (buttonTitle == null) {
-            buttonTitle = "Save " + specification.getSingularName();
-        } else if (buttonTitle.equals("")) {
-            buttonTitle = "Save";
-        }
-
-        final HiddenInputField[] hiddenFieldArray = hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]);
-        HtmlFormBuilder.createForm(request, EditAction.ACTION + ".app", hiddenFieldArray, formFields, className, id, formTitle,
-                labelDelimiter, null, null, buttonTitle, errors, cancelTo);
-     request.popBlockContent();
-    }
-
-    private InputField[] createFields(final List<ObjectAssociation> fields) {
-        final InputField[] formFields = new InputField[fields.size()];
-        int length = 0;
-        for (int i = 0; i < fields.size(); i++) {
-            if (!fields.get(i).isOneToManyAssociation()) {
-                formFields[i] = new InputField(fields.get(i).getId());
-                length++;
-            }
-        }
-        final InputField[] array = new InputField[length];
-        for (int i = 0, j = 0; i < formFields.length; i++) {
-            if (formFields[i] != null) {
-                array[j++] = formFields[i];
-            }
-        }
-        return array;
-    }
-
-    // TODO duplicated in ActionForm#initializeFields
-    private void initializeFields(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean includeUnusableFields) {
-        for (final InputField formField : formFields) {
-            final String fieldId = formField.getName();
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
-            final AuthenticationSession session = IsisContext.getAuthenticationSession();
-            final Consent usable = field.isUsable(session, object, where);
-            final ObjectAdapter[] options = field.getChoices(object);
-            FieldFactory.initializeField(context, object, field, options, field.isMandatory(), formField);
-
-            final boolean isEditable = usable.isAllowed();
-            if (!isEditable) {
-                formField.setDescription(usable.getReason());
-            }
-            formField.setEditable(isEditable);
-            final boolean hiddenField = field.isVisible(session, object, where).isVetoed();
-            final boolean unusable = usable.isVetoed();
-            final boolean hideAsUnusable = unusable && !includeUnusableFields;
-            if (hiddenField || hideAsUnusable) {
-                formField.setHidden(true);
-            }
-        }
-    }
-
-    private void copyFieldContent(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final boolean showIcon) {
-        for (final InputField inputField : formFields) {
-            final String fieldName = inputField.getName();
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
-                ResolveFieldUtil.resolveField(object, field);
-                final ObjectAdapter fieldValue = field.get(object);
-                if (inputField.isEditable()) {
-                    final String value = getValue(context, fieldValue);
-                    if (!value.equals("") || inputField.getValue() == null) {
-                        inputField.setValue(value);
-                    }
-                } else {
-                    final String entry = getValue(context, fieldValue);
-                    inputField.setHtml(entry);
-                    inputField.setType(InputField.HTML);
-
-                }
-
-                if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
-                    if (fieldValue != null) {
-                        final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(field.getSpecification()) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>" : "";
-                        final String entry = iconSegment + fieldValue.titleString();
-                        inputField.setHtml(entry);
-                    } else {
-                        final String entry = "<em>none specified</em>";
-                        inputField.setHtml(entry);
-                    }
-                }
-            }
-        }
-    }
-
-    private void setDefaults(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean showIcon) {
-        for (final InputField formField : formFields) {
-            final String fieldId = formField.getName();
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
-            final ObjectAdapter defaultValue = field.getDefault(object);
-            if (defaultValue == null) {
-                continue;
-            }
-
-            final String title = defaultValue.titleString();
-            if (field.getSpecification().containsFacet(ParseableFacet.class)) {
-                formField.setValue(title);
-            } else if (field.isOneToOneAssociation()) {
-                final ObjectSpecification objectSpecification = field.getSpecification();
-                if (defaultValue != null) {
-                    final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
-                    final String html = iconSegment + title;
-                    formField.setHtml(html);
-                    final String value = defaultValue == null ? null : context.mapObject(defaultValue, Scope.INTERACTION);
-                    formField.setValue(value);
-                }
-            }
-        }
-    }
-
-    private void overrideWithHtml(final RequestContext context, final FormFieldBlock containedBlock, final InputField[] formFields) {
-        for (final InputField formField : formFields) {
-            final String fieldId = formField.getName();
-            if (containedBlock.hasContent(fieldId)) {
-                final String content = containedBlock.getContent(fieldId);
-                if (content != null) {
-                    formField.setHtml(content);
-                    formField.setValue(null);
-                    formField.setType(InputField.HTML);
-                }
-            }
-        }
-    }
-
-    private void copyEntryState(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState) {
-        for (final InputField formField : formFields) {
-            final String fieldId = formField.getName();
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() && formField.isEditable()) {
-                final FieldEditState fieldState = entryState.getField(field.getId());
-                final String entry = fieldState == null ? "" : fieldState.getEntry();
-                formField.setValue(entry);
-                final String error = fieldState == null ? "" : fieldState.getError();
-                formField.setErrorText(error);
-            }
-        }
-    }
-
-    private String getValue(final RequestContext context, final ObjectAdapter field) {
-        if (field == null || field.isTransient()) {
-            return "";
-        }
-        final ObjectSpecification specification = field.getSpecification();
-        if (specification.containsFacet(EnumFacet.class)) {
-            return String.valueOf(field.getObject());
-        } else if (specification.getFacet(ParseableFacet.class) == null) {
-            return context.mapObject(field, Scope.INTERACTION);
-        } else {
-            return field.titleString();
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "edit";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
deleted file mode 100644
index 35a9158..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *  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.view.edit;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.all.help.HelpFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.maxlen.MaxLengthFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacet;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectFeature;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.metamodel.facets.value.password.PasswordValueFacet;
-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.view.form.InputField;
-
-public class FieldFactory {
-
-    public static void initializeField(final RequestContext context, final ObjectAdapter object, final ObjectFeature param, final ObjectAdapter[] optionsForParameter, final boolean isRequired, final InputField field) {
-
-        field.setLabel(param.getName());
-        field.setDescription(param.getDescription());
-        field.setDataType(param.getSpecification().getShortIdentifier());
-        if (param instanceof ObjectMember) {
-            field.setHelpReference(((ObjectMember) param).getHelp());
-        } else {
-            final HelpFacet helpFacet = param.getFacet(HelpFacet.class);
-            final String value = helpFacet.value();
-            field.setHelpReference(value);
-        }
-        field.setRequired(isRequired);
-        field.setHidden(false);
-
-        if (param.getSpecification().getFacet(ParseableFacet.class) != null) {
-            final int maxLength = param.getFacet(MaxLengthFacet.class).value();
-            field.setMaxLength(maxLength);
-
-            final TypicalLengthFacet typicalLengthFacet = param.getFacet(TypicalLengthFacet.class);
-            if (typicalLengthFacet.isDerived() && maxLength > 0) {
-                field.setWidth(maxLength);
-            } else {
-                field.setWidth(typicalLengthFacet.value());
-            }
-
-            final MultiLineFacet multiLineFacet = param.getFacet(MultiLineFacet.class);
-            field.setHeight(multiLineFacet.numberOfLines());
-            field.setWrapped(!multiLineFacet.preventWrapping());
-
-            final ObjectSpecification spec = param.getSpecification();
-            if (spec.containsFacet(BooleanValueFacet.class)) {
-                field.setType(InputField.CHECKBOX);
-            } else if (spec.containsFacet(PasswordValueFacet.class)) {
-                field.setType(InputField.PASSWORD);
-            } else {
-                field.setType(InputField.TEXT);
-            }
-
-        } else {
-            field.setType(InputField.REFERENCE);
-        }
-
-        if (optionsForParameter != null) {
-            final int noOptions = optionsForParameter.length;
-            final String[] optionValues = new String[noOptions];
-            final String[] optionTitles = new String[noOptions];
-            for (int j = 0; j < optionsForParameter.length; j++) {
-                final int i = j; // + (field.isRequired() ? 0 : 1);
-                optionValues[i] = getValue(context, optionsForParameter[j]);
-                optionTitles[i] = optionsForParameter[j].titleString();
-            }
-            field.setOptions(optionTitles, optionValues);
-        }
-    }
-
-    private static String getValue(final RequestContext context, final ObjectAdapter field) {
-        if (field == null) {
-            return "";
-        }
-        if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
-            return context.mapObject(field, Scope.INTERACTION);
-        } else {
-            return field.getObject().toString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
deleted file mode 100644
index 5d57740..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.view.edit;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FormEntry extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        final String field = request.getRequiredProperty(FIELD);
-        final String value = request.getRequiredProperty(VALUE);
-        final boolean isHidden = request.isRequested(HIDDEN, true);
-        block.exclude(field);
-        // TODO this is replaced because the field is marked as hidden!
-        final String content = "reference <input type=\"" + (isHidden ? "hidden" : "text") + "\" disabled=\"disabled\" name=\"" + field + "\" value=\"" + value + "\" />";
-        block.replaceContent(field, content);
-    }
-
-    @Override
-    public String getName() {
-        return "form-entry";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
deleted file mode 100644
index 55c7425..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.view.edit;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FormField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        final String field = request.getRequiredProperty(FIELD);
-        if (block.isVisible(field)) {
-            request.pushNewBuffer();
-            request.processUtilCloseTag();
-            final String content = request.popBuffer();
-            block.replaceContent(field, content);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "form-field";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
deleted file mode 100644
index 294a239..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  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.view.edit;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class FormFieldBlock extends InclusionList {
-    private final Map<String, String> content = new HashMap<String, String>();
-    private final Map<String, String> values = new HashMap<String, String>();
-
-    public void replaceContent(final String field, final String htmlString) {
-        content.put(field, htmlString);
-    }
-
-    public boolean hasContent(final String name) {
-        return content.containsKey(name);
-    }
-
-    public String getContent(final String name) {
-        return content.get(name);
-    }
-
-    public boolean isVisible(final String name) {
-        return true;
-    }
-
-    public boolean isNullable(final String name) {
-        return true;
-    }
-
-    public ObjectAdapter getCurrent(final String name) {
-        return null;
-    }
-
-    public void value(final String field, final String value) {
-        values.put(field, value);
-    }
-
-    public void setUpValues(final InputField[] inputFields) {
-        for (final InputField inputField : inputFields) {
-            final String name = inputField.getName();
-            inputField.setValue(values.get(name));
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
deleted file mode 100644
index 71019ea..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  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.view.edit;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.TagOrderException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class HiddenField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final BlockContent blockContent = request.getBlockContent();
-        if (!(blockContent instanceof FormFieldBlock)) {
-            throw new TagOrderException(request);
-        }
-
-        final String field = request.getOptionalProperty("name");
-        final String value = request.getRequiredProperty("value");
-        final FormFieldBlock block = (FormFieldBlock) blockContent;
-        block.value(field, value);
-        block.exclude(field);
-    }
-
-    @Override
-    public String getName() {
-        return "hidden-field";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
deleted file mode 100644
index 7b3c1e6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  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.view.edit;
-
-import java.util.Iterator;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class RadioListField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        final String field = request.getRequiredProperty(FIELD);
-        if (block.isVisible(field)) {
-            final String id = request.getRequiredProperty(COLLECTION);
-            final String exclude = request.getOptionalProperty("exclude");
-
-            final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(id);
-
-            final RequestContext context = request.getContext();
-            final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-            final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-
-            final StringBuffer buffer = new StringBuffer();
-
-            while (iterator.hasNext()) {
-                final ObjectAdapter element = iterator.next();
-                final Scope scope = Scope.INTERACTION;
-                final String elementId = context.mapObject(element, scope);
-                if (exclude != null && context.getMappedObject(exclude) == element) {
-                    continue;
-                }
-                final String title = element.titleString();
-                final String checked = "";
-                buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + " />" + title + "</input><br/>\n");
-            }
-
-            block.replaceContent(field, buffer.toString());
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "radio-list";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
deleted file mode 100644
index e814f28..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *  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.view.edit;
-
-import java.util.Iterator;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.CreateFormParameter;
-
-public class Selector extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        final String field = request.getRequiredProperty(FIELD);
-        if (block.isVisible(field)) {
-            processElement(request, block, field);
-        }
-        request.skipUntilClose();
-    }
-
-    private void processElement(final Request request, final FormFieldBlock block, final String field) {
-        final String type = request.getOptionalProperty(TYPE, "dropdown");
-        if (!request.isPropertySpecified(METHOD) && request.isPropertySpecified(COLLECTION)) {
-            final String id = request.getRequiredProperty(COLLECTION, Request.NO_VARIABLE_CHECKING);
-            final String selector = showSelectionList(request, id, block.getCurrent(field), block.isNullable(field), type);
-            block.replaceContent(field, selector);
-        } else {
-            final String objectId = request.getOptionalProperty(OBJECT);
-            final String methodName = request.getRequiredProperty(METHOD);
-            final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-            final ObjectAction action = MethodsUtils.findAction(object, methodName);
-            if (action.getParameterCount() == 0) {
-                final ObjectAdapter collection = action.execute(object, new ObjectAdapter[0]);
-                final String selector = showSelectionList(request, collection, block.getCurrent(field), block.isNullable(field), type);
-                block.replaceContent(field, selector);
-            } else {
-                final String id = "selector_options";
-                final String id2 = (String) request.getContext().getVariable(id);
-                final String selector = showSelectionList(request, id2, block.getCurrent(field), block.isNullable(field), type);
-
-                final CreateFormParameter parameters = new CreateFormParameter();
-                parameters.objectId = objectId;
-                parameters.methodName = methodName;
-                parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE, "Search");
-                parameters.formTitle = request.getOptionalProperty(FORM_TITLE);
-                parameters.className = request.getOptionalProperty(CLASS, "selector");
-                parameters.id = request.getOptionalProperty(ID);
-
-                parameters.resultName = id;
-                parameters.forwardResultTo = request.getContext().getResourceFile();
-                parameters.forwardVoidTo = "error";
-                parameters.forwardErrorTo = parameters.forwardResultTo;
-                parameters.scope = Scope.REQUEST.name();
-                request.pushNewBuffer();
-                ActionForm.createForm(request, parameters);
-                block.replaceContent(field, selector);
-
-                request.appendHtml(request.popBuffer());
-            }
-        }
-    }
-
-    private String showSelectionList(final Request request, final String collectionId, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
-        if (collectionId != null && !collectionId.equals("")) {
-            final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(collectionId);
-            return showSelectionList(request, collection, selectedItem, allowNotSet, type);
-        } else {
-            return null;
-        }
-    }
-
-    private String showSelectionList(final Request request, final ObjectAdapter collection, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
-        final String field = request.getRequiredProperty(FIELD);
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-
-        if (type.equals("radio")) {
-            return radioButtonList(request, field, allowNotSet, collection, selectedItem, facet);
-        } else if (type.equals("list")) {
-            final String size = request.getOptionalProperty("size", "5");
-            return dropdownList(request, field, allowNotSet, collection, selectedItem, size, facet);
-        } else if (type.equals("dropdown")) {
-            return dropdownList(request, field, allowNotSet, collection, selectedItem, null, facet);
-        } else {
-            throw new UnknownTypeException(type);
-        }
-    }
-
-    private String radioButtonList(final Request request, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, final CollectionFacet facet) {
-        final RequestContext context = request.getContext();
-        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        final StringBuffer buffer = new StringBuffer();
-        if (allowNotSet) {
-            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"null\"></input><br/>\n");
-        }
-        while (iterator.hasNext()) {
-            final ObjectAdapter element = iterator.next();
-            final String elementId = context.mapObject(element, Scope.INTERACTION);
-            final String title = element.titleString();
-            final String checked = element == selectedItem ? "checked=\"checked\"" : "";
-            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + ">" + title + "</input><br/>\n");
-        }
-
-        return buffer.toString();
-    }
-
-    private String dropdownList(final Request request, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, String size, final CollectionFacet facet) {
-        final RequestContext context = request.getContext();
-        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        final StringBuffer buffer = new StringBuffer();
-        size = size == null ? "" : " size =\"" + size + "\"";
-        buffer.append("<select name=\"" + field + "\"" + size + " >\n");
-        if (allowNotSet) {
-            buffer.append("  <option value=\"null\"></option>\n");
-        }
-        while (iterator.hasNext()) {
-            final ObjectAdapter element = iterator.next();
-            final String elementId = context.mapObject(element, Scope.INTERACTION);
-            final String title = element.titleString();
-            final String checked = element == selectedItem ? "selected=\"selected\"" : "";
-            buffer.append("  <option value=\"" + elementId + "\"" + checked + ">" + title + "</option>\n");
-        }
-        buffer.append("</select>\n");
-        return buffer.toString();
-    }
-
-    @Override
-    public String getName() {
-        return "selector";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
deleted file mode 100644
index 0c12990..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.view.field;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ExcludeField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String field = request.getOptionalProperty(NAME);
-        final InclusionList block = (InclusionList) request.getBlockContent();
-        block.exclude(field);
-    }
-
-    @Override
-    public String getName() {
-        return "exclude";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
deleted file mode 100644
index bff9858..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.view.field;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class IncludeField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String field = request.getOptionalProperty(NAME);
-        final InclusionList block = (InclusionList) request.getBlockContent();
-        block.include(field);
-    }
-
-    @Override
-    public String getName() {
-        return "include";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
deleted file mode 100644
index 1fdc2f6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  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.view.field;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.collect.Lists;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class InclusionList implements BlockContent {
-    private final Set<String> includedList = new HashSet<String>();
-    private final Set<String> excludedList = new HashSet<String>();
-
-    private boolean inIncludedList(final String fieldName) {
-        return includedList.size() == 0 || includedList.contains(fieldName) || includedList.contains("all");
-    }
-
-    private boolean inExcludedList(final String fieldName) {
-        return excludedList.contains(fieldName) || excludedList.contains("all");
-    }
-
-    public void include(final String field) {
-        includedList.add(field);
-    }
-
-    public void exclude(final String field) {
-        excludedList.add(field);
-    }
-
-    public List<ObjectAssociation> includedFields(final List<ObjectAssociation> originalFields) {
-        final List<ObjectAssociation> includedFields = Lists.newArrayList();
-        for (int i = 0; i < originalFields.size(); i++) {
-            final String id2 = originalFields.get(i).getId();
-            if (includes(id2)) {
-                includedFields.add(originalFields.get(i));
-            }
-        }
-
-        return includedFields;
-    }
-
-    public void hideExcludedParameters(final InputField[] inputFields) {
-        for (final InputField inputField : inputFields) {
-            final String id2 = inputField.getName();
-            if (!includes(id2)) {
-                inputField.setHidden(true);
-            }
-        }
-    }
-
-    public boolean includes(final String id) {
-        return inIncludedList(id) && !inExcludedList(id);
-    }
-
-    public List<ObjectAction> includedActions(final List<ObjectAction> originalActions) {
-        final List<ObjectAction> includedActions = Lists.newArrayList();
-        for (int i = 0; i < originalActions.size(); i++) {
-            final String id2 = originalActions.get(i).getId();
-            if (includes(id2)) {
-                includedActions.add(originalActions.get(i));
-            }
-        }
-
-        return includedActions;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
deleted file mode 100644
index 74a24e6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  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.view.field;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-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.processor.Request;
-
-public class LinkField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String field = request.getOptionalProperty(NAME);
-        final String variable = request.getOptionalProperty(REFERENCE_NAME, RequestContext.RESULT);
-        final String scope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
-        final String forwardView = request.getOptionalProperty(VIEW, "_generic." + Dispatcher.EXTENSION);
-        final LinkedFieldsBlock tag = (LinkedFieldsBlock) request.getBlockContent();
-        tag.link(field, variable, scope, forwardView);
-    }
-
-    @Override
-    public String getName() {
-        return "link";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
deleted file mode 100644
index 5049a3d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  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.view.field;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class LinkedFieldsBlock extends InclusionList {
-    private final Map<String, LinkedObject> linkedFields = new HashMap<String, LinkedObject>();
-
-    public void link(final String field, final String variable, final String scope, final String forwardView) {
-        include(field);
-        linkedFields.put(field, new LinkedObject(variable, scope, forwardView));
-    }
-
-    public LinkedObject[] linkedFields(final List<ObjectAssociation> fields) {
-        final LinkedObject[] includedFields = new LinkedObject[fields.size()];
-        for (int i = 0; i < fields.size(); i++) {
-            final String id2 = fields.get(i).getId();
-            if (fields.get(i).isOneToOneAssociation() && linkedFields.containsKey(id2)) {
-                includedFields[i] = linkedFields.get(id2);
-            }
-        }
-        return includedFields;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
deleted file mode 100644
index d2c8548..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  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.view.field;
-
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-
-public class LinkedObject {
-    private final String variable;
-    private final String scope;
-    private String forwardView;
-
-    public LinkedObject(final String variable, final String scope, final String forwardView) {
-        this.variable = variable;
-        this.scope = scope;
-        this.forwardView = forwardView;
-    }
-
-    public LinkedObject(final String forwardView) {
-        this.forwardView = forwardView;
-        scope = Scope.INTERACTION.toString();
-        variable = RequestContext.RESULT;
-    }
-
-    public String getVariable() {
-        return variable;
-    }
-
-    public String getScope() {
-        return scope;
-    }
-
-    public String getForwardView() {
-        return forwardView;
-    }
-
-    public void setForwardView(final String path) {
-        forwardView = path;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
deleted file mode 100644
index 9245bc6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  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.view.form;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-public class HiddenInputField {
-    private final String value;
-    private final String name;
-
-    public HiddenInputField(final String name, final String value) {
-        this.value = value;
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return StringEscapeUtils.escapeHtml(value);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
deleted file mode 100644
index fd44cc8..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *  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.view.form;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-
-public class HtmlFormBuilder {
-
-    public static void createForm(
-            final Request request,
-            final String action,
-            final HiddenInputField[] hiddenFields,
-            final InputField[] fields,
-            final String className,
-            final String id,
-            final String formTitle,
-            final String labelDelimiter,
-            final String description,
-            final String helpReference,
-            final String buttonTitle,
-            final String errors,
-            final String cancelTo) {
-
-        String classSegment = " class=\"" + className + (id == null ? "\"" : "\" id=\"" + id + "\"");
-        request.appendHtml("<form " + classSegment + " action=\"" + action + "\" method=\"post\" accept-charset=\"UTF-8\">\n");
-        if (formTitle != null && formTitle.trim().length() > 0) {
-            classSegment = " class=\"title\"";
-            request.appendHtml("<div" + classSegment + ">");
-            request.appendAsHtmlEncoded(formTitle);
-            request.appendHtml("</div>\n");
-        }
-
-        // TODO reinstate fieldsets when we can specify them
-        // request.appendHtml("<fieldset>\n");
-
-        final String cls = "errors";
-        if (errors != null) {
-            request.appendHtml("<div class=\"" + cls + "\">");
-            request.appendAsHtmlEncoded(errors);
-            request.appendHtml("</div>");
-        }
-        for (final HiddenInputField hiddenField : hiddenFields) {
-            if (hiddenField == null) {
-                continue;
-            }
-            request.appendHtml("  <input type=\"hidden\" name=\"" + hiddenField.getName() + "\" value=\"");
-            request.appendAsHtmlEncoded(hiddenField.getValue());
-            request.appendHtml("\" />\n");
-        }
-        request.appendHtml(request.getContext().interactionFields());
-        for (final InputField fld : fields) {
-            if (fld.isHidden()) {
-                request.appendHtml("  <input type=\"hidden\" name=\"" + fld.getName() + "\" value=\"");
-                request.appendAsHtmlEncoded(fld.getValue());
-                request.appendHtml("\" />\n");
-            } else {
-                final String errorSegment = fld.getErrorText() == null ? "" : "<span class=\"error\">" + fld.getErrorText() + "</span>";
-                final String fieldSegment = createField(fld);
-                final String helpSegment = HelpLink.createHelpSegment(fld.getDescription(), fld.getHelpReference());
-                final String title = fld.getDescription().equals("") ? "" : " title=\"" + fld.getDescription() + "\"";
-                request.appendHtml("  <div class=\"field " + fld.getName() + "\"><label class=\"label\" " + title + ">");
-                request.appendAsHtmlEncoded(fld.getLabel());
-                request.appendHtml(labelDelimiter + "</label>" + fieldSegment + errorSegment + helpSegment + "</div>\n");
-            }
-        }
-
-        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"");
-        request.appendAsHtmlEncoded(buttonTitle);
-        request.appendHtml("\" name=\"execute\" />\n");
-        HelpLink.append(request, description, helpReference);
-        // TODO alllow forms to be cancelled, returning to previous page.
-        // request.appendHtml("  <div class=\"action\"><a class=\"button\" href=\"reset\">Cancel</a></div>");
-
-        if (cancelTo != null) {
-            request.appendHtml("  <input class=\"button\" type=\"button\" value=\"");
-            request.appendAsHtmlEncoded("Cancel");
-            request.appendHtml("\" onclick=\"window.location = '" + cancelTo + "'\" name=\"cancel\" />\n");
-        }
-
-        // TODO reinstate fieldsets when we can specify them
-        // request.appendHtml("</fieldset>\n");
-        request.appendHtml("</form>\n");
-    }
-
-    private static String createField(final InputField field) {
-        if (field.isHidden()) {
-            if (field.getType() == InputField.REFERENCE) {
-                return createObjectField(field, "hidden");
-            } else {
-                return "";
-            }
-        } else {
-            if (field.getType() == InputField.HTML) {
-                return "<span class=\"value\">" + field.getHtml() + "</span>";
-            } else if (field.getOptionsText() != null) {
-                return createOptions(field);
-            } else if (field.getType() == InputField.REFERENCE) {
-                return createObjectField(field, "text");
-            } else if (field.getType() == InputField.CHECKBOX) {
-                return createCheckbox(field);
-            } else if (field.getType() == InputField.PASSWORD) {
-                return createPasswordField(field);
-            } else if (field.getType() == InputField.TEXT) {
-                if (field.getHeight() > 1) {
-                    return createTextArea(field);
-                } else {
-                    return createTextField(field);
-                }
-            } else {
-                throw new UnknownTypeException(field.toString());
-            }
-        }
-    }
-
-    private static String createObjectField(final InputField field, final String type) {
-        return field.getHtml();
-    }
-
-    private static String createTextArea(final InputField field) {
-        final String columnsSegment = field.getWidth() == 0 ? "" : " cols=\"" + field.getWidth() / field.getHeight() + "\"";
-        final String rowsSegment = field.getHeight() == 0 ? "" : " rows=\"" + field.getHeight() + "\"";
-        final String wrapSegment = !field.isWrapped() ? "" : " wrap=\"off\"";
-        final String requiredSegment = !field.isRequired() ? "" : " class=\"required\"";
-        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        final String maxLength = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
-        return "<textarea" + requiredSegment + " name=\"" + field.getName() + "\"" + columnsSegment + rowsSegment + wrapSegment
-                + maxLength + disabled + ">" + Request.getEncoder().encoder(field.getValue()) + "</textarea>";
-    }
-
-    private static String createPasswordField(final InputField field) {
-        final String extra = " autocomplete=\"off\"";
-        return createTextField(field, "password", extra);
-    }
-
-    private static String createTextField(final InputField field) {
-        return createTextField(field, "text", "");
-    }
-
-    private static String createTextField(final InputField field, final String type, final String additionalAttributes) {
-        final String value = field.getValue();
-        final String valueSegment = value == null ? "" : " value=\"" + Request.getEncoder().encoder(value) + "\"";
-        final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
-        final String maxLengthSegment = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
-        final String requiredSegment = !field.isRequired() ? "" : " required";
-        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        return "<input class=\"" + field.getDataType() + requiredSegment + "\" type=\"" + type + "\" name=\"" + field.getName() + "\"" + 
-                valueSegment + lengthSegment + maxLengthSegment + disabled + additionalAttributes + " />";
-    }
-
-    private static String createCheckbox(final InputField field) {
-        final String entryText = field.getValue();
-        final String valueSegment = entryText != null && entryText.toLowerCase().equals("true") ? " checked=\"checked\"" : "";
-        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        return "<input type=\"checkbox\" name=\"" + field.getName() + "\" value=\"true\" " + valueSegment + disabled + " />";
-    }
-
-    private static String createOptions(final InputField field) {
-        final String[] options = field.getOptionsText();
-        final String[] ids = field.getOptionValues();
-        final int length = options.length;
-        final String classSegment = field.isRequired() && length == 0 ? " class=\"required\"" : "";
-        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        final StringBuffer str = new StringBuffer();
-        str.append("\n  <select name=\"" + field.getName() + "\"" + disabled  + classSegment + ">\n");
-        boolean offerOther = false;
-        for (int i = 0; i < length; i++) {
-            final String selectedSegment = field.getValue() == null || ids[i].equals(field.getValue()) ? " selected=\"selected\"" : "";
-            if (field.getType() == InputField.TEXT && options[i].equals("__other")) {
-                offerOther = true;
-            } else {
-                str.append("    <option value=\"" + Request.getEncoder().encoder(ids[i]) + "\"" + selectedSegment + ">" + Request.getEncoder().encoder(options[i]) + "</option>\n");
-            }
-        }
-        if (!field.isRequired() || length == 0) {
-            final String selectedSegment = field.getValue() == null || field.getValue().equals("") ? " selected=\"selected\"" : "";
-            str.append("    <option value=\"null\"" + selectedSegment + "></option>\n");
-        }
-        if (offerOther) {
-            str.append("    <option value=\"-OTHER-\">Other:</option>\n");
-        }
-        str.append("  </select>");
-        if (field.getType() == InputField.TEXT) {
-            final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
-            final String hideSegment = " style=\"display: none;\" "; // TODO
-                                                                     // only
-                                                                     // hide
-                                                                     // when JS
-                                                                     // enabled
-            str.append("  <input type=\"text\" name=\"" + field.getName() + "-other\"" + hideSegment + lengthSegment + disabled + " />");
-        }
-        str.append("\n");
-        return str.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
deleted file mode 100644
index 0382cc4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- *  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.view.form;
-
-import org.apache.isis.core.commons.util.ToString;
-
-public class InputField {
-    public static final int REFERENCE = 1;
-    public static final int TEXT = 2;
-    public static final int PASSWORD = 3;
-    public static final int CHECKBOX = 4;
-    public static final int HTML = 5;
-
-    private int type;
-
-    private String label;
-    private String description = "";
-    private String helpReference;
-    private String errorText;
-    private final String name;
-    private String dataType;
-
-    private int maxLength = 0;
-    private int width;
-    private int height = 1;
-    private boolean isWrapped = false;
-
-    private boolean isRequired = true;
-    private boolean isEditable = true;
-    private boolean isHidden = false;
-
-    private String[] optionsText;
-    private String[] optionValues;
-
-    private String value;
-    private String html;
-
-    public InputField(final String name) {
-        this.name = name;
-    }
-
-    public String getErrorText() {
-        return errorText;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public String getDataType() {
-        return dataType;
-    }
-    
-    public String getHelpReference() {
-        return helpReference;
-    }
-
-    public String getLabel() {
-        return label;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public boolean isEditable() {
-        return isEditable;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public String getHtml() {
-        return html;
-    }
-
-    public boolean isHidden() {
-        return isHidden;
-    }
-
-    public String[] getOptionsText() {
-        return optionsText;
-    }
-
-    public String[] getOptionValues() {
-        return optionValues;
-    }
-
-    public int getWidth() {
-        return width;
-    }
-
-    public int getHeight() {
-        return height;
-    }
-
-    public boolean isWrapped() {
-        return isWrapped;
-    }
-
-    public boolean isRequired() {
-        return isRequired;
-    }
-
-    public int getMaxLength() {
-        return maxLength;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public void setErrorText(final String errorText) {
-        this.errorText = errorText;
-    }
-
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    public void setHelpReference(final String helpReference) {
-        this.helpReference = helpReference;
-    }
-
-    public void setLabel(final String label) {
-        this.label = label;
-    }
-
-    public void setEditable(final boolean isEditable) {
-        this.isEditable = isEditable;
-        isRequired = isRequired && isEditable;
-    }
-
-    public void setValue(final String entryText) {
-        this.value = entryText;
-    }
-
-    public void setHtml(final String html) {
-        this.html = html;
-    }
-
-    public void setHidden(final boolean isHidden) {
-        this.isHidden = isHidden;
-    }
-
-    public void setWidth(final int width) {
-        this.width = width;
-    }
-
-    public void setOptions(final String[] optionsText, final String[] optionValues) {
-        this.optionsText = optionsText;
-        this.optionValues = optionValues;
-    }
-
-    public void setHeight(final int height) {
-        this.height = height;
-    }
-
-    public void setWrapped(final boolean isWrapped) {
-        this.isWrapped = isWrapped;
-    }
-
-    public void setRequired(final boolean isRequired) {
-        this.isRequired = isRequired;
-    }
-
-    public void setMaxLength(final int maxLength) {
-        this.maxLength = maxLength;
-    }
-
-    public void setType(final int type) {
-        this.type = type;
-    }
-
-    public void setDataType(String dataType) {
-        this.dataType = dataType;
-    }
-    
-    @Override
-    public String toString() {
-        final ToString str = new ToString(this);
-        str.append("name", name);
-        String typeName;
-        switch (type) {
-        case CHECKBOX:
-            typeName = "checkbox";
-            break;
-        case REFERENCE:
-            typeName = "reference";
-            break;
-        case TEXT:
-            typeName = "text";
-            break;
-        default:
-            typeName = "unset";
-            break;
-        }
-        str.append("type", typeName);
-        str.append("datatype", dataType);
-        str.append("editable", isEditable);
-        str.append("hidden", isHidden);
-        str.append("required", isRequired);
-        return str.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
deleted file mode 100644
index 1632f5d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  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.view.logon;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.logon.LogoutAction;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Logoff extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        LogoutAction.logoutUser(request.getContext());
-    }
-
-    @Override
-    public String getName() {
-        return "logoff";
-    }
-
-}


[10/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
new file mode 100644
index 0000000..85d0f02
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
@@ -0,0 +1,511 @@
+/*
+ *  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.context;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+
+public class DefaultOidObjectMapping implements ObjectMapping {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DefaultOidObjectMapping.class);
+
+    private final Map<String, TransientRootAdapterMapping> requestTransients = Maps.newHashMap();
+    private final Map<String, TransientRootAdapterMapping> sessionTransients = Maps.newHashMap();
+
+    //private Class<? extends Oid> oidType;
+
+
+    ///////////////////////////////////////
+    // clear, endSession
+    ///////////////////////////////////////
+
+    @Override
+    public void clear() {
+        requestTransients.clear();
+
+        final List<String> remove = Lists.newArrayList();
+        for (final String id : sessionTransients.keySet()) {
+            final Oid oid = sessionTransients.get(id).getOid();
+            if (!oid.isTransient()) {
+                remove.add(id);
+                sessionTransients.put(id, null);
+            }
+        }
+        for (final String id : remove) {
+            sessionTransients.remove(id);
+        }
+    }
+
+    @Override
+    public void endSession() {
+        sessionTransients.clear();
+    }
+
+
+    ///////////////////////////////////////
+    // mapTransientObject
+    ///////////////////////////////////////
+
+    @Override
+    public String mapTransientObject(final ObjectAdapter adapter) {
+        try {
+            final List<ObjectAdapter> savedObject = Lists.newArrayList();
+            final JSONObject data = encodeTransientData(adapter, savedObject);
+            return RequestContext.TRANSIENT_OBJECT_OID_MARKER + data.toString(4);
+        } catch (final JSONException e) {
+            throw new ScimpiException(e);
+        }
+    }
+
+    private JSONObject encodeTransientData(final ObjectAdapter adapter, final List<ObjectAdapter> adaptersToSave) throws JSONException {
+        if (adaptersToSave.contains(adapter)) {
+            return null;
+        }
+        adaptersToSave.add(adapter);
+
+        final JSONObject data = createJsonForAdapter(adapter);
+
+        final ObjectSpecification specification = adapter.getSpecification();
+        for (final ObjectAssociation association : specification.getAssociations(Contributed.EXCLUDED)) {
+            final ObjectAdapter fieldValue = association.get(adapter);
+            final String fieldName = association.getId();
+
+            if (fieldValue == null) {
+                data.put(fieldName, (Object) null);
+            } else if (association.getSpecification().isEncodeable()) {
+                final EncodableFacet encodeableFacet = fieldValue.getSpecification().getFacet(EncodableFacet.class);
+                data.put(fieldName, encodeableFacet.toEncodedString(fieldValue));
+
+            } else if (association instanceof OneToManyAssociation) {
+                final List<JSONObject> collection = Lists.newArrayList();
+                final CollectionFacet facet = fieldValue.getSpecification().getFacet(CollectionFacet.class);
+                for (final ObjectAdapter element : facet.iterable(fieldValue)) {
+                    collection.add(encodeTransientData(element, adaptersToSave));
+                }
+                data.put(fieldName, collection);
+            } else {
+                if (fieldValue.isTransient() || fieldValue.isParented()) {
+                    final JSONObject saveData = encodeTransientData(fieldValue, adaptersToSave);
+                    if (saveData == null) {
+                        data.put(fieldName, mapObject(fieldValue, Scope.INTERACTION));
+                    } else {
+                        data.put(fieldName, saveData);
+                    }
+                } else {
+                    data.put(fieldName, mapObject(fieldValue, Scope.INTERACTION));
+                }
+            }
+        }
+        return data;
+    }
+
+    private JSONObject createJsonForAdapter(final ObjectAdapter adapter) throws JSONException {
+        final JSONObject data = new JSONObject();
+
+        final Oid oid = adapter.getOid();
+        data.put("_oid", oid.enString(getOidMarshaller()));
+
+        if(oid instanceof RootOid) {
+            return data;
+        }
+
+        if (!(oid instanceof AggregatedOid)) {
+            throw new ScimpiException("Unsupported OID type " + oid);
+        }
+        return data;
+    }
+
+
+
+
+    ////////////////////////////////////////////////////
+    // mapObject  (either persistent or transient)
+    ////////////////////////////////////////////////////
+
+    @Override
+    public String mapObject(final ObjectAdapter adapter, final Scope scope) {
+
+        // TODO need to ensure that transient objects are remapped each time so
+        // that any changes are added to
+        // session data
+        // continue work here.....here
+
+        final Oid oid = adapter.getOid();
+//        if (oidType == null) {
+//            oidType = oid.getClass();
+//        }
+
+        String encodedOid = oid.enString(getOidMarshaller());
+
+        //final boolean isTransient = adapter.isTransient();
+        //final String transferableId = (isTransient ? "T" : "P") + adapter.getSpecification().getFullIdentifier() + "@" + encodedOid;
+        final String transferableId = encodedOid;
+        // LOG.debug("encoded " + oid + " as " + transferableId + " ~ " + encodedOid);
+
+        if (adapter.isTransient()) {
+            // old TODO cache these in requests so that Mementos are only created once.
+            // old TODO if Transient/Interaction then return state; other store state in session an return OID string
+            final TransientRootAdapterMapping mapping = new TransientRootAdapterMapping(adapter);
+            mappingFor(scope).put(transferableId, mapping);
+        }
+
+        return transferableId;
+    }
+
+    private Map<String, TransientRootAdapterMapping> mappingFor(final Scope scope) {
+        if (scope == Scope.REQUEST) {
+            return requestTransients;
+        }
+        if (scope == Scope.INTERACTION || scope == Scope.SESSION) {
+            return sessionTransients;
+        }
+        throw new ScimpiException("Can't hold globally transient object");
+    }
+
+
+
+    ////////////////////////////////////////////////////
+    // mappedTransientObject  (lookup)
+    ////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter mappedTransientObject(final String jsonObjectData) {
+        final String objectData = jsonObjectData; // StringEscapeUtils.unescapeHtml(data);
+        if(LOG.isDebugEnabled()) {
+            LOG.debug("data" + objectData);
+        }
+
+        try {
+            final JSONObject jsonObject = new JSONObject(objectData);
+            return restoreTransientObject(jsonObject);
+        } catch (final JSONException e) {
+            throw new ScimpiException("Problem reading data: " + jsonObjectData, e);
+        }
+    }
+
+    private ObjectAdapter restoreTransientObject(final JSONObject jsonObject) throws JSONException {
+
+        final ObjectAdapter adapter = getAdapter(jsonObject);
+
+        //final String objectType = jsonObject.getString("_objectType");
+        //final ObjectSpecification specification = getSpecificationLoader().lookupByObjectType(objectType);
+        final ObjectSpecification specification = adapter.getSpecification();
+
+        for (final ObjectAssociation association : specification.getAssociations(Contributed.EXCLUDED)) {
+            final String fieldName = association.getId();
+
+            final Object fieldValue = jsonObject.has(fieldName) ? jsonObject.get(fieldName) : null;
+
+            if (association.getSpecification().isEncodeable()) {
+                if (fieldValue == null) {
+                    ((OneToOneAssociation) association).initAssociation(adapter, null);
+                } else {
+                    final EncodableFacet encodeableFacet = association.getSpecification().getFacet(EncodableFacet.class);
+                    final ObjectAdapter fromEncodedString = encodeableFacet.fromEncodedString((String) fieldValue);
+                    ((OneToOneAssociation) association).initAssociation(adapter, fromEncodedString);
+                }
+            } else if (association instanceof OneToManyAssociation) {
+                final JSONArray collection = (JSONArray) fieldValue;
+                for (int i = 0; i < collection.length(); i++) {
+                    final JSONObject jsonElement = (JSONObject) collection.get(i);
+                    final ObjectAdapter objectToAdd = restoreTransientObject(jsonElement);
+                    ((OneToManyAssociation) association).addElement(adapter, objectToAdd);
+                }
+
+                /*
+                 * CollectionFacet facet =
+                 * fieldValue.getSpecification().getFacet
+                 * (CollectionFacet.class); for (ObjectAdapter element :
+                 * facet.iterable(fieldValue)) {
+                 * collection.add(saveData(element, savedObject)); }
+                 * data.put(fieldName, collection);
+                 */
+            } else {
+                if (fieldValue == null) {
+                    ((OneToOneAssociation) association).initAssociation(adapter, null);
+                } else {
+                    if (fieldValue instanceof JSONObject) {
+                        final ObjectAdapter fieldObject = restoreTransientObject((JSONObject) fieldValue);
+                        ((OneToOneAssociation) association).initAssociation(adapter, fieldObject);
+                    } else {
+                        final ObjectAdapter field = mappedObject((String) fieldValue);
+                        ((OneToOneAssociation) association).initAssociation(adapter, field);
+                    }
+                }
+            }
+        }
+        return adapter;
+    }
+
+    private ObjectAdapter getAdapter(final JSONObject jsonObject) throws JSONException {
+
+        //final String objectType = jsonObject.getString("_objectType");
+        //final String id = jsonObject.getString("_id");
+        //final ObjectSpecification objectSpec = getSpecificationLoader().lookupByObjectType(objectType);
+
+        final String oidStr = jsonObject.getString("_oid");
+        final TypedOid typedOid = getOidMarshaller().unmarshal(oidStr, TypedOid.class);
+
+        if(!typedOid.isTransient()) {
+            return getAdapterManager().adapterFor(typedOid);
+        } else {
+            return mappedObject(oidStr);
+        }
+
+//        if (objectSpec.isParented() && !objectSpec.isParentedOrFreeCollection()) {
+//            final String[] split = id.split("@");
+//            final String parentOidStr = split[0];
+//            final String aggregatedLocalId = split[1];
+//
+//            RootOid parentOid;
+//            if(RootOid.class.isAssignableFrom(oidType)) {
+//                parentOid = getOidStringifier().deString(parentOidStr);
+//            } else if (RootOidDefault.class.isAssignableFrom(oidType)) {
+//                parentOid = RootOidDefault.createTransient(objectType, parentOidStr);
+//            } else {
+//                // REVIEW: for now, don't support holding references to aggregates whose parent is also an aggregate
+//                throw new ScimpiException("Unsupported OID type " + oidType);
+//            }
+//
+//            final AggregatedOid oid = new AggregatedOid(objectType, parentOid, aggregatedLocalId);
+//            return getPersistenceSession().recreateAdapter(oid, objectSpec);
+//        } else {
+//            return mappedObject("T" + objectType + "@" + id); // yuk!
+//        }
+    }
+
+
+
+    ////////////////////////////////////////////////////
+    // mappedObject  (lookup - either persistent or transient)
+    ////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter mappedObject(final String oidStr) {
+
+        final TypedOid typedOid = getOidMarshaller().unmarshal(oidStr, TypedOid.class);
+
+
+//        final char type = oidStr.charAt(0);
+//
+//        // Pdom.todo.ToDoItem@OID:TODO:6
+//        final String[] split = oidStr.split("@");
+//        final String oidData = split[1];
+//        final String[] oidDataArray = oidData.split(":");
+//        final String objectType = oidDataArray[1];
+//        final String aggregatedId = split.length > 2?split[2]:null;
+//
+//        final ObjectSpecification spec = getSpecificationLoader().lookupByObjectType(objectType);
+
+        //if ((type == 'T')) {
+        if (typedOid.isTransient()) {
+
+            TransientRootAdapterMapping mapping = sessionTransients.get(oidStr);
+            if (mapping == null) {
+                mapping = requestTransients.get(oidStr);
+            }
+            if (mapping == null) {
+
+                // create as a (transient) root adapter
+                // Oid oid = deString(objectType, oidData, State.TRANSIENT);
+                //return getPersistenceSession().recreateAdapter(oid, pojo);
+
+                return getAdapterManager().adapterFor(typedOid);
+            }
+
+            final ObjectAdapter mappedTransientObject = mapping.getObject();
+            if(LOG.isDebugEnabled()) {
+                LOG.debug("retrieved " + mappedTransientObject.getOid() + " for " + oidStr);
+            }
+
+            return mappedTransientObject;
+        }
+
+        try {
+            //LOG.debug("decoding " + oidData);
+
+            //if (aggregatedId != null) {
+            if(typedOid instanceof AggregatedOid) {
+
+//              final RootOid parentOid = deString(objectType, oidData, State.PERSISTENT);
+//              Oid aggregatedOid = new AggregatedOid(objectType, parentOid, aggregatedId);
+
+                AggregatedOid aggregatedOid = (AggregatedOid) typedOid;
+                final TypedOid parentOid = aggregatedOid.getParentOid();
+
+                getPersistenceSession().loadObject(parentOid);
+                return getAdapterManager().getAdapterFor(aggregatedOid);
+            }
+
+//          RootOid oid = deString(objectType, oidData, State.PERSISTENT);
+//          return getPersistenceSession().loadObject(oid);
+
+            return getPersistenceSession().loadObject(typedOid);
+
+        } catch (final SecurityException e) {
+            throw new IsisException(e);
+        }
+    }
+
+
+    ///////////////////////////////////////////////////////
+    // reloadIdentityMap  (reloads the session transients)
+    ///////////////////////////////////////////////////////
+
+    @Override
+    public void reloadIdentityMap() {
+        final Iterator<TransientRootAdapterMapping> mappings = sessionTransients.values().iterator();
+        while (mappings.hasNext()) {
+            final TransientRootAdapterMapping mapping = mappings.next();
+            mapping.reload();
+        }
+    }
+
+
+    ////////////////////////////////////////////////////
+    // unmapObject  (unmaps the transients)
+    ////////////////////////////////////////////////////
+
+    @Override
+    public void unmapObject(final ObjectAdapter object, final Scope scope) {
+        sessionTransients.remove(object.getOid());
+        requestTransients.remove(object.getOid());
+    }
+
+
+    ///////////////////////////////////////
+    // helpers
+    ///////////////////////////////////////
+
+//    enum State { TRANSIENT, PERSISTENT }
+
+//    private RootOid deString(String objectType, final String oidData, State stateHint) {
+//        if(RootOid.class.isAssignableFrom(oidType)) {
+//            return getOidStringifier().deString(oidData);
+//        } else {
+//            throw new ScimpiException("Unsupported OID type " + oidType);
+//        }
+//    }
+
+
+//    private String enString(RootOid ows) {
+//        return getOidStringifier().enString(ows);
+//    }
+
+//    private String enString(final Oid parentOid, final String aggregatedId) {
+//        return enString(parentOid) + "@" + aggregatedId;
+//    }
+
+//    private String enString(final Oid oid) {
+//        final String parentOidStr;
+//        if(oid instanceof RootOid) {
+//            RootOid ows = (RootOid) oid;
+//            parentOidStr = enString(ows);
+//        } else if (oid instanceof RootOidDefault) {
+//            final RootOidDefault parentSerialOid = (RootOidDefault) oid;
+//            parentOidStr = parentSerialOid.getIdentifier();
+//        } else {
+//            throw new ScimpiException("Unsupported OID type " + oid);
+//        }
+//        return parentOidStr;
+//    }
+
+
+
+    /////////////////////////////////////////////////////////////////////////
+    // debugging
+    /////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void append(final DebugBuilder debug) {
+        append(debug, requestTransients, "request");
+        append(debug, sessionTransients, "session");
+    }
+
+    private void append(final DebugBuilder debug, final Map<String, TransientRootAdapterMapping> transients, final String type) {
+        final Iterator<String> ids = new HashSet<String>(transients.keySet()).iterator();
+        if (ids.hasNext()) {
+            debug.appendTitle("Transient objects (" + type + ")");
+            while (ids.hasNext()) {
+                final String key = ids.next();
+                debug.appendln(key, transients.get(key).debug());
+            }
+        }
+    }
+
+    @Override
+    public void appendMappings(final DebugBuilder request) {
+    }
+
+
+    ///////////////////////////////////////
+    // from context
+    ///////////////////////////////////////
+
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    protected AdapterManager getAdapterManager() {
+        return getPersistenceSession().getAdapterManager();
+    }
+
+    protected OidMarshaller getOidMarshaller() {
+        return IsisContext.getOidMarshaller();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java
new file mode 100644
index 0000000..2fb0006
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher.context;
+
+import org.apache.isis.core.metamodel.adapter.version.SerialNumberVersion;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+
+public class DefaultVersionMapping implements VersionMapping {
+
+    @Override
+    public String mapVersion(final Version version) {
+        // SerialNumberVersion v = (SerialNumberVersion) version;
+        // return Long.toHexString(v.getSequence());
+        return version.sequence();
+    }
+
+    @Override
+    public Version getVersion(final String id) {
+        final Long sequence = Long.valueOf(id, 16);
+        return SerialNumberVersion.create(sequence, null, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
new file mode 100644
index 0000000..2a5dfff
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
@@ -0,0 +1,204 @@
+/*
+ *  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.context;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeSet;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+
+public class IndirectObjectMapping implements ObjectMapping {
+    private final Map<Scope, Map<String, Mapping>> scopedMappings = Maps.newLinkedHashMap();
+    private int nextId = 0;
+
+    public IndirectObjectMapping() {
+        scopedMappings.put(Scope.GLOBAL, Maps.<String,Mapping>newHashMap());
+        scopedMappings.put(Scope.SESSION, Maps.<String,Mapping>newHashMap());
+        scopedMappings.put(Scope.INTERACTION, Maps.<String,Mapping>newHashMap());
+        scopedMappings.put(Scope.REQUEST, Maps.<String,Mapping>newHashMap());
+    }
+
+    private String nextId() {
+        nextId++;
+        return String.valueOf(nextId);
+    }
+
+    @Override
+    public void endSession() {
+        scopedMappings.get(Scope.SESSION).clear();
+        nextId = 0;
+    }
+
+    @Override
+    public void reloadIdentityMap() {
+        reloadIdentityMap(Scope.GLOBAL);
+        reloadIdentityMap(Scope.SESSION);
+        reloadIdentityMap(Scope.INTERACTION);
+
+        final Map<String, Mapping> map = scopedMappings.get(Scope.INTERACTION);
+        scopedMappings.put(Scope.REQUEST, map);
+        scopedMappings.put(Scope.INTERACTION, new HashMap<String, Mapping>());
+    }
+
+    private void reloadIdentityMap(final Scope scope) {
+        final Map<String, Mapping> map = scopedMappings.get(scope);
+        final Iterator<String> ids = map.keySet().iterator();
+        while (ids.hasNext()) {
+            final String key = ids.next();
+            final Mapping mapping = map.get(key);
+            mapping.reload();
+        }
+    }
+
+    @Override
+    public void clear() {
+        scopedMappings.get(Scope.REQUEST).clear();
+    }
+
+    @Override
+    public void unmapObject(final ObjectAdapter object, final Scope scope) {
+        final String id = mapObject(object, scope);
+        scopedMappings.get(scope).remove(id);
+    }
+
+    @Override
+    public void appendMappings(final DebugBuilder debug) {
+        appendMappings(debug, scopedMappings.get(Scope.INTERACTION));
+    }
+
+    private void appendMappings(final DebugBuilder debug, final Map<String, Mapping> map) {
+        final Iterator<String> names = map.keySet().iterator();
+        while (names.hasNext()) {
+            final String id = names.next();
+            final ObjectAdapter object = mappedObject(id);
+            debug.appendln(id, object);
+        }
+    }
+
+    private void appendMappings(final DebugBuilder debug, final Scope scope) {
+        debug.appendTitle("Objects for " + scope);
+        final Map<String, Mapping> map = scopedMappings.get(scope);
+        final Iterator<String> ids = new TreeSet<String>(map.keySet()).iterator();
+        if (!ids.hasNext()) {
+            debug.appendln("None", "");
+        }
+        while (ids.hasNext()) {
+            final String key = ids.next();
+            debug.appendln(key, map.get(key).debug());
+        }
+    }
+
+    private Mapping createMapping(final ObjectAdapter adapter) {
+        if (adapter.isTransient()) {
+            return new TransientRootAdapterMapping(adapter);
+        } else {
+            return new PersistentRootAdapterMapping(adapter);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.isis.webapp.context.ObjectMapping#mappedObject(java.lang.String
+     * )
+     */
+    @Override
+    public ObjectAdapter mappedObject(final String id) {
+        final Iterator<Map<String, Mapping>> iterator = scopedMappings.values().iterator();
+        while (iterator.hasNext()) {
+            final Map<String, Mapping> map = iterator.next();
+            final Mapping mapping = map.get(id);
+            if (mapping != null) {
+                return mapping.getObject();
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public String mapObject(final ObjectAdapter obj, final Scope scope) {
+        ObjectAdapter object;
+        object = obj;
+        final Mapping mapping = createMapping(object);
+
+        boolean changeScope = false;
+        for (final Scope s : scopedMappings.keySet()) {
+            final Map<String, Mapping> map = scopedMappings.get(s);
+            if (map.containsValue(mapping)) {
+                final String id = findMapping(map, mapping);
+                if (changeScope) {
+                    map.remove(id);
+                    scopedMappings.get(scope).put(id, mapping);
+                }
+                return id;
+            }
+
+            if (s == scope) {
+                changeScope = true;
+            }
+        }
+
+        final Map<String, Mapping> map = scopedMappings.get(scope);
+        final String id = obj.getSpecification().getShortIdentifier() + "@" + nextId();
+        map.put(id, mapping);
+        return id;
+    }
+
+    private String findMapping(final Map<String, Mapping> map, final Mapping mapping) {
+        final Iterator<String> ids = map.keySet().iterator();
+        while (ids.hasNext()) {
+            final String key = ids.next();
+            if (map.get(key).equals(mapping)) {
+                return key;
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    public void append(final DebugBuilder debug) {
+        debug.appendln("Next ID", nextId);
+
+        appendMappings(debug, Scope.GLOBAL);
+        appendMappings(debug, Scope.SESSION);
+        appendMappings(debug, Scope.INTERACTION);
+        appendMappings(debug, Scope.REQUEST);
+    }
+
+    @Override
+    public ObjectAdapter mappedTransientObject(final String substring) {
+        throw new NotYetImplementedException();
+    }
+
+    @Override
+    public String mapTransientObject(final ObjectAdapter object) {
+        throw new NotYetImplementedException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java
new file mode 100644
index 0000000..a41481b
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java
@@ -0,0 +1,205 @@
+/*
+ *  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.context;
+
+import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.commons.ensure.Assert;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.runtime.memento.Memento;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+
+interface Mapping {
+    ObjectAdapter getObject();
+
+    Oid getOid();
+
+    String debug();
+
+    void reload();
+
+    void update();
+}
+
+class TransientRootAdapterMapping implements Mapping {
+    private final RootOid oid;
+    private Memento memento;
+
+    public TransientRootAdapterMapping(final ObjectAdapter adapter) {
+        oid = (RootOid) adapter.getOid();
+        Assert.assertTrue("OID is for persistent", oid.isTransient());
+        Assert.assertTrue("adapter is for persistent", adapter.isTransient());
+        memento = new Memento(adapter);
+    }
+
+    @Override
+    public ObjectAdapter getObject() {
+        return getAdapterManager().getAdapterFor(oid);
+    }
+
+    @Override
+    public Oid getOid() {
+        return oid;
+    }
+
+    @Override
+    public void reload() {
+        memento.recreateObject();
+    }
+
+    @Override
+    public void update() {
+        memento = new Memento(getObject());
+    }
+
+
+    ////////////////////////////////////
+    // debug
+    ////////////////////////////////////
+
+    @Override
+    public String debug() {
+        final DebugString debug = new DebugString();
+        memento.debug(debug);
+        return debug.toString();
+    }
+
+    ////////////////////////////////////
+    // equals, hashCode
+    ////////////////////////////////////
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj == this) {
+            return true;
+        }
+
+        if (obj instanceof TransientRootAdapterMapping) {
+            return ((TransientRootAdapterMapping) obj).oid.equals(oid);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return oid.hashCode();
+    }
+
+    
+    ////////////////////////////////////
+    // from context
+    ////////////////////////////////////
+
+	private AdapterManager getAdapterManager() {
+		return getPersistenceSession().getAdapterManager();
+	}
+
+	private PersistenceSession getPersistenceSession() {
+		return IsisContext.getPersistenceSession();
+	}
+}
+
+class PersistentRootAdapterMapping implements Mapping {
+    private final RootOid oid;
+    private final ObjectSpecification spec;
+
+    public PersistentRootAdapterMapping(final ObjectAdapter object) {
+        this.oid = (RootOid) object.getOid();
+        this.spec = object.getSpecification();
+    }
+
+    @Override
+    public Oid getOid() {
+        return oid;
+    }
+
+    @Override
+    public ObjectAdapter getObject() {
+        if (!IsisContext.inTransaction()) {
+            throw new IllegalStateException(getClass().getSimpleName() + " requires transaction in order to load");
+        }
+        return getPersistenceSession().loadObject(oid);
+    }
+
+    @Override
+    public void reload() {
+    	// will only recreate if not already in the adapter mgr maps.
+    	getAdapterManager().adapterFor(oid);
+    }
+
+
+    @Override
+    public void update() {
+    }
+
+    ////////////////////////////////////
+    // debug
+    ////////////////////////////////////
+
+    @Override
+    public String debug() {
+        return oid + "  " + spec.getShortIdentifier() + "  " + getAdapterManager().getAdapterFor(oid);
+    }
+
+    ////////////////////////////////////
+    // equals, hashCode
+    ////////////////////////////////////
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj == this) {
+            return true;
+        }
+
+        if (obj instanceof PersistentRootAdapterMapping) {
+            final PersistentRootAdapterMapping other = (PersistentRootAdapterMapping) obj;
+            return oid.equals(other.oid) && spec == other.spec;
+        }
+
+        return false;
+    }
+
+
+    @Override
+    public int hashCode() {
+        int hash = 37;
+        hash = hash * 17 + oid.hashCode();
+        hash = hash * 17 + spec.hashCode();
+        return hash;
+    }
+
+    
+    ////////////////////////////////////
+    // from context
+    ////////////////////////////////////
+
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    protected AdapterManager getAdapterManager() {
+        return getPersistenceSession().getAdapterManager();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
new file mode 100644
index 0000000..9fe4013
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
@@ -0,0 +1,42 @@
+/*
+ *  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.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;
+
+public interface ObjectMapping {
+
+    void reloadIdentityMap();
+    void endSession();
+
+    void clear();
+
+    String mapObject(ObjectAdapter obj, Scope scope);
+    String mapTransientObject(ObjectAdapter object);
+    void unmapObject(ObjectAdapter object, Scope scope);
+
+    ObjectAdapter mappedObject(String oidStr);
+    ObjectAdapter mappedTransientObject(String jsonData);
+
+    void append(DebugBuilder debug);
+    void appendMappings(DebugBuilder debug);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
new file mode 100644
index 0000000..183a0b2
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
@@ -0,0 +1,857 @@
+/*
+ *  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.context;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.util.*;
+import java.util.Map.Entry;
+import com.google.common.collect.Maps;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.ErrorCollator;
+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.DebugUsers;
+
+public abstract class RequestContext {
+    private static final Logger LOG = LoggerFactory.getLogger(RequestContext.class);
+    static final String TRANSIENT_OBJECT_OID_MARKER = "~";
+
+    public enum Scope {
+        GLOBAL, SESSION, INTERACTION, REQUEST, ERROR
+    };
+
+    public enum Debug {
+        ON, OFF, PAGE
+    }
+
+    public static Scope scope(final String scopeName) {
+        final String name = scopeName.toUpperCase();
+        if (name.equals(Scope.GLOBAL.toString())) {
+            return Scope.GLOBAL;
+        } else if (name.equals(Scope.SESSION.toString())) {
+            return Scope.SESSION;
+        } else if (name.equals(Scope.INTERACTION.toString())) {
+            return Scope.INTERACTION;
+        } else if (name.equals(Scope.REQUEST.toString())) {
+            return Scope.REQUEST;
+        }
+        throw new IllegalArgumentException("Invalid scope name: " + scopeName);
+    }
+
+    public static Scope scope(final String scopeName, final Scope defaultScope) {
+        if (scopeName == null || scopeName.trim().equals("")) {
+            return defaultScope;
+        } else {
+            return scope(scopeName);
+        }
+    }
+
+    public static final String RESULT = "_result";
+    public static final String ERROR = "_error";
+    public static final String BACK_TO = "_back_to";
+    private static final Map<String, Object> globalVariables = new HashMap<String, Object>();
+    private static final Scope[] SCOPES = new Scope[] { Scope.ERROR, Scope.REQUEST, Scope.INTERACTION, Scope.SESSION, Scope.GLOBAL };
+
+    private final OidMarshaller oidMarshaller = new OidMarshaller();
+
+
+    private final ObjectMapping objectMapping;
+    private final VersionMapping versionMapping;
+    private final Map<Scope, Map<String, Object>> variables;
+    private final StringBuffer debugTrace = new StringBuffer();
+    private final DebugUsers debugUsers;
+
+    private String forwardTo;
+    private String requestedFile;
+    private String requestedParentPath;
+    private AuthenticationSession session;
+    private Debug debug;
+    private String resourceFile;
+    private String resourceParentPath;
+    private ObjectAdapter collection;
+    private boolean isUserAuthenticated;
+
+    public RequestContext(final DebugUsers debugUsers) {
+        this.debugUsers = debugUsers;
+
+        String className = IsisContext.getConfiguration().getString("scimpi.object-mapping.class", DefaultOidObjectMapping.class.getName());
+        objectMapping = InstanceUtil.createInstance(className, ObjectMapping.class);
+        className = IsisContext.getConfiguration().getString("scimpi.version-mapping.class", DefaultVersionMapping.class.getName());
+        versionMapping = InstanceUtil.createInstance(className, VersionMapping.class);
+        variables = new HashMap<Scope, Map<String, Object>>();
+
+        variables.put(Scope.GLOBAL, globalVariables);
+        variables.put(Scope.SESSION, Maps.<String, Object>newHashMap());
+        variables.put(Scope.INTERACTION, Maps.<String, Object>newHashMap());
+        variables.put(Scope.REQUEST, Maps.<String, Object>newHashMap());
+        variables.put(Scope.ERROR, Maps.<String, Object>newHashMap());
+    }
+
+    public void endHttpSession() {
+        objectMapping.endSession();
+        variables.get(Scope.SESSION).clear();
+        session = null;
+        clearSession();
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Mapped objects
+    // //////////////////////////////////////////////////////////////////
+
+    public ObjectAdapter getMappedObject(final String oidStr) {
+        if (oidStr == null || oidStr.trim().equals("") || oidStr.trim().equals("null")) {
+            return null;
+        }
+        if (oidStr.equals("collection")) {
+            return collection;
+        }
+        final ObjectAdapter adapter = mappedObject(oidStr);
+        if (adapter == null) {
+            throw new ScimpiException("No object for " + oidStr);
+        }
+        return adapter;
+    }
+
+    public ObjectAdapter getMappedObjectOrResult(final String id) {
+        return getMappedObjectOrVariable(id, RESULT);
+    }
+
+    public ObjectAdapter getMappedObjectOrVariable(String idOrData, final String name) {
+        if (idOrData == null) {
+            idOrData = (String) getVariable(name);
+            if (idOrData == null) {
+                throw new ScimpiException("No variable for " + name);
+            }
+        }
+        if (idOrData.equals("collection")) {
+            return collection;
+        }
+        return getMappedObject(idOrData);
+    }
+
+    public String mapObject(final ObjectAdapter object, final String scopeName, final Scope defaultScope) {
+        final Scope scope = scopeName == null ? defaultScope : scope(scopeName);
+        LOG.debug("mapping " + object + " " + scope);
+        return objectMapping.mapObject(object, scope);
+    }
+
+    private ObjectAdapter mappedObject(String dataOrOid) {
+        if (dataOrOid != null && dataOrOid.equals("")) {
+            return null;
+        }
+        if (dataOrOid == null) {
+            dataOrOid = RESULT;
+        }
+
+        if (dataOrOid.startsWith(TRANSIENT_OBJECT_OID_MARKER + "{")) {
+            return objectMapping.mappedTransientObject(StringEscapeUtils.unescapeHtml(dataOrOid.substring(TRANSIENT_OBJECT_OID_MARKER.length())));
+        }
+
+        final String oidStr = dataOrOid;
+        final TypedOid typedOid = getOidMarshaller().unmarshal(oidStr, TypedOid.class);
+        if(typedOid instanceof RootOid) {
+//        final String[] idParts = dataOrOid.split("@");
+//        if (idParts.length == 2) {
+            final ObjectAdapter mappedObject = objectMapping.mappedObject(oidStr);
+            if (mappedObject != null) {
+                getPersistenceSession().resolveImmediately(mappedObject);
+            }
+            return mappedObject;
+        }
+
+        //
+        // else, handle aggregate
+        //
+        AggregatedOid aggregatedOid = (AggregatedOid) typedOid;
+        final TypedOid parentOid = aggregatedOid.getParentOid();
+
+        //final ObjectAdapter parentAdapter = objectMapping.mappedObject(idParts[0] + "@" + idParts[1]);
+        final ObjectAdapter parentAdapter = objectMapping.mappedObject(parentOid.enString(getOidMarshaller()));
+        getPersistenceSession().resolveImmediately(parentAdapter);
+
+        //ObjectSpecId objectType = null;
+        //final AggregatedOid aggregatedOid = new AggregatedOid(objectType, (TypedOid) parentAdapter.getOid(), idParts[2]);
+
+        ObjectAdapter aggregatedAdapter = null;
+        outer: for (final ObjectAssociation association : parentAdapter.getSpecification().getAssociations(Contributed.EXCLUDED)) {
+            if (association.getSpecification().isParented()) {
+                final ObjectAdapter objectAdapter = association.get(parentAdapter);
+                if (objectAdapter == null) {
+                    continue;
+                }
+                if (association.isOneToManyAssociation()) {
+                    final ObjectAdapter coll = objectAdapter;
+                    final CollectionFacet facet = coll.getSpecification().getFacet(CollectionFacet.class);
+                    for (final ObjectAdapter element : facet.iterable(coll)) {
+                        if (element.getOid().equals(aggregatedOid)) {
+                            aggregatedAdapter = element;
+                            break outer;
+                        }
+                    }
+                } else {
+                    if (objectAdapter.getOid().equals(aggregatedOid)) {
+                        aggregatedAdapter = objectAdapter;
+                        break;
+                    }
+                }
+            } else if (association.isOneToManyAssociation()) {
+                if (association.getId().equals(aggregatedOid.getLocalId())) {
+                //if (association.getId().equals(idParts[2])) {
+                    return association.get(parentAdapter);
+                }
+            }
+        }
+        return aggregatedAdapter;
+    }
+
+
+    public boolean isInternalRequest() {
+        final String referrer = getHeader("Referer"); // Note spelling mistake
+                                                      // is intentional
+        return referrer != null && referrer.contains("localhost"); // TODO need
+                                                                   // to look
+                                                                   // for actual
+                                                                   // domain
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Version
+    // //////////////////////////////////////////////////////////////////
+
+    public String mapVersion(final ObjectAdapter object) {
+        final Version version = object.getVersion();
+        return version == null ? "" : versionMapping.mapVersion(version);
+    }
+
+    public Version getVersion(final String id) {
+        if (id.equals("")) {
+            return null;
+        }
+        return versionMapping.getVersion(id);
+    }
+
+    // ////////////////////////////
+    // Debug
+    // ////////////////////////////
+    public void append(final DebugBuilder debug) {
+        debug.startSection("Scimpi Request");
+
+        debug.appendTitle("User");
+        final AuthenticationSession session = getSession();
+        debug.appendln("Authentication Session", session);
+        if (session != null) {
+            debug.appendln("Name", session.getUserName());
+            debug.appendln("Roles", session.getRoles());
+        }
+
+        debug.appendTitle("context");
+        debug.appendln("Parent request path", requestedParentPath);
+        debug.appendln("Requested file", requestedFile);
+        debug.appendln("Parent resource path", resourceParentPath);
+        debug.appendln("Resource file", resourceFile);
+        debug.endSection();
+
+        debug.startSection("Variables");
+        append(debug, Scope.GLOBAL);
+        append(debug, Scope.SESSION);
+        append(debug, Scope.INTERACTION);
+        append(debug, Scope.REQUEST);
+        append(debug, Scope.ERROR);
+        debug.endSection();
+
+        debug.startSection("Object Mapping");
+        objectMapping.append(debug);
+        debug.endSection();
+    }
+
+    private void append(final DebugBuilder view, final Scope scope) {
+        final Map<String, Object> map = variables.get(scope);
+        final Iterator<String> keys = new TreeSet<String>(map.keySet()).iterator();
+        if (keys.hasNext()) {
+            view.appendTitle(scope + " scoped variables");
+            while (keys.hasNext()) {
+                final String key = keys.next();
+                final Object object = map.get(key);
+                final String mappedTo = "";
+                view.appendln(key, object + mappedTo);
+            }
+        }
+    }
+
+    public void append(final DebugBuilder debug, final String list) {
+        if (list.equals("variables")) {
+            appendVariables(debug, Scope.GLOBAL);
+            appendVariables(debug, Scope.SESSION);
+            appendVariables(debug, Scope.INTERACTION);
+            appendVariables(debug, Scope.REQUEST);
+            appendVariables(debug, Scope.ERROR);
+        } else if (list.equals("mappings")) {
+            objectMapping.appendMappings(debug);
+        }
+    }
+
+    private void appendVariables(final DebugBuilder debug, final Scope scope) {
+        final Map<String, Object> map = variables.get(scope);
+        final Iterator<String> names = new TreeSet(map.keySet()).iterator();
+        if (names.hasNext()) {
+            debug.startSection(scope.toString());
+            while (names.hasNext()) {
+                final String name = names.next();
+                try {
+                    final Object object = map.get(name);
+                    String details = "";
+                    if (object instanceof String) {
+                        final ObjectAdapter mappedObject = mappedObject((String) object);
+                        if (mappedObject != null) {
+                            details = mappedObject.toString();
+                        }
+                    }
+                    debug.appendln(name, object + "  " + details);
+                } catch (final Exception e) {
+                    debug.appendln(name, map.get(name));
+                }
+            }
+            debug.endSection();
+        }
+    }
+
+    public List<String> getDebugUsers() {
+        return debugUsers.getNames();
+    }
+
+    // ////////////////////////////
+    // Variables
+    // ////////////////////////////
+
+    public void clearVariables(final Scope scope) {
+        variables.get(scope).clear();
+    }
+
+    public void changeScope(final String name, final Scope newScope) {
+        for (final Scope element : SCOPES) {
+            final Map<String, Object> map = variables.get(element);
+            final Object object = map.get(name);
+            if (object != null) {
+                map.remove(name);
+                addVariable(name, object, newScope);
+                return;
+            }
+        }
+    }
+
+    public void clearVariable(String name, final Scope scope) {
+        name = name != null ? name : RESULT;
+        variables.get(scope).remove(name);
+    }
+
+    public void addVariable(final String name, final Object value, final String scope) {
+        addVariable(name, value, scope(scope));
+    }
+
+    public void addVariable(String name, final Object value, final Scope scope) {
+        name = name != null ? name : RESULT;
+        if (scope == Scope.SESSION && value != null && !(value instanceof Serializable)) {
+            throw new ScimpiException("SESSION scoped variable (" + name + ") must be serializable: " + value);
+        }
+        removeExistingVariable(name);
+        variables.get(scope).put(name, value);
+    }
+
+    private void removeExistingVariable(final String name) {
+        for (final Scope element : SCOPES) {
+            final Map<String, Object> map = variables.get(element);
+            final Object object = map.get(name);
+            if (object != null) {
+                map.remove(name);
+                break;
+            }
+        }
+    }
+
+    public String getStringVariable(final String name) {
+        final String value = (String) getVariable(name);
+        if (value == null) {
+            return null;
+        } else {
+            return replaceVariables(value);
+        }
+    }
+
+    public Object getVariable(final String name) {
+        for (final Scope element : SCOPES) {
+            final Map<String, Object> map = variables.get(element);
+            final Object object = map.get(name);
+            if (object != null) {
+                return object;
+            }
+        }
+        return null;
+    }
+
+    public String replaceVariables(String value) {
+        final int start = value.indexOf("${");
+        if (start == -1) {
+            return value;
+        } else {
+            final int end = value.indexOf('}');
+            if (end == -1) {
+                throw new PropertyException("No closing brace in " + value.substring(start));
+            } else if (end < start) {
+                throw new PropertyException("Closing brace before opening brace in " + value.substring(end));
+            }
+            final String name = value.substring(start + 2, end);
+            if (name != null) {
+                final int pos = name.indexOf(":");
+                final String variableName = pos == -1 ? name : name.substring(0, pos);
+                final String qualifier = pos == -1 ? "none" : name.substring(pos);
+                Object replacementValue;
+                final boolean embed = qualifier.indexOf("embed") > -1;
+                if (embed) {
+                    replacementValue = "${" + variableName + "}";
+                } else {
+                    replacementValue = getParameter(variableName);
+                    if (replacementValue == null) {
+                        replacementValue = getVariable(variableName);
+                    }
+                    if (replacementValue == null) {
+                        replacementValue = getBuiltIn(variableName);
+                    }
+
+                    if (replacementValue == null) {
+                        final boolean ensureExists = qualifier.indexOf("optional") == -1;
+                        if (ensureExists) {
+                            throw new PropertyException("No value for the variable " + value.substring(start, end + 1));
+                        } else {
+                            replacementValue = "";
+                        }
+                    }
+                }
+                final boolean repeat = qualifier.indexOf("repeat") > -1;
+                if (repeat) {
+                    value = value.substring(0, start) + replacementValue + value.substring(end + 1);
+                    return replaceVariables(value);
+                } else {
+                    final String remainder = replaceVariables(value.substring(end + 1));
+                    value = value.substring(0, start) + replacementValue + remainder;
+                    return value;
+                }
+
+            } else {
+                throw new PropertyException("No variable name speceified");
+            }
+        }
+    }
+
+    private Object getBuiltIn(final String name) {
+        if (name.equals("_session")) {
+            return getSessionId();
+        } else if (name.equals("_context")) {
+            return getContextPath();
+        } else if (name.equals("_this")) {
+            return resourceFile;
+        } else if (name.equals("_directory")) {
+            return resourceParentPath;
+        } else if (name.equals("_base")) {
+            return getUrlBase() + getContextPath() + resourceParentPath + resourceFile;
+            // return "http://localhost:8080" + resourceParentPath +
+            // resourceFile;
+        }
+        return null;
+    }
+
+    public String encodedInteractionParameters() {
+        final StringBuffer buffer = new StringBuffer();
+        final Map<String, Object> map = variables.get(Scope.INTERACTION);
+        final Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();
+        while (iterator.hasNext()) {
+            final Entry<String, Object> entry = iterator.next();
+            buffer.append("&amp;" + entry.getKey() + "=" + entry.getValue());
+        }
+        return buffer.toString();
+    }
+
+    public String interactionFields() {
+        final StringBuffer buffer = new StringBuffer();
+        final Map<String, Object> map = variables.get(Scope.INTERACTION);
+        final Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();
+        while (iterator.hasNext()) {
+            final Entry<String, Object> entry = iterator.next();
+            buffer.append("<input type=\"hidden\" name=\"" + entry.getKey() + "\" value=\"" + entry.getValue() + "\" />\n");
+        }
+        return buffer.toString();
+    }
+
+    protected abstract String getSessionId();
+
+    public abstract void addCookie(String name, String value, int minutesUtilExpires);
+
+    public abstract String getCookie(String name);
+
+
+
+    // /////////////////////////////////////////////////
+    // Start/end request
+    // /////////////////////////////////////////////////
+
+    public void endRequest() throws IOException {
+        getWriter().close();
+        objectMapping.clear();
+        variables.get(Scope.ERROR).clear();
+        variables.get(Scope.REQUEST).clear();
+        variables.get(Scope.INTERACTION).clear();
+    }
+
+    public void startRequest() {
+        debugTrace.setLength(0);
+        objectMapping.reloadIdentityMap();
+        final String debugParameter = getParameter("debug");
+        if (debugParameter != null) {
+            if (debugParameter.equals("off")) {
+                debug = Debug.OFF;
+            } else if (debugParameter.equals("on")) {
+                debug = Debug.ON;
+            } else if (debugParameter.equals("page")) {
+                debug = Debug.PAGE;
+            }
+        }
+    }
+
+    public abstract PrintWriter getWriter();
+
+    // /////////////////////////////
+    // Forwarding
+    // /////////////////////////////
+    public void forwardTo(final String forwardTo) {
+        this.forwardTo = "/" + forwardTo;
+    }
+
+    public String forwardTo() {
+        final String returnForwardTo = forwardTo;
+        forwardTo = null;
+        return returnForwardTo;
+    }
+
+    // /////////////////////////////
+    // Parameters
+    // /////////////////////////////
+    public void addParameter(final String name, final String parameter) {
+        if (name == null) {
+            throw new ScimpiException("Name must be specified for parameter " + parameter);
+        }
+        addVariable(name, parameter, Scope.REQUEST);
+    }
+
+    public String getParameter(final String name) {
+        final Object variable = getVariable(name);
+        if (variable instanceof String || variable == null) {
+            return (String) variable;
+        } else {
+            return variable.toString();
+        }
+    }
+
+    public Iterator<Entry<String, Object>> interactionParameters() {
+        final Map<String, Object> map = variables.get(Scope.REQUEST);
+        final Iterator<Entry<String, Object>> iterator = map.entrySet().iterator();
+        return iterator;
+    }
+
+    // ///////////////////////////////////////
+    // Requested file
+    // ///////////////////////////////////////
+
+    /**
+     * The requested file is the file that the browser requested. This may or
+     * may not be the file that is actually processed and returned; that is the
+     * {@link #getResourceFile()}.
+     */
+    public String getRequestedFile() {
+        return requestedFile;
+    }
+
+    public void setRequestPath(final String filePath) {
+        setRequestPath(filePath, null);
+    }
+
+    public void setRequestPath(final String filePath, String defaultGenericPath) {
+        if (filePath == null) {
+            defaultGenericPath = defaultGenericPath == null ? "" : defaultGenericPath;
+            this.requestedFile = Dispatcher.GENERIC + defaultGenericPath + "." + Dispatcher.EXTENSION;
+        } else if (filePath.startsWith("_generic")) {
+            this.requestedParentPath = "/";
+            LOG.debug("generic file, requested path cleared");
+            this.requestedFile = filePath;
+            LOG.debug("requested file set = " + filePath);
+
+        } else {
+            final int lastSlash = filePath.lastIndexOf('/');
+            if (lastSlash == -1) {
+                throw new ScimpiException("No slash in request path: " + filePath);
+            }
+            final String path = filePath.substring(0, lastSlash + 1);
+            LOG.debug("requested path set = " + path);
+            this.requestedParentPath = path;
+
+            final String file = filePath.substring(lastSlash + 1);
+            LOG.debug("requested file set = " + file);
+            this.requestedFile = file;
+        }
+    }
+
+    public void clearRequestedPath() {
+        this.requestedParentPath = null;
+        this.requestedFile = null;
+    }
+
+    /**
+     * Returns the absolute file system path to the specified resource based on
+     * the path used for the current request during the call to
+     * {@link #setRequestPath(String)}. The return path can then be used to
+     * access the specified resource. If the resource has a leading slash (/)
+     * then that resource string is returned as the path.
+     */
+    public String requestedFilePath(final String resource) {
+        if (resource.startsWith("/")) {
+            return resource;
+        } else {
+            return requestedParentPath + resource;
+        }
+    }
+
+    // ///////////////////////////////////////
+    // Resource file
+    // ///////////////////////////////////////
+
+    /**
+     * The resource file is the file on disk that is processed and returned to
+     * the browser. This may or may not be the file that was actually requested
+     * by the browser; that is the {@link #getRequestedFile()}.
+     */
+    public String getResourceFile() {
+        return resourceFile;
+    }
+
+    public String getResourceParentPath() {
+        return resourceParentPath;
+    }
+
+    public void setResourcePath(final String filePath) {
+        if (filePath == null) {
+            throw new ScimpiException("Path must be specified");
+        } else {
+            final int lastSlash = filePath.lastIndexOf('/');
+            if (lastSlash == -1) {
+                throw new ScimpiException("No slash in request path: " + filePath);
+            }
+            final String path = /* getContextPath() + */filePath.substring(0, lastSlash + 1);
+            LOG.debug("resource path set = " + path);
+            this.resourceParentPath = path;
+
+            final String file = filePath.substring(lastSlash + 1);
+            LOG.debug("resource file set = " + file);
+            this.resourceFile = file;
+        }
+    }
+
+    /**
+     * Returns a uri for the specified resource based on the path used for the
+     * current request (as set up during the call to
+     * {@link #setResourcePath(String)}). Such a uri when used by the browser
+     * will allow access to the specified resource. If the resource has a
+     * leading slash (/) or the resource is for a generic page (starts with
+     * "_generic") then that resource string is returned as the path.
+     */
+    public String fullUriPath(final String resource) {
+        if (resource.startsWith("/") || resource.startsWith("_generic")) {
+            return resource;
+        } else {
+            return getContextPath() + resourceParentPath + resource;
+        }
+    }
+
+    /**
+     * Returns the absolute file system path to the specified resource based on
+     * the path used for the current request (as set up during the call to
+     * {@link #setResourcePath(String)}). The return path can then be used to
+     * access the specified resource. If the resource has a leading slash (/) or
+     * the resource is for a generic page (starts with "_generic") then that
+     * resource string is returned as the path.
+     */
+    public String fullFilePath(final String resource) {
+        if (resource.startsWith("/") || resource.startsWith("_generic")) {
+            return resource;
+        } else {
+            return resourceParentPath + resource;
+        }
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    //
+    // //////////////////////////////////////////////////////////////////
+
+    public String mapObject(final ObjectAdapter object, final Scope scope) {
+        if (object.isValue()) {
+            return object.titleString();
+        } else if (scope == Scope.INTERACTION && object.isTransient()) {
+            return objectMapping.mapTransientObject(object);
+        } else if (object.getOid() != null) {
+            return objectMapping.mapObject(object, scope);
+        } else {
+            collection = object;
+            return "collection";
+        }
+    }
+
+    public void unmapObject(final ObjectAdapter object, final Scope scope) {
+        objectMapping.unmapObject(object, scope);
+    }
+
+    public abstract String findFile(String fileName);
+
+    public abstract InputStream openStream(String path);
+
+    public abstract String imagePath(ObjectAdapter object);
+
+    public abstract String imagePath(ObjectSpecification specification);
+
+    public abstract void forward(String view);
+
+    public abstract void redirectTo(String view);
+
+    public abstract String getContextPath();
+
+    public abstract String getUrlBase();
+
+    public abstract String getHeader(String name);
+
+    public abstract String getQueryString();
+
+    public abstract void startHttpSession();
+
+    public abstract String clearSession();
+
+    public abstract boolean isAborted();
+
+    public abstract String getErrorReference();
+
+    public abstract String getErrorMessage();
+
+    public abstract String getErrorDetails();
+
+    public void setSession(final AuthenticationSession session) {
+        this.session = session;
+        addVariable("_auth_session", session, Scope.SESSION);
+    }
+
+    public AuthenticationSession getSession() {
+        return session;
+    }
+
+    public abstract String getUri();
+
+    public void raiseError(final int status, final ErrorCollator errorDetails) {
+    }
+
+    public void setContentType(final String string) {
+    }
+
+    public void setSessionData(final Map<String, Object> hashMap) {
+        variables.put(Scope.SESSION, hashMap);
+        session = (AuthenticationSession) getVariable("_auth_session");
+        Boolean authenticated = (Boolean) getVariable("_authenticated");
+        isUserAuthenticated = authenticated != null && authenticated.booleanValue();
+    }
+
+    public Map<String, Object> getSessionData() {
+        return variables.get(Scope.SESSION);
+    }
+
+    public Debug getDebug() {
+        return debug;
+    }
+
+    public boolean isDebugDisabled() {
+        return !debugUsers.isDebugEnabled(getSession());
+    }
+
+    public boolean isDebug() {
+        return getDebug() == Debug.ON;
+    }
+
+    public boolean showDebugData() {
+        final Boolean variable = (Boolean) getVariable("debug-on");
+        return variable != null && variable.booleanValue();
+    }
+
+    public String getDebugTrace() {
+        return debugTrace.toString().replace('<', '[').replace('>', ']');
+    }
+
+    public void appendDebugTrace(final String line) {
+        debugTrace.append(line);
+    }
+
+    public void clearTransientVariables() {
+        objectMapping.endSession();
+    }
+
+    public void reset() {
+    }
+
+    public boolean isUserAuthenticated() {
+        return isUserAuthenticated;
+    }
+
+    public void setUserAuthenticated(boolean isUserAuthenticated) {
+        this.isUserAuthenticated = isUserAuthenticated;
+        addVariable("_authenticated", isUserAuthenticated, Scope.SESSION);
+    }
+
+
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    protected OidMarshaller getOidMarshaller() {
+        return oidMarshaller;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java
new file mode 100644
index 0000000..0ce8645
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/VersionMapping.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher.context;
+
+import org.apache.isis.core.metamodel.adapter.version.Version;
+
+public interface VersionMapping {
+
+    String mapVersion(Version version);
+
+    Version getVersion(String id);
+
+}


[21/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java
deleted file mode 100644
index 6b1e77a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiNotFoundException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  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;
-
-public class ScimpiNotFoundException extends ScimpiException {
-    public ScimpiNotFoundException() {
-        super();
-    }
-
-    public ScimpiNotFoundException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public ScimpiNotFoundException(final String message) {
-        super(message);
-    }
-
-    public ScimpiNotFoundException(final Throwable cause) {
-        super(cause);
-    }
-
-    private static final long serialVersionUID = 1L;
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java
deleted file mode 100644
index 97e00e4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/TagOrderException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  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;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class TagOrderException extends ScimpiException {
-    private static final long serialVersionUID = 1L;
-
-    public TagOrderException(final Request request) {
-        super("Invalid tag in this context: " + request.getTag().getName());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java
deleted file mode 100644
index cdb1b04..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/UserManager.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  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;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-
-public class UserManager {
-
-    private static final Logger LOG = LoggerFactory.getLogger(UserManager.class);
-    private static UserManager instance;
-
-    private static AuthenticationManager getAuthenticationManager() {
-        if (instance == null) {
-            throw new IllegalStateException("Server initialisation failed, or not defined as a context listener");
-        }
-        return instance.authenticationManager;
-    }
-
-    public static AuthenticationSession startRequest(final RequestContext context) {
-        AuthenticationSession session = context.getSession();
-        if (session == null) {
-            session = new AnonymousSession();
-            LOG.debug("start anonymous request: " + session);
-        } else {
-            LOG.debug("start request for: " + session.getUserName());
-        }
-        IsisContext.closeSession();
-        IsisContext.openSession(session);
-        return session;
-    }
-
-    public static AuthenticationSession authenticate(final AuthenticationRequestPassword passwordAuthenticationRequest) {
-        final AuthenticationSession session = getAuthenticationManager().authenticate(passwordAuthenticationRequest);
-        if (session != null) {
-            LOG.info("log on user " + session.getUserName());
-            IsisContext.closeSession();
-            IsisContext.openSession(session);
-        }
-        return session;
-    }
-
-    public static void endRequest(final AuthenticationSession session) {
-        if (session == null) {
-            LOG.debug("end anonymous request");
-        } else {
-            LOG.debug("end request for: " + session.getUserName());
-        }
-        IsisContext.closeSession();
-    }
-
-    public static void logoffUser(final AuthenticationSession session) {
-        LOG.info("log off user " + session.getUserName());
-        IsisContext.closeSession();
-        getAuthenticationManager().closeSession(session);
-
-        final AnonymousSession replacementSession = new AnonymousSession();
-        IsisContext.openSession(replacementSession);
-    }
-
-    private final AuthenticationManager authenticationManager;
-
-    public UserManager(final AuthenticationManager authenticationManager) {
-        this.authenticationManager = authenticationManager;
-        UserManager.instance = this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java
deleted file mode 100644
index b485dd0..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Util.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *  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;
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
-
-class Util {
-    
-    public static final String DEFAULT_TIME_ZONE = "Europe/London";
-    public static final String DEFAULT_LANGUAGE = "English, United Kingdom (en-gb)";
-    
-
-    private Util() {}
-
-    public static boolean hasChanged(String version1, String version2) {
-        return version2 == null && version1 != null || (version2 != null && !version2.equals(version1));
-    }
-
-    public static List<String> languages() {
-        Locale[] locales = DateFormat.getAvailableLocales();
-        List<String> list = new ArrayList<String>(locales.length);
-        for (Locale locale : locales) {
-            list.add(localeName(locale));
-        }
-        Collections.sort(list);
-        return list;
-    }
-    
-    public static List<String> timeZones() {
-        List<String> timezones = Arrays.asList(TimeZone.getAvailableIDs());
-        Collections.sort(timezones);
-        return timezones;
-    }
-
-    public static TimeZone timeZone(String timeZoneEntry) {
-        TimeZone timeZone = TimeZone.getTimeZone(timeZoneEntry);
-        return timeZone;
-    }
-
-    public static Locale locale(String localeCode) {
-        String substring[] = localeCode.trim().split("-");
-        Locale locale;
-        switch (substring.length) {
-        case 1:
-            locale = new Locale(substring[0]);                    
-            break;
-        case 2:
-            locale = new Locale(substring[0], substring[1]);                    
-            break;
-        case 3:
-            locale = new Locale(substring[0], substring[1], substring[3]);                    
-            break;
-        default:
-            locale = Locale.getDefault();
-            break;
-        }
-        return locale;
-    }
-
-    public static String languageName(String languageCode) {
-        Locale locale = locale(languageCode);
-        return localeName(locale);
-    }
-
-    public static String codeForLanguage(String language) {
-        Locale[] locales = DateFormat.getAvailableLocales();
-        for (Locale locale : locales) {
-            String name = localeName(locale);
-            if (name.equals(language)) {
-                return locale.toString().toLowerCase().replace('_', '-');
-            }
-        }
-        return null;
-    }
-
-    public static String localeName(Locale locale) {
-        String language = locale.getDisplayLanguage();
-        String country = locale.getDisplayCountry().length() == 0 ? "" :  ", " + (locale.getDisplayCountry());
-        return language + country + " (" +  locale.toString().toLowerCase().replace('_', '-') + ")";
-    }
-   
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
deleted file mode 100644
index 44a9756..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- *  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.action;
-
-import java.io.IOException;
-import java.util.List;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.consent.Veto;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.Action;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-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.edit.FieldEditState;
-import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class ActionAction implements Action {
-
-    public static final String ACTION = "action";
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public String getName() {
-        return ACTION;
-    }
-
-    /**
-     * REVIEW - this and EditAction are very similar - refactor out common code.
-     */
-    @Override
-    public void process(final RequestContext context) throws IOException {
-        final String objectId = context.getParameter("_" + OBJECT);
-        final String version = context.getParameter("_" + VERSION);
-        final String formId = context.getParameter("_" + FORM_ID);
-        final String methodName = context.getParameter("_" + METHOD);
-        final String override = context.getParameter("_" + RESULT_OVERRIDE);
-        String resultName = context.getParameter("_" + RESULT_NAME);
-        final String message = context.getParameter("_" + MESSAGE);
-        resultName = resultName == null ? RequestContext.RESULT : resultName;
-
-        FormState entryState = null;
-        try {
-            final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
-            // FIXME need to find method based on the set of parameters.
-            // otherwise overloaded method may be incorrectly
-            // selected.
-            final ObjectAction action = MethodsUtils.findAction(object, methodName);
-            entryState = validateParameters(context, action, object);
-
-            AuthenticationSession session = context.getSession();
-            if (session == null && action.isVisible(new AnonymousSession(), object, where).isVetoed()) {
-                session = new AnonymousSession();
-            }
-
-            final Version originalVersion = context.getVersion(version);
-            object.checkLock(originalVersion);
-            if (entryState.isValid()) {
-                final boolean hasResult = invokeMethod(context, resultName, object, action, entryState);
-                String view = context.getParameter(hasResult ? "_" + VIEW : "_" + VOID);
-
-                final int questionMark = view == null ? -1 : view.indexOf("?");
-                if (questionMark > -1) {
-                    final String params[] = view.substring(questionMark + 1).split("&");
-                    for (final String param : params) {
-                        final int equals = param.indexOf("=");
-                        context.addVariable(param.substring(0, equals), param.substring(equals + 1), Scope.REQUEST);
-                        view = view.substring(0, questionMark);
-                    }
-                }
-                context.setRequestPath(view);
-                if (message != null) {
-                    final MessageBroker messageBroker = getMessageBroker();
-                    messageBroker.addMessage(message);
-                }
-                if (override != null) {
-                    context.addVariable(resultName, override, Scope.REQUEST);
-                }
-                if (!action.hasReturn() && context.getVariable(resultName) == null) {
-                    context.addVariable(resultName, objectId, Scope.REQUEST);
-                }
-            } else {
-                entryState.setForm(formId);
-                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
-                context.addVariable(resultName, objectId, Scope.REQUEST);
-                if (override != null) {
-                    context.addVariable(resultName, override, Scope.REQUEST);
-                }
-                final String error = entryState.getError();
-                final String view = context.getParameter("_" + ERROR);
-                context.setRequestPath(view, Dispatcher.ACTION);
-
-                final MessageBroker messageBroker = getMessageBroker();
-                messageBroker.addWarning(error);
-            }
-        } catch (final ConcurrencyException e) {
-            final ObjectAdapter adapter = getAdapterManager().getAdapterFor(e.getOid()); 
-            String user = adapter.getOid().getVersion().getUser();
-            String errorMessage = "The data for '" + adapter.titleString() + "' was changed by " + user
-                    + ". Please repeat the action based on those changes.";
-            getMessageBroker().addMessage(errorMessage);
-
-            entryState.setForm(formId);
-            context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
-            context.addVariable(resultName, objectId, Scope.REQUEST);
-            if (override != null) {
-                context.addVariable(resultName, override, Scope.REQUEST);
-            }
-            final String error = entryState.getError();
-            if (error != null) {
-                context.addVariable(RequestContext.ERROR, error, Scope.REQUEST);
-            }
-
-            final String view = context.getParameter("_" + ERROR);
-            context.setRequestPath(view, Dispatcher.ACTION);
-
-        } catch (final RuntimeException e) {
-            getMessageBroker().getMessages();
-            getMessageBroker().getWarnings();
-            throw e;
-        }
-    }
-
-    private boolean invokeMethod(final RequestContext context, final String variable, final ObjectAdapter object, final ObjectAction action, final FormState entryState) {
-
-        final ObjectAdapter[] parameters = getParameters(action, entryState);
-        final String scopeName = context.getParameter("_" + SCOPE);
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-        return MethodsUtils.runMethod(context, action, object, parameters, variable, scope);
-    }
-
-    private ObjectAdapter[] getParameters(final ObjectAction action, final FormState entryState) {
-        final int parameterCount = action.getParameterCount();
-        final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];
-        for (int i = 0; i < parameterCount; i++) {
-            parameters[i] = entryState.getField(parameterName(i)).getValue();
-        }
-        return parameters;
-    }
-
-    private FormState validateParameters(final RequestContext context, final ObjectAction action, final ObjectAdapter object) {
-        final FormState formState = new FormState();
-        final List<ObjectActionParameter> parameters2 = action.getParameters();
-        final int parameterCount = action.getParameterCount();
-        for (int i = 0; i < parameterCount; i++) {
-            final String fieldName = parameterName(i);
-            String newEntry = context.getParameter(fieldName);
-
-            if (newEntry != null && newEntry.equals("-OTHER-")) {
-                newEntry = context.getParameter(fieldName + "-other");
-            }
-
-            if (newEntry == null) {
-                // TODO figure out a better way to determine if boolean or a
-                // password
-                final ObjectSpecification spec = parameters2.get(i).getSpecification();
-                if (spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(boolean.class)) || spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(Boolean.class))) {
-                    newEntry = FALSE;
-                } else {
-                    newEntry = "";
-                }
-            }
-            final FieldEditState fieldState = formState.createField(fieldName, newEntry);
-            Consent consent = null;
-
-            if (!parameters2.get(i).isOptional() && newEntry.equals("")) {
-                consent = new Veto(parameters2.get(i).getName() + " required");
-                formState.setError("Not all fields have been set");
-
-            } else if (parameters2.get(i).getSpecification().getFacet(ParseableFacet.class) != null) {
-                try {
-                    final ParseableFacet facet = parameters2.get(i).getSpecification().getFacet(ParseableFacet.class);
-                    Localization localization = IsisContext.getLocalization(); 
-                    final String message = parameters2.get(i).isValid(object, newEntry, localization); 
-                    if (message != null) {
-                        consent = new Veto(message);
-                        formState.setError("Not all fields are valid");
-                    }
-                    final ObjectAdapter entry = facet.parseTextEntry(null, newEntry, localization);
-                    fieldState.setValue(entry);
-                } catch (final TextEntryParseException e) {
-                    consent = new Veto(e.getMessage());
-                    formState.setError("Not all fields are valid");
-                }
-            } else {
-                fieldState.setValue(newEntry == null ? null : context.getMappedObject(newEntry));
-            }
-            if (consent != null && consent.isVetoed()) {
-                fieldState.setError(consent.getReason());
-            }
-        }
-
-        if (formState.isValid()) {
-            final ObjectAdapter[] parameters = getParameters(action, formState);
-            final Consent consent = action.isProposedArgumentSetValid(object, parameters);
-            if (consent != null && consent.isVetoed()) {
-                formState.setError(consent.getReason());
-            }
-        }
-
-        return formState;
-    }
-
-    public static String parameterName(final int index) {
-        return PARAMETER + (index + 1);
-    }
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-    }
-    
-
-    ///////////////////////////////////////////////////////////////////////////
-    // from context
-    ///////////////////////////////////////////////////////////////////////////
-    
-    protected MessageBroker getMessageBroker() {
-        return IsisContext.getMessageBroker();
-    }
-
-    protected AdapterManager getAdapterManager() {
-        return IsisContext.getPersistenceSession().getAdapterManager();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
deleted file mode 100644
index 67d13e2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *  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.action;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.htmlparser.Attribute;
-import org.htmlparser.nodes.TagNode;
-
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-
-public class Attributes {
-    private static final String TRUE = " true yes on ";
-    private static final String FALSE = " false no off ";
-    private final TagNode tagNode;
-    private final RequestContext context;
-
-    public Attributes(final TagNode tagNode, final RequestContext context) {
-        this.tagNode = tagNode;
-        this.context = context;
-    }
-
-    public boolean isPropertySet(final String name) {
-        final String attribute = tagNode.getAttribute(name);
-        int end = attribute.length() - 1;
-        final int pos = attribute.indexOf(':');
-        end = pos == -1 ? end : pos;
-        final String variabelName = attribute.substring(2, end);
-        final Object value = context.getVariable(variabelName);
-        return value != null;
-        // return attribute != null &&
-        // !context.replaceVariables(attribute).equals("");
-    }
-
-    public boolean isPropertySpecified(final String name) {
-        final String attribute = tagNode.getAttribute(name);
-        return attribute != null;
-    }
-
-    public String getOptionalProperty(final String name, final boolean ensureVariablesExists) {
-        return getOptionalProperty(name, null, ensureVariablesExists);
-    }
-
-    public String getOptionalProperty(final String name, final String defaultValue, final boolean ensureVariablesExists) {
-        final String attribute = tagNode.getAttribute(name);
-        return attribute == null ? defaultValue : context.replaceVariables(attribute);
-    }
-
-    public String getRequiredProperty(final String name, final boolean ensureVariablesExists) {
-        final String attribute = tagNode.getAttribute(name);
-        if (attribute == null) {
-            throw new RequiredPropertyException("Missing property: " + name);
-        } else if (attribute.equals("")) {
-            throw new RequiredPropertyException("Property not set: " + name);
-        } else {
-            return context.replaceVariables(attribute);
-        }
-    }
-
-    public String[] getPropertyNames(final String excluding[]) {
-        final Vector attributes = tagNode.getAttributesEx();
-        final String[] names = new String[attributes.size()];
-        int i = 0;
-        names: for (final Enumeration e = attributes.elements(); e.hasMoreElements();) {
-            final String name = ((Attribute) e.nextElement()).getName();
-            if (name == null) {
-                continue;
-            }
-            for (int j = 0; j < excluding.length; j++) {
-                if (name.equals(excluding[j])) {
-                    continue names;
-                }
-            }
-            if (tagNode.getAttribute(name) != null) {
-                names[i++] = name;
-            }
-        }
-
-        final String[] array = new String[i];
-        System.arraycopy(names, 0, array, 0, i);
-        return array;
-    }
-
-    @Override
-    public String toString() {
-        return tagNode.toHtml(); // getAttributesEx().toString();
-    }
-
-    public boolean isRequested(final String name) {
-        return isRequested(name, false);
-    }
-
-    public boolean isRequested(final String name, final boolean defaultValue) {
-        final String flag = getOptionalProperty(name, true);
-        if (flag == null) {
-            return defaultValue;
-        } else {
-            return isTrue(flag);
-        }
-    }
-
-    public static boolean isTrue(final String flag) {
-        final String value = " " + flag.toLowerCase().trim() + " ";
-        if (TRUE.indexOf(value) >= 0) {
-            return true;
-        } else if (FALSE.indexOf(value) >= 0) {
-            return false;
-        } else {
-            throw new PropertyException("Illegal flag value: " + flag);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java
deleted file mode 100644
index 2e42188..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/PropertyException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.action;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-
-public class PropertyException extends ScimpiException {
-
-    private static final long serialVersionUID = 1L;
-
-    public PropertyException() {
-        super();
-    }
-
-    public PropertyException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public PropertyException(final String message) {
-        super(message);
-    }
-
-    public PropertyException(final Throwable cause) {
-        super(cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java
deleted file mode 100644
index 20430d3..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/RequiredPropertyException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  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.action;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-
-public class RequiredPropertyException extends ScimpiException {
-    private static final long serialVersionUID = 1L;
-
-    public RequiredPropertyException() {
-        super();
-    }
-
-    public RequiredPropertyException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public RequiredPropertyException(final String message) {
-        super(message);
-    }
-
-    public RequiredPropertyException(final Throwable cause) {
-        super(cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
deleted file mode 100644
index 85d0f02..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- *  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.context;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-
-public class DefaultOidObjectMapping implements ObjectMapping {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DefaultOidObjectMapping.class);
-
-    private final Map<String, TransientRootAdapterMapping> requestTransients = Maps.newHashMap();
-    private final Map<String, TransientRootAdapterMapping> sessionTransients = Maps.newHashMap();
-
-    //private Class<? extends Oid> oidType;
-
-
-    ///////////////////////////////////////
-    // clear, endSession
-    ///////////////////////////////////////
-
-    @Override
-    public void clear() {
-        requestTransients.clear();
-
-        final List<String> remove = Lists.newArrayList();
-        for (final String id : sessionTransients.keySet()) {
-            final Oid oid = sessionTransients.get(id).getOid();
-            if (!oid.isTransient()) {
-                remove.add(id);
-                sessionTransients.put(id, null);
-            }
-        }
-        for (final String id : remove) {
-            sessionTransients.remove(id);
-        }
-    }
-
-    @Override
-    public void endSession() {
-        sessionTransients.clear();
-    }
-
-
-    ///////////////////////////////////////
-    // mapTransientObject
-    ///////////////////////////////////////
-
-    @Override
-    public String mapTransientObject(final ObjectAdapter adapter) {
-        try {
-            final List<ObjectAdapter> savedObject = Lists.newArrayList();
-            final JSONObject data = encodeTransientData(adapter, savedObject);
-            return RequestContext.TRANSIENT_OBJECT_OID_MARKER + data.toString(4);
-        } catch (final JSONException e) {
-            throw new ScimpiException(e);
-        }
-    }
-
-    private JSONObject encodeTransientData(final ObjectAdapter adapter, final List<ObjectAdapter> adaptersToSave) throws JSONException {
-        if (adaptersToSave.contains(adapter)) {
-            return null;
-        }
-        adaptersToSave.add(adapter);
-
-        final JSONObject data = createJsonForAdapter(adapter);
-
-        final ObjectSpecification specification = adapter.getSpecification();
-        for (final ObjectAssociation association : specification.getAssociations(Contributed.EXCLUDED)) {
-            final ObjectAdapter fieldValue = association.get(adapter);
-            final String fieldName = association.getId();
-
-            if (fieldValue == null) {
-                data.put(fieldName, (Object) null);
-            } else if (association.getSpecification().isEncodeable()) {
-                final EncodableFacet encodeableFacet = fieldValue.getSpecification().getFacet(EncodableFacet.class);
-                data.put(fieldName, encodeableFacet.toEncodedString(fieldValue));
-
-            } else if (association instanceof OneToManyAssociation) {
-                final List<JSONObject> collection = Lists.newArrayList();
-                final CollectionFacet facet = fieldValue.getSpecification().getFacet(CollectionFacet.class);
-                for (final ObjectAdapter element : facet.iterable(fieldValue)) {
-                    collection.add(encodeTransientData(element, adaptersToSave));
-                }
-                data.put(fieldName, collection);
-            } else {
-                if (fieldValue.isTransient() || fieldValue.isParented()) {
-                    final JSONObject saveData = encodeTransientData(fieldValue, adaptersToSave);
-                    if (saveData == null) {
-                        data.put(fieldName, mapObject(fieldValue, Scope.INTERACTION));
-                    } else {
-                        data.put(fieldName, saveData);
-                    }
-                } else {
-                    data.put(fieldName, mapObject(fieldValue, Scope.INTERACTION));
-                }
-            }
-        }
-        return data;
-    }
-
-    private JSONObject createJsonForAdapter(final ObjectAdapter adapter) throws JSONException {
-        final JSONObject data = new JSONObject();
-
-        final Oid oid = adapter.getOid();
-        data.put("_oid", oid.enString(getOidMarshaller()));
-
-        if(oid instanceof RootOid) {
-            return data;
-        }
-
-        if (!(oid instanceof AggregatedOid)) {
-            throw new ScimpiException("Unsupported OID type " + oid);
-        }
-        return data;
-    }
-
-
-
-
-    ////////////////////////////////////////////////////
-    // mapObject  (either persistent or transient)
-    ////////////////////////////////////////////////////
-
-    @Override
-    public String mapObject(final ObjectAdapter adapter, final Scope scope) {
-
-        // TODO need to ensure that transient objects are remapped each time so
-        // that any changes are added to
-        // session data
-        // continue work here.....here
-
-        final Oid oid = adapter.getOid();
-//        if (oidType == null) {
-//            oidType = oid.getClass();
-//        }
-
-        String encodedOid = oid.enString(getOidMarshaller());
-
-        //final boolean isTransient = adapter.isTransient();
-        //final String transferableId = (isTransient ? "T" : "P") + adapter.getSpecification().getFullIdentifier() + "@" + encodedOid;
-        final String transferableId = encodedOid;
-        // LOG.debug("encoded " + oid + " as " + transferableId + " ~ " + encodedOid);
-
-        if (adapter.isTransient()) {
-            // old TODO cache these in requests so that Mementos are only created once.
-            // old TODO if Transient/Interaction then return state; other store state in session an return OID string
-            final TransientRootAdapterMapping mapping = new TransientRootAdapterMapping(adapter);
-            mappingFor(scope).put(transferableId, mapping);
-        }
-
-        return transferableId;
-    }
-
-    private Map<String, TransientRootAdapterMapping> mappingFor(final Scope scope) {
-        if (scope == Scope.REQUEST) {
-            return requestTransients;
-        }
-        if (scope == Scope.INTERACTION || scope == Scope.SESSION) {
-            return sessionTransients;
-        }
-        throw new ScimpiException("Can't hold globally transient object");
-    }
-
-
-
-    ////////////////////////////////////////////////////
-    // mappedTransientObject  (lookup)
-    ////////////////////////////////////////////////////
-
-    @Override
-    public ObjectAdapter mappedTransientObject(final String jsonObjectData) {
-        final String objectData = jsonObjectData; // StringEscapeUtils.unescapeHtml(data);
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("data" + objectData);
-        }
-
-        try {
-            final JSONObject jsonObject = new JSONObject(objectData);
-            return restoreTransientObject(jsonObject);
-        } catch (final JSONException e) {
-            throw new ScimpiException("Problem reading data: " + jsonObjectData, e);
-        }
-    }
-
-    private ObjectAdapter restoreTransientObject(final JSONObject jsonObject) throws JSONException {
-
-        final ObjectAdapter adapter = getAdapter(jsonObject);
-
-        //final String objectType = jsonObject.getString("_objectType");
-        //final ObjectSpecification specification = getSpecificationLoader().lookupByObjectType(objectType);
-        final ObjectSpecification specification = adapter.getSpecification();
-
-        for (final ObjectAssociation association : specification.getAssociations(Contributed.EXCLUDED)) {
-            final String fieldName = association.getId();
-
-            final Object fieldValue = jsonObject.has(fieldName) ? jsonObject.get(fieldName) : null;
-
-            if (association.getSpecification().isEncodeable()) {
-                if (fieldValue == null) {
-                    ((OneToOneAssociation) association).initAssociation(adapter, null);
-                } else {
-                    final EncodableFacet encodeableFacet = association.getSpecification().getFacet(EncodableFacet.class);
-                    final ObjectAdapter fromEncodedString = encodeableFacet.fromEncodedString((String) fieldValue);
-                    ((OneToOneAssociation) association).initAssociation(adapter, fromEncodedString);
-                }
-            } else if (association instanceof OneToManyAssociation) {
-                final JSONArray collection = (JSONArray) fieldValue;
-                for (int i = 0; i < collection.length(); i++) {
-                    final JSONObject jsonElement = (JSONObject) collection.get(i);
-                    final ObjectAdapter objectToAdd = restoreTransientObject(jsonElement);
-                    ((OneToManyAssociation) association).addElement(adapter, objectToAdd);
-                }
-
-                /*
-                 * CollectionFacet facet =
-                 * fieldValue.getSpecification().getFacet
-                 * (CollectionFacet.class); for (ObjectAdapter element :
-                 * facet.iterable(fieldValue)) {
-                 * collection.add(saveData(element, savedObject)); }
-                 * data.put(fieldName, collection);
-                 */
-            } else {
-                if (fieldValue == null) {
-                    ((OneToOneAssociation) association).initAssociation(adapter, null);
-                } else {
-                    if (fieldValue instanceof JSONObject) {
-                        final ObjectAdapter fieldObject = restoreTransientObject((JSONObject) fieldValue);
-                        ((OneToOneAssociation) association).initAssociation(adapter, fieldObject);
-                    } else {
-                        final ObjectAdapter field = mappedObject((String) fieldValue);
-                        ((OneToOneAssociation) association).initAssociation(adapter, field);
-                    }
-                }
-            }
-        }
-        return adapter;
-    }
-
-    private ObjectAdapter getAdapter(final JSONObject jsonObject) throws JSONException {
-
-        //final String objectType = jsonObject.getString("_objectType");
-        //final String id = jsonObject.getString("_id");
-        //final ObjectSpecification objectSpec = getSpecificationLoader().lookupByObjectType(objectType);
-
-        final String oidStr = jsonObject.getString("_oid");
-        final TypedOid typedOid = getOidMarshaller().unmarshal(oidStr, TypedOid.class);
-
-        if(!typedOid.isTransient()) {
-            return getAdapterManager().adapterFor(typedOid);
-        } else {
-            return mappedObject(oidStr);
-        }
-
-//        if (objectSpec.isParented() && !objectSpec.isParentedOrFreeCollection()) {
-//            final String[] split = id.split("@");
-//            final String parentOidStr = split[0];
-//            final String aggregatedLocalId = split[1];
-//
-//            RootOid parentOid;
-//            if(RootOid.class.isAssignableFrom(oidType)) {
-//                parentOid = getOidStringifier().deString(parentOidStr);
-//            } else if (RootOidDefault.class.isAssignableFrom(oidType)) {
-//                parentOid = RootOidDefault.createTransient(objectType, parentOidStr);
-//            } else {
-//                // REVIEW: for now, don't support holding references to aggregates whose parent is also an aggregate
-//                throw new ScimpiException("Unsupported OID type " + oidType);
-//            }
-//
-//            final AggregatedOid oid = new AggregatedOid(objectType, parentOid, aggregatedLocalId);
-//            return getPersistenceSession().recreateAdapter(oid, objectSpec);
-//        } else {
-//            return mappedObject("T" + objectType + "@" + id); // yuk!
-//        }
-    }
-
-
-
-    ////////////////////////////////////////////////////
-    // mappedObject  (lookup - either persistent or transient)
-    ////////////////////////////////////////////////////
-
-    @Override
-    public ObjectAdapter mappedObject(final String oidStr) {
-
-        final TypedOid typedOid = getOidMarshaller().unmarshal(oidStr, TypedOid.class);
-
-
-//        final char type = oidStr.charAt(0);
-//
-//        // Pdom.todo.ToDoItem@OID:TODO:6
-//        final String[] split = oidStr.split("@");
-//        final String oidData = split[1];
-//        final String[] oidDataArray = oidData.split(":");
-//        final String objectType = oidDataArray[1];
-//        final String aggregatedId = split.length > 2?split[2]:null;
-//
-//        final ObjectSpecification spec = getSpecificationLoader().lookupByObjectType(objectType);
-
-        //if ((type == 'T')) {
-        if (typedOid.isTransient()) {
-
-            TransientRootAdapterMapping mapping = sessionTransients.get(oidStr);
-            if (mapping == null) {
-                mapping = requestTransients.get(oidStr);
-            }
-            if (mapping == null) {
-
-                // create as a (transient) root adapter
-                // Oid oid = deString(objectType, oidData, State.TRANSIENT);
-                //return getPersistenceSession().recreateAdapter(oid, pojo);
-
-                return getAdapterManager().adapterFor(typedOid);
-            }
-
-            final ObjectAdapter mappedTransientObject = mapping.getObject();
-            if(LOG.isDebugEnabled()) {
-                LOG.debug("retrieved " + mappedTransientObject.getOid() + " for " + oidStr);
-            }
-
-            return mappedTransientObject;
-        }
-
-        try {
-            //LOG.debug("decoding " + oidData);
-
-            //if (aggregatedId != null) {
-            if(typedOid instanceof AggregatedOid) {
-
-//              final RootOid parentOid = deString(objectType, oidData, State.PERSISTENT);
-//              Oid aggregatedOid = new AggregatedOid(objectType, parentOid, aggregatedId);
-
-                AggregatedOid aggregatedOid = (AggregatedOid) typedOid;
-                final TypedOid parentOid = aggregatedOid.getParentOid();
-
-                getPersistenceSession().loadObject(parentOid);
-                return getAdapterManager().getAdapterFor(aggregatedOid);
-            }
-
-//          RootOid oid = deString(objectType, oidData, State.PERSISTENT);
-//          return getPersistenceSession().loadObject(oid);
-
-            return getPersistenceSession().loadObject(typedOid);
-
-        } catch (final SecurityException e) {
-            throw new IsisException(e);
-        }
-    }
-
-
-    ///////////////////////////////////////////////////////
-    // reloadIdentityMap  (reloads the session transients)
-    ///////////////////////////////////////////////////////
-
-    @Override
-    public void reloadIdentityMap() {
-        final Iterator<TransientRootAdapterMapping> mappings = sessionTransients.values().iterator();
-        while (mappings.hasNext()) {
-            final TransientRootAdapterMapping mapping = mappings.next();
-            mapping.reload();
-        }
-    }
-
-
-    ////////////////////////////////////////////////////
-    // unmapObject  (unmaps the transients)
-    ////////////////////////////////////////////////////
-
-    @Override
-    public void unmapObject(final ObjectAdapter object, final Scope scope) {
-        sessionTransients.remove(object.getOid());
-        requestTransients.remove(object.getOid());
-    }
-
-
-    ///////////////////////////////////////
-    // helpers
-    ///////////////////////////////////////
-
-//    enum State { TRANSIENT, PERSISTENT }
-
-//    private RootOid deString(String objectType, final String oidData, State stateHint) {
-//        if(RootOid.class.isAssignableFrom(oidType)) {
-//            return getOidStringifier().deString(oidData);
-//        } else {
-//            throw new ScimpiException("Unsupported OID type " + oidType);
-//        }
-//    }
-
-
-//    private String enString(RootOid ows) {
-//        return getOidStringifier().enString(ows);
-//    }
-
-//    private String enString(final Oid parentOid, final String aggregatedId) {
-//        return enString(parentOid) + "@" + aggregatedId;
-//    }
-
-//    private String enString(final Oid oid) {
-//        final String parentOidStr;
-//        if(oid instanceof RootOid) {
-//            RootOid ows = (RootOid) oid;
-//            parentOidStr = enString(ows);
-//        } else if (oid instanceof RootOidDefault) {
-//            final RootOidDefault parentSerialOid = (RootOidDefault) oid;
-//            parentOidStr = parentSerialOid.getIdentifier();
-//        } else {
-//            throw new ScimpiException("Unsupported OID type " + oid);
-//        }
-//        return parentOidStr;
-//    }
-
-
-
-    /////////////////////////////////////////////////////////////////////////
-    // debugging
-    /////////////////////////////////////////////////////////////////////////
-
-    @Override
-    public void append(final DebugBuilder debug) {
-        append(debug, requestTransients, "request");
-        append(debug, sessionTransients, "session");
-    }
-
-    private void append(final DebugBuilder debug, final Map<String, TransientRootAdapterMapping> transients, final String type) {
-        final Iterator<String> ids = new HashSet<String>(transients.keySet()).iterator();
-        if (ids.hasNext()) {
-            debug.appendTitle("Transient objects (" + type + ")");
-            while (ids.hasNext()) {
-                final String key = ids.next();
-                debug.appendln(key, transients.get(key).debug());
-            }
-        }
-    }
-
-    @Override
-    public void appendMappings(final DebugBuilder request) {
-    }
-
-
-    ///////////////////////////////////////
-    // from context
-    ///////////////////////////////////////
-
-    protected SpecificationLoaderSpi getSpecificationLoader() {
-        return IsisContext.getSpecificationLoader();
-    }
-
-    protected PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    protected AdapterManager getAdapterManager() {
-        return getPersistenceSession().getAdapterManager();
-    }
-
-    protected OidMarshaller getOidMarshaller() {
-        return IsisContext.getOidMarshaller();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java
deleted file mode 100644
index 2fb0006..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultVersionMapping.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  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.context;
-
-import org.apache.isis.core.metamodel.adapter.version.SerialNumberVersion;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-
-public class DefaultVersionMapping implements VersionMapping {
-
-    @Override
-    public String mapVersion(final Version version) {
-        // SerialNumberVersion v = (SerialNumberVersion) version;
-        // return Long.toHexString(v.getSequence());
-        return version.sequence();
-    }
-
-    @Override
-    public Version getVersion(final String id) {
-        final Long sequence = Long.valueOf(id, 16);
-        return SerialNumberVersion.create(sequence, null, null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
deleted file mode 100644
index 2a5dfff..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/IndirectObjectMapping.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *  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.context;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeSet;
-
-import com.google.common.collect.Maps;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-
-public class IndirectObjectMapping implements ObjectMapping {
-    private final Map<Scope, Map<String, Mapping>> scopedMappings = Maps.newLinkedHashMap();
-    private int nextId = 0;
-
-    public IndirectObjectMapping() {
-        scopedMappings.put(Scope.GLOBAL, Maps.<String,Mapping>newHashMap());
-        scopedMappings.put(Scope.SESSION, Maps.<String,Mapping>newHashMap());
-        scopedMappings.put(Scope.INTERACTION, Maps.<String,Mapping>newHashMap());
-        scopedMappings.put(Scope.REQUEST, Maps.<String,Mapping>newHashMap());
-    }
-
-    private String nextId() {
-        nextId++;
-        return String.valueOf(nextId);
-    }
-
-    @Override
-    public void endSession() {
-        scopedMappings.get(Scope.SESSION).clear();
-        nextId = 0;
-    }
-
-    @Override
-    public void reloadIdentityMap() {
-        reloadIdentityMap(Scope.GLOBAL);
-        reloadIdentityMap(Scope.SESSION);
-        reloadIdentityMap(Scope.INTERACTION);
-
-        final Map<String, Mapping> map = scopedMappings.get(Scope.INTERACTION);
-        scopedMappings.put(Scope.REQUEST, map);
-        scopedMappings.put(Scope.INTERACTION, new HashMap<String, Mapping>());
-    }
-
-    private void reloadIdentityMap(final Scope scope) {
-        final Map<String, Mapping> map = scopedMappings.get(scope);
-        final Iterator<String> ids = map.keySet().iterator();
-        while (ids.hasNext()) {
-            final String key = ids.next();
-            final Mapping mapping = map.get(key);
-            mapping.reload();
-        }
-    }
-
-    @Override
-    public void clear() {
-        scopedMappings.get(Scope.REQUEST).clear();
-    }
-
-    @Override
-    public void unmapObject(final ObjectAdapter object, final Scope scope) {
-        final String id = mapObject(object, scope);
-        scopedMappings.get(scope).remove(id);
-    }
-
-    @Override
-    public void appendMappings(final DebugBuilder debug) {
-        appendMappings(debug, scopedMappings.get(Scope.INTERACTION));
-    }
-
-    private void appendMappings(final DebugBuilder debug, final Map<String, Mapping> map) {
-        final Iterator<String> names = map.keySet().iterator();
-        while (names.hasNext()) {
-            final String id = names.next();
-            final ObjectAdapter object = mappedObject(id);
-            debug.appendln(id, object);
-        }
-    }
-
-    private void appendMappings(final DebugBuilder debug, final Scope scope) {
-        debug.appendTitle("Objects for " + scope);
-        final Map<String, Mapping> map = scopedMappings.get(scope);
-        final Iterator<String> ids = new TreeSet<String>(map.keySet()).iterator();
-        if (!ids.hasNext()) {
-            debug.appendln("None", "");
-        }
-        while (ids.hasNext()) {
-            final String key = ids.next();
-            debug.appendln(key, map.get(key).debug());
-        }
-    }
-
-    private Mapping createMapping(final ObjectAdapter adapter) {
-        if (adapter.isTransient()) {
-            return new TransientRootAdapterMapping(adapter);
-        } else {
-            return new PersistentRootAdapterMapping(adapter);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.isis.webapp.context.ObjectMapping#mappedObject(java.lang.String
-     * )
-     */
-    @Override
-    public ObjectAdapter mappedObject(final String id) {
-        final Iterator<Map<String, Mapping>> iterator = scopedMappings.values().iterator();
-        while (iterator.hasNext()) {
-            final Map<String, Mapping> map = iterator.next();
-            final Mapping mapping = map.get(id);
-            if (mapping != null) {
-                return mapping.getObject();
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public String mapObject(final ObjectAdapter obj, final Scope scope) {
-        ObjectAdapter object;
-        object = obj;
-        final Mapping mapping = createMapping(object);
-
-        boolean changeScope = false;
-        for (final Scope s : scopedMappings.keySet()) {
-            final Map<String, Mapping> map = scopedMappings.get(s);
-            if (map.containsValue(mapping)) {
-                final String id = findMapping(map, mapping);
-                if (changeScope) {
-                    map.remove(id);
-                    scopedMappings.get(scope).put(id, mapping);
-                }
-                return id;
-            }
-
-            if (s == scope) {
-                changeScope = true;
-            }
-        }
-
-        final Map<String, Mapping> map = scopedMappings.get(scope);
-        final String id = obj.getSpecification().getShortIdentifier() + "@" + nextId();
-        map.put(id, mapping);
-        return id;
-    }
-
-    private String findMapping(final Map<String, Mapping> map, final Mapping mapping) {
-        final Iterator<String> ids = map.keySet().iterator();
-        while (ids.hasNext()) {
-            final String key = ids.next();
-            if (map.get(key).equals(mapping)) {
-                return key;
-            }
-        }
-
-        return null;
-    }
-
-    @Override
-    public void append(final DebugBuilder debug) {
-        debug.appendln("Next ID", nextId);
-
-        appendMappings(debug, Scope.GLOBAL);
-        appendMappings(debug, Scope.SESSION);
-        appendMappings(debug, Scope.INTERACTION);
-        appendMappings(debug, Scope.REQUEST);
-    }
-
-    @Override
-    public ObjectAdapter mappedTransientObject(final String substring) {
-        throw new NotYetImplementedException();
-    }
-
-    @Override
-    public String mapTransientObject(final ObjectAdapter object) {
-        throw new NotYetImplementedException();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java
deleted file mode 100644
index a41481b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/Mapping.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- *  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.context;
-
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.runtime.memento.Memento;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-
-interface Mapping {
-    ObjectAdapter getObject();
-
-    Oid getOid();
-
-    String debug();
-
-    void reload();
-
-    void update();
-}
-
-class TransientRootAdapterMapping implements Mapping {
-    private final RootOid oid;
-    private Memento memento;
-
-    public TransientRootAdapterMapping(final ObjectAdapter adapter) {
-        oid = (RootOid) adapter.getOid();
-        Assert.assertTrue("OID is for persistent", oid.isTransient());
-        Assert.assertTrue("adapter is for persistent", adapter.isTransient());
-        memento = new Memento(adapter);
-    }
-
-    @Override
-    public ObjectAdapter getObject() {
-        return getAdapterManager().getAdapterFor(oid);
-    }
-
-    @Override
-    public Oid getOid() {
-        return oid;
-    }
-
-    @Override
-    public void reload() {
-        memento.recreateObject();
-    }
-
-    @Override
-    public void update() {
-        memento = new Memento(getObject());
-    }
-
-
-    ////////////////////////////////////
-    // debug
-    ////////////////////////////////////
-
-    @Override
-    public String debug() {
-        final DebugString debug = new DebugString();
-        memento.debug(debug);
-        return debug.toString();
-    }
-
-    ////////////////////////////////////
-    // equals, hashCode
-    ////////////////////////////////////
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (obj == this) {
-            return true;
-        }
-
-        if (obj instanceof TransientRootAdapterMapping) {
-            return ((TransientRootAdapterMapping) obj).oid.equals(oid);
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return oid.hashCode();
-    }
-
-    
-    ////////////////////////////////////
-    // from context
-    ////////////////////////////////////
-
-	private AdapterManager getAdapterManager() {
-		return getPersistenceSession().getAdapterManager();
-	}
-
-	private PersistenceSession getPersistenceSession() {
-		return IsisContext.getPersistenceSession();
-	}
-}
-
-class PersistentRootAdapterMapping implements Mapping {
-    private final RootOid oid;
-    private final ObjectSpecification spec;
-
-    public PersistentRootAdapterMapping(final ObjectAdapter object) {
-        this.oid = (RootOid) object.getOid();
-        this.spec = object.getSpecification();
-    }
-
-    @Override
-    public Oid getOid() {
-        return oid;
-    }
-
-    @Override
-    public ObjectAdapter getObject() {
-        if (!IsisContext.inTransaction()) {
-            throw new IllegalStateException(getClass().getSimpleName() + " requires transaction in order to load");
-        }
-        return getPersistenceSession().loadObject(oid);
-    }
-
-    @Override
-    public void reload() {
-    	// will only recreate if not already in the adapter mgr maps.
-    	getAdapterManager().adapterFor(oid);
-    }
-
-
-    @Override
-    public void update() {
-    }
-
-    ////////////////////////////////////
-    // debug
-    ////////////////////////////////////
-
-    @Override
-    public String debug() {
-        return oid + "  " + spec.getShortIdentifier() + "  " + getAdapterManager().getAdapterFor(oid);
-    }
-
-    ////////////////////////////////////
-    // equals, hashCode
-    ////////////////////////////////////
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (obj == this) {
-            return true;
-        }
-
-        if (obj instanceof PersistentRootAdapterMapping) {
-            final PersistentRootAdapterMapping other = (PersistentRootAdapterMapping) obj;
-            return oid.equals(other.oid) && spec == other.spec;
-        }
-
-        return false;
-    }
-
-
-    @Override
-    public int hashCode() {
-        int hash = 37;
-        hash = hash * 17 + oid.hashCode();
-        hash = hash * 17 + spec.hashCode();
-        return hash;
-    }
-
-    
-    ////////////////////////////////////
-    // from context
-    ////////////////////////////////////
-
-    protected PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    protected AdapterManager getAdapterManager() {
-        return getPersistenceSession().getAdapterManager();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
deleted file mode 100644
index 9fe4013..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ObjectMapping.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  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.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;
-
-public interface ObjectMapping {
-
-    void reloadIdentityMap();
-    void endSession();
-
-    void clear();
-
-    String mapObject(ObjectAdapter obj, Scope scope);
-    String mapTransientObject(ObjectAdapter object);
-    void unmapObject(ObjectAdapter object, Scope scope);
-
-    ObjectAdapter mappedObject(String oidStr);
-    ObjectAdapter mappedTransientObject(String jsonData);
-
-    void append(DebugBuilder debug);
-    void appendMappings(DebugBuilder debug);
-}


[13/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java
deleted file mode 100644
index febafb6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Mark.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class Mark extends AbstractElementProcessor {
-
-    // TODO the return points should be pushed on to a stack so that there is
-    // traceable history.
-    @Override
-    public void process(final Request request) {
-        // String name = request.getOptionalProperty(NAME);
-        final RequestContext context = request.getContext();
-        context.addVariable("_return-to", context.getUri(), Scope.SESSION);
-    }
-
-    @Override
-    public String getName() {
-        return "mark";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java
deleted file mode 100644
index 5929f81..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/NewActionLink.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class NewActionLink extends AbstractLink {
-
-    // REVIEW: confirm this rendering context
-    private final Where where = Where.OBJECT_FORMS;
-
-    @Override
-    protected boolean valid(final Request request, final ObjectAdapter object) {
-        final String method = request.getRequiredProperty(METHOD);
-        final ObjectAction action = MethodsUtils.findAction(object, method);
-        return MethodsUtils.isVisibleAndUsable(object, action, where);
-    }
-
-    @Override
-    protected String linkLabel(final String name, final ObjectAdapter object) {
-        return "run";
-    }
-
-    @Override
-    protected String defaultView() {
-        return "_generic_action." + Dispatcher.EXTENSION;
-    }
-
-    @Override
-    protected String additionalParameters(final Request request) {
-        final String method = request.getRequiredProperty(METHOD);
-        return "method=" + method;
-    }
-
-    @Override
-    public String getName() {
-        return "new-action-link";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java
deleted file mode 100644
index f2726bf..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ObjectLink.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  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.view.simple;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ObjectLink extends AbstractLink {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    protected boolean valid(final Request request, final ObjectAdapter object) {
-        final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        final List<ObjectAssociation> visibleFields = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, where));
-        return visibleFields.size() > 0;
-    }
-
-    @Override
-    protected String linkLabel(final String name, final ObjectAdapter object) {
-        if (name == null) {
-            return object.titleString();
-        } else {
-            return name;
-        }
-    }
-
-    @Override
-    protected String defaultView() {
-        return Dispatcher.GENERIC + "." + Dispatcher.EXTENSION;
-    }
-
-    @Override
-    public String getName() {
-        return "object-link";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java
deleted file mode 100644
index 10c3b13..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/PageTitle.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class PageTitle extends Variable {
-    @Override
-    public void process(final Request request) {
-        process(request, "title", null, null, false, Scope.REQUEST);
-    }
-
-    @Override
-    public String getName() {
-        return "page-title";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java
deleted file mode 100644
index 6f3b0d8..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Redirect.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Redirect extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "redirect";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final String view = request.getRequiredProperty(VIEW);
-        request.getContext().redirectTo(view);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
deleted file mode 100644
index 3321b87..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *  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.view.simple;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.*;
-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.edit.RemoveAction;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class RemoveElement extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final static Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String title = request.getOptionalProperty(BUTTON_TITLE, "Remove From List");
-        final String cls = request.getOptionalProperty(CLASS, "action in-line delete confirm");
-        final String object = request.getOptionalProperty(OBJECT);
-        final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        final RequestContext context = request.getContext();
-        final String objectId = object != null ? object : (String) context.getVariable(RequestContext.RESULT);
-        final ObjectAdapter adapter = MethodsUtils.findObject(context, objectId);
-
-        final String element = request.getOptionalProperty(ELEMENT, (String) context.getVariable(ELEMENT));
-        final ObjectAdapter elementId = MethodsUtils.findObject(context, element);
-
-        final String fieldName = request.getRequiredProperty(FIELD);
-
-        String view = request.getOptionalProperty(VIEW);
-        view = context.fullFilePath(view == null ? context.getResourceFile() : view);
-        String error = request.getOptionalProperty(ERROR);
-        error = context.fullFilePath(error == null ? context.getResourceFile() : error);
-
-        request.processUtilCloseTag();
-
-        write(request, adapter, fieldName, elementId, resultOverride, view, error, title, cls);
-    }
-
-    @Override
-    public String getName() {
-        return "remove-element";
-    }
-
-    public static void write(final Request request, final ObjectAdapter adapter, final String fieldName, final ObjectAdapter element, final String resultOverride, final String view, final String error, final String title, final String cssClass) {
-        final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
-        if (field == null) {
-            throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
-        }
-        if (!field.isOneToManyAssociation()) {
-            throw new ScimpiException("Field " + fieldName + " not a collection, in " + adapter.getSpecification().getFullIdentifier());
-        }
-        if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
-            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-        }
-        ResolveFieldUtil.resolveField(adapter, field);
-
-        Consent usable = field.isUsable(IsisContext.getAuthenticationSession(), adapter, where);
-        if (usable.isAllowed()) {
-            usable = ((OneToManyAssociation) field).isValidToRemove(adapter, element);
-        }
-
-        if (usable.isVetoed()) {
-            request.appendHtml("<div class=\"" + cssClass + " disabled-form\">"); 
-            request.appendHtml("<div class=\"button disabled\" title=\""); 
-            request.appendAsHtmlEncoded(usable.getReason());
-            request.appendHtml("\" >" + title);
-            request.appendHtml("</div>");
-            request.appendHtml("</div>");
-        } else {
-            if (valid(request, adapter)) {
-                final String classSegment = " class=\"" + cssClass + "\"";
-
-                final String objectId = request.getContext().mapObject(adapter, Scope.INTERACTION);
-                final String elementId = request.getContext().mapObject(element, Scope.INTERACTION);
-                final String action = RemoveAction.ACTION + Dispatcher.COMMAND_ROOT;
-                request.appendHtml("<form" + classSegment + " method=\"post\" action=\"" + action + "\" >");
-                request.appendHtml("<input type=\"hidden\" name=\"" + OBJECT + "\" value=\"" + objectId + "\" />");
-                request.appendHtml("<input type=\"hidden\" name=\"" + FIELD + "\" value=\"" + fieldName + "\" />");
-                request.appendHtml("<input type=\"hidden\" name=\"" + ELEMENT + "\" value=\"" + elementId + "\" />");
-                if (resultOverride != null) {
-                    request.appendHtml("<input type=\"hidden\" name=\"" + RESULT_OVERRIDE + "\" value=\"" + resultOverride + "\" />");
-                }
-                request.appendHtml("<input type=\"hidden\" name=\"" + VIEW + "\" value=\"" + view + "\" />");
-                request.appendHtml("<input type=\"hidden\" name=\"" + ERROR + "\" value=\"" + error + "\" />");
-                request.appendHtml(request.getContext().interactionFields());
-                request.appendHtml("<input class=\"button\" type=\"submit\" value=\"" + title + "\" />");
-                request.appendHtml("</form>");
-            }
-        }
-    }
-
-    private static boolean valid(final Request request, final ObjectAdapter adapter) {
-        // TODO is this check valid/necessary?
-
-        // TODO check is valid to remove element
-        final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        final Filter<ObjectAssociation> filter = ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where);
-        final List<ObjectAssociation> visibleFields = adapter.getSpecification().getAssociations(Contributed.EXCLUDED, filter);
-        if (visibleFields.size() == 0) {
-            return false;
-        }
-
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java
deleted file mode 100644
index 2dced50..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class ScopeTag extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getRequiredProperty(NAME);
-        final String scopeName = request.getRequiredProperty(SCOPE);
-        final Scope scope = RequestContext.scope(scopeName);
-        request.processUtilCloseTag();
-        changeScope(request, name, scope);
-    }
-
-    protected static void changeScope(final Request request, final String name, final Scope scope) {
-        request.getContext().changeScope(name, scope);
-        final Object value = request.getContext().getVariable(name);
-        if (value != null) {
-            request.getContext().addVariable(name, value, scope);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "scope";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java
deleted file mode 100644
index 1014280..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.action.RequiredPropertyException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class SetCookie extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getRequiredProperty("name");
-        final String value = request.getOptionalProperty("value");
-        final boolean isClear = request.getOptionalProperty("action", "set").equals("clear");
-        final String expiresString = request.getOptionalProperty("expires", "-1");
-
-        if (!isClear && value == null) {
-            throw new RequiredPropertyException("Property not set: " + value);
-        }
-        if (isClear) {
-            request.appendDebug("cookie: " + name + " (cleared)");
-            request.getContext().addCookie(name, null, 0);
-        } else {
-            if (value.length() > 0) {
-                request.appendDebug("cookie: " + name + " set to"+ value);
-                request.getContext().addCookie(name, value, Integer.valueOf(expiresString));
-            }
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "set-cookie";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java
deleted file mode 100644
index b91261c..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class SetCookieFromField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        throw new NotYetImplementedException("3.1");
-        /*
-         * String objectId = request.getOptionalProperty(OBJECT); String
-         * fieldName = request.getRequiredProperty(FIELD);
-         * 
-         * ObjectAdapter object = (ObjectAdapter)
-         * request.getContext().getMappedObjectOrResult(objectId);
-         * ObjectAssociation field =
-         * object.getSpecification().getField(fieldName); if (field.isValue()) {
-         * throw new ScimpiException("Can only set up a value field"); }
-         * ObjectAdapter value = field.get(object); if (value != null) { String
-         * title = value.titleString();
-         * 
-         * if (title.length() > 0) { String name =
-         * request.getRequiredProperty(NAME); String expiresString =
-         * request.getOptionalProperty("expires", "-1");
-         * request.getContext().addCookie(name, title,
-         * Integer.valueOf(expiresString)); } }
-         */
-    }
-
-    @Override
-    public String getName() {
-        return "set-cookie-from-field";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java
deleted file mode 100644
index 89702fa..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class SetFieldFromCookie extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        throw new NotYetImplementedException("3.1");
-        /*
-         * String name = request.getRequiredProperty(NAME); String cookieString
-         * = request.getContext().getCookie(name); ObjectAdapter valueAdapter =
-         * IsisContext.getObjectPersistor().createAdapterForValue(cookieString);
-         * 
-         * String objectId = request.getOptionalProperty(OBJECT); String
-         * fieldName = request.getRequiredProperty(FIELD); ObjectAdapter object
-         * = (ObjectAdapter)
-         * request.getContext().getMappedObjectOrResult(objectId);
-         * ObjectAssociation field =
-         * object.getSpecification().getField(fieldName); if (field.isValue()) {
-         * throw new ScimpiException("Can only set up a value field"); }
-         * 
-         * ((ValueAssociation) field).setValue(object, valueAdapter);
-         */
-    }
-
-    @Override
-    public String getName() {
-        return "set-field-from-cookie";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java
deleted file mode 100644
index d8f79f6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  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.view.simple;
-
-import java.util.Locale;
-import java.util.TimeZone;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * Displays the localization data for the current user.
- */
-public class SetLocalization extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.closeEmpty();
-        
-        final String localeCode = request.getRequiredProperty("locale");
-        final String timeZone = request.getRequiredProperty("time-zone");
-        
-        String country;
-        String language;
-        int pos = localeCode.indexOf('_');
-        if (pos == 1) {
-            language = localeCode;
-            country = "";
-        } else {
-            language = localeCode.substring(0, pos);
-            country = localeCode.substring(pos + 1);
-        }
-        
-        Locale l = new Locale(language, country);
-        TimeZone t = TimeZone.getTimeZone(timeZone);
-        // IsisContext.getUserProfile().setLocalization(new UserLocalization(l, t));
-
-    }
-
-    @Override
-    public String getName() {
-        return "alpha-set-localization";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java
deleted file mode 100644
index 1efd7bf..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class SimpleButton extends AbstractElementProcessor {
-    @Override
-    public void process(final Request request) {
-        final String href = request.getRequiredProperty("href");
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        final String text = request.popBuffer();
-        request.appendHtml("<div class=\"action\"><a class=\"button\" href=\"" + href + "\">" + text + "</a></div>");
-    }
-
-    @Override
-    public String getName() {
-        return "button";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java
deleted file mode 100644
index 493c33a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class StartSession extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        request.getContext().startHttpSession();
-    }
-
-    @Override
-    public String getName() {
-        return "start-session";
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java
deleted file mode 100644
index 8860780..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class TemplateTag implements ElementProcessor {
-
-    @Override
-    public String getName() {
-        return "template";
-    }
-
-    @Override
-    public void process(final Request request) {
-        // REVIEW this make IE8 render poorly as the browser doesn't think a
-        // DOCTYPE is provided, causing it to run in
-        // quirk mode
-        // request.appendHtml("<!--  zz apply template " +
-        // request.getOptionalProperty("file") + " -->");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java
deleted file mode 100644
index 9dcf810..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Unless extends AbstractConditionalBlock {
-
-    @Override
-    protected void processTags(final boolean isSet, final Request request) {
-        if (isSet) {
-            request.skipUntilClose();
-            request.appendDebug("    skipping segment");
-        } else {
-            request.processUtilCloseTag();
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "unless";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java
deleted file mode 100644
index 960fc6b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class Variable extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getOptionalProperty(NAME);
-        final String value = request.getOptionalProperty(VALUE);
-        final String defaultTo = request.getOptionalProperty(DEFAULT);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-        final boolean isClear = request.getOptionalProperty("action", "set").equals("clear");
-        final Scope scope = RequestContext.scope(scopeName, isClear ? Scope.SESSION : Scope.REQUEST);
-        process(request, name, value, defaultTo, isClear, scope);
-    }
-
-    protected void process(final Request request, final String name, final String value, final String defaultTo, final boolean isClear, final Scope scope) {
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        String source = request.popBuffer();
-        if (isClear) {
-            request.appendDebug("variable: " + name + " (cleared)");
-            request.getContext().clearVariable(name, scope);
-        } else {
-            if (source.length() == 0 && value != null) {
-                source = value;
-            }
-            if (source.length() == 0) {
-                source = defaultTo;
-            }
-            request.appendDebug("    " + name + " (" + scope + ") set to " + source);
-            request.getContext().addVariable(name, source, scope);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "variable";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java
deleted file mode 100644
index cc1fd09..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  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.view.simple;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class When extends AbstractConditionalBlock {
-
-    @Override
-    protected void processTags(final boolean isSet, final Request request) {
-        if (isSet) {
-            request.processUtilCloseTag();
-        } else {
-            request.appendDebug("    skipping segment");
-            request.skipUntilClose();
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "when";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java
deleted file mode 100644
index 119a453..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  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.view.value;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-// TODO do the same for description and help, and for fields
-public class ActionName extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String objectId = request.getOptionalProperty(OBJECT);
-        final String methodName = request.getRequiredProperty(METHOD);
-
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-        final ObjectAction action = MethodsUtils.findAction(object, methodName);
-
-        request.appendAsHtmlEncoded(action.getName());
-    }
-
-    @Override
-    public String getName() {
-        return "action-name";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java
deleted file mode 100644
index debaa49..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  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.view.value;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class CountElements extends AbstractObjectProcessor {
-
-    @Override
-    protected void process(final Request request, final ObjectAdapter collection) {
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-        final int size = facet.size(collection);
-        if (size == 0) {
-            request.appendHtml(request.getOptionalProperty("none", "0"));
-        } else if (size == 1) {
-            request.appendHtml(request.getOptionalProperty("one", "1"));
-        } else {
-            final String text = request.getOptionalProperty("many", "" + size);
-            request.appendHtml(String.format(text, size));
-        }
-    }
-
-    @Override
-    protected String checkFieldType(final ObjectAssociation objectField) {
-        return objectField.isOneToManyAssociation() ? null : "must be a collection";
-    }
-
-    @Override
-    public String getName() {
-        return "count";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java
deleted file mode 100644
index c7284a0..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  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.view.value;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ElementType extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        ObjectAdapter collection;
-        final String field = request.getOptionalProperty(FIELD);
-        final RequestContext context = request.getContext();
-        if (field != null) {
-            final String id = request.getRequiredProperty(OBJECT);
-            final ObjectAdapter object = context.getMappedObjectOrResult(id);
-            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
-            if (!objectField.isOneToManyAssociation()) {
-                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
-            }
-            collection = objectField.get(object);
-        } else {
-            final String id = request.getOptionalProperty(COLLECTION);
-            collection = context.getMappedObjectOrResult(id);
-        }
-
-        final ObjectSpecification elementSpecification = collection.getElementSpecification();
-        final String name = elementSpecification.getSingularName();
-
-        request.appendAsHtmlEncoded(name);
-    }
-
-    @Override
-    public String getName() {
-        return "element-type";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
deleted file mode 100644
index ed054a1..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *  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.view.value;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FieldName extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getRequiredProperty(FIELD);
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-        if (field == null) {
-            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
-        }
-        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-        }
-        request.appendAsHtmlEncoded(field.getName());
-    }
-
-    @Override
-    public String getName() {
-        return "field-name";
-    }
-
-    public static void write(final Request content, final ObjectAssociation field) {
-        content.appendHtml("<span class=\"label\" title=\"" + field.getDescription() + "\">");
-        content.appendHtml("</span>");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java
deleted file mode 100644
index 84e2204..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  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.view.value;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class ParameterName extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String objectId = request.getOptionalProperty(OBJECT);
-        final String methodName = request.getRequiredProperty(METHOD);
-        final String field = request.getOptionalProperty(PARAMETER_NUMBER);
-
-        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-        final ObjectAction action = MethodsUtils.findAction(object, methodName);
-        final List<ObjectActionParameter> parameters = action.getParameters();
-
-        int index;
-        if (field == null) {
-            index = 0;
-        } else {
-            index = Integer.valueOf(field).intValue() - 1;
-        }
-        if (index < 0 || index >= parameters.size()) {
-            throw new ScimpiException("Parameter numbers should be between 1 and " + parameters.size() + ": " + index);
-        }
-
-        request.appendAsHtmlEncoded(parameters.get(index).getName());
-    }
-
-    @Override
-    public String getName() {
-        return "parameter-name";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
deleted file mode 100644
index 6b2078a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  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.view.value;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * 
- */
-public class TitleString extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getOptionalProperty(FIELD);
-        final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        if (object == null) { 
-            return; 
-        } 
-        String titleString;
-        if (fieldName == null) {
-            titleString = object.titleString();
-        } else {
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE).isVetoed()) {
-                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-            }
-            final ObjectAdapter fieldReference = field.get(object);
-            if (fieldReference != null) {
-                titleString = fieldReference.titleString();
-            } else {
-                titleString = "";
-            }
-        }
-        request.appendDebug("    " + titleString);
-        request.appendTruncated(titleString, truncateTo);
-    }
-
-    @Override
-    public String getName() {
-        return "title-string";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java
deleted file mode 100644
index 9c7861d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  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.view.value;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Type extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final RequestContext context = request.getContext();
-        final String showPlural = request.getOptionalProperty(PLURAL);
-        final String id = request.getOptionalProperty(OBJECT);
-        final String objectId = id != null ? id : (String) context.getVariable(RequestContext.RESULT);
-
-        ObjectAdapter object = context.getMappedObjectOrResult(objectId);
-        final String field = request.getOptionalProperty(FIELD);
-        if (field != null) {
-            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
-            object = objectField.get(object);
-        }
-        request.appendDebug(" for " + object);
-
-        final ObjectSpecification specification = object.getSpecification();
-        final String name = showPlural != null ? specification.getPluralName() : specification.getSingularName();
-
-        request.appendAsHtmlEncoded(name);
-    }
-
-    @Override
-    public String getName() {
-        return "type";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/pom.xml b/component/viewer/scimpi/pom.xml
deleted file mode 100644
index 300d60d..0000000
--- a/component/viewer/scimpi/pom.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>org.apache.isis.core</groupId>
-		<artifactId>isis</artifactId>
-        <version>1.9.0-SNAPSHOT</version>
-		<relativePath>../../../core/pom.xml</relativePath>
-	</parent>
-
-	<groupId>org.apache.isis.viewer</groupId>
-	<artifactId>isis-viewer-scimpi</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
-	
-	<name>Isis Scimpi Viewer</name>
-	
-	<packaging>pom</packaging>
-
-	<properties>
-        <siteBaseDir>.</siteBaseDir>
-		<relativeUrl/>
-    </properties>
-
-    <!-- used in Site generation for relative references. -->
-    <url>http://isis.apache.org/${relativeUrl}</url>
-
-	<build>
-		<pluginManagement>
-			<plugins>
-                <!-- Apache Release Audit Tool -->
-                <plugin>
-                    <groupId>org.apache.rat</groupId>
-                    <artifactId>apache-rat-plugin</artifactId>
-                    <version>0.10</version>
-	                <configuration>
-	                    <excludes>
-	                    	<!-- 
-	                    	overriding inherited excludes from oia.core:isis 
-	                    	with a more specific set for this component
-	                    	 -->
-	                        <exclude>**/target/**</exclude>
-	                        <exclude>**/target-ide/**</exclude>
-
-	                        <exclude>**/*.project</exclude>
-	                        <exclude>**/.classpath</exclude>
-	                        <exclude>**/.settings/**</exclude>
-	                    </excludes>
-                    </configuration>
-	            </plugin>
-			</plugins>
-		</pluginManagement>
-	</build>
-
-    <reporting>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-project-info-reports-plugin</artifactId>
-                <inherited>false</inherited>
-                <reportSets>
-                    <reportSet>
-                        <inherited>false</inherited>
-                        <reports>
-                            <report>dependency-management</report>
-                            <report>plugins</report>
-                            <report>modules</report>
-                            <report>summary</report>
-                        </reports>
-                    </reportSet>
-                </reportSets>
-            </plugin>
-        </plugins>
-    </reporting>
-
-    <dependencyManagement>
-        <dependencies>
-
-	    	<!-- for benefit of application developers, using scope=import -->
-
-	        <dependency>
-	            <groupId>org.apache.isis.viewer</groupId>
-	            <artifactId>isis-viewer-scimpi-dispatcher</artifactId>
-	            <version>1.0.0-SNAPSHOT</version>
-	        </dependency>
-
-	        <dependency>
-	            <groupId>org.apache.isis.viewer</groupId>
-	            <artifactId>isis-viewer-scimpi-servlet</artifactId>
-	            <version>1.0.0-SNAPSHOT</version>
-	        </dependency>
-
-            <dependency>
-                <!--  defined here because other Isis modules do not depend upon it -->
-                <groupId>commons-lang</groupId>
-                <artifactId>commons-lang</artifactId>
-                <version>2.6</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.json</groupId>
-                <artifactId>json</artifactId>
-                <version>20140107</version>
-            </dependency>
-
-		</dependencies>
-	</dependencyManagement>
-
-	<modules>
-		<module>dispatcher</module>
-		<module>servlet</module>
-	</modules>
-</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/servlet/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/pom.xml b/component/viewer/scimpi/servlet/pom.xml
deleted file mode 100644
index 1600dd7..0000000
--- a/component/viewer/scimpi/servlet/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-        <groupId>org.apache.isis.viewer</groupId>
-	    <artifactId>isis-viewer-scimpi</artifactId>
-		<version>1.0.0-SNAPSHOT</version>
-	</parent>
-
-	<artifactId>isis-viewer-scimpi-servlet</artifactId>
-
-	<name>Isis Scimpi Viewer Servlet</name>
-
-	<properties>
-        <siteBaseDir>..</siteBaseDir>
-		<relativeUrl>servlet/</relativeUrl>
-	</properties>
-
-    <!-- used in Site generation for relative references. -->
-    <url>http://isis.apache.org/${relativeUrl}</url>
-
-    <reporting>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-project-info-reports-plugin</artifactId>
-                <inherited>false</inherited>
-                <configuration>
-                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
-                </configuration>
-                <reportSets>
-                    <reportSet>
-                        <inherited>false</inherited>
-                        <reports>
-                            <report>dependencies</report>
-                            <report>dependency-convergence</report>
-                            <report>plugins</report>
-                            <report>summary</report>
-                        </reports>
-                    </reportSet>
-                </reportSets>
-            </plugin>
-        </plugins>
-    </reporting>
-
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.isis.viewer</groupId>
-			<artifactId>isis-viewer-scimpi-dispatcher</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-servlet_3.0_spec</artifactId>
-		</dependency>
-
-	</dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java
deleted file mode 100644
index 6bb776c..0000000
--- a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  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.servlet;
-
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-
-public class DispatchException extends ScimpiException {
-    private static final long serialVersionUID = 1L;
-
-    public DispatchException() {
-    }
-
-    public DispatchException(final String message) {
-        super(message);
-    }
-
-    public DispatchException(final Throwable cause) {
-        super(cause);
-    }
-
-    public DispatchException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
deleted file mode 100644
index 272e1c4..0000000
--- a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  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.servlet;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.UserManager;
-import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUsers;
-
-public class DispatcherServlet extends HttpServlet {
-    private static final long serialVersionUID = 1L;
-    private static final Logger LOG = LoggerFactory.getLogger(DispatcherServlet.class);
-    private Dispatcher dispatcher;
-    private DebugUsers debugUsers;
-
-    @Override
-    protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-        LOG.info("http request from " + request.getRemoteAddr() + ": post " + request.getServletPath() + "?" + request.getQueryString()); 
-        process(request, response);
-    }
-
-    @Override
-    protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-        LOG.info("http request from " + request.getRemoteAddr() + ": get  " + request.getServletPath() + "?" + request.getQueryString()); 
-        process(request, response);
-    }
-
-    private void process(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-        try {
-            final ServletRequestContext context = new ServletRequestContext(debugUsers);
-            context.startRequest(request, response, getServletContext());
-            dispatcher.process(context, request.getServletPath());
-        } catch (final RuntimeException e) {
-            LOG.error("servlet exception", e);
-            throw e;
-        }
-    }
-
-    @Override
-    public void init() throws ServletException {
-        super.init();
-
-        // TODO get directory from servlet parameter
-        ImageLookup.setImageDirectory(getServletContext(), "images");
-
-        debugUsers = new DebugUsers();
-        debugUsers.initialize();
-
-        dispatcher = new Dispatcher();
-        final Enumeration initParameterNames = getInitParameterNames();
-        while (initParameterNames.hasMoreElements()) {
-            final String name = (String) initParameterNames.nextElement();
-            final String value = getInitParameter(name);
-            dispatcher.addParameter(name, value);
-        }
-        final String dir = getServletContext().getRealPath("/WEB-INF");
-        dispatcher.init(dir, debugUsers);
-
-        new UserManager(IsisContext.getAuthenticationManager());
-    }
-}


[08/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
new file mode 100644
index 0000000..36c1920
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
@@ -0,0 +1,256 @@
+/*
+ *  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.processor;
+
+import java.util.HashMap;
+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.DebugUsersView;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.ErrorDetails;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.ErrorMessage;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.ErrorReference;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.History;
+import org.apache.isis.viewer.scimpi.dispatcher.view.VersionNumber;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionButton;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.Methods;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.Parameter;
+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.DebugAccessCheck;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.DebugCollectionView;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.DebugObjectView;
+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.Log;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.LogLevel;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Members;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.ShowDebug;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Specification;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.ThrowException;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.AddMessage;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.AddWarning;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.Errors;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.Feedback;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldLabel;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldValue;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.GetField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.IncludeObject;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.ListView;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.LongFormView;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.Messages;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.SelectedObject;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.ShortFormView;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableCell;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableEmpty;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableHeader;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableRow;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableView;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.Title;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.Warnings;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.EditObject;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FormEntry;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FormField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.HiddenField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.RadioListField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.Selector;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.ExcludeField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.IncludeField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.logon.Logoff;
+import org.apache.isis.viewer.scimpi.dispatcher.view.logon.Logon;
+import org.apache.isis.viewer.scimpi.dispatcher.view.logon.RestrictAccess;
+import org.apache.isis.viewer.scimpi.dispatcher.view.logon.Secure;
+import org.apache.isis.viewer.scimpi.dispatcher.view.logon.User;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.BlockDefine;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.BlockUse;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Commit;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.ContentTag;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.CookieValue;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.DefaultValue;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.EditLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.EndSession;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Forward;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.GetCookie;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Import;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.InitializeFromCookie;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.InitializeFromResult;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Localization;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Mark;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.NewActionLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.ObjectLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.PageTitle;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Redirect;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.RemoveElement;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.ScopeTag;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetCookie;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetCookieFromField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetFieldFromCookie;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SetLocalization;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.SimpleButton;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.StartSession;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.TemplateTag;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Unless;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.Variable;
+import org.apache.isis.viewer.scimpi.dispatcher.view.simple.When;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.ActionName;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.CountElements;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.ElementType;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.FieldName;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.ParameterName;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.TitleString;
+import org.apache.isis.viewer.scimpi.dispatcher.view.value.Type;
+
+public class ProcessorLookup {
+    private final Map<String, ElementProcessor> swfElementProcessors = new HashMap<String, ElementProcessor>();
+
+    public void init() {
+        addElementProcessor(new ActionLink());
+        addElementProcessor(new ActionButton());
+        addElementProcessor(new ActionForm());
+        addElementProcessor(new ActionName());
+        addElementProcessor(new AddMessage());
+        addElementProcessor(new AddWarning());
+        addElementProcessor(new BlockDefine());
+        addElementProcessor(new BlockUse());
+        addElementProcessor(new History());
+        addElementProcessor(new Collection());
+        addElementProcessor(new Commit());
+        addElementProcessor(new ContentTag());
+        addElementProcessor(new CountElements());
+        addElementProcessor(new Diagnostics());
+        addElementProcessor(new DebugAccessCheck());
+        addElementProcessor(new DebugCollectionView()); 
+        addElementProcessor(new DebuggerLink());
+        addElementProcessor(new DebugObjectView()); 
+        addElementProcessor(new DebugUsersView());
+        addElementProcessor(new DefaultValue());
+        addElementProcessor(new EditLink());
+        addElementProcessor(new EditObject());
+        addElementProcessor(new ElementType());
+        addElementProcessor(new Errors());
+        addElementProcessor(new ErrorDetails()); 
+        addElementProcessor(new ErrorMessage()); 
+        addElementProcessor(new ErrorReference());
+        addElementProcessor(new ExcludeField());
+        addElementProcessor(new Feedback());
+        addElementProcessor(new FieldLabel());
+        addElementProcessor(new FieldName());
+        addElementProcessor(new FieldValue());
+        addElementProcessor(new FormField());
+        addElementProcessor(new FormEntry());
+        addElementProcessor(new Forward());
+        addElementProcessor(new GetField());
+        addElementProcessor(new HelpLink());
+        addElementProcessor(new HiddenField());
+        addElementProcessor(new Import());
+        addElementProcessor(new IncludeObject());
+        addElementProcessor(new IncludeField());
+        addElementProcessor(new InitializeFromCookie());
+        addElementProcessor(new InitializeFromResult());
+        addElementProcessor(new Log());
+        addElementProcessor(new LogLevel());
+        addElementProcessor(new Logon());
+        addElementProcessor(new Logoff());
+        addElementProcessor(new LongFormView());
+        addElementProcessor(new LinkField());
+        addElementProcessor(new ListView());
+        addElementProcessor(new NewActionLink());
+        addElementProcessor(new Mark());
+        addElementProcessor(new Members());
+        addElementProcessor(new Messages());
+        addElementProcessor(new Methods());
+        addElementProcessor(new ObjectLink());
+        addElementProcessor(new PageTitle());
+        addElementProcessor(new Parameter());
+        addElementProcessor(new ParameterName());
+        addElementProcessor(new RadioListField());
+        addElementProcessor(new Redirect());
+        addElementProcessor(new RemoveElement());
+        addElementProcessor(new VersionNumber());
+        addElementProcessor(new RunAction());
+        addElementProcessor(new RestrictAccess());
+        addElementProcessor(new ScopeTag());
+        addElementProcessor(new Secure());
+        addElementProcessor(new SelectedObject());
+        addElementProcessor(new Selector());
+        addElementProcessor(new Services());
+        addElementProcessor(new ShortFormView());
+        addElementProcessor(new ShowDebug());
+        addElementProcessor(new SimpleButton());
+        addElementProcessor(new Specification());
+        addElementProcessor(new TableCell());
+        addElementProcessor(new TableView());
+        addElementProcessor(new TableBuilder());
+        addElementProcessor(new TableEmpty());
+        addElementProcessor(new TableRow());
+        addElementProcessor(new TableHeader());
+        addElementProcessor(new TemplateTag());
+        addElementProcessor(new Title());
+        addElementProcessor(new TitleString());
+        addElementProcessor(new ThrowException());
+        addElementProcessor(new Type());
+        addElementProcessor(new User());
+        addElementProcessor(new Unless());
+        addElementProcessor(new Variable());
+        addElementProcessor(new Warnings());
+        addElementProcessor(new When());
+
+        addElementProcessor(new StartSession());
+        addElementProcessor(new EndSession());
+
+        addElementProcessor(new CookieValue());
+        addElementProcessor(new SetCookie());
+        addElementProcessor(new GetCookie());
+        addElementProcessor(new SetCookieFromField());
+        addElementProcessor(new SetFieldFromCookie());
+        
+        // new, alpha, processors
+        addElementProcessor(new Localization());
+        addElementProcessor(new SetLocalization());
+    }
+
+    public void addElementProcessor(final ElementProcessor action) {
+        swfElementProcessors.put("SWF:" + action.getName().toUpperCase(), action);
+    }
+
+    public void debug(final DebugBuilder debug) {
+        debug.startSection("Recognised tags");
+        final Iterator<String> it2 = new TreeSet<String>(swfElementProcessors.keySet()).iterator();
+        while (it2.hasNext()) {
+            final String name = it2.next();
+            debug.appendln(name.toLowerCase(), swfElementProcessors.get(name));
+        }
+        debug.endSection();
+    }
+
+    public ElementProcessor getFor(final String name) {
+        return swfElementProcessors.get(name);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
new file mode 100644
index 0000000..118ff9b
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
@@ -0,0 +1,324 @@
+/*
+ *  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.processor;
+
+import java.util.Stack;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
+import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HtmlSnippet;
+import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
+import org.apache.isis.viewer.scimpi.dispatcher.view.SwfTag;
+
+public class Request implements PageWriter {
+
+    public class RepeatMarker {
+        private final int index;
+
+        private RepeatMarker(final int index) {
+            this.index = index;
+        }
+
+        public void repeat() {
+            Request.this.index = index;
+        }
+    }
+
+    private static Logger LOG = LoggerFactory.getLogger(Request.class);
+    public static final boolean ENSURE_VARIABLES_EXIST = true;
+    public static final boolean NO_VARIABLE_CHECKING = false;
+    private static Encoder encoder;
+
+    public static Encoder getEncoder() {
+        return encoder;
+    }
+
+    private final RequestContext context;
+    private final Stack<Snippet> snippets;
+    private final Stack<StringBuffer> buffers;
+    private final Stack<BlockContent> blocks;
+    private final ProcessorLookup processors;
+    private int nextFormId;
+    private int index = -1;
+    private final String path;
+
+    public Request(final String path, final RequestContext context, final Encoder encoder, final Stack<Snippet> snippets, final ProcessorLookup processors) {
+        this.path = path;
+        this.context = context;
+        Request.encoder = encoder;
+        this.snippets = snippets;
+        this.processors = processors;
+
+        buffers = new Stack<StringBuffer>();
+        blocks = new Stack<BlockContent>();
+        pushNewBuffer();
+    }
+
+    public void processNextTag() {
+        while (index < snippets.size() - 1) {
+            index++;
+            final Snippet snippet = snippets.get(index);
+            if (snippet instanceof HtmlSnippet) {
+                appendSnippet((HtmlSnippet) snippet);
+            } else {
+                final SwfTag tag = (SwfTag) snippet;
+                final String name = tag.getName();
+                final ElementProcessor processor = processors.getFor(name);
+                process(tag, processor);
+                if (context.isAborted()) {
+                    return;
+                }
+            }
+        }
+    }
+
+    private void appendSnippet(final HtmlSnippet snippet) {
+        String html = snippet.getHtml();
+        try {
+            if (snippet.isContainsVariable()) {
+                html = context.replaceVariables(html);
+            }
+            appendHtml(html);
+        } catch (final TagProcessingException e) {
+            throw e;
+        } catch (final RuntimeException e) {
+            final String replace = "<";
+            final String withReplacement = "&lt;";
+            html = html.replaceAll(replace, withReplacement);
+
+            throw new TagProcessingException("Error while processing html block at " + snippet.errorAt() + " - " + e.getMessage(), html, e);
+        }
+    }
+
+    @Override
+    public void appendAsHtmlEncoded(final String string) {
+        appendHtml(encodeHtml(string));
+        // appendHtml(string);
+    }
+
+    @Override
+    public void appendHtml(final String html) {
+        final StringBuffer buffer = buffers.peek();
+        buffer.append(html);
+    }
+
+    public void appendDebug(final String line) {
+        context.appendDebugTrace(encodeHtml(line));
+    }
+
+    private String encodeHtml(final String text) {
+        return encoder.encoder(text);
+    }
+
+    public void appendTruncated(String text, final int truncateTo) {
+        if (truncateTo > 0 && text.length() > truncateTo) {
+            text = text.substring(0, truncateTo) + "...";
+        }
+        appendAsHtmlEncoded(text);
+    }
+
+    private void process(final SwfTag tag, final ElementProcessor processor) {
+        try {
+            LOG.debug("processing " + processor.getName() + " " + tag);
+            appendDebug("\n" + tag.debug());
+            if (tag.getType() == SwfTag.END) {
+                throw new TagProcessingException(tag.errorAt() + " - end tag mistaken for a start tag", tag.toString());
+            }
+            processor.process(this);
+        } catch (final TagProcessingException e) {
+            throw e;
+        } catch (final RuntimeException e) {
+            throw new TagProcessingException("Error while processing " + tag.getName().toLowerCase() + " element at " + tag.errorAt() + " - " + e.getMessage(), tag.toString(), e);
+        }
+    }
+
+    public void processUtilCloseTag() {
+        final SwfTag tag = getTag();
+        if (tag.getType() == SwfTag.EMPTY) {
+            return;
+        }
+        while (index < snippets.size() - 1) {
+            index++;
+            final Snippet snippet = snippets.get(index);
+            if (snippet instanceof HtmlSnippet) {
+                appendSnippet((HtmlSnippet) snippet);
+            } else {
+                final SwfTag nextTag = (SwfTag) snippet;
+                if (tag.getName().equals(nextTag.getName())) {
+                    if (nextTag.getType() == SwfTag.START) {
+                    } else {
+                        return;
+                    }
+                }
+                final String name = nextTag.getName();
+                if (nextTag.getType() == SwfTag.END && !tag.getName().equals(name)) {
+                    throw new TagProcessingException("Expected " + nextTag.getName().toLowerCase() + " tag but found " + tag.getName().toLowerCase() + " tag at " + nextTag.errorAt(), tag.toString());
+                }
+                final ElementProcessor processor = processors.getFor(name);
+                process(nextTag, processor);
+            }
+        }
+    }
+
+    public void skipUntilClose() {
+        final SwfTag tag = getTag();
+        if (tag.getType() == SwfTag.EMPTY) {
+            if (context.isDebug()) {
+                appendHtml("<!-- " + "skipped " + tag + " -->");
+            }
+            return;
+        }
+        int depth = 1;
+        while (index < snippets.size() - 1) {
+            index++;
+            final Snippet snippet = snippets.get(index);
+            if (snippet instanceof SwfTag) {
+                final SwfTag nextTag = (SwfTag) snippet;
+                if (tag.getName().equals(nextTag.getName())) {
+                    if (nextTag.getType() == SwfTag.START) {
+                        depth++;
+                    } else {
+                        depth--;
+                        if (depth == 0) {
+                            return;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public void closeEmpty() {
+        final SwfTag tag = getTag();
+        if (tag.getType() == SwfTag.EMPTY) {
+            return;
+        }
+        if (index < snippets.size()) {
+            final Snippet snippet = snippets.get(index);
+            if (snippet instanceof SwfTag) {
+                final SwfTag nextTag = (SwfTag) snippet;
+                if (nextTag.getType() == SwfTag.EMPTY) {
+                    return;
+                }
+            }
+        }
+        throw new ScimpiException("Empty tag not closed");
+    }
+
+    public void pushNewBuffer() {
+        final StringBuffer buffer = new StringBuffer();
+        buffers.push(buffer);
+    }
+
+    public String popBuffer() {
+        final String content = buffers.pop().toString();
+        return content;
+    }
+
+    public SwfTag getTag() {
+        return (SwfTag) snippets.get(index);
+    }
+
+    public RequestContext getContext() {
+        return context;
+    }
+
+    // TODO rename to pushBlock()
+    public void setBlockContent(final BlockContent content) {
+        blocks.add(content);
+    }
+
+    public BlockContent popBlockContent() {
+        return blocks.pop();
+    }
+
+    public BlockContent getBlockContent() {
+        return blocks.peek();
+    }
+
+    public String getViewPath() {
+        return path;
+    }
+
+    public String nextFormId() {
+        return String.valueOf(nextFormId++);
+    }
+
+    public String getOptionalProperty(final String name, final String defaultValue) {
+        return getOptionalProperty(name, defaultValue, true);
+    }
+
+    public String getOptionalProperty(final String name, final String defaultValue, final boolean ensureVariablesExists) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.getOptionalProperty(name, defaultValue, ensureVariablesExists);
+    }
+
+    public String getOptionalProperty(final String name) {
+        return getOptionalProperty(name, true);
+    }
+
+    public String getOptionalProperty(final String name, final boolean ensureVariablesExists) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.getOptionalProperty(name, ensureVariablesExists);
+    }
+
+    public Attributes getAttributes() {
+        return getTag().getAttributes();
+    }
+
+    public String getRequiredProperty(final String name) {
+        return getRequiredProperty(name, true);
+    }
+
+    public String getRequiredProperty(final String name, final boolean ensureVariablesExists) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.getRequiredProperty(name, ensureVariablesExists);
+    }
+
+    public boolean isRequested(final String name) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.isRequested(name);
+    }
+
+    public boolean isRequested(final String name, final boolean defaultValue) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.isRequested(name, defaultValue);
+    }
+
+    public boolean isPropertySet(final String name) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.isPropertySet(name);
+    }
+
+    public boolean isPropertySpecified(final String name) {
+        final Attributes attributes = getTag().getAttributes();
+        return attributes.isPropertySpecified(name);
+    }
+
+    public RepeatMarker createMarker() {
+        return new RepeatMarker(index);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java
new file mode 100644
index 0000000..8b7a2d5
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/SimpleEncoder.java
@@ -0,0 +1,32 @@
+/*
+ *  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.processor;
+
+import org.apache.commons.lang.StringEscapeUtils;
+
+public class SimpleEncoder implements Encoder {
+
+    @Override
+    public String encoder(final String text) {
+        return StringEscapeUtils.escapeHtml(text);
+        // text.replace("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">",
+        // "&gt;").replace("\"", "&quot;");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
new file mode 100644
index 0000000..d9a8a60
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
@@ -0,0 +1,59 @@
+/*
+ *  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.processor;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+
+public class TagProcessingException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+    private String context;
+
+    public TagProcessingException() {
+        super();
+    }
+
+    public TagProcessingException(final String message, final String context, final Throwable cause) {
+        super(message, cause);
+        this.context = context;
+    }
+
+    public TagProcessingException(final String message, final String context) {
+        super(message);
+        this.context = context;
+    }
+
+    public TagProcessingException(final Throwable cause) {
+        super(cause);
+    }
+
+    public String getContext() {
+        return context;
+    }
+
+    @Override
+    public String getMessage() {
+        return super.getMessage() + "\n" + getContext();
+    }
+
+    @Override
+    public String getHtmlMessage() {
+        return super.getMessage() + "<pre>" + getContext() + "</pre>";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
new file mode 100644
index 0000000..a6ae574
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
@@ -0,0 +1,154 @@
+/*
+ *  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.util;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.services.ServiceUtil;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.session.IsisSession;
+import org.apache.isis.viewer.scimpi.dispatcher.DispatchException;
+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;
+
+public class MethodsUtils {
+    public static final String SERVICE_PREFIX = "service:";
+
+    public static Consent canRunMethod(final ObjectAdapter target, final ObjectAction action, final ObjectAdapter[] parameters) {
+        final Consent consent = action.isProposedArgumentSetValid(target, parameters == null ? new ObjectAdapter[0] : parameters);
+        return consent;
+    }
+
+    public static boolean runMethod(final RequestContext context, final ObjectAction action, final ObjectAdapter target, final ObjectAdapter[] parameters, String variable, Scope scope) {
+        scope = scope == null ? Scope.REQUEST : scope;
+        variable = variable == null ? RequestContext.RESULT : variable;
+
+        final ObjectAdapter result = action.execute(target, parameters == null ? new ObjectAdapter[0] : parameters);
+        if (result == null) {
+            return false;
+        } else {
+            final String mappedId = context.mapObject(result, scope);
+            context.addVariable(variable, mappedId, scope);
+            // context.addVariable(variable + "_type",
+            // action.getFacet(TypeOfFacet.class), scope);
+            return true;
+        }
+    }
+
+    public static boolean runMethod(final RequestContext context, final ObjectAction action, final ObjectAdapter target, final ObjectAdapter[] parameters) {
+        return runMethod(context, action, target, parameters, null, null);
+    }
+
+    public static ObjectAction findAction(final ObjectAdapter object, final String methodName) {
+        if (object == null) {
+            throw new ScimpiException("Object not specified when looking for " + methodName);
+        }
+
+        final List<ObjectAction> actions = object.getSpecification().getObjectActions(Contributed.INCLUDED);
+        final ObjectAction action = findAction(actions, methodName);
+        /*
+         * if (action == null) { actions =
+         * object.getSpecification().getServiceActionsFor(ObjectActionType.USER,
+         * ObjectActionType.EXPLORATION, ObjectActionType.DEBUG); action =
+         * findAction(actions, methodName); }
+         */
+        if (action == null) {
+            throw new DispatchException("Failed to find action " + methodName + " on " + object);
+        }
+        return action;
+    }
+
+    private static ObjectAction findAction(final List<ObjectAction> actions, final String methodName) {
+        for (int i = 0; i < actions.size(); i++) {
+            final ObjectAction objectAction = actions.get(i);
+            if (objectAction.getId().equals(methodName)) {
+                return objectAction;
+            }
+        }
+        return null;
+    }
+
+    public static ObjectAdapter findObject(final RequestContext context, String objectId) {
+        if (objectId == null) {
+            objectId = context.getStringVariable(RequestContext.RESULT);
+        }
+
+        if (objectId != null && objectId.startsWith(SERVICE_PREFIX)) {
+            final String serviceId = objectId.substring(SERVICE_PREFIX.length());
+            final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
+            for (final ObjectAdapter serviceAdapter : serviceAdapters) {
+                final Object service = serviceAdapter.getObject();
+                if (ServiceUtil.id(service).equals(serviceId.trim())) {
+                    final ObjectAdapter adapter = getAdapterManager().getAdapterFor(service);
+                    return adapter;
+                }
+            }
+            throw new DispatchException("Failed to find service " + serviceId);
+        } else {
+            return context.getMappedObject(objectId);
+        }
+    }
+
+    public static boolean isVisible(final ObjectAdapter object, final ObjectAction action, Where where) {
+        return action.isVisible(getAuthenticationSession(), object, where).isAllowed();
+    }
+
+    public static String isUsable(final ObjectAdapter object, final ObjectAction action, Where where) {
+        final Consent usable = action.isUsable(getAuthenticationSession(), object, where);
+        final boolean isUsable = getSession() != null && usable.isAllowed();
+        return isUsable ? null : usable.getReason();
+    }
+
+    public static boolean isVisibleAndUsable(final ObjectAdapter object, final ObjectAction action, Where where) {
+        AuthenticationSession authenticatedSession = getAuthenticationSession();
+        final boolean isVisible = action.isVisible(authenticatedSession, object, where).isAllowed();
+        final boolean isUsable = getSession() != null && action.isUsable(authenticatedSession, object, where).isAllowed();
+        final boolean isVisibleAndUsable = isVisible && isUsable;
+        return isVisibleAndUsable;
+    }
+
+    private static AuthenticationSession getAuthenticationSession() {
+        return IsisContext.getAuthenticationSession();
+    }
+
+    private static IsisSession getSession() {
+        return IsisContext.getSession();
+    }
+
+    private static AdapterManager getAdapterManager() {
+        return getPersistenceSession().getAdapterManager();
+    }
+
+    private static PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
new file mode 100644
index 0000000..477828d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
@@ -0,0 +1,72 @@
+/*
+ *  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.view;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class HelpLink extends AbstractElementProcessor {
+
+    private static String site;
+    private static String suffix;
+
+    public static void append(final Request request, final String description, final String helpReference) {
+        request.appendHtml(createHelpSegment(description, helpReference));
+    }
+
+    public static String createHelpSegment(final String description, final String helpReference) {
+        if (site == null) {
+            site = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-site", "/help/");
+        }
+        if (suffix == null) {
+            suffix = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-suffix", "shtml");
+            if (suffix == null || suffix.equals("")) {
+                suffix = "";
+            } else {
+                suffix = "." + suffix;
+            }
+        }
+
+        if (helpReference == null || helpReference.equals("No help available")) {
+            return "";
+        } else {
+            final String elementClass = "help-link";
+            final String link = site + helpReference + suffix;
+            final String linkText = "Help";
+            final String target = "scimpi-help";
+            final String titleSection = description == null ? "" : ("\" title=\"" + description);
+            return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\"" + target + titleSection + "\"><img src=\"/images/help.png\" alt=\"" + linkText + "\" /></a>";
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "help";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String description = null;
+        final String helpReference = request.getRequiredProperty("ref");
+        append(request, description, helpReference);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
new file mode 100644
index 0000000..2f2a9b7
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
@@ -0,0 +1,150 @@
+/*
+ *  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.view;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class History extends AbstractElementProcessor {
+
+    private static final String _HISTORY = "_history";
+
+    static class Crumb {
+        String name;
+        String link;
+    }
+
+    static class Crumbs implements Serializable {
+        private static final long serialVersionUID = 1L;
+        private static final int MAXIMUM_SIZE = 10;
+        private final List<Crumb> crumbs = new ArrayList<Crumb>();
+
+        public void add(final String name, final String link) {
+            for (final Crumb crumb : crumbs) {
+                if (crumb.link.equals(link)) {
+                    crumbs.remove(crumb);
+                    crumbs.add(crumb);
+                    return;
+                }
+            }
+
+            final Crumb crumb = new Crumb();
+            crumb.name = name;
+            crumb.link = link;
+            crumbs.add(crumb);
+
+            if (crumbs.size() > MAXIMUM_SIZE) {
+                crumbs.remove(0);
+            }
+        }
+
+        public void clear() {
+            crumbs.clear();
+        }
+
+        public boolean isEmpty() {
+            return crumbs.size() == 0;
+        }
+
+        public int size() {
+            return crumbs.size();
+        }
+
+        public Iterable<Crumb> iterator() {
+            return crumbs;
+        }
+
+    }
+
+    @Override
+    public String getName() {
+        return "history";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String action = request.getOptionalProperty("action", "display");
+        final Crumbs crumbs = getCrumbs(request);
+        if (action.equals("display") && crumbs != null) {
+            write(crumbs, request);
+        } else if (action.equals("link")) {
+            final String name = request.getRequiredProperty(NAME);
+            final String link = request.getRequiredProperty(LINK_VIEW);
+            crumbs.add(name, link);
+        } else if (action.equals("object")) {
+            final String id = request.getOptionalProperty(OBJECT);
+            final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), id);
+            final String name = object.titleString();
+            String link = request.getRequiredProperty(LINK_VIEW);
+            link += "?_result=" + id;
+            crumbs.add(name, link);
+        } else if (action.equals("return")) {
+
+        } else if (action.equals("clear")) {
+            crumbs.clear();
+        }
+
+    }
+
+    public void write(final Crumbs crumbs, final Request request) {
+        if (crumbs.isEmpty()) {
+            return;
+        }
+
+        request.appendHtml("<div id=\"history\">");
+        int i = 0;
+        final int length = crumbs.size();
+        for (final Crumb crumb : crumbs.iterator()) {
+            final String link = crumb.link;
+            if (i > 0) {
+                request.appendHtml("<span class=\"separator\"> | </span>");
+            }
+            if (i == length - 1 || link == null) {
+                request.appendHtml("<span class=\"disabled\">");
+                request.appendHtml(crumb.name);
+                request.appendHtml("</span>");
+            } else {
+                request.appendHtml("<a class=\"linked\" href=\"" + link + "\">");
+                request.appendHtml(crumb.name);
+                request.appendHtml("</a>");
+            }
+            i++;
+        }
+        request.appendHtml("</div>");
+    }
+
+    private Crumbs getCrumbs(final Request request) {
+        final RequestContext context = request.getContext();
+        Crumbs crumbs = (Crumbs) context.getVariable(_HISTORY);
+        if (crumbs == null) {
+            crumbs = new Crumbs();
+            context.addVariable(_HISTORY, crumbs, Scope.SESSION);
+        }
+        return crumbs;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
new file mode 100644
index 0000000..f1807df
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
@@ -0,0 +1,51 @@
+/*
+ *  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.view;
+
+public class HtmlSnippet implements Snippet {
+    private final StringBuffer html = new StringBuffer();
+    private boolean containsVariable;
+    private final String lineNumbers;
+    private final String path;
+
+    public HtmlSnippet(final String lineNumbers, final String path) {
+        this.lineNumbers = lineNumbers;
+        this.path = path;
+    }
+
+    public void append(final String html) {
+        this.html.append(html);
+        containsVariable |= html.indexOf("${") >= 0;
+    }
+
+    @Override
+    public String getHtml() {
+        return html.toString();
+    }
+
+    public boolean isContainsVariable() {
+        return containsVariable;
+    }
+
+    @Override
+    public String errorAt() {
+        return path + ":" + lineNumbers;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
new file mode 100644
index 0000000..b8a7b3e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
@@ -0,0 +1,27 @@
+/*
+ *  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.view;
+
+public interface Snippet {
+
+    String getHtml();
+
+    String errorAt();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
new file mode 100644
index 0000000..6b097bb
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
@@ -0,0 +1,90 @@
+/*
+ *  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.view;
+
+import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
+
+public class SwfTag implements Snippet {
+
+    public static final int END = 0;
+    public static final int EMPTY = 1;
+    public static final int START = 2;
+    private final String tagName;
+    private final int type;
+    private final Attributes attributes;
+    private final String lineNumbers;
+    private final String path;
+
+    public SwfTag(final String tagName, final Attributes attributes, final int type, final String lineNumbers, final String path) {
+        this.tagName = tagName;
+        this.attributes = attributes;
+        this.type = type;
+        this.lineNumbers = lineNumbers;
+        this.path = path;
+    }
+
+    @Override
+    public String getHtml() {
+        return tagName;
+    }
+    
+    public String getPath() { 
+        return path; 
+    } 
+
+    public int getType() {
+        return type;
+    }
+
+    public String getName() {
+        return tagName;
+    }
+
+    public Attributes getAttributes() {
+        return attributes;
+    }
+
+    @Override
+    public String errorAt() {
+        return path + ":" + lineNumbers;
+    }
+
+    public String debug() {
+        return path + ":" + lineNumbers + " - " + getAttributes();
+    }
+
+    @Override
+    public String toString() {
+        String t = null;
+        switch (type) {
+        case EMPTY:
+            t = "empty";
+            break;
+        case START:
+            t = "start";
+            break;
+        case END:
+            t = "end";
+            break;
+        }
+        return "SwfTag[name=" + tagName + ",path=" + path + ",line=" + lineNumbers + ",type=" + t + "]";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java
new file mode 100644
index 0000000..6b054b1
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/VersionNumber.java
@@ -0,0 +1,70 @@
+/*
+ *  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.view;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class VersionNumber extends AbstractElementProcessor {
+
+    private static final String MARKER = "Implementation-Build: ";
+    private static final String FILE = "/META-INF/MANIFEST.MF";
+    private String version;
+
+    @Override
+    public String getName() {
+        return "version-number";
+    }
+
+    @Override
+    public void process(final Request request) {
+        if (version == null) {
+            version = "0000"; // default revision number
+            loadRevisonNumber(request.getContext());
+        }
+        request.appendHtml(version);
+    }
+
+    private void loadRevisonNumber(final RequestContext context) {
+        BufferedReader reader;
+        try {
+            String file = FILE;
+
+            file = context.findFile(FILE);
+            reader = new BufferedReader(new InputStreamReader(context.openStream(file)));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                if (line.startsWith(MARKER)) {
+                    version = line.substring(MARKER.length());
+                    break;
+                }
+            }
+            reader.close();
+        } catch (final IOException e) {
+            throw new ScimpiException(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
new file mode 100644
index 0000000..740de00
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
@@ -0,0 +1,237 @@
+/*
+ *  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.view.action;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
+
+public class ActionButton extends AbstractElementProcessor {
+    private static final Logger LOG = LoggerFactory.getLogger(ActionButton.class);
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final static Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final String methodName = request.getRequiredProperty(METHOD);
+        final String forwardResultTo = request.getOptionalProperty(VIEW);
+        final String forwardVoidTo = request.getOptionalProperty(VOID);
+        final String forwardErrorTo = request.getOptionalProperty(ERROR);
+        final String variable = request.getOptionalProperty(RESULT_NAME);
+        final String scope = request.getOptionalProperty(SCOPE);
+        final String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
+        String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        final String idName = request.getOptionalProperty(ID, methodName);
+        final String className = request.getOptionalProperty(CLASS);
+        final boolean showMessage = request.isRequested(SHOW_MESSAGE, false);
+        final String completionMessage = request.getOptionalProperty(MESSAGE);
+
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+        final String version = request.getContext().mapVersion(object);
+        final ObjectAction action = MethodsUtils.findAction(object, methodName);
+
+        final ActionContent parameterBlock = new ActionContent(action);
+        request.setBlockContent(parameterBlock);
+        request.processUtilCloseTag();
+        final String[] parameters = parameterBlock.getParameters();
+        final ObjectAdapter[] objectParameters;
+        
+        final ObjectAdapter target;
+        if (false /*action.isContributed()*/) {
+//            objectParameters= null;
+//            System.arraycopy(parameters, 0, parameters, 1, parameters.length - 1);
+//            parameters[0] = request.getContext().mapObject(object, Scope.REQUEST);
+//            target =  action.realTarget(object);
+//            if (!action.hasReturn() && resultOverride == null) {
+//                resultOverride = parameters[0];
+//            }
+        } else {
+            objectParameters = new ObjectAdapter[parameters.length];
+            target = object;
+            int i = 0;
+            for (final ObjectActionParameter spec : action.getParameters()) {
+                final ObjectSpecification type = spec.getSpecification();
+                if (parameters[i] == null) {
+                    objectParameters[i] = null;
+                } else if (type.getFacet(ParseableFacet.class) != null) {
+                    final ParseableFacet facet = type.getFacet(ParseableFacet.class);
+                    Localization localization = IsisContext.getLocalization(); 
+                    objectParameters[i] = facet.parseTextEntry(null, parameters[i], localization); 
+                } else {
+                    objectParameters[i] = MethodsUtils.findObject(request.getContext(), parameters[i]);
+                }
+                i++;
+            }
+        }
+
+        if (MethodsUtils.isVisibleAndUsable(object, action, where) && MethodsUtils.canRunMethod(object, action, objectParameters).isAllowed()) {
+            // TODO use the form creation mechanism as used in ActionForm
+            write(request, target, action, parameters, version, forwardResultTo, forwardVoidTo, forwardErrorTo, variable, scope, buttonTitle, completionMessage, resultOverride, idName, className);
+        }
+
+        if (showMessage) {
+            final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object, where);
+            if (usable.isVetoed()) {
+                final String notUsable = usable.getReason();
+                if (notUsable != null) {
+                    String title = buttonTitle == null ? action.getName() : buttonTitle;
+                    disabledButton(request, title, notUsable, idName, className);
+                }
+            } else {
+                final Consent valid = action.isProposedArgumentSetValid(object, objectParameters);
+                final String notValid = valid.getReason();
+                if (notValid != null) {
+                    String title = buttonTitle == null ? action.getName() : buttonTitle;
+                    disabledButton(request, title, notValid, idName, className);
+                }
+            }
+        }
+
+        request.popBlockContent();
+    }
+
+    private void disabledButton(final Request request, final String buttonTitle, String message, String id, String className) {
+        if (className == null) {
+            className = "access";
+        }
+        request.appendHtml("<div id=\"" + id + "\" class=\"" + className + " disabled-form\">");
+        request.appendHtml("<div class=\"button disabled\" title=\"");
+        request.appendAsHtmlEncoded(message);
+        request.appendHtml("\" >" + buttonTitle);
+        request.appendHtml("</div>");
+        request.appendHtml("</div>");
+    }
+
+    public static void write(
+            final Request request,
+            final ObjectAdapter object,
+            final ObjectAction action,
+            final String[] parameters,
+            final String version,
+            String forwardResultTo,
+            String forwardVoidTo,
+            String forwardErrorTo,
+            final String variable,
+            final String scope,
+            String buttonTitle,
+            final String completionMessage,
+            final String resultOverride,
+            final String idName,
+            final String className) {
+        final RequestContext context = request.getContext();
+
+        buttonTitle = buttonTitle != null ? buttonTitle : action.getName();
+
+        if (action.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+            LOG.info("action not visible " + action.getName());
+            return;
+        }
+        final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object, where);
+        if (usable.isVetoed()) {
+            LOG.info("action not available: " + usable.getReason());
+            return;
+        }
+
+        /*
+         * 
+         * TODO this mechanism fails as it tries to process tags - which we dont
+         * need! Also it calls action 'edit' (not 'action'). Field[] fields =
+         * new Field[0]; HiddenField[] hiddenFields = new HiddenField[] { new
+         * HiddenField("service", serviceId), new HiddenField("method",
+         * methodName), new HiddenField("view", forwardToView), variable == null
+         * ? null : new HiddenField("variable", variable), };
+         * Form.createForm(request, buttonTitle, fields, hiddenFields, false);
+         */
+
+        final String objectId = context.mapObject(object, Scope.INTERACTION);
+        final String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
+        final String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
+        request.appendHtml("\n<form " + idSegment + classSegment + " action=\"action.app\" method=\"post\">\n");
+        if (objectId == null) {
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + context.getVariable(RequestContext.RESULT) + "\" />\n");
+        } else {
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" +  StringEscapeUtils.escapeHtml(objectId) + "\" />\n");
+        }
+        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VERSION + "\" value=\"" + version + "\" />\n");
+        if (scope != null) {
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + SCOPE + "\" value=\"" + scope + "\" />\n");
+        }
+        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + METHOD + "\" value=\"" + action.getId() + "\" />\n");
+        if (forwardResultTo != null) {
+            forwardResultTo = context.fullFilePath(forwardResultTo);
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VIEW + "\" value=\"" + forwardResultTo + "\" />\n");
+        }
+        if (forwardErrorTo == null) {
+            forwardErrorTo = request.getContext().getResourceFile();
+        }
+        forwardErrorTo = context.fullFilePath(forwardErrorTo);
+        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + ERROR + "\" value=\"" + forwardErrorTo + "\" />\n");
+        if (forwardVoidTo == null) {
+            forwardVoidTo = request.getContext().getResourceFile();
+        }
+        forwardVoidTo = context.fullFilePath(forwardVoidTo);
+        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VOID + "\" value=\"" + forwardVoidTo + "\" />\n");
+        if (variable != null) {
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_NAME + "\" value=\"" + variable + "\" />\n");
+        }
+        if (resultOverride != null) {
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_OVERRIDE + "\" value=\"" + resultOverride + "\" />\n");
+        }
+        if (completionMessage != null) {
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + MESSAGE + "\" value=\"" + completionMessage + "\" />\n");
+        }
+
+        for (int i = 0; i < parameters.length; i++) {
+            request.appendHtml("  <input type=\"hidden\" name=\"param" + (i + 1) + "\" value=\"" + parameters[i] + "\" />\n");
+        }
+        request.appendHtml(request.getContext().interactionFields());
+        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"" + buttonTitle + "\" name=\"execute\" title=\"" + action.getDescription() + "\" />");
+        HelpLink.append(request, action.getDescription(), action.getHelp());
+        request.appendHtml("\n</form>\n");
+    }
+
+    @Override
+    public String getName() {
+        return "action-button";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
new file mode 100644
index 0000000..2466726
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
@@ -0,0 +1,77 @@
+/*
+ *  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.view.action;
+
+import java.util.List;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ActionContent implements BlockContent {
+    private final ObjectAction action;
+    private final String[] parameters;
+    private int next;
+
+    public ActionContent(final ObjectAction action) {
+        this.action = action;
+        this.parameters = new String[action.getParameterCount()];
+    }
+
+    public void setParameter(final String field, final String value) {
+        int index;
+        if (field == null) {
+            index = next++;
+        } else {
+            index = Integer.valueOf(field).intValue() - 1;
+        }
+        if (index < 0 || index >= parameters.length) {
+            throw new ScimpiException("Parameter numbers should be between 1 and " + parameters.length + ": " + index);
+        }
+        parameters[index] = value;
+    }
+
+    public ObjectAdapter[] getParameters(final Request request) {
+        final ObjectAdapter[] params = new ObjectAdapter[parameters.length];
+        final List<ObjectActionParameter> pars = action.getParameters();
+        for (int i = 0; i < parameters.length; i++) {
+            final ObjectSpecification typ = pars.get(i).getSpecification();
+            if (typ.getFacet(ParseableFacet.class) != null) {
+                final ParseableFacet facet = typ.getFacet(ParseableFacet.class);
+                Localization localization = IsisContext.getLocalization(); 
+                params[i] = facet.parseTextEntry(null, parameters[i], localization);            
+            } else {
+                params[i] = request.getContext().getMappedObject(parameters[i]);
+            }
+        }
+        return params;
+    }
+
+    public String[] getParameters() {
+        return parameters;
+    }
+}


[06/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
new file mode 100644
index 0000000..020377d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
@@ -0,0 +1,136 @@
+/*
+ *  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.view.debug;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldValue;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+
+
+public class DebugObjectView extends AbstractObjectProcessor {
+
+    @Override
+    public void process(final Request request, final ObjectAdapter object) {
+        final String classString = " class=\"" + request.getOptionalProperty(CLASS, "form debug") + "\"";
+        final String objectLink = request.getOptionalProperty(OBJECT + "-" + LINK_VIEW, request.getViewPath());
+        // final String collectionLink = request.getOptionalProperty(COLLECTION + "-" + LINK_VIEW, request.getViewPath());
+        final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
+        final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
+        final boolean showIcons = request.isRequested(SHOW_ICON, true);
+
+        ObjectSpecification specification = object.getSpecification();
+
+        request.appendHtml("<div" + classString + ">");
+        request.appendHtml("<div class=\"title\">");
+        request.appendAsHtmlEncoded(specification.getSingularName() + " - " + specification.getFullIdentifier());
+        request.appendHtml("</div>");
+
+        Version version = object.getVersion();
+        request.appendHtml("<div class=\"version\">");
+        request.appendAsHtmlEncoded("#" + version.sequence() + " - " + version.getUser() + " (" + version.getTime() + ")" );
+        request.appendHtml("</div>");
+
+        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.ALL);
+
+        int row = 1;
+        for (int i = 0; i < fields.size(); i++) {
+            final ObjectAssociation field = fields.get(i);
+            /*
+             * if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) { continue; }
+             */
+            String cls;
+            if (row++ % 2 == 1) {
+                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
+            } else {
+                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
+            }
+            request.appendHtml("<div " + cls + "><span class=\"label\">");
+            request.appendAsHtmlEncoded(field.getName());
+            request.appendHtml(":</span>");
+            
+            final boolean isNotParseable =
+                !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
+            LinkedObject linkedObject = null;
+            if (isNotParseable) {
+     //           linkedObject = new LinkedObject(field.isOneToManyAssociation() ? collectionLink : objectLink);
+                linkedObject = new LinkedObject(objectLink);
+            }
+            addField(request, object, field, linkedObject, showIcons);
+            
+            if (field.isOneToManyAssociation()) {
+                Collection collection = (Collection) field.get(object).getObject();
+                if (collection.size() == 0) {
+                    request.appendHtml("[empty]");
+                } else {
+                    // request.appendHtml(collection.size() + " elements");
+                   
+                    request.appendHtml("<ol>");
+                    
+                   for (Object element : collection) {
+                       ObjectAdapter adapterFor = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(element);
+                       IsisContext.getPersistenceSession().resolveImmediately(adapterFor);
+
+                       String id = request.getContext().mapObject(adapterFor, linkedObject.getScope(), Scope.INTERACTION);
+
+                       request.appendHtml("<li class=\"element\">");
+                       request.appendHtml("<a href=\"" + linkedObject.getForwardView() + "?" + linkedObject.getVariable() + "="
+                               + id + request.getContext().encodedInteractionParameters() + "\">");
+                       request.appendHtml(element.toString());
+                       request.appendHtml("</a></li>");
+                   }
+                   request.appendHtml("</ol>");
+                }
+            } else {
+                FieldValue.write(request, object, field, linkedObject, "value", showIcons, 0);
+            }
+
+            
+            
+            request.appendHtml("</div>");
+        }
+        request.appendHtml("</div>");
+    }
+
+    protected void addField(
+            final Request request,
+            final ObjectAdapter object,
+            final ObjectAssociation field,
+            final LinkedObject linkedObject,
+            final boolean showIcons) {
+     }
+
+    @Override
+    public String getName() {
+        return "debug-object";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
new file mode 100644
index 0000000..795d272
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
@@ -0,0 +1,53 @@
+/*
+ *  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.view.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class DebuggerLink extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            request.skipUntilClose();
+            return;
+        }
+
+        final RequestContext context = request.getContext();
+        final Object result = context.getVariable(RequestContext.RESULT);
+        request.appendHtml("<div class=\"debug\">");
+        request.appendHtml("<a class=\"debug-link\" href=\"/debug/debug.shtml\" target=\"debug\" title=\"debug\" >...</a>");
+        if (result != null) {
+            request.appendHtml(" <a href=\"/debug/object.shtml?_result=" + result + "\" target=\"debug\"  title=\"debug instance\">...</a>");
+        }
+        request.appendHtml(" <span class=\"debug-link\" onclick=\"$('#page-debug').toggle()\" alt=\"show/hide debug details\">...</span>");
+        request.appendHtml("</div>");
+
+        request.processUtilCloseTag();
+    }
+
+    @Override
+    public String getName() {
+        return "debugger";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
new file mode 100644
index 0000000..037812e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
@@ -0,0 +1,81 @@
+/*
+ *  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.view.debug;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugHtmlString;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Diagnostics extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            return;
+        }
+
+        final String type = request.getOptionalProperty(TYPE, "page");
+        final boolean isForced = request.isRequested("force");
+        if (isForced || request.getContext().showDebugData()) {
+            request.appendHtml("<div class=\"debug\">");
+            if ("page".equals(type)) {
+                request.appendHtml("<pre>");
+                final RequestContext context = request.getContext();
+                request.appendHtml("URI:  " + context.getUri());
+                request.appendHtml("\n");
+                request.appendHtml("File: " + context.fullFilePath(context.getResourceFile()));
+                final String result = (String) request.getContext().getVariable(RequestContext.RESULT);
+                if (result != null) {
+                    request.appendHtml("\n");
+                    request.appendHtml("Object: " + result);
+                }
+                request.appendHtml("</pre>");
+            } else if ("session".equals(type)) {
+                request.appendHtml("<pre>");
+                final AuthenticationSession session = IsisContext.getAuthenticationSession();
+                request.appendHtml("Session:  " + session.getUserName() + " " + session.getRoles());
+                request.appendHtml("</pre>");
+            } else if ("variables".equals(type)) {
+                final RequestContext context = request.getContext();
+                final DebugHtmlString debug = new DebugHtmlString();
+                debug.appendln("", "");
+                context.append(debug, "variables");
+                debug.close();
+                request.appendHtml(debug.toString());
+            } else if ("processing".equals(type)) {
+                request.appendHtml("<pre>");
+                request.appendHtml(request.getContext().getDebugTrace());
+                request.appendHtml("</pre>");
+            } else {
+                request.appendHtml("<i>No such type " + type + "</i>");
+            }
+            request.appendHtml("</div>");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "diagnostics";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
new file mode 100644
index 0000000..92db889
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
@@ -0,0 +1,46 @@
+/*
+ *  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.view.debug;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Log extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        String name = request.getRequiredProperty(NAME);
+        Logger logger = LoggerFactory.getLogger(name);
+        
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        final String message = request.popBuffer();
+        logger.info(message);
+    }
+
+    @Override
+    public String getName() {
+        return "log";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
new file mode 100644
index 0000000..66e2d6d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
@@ -0,0 +1,55 @@
+/*
+ *  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.view.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class LogLevel extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+
+        String view = request.getOptionalProperty(VIEW, request.getViewPath());
+        view = request.getContext().fullFilePath(view);
+        final org.apache.log4j.Level level = org.apache.log4j.LogManager.getRootLogger().getLevel();
+        final boolean showSelector = request.isRequested(SHOW_SELECT, true);
+        if (showSelector) {
+            request.appendHtml("<form action=\"log.app\" type=\"post\" >");
+            request.appendHtml("<input type=\"hidden\" name=\"view\" value=\"" + view + "\" />");
+            request.appendHtml("<select name=\"level\">");
+            for (final org.apache.log4j.Level l : new org.apache.log4j.Level[] { org.apache.log4j.Level.OFF, org.apache.log4j.Level.FATAL, org.apache.log4j.Level.ERROR, org.apache.log4j.Level.WARN, org.apache.log4j.Level.INFO, org.apache.log4j.Level.DEBUG, org.apache.log4j.Level.TRACE }) {
+                final String settings = level + "\"" + (level == l ? " selected=\"selected\" " : "");
+                request.appendHtml("<option " + settings + ">" + l + "</option>");
+            }
+            request.appendHtml("<input type=\"submit\" value=\"Change Level\" />");
+            request.appendHtml("</select>");
+            request.appendHtml("</form>");
+        } else {
+            request.appendHtml(level.toString());
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "log-level";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
new file mode 100644
index 0000000..54ff196
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
@@ -0,0 +1,109 @@
+/*
+ *  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.view.debug;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Members extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public String getName() {
+        return "members";
+    }
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            return;
+        }
+
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getOptionalProperty(FIELD);
+        request.appendHtml("<pre class=\"debug\">");
+        try {
+            ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+            ObjectAssociation field = null;
+            if (fieldName != null) {
+                field = object.getSpecification().getAssociation(fieldName);
+                if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+                    throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+                }
+                object = field.get(object);
+            }
+            request.processUtilCloseTag();
+
+            final ObjectSpecification specification = field == null ? object.getSpecification() : field.getSpecification();
+
+            request.appendHtml(specification.getSingularName() + " (" + specification.getFullIdentifier() + ") \n");
+            final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
+            for (final ObjectAssociation fld : fields) {
+                if (!fld.isAlwaysHidden()) {
+                    request.appendHtml("   " + fld.getId() + " - '" + fld.getName() + "' -> " + fld.getSpecification().getSingularName() + (fld.isOneToManyAssociation() ? " (collection of)" : "") + "\n");
+                }
+            }
+            request.appendHtml("   --------------\n");
+            final List<ObjectAction> actions = specification.getObjectActions(
+                    ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            ;
+            for (final ObjectAction action : actions) {
+                request.appendHtml("   " + action.getId() + " (");
+                boolean first = true;
+                for (final ObjectActionParameter parameter : action.getParameters()) {
+                    if (!first) {
+                        request.appendHtml(", ");
+                    }
+                    request.appendHtml(parameter.getSpecification().getSingularName());
+                    first = false;
+                }
+                request.appendHtml(")" + " - '" + action.getName() + "'");
+                if (action.getSpecification() != null) {
+                    request.appendHtml(" -> " + action.getSpecification().getSingularName() + ")");
+                }
+                request.appendHtml("\n");
+            }
+        } catch (final ScimpiException e) {
+            request.appendHtml("Debug failed: " + e.getMessage());
+        }
+        request.appendHtml("</pre>");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
new file mode 100644
index 0000000..895f9a6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
@@ -0,0 +1,41 @@
+/*
+ *  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.view.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ShowDebug extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            request.skipUntilClose();
+        } else {
+            request.processUtilCloseTag();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "show-debug";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
new file mode 100644
index 0000000..0974fe4
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
@@ -0,0 +1,119 @@
+/*
+ *  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.view.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+
+public class Specification extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
+        if (context.isDebugDisabled()) {
+            return;
+        }
+
+        if (request.isRequested("always") || context.getDebug() == RequestContext.Debug.ON) {
+            request.appendHtml("<div class=\"debug\">");
+            request.appendHtml("<pre>");
+
+            final String id = request.getOptionalProperty("object");
+            final ObjectAdapter object = context.getMappedObjectOrResult(id);
+            final ObjectSpecification specification = object.getSpecification();
+            String type = request.getOptionalProperty(TYPE, "details");
+
+            if (type.equals("graph")) {
+                specificationGraph(request, specification, null, new ArrayList<ObjectSpecification>(), 0);
+            } else if (type.equals("details")) {
+                specificationDetails(request, specification);
+            } else {
+                request.appendHtml("invalid type: " + type);
+            }
+
+            request.appendHtml("</pre>");
+            request.appendHtml("</div>");
+        }
+    }
+
+    private void specificationDetails(final Request request, final ObjectSpecification specification) {
+        renderName(request, specification);
+        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
+        for (int i = 0; i < fields.size(); i++) {
+            request.appendHtml("    " + fields.get(i).getName() + " (" + fields.get(i).getSpecification().getSingularName()
+                    + ") \n");
+        }
+    }
+
+    private void specificationGraph(
+            Request request,
+            ObjectSpecification specification,
+            String fieldName,
+            List<ObjectSpecification> processed,
+            int level) {
+        if (processed.contains(specification)) {
+            return;
+        }
+
+        request.appendHtml(StringExtensions.repeat("    ", level));
+        if (processed.contains(specification)) {
+            request.appendHtml("* ");
+        }
+        request.appendHtml(specification.getFullIdentifier());
+        if (fieldName != null) {
+            request.appendHtml(" (" + fieldName + ")");
+        }
+        request.appendHtml("\n");
+
+        if (processed.contains(specification)) {
+            return;
+        }
+        processed.add(specification);
+
+        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
+        for (int i = 0; i < fields.size(); i++) {
+            ObjectSpecification fieldSpecification = fields.get(i).getSpecification();
+            if (fieldSpecification.isValue()) {
+                continue;
+            }
+            specificationGraph(request, fieldSpecification, fields.get(i).getName(), processed, level + 1);
+        }
+    }
+
+    private void renderName(final Request request, final ObjectSpecification specification) {
+        request.appendHtml(specification.getSingularName() + " (" + specification.getFullIdentifier() + ") \n");
+    }
+
+    @Override
+    public String getName() {
+        return "specification";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
new file mode 100644
index 0000000..65af85e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
@@ -0,0 +1,43 @@
+/*
+ *  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.view.debug;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ThrowException extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            return;
+        }
+
+        final String message = request.getOptionalProperty("message", "Exception throw for testing purposes");
+        throw new IsisException(message);
+    }
+
+    @Override
+    public String getName() {
+        return "debug-exception";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
new file mode 100644
index 0000000..e88f89a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
@@ -0,0 +1,142 @@
+/*
+ *  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.view.display;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedFieldsBlock;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+
+public abstract class AbstractFormView extends AbstractObjectProcessor {
+
+    @Override
+    public String checkFieldType(final ObjectAssociation objectField) {
+        return objectField.isOneToOneAssociation() ? null : "is not an object";
+    }
+
+    @Override
+    public void process(final Request request, final ObjectAdapter object) {
+        final LinkedFieldsBlock tag = new LinkedFieldsBlock();
+
+        if (object != null) {
+            final String id = request.getOptionalProperty(ID, object.getSpecification().getShortIdentifier()); 
+            final String cls = request.getOptionalProperty(CLASS, "form");
+            final String classString = " id=\"" + id + "\" class=\"" + cls + "\"";
+            String title = request.getOptionalProperty(FORM_TITLE);
+            final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
+            final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
+            final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
+            final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault()); 
+            String linkAllView = request.getOptionalProperty(LINK_VIEW);
+
+            request.setBlockContent(tag);
+            request.processUtilCloseTag();
+
+            final AuthenticationSession session = IsisContext.getAuthenticationSession(); 
+            List<ObjectAssociation> associations = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, Where.OBJECT_FORMS));
+            final List<ObjectAssociation> fields = tag.includedFields(associations);
+            final LinkedObject[] linkFields = tag.linkedFields(fields);
+
+            if (linkAllView != null) {
+                linkAllView = request.getContext().fullUriPath(linkAllView);
+                for (int i = 0; i < linkFields.length; i++) {
+                    final boolean isObject = fields.get(i).isOneToOneAssociation();
+                    final boolean isNotParseable = !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
+                    linkFields[i] = isObject && isNotParseable ? new LinkedObject(linkAllView) : null;
+                }
+            }
+
+            if (title == null) {
+                title = object.getSpecification().getSingularName();
+            } else if (title.equals("")) {
+                title = null;
+            }
+
+            write(request, object, fields, linkFields, classString, title, labelDelimiter, oddRowClass, evenRowClass, showIcons);
+        } else {
+            request.skipUntilClose(); 
+        }
+    }
+
+    private void write(
+            final Request request,
+            final ObjectAdapter object,
+            final List<ObjectAssociation> fields,
+            final LinkedObject[] linkFields,
+            final String classString,
+            final String title,
+            final String labelDelimiter,
+            final String oddRowClass,
+            final String evenRowClass,
+            final boolean showIcons) {
+        request.appendHtml("<div" + classString + ">");
+        if (title != null) {
+            request.appendHtml("<div class=\"title\">");
+            request.appendAsHtmlEncoded(title);
+            request.appendHtml("</div>");
+            HelpLink.append(request, object.getSpecification().getDescription(), object.getSpecification().getHelp());
+        }
+        int row = 1;
+        for (int i = 0; i < fields.size(); i++) {
+            final ObjectAssociation field = fields.get(i);
+            if (ignoreField(field)) {
+                continue;
+            }
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.OBJECT_FORMS).isVetoed()) {
+                continue;
+            }
+
+            final String description = field.getDescription().equals("") ? "" : "title=\"" + field.getDescription() + "\"";
+            String cls;
+            if (row++ % 2 == 1) {
+                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
+            } else {
+                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
+            }
+            request.appendHtml("<div " + cls + description + "><span class=\"label\">");
+            request.appendAsHtmlEncoded(field.getName());
+            request.appendHtml(labelDelimiter + "</span>");
+            final LinkedObject linkedObject = linkFields[i];
+            addField(request, object, field, linkedObject, showIcons);
+            HelpLink.append(request, field.getDescription(), field.getHelp());
+            request.appendHtml("</div>");
+        }
+        request.appendHtml("</div>");
+    }
+
+    protected void addField(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
+        FieldValue.write(request, object, field, linkedObject, null, showIcons, 0);
+    }
+
+    protected boolean ignoreField(final ObjectAssociation objectField) {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
new file mode 100644
index 0000000..286d84d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
@@ -0,0 +1,149 @@
+/*
+ *  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.view.display;
+
+import java.util.Iterator;
+import java.util.List;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
+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.processor.Request;
+
+public abstract class AbstractTableView extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with
+    // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
+    // be hidden from all tables but will be visible/enabled (perhaps incorrectly) 
+    // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
+    private final Where where = Where.ALL_TABLES;
+
+    @Override
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
+
+        ObjectAdapter collection;
+        String parentObjectId = null;
+        boolean isFieldEditable = false;
+        final String field = request.getOptionalProperty(FIELD);
+        final String tableClass = request.getOptionalProperty(CLASS);
+        ObjectSpecification elementSpec;
+        String tableId;
+        if (field != null) {
+            final String objectId = request.getOptionalProperty(OBJECT);
+            final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
+            if (object == null) {
+                throw new ScimpiException("No object for result or " + objectId);
+            }
+            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
+            if (!objectField.isOneToManyAssociation()) {
+                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
+            }
+            isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
+            ResolveFieldUtil.resolveField(object, objectField);
+            collection = objectField.get(object);
+            final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
+            elementSpec = facet.valueSpec();
+            parentObjectId = objectId == null ? context.mapObject(object, Scope.REQUEST) : objectId;
+            tableId = request.getOptionalProperty(ID, field);
+        } else {
+            final String id = request.getOptionalProperty(COLLECTION);
+            collection = context.getMappedObjectOrResult(id);
+            elementSpec = collection.getElementSpecification();
+            tableId = request.getOptionalProperty(ID, collection.getElementSpecification().getShortIdentifier());
+        }
+
+        final String summary = request.getOptionalProperty("summary");
+        final String rowClassesList = request.getOptionalProperty(ROW_CLASSES, ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
+        String[] rowClasses = null;
+        if (rowClassesList.length() > 0) {
+            rowClasses = rowClassesList.split("[,|/]");
+        }
+
+        final List<ObjectAssociation> allFields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
+        final TableContentWriter rowBuilder = createRowBuilder(request, context, isFieldEditable ? parentObjectId : null, allFields, collection);
+        write(request, collection, summary, rowBuilder, tableId, tableClass, rowClasses);
+
+    }
+
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    protected abstract TableContentWriter createRowBuilder(final Request request, RequestContext context, final String parent, final List<ObjectAssociation> allFields, ObjectAdapter collection);
+
+    public static void write(
+            final Request request,
+            final ObjectAdapter collection,
+            final String summary,
+            final TableContentWriter rowBuilder,
+            final String tableId,
+            final String tableClass,
+            final String[] rowClasses) {
+        final RequestContext context = request.getContext();
+
+        final String summarySegment = summary == null ? "" : (" summary=\"" + summary + "\"");
+        final String idSegment = tableId == null ? "" : (" id=\"" + tableId + "\""); 
+        final String classSegment = tableClass == null ? "" : (" class=\"" + tableClass + "\"");
+        request.appendHtml("<table" + idSegment + classSegment + summarySegment + ">");
+        rowBuilder.writeCaption(request);
+        rowBuilder.writeHeaders(request);
+        rowBuilder.writeFooters(request);
+
+        request.appendHtml("<tbody>");
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        int row = 1;
+        while (iterator.hasNext()) {
+            final ObjectAdapter element = iterator.next();
+
+            context.addVariable("row", "" + (row), Scope.REQUEST);
+            String cls = "";
+            if (rowClasses != null) {
+                cls = " class=\"" + rowClasses[row % rowClasses.length] + "\"";
+            }
+            request.appendHtml("<tr" + cls + ">");
+            rowBuilder.writeElement(request, context, element);
+            request.appendHtml("</tr>");
+            row++;
+        }
+        request.appendHtml("</tbody>");
+        request.appendHtml("</table>");
+        
+        rowBuilder.tidyUp();
+    }
+
+    @Override
+    public String getName() {
+        return "table";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
new file mode 100644
index 0000000..7076f70
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
@@ -0,0 +1,44 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class AddMessage extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        final String content = request.popBuffer();
+
+        final MessageBroker messageBroker = IsisContext.getMessageBroker();
+        messageBroker.addMessage(content);
+    }
+
+    @Override
+    public String getName() {
+        return "add-message";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
new file mode 100644
index 0000000..ac0d240
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
@@ -0,0 +1,44 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class AddWarning extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        final String content = request.popBuffer();
+
+        final MessageBroker messageBroker = IsisContext.getMessageBroker();
+        messageBroker.addWarning(content);
+    }
+
+    @Override
+    public String getName() {
+        return "add-warning";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
new file mode 100644
index 0000000..960997d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
@@ -0,0 +1,65 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Errors extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String cls = request.getOptionalProperty(CLASS);
+        final StringBuffer buffer = new StringBuffer();
+        write(request, cls, buffer);
+        if (buffer.length() > 0) {
+            request.appendHtml("<div class=\"error\">");
+            request.appendHtml(buffer.toString());
+            request.appendHtml("</div>");
+        }
+    }
+
+    public static void write(final Request request, String cls, final StringBuffer buffer) {
+        if (cls == null) {
+            cls = "error";
+        }
+        final String message = (String) request.getContext().getVariable("_error-message");
+        if (message != null) {
+            buffer.append(message);
+        }
+        final String details = (String) request.getContext().getVariable("_error-details");
+        if (details != null) {
+            buffer.append(details);
+        }
+
+        /*
+         * final MessageBroker messageBroker = IsisContext.getMessageBroker();
+         * final List<String> warnings = messageBroker.getWarnings(); for (final
+         * String warning : warnings) { buffer.append("<div class=\"" + cls +
+         * "\">" + warning + "</div>"); }
+         */
+    }
+
+    @Override
+    public String getName() {
+        return "errors";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
new file mode 100644
index 0000000..f734ce2
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
@@ -0,0 +1,46 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Feedback extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String cls = request.getOptionalProperty(CLASS);
+        final StringBuffer buffer = new StringBuffer();
+        Errors.write(request, cls, buffer);
+        Warnings.write(cls, buffer);
+        Messages.write(cls, buffer);
+        if (buffer.length() > 0) {
+            request.appendHtml("<div class=\"feedback\">");
+            request.appendHtml(buffer.toString());
+            request.appendHtml("</div>");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "feedback";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
new file mode 100644
index 0000000..32e2cd8
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
@@ -0,0 +1,77 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class FieldLabel extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getRequiredProperty(FIELD);
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+        if (field == null) {
+            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
+        }
+        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+        }
+        String delimiter = request.getOptionalProperty("delimiter");
+        if (delimiter == null) {
+            delimiter = ": ";
+        } else if (delimiter.equals("")) {
+            delimiter = null;
+        }
+        write(request, field, delimiter);
+    }
+
+    @Override
+    public String getName() {
+        return "label";
+    }
+
+    public static void write(final Request content, final ObjectAssociation field, final String delimiter) {
+        final String description = field.getDescription();
+        final String titleSegment = description == null || description.equals("") ? null : ("title=\"" + description + "\"");
+        content.appendHtml("<span class=\"label\"" + titleSegment + ">");
+        content.appendAsHtmlEncoded(field.getName());
+        if (delimiter != null) {
+            content.appendHtml("<span class=\"delimiter\">" + delimiter + "</span>");
+        }
+        content.appendHtml("</span>");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
new file mode 100644
index 0000000..3e84218
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
@@ -0,0 +1,118 @@
+/*
+ *  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.view.display;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+
+public class FieldValue extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String className = request.getOptionalProperty(CLASS);
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getRequiredProperty(FIELD);
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+        if (field == null) {
+            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
+        }
+        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+        }
+        final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
+        final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
+
+        write(request, object, field, null, className, isIconShowing, truncateTo);
+    }
+
+    @Override
+    public String getName() {
+        return "field";
+    }
+
+    public static void write(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedField, final String className, final boolean showIcon, final int truncateTo) {
+
+        final ObjectAdapter fieldReference = field.get(object);
+
+        if (fieldReference != null) {
+            final String classSection = "class=\"" + (className == null ? "value" : className) + "\"";
+            request.appendHtml("<span " + classSection + ">");
+            if (field.isOneToOneAssociation()) {
+                try {
+                    IsisContext.getPersistenceSession().resolveImmediately(fieldReference);
+                } catch (final ObjectNotFoundException e) {
+                    request.appendHtml(e.getMessage() + "</span>");
+                }
+            }
+
+            if (!field.getSpecification().containsFacet(ParseableFacet.class) && showIcon) {
+                request.appendHtml("<img class=\"small-icon\" src=\"" + request.getContext().imagePath(fieldReference) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>");
+            }
+
+            if (linkedField != null) {
+                final String id = request.getContext().mapObject(fieldReference, linkedField.getScope(), Scope.INTERACTION);
+                request.appendHtml("<a href=\"" + linkedField.getForwardView() + "?" + linkedField.getVariable() + "=" + id + request.getContext().encodedInteractionParameters() + "\">");
+            }
+            String value = fieldReference == null ? "" : fieldReference.titleString();
+            if (truncateTo > 0 && value.length() > truncateTo) {
+                value = value.substring(0, truncateTo) + "...";
+            }
+
+            // TODO figure out a better way to determine if boolean or a
+            // password
+            final ObjectSpecification spec = field.getSpecification();
+            final BooleanValueFacet facet = spec.getFacet(BooleanValueFacet.class);
+            if (facet != null) {
+                final boolean flag = facet.isSet(fieldReference);
+                final String valueSegment = flag ? " checked=\"checked\"" : "";
+                final String disabled = " disabled=\"disabled\"";
+                request.appendHtml("<input type=\"checkbox\"" + valueSegment + disabled + " />");
+            } else {
+                request.appendAsHtmlEncoded(value);
+            }
+
+            if (linkedField != null) {
+                request.appendHtml("</a>");
+            }
+            request.appendHtml("</span>");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
new file mode 100644
index 0000000..8a6ab16
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
@@ -0,0 +1,103 @@
+/*
+ *  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.view.display;
+
+import java.text.DecimalFormat;
+import java.text.Format;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.facets.value.date.DateValueFacet;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+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.processor.Request;
+
+public class GetField extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getRequiredProperty(FIELD);
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        if (object == null) {
+            throw new ScimpiException("No object to get field for: " + fieldName + " - " + id);
+        }
+        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+        if (field == null) {
+            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
+        }
+        final AuthenticationSession session = IsisContext.getAuthenticationSession();
+        if (field.isVisible(session, object, where).isVetoed()) {
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+        }
+
+        String pattern = request.getOptionalProperty("decimal-format");
+        Format format = null;
+        if (pattern != null) {
+            format = new DecimalFormat(pattern);
+        }
+        pattern = request.getOptionalProperty("date-format");
+        if (pattern != null) {
+            format = new SimpleDateFormat(pattern);
+        }
+
+        final String name = request.getOptionalProperty(RESULT_NAME, fieldName);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+
+        process(request, object, field, format, name, scope);
+    }
+
+    protected void process(final Request request, final ObjectAdapter object, final ObjectAssociation field, final Format format, final String name, final Scope scope) {
+        final ObjectAdapter fieldReference = field.get(object);
+        if (format != null && fieldReference.isValue()) {
+            final DateValueFacet facet = fieldReference.getSpecification().getFacet(DateValueFacet.class);
+            final Date date = facet.dateValue(fieldReference);
+            final String value = format.format(date);
+            request.appendDebug("    " + object + " -> " + value);
+            request.getContext().addVariable(name, Request.getEncoder().encoder(value), scope);
+        } else {
+            final String source = fieldReference == null ? "" : request.getContext().mapObject(fieldReference, scope);
+            request.appendDebug("    " + object + " -> " + source);
+            request.getContext().addVariable(name, source, scope);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "get-field";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
new file mode 100644
index 0000000..aa3bfff
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
@@ -0,0 +1,107 @@
+/*
+ *  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.view.display;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+/**
+ * Element to include another file that will display an object.
+ */
+public class IncludeObject extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String path = request.getOptionalProperty("file");
+        String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getOptionalProperty(FIELD);
+        ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        if (fieldName != null) {
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+            }
+            object = field.get(object);
+            id = request.getContext().mapObject(object, Scope.REQUEST);
+        }
+
+        if (object != null) {
+            IsisContext.getPersistenceSession().resolveImmediately(object);
+            request.getContext().addVariable("_object", id, Scope.REQUEST);
+            importFile(request, path);
+        }
+        request.closeEmpty();
+    }
+
+    private static void importFile(final Request request, final String path) {
+        // TODO load in file via HtmlFileParser
+        final File file = new File(path);
+        BufferedReader reader = null;
+        try {
+            if (file.exists()) {
+                reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+                String line;
+                while ((line = reader.readLine()) != null) {
+                    request.appendHtml(line);
+                }
+            } else {
+                request.appendHtml("<P classs=\"error\">File " + path + " not found to import</P>");
+            }
+        } catch (final FileNotFoundException e) {
+            throw new RuntimeException(e);
+        } catch (final IOException e) {
+            throw new RuntimeException(e);
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (final IOException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "include-object";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
new file mode 100644
index 0000000..3bd8352
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
@@ -0,0 +1,94 @@
+/*
+ *  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.view.display;
+
+import java.util.Iterator;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+
+public class ListView extends AbstractObjectProcessor {
+
+    @Override
+    public String checkFieldType(final ObjectAssociation objectField) {
+        return objectField.isOneToManyAssociation() ? null : "is not a collection";
+    }
+
+    @Override
+    public void process(final Request request, final ObjectAdapter object) {
+        final String linkRowView = request.getOptionalProperty(LINK_VIEW);
+        final String linkObjectName = request.getOptionalProperty(ELEMENT_NAME, RequestContext.RESULT);
+        final String linkObjectScope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
+        LinkedObject linkedRow = null;
+        if (linkRowView != null) {
+            linkedRow = new LinkedObject(linkObjectName, linkObjectScope, request.getContext().fullUriPath(linkRowView));
+        }
+        final String bulletType = request.getOptionalProperty("type");
+        write(request, object, linkedRow, bulletType);
+    }
+
+    public static void write(final Request request, final ObjectAdapter collection, final LinkedObject linkRow, final String bulletType) {
+
+        if (bulletType == null) {
+            request.appendHtml("<ol>");
+        } else {
+            request.appendHtml("<ul type=\"" + bulletType + "\">");
+        }
+
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        while (iterator.hasNext()) {
+            final ObjectAdapter element = iterator.next();
+
+            request.appendHtml("<li>");
+            if (linkRow != null) {
+                final Scope scope = linkRow == null ? Scope.INTERACTION : RequestContext.scope(linkRow.getScope());
+                RequestContext context = request.getContext();
+                final String rowId = context.mapObject(element, scope);
+                request.appendHtml("<a class=\"item-select\" href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable()
+                        + "=" + rowId + context.encodedInteractionParameters() + "\">");
+            }
+            request.appendAsHtmlEncoded(element.titleString());
+            if (linkRow != null) {
+                request.appendHtml("</a>");
+            }
+
+            request.appendHtml("</li>\n");
+        }
+        if (bulletType == null) {
+            request.appendHtml("</ol>");
+        } else {
+            request.appendHtml("</ul>");
+        }
+
+    }
+
+    @Override
+    public String getName() {
+        return "list";
+    }
+
+}


[02/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
new file mode 100644
index 0000000..3321b87
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
@@ -0,0 +1,140 @@
+/*
+ *  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.view.simple;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.*;
+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.edit.RemoveAction;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class RemoveElement extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final static Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String title = request.getOptionalProperty(BUTTON_TITLE, "Remove From List");
+        final String cls = request.getOptionalProperty(CLASS, "action in-line delete confirm");
+        final String object = request.getOptionalProperty(OBJECT);
+        final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        final RequestContext context = request.getContext();
+        final String objectId = object != null ? object : (String) context.getVariable(RequestContext.RESULT);
+        final ObjectAdapter adapter = MethodsUtils.findObject(context, objectId);
+
+        final String element = request.getOptionalProperty(ELEMENT, (String) context.getVariable(ELEMENT));
+        final ObjectAdapter elementId = MethodsUtils.findObject(context, element);
+
+        final String fieldName = request.getRequiredProperty(FIELD);
+
+        String view = request.getOptionalProperty(VIEW);
+        view = context.fullFilePath(view == null ? context.getResourceFile() : view);
+        String error = request.getOptionalProperty(ERROR);
+        error = context.fullFilePath(error == null ? context.getResourceFile() : error);
+
+        request.processUtilCloseTag();
+
+        write(request, adapter, fieldName, elementId, resultOverride, view, error, title, cls);
+    }
+
+    @Override
+    public String getName() {
+        return "remove-element";
+    }
+
+    public static void write(final Request request, final ObjectAdapter adapter, final String fieldName, final ObjectAdapter element, final String resultOverride, final String view, final String error, final String title, final String cssClass) {
+        final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
+        if (field == null) {
+            throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
+        }
+        if (!field.isOneToManyAssociation()) {
+            throw new ScimpiException("Field " + fieldName + " not a collection, in " + adapter.getSpecification().getFullIdentifier());
+        }
+        if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+        }
+        ResolveFieldUtil.resolveField(adapter, field);
+
+        Consent usable = field.isUsable(IsisContext.getAuthenticationSession(), adapter, where);
+        if (usable.isAllowed()) {
+            usable = ((OneToManyAssociation) field).isValidToRemove(adapter, element);
+        }
+
+        if (usable.isVetoed()) {
+            request.appendHtml("<div class=\"" + cssClass + " disabled-form\">"); 
+            request.appendHtml("<div class=\"button disabled\" title=\""); 
+            request.appendAsHtmlEncoded(usable.getReason());
+            request.appendHtml("\" >" + title);
+            request.appendHtml("</div>");
+            request.appendHtml("</div>");
+        } else {
+            if (valid(request, adapter)) {
+                final String classSegment = " class=\"" + cssClass + "\"";
+
+                final String objectId = request.getContext().mapObject(adapter, Scope.INTERACTION);
+                final String elementId = request.getContext().mapObject(element, Scope.INTERACTION);
+                final String action = RemoveAction.ACTION + Dispatcher.COMMAND_ROOT;
+                request.appendHtml("<form" + classSegment + " method=\"post\" action=\"" + action + "\" >");
+                request.appendHtml("<input type=\"hidden\" name=\"" + OBJECT + "\" value=\"" + objectId + "\" />");
+                request.appendHtml("<input type=\"hidden\" name=\"" + FIELD + "\" value=\"" + fieldName + "\" />");
+                request.appendHtml("<input type=\"hidden\" name=\"" + ELEMENT + "\" value=\"" + elementId + "\" />");
+                if (resultOverride != null) {
+                    request.appendHtml("<input type=\"hidden\" name=\"" + RESULT_OVERRIDE + "\" value=\"" + resultOverride + "\" />");
+                }
+                request.appendHtml("<input type=\"hidden\" name=\"" + VIEW + "\" value=\"" + view + "\" />");
+                request.appendHtml("<input type=\"hidden\" name=\"" + ERROR + "\" value=\"" + error + "\" />");
+                request.appendHtml(request.getContext().interactionFields());
+                request.appendHtml("<input class=\"button\" type=\"submit\" value=\"" + title + "\" />");
+                request.appendHtml("</form>");
+            }
+        }
+    }
+
+    private static boolean valid(final Request request, final ObjectAdapter adapter) {
+        // TODO is this check valid/necessary?
+
+        // TODO check is valid to remove element
+        final AuthenticationSession session = IsisContext.getAuthenticationSession();
+        final Filter<ObjectAssociation> filter = ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where);
+        final List<ObjectAssociation> visibleFields = adapter.getSpecification().getAssociations(Contributed.EXCLUDED, filter);
+        if (visibleFields.size() == 0) {
+            return false;
+        }
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java
new file mode 100644
index 0000000..2dced50
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/ScopeTag.java
@@ -0,0 +1,51 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class ScopeTag extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getRequiredProperty(NAME);
+        final String scopeName = request.getRequiredProperty(SCOPE);
+        final Scope scope = RequestContext.scope(scopeName);
+        request.processUtilCloseTag();
+        changeScope(request, name, scope);
+    }
+
+    protected static void changeScope(final Request request, final String name, final Scope scope) {
+        request.getContext().changeScope(name, scope);
+        final Object value = request.getContext().getVariable(name);
+        if (value != null) {
+            request.getContext().addVariable(name, value, scope);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "scope";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java
new file mode 100644
index 0000000..1014280
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookie.java
@@ -0,0 +1,53 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.action.RequiredPropertyException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class SetCookie extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getRequiredProperty("name");
+        final String value = request.getOptionalProperty("value");
+        final boolean isClear = request.getOptionalProperty("action", "set").equals("clear");
+        final String expiresString = request.getOptionalProperty("expires", "-1");
+
+        if (!isClear && value == null) {
+            throw new RequiredPropertyException("Property not set: " + value);
+        }
+        if (isClear) {
+            request.appendDebug("cookie: " + name + " (cleared)");
+            request.getContext().addCookie(name, null, 0);
+        } else {
+            if (value.length() > 0) {
+                request.appendDebug("cookie: " + name + " set to"+ value);
+                request.getContext().addCookie(name, value, Integer.valueOf(expiresString));
+            }
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "set-cookie";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java
new file mode 100644
index 0000000..b91261c
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetCookieFromField.java
@@ -0,0 +1,55 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class SetCookieFromField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        throw new NotYetImplementedException("3.1");
+        /*
+         * String objectId = request.getOptionalProperty(OBJECT); String
+         * fieldName = request.getRequiredProperty(FIELD);
+         * 
+         * ObjectAdapter object = (ObjectAdapter)
+         * request.getContext().getMappedObjectOrResult(objectId);
+         * ObjectAssociation field =
+         * object.getSpecification().getField(fieldName); if (field.isValue()) {
+         * throw new ScimpiException("Can only set up a value field"); }
+         * ObjectAdapter value = field.get(object); if (value != null) { String
+         * title = value.titleString();
+         * 
+         * if (title.length() > 0) { String name =
+         * request.getRequiredProperty(NAME); String expiresString =
+         * request.getOptionalProperty("expires", "-1");
+         * request.getContext().addCookie(name, title,
+         * Integer.valueOf(expiresString)); } }
+         */
+    }
+
+    @Override
+    public String getName() {
+        return "set-cookie-from-field";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java
new file mode 100644
index 0000000..89702fa
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetFieldFromCookie.java
@@ -0,0 +1,52 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class SetFieldFromCookie extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        throw new NotYetImplementedException("3.1");
+        /*
+         * String name = request.getRequiredProperty(NAME); String cookieString
+         * = request.getContext().getCookie(name); ObjectAdapter valueAdapter =
+         * IsisContext.getObjectPersistor().createAdapterForValue(cookieString);
+         * 
+         * String objectId = request.getOptionalProperty(OBJECT); String
+         * fieldName = request.getRequiredProperty(FIELD); ObjectAdapter object
+         * = (ObjectAdapter)
+         * request.getContext().getMappedObjectOrResult(objectId);
+         * ObjectAssociation field =
+         * object.getSpecification().getField(fieldName); if (field.isValue()) {
+         * throw new ScimpiException("Can only set up a value field"); }
+         * 
+         * ((ValueAssociation) field).setValue(object, valueAdapter);
+         */
+    }
+
+    @Override
+    public String getName() {
+        return "set-field-from-cookie";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java
new file mode 100644
index 0000000..d8f79f6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SetLocalization.java
@@ -0,0 +1,61 @@
+/*
+ *  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.view.simple;
+
+import java.util.Locale;
+import java.util.TimeZone;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+/**
+ * Displays the localization data for the current user.
+ */
+public class SetLocalization extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.closeEmpty();
+        
+        final String localeCode = request.getRequiredProperty("locale");
+        final String timeZone = request.getRequiredProperty("time-zone");
+        
+        String country;
+        String language;
+        int pos = localeCode.indexOf('_');
+        if (pos == 1) {
+            language = localeCode;
+            country = "";
+        } else {
+            language = localeCode.substring(0, pos);
+            country = localeCode.substring(pos + 1);
+        }
+        
+        Locale l = new Locale(language, country);
+        TimeZone t = TimeZone.getTimeZone(timeZone);
+        // IsisContext.getUserProfile().setLocalization(new UserLocalization(l, t));
+
+    }
+
+    @Override
+    public String getName() {
+        return "alpha-set-localization";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java
new file mode 100644
index 0000000..1efd7bf
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/SimpleButton.java
@@ -0,0 +1,39 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class SimpleButton extends AbstractElementProcessor {
+    @Override
+    public void process(final Request request) {
+        final String href = request.getRequiredProperty("href");
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        final String text = request.popBuffer();
+        request.appendHtml("<div class=\"action\"><a class=\"button\" href=\"" + href + "\">" + text + "</a></div>");
+    }
+
+    @Override
+    public String getName() {
+        return "button";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java
new file mode 100644
index 0000000..493c33a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/StartSession.java
@@ -0,0 +1,36 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class StartSession extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        request.getContext().startHttpSession();
+    }
+
+    @Override
+    public String getName() {
+        return "start-session";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java
new file mode 100644
index 0000000..8860780
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/TemplateTag.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.viewer.scimpi.dispatcher.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class TemplateTag implements ElementProcessor {
+
+    @Override
+    public String getName() {
+        return "template";
+    }
+
+    @Override
+    public void process(final Request request) {
+        // REVIEW this make IE8 render poorly as the browser doesn't think a
+        // DOCTYPE is provided, causing it to run in
+        // quirk mode
+        // request.appendHtml("<!--  zz apply template " +
+        // request.getOptionalProperty("file") + " -->");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java
new file mode 100644
index 0000000..9dcf810
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Unless.java
@@ -0,0 +1,41 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Unless extends AbstractConditionalBlock {
+
+    @Override
+    protected void processTags(final boolean isSet, final Request request) {
+        if (isSet) {
+            request.skipUntilClose();
+            request.appendDebug("    skipping segment");
+        } else {
+            request.processUtilCloseTag();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "unless";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java
new file mode 100644
index 0000000..960fc6b
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/Variable.java
@@ -0,0 +1,64 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class Variable extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String name = request.getOptionalProperty(NAME);
+        final String value = request.getOptionalProperty(VALUE);
+        final String defaultTo = request.getOptionalProperty(DEFAULT);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+        final boolean isClear = request.getOptionalProperty("action", "set").equals("clear");
+        final Scope scope = RequestContext.scope(scopeName, isClear ? Scope.SESSION : Scope.REQUEST);
+        process(request, name, value, defaultTo, isClear, scope);
+    }
+
+    protected void process(final Request request, final String name, final String value, final String defaultTo, final boolean isClear, final Scope scope) {
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        String source = request.popBuffer();
+        if (isClear) {
+            request.appendDebug("variable: " + name + " (cleared)");
+            request.getContext().clearVariable(name, scope);
+        } else {
+            if (source.length() == 0 && value != null) {
+                source = value;
+            }
+            if (source.length() == 0) {
+                source = defaultTo;
+            }
+            request.appendDebug("    " + name + " (" + scope + ") set to " + source);
+            request.getContext().addVariable(name, source, scope);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "variable";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java
new file mode 100644
index 0000000..cc1fd09
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/When.java
@@ -0,0 +1,41 @@
+/*
+ *  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.view.simple;
+
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class When extends AbstractConditionalBlock {
+
+    @Override
+    protected void processTags(final boolean isSet, final Request request) {
+        if (isSet) {
+            request.processUtilCloseTag();
+        } else {
+            request.appendDebug("    skipping segment");
+            request.skipUntilClose();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "when";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java
new file mode 100644
index 0000000..119a453
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ActionName.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher.view.value;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+// TODO do the same for description and help, and for fields
+public class ActionName extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final String methodName = request.getRequiredProperty(METHOD);
+
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+        final ObjectAction action = MethodsUtils.findAction(object, methodName);
+
+        request.appendAsHtmlEncoded(action.getName());
+    }
+
+    @Override
+    public String getName() {
+        return "action-name";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java
new file mode 100644
index 0000000..debaa49
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/CountElements.java
@@ -0,0 +1,54 @@
+/*
+ *  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.view.value;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class CountElements extends AbstractObjectProcessor {
+
+    @Override
+    protected void process(final Request request, final ObjectAdapter collection) {
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+        final int size = facet.size(collection);
+        if (size == 0) {
+            request.appendHtml(request.getOptionalProperty("none", "0"));
+        } else if (size == 1) {
+            request.appendHtml(request.getOptionalProperty("one", "1"));
+        } else {
+            final String text = request.getOptionalProperty("many", "" + size);
+            request.appendHtml(String.format(text, size));
+        }
+    }
+
+    @Override
+    protected String checkFieldType(final ObjectAssociation objectField) {
+        return objectField.isOneToManyAssociation() ? null : "must be a collection";
+    }
+
+    @Override
+    public String getName() {
+        return "count";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java
new file mode 100644
index 0000000..c7284a0
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ElementType.java
@@ -0,0 +1,61 @@
+/*
+ *  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.view.value;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ElementType extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        ObjectAdapter collection;
+        final String field = request.getOptionalProperty(FIELD);
+        final RequestContext context = request.getContext();
+        if (field != null) {
+            final String id = request.getRequiredProperty(OBJECT);
+            final ObjectAdapter object = context.getMappedObjectOrResult(id);
+            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
+            if (!objectField.isOneToManyAssociation()) {
+                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
+            }
+            collection = objectField.get(object);
+        } else {
+            final String id = request.getOptionalProperty(COLLECTION);
+            collection = context.getMappedObjectOrResult(id);
+        }
+
+        final ObjectSpecification elementSpecification = collection.getElementSpecification();
+        final String name = elementSpecification.getSingularName();
+
+        request.appendAsHtmlEncoded(name);
+    }
+
+    @Override
+    public String getName() {
+        return "element-type";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
new file mode 100644
index 0000000..ed054a1
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
@@ -0,0 +1,65 @@
+/*
+ *  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.view.value;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class FieldName extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getRequiredProperty(FIELD);
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+        if (field == null) {
+            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
+        }
+        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+        }
+        request.appendAsHtmlEncoded(field.getName());
+    }
+
+    @Override
+    public String getName() {
+        return "field-name";
+    }
+
+    public static void write(final Request content, final ObjectAssociation field) {
+        content.appendHtml("<span class=\"label\" title=\"" + field.getDescription() + "\">");
+        content.appendHtml("</span>");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java
new file mode 100644
index 0000000..84e2204
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/ParameterName.java
@@ -0,0 +1,62 @@
+/*
+ *  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.view.value;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class ParameterName extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final String methodName = request.getRequiredProperty(METHOD);
+        final String field = request.getOptionalProperty(PARAMETER_NUMBER);
+
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+        final ObjectAction action = MethodsUtils.findAction(object, methodName);
+        final List<ObjectActionParameter> parameters = action.getParameters();
+
+        int index;
+        if (field == null) {
+            index = 0;
+        } else {
+            index = Integer.valueOf(field).intValue() - 1;
+        }
+        if (index < 0 || index >= parameters.size()) {
+            throw new ScimpiException("Parameter numbers should be between 1 and " + parameters.size() + ": " + index);
+        }
+
+        request.appendAsHtmlEncoded(parameters.get(index).getName());
+    }
+
+    @Override
+    public String getName() {
+        return "parameter-name";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
new file mode 100644
index 0000000..6b2078a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
@@ -0,0 +1,68 @@
+/*
+ *  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.view.value;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+/**
+ * 
+ */
+public class TitleString extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String id = request.getOptionalProperty(OBJECT);
+        final String fieldName = request.getOptionalProperty(FIELD);
+        final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        if (object == null) { 
+            return; 
+        } 
+        String titleString;
+        if (fieldName == null) {
+            titleString = object.titleString();
+        } else {
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE).isVetoed()) {
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+            }
+            final ObjectAdapter fieldReference = field.get(object);
+            if (fieldReference != null) {
+                titleString = fieldReference.titleString();
+            } else {
+                titleString = "";
+            }
+        }
+        request.appendDebug("    " + titleString);
+        request.appendTruncated(titleString, truncateTo);
+    }
+
+    @Override
+    public String getName() {
+        return "title-string";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java
new file mode 100644
index 0000000..9c7861d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/Type.java
@@ -0,0 +1,57 @@
+/*
+ *  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.view.value;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Type extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
+        final String showPlural = request.getOptionalProperty(PLURAL);
+        final String id = request.getOptionalProperty(OBJECT);
+        final String objectId = id != null ? id : (String) context.getVariable(RequestContext.RESULT);
+
+        ObjectAdapter object = context.getMappedObjectOrResult(objectId);
+        final String field = request.getOptionalProperty(FIELD);
+        if (field != null) {
+            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
+            object = objectField.get(object);
+        }
+        request.appendDebug(" for " + object);
+
+        final ObjectSpecification specification = object.getSpecification();
+        final String name = showPlural != null ? specification.getPluralName() : specification.getSingularName();
+
+        request.appendAsHtmlEncoded(name);
+    }
+
+    @Override
+    public String getName() {
+        return "type";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/pom.xml b/mothballed/component/viewer/scimpi/pom.xml
new file mode 100644
index 0000000..300d60d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/pom.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.isis.core</groupId>
+		<artifactId>isis</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+		<relativePath>../../../core/pom.xml</relativePath>
+	</parent>
+
+	<groupId>org.apache.isis.viewer</groupId>
+	<artifactId>isis-viewer-scimpi</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+	
+	<name>Isis Scimpi Viewer</name>
+	
+	<packaging>pom</packaging>
+
+	<properties>
+        <siteBaseDir>.</siteBaseDir>
+		<relativeUrl/>
+    </properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://isis.apache.org/${relativeUrl}</url>
+
+	<build>
+		<pluginManagement>
+			<plugins>
+                <!-- Apache Release Audit Tool -->
+                <plugin>
+                    <groupId>org.apache.rat</groupId>
+                    <artifactId>apache-rat-plugin</artifactId>
+                    <version>0.10</version>
+	                <configuration>
+	                    <excludes>
+	                    	<!-- 
+	                    	overriding inherited excludes from oia.core:isis 
+	                    	with a more specific set for this component
+	                    	 -->
+	                        <exclude>**/target/**</exclude>
+	                        <exclude>**/target-ide/**</exclude>
+
+	                        <exclude>**/*.project</exclude>
+	                        <exclude>**/.classpath</exclude>
+	                        <exclude>**/.settings/**</exclude>
+	                    </excludes>
+                    </configuration>
+	            </plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <inherited>false</inherited>
+                <reportSets>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>dependency-management</report>
+                            <report>plugins</report>
+                            <report>modules</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+    <dependencyManagement>
+        <dependencies>
+
+	    	<!-- for benefit of application developers, using scope=import -->
+
+	        <dependency>
+	            <groupId>org.apache.isis.viewer</groupId>
+	            <artifactId>isis-viewer-scimpi-dispatcher</artifactId>
+	            <version>1.0.0-SNAPSHOT</version>
+	        </dependency>
+
+	        <dependency>
+	            <groupId>org.apache.isis.viewer</groupId>
+	            <artifactId>isis-viewer-scimpi-servlet</artifactId>
+	            <version>1.0.0-SNAPSHOT</version>
+	        </dependency>
+
+            <dependency>
+                <!--  defined here because other Isis modules do not depend upon it -->
+                <groupId>commons-lang</groupId>
+                <artifactId>commons-lang</artifactId>
+                <version>2.6</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.json</groupId>
+                <artifactId>json</artifactId>
+                <version>20140107</version>
+            </dependency>
+
+		</dependencies>
+	</dependencyManagement>
+
+	<modules>
+		<module>dispatcher</module>
+		<module>servlet</module>
+	</modules>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/servlet/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/servlet/pom.xml b/mothballed/component/viewer/scimpi/servlet/pom.xml
new file mode 100644
index 0000000..1600dd7
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/servlet/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+        <groupId>org.apache.isis.viewer</groupId>
+	    <artifactId>isis-viewer-scimpi</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>isis-viewer-scimpi-servlet</artifactId>
+
+	<name>Isis Scimpi Viewer Servlet</name>
+
+	<properties>
+        <siteBaseDir>..</siteBaseDir>
+		<relativeUrl>servlet/</relativeUrl>
+	</properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://isis.apache.org/${relativeUrl}</url>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <inherited>false</inherited>
+                <configuration>
+                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>dependencies</report>
+                            <report>dependency-convergence</report>
+                            <report>plugins</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.isis.viewer</groupId>
+			<artifactId>isis-viewer-scimpi-dispatcher</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-servlet_3.0_spec</artifactId>
+		</dependency>
+
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java
new file mode 100644
index 0000000..6bb776c
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatchException.java
@@ -0,0 +1,42 @@
+/*
+ *  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.servlet;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+
+public class DispatchException extends ScimpiException {
+    private static final long serialVersionUID = 1L;
+
+    public DispatchException() {
+    }
+
+    public DispatchException(final String message) {
+        super(message);
+    }
+
+    public DispatchException(final Throwable cause) {
+        super(cause);
+    }
+
+    public DispatchException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
new file mode 100644
index 0000000..272e1c4
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
@@ -0,0 +1,89 @@
+/*
+ *  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.servlet;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.UserManager;
+import org.apache.isis.viewer.scimpi.dispatcher.debug.DebugUsers;
+
+public class DispatcherServlet extends HttpServlet {
+    private static final long serialVersionUID = 1L;
+    private static final Logger LOG = LoggerFactory.getLogger(DispatcherServlet.class);
+    private Dispatcher dispatcher;
+    private DebugUsers debugUsers;
+
+    @Override
+    protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+        LOG.info("http request from " + request.getRemoteAddr() + ": post " + request.getServletPath() + "?" + request.getQueryString()); 
+        process(request, response);
+    }
+
+    @Override
+    protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+        LOG.info("http request from " + request.getRemoteAddr() + ": get  " + request.getServletPath() + "?" + request.getQueryString()); 
+        process(request, response);
+    }
+
+    private void process(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+        try {
+            final ServletRequestContext context = new ServletRequestContext(debugUsers);
+            context.startRequest(request, response, getServletContext());
+            dispatcher.process(context, request.getServletPath());
+        } catch (final RuntimeException e) {
+            LOG.error("servlet exception", e);
+            throw e;
+        }
+    }
+
+    @Override
+    public void init() throws ServletException {
+        super.init();
+
+        // TODO get directory from servlet parameter
+        ImageLookup.setImageDirectory(getServletContext(), "images");
+
+        debugUsers = new DebugUsers();
+        debugUsers.initialize();
+
+        dispatcher = new Dispatcher();
+        final Enumeration initParameterNames = getInitParameterNames();
+        while (initParameterNames.hasMoreElements()) {
+            final String name = (String) initParameterNames.nextElement();
+            final String value = getInitParameter(name);
+            dispatcher.addParameter(name, value);
+        }
+        final String dir = getServletContext().getRealPath("/WEB-INF");
+        dispatcher.init(dir, debugUsers);
+
+        new UserManager(IsisContext.getAuthenticationManager());
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java
new file mode 100644
index 0000000..39a703a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ImageLookup.java
@@ -0,0 +1,174 @@
+/*
+ *  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.servlet;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.ServletContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+/**
+ * ImageLookup provides an efficient way of finding the most suitable image to
+ * use. It ensures that an image is always available, providing a default image
+ * if needed. All requests are cached to improve performance.
+ */
+// TODO allow for multiple extension types
+public class ImageLookup {
+    private static final Logger LOG = LoggerFactory.getLogger(ImageLookup.class);
+    private static final String UNKNOWN_IMAGE = "Default";
+    private static final String[] EXTENSIONS = { "png", "gif", "jpg", "jpeg" };
+    private static final Map images = new HashMap();
+    private static String imageDirectory;
+    // private static String unknownImageFile;
+    private static ServletContext context;
+
+    public static void setImageDirectory(final ServletContext context, String imageDirectory) {
+        LOG.debug("image directory required for: " + imageDirectory);
+        ImageLookup.context = context;
+        imageDirectory = (imageDirectory.startsWith("/") ? "" : "/") + imageDirectory + "/";
+        final Set resourcePaths = context.getResourcePaths(imageDirectory);
+        if (resourcePaths == null || resourcePaths.size() == 0) {
+            //throw new IsisException("No image directory found: " + imageDirectory);
+            LOG.warn("No image directory found: " + imageDirectory);
+        }
+        LOG.info("image directory set to: " + imageDirectory);
+        ImageLookup.imageDirectory = imageDirectory;
+    }
+
+    public static void debug(final DebugString debug) {
+        debug.appendTitle("Image Lookup");
+        debug.indent();
+        final Iterator keys = images.keySet().iterator();
+        while (keys.hasNext()) {
+            final Object key = keys.next();
+            final Object value = images.get(key);
+            debug.appendln(key + " -> " + value);
+        }
+        debug.unindent();
+    }
+
+    private static String imageFile(final String imageName, final String contextPath) {
+        for (final String element : EXTENSIONS) {
+            URL resource;
+            try {
+                final String imagePath = imageDirectory + imageName + "." + element;
+                resource = context.getResource(imagePath);
+                if (resource != null) {
+                    LOG.debug("image found at " + contextPath + imagePath);
+                    return contextPath + imagePath;
+                }
+                final URL onClasspath = ImageLookup.class.getResource(imagePath);
+                if (onClasspath != null) {
+                    LOG.debug("image found on classpath " + onClasspath);
+                    return contextPath + imagePath;
+                }
+            } catch (final MalformedURLException ignore) {
+            }
+        }
+        return null;
+    }
+
+    private static String findImage(final ObjectSpecification specification, final String contextPath) {
+        String path = findImageFor(specification, contextPath);
+        if (path == null) {
+            path = imageFile(UNKNOWN_IMAGE, contextPath);
+        }
+        return path;
+    }
+
+    private static String findImageFor(final ObjectSpecification specification, final String contextPath) {
+        final String name = specification.getShortIdentifier();
+        final String fileName = imageFile(name, contextPath);
+        if (fileName != null) {
+            images.put(name, fileName);
+            return fileName;
+        } else {
+            for (final ObjectSpecification interfaceSpec : specification.interfaces()) {
+                final String path = findImageFor(interfaceSpec, contextPath);
+                if (path != null) {
+                    return path;
+                }
+            }
+            final ObjectSpecification superclass = specification.superclass();
+            if (superclass != null) {
+                return findImageFor(superclass, contextPath);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    /**
+     * For an object, the icon name from the object is return if it is not null,
+     * otherwise the specification is used to look up a suitable image name.
+     * 
+     * @param contextPath
+     * 
+     * @see ObjectAdapter#getIconName()
+     * @see #imagePath(ObjectSpecification)
+     */
+    /*
+     * public static String imagePath(ObjectAdapter object) { String iconName =
+     * object.getIconName(); if (iconName != null) { return imagePath(iconName);
+     * } else { return imagePath(object.getSpecification()); } }
+     */
+    public static String imagePath(final ObjectSpecification specification, final String contextPath) {
+        final String name = specification.getShortIdentifier();
+        final String imageName = (String) images.get(name);
+        if (imageName != null) {
+            return imageName;
+        } else {
+            return findImage(specification, contextPath);
+        }
+    }
+
+    /*
+     * public static String imagePath(String name) { String imageName = (String)
+     * images.get(name); if (imageName != null) { return (String) imageName; }
+     * else { String fileName = imageFile(name); return fileName == null ?
+     * unknownImageFile : fileName; } }
+     */
+
+    public static String imagePath(final ObjectAdapter object, final String contextPath) {
+        final String name = object.getIconName();
+        final String imageName = (String) images.get(name);
+        if (imageName != null) {
+            return imageName;
+        } else {
+            final String imageFile = imageFile(name, contextPath);
+            if (imageFile != null) {
+                return imageFile;
+            } else {
+                return findImage(object.getSpecification(), contextPath);
+            }
+        }
+    }
+}


[07/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
new file mode 100644
index 0000000..469b99d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
@@ -0,0 +1,262 @@
+/*
+ *  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.view.action;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.action.ActionAction;
+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.edit.FieldEditState;
+import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FieldFactory;
+import org.apache.isis.viewer.scimpi.dispatcher.view.edit.FormFieldBlock;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
+
+public class ActionForm extends AbstractElementProcessor {
+
+    // REVIEW: confirm this rendering context
+    private final static Where where = Where.OBJECT_FORMS;
+
+    @Override
+    public void process(final Request request) {
+        final CreateFormParameter parameters = new CreateFormParameter();
+        parameters.objectId = request.getOptionalProperty(OBJECT);
+        parameters.methodName = request.getRequiredProperty(METHOD);
+        parameters.forwardResultTo = request.getOptionalProperty(VIEW);
+        parameters.forwardVoidTo = request.getOptionalProperty(VOID);
+        parameters.forwardErrorTo = request.getOptionalProperty(ERROR);
+        parameters.cancelTo = request.getOptionalProperty(CANCEL_TO); 
+        parameters.showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
+        parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
+        parameters.formTitle = request.getOptionalProperty(FORM_TITLE);
+        parameters.labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
+        parameters.formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
+        parameters.resultName = request.getOptionalProperty(RESULT_NAME);
+        parameters.resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        parameters.scope = request.getOptionalProperty(SCOPE);
+        parameters.className = request.getOptionalProperty(CLASS, "action full");
+        parameters.showMessage = request.isRequested(SHOW_MESSAGE, false);
+        parameters.completionMessage = request.getOptionalProperty(MESSAGE);
+        parameters.id = request.getOptionalProperty(ID, parameters.methodName);
+        createForm(request, parameters);
+    }
+
+    public static void createForm(final Request request, final CreateFormParameter parameterObject) {
+        createForm(request, parameterObject, false);
+    }
+
+    protected static void createForm(final Request request, final CreateFormParameter parameterObject, final boolean withoutProcessing) {
+        final RequestContext context = request.getContext();
+        final ObjectAdapter object = MethodsUtils.findObject(context, parameterObject.objectId);
+        final String version = request.getContext().mapVersion(object);
+        final ObjectAction action = MethodsUtils.findAction(object, parameterObject.methodName);
+        // TODO how do we distinguish between overloaded methods?
+
+        // REVIEW Is this useful?
+        if (action.getParameterCount() == 0) {
+            throw new ScimpiException("Action form can only be used for actions with parameters");
+        }
+        if (parameterObject.showMessage && MethodsUtils.isVisible(object, action, where)) {
+            final String notUsable = MethodsUtils.isUsable(object, action, where);
+            if (notUsable != null) {
+                if (!withoutProcessing) {
+                    request.skipUntilClose();
+                }
+                request.appendHtml("<div class=\"" + parameterObject.className + "-message\" >");
+                request.appendAsHtmlEncoded(notUsable);
+                request.appendHtml("</div>");
+                return;
+            }
+        }
+        if (!MethodsUtils.isVisibleAndUsable(object, action, where)) {
+            if (!withoutProcessing) {
+                request.skipUntilClose();
+            }
+            return;
+        }
+        final String objectId = context.mapObject(object, Scope.INTERACTION);
+        final String errorView = context.fullFilePath(parameterObject.forwardErrorTo == null ? context.getResourceFile() : parameterObject.forwardErrorTo);
+        final String voidView = context.fullFilePath(parameterObject.forwardVoidTo == null ? context.getResourceFile() : parameterObject.forwardVoidTo);
+        if (false /* action.isContributed() && !action.hasReturn() && parameterObject.resultOverride == null */) {
+            parameterObject.resultOverride = objectId;
+        }
+        final HiddenInputField[] hiddenFields = new HiddenInputField[] { new HiddenInputField("_" + OBJECT, objectId), new HiddenInputField("_" + VERSION, version), new HiddenInputField("_" + FORM_ID, parameterObject.formId), new HiddenInputField("_" + METHOD, parameterObject.methodName),
+                parameterObject.forwardResultTo == null ? null : new HiddenInputField("_" + VIEW, context.fullFilePath(parameterObject.forwardResultTo)), new HiddenInputField("_" + VOID, voidView), new HiddenInputField("_" + ERROR, errorView),
+                parameterObject.completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, parameterObject.completionMessage), parameterObject.scope == null ? null : new HiddenInputField("_" + SCOPE, parameterObject.scope),
+                parameterObject.resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, parameterObject.resultOverride), parameterObject.resultName == null ? null : new HiddenInputField("_" + RESULT_NAME, parameterObject.resultName),
+                parameterObject.resultName == null ? null : new HiddenInputField(RequestContext.RESULT, (String) request.getContext().getVariable(RequestContext.RESULT)) };
+
+        // TODO when the block contains a selector tag it doesn't disable it if
+        // the field cannot be edited!!!
+        final FormFieldBlock containedBlock = new FormFieldBlock() {
+            @Override
+            public boolean isNullable(final String name) {
+                final int index = Integer.parseInt(name.substring(5)) - 1;
+                final ObjectActionParameter param = action.getParameters().get(index);
+                return param.isOptional();
+            }
+        };
+        request.setBlockContent(containedBlock);
+        if (!withoutProcessing) {
+            request.processUtilCloseTag();
+        }
+
+        final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
+
+        // TODO the list of included fields should be considered in the next
+        // method (see EditObject)
+        final InputField[] formFields = createFields(action, object);
+        containedBlock.hideExcludedParameters(formFields);
+        containedBlock.setUpValues(formFields);
+        initializeFields(context, object, action, formFields);
+        setDefaults(context, object, action, formFields, entryState, parameterObject.showIcon);
+        String errors = null;
+        if (entryState != null && entryState.isForForm(parameterObject.formId)) {
+            copyEntryState(context, object, action, formFields, entryState);
+            errors = entryState.getError();
+        }
+        overrideWithHtml(context, containedBlock, formFields);
+
+        String formTitle;
+        if (parameterObject.formTitle == null) {
+            formTitle = action.getName();
+        } else {
+            formTitle = parameterObject.formTitle;
+        }
+
+        String buttonTitle = parameterObject.buttonTitle;
+        if (buttonTitle == null) {
+            buttonTitle = action.getName();
+        } else if (buttonTitle.equals("")) {
+            buttonTitle = "Ok";
+        }
+
+        HtmlFormBuilder.createForm(request, ActionAction.ACTION + ".app", hiddenFields, formFields, parameterObject.className,
+                parameterObject.id, formTitle, parameterObject.labelDelimiter, action.getDescription(), action.getHelp(), buttonTitle, errors, parameterObject.cancelTo);
+
+        request.popBlockContent();
+    }
+
+    private static InputField[] createFields(final ObjectAction action, final ObjectAdapter object) {
+        final int parameterCount = action.getParameterCount();
+        final InputField[] fields = new InputField[parameterCount];
+        for (int i = 0; i < fields.length; i++) {
+            fields[i] = new InputField(ActionAction.parameterName(i));
+        }
+        return fields;
+    }
+
+    private static void initializeFields(final RequestContext context, final ObjectAdapter object, final ObjectAction action, final InputField[] fields) {
+        final List<ObjectActionParameter> parameters = action.getParameters();
+        for (int i = 0; i < fields.length; i++) {
+            final InputField field = fields[i];
+            final ObjectActionParameter param = parameters.get(i);
+            if (false /*action.isContributed() && i == 0*/) {
+                // fields[i].setValue(context.mapObject(object,
+                // Scope.INTERACTION));
+                fields[i].setType(InputField.REFERENCE);
+                fields[i].setHidden(true);
+            } else {
+
+                fields[i].setHelpReference("xxxhelp");
+                final ObjectAdapter[] optionsForParameter = action.getChoices(object)[i];
+                FieldFactory.initializeField(context, object, param, optionsForParameter, !param.isOptional(), field);
+            }
+        }
+    }
+
+    /**
+     * Sets up the fields with their initial values
+     * 
+     * @param showIcon
+     */
+    private static void setDefaults(final RequestContext context, final ObjectAdapter object, final ObjectAction action, final InputField[] fields, final FormState entryState, final boolean showIcon) {
+        final ObjectAdapter[] defaultValues = action.getDefaults(object);
+        if (defaultValues == null) {
+            return;
+        }
+
+        for (int i = 0; i < fields.length; i++) {
+            final InputField field = fields[i];
+            final ObjectAdapter defaultValue = defaultValues[i];
+
+            final String title = defaultValue == null ? "" : defaultValue.titleString();
+            if (field.getType() == InputField.REFERENCE) {
+                final ObjectSpecification objectSpecification = action.getParameters().get(i).getSpecification();
+                if (defaultValue != null) {
+                    final String imageSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
+                    final String html = imageSegment + title;
+                    final String value = context.mapObject(defaultValue, Scope.INTERACTION);
+                    field.setValue(value);
+                    field.setHtml(html);
+                }
+            } else {
+                field.setValue(title);
+            }
+        }
+    }
+
+    private static void copyEntryState(final RequestContext context, final ObjectAdapter object, final ObjectAction action, final InputField[] fields, final FormState entryState) {
+
+        for (final InputField field : fields) {
+            final FieldEditState fieldState = entryState.getField(field.getName());
+            if (fieldState != null) {
+                if (field.isEditable()) {
+                    String entry;
+                    entry = fieldState.getEntry();
+                    field.setValue(entry);
+                }
+
+                field.setErrorText(fieldState.getError());
+            }
+        }
+    }
+
+    private static void overrideWithHtml(final RequestContext context, final FormFieldBlock containedBlock, final InputField[] formFields) {
+        for (int i = 0; i < formFields.length; i++) {
+            final String id = ActionAction.parameterName(i);
+            if (containedBlock.hasContent(id)) {
+                final String content = containedBlock.getContent(id);
+                if (content != null) {
+                    formFields[i].setHtml(content);
+                    formFields[i].setType(InputField.HTML);
+                }
+            }
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "action-form";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java
new file mode 100644
index 0000000..520e2bc
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionLink.java
@@ -0,0 +1,179 @@
+/*
+ *  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.view.action;
+
+import java.net.URLEncoder;
+
+import org.apache.commons.lang.StringEscapeUtils;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
+
+public class ActionLink extends AbstractElementProcessor {
+
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORMS;
+
+    @Override
+    public void process(final Request request) {
+        String objectId = request.getOptionalProperty(OBJECT);
+        final String method = request.getOptionalProperty(METHOD);
+        final String forwardResultTo = request.getOptionalProperty(VIEW);
+        final String forwardVoidTo = request.getOptionalProperty(VOID);
+        String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        
+        final String resultName = request.getOptionalProperty(RESULT_NAME);
+        final String resultNameSegment = resultName == null ? "" : "&amp;" + RESULT_NAME + "=" + resultName;
+        final String scope = request.getOptionalProperty(SCOPE);
+        final String scopeSegment = scope == null ? "" : "&amp;" + SCOPE + "=" + scope;
+        final String confirm = request.getOptionalProperty(CONFIRM);
+        final String completionMessage = request.getOptionalProperty(MESSAGE);
+        final String idName = request.getOptionalProperty(ID, method);
+        final String className = request.getOptionalProperty(CLASS);
+
+        
+        // TODO need a mechanism for globally dealing with encoding; then use
+        // the new encode method
+        final String confirmSegment = confirm == null ? "" : "&amp;" + "_" + CONFIRM + "=" + URLEncoder.encode(confirm);
+        final String messageSegment = completionMessage == null ? "" : "&amp;" + "_" + MESSAGE + "=" + URLEncoder.encode(completionMessage);
+
+        final RequestContext context = request.getContext();
+        final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
+        final String version = context.mapVersion(object);
+        final ObjectAction action = MethodsUtils.findAction(object, method);
+
+        final ActionContent parameterBlock = new ActionContent(action);
+        request.setBlockContent(parameterBlock);
+        request.pushNewBuffer();
+        request.processUtilCloseTag();
+        final String text = request.popBuffer();
+        
+        final String[] parameters = parameterBlock.getParameters();
+        final String target;
+        /*
+        if (action.isContributed()) {
+            System.arraycopy(parameters, 0, parameters, 1, parameters.length - 1);
+            parameters[0] = request.getContext().mapObject(object, Scope.REQUEST);
+            target =  request.getContext().mapObject(action.realTarget(object), Scope.REQUEST);
+            if (!action.hasReturn() && resultOverride == null) {
+                resultOverride = parameters[0];
+            }
+        } else {
+            target =  StringEscapeUtils.escapeHtml(request.getContext().mapObject(object, Scope.INTERACTION));
+        }
+         */
+        
+        final ObjectAdapter[] objectParameters;
+        
+        // TODO copied from ActionButton
+        //final ObjectAdapter target;
+        if (false /*action.isContributed() */) {
+//            objectParameters= null;
+//            System.arraycopy(parameters, 0, parameters, 1, parameters.length - 1);
+//            parameters[0] = request.getContext().mapObject(object, Scope.REQUEST);
+//            target =  request.getContext().mapObject(action.realTarget(object), Scope.REQUEST);
+//            if (!action.hasReturn() && resultOverride == null) {
+//                resultOverride = parameters[0];
+//            }
+        } else {
+            objectParameters = new ObjectAdapter[parameters.length];
+            // target = object;
+            target =  StringEscapeUtils.escapeHtml(request.getContext().mapObject(object, Scope.INTERACTION));
+            int i = 0;
+            for (final ObjectActionParameter spec : action.getParameters()) {
+                final ObjectSpecification type = spec.getSpecification();
+                if (parameters[i] == null) {
+                    objectParameters[i] = null;
+                } else if (type.getFacet(ParseableFacet.class) != null) {
+                    final ParseableFacet facet = type.getFacet(ParseableFacet.class);
+                    Localization localization = IsisContext.getLocalization(); 
+                    objectParameters[i] = facet.parseTextEntry(null, parameters[i], localization); 
+                } else {
+                    objectParameters[i] = MethodsUtils.findObject(request.getContext(), parameters[i]);
+                }
+                i++;
+            }
+        }
+
+        if (MethodsUtils.isVisibleAndUsable(object, action, where)  && MethodsUtils.canRunMethod(object, action, objectParameters).isAllowed()) {
+            writeLink(request, idName, className, target, version, method, forwardResultTo, forwardVoidTo, resultNameSegment, resultOverride, scopeSegment,
+                    confirmSegment, messageSegment, context, action, parameters, text);
+        }
+        request.popBlockContent();
+    }
+
+    public static void writeLink(
+            final Request request,
+            final String idName,
+            final String className,
+            final String objectId,
+            final String version,
+            final String method,
+            final String forwardResultTo,
+            final String forwardVoidTo,
+            final String resultNameSegment,
+            final String resultOverride,
+            final String scopeSegment,
+            final String confirmSegment,
+            final String messageSegment,
+            final RequestContext context,
+            final ObjectAction action,
+            final String[] parameters,
+            String text) {
+        text = text == null || text.trim().equals("") ? action.getName() : text;
+
+        String parameterSegment = "";
+        for (int i = 0; i < parameters.length; i++) {
+            parameterSegment += "&param" + (i + 1) + "=" + parameters[i];
+        }
+
+        final String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
+        final String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
+        final String interactionParamters = context.encodedInteractionParameters();
+        final String forwardResultSegment = forwardResultTo == null ? "" : "&amp;" + "_" + VIEW + "=" + context.fullFilePath(forwardResultTo);
+        final String resultOverrideSegment = resultOverride == null ? "" : "&amp;" + "_" + RESULT_OVERRIDE + "=" + resultOverride;
+        final String voidView = context.fullFilePath(forwardVoidTo == null ? context.getResourceFile() : forwardVoidTo);
+        final String forwardVoidSegment = "&amp;" + "_" + VOID + "=" + voidView;
+        request.appendHtml("<a " + idSegment + classSegment + " href=\"action.app?" + "_" + OBJECT + "=" + objectId + "&amp;" + "_" + VERSION + "=" + version
+                + "&amp;" + "_" + METHOD + "=" + method + resultOverrideSegment + forwardResultSegment + forwardVoidSegment + resultNameSegment
+                + parameterSegment + scopeSegment + confirmSegment + messageSegment + interactionParamters + "\">");
+        request.appendHtml(text);
+        request.appendHtml("</a>");
+        HelpLink.append(request, action.getDescription(), action.getHelp());
+    }
+
+    @Override
+    public String getName() {
+        return "action-link";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
new file mode 100644
index 0000000..2628449
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
@@ -0,0 +1,43 @@
+/*
+ *  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.view.action;
+
+public class CreateFormParameter {
+    public String methodName;
+    public String forwardResultTo;
+    public String forwardVoidTo;
+    public String forwardErrorTo;
+    public String buttonTitle;
+    public String formTitle;
+    public String formId;
+    public String resultName;
+    public String scope;
+    public String objectId;
+    public String description;
+    public String helpReference;
+    public String className;
+    public String id;
+    public String resultOverride;
+    public boolean showMessage;
+    public boolean showIcon;
+    public String completionMessage;
+    public String cancelTo;
+    public String labelDelimiter;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java
new file mode 100644
index 0000000..21cff4e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Methods.java
@@ -0,0 +1,192 @@
+/*
+ *  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.view.action;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
+
+public class Methods extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final static Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        String objectId = request.getOptionalProperty(OBJECT);
+        final String view = request.getOptionalProperty(VIEW, "_generic_action." + Dispatcher.EXTENSION);
+        final String cancelTo = request.getOptionalProperty(CANCEL_TO);
+        final boolean showForms = request.isRequested(FORMS, false);
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+        if (objectId == null) {
+            objectId = request.getContext().mapObject(object, null);
+        }
+
+        final InclusionList inclusionList = new InclusionList();
+        request.setBlockContent(inclusionList);
+        request.processUtilCloseTag();
+
+        request.appendHtml("<div class=\"actions\">");
+        if (inclusionList.includes("edit") && !object.getSpecification().isService()) {
+            request.appendHtml("<div class=\"action\">");
+            request.appendHtml("<a class=\"button\" href=\"_generic_edit." + Dispatcher.EXTENSION + "?_result=" + objectId + "\">Edit...</a>");
+            request.appendHtml("</div>");
+        }
+        writeMethods(request, objectId, object, showForms, inclusionList, view, "_generic.shtml?_result=" + objectId);
+        request.popBlockContent();
+        request.appendHtml("</div>");
+    }
+
+    public static void writeMethods(
+            final Request request,
+            final String objectId,
+            final ObjectAdapter adapter,
+            final boolean showForms,
+            final InclusionList inclusionList,
+            final String view,
+            final String cancelTo) {
+        List<ObjectAction> actions = adapter.getSpecification().getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
+        writeMethods(request, adapter, actions, objectId, showForms, inclusionList, view, cancelTo);
+        // TODO determine if system is set up to display exploration methods
+        if (true) {
+            actions = adapter.getSpecification().getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            writeMethods(request, adapter, actions, objectId, showForms, inclusionList, view, cancelTo);
+        }
+        // TODO determine if system is set up to display debug methods
+        if (true) {
+            actions = adapter.getSpecification().getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            writeMethods(request, adapter, actions, objectId, showForms, inclusionList, view, cancelTo);
+        }
+    }
+
+    private static void writeMethods(
+            final Request request,
+            final ObjectAdapter adapter,
+            List<ObjectAction> actions,
+            final String objectId,
+            final boolean showForms,
+            final InclusionList inclusionList,
+            final String view,
+            final String cancelTo) {
+        actions = inclusionList.includedActions(actions);
+        for (int j = 0; j < actions.size(); j++) {
+            final ObjectAction action = actions.get(j);
+            if (false /* action instanceof ObjectActionSet */) {
+//                request.appendHtml("<div class=\"actions\">");
+//                writeMethods(request, adapter, action.getActions(), objectId, showForms, inclusionList, view, cancelTo);
+//                request.appendHtml("</div>");
+            } else if (false /*action.isContributed()*/) {
+//                if (action.getParameterCount() == 1 && adapter.getSpecification().isOfType(action.getParameters().get(0).getSpecification())) {
+//                    if (objectId != null) {
+//                        final ObjectAdapter target = request.getContext().getMappedObject(objectId);
+//                        final ObjectAdapter realTarget = action.realTarget(target);
+//                        final String realTargetId = request.getContext().mapObject(realTarget, Scope.INTERACTION);
+//                        writeMethod(request, adapter, new String[] { objectId }, action, realTargetId, showForms, view, cancelTo);
+//                    } else {
+//                        request.appendHtml("<div class=\"action\">");
+//                        request.appendAsHtmlEncoded(action.getName());
+//                        request.appendHtml("???</div>");
+//                    }
+//                } else if (!adapter.getSpecification().isService()) {
+//                    writeMethod(request, adapter, new String[0], action, objectId, showForms, view, cancelTo);
+//                }
+            } else {
+                writeMethod(request, adapter, new String[0], action, objectId, showForms, view, cancelTo);
+            }
+        }
+    }
+
+    private static void writeMethod(
+            final Request request,
+            final ObjectAdapter adapter,
+            final String[] parameters,
+            final ObjectAction action,
+            final String objectId,
+            final boolean showForms,
+            final String view,
+            final String cancelTo) {
+        // if (action.isVisible(IsisContext.getSession(), null) &&
+        // action.isVisible(IsisContext.getSession(), adapter))
+        // {
+        if (action.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isAllowed()) {
+            request.appendHtml("<div class=\"action\">");
+            if (IsisContext.getSession() == null) {
+                request.appendHtml("<span class=\"disabled\" title=\"no user logged in\">");
+                request.appendAsHtmlEncoded(action.getName());
+                request.appendHtml("</span>");
+                /*
+                 * } else if (action.isUsable(IsisContext.getSession(),
+                 * null).isVetoed()) {
+                 * request.appendHtml("<span class=\"disabled\" title=\"" +
+                 * action.isUsable(IsisContext.getSession(), null).getReason() +
+                 * "\">"); request.appendHtml(action.getName());
+                 * request.appendHtml("</span>");
+                 */} else if (action.isUsable(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
+                request.appendHtml("<span class=\"disabled\" title=\"" + action.isUsable(IsisContext.getAuthenticationSession(), adapter, where).getReason() + "\">");
+                request.appendAsHtmlEncoded(action.getName());
+                request.appendHtml("</span>");
+            } else {
+                final String version = request.getContext().mapVersion(adapter);
+                if (action.getParameterCount() == 0 || (false /*action.isContributed() && action.getParameterCount() == 1*/ )) {
+                    ActionButton.write(request, adapter, action, parameters, version, "_generic." + Dispatcher.EXTENSION, null, null, null, null, null, null, null, null, null);
+                } else if (showForms) {
+                    final CreateFormParameter params = new CreateFormParameter();
+                    params.objectId = objectId;
+                    params.methodName = action.getId();
+                    params.forwardResultTo = "_generic." + Dispatcher.EXTENSION;
+                    params.buttonTitle = "OK";
+                    params.formTitle = action.getName();
+                    ActionForm.createForm(request, params, true);
+                } else {
+                    request.appendHtml("<a class=\"button\" href=\"" + view + "?_result=" + objectId + "&amp;_" + VERSION + "=" + version + "&amp;_" + METHOD + "=" + action.getId());
+                    if (cancelTo != null) {
+                        request.appendHtml("&amp;_cancel-to=");
+                        request.appendAsHtmlEncoded("cancel-to=\"" + cancelTo + "\"");
+                    }
+                    request.appendHtml("\" title=\"" + action.getDescription() + "\">");
+                    request.appendAsHtmlEncoded(action.getName() + "...");
+                    request.appendHtml("</a>");
+                }
+            }
+            request.appendHtml("</div>");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "methods";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java
new file mode 100644
index 0000000..69be5c5
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Parameter.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher.view.action;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
+import org.apache.isis.viewer.scimpi.dispatcher.TagOrderException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Parameter extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final BlockContent blockContent = request.getBlockContent();
+        if (!(blockContent instanceof ActionContent)) {
+            throw new TagOrderException(request);
+        }
+
+        final String field = request.getOptionalProperty(PARAMETER_NUMBER);
+        final String value = request.getRequiredProperty(VALUE);
+        final ActionContent block = (ActionContent) blockContent;
+        block.setParameter(field, value);
+    }
+
+    @Override
+    public String getName() {
+        return "parameter";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
new file mode 100644
index 0000000..9610457
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
@@ -0,0 +1,87 @@
+/*
+ *  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.view.action;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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 org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+public class RunAction extends AbstractElementProcessor {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
+
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
+
+        final String methodName = request.getRequiredProperty(METHOD);
+        final ObjectAction action = MethodsUtils.findAction(object, methodName);
+
+        final String variableName = request.getOptionalProperty(RESULT_NAME);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+
+        final ActionContent parameterBlock = new ActionContent(action);
+        request.setBlockContent(parameterBlock);
+        request.processUtilCloseTag();
+        final ObjectAdapter[] parameters = parameterBlock.getParameters(request);
+
+        if (!MethodsUtils.isVisibleAndUsable(object, action, where)) {
+            throw new ForbiddenException(action, ForbiddenException.VISIBLE_AND_USABLE);
+        }
+
+        // swap null parameter of the object's type to run a contributed method
+        if (false /*action.isContributed()*/) {
+            final List<ObjectActionParameter> parameterSpecs = action.getParameters();
+            for (int i = 0; i < parameters.length; i++) {
+                if (parameters[i] == null && object.getSpecification().isOfType(parameterSpecs.get(i).getSpecification())) {
+                    parameters[i] = object;
+                    break;
+                }
+            }
+        }
+
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+        MethodsUtils.runMethod(context, action, object, parameters, variableName, scope);
+        request.popBlockContent();
+    }
+
+    @Override
+    public String getName() {
+        return "run-action";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java
new file mode 100644
index 0000000..2a621f1
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/Services.java
@@ -0,0 +1,67 @@
+/*
+ *  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.view.action;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
+
+public class Services extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final boolean showForms = request.isRequested(FORMS, false);
+        final String view = request.getOptionalProperty(VIEW, "_generic_action." + Dispatcher.EXTENSION);
+        final String cancelTo = request.getOptionalProperty(CANCEL_TO);
+
+        final InclusionList inclusionList = new InclusionList();
+        request.setBlockContent(inclusionList);
+        request.processUtilCloseTag();
+
+        final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
+        for (final ObjectAdapter adapter : serviceAdapters) {
+            final String serviceId = request.getContext().mapObject(adapter, Scope.REQUEST);
+            request.appendHtml("<div class=\"actions\">");
+            request.appendHtml("<h3>");
+            request.appendAsHtmlEncoded(adapter.titleString());
+            request.appendHtml("</h3>");
+            Methods.writeMethods(request, serviceId, adapter, showForms, inclusionList, view, cancelTo);
+            request.appendHtml("</div>");
+        }
+        request.popBlockContent();
+    }
+
+    @Override
+    public String getName() {
+        return "services";
+    }
+
+    private static PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
new file mode 100644
index 0000000..1002c9f
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
@@ -0,0 +1,93 @@
+/*
+ *  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.view.collection;
+
+import java.util.Iterator;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
+
+public class Collection extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
+
+        ObjectAdapter collection;
+
+        final String field = request.getOptionalProperty(FIELD);
+        if (field != null) {
+            final String id = request.getOptionalProperty(OBJECT);
+            final ObjectAdapter object = context.getMappedObjectOrResult(id);
+            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
+            if (!objectField.isOneToManyAssociation()) {
+                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
+            }
+            ResolveFieldUtil.resolveField(object, objectField);
+            collection = objectField.get(object);
+        } else {
+            final String id = request.getOptionalProperty(COLLECTION);
+            collection = context.getMappedObjectOrResult(id);
+        }
+
+        final RepeatMarker marker = request.createMarker();
+
+        final String variable = request.getOptionalProperty(ELEMENT_NAME);
+        final String scopeName = request.getOptionalProperty(SCOPE);
+        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
+        final String rowClassesList = request.getOptionalProperty(ROW_CLASSES, ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
+        String[] rowClasses = new String[0];
+        if (rowClassesList != null) {
+            rowClasses = rowClassesList.split("[,|/]");
+        }
+
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+        if (facet.size(collection) == 0) {
+            request.skipUntilClose();
+        } else {
+            final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+            int row = 0;
+            while (iterator.hasNext()) {
+                final ObjectAdapter element = iterator.next();
+                context.addVariable("row", "" + (row + 1), Scope.REQUEST);
+                if (rowClassesList != null) {
+                    context.addVariable("row-class", rowClasses[row % rowClasses.length], Scope.REQUEST);
+                }
+                context.addVariable(variable, context.mapObject(element, scope), scope);
+                marker.repeat();
+                request.processUtilCloseTag();
+                row++;
+            }
+        }
+    }
+
+    @Override
+    public String getName() {
+        return COLLECTION;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
new file mode 100644
index 0000000..c1a01b4
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
@@ -0,0 +1,479 @@
+/*
+ *  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.view.debug;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.debug.DebugHtmlString;
+import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.commons.debug.DebuggableWithTitle;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.util.Dump;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Debug extends AbstractElementProcessor {
+
+    private final Dispatcher dispatcher;
+
+    public Debug(final Dispatcher dispatcher) {
+        this.dispatcher = dispatcher;
+    }
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            return;
+        }
+        
+        final String type = request.getOptionalProperty(TYPE);
+
+        final boolean alwaysShow = request.isRequested("force", false);
+        if (type != null) {
+            if (type.equals("system")) {
+                displaySystem(request);
+            } else if (type.equals("session")) {
+                displaySession(request);
+            } else if (type.equals("test")) {
+                final DebugBuilder debug = new DebugHtmlString();
+                debug.appendTitle("Title");
+                debug.appendln("boolean", true);
+                debug.appendln("number", 213);
+                debug.startSection("Section 1");
+                debug.appendln("boolean", false);
+                debug.appendln("number", 12348);
+                debug.endSection();
+                debug.startSection("Section 2");
+                debug.appendln("boolean", false);
+                debug.appendln("number", 12348);
+                debug.appendTitle("Another title");
+                debug.appendln("boolean", false);
+                debug.appendln("number", 12348);
+                debug.endSection();
+
+                debug.startSection("Section 3");
+                debug.appendln("boolean", false);
+                debug.appendln("number", 89878);
+                debug.endSection();
+                debug.startSection("Subsection 2");
+                debug.appendln("boolean", false);
+                debug.appendln("number", 12348);
+                debug.endSection();
+
+                debug.startSection("Section 4");
+                debug.appendln("boolean", false);
+                debug.indent();
+                debug.appendln("boolean", false);
+                debug.appendln("number", 12348);
+                debug.unindent();
+                debug.appendln("number", 12348);
+                debug.appendPreformatted("code", "line 1\nline 2\nline 3");
+                debug.appendln("A lot of text etc.");
+                debug.endSection();
+
+                request.appendHtml(debug.toString());
+                //request.appendHtml("<pre>" + debug.toString() + "</pre>");
+                
+                debug.close();
+                
+            } else if (type.equals("variables")) {
+                displayVariables(request);
+            } else if (type.equals("dispatcher")) {
+                displayDispatcher(request);
+            } else if (type.equals("context")) {
+                displayContext(request);
+            } else if (type.equals("specifications")) {
+                listSpecifications(request);
+            } else if (type.equals("specification-for")) {
+                specificationFor(request);
+            } else if (type.equals("specification")) {
+                specification(request);
+            } else if (type.equals("specification-graph")) {
+                specificationGraph(request);
+            } else if (type.equals("object-graph")) {
+                objectGraph(request);
+
+            } else if (type.equals("object")) {
+                final String value = request.getOptionalProperty(VALUE);
+                final RequestContext context = request.getContext();
+                final ObjectAdapter object = context.getMappedObject(value);
+                final DebugString str = new DebugString();
+                Dump.adapter(object, str);
+                Dump.graph(object, IsisContext.getAuthenticationSession(), str);
+                request.appendHtml("<h2>" + object.getSpecification().getFullIdentifier() + "</h2>");
+                request.appendHtml("<pre class=\"debug\">" + str + "</pre>");
+            }
+
+        }
+
+        if (alwaysShow || request.getContext().getDebug() == RequestContext.Debug.ON) {
+
+            final RequestContext context = request.getContext();
+
+            final String id = request.getOptionalProperty("object");
+            if (id != null) {
+                final ObjectAdapter object = context.getMappedObject(id);
+                if (object instanceof DebuggableWithTitle) {
+                    final DebugString debug = new DebugString();
+                    ((DebuggableWithTitle) object).debugData(debug);
+                    request.appendHtml("<pre class=\"debug\">" + debug + "</pre>");
+                } else {
+                    request.appendHtml(object.toString());
+                }
+            }
+
+            final String variable = request.getOptionalProperty("variable");
+            if (variable != null) {
+                final Object object = context.getVariable(variable);
+                request.appendHtml(variable + " => " + (object == null ? "null" : object.toString()));
+            }
+
+            final String list = request.getOptionalProperty("list");
+            if (list != null) {
+                final DebugString debug = new DebugString();
+                context.append(debug, list);
+                request.appendHtml(debug.toString());
+            }
+
+            final String uri = request.getOptionalProperty("uri");
+            if (uri != null) {
+                request.appendHtml("<pre class=\"debug\">");
+                request.appendHtml(context.getUri());
+                request.appendHtml("</pre>");
+            }
+
+        }
+    }
+
+    protected void objectGraph(final Request request) {
+        final String id = request.getOptionalProperty(VALUE);
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        request.appendHtml("<h1>Object Graph - " + object + "</h1>");
+        request.appendHtml("<pre>");
+        final DebugBuilder debug = new DebugString();
+        Dump.graph(object, null, debug);
+        request.appendHtml(debug.toString());
+        request.appendHtml("</pre>");
+    }
+
+    protected void specificationFor(final Request request) {
+        final String id = request.getOptionalProperty(VALUE);
+        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
+        specification(request, object.getSpecification());
+    }
+
+    protected void specification(final Request request) {
+        final String name = request.getOptionalProperty(VALUE);
+        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
+        specification(request, spec);
+    }
+
+    private void specification(final Request request, final ObjectSpecification spec) {
+        request.appendHtml("<h1>Specification - " + spec.getFullIdentifier() + "</h1>");
+        request.appendHtml("<p><a href=\"./debug.shtml?type=specification-graph&value=" + spec.getFullIdentifier() + "\">Specification Graph</a></p>");
+        final DebugBuilder debug = new DebugHtmlString();
+        specification(spec, debug);
+        request.appendHtml(debug.toString());
+    }
+
+    protected void specificationGraph(final Request request) {
+        final String name = request.getOptionalProperty(VALUE);
+        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
+        request.appendHtml("<h1>Specification Graph - " + spec.getFullIdentifier() + "</h1>");
+        request.appendHtml("<p><a href=\"./debug.shtml?type=specification&value=" + spec.getFullIdentifier() + "\">Full Specification</a></p>");
+        request.appendHtml("<pre>");
+        final DebugBuilder debug = new DebugString();
+        debug.appendln(spec.getFullIdentifier());
+        debug.indent();
+        specificationGraph(spec, debug, new ArrayList<ObjectSpecification>());
+        debug.unindent();
+        request.appendHtml(debug.toString());
+        request.appendHtml("</pre>");
+    }
+
+    private void displayContext(final Request request) {
+        request.appendHtml("<h1>Context</h1>");
+        final DebugHtmlString debugString = new DebugHtmlString();
+        request.getContext().append(debugString);
+        debugString.close();
+        request.appendHtml(debugString.toString());
+    }
+
+    private void displayDispatcher(final Request request) {
+        request.appendHtml("<h1>Dispatcher</h1>");
+        final DebugHtmlString debugString = new DebugHtmlString();
+        dispatcher.debug(debugString);
+        debugString.close();
+        request.appendHtml(debugString.toString());
+    }
+
+    protected void displayVariables(final Request request) {
+        request.appendHtml("<h1>Variables</h1>");
+        final DebugHtmlString debug = new DebugHtmlString();
+        final RequestContext context = request.getContext();
+        context.append(debug, "variables");
+        debug.close();
+        request.appendHtml(debug.toString());
+    }
+
+    protected void displaySystem(final Request request) {
+        request.appendHtml("<h1>System</h1>");
+        final DebuggableWithTitle[] debugItems = IsisContext.debugSystem();
+        for (final DebuggableWithTitle debug : debugItems) {
+            final DebugHtmlString debugBuffer = new DebugHtmlString();
+            debugBuffer.startSection(debug.debugTitle());
+            debug.debugData(debugBuffer);
+            debugBuffer.endSection();
+            debugBuffer.close();
+            request.appendHtml(debugBuffer.toString());
+        }
+    }
+
+    protected void displaySession(final Request request) {
+        request.appendHtml("<h1>Session</h1>");
+        final DebuggableWithTitle[] debugItems = IsisContext.debugSession();
+        for (final DebuggableWithTitle debug : debugItems) {
+            final DebugHtmlString debugBuffer = new DebugHtmlString();
+            debugBuffer.startSection(debug.debugTitle());
+            debug.debugData(debugBuffer);
+            debugBuffer.endSection();
+            debugBuffer.close();
+            request.appendHtml(debugBuffer.toString());
+        }
+    }
+
+    protected void listSpecifications(final Request request) {
+        request.appendHtml("<h1>Specifications</h1>");
+        final List<ObjectSpecification> fullIdentifierList = new ArrayList<ObjectSpecification>(getSpecificationLoader().allSpecifications());
+        Collections.sort(fullIdentifierList, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
+        final DebugHtmlString debug = new DebugHtmlString();
+        for (final ObjectSpecification spec : fullIdentifierList) {
+            final String name = spec.getSingularName();
+            debug.appendln(name, specificationLink(spec));
+        }
+        debug.close();
+        request.appendHtml(debug.toString());
+    }
+
+    private String specificationLink(final ObjectSpecification specification) {
+        if (specification == null) {
+            return "none";
+        } else {
+            final String name = specification.getFullIdentifier();
+            return "<a href=\"./debug.shtml?type=specification&value=" + name + "\">" + name + "</a>";
+        }
+    }
+
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    @Override
+    public String getName() {
+        return "debug";
+    }
+
+    private void specificationGraph(final ObjectSpecification spec, final DebugBuilder view, final ArrayList<ObjectSpecification> visited) {
+        final List<ObjectAssociation> fields = new ArrayList<ObjectAssociation>(spec.getAssociations(Contributed.EXCLUDED));
+        Collections.sort(fields, new Comparator<ObjectAssociation>() {
+            @Override
+            public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
+                return o1.getName().compareTo(o2.getName());
+            }
+        });
+        for (int i = 0; i < fields.size(); i++) {
+            final ObjectAssociation field = fields.get(i);
+            final ObjectSpecification specification = field.getSpecification();
+            if (!specification.isValue()) {
+                final boolean contains = visited.contains(specification);
+                final String aggregated = specification.isParented() ? "++" : "";
+                view.appendln(aggregated + field.getName() + "  (<a href=\"./debug.shtml?type=specification-graph&value=" + specification.getFullIdentifier() + "\">" + specification.getFullIdentifier() + "</a>" + (contains ? "..." : "") + ")");
+                if (!contains) {
+                    visited.add(specification);
+                    view.indent();
+                    specificationGraph(specification, view, visited);
+                    view.unindent();
+                }
+            }
+        }
+
+    }
+
+    private void specification(final ObjectSpecification spec, final DebugBuilder view) {
+        view.startSection("Summary");
+        view.appendln("Hash code", "#" + Integer.toHexString(spec.hashCode()));
+        view.appendln("ID", spec.getIdentifier());
+        view.appendln("Full name", spec.getFullIdentifier());
+        view.appendln("Short name", spec.getShortIdentifier());
+        view.appendln("Singular name", spec.getSingularName());
+        view.appendln("Plural name", spec.getPluralName());
+        view.appendln("Description", spec.getDescription());
+
+        view.appendln("Type", "?");
+        view.appendln("Value/aggregated", String.valueOf(!spec.isValueOrIsParented()));
+
+        view.appendln("Parent specification", specificationLink(spec.superclass()));
+        specificationClasses(view, "Child specifications", spec.subclasses());
+        specificationClasses(view, "Implemented interfaces", spec.interfaces());
+        speficationFacets(view, spec);
+
+        final List<ObjectAssociation> fields = spec.getAssociations(Contributed.EXCLUDED);
+        specificationMembers(view, "Fields", fields);
+        final List<ObjectAction> userActions = spec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
+        specificationMembers(view, "User Actions", userActions);
+        specificationMembers(view, "Exploration Actions", spec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any()));
+        specificationMembers(view, "Prototype Actions", spec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any()));
+        specificationMembers(view, "Debug Actions", spec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any()));
+        view.endSection();
+
+        view.startSection("Fields");
+        for (int i = 0; i < fields.size(); i++) {
+            final ObjectAssociation field = fields.get(i);
+            view.appendTitle("<span id=\"" + field.getId() + "\"><em>Field:</em> " + field.getId() + "</span>");
+            view.appendln("ID", field.getIdentifier());
+            view.appendln("Short ID", field.getId());
+            view.appendln("Name", field.getName());
+            view.appendln("Specification", specificationLink(field.getSpecification()));
+
+            view.appendln("Type", field.isOneToManyAssociation() ? "Collection" : field.isOneToOneAssociation() ? "Object" : "Unknown");
+            view.appendln("Flags", (field.isAlwaysHidden() ? "" : "Visible ") + (field.isNotPersisted() ? "Not-Persisted " : " ") + (field.isMandatory() ? "Mandatory " : ""));
+
+            speficationFacets(view, field);
+        }
+        view.endSection();
+
+        view.startSection("Actions");
+        for (int i = 0; i < userActions.size(); i++) {
+            final ObjectAction action = userActions.get(i);
+            view.appendTitle("<span id=\"" + action.getId() + "\"><em>Action:</em> " + action.getId() + "</span>");
+            view.appendln("ID", action.getIdentifier());
+            view.appendln("Short ID", action.getId());
+            view.appendln("Name", action.getName());
+            view.appendln("Specification", specificationLink(action.getSpecification()));
+
+            view.appendln("On type", specificationLink(action.getOnType()));
+
+            final ObjectSpecification returnType = action.getReturnType();
+            view.appendln("Returns", returnType == null ? "VOID" : specificationLink(returnType));
+
+            speficationFacets(view, action);
+
+            final List<ObjectActionParameter> parameters = action.getParameters();
+            if (parameters.size() == 0) {
+                view.appendln("Parameters", "none");
+            } else {
+                final StringBuffer buffer = new StringBuffer();
+                final 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(")");
+                    view.appendln("Parameters", buffer.toString());
+
+                    view.indent();
+                    final Class<? extends Facet>[] parameterFacets = p.get(j).getFacetTypes();
+                    for (final Class<? extends Facet> parameterFacet : parameterFacets) {
+                        view.append(p.get(j).getFacet(parameterFacet).toString());
+                    }
+                    view.unindent();
+                }
+            }
+        }
+    }
+
+    private void specificationClasses(final DebugBuilder view, final String label, final List<ObjectSpecification> subclasses) {
+        final 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.appendln(label, buffer.toString());
+    }
+
+    private void specificationMembers(final DebugBuilder view, final String label, final List<? extends ObjectMember> members) {
+        final StringBuffer buffer = new StringBuffer();
+        if (members.size() == 0) {
+            buffer.append("none");
+        } else {
+            for (int i = 0; i < members.size(); i++) {
+                final ObjectMember member = members.get(i);
+                buffer.append("<a href=\"#" + members.get(i).getId() + "\">" + member.getId() + "</a>   <small>");
+                buffer.append(member.isAlwaysHidden() ? "" : "Visible ");
+                if (member.isPropertyOrCollection()) {
+                    buffer.append(((ObjectAssociation) member).isNotPersisted() ? "Not-Persisted " : " ");
+                    buffer.append(((ObjectAssociation) member).isMandatory() ? "Mandatory " : "");
+                }
+                buffer.append("</small></a><br>");
+            }
+        }
+        view.appendln(label, buffer.toString());
+    }
+
+    private void speficationFacets(final DebugBuilder view, final FacetHolder facetHolder) {
+        final List<Facet> facets = facetHolder.getFacets(new Filter<Facet>() {
+            @Override
+            public boolean accept(final Facet facet) {
+                return true;
+            }
+        });
+        final StringBuffer buffer = new StringBuffer();
+        if (facets == null || facets.size() == 0) {
+            buffer.append("none");
+        } else {
+            Collections.sort(facets, new Comparator<Facet>() {
+                @Override
+                public int compare(final Facet o1, final Facet o2) {
+                    final String facetType1 = o1.facetType().getName();
+                    final String facetType2 = o2.facetType().getName();
+                    return facetType1.substring(facetType1.lastIndexOf('.') + 1).compareTo(facetType2.substring(facetType2.lastIndexOf('.') + 1));
+                }
+            });
+            for (final Facet facet : facets) {
+                final String facetType = facet.facetType().getName();
+                buffer.append("<span class=\"facet-type\">" + facetType.substring(facetType.lastIndexOf('.') + 1) + "</span>:  " + facet + "<br>");
+            }
+        }
+        view.appendln("Facets", buffer.toString());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
new file mode 100644
index 0000000..796faf0
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class DebugAccessCheck extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        if (request.getContext().isDebugDisabled()) {
+            throw new ForbiddenException("Debug is disabled");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "debug-access-check";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
new file mode 100644
index 0000000..9137783
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
@@ -0,0 +1,110 @@
+/*
+ *  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.view.debug;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
+
+public class DebugCollectionView extends AbstractObjectProcessor {
+
+    @Override
+    public void process(final Request request, final ObjectAdapter object) {
+        final String cls = request.getOptionalProperty(CLASS, "form");
+        final String classString = " class=\"" + cls + "\"";
+        String title = request.getOptionalProperty(FORM_TITLE);
+        final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
+        final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
+        final boolean showIcons = request.isRequested(SHOW_ICON, true);
+
+    }
+
+    private void write(final Request request, final ObjectAdapter object, final List<ObjectAssociation> fields,
+        final LinkedObject[] linkFields, final String classString, final String title, final String oddRowClass,
+        final String evenRowClass, final boolean showIcons) {
+        request.appendHtml("<div" + classString + ">");
+        if (title != null) {
+            request.appendHtml("<div class=\"title\">");
+            request.appendAsHtmlEncoded(title);
+            request.appendHtml("</div>");
+            HelpLink.append(request, object.getSpecification().getDescription(), object.getSpecification().getHelp());
+        }
+     /*   
+        final List<ObjectAssociation> fields =
+                tag.includedFields(object.getSpecification().getAssociations(
+                    ObjectAssociationFilters.STATICALLY_VISIBLE_ASSOCIATIONS));
+            final LinkedObject[] linkFields = tag.linkedFields(fields);
+
+            String linkAllView = request.getOptionalProperty(LINK);
+            if (linkAllView != null) {
+                linkAllView = request.getContext().fullUriPath(linkAllView);
+                for (int i = 0; i < linkFields.length; i++) {
+                    final boolean isObject = fields.get(i).isOneToOneAssociation();
+                    final boolean isNotParseable =
+                        !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
+                    linkFields[i] = isObject && isNotParseable ? new LinkedObject(linkAllView) : null;
+                }
+            }
+
+        
+        
+        int row = 1;
+        for (int i = 0; i < fields.size(); i++) {
+            final ObjectAssociation field = fields.get(i);
+            if (ignoreField(field)) {
+                continue;
+            }
+            if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
+                continue;
+            }
+
+            final String description =
+                field.getDescription().equals("") ? "" : "title=\"" + field.getDescription() + "\"";
+            String cls;
+            if (row++ % 2 == 1) {
+                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
+            } else {
+                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
+            }
+            request.appendHtml("<div " + cls + description + "><span class=\"label\">");
+            request.appendAsHtmlEncoded(field.getName());
+            request.appendHtml(":</span>");
+            final LinkedObject linkedObject = linkFields[i];
+            addField(request, object, field, linkedObject, showIcons);
+            HelpLink.append(request, field.getDescription(), field.getHelp());
+            request.appendHtml("</div>");
+        }
+        */
+        request.appendHtml("</div>");
+        
+    }
+
+
+    @Override
+    public String getName() {
+        return "debug-collection";
+    }
+
+}


[16/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
deleted file mode 100644
index 960997d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Errors.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Errors extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String cls = request.getOptionalProperty(CLASS);
-        final StringBuffer buffer = new StringBuffer();
-        write(request, cls, buffer);
-        if (buffer.length() > 0) {
-            request.appendHtml("<div class=\"error\">");
-            request.appendHtml(buffer.toString());
-            request.appendHtml("</div>");
-        }
-    }
-
-    public static void write(final Request request, String cls, final StringBuffer buffer) {
-        if (cls == null) {
-            cls = "error";
-        }
-        final String message = (String) request.getContext().getVariable("_error-message");
-        if (message != null) {
-            buffer.append(message);
-        }
-        final String details = (String) request.getContext().getVariable("_error-details");
-        if (details != null) {
-            buffer.append(details);
-        }
-
-        /*
-         * final MessageBroker messageBroker = IsisContext.getMessageBroker();
-         * final List<String> warnings = messageBroker.getWarnings(); for (final
-         * String warning : warnings) { buffer.append("<div class=\"" + cls +
-         * "\">" + warning + "</div>"); }
-         */
-    }
-
-    @Override
-    public String getName() {
-        return "errors";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
deleted file mode 100644
index f734ce2..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Feedback.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Feedback extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String cls = request.getOptionalProperty(CLASS);
-        final StringBuffer buffer = new StringBuffer();
-        Errors.write(request, cls, buffer);
-        Warnings.write(cls, buffer);
-        Messages.write(cls, buffer);
-        if (buffer.length() > 0) {
-            request.appendHtml("<div class=\"feedback\">");
-            request.appendHtml(buffer.toString());
-            request.appendHtml("</div>");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "feedback";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
deleted file mode 100644
index 32e2cd8..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class FieldLabel extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getRequiredProperty(FIELD);
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-        if (field == null) {
-            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
-        }
-        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-        }
-        String delimiter = request.getOptionalProperty("delimiter");
-        if (delimiter == null) {
-            delimiter = ": ";
-        } else if (delimiter.equals("")) {
-            delimiter = null;
-        }
-        write(request, field, delimiter);
-    }
-
-    @Override
-    public String getName() {
-        return "label";
-    }
-
-    public static void write(final Request content, final ObjectAssociation field, final String delimiter) {
-        final String description = field.getDescription();
-        final String titleSegment = description == null || description.equals("") ? null : ("title=\"" + description + "\"");
-        content.appendHtml("<span class=\"label\"" + titleSegment + ">");
-        content.appendAsHtmlEncoded(field.getName());
-        if (delimiter != null) {
-            content.appendHtml("<span class=\"delimiter\">" + delimiter + "</span>");
-        }
-        content.appendHtml("</span>");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
deleted file mode 100644
index 3e84218..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class FieldValue extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String className = request.getOptionalProperty(CLASS);
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getRequiredProperty(FIELD);
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-        if (field == null) {
-            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
-        }
-        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-        }
-        final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
-        final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
-
-        write(request, object, field, null, className, isIconShowing, truncateTo);
-    }
-
-    @Override
-    public String getName() {
-        return "field";
-    }
-
-    public static void write(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedField, final String className, final boolean showIcon, final int truncateTo) {
-
-        final ObjectAdapter fieldReference = field.get(object);
-
-        if (fieldReference != null) {
-            final String classSection = "class=\"" + (className == null ? "value" : className) + "\"";
-            request.appendHtml("<span " + classSection + ">");
-            if (field.isOneToOneAssociation()) {
-                try {
-                    IsisContext.getPersistenceSession().resolveImmediately(fieldReference);
-                } catch (final ObjectNotFoundException e) {
-                    request.appendHtml(e.getMessage() + "</span>");
-                }
-            }
-
-            if (!field.getSpecification().containsFacet(ParseableFacet.class) && showIcon) {
-                request.appendHtml("<img class=\"small-icon\" src=\"" + request.getContext().imagePath(fieldReference) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>");
-            }
-
-            if (linkedField != null) {
-                final String id = request.getContext().mapObject(fieldReference, linkedField.getScope(), Scope.INTERACTION);
-                request.appendHtml("<a href=\"" + linkedField.getForwardView() + "?" + linkedField.getVariable() + "=" + id + request.getContext().encodedInteractionParameters() + "\">");
-            }
-            String value = fieldReference == null ? "" : fieldReference.titleString();
-            if (truncateTo > 0 && value.length() > truncateTo) {
-                value = value.substring(0, truncateTo) + "...";
-            }
-
-            // TODO figure out a better way to determine if boolean or a
-            // password
-            final ObjectSpecification spec = field.getSpecification();
-            final BooleanValueFacet facet = spec.getFacet(BooleanValueFacet.class);
-            if (facet != null) {
-                final boolean flag = facet.isSet(fieldReference);
-                final String valueSegment = flag ? " checked=\"checked\"" : "";
-                final String disabled = " disabled=\"disabled\"";
-                request.appendHtml("<input type=\"checkbox\"" + valueSegment + disabled + " />");
-            } else {
-                request.appendAsHtmlEncoded(value);
-            }
-
-            if (linkedField != null) {
-                request.appendHtml("</a>");
-            }
-            request.appendHtml("</span>");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
deleted file mode 100644
index 8a6ab16..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *  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.view.display;
-
-import java.text.DecimalFormat;
-import java.text.Format;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.facets.value.date.DateValueFacet;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-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.processor.Request;
-
-public class GetField extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getRequiredProperty(FIELD);
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        if (object == null) {
-            throw new ScimpiException("No object to get field for: " + fieldName + " - " + id);
-        }
-        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-        if (field == null) {
-            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
-        }
-        final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        if (field.isVisible(session, object, where).isVetoed()) {
-            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-        }
-
-        String pattern = request.getOptionalProperty("decimal-format");
-        Format format = null;
-        if (pattern != null) {
-            format = new DecimalFormat(pattern);
-        }
-        pattern = request.getOptionalProperty("date-format");
-        if (pattern != null) {
-            format = new SimpleDateFormat(pattern);
-        }
-
-        final String name = request.getOptionalProperty(RESULT_NAME, fieldName);
-        final String scopeName = request.getOptionalProperty(SCOPE);
-        final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
-
-        process(request, object, field, format, name, scope);
-    }
-
-    protected void process(final Request request, final ObjectAdapter object, final ObjectAssociation field, final Format format, final String name, final Scope scope) {
-        final ObjectAdapter fieldReference = field.get(object);
-        if (format != null && fieldReference.isValue()) {
-            final DateValueFacet facet = fieldReference.getSpecification().getFacet(DateValueFacet.class);
-            final Date date = facet.dateValue(fieldReference);
-            final String value = format.format(date);
-            request.appendDebug("    " + object + " -> " + value);
-            request.getContext().addVariable(name, Request.getEncoder().encoder(value), scope);
-        } else {
-            final String source = fieldReference == null ? "" : request.getContext().mapObject(fieldReference, scope);
-            request.appendDebug("    " + object + " -> " + source);
-            request.getContext().addVariable(name, source, scope);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "get-field";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
deleted file mode 100644
index aa3bfff..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  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.view.display;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * Element to include another file that will display an object.
- */
-public class IncludeObject extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with 
-    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
-    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
-    // for any other value for Where
-    private final Where where = Where.ANYWHERE;
-
-    @Override
-    public void process(final Request request) {
-        final String path = request.getOptionalProperty("file");
-        String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getOptionalProperty(FIELD);
-        ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
-        if (fieldName != null) {
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
-                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-            }
-            object = field.get(object);
-            id = request.getContext().mapObject(object, Scope.REQUEST);
-        }
-
-        if (object != null) {
-            IsisContext.getPersistenceSession().resolveImmediately(object);
-            request.getContext().addVariable("_object", id, Scope.REQUEST);
-            importFile(request, path);
-        }
-        request.closeEmpty();
-    }
-
-    private static void importFile(final Request request, final String path) {
-        // TODO load in file via HtmlFileParser
-        final File file = new File(path);
-        BufferedReader reader = null;
-        try {
-            if (file.exists()) {
-                reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
-                String line;
-                while ((line = reader.readLine()) != null) {
-                    request.appendHtml(line);
-                }
-            } else {
-                request.appendHtml("<P classs=\"error\">File " + path + " not found to import</P>");
-            }
-        } catch (final FileNotFoundException e) {
-            throw new RuntimeException(e);
-        } catch (final IOException e) {
-            throw new RuntimeException(e);
-        } finally {
-            if (reader != null) {
-                try {
-                    reader.close();
-                } catch (final IOException e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "include-object";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
deleted file mode 100644
index 3bd8352..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ListView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.Iterator;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-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.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class ListView extends AbstractObjectProcessor {
-
-    @Override
-    public String checkFieldType(final ObjectAssociation objectField) {
-        return objectField.isOneToManyAssociation() ? null : "is not a collection";
-    }
-
-    @Override
-    public void process(final Request request, final ObjectAdapter object) {
-        final String linkRowView = request.getOptionalProperty(LINK_VIEW);
-        final String linkObjectName = request.getOptionalProperty(ELEMENT_NAME, RequestContext.RESULT);
-        final String linkObjectScope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
-        LinkedObject linkedRow = null;
-        if (linkRowView != null) {
-            linkedRow = new LinkedObject(linkObjectName, linkObjectScope, request.getContext().fullUriPath(linkRowView));
-        }
-        final String bulletType = request.getOptionalProperty("type");
-        write(request, object, linkedRow, bulletType);
-    }
-
-    public static void write(final Request request, final ObjectAdapter collection, final LinkedObject linkRow, final String bulletType) {
-
-        if (bulletType == null) {
-            request.appendHtml("<ol>");
-        } else {
-            request.appendHtml("<ul type=\"" + bulletType + "\">");
-        }
-
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        while (iterator.hasNext()) {
-            final ObjectAdapter element = iterator.next();
-
-            request.appendHtml("<li>");
-            if (linkRow != null) {
-                final Scope scope = linkRow == null ? Scope.INTERACTION : RequestContext.scope(linkRow.getScope());
-                RequestContext context = request.getContext();
-                final String rowId = context.mapObject(element, scope);
-                request.appendHtml("<a class=\"item-select\" href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable()
-                        + "=" + rowId + context.encodedInteractionParameters() + "\">");
-            }
-            request.appendAsHtmlEncoded(element.titleString());
-            if (linkRow != null) {
-                request.appendHtml("</a>");
-            }
-
-            request.appendHtml("</li>\n");
-        }
-        if (bulletType == null) {
-            request.appendHtml("</ol>");
-        } else {
-            request.appendHtml("</ul>");
-        }
-
-    }
-
-    @Override
-    public String getName() {
-        return "list";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
deleted file mode 100644
index 1efad45..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.List;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableView.SimpleTableBuilder;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class LongFormView extends AbstractFormView {
-
-    @Override
-    protected void addField(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
-        if (field.isOneToManyAssociation()) {
-            final String noColumnsString = request.getOptionalProperty("no-columns", "3");
-            final String tableClass = request.getOptionalProperty("table-class");
-            final String rowClassesList = request.getOptionalProperty("row-classes", ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
-            String[] rowClasses = new String[0];
-            if (rowClassesList != null) {
-                rowClasses = rowClassesList.split("[,|/]");
-            }
-            int noColumns;
-            ResolveFieldUtil.resolveField(object, field);
-            final ObjectAdapter collection = field.get(object);
-            final ObjectSpecification elementSpec = collection.getElementSpecification();
-            final List<ObjectAssociation> fields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
-            if (noColumnsString.equalsIgnoreCase("all")) {
-                noColumns = fields.size();
-            } else {
-                noColumns = Math.min(fields.size(), Integer.valueOf(noColumnsString));
-            }
-            // final boolean isFieldEditable = field.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
-            final String summary = "Table of elements in " + field.getName();
-            // TableView.write(request, summary, object, field, collection, noColumns, fields, isFieldEditable, showIconByDefault(), tableClass, rowClasses, linkedObject);
-            
-            
-            final String headers[] = new String[fields.size()];
-            int h = 0;
-            for (int i = 0; i < noColumns; i++) {
-                if (fields.get(i).isOneToManyAssociation()) {
-                    continue;
-                }
-                headers[h++] = fields.get(i).getName();
-            }
-            
-            final LinkedObject[] linkedFields = new LinkedObject[fields.size()];
-
-
-            final TableContentWriter rowBuilder =new SimpleTableBuilder(object.titleString(), true, false, "", noColumns, headers, fields, false,
-                    showIcons, false, false, false, field.getName(), linkedFields, null);
-            TableView.write(request, collection, summary, rowBuilder, null, tableClass, rowClasses);
-        } else {
-            super.addField(request, object, field, linkedObject, showIcons);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "long-form";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
deleted file mode 100644
index 8ec1420..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.List;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Messages extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String cls = request.getOptionalProperty(CLASS);
-        final StringBuffer buffer = new StringBuffer();
-        write(cls, buffer);
-        if (buffer.length() > 0) {
-            request.appendHtml("<div class=\"feedback\">");
-            request.appendHtml(buffer.toString());
-            request.appendHtml("</div>");
-        }
-
-    }
-
-    public static void write(String cls, final StringBuffer buffer) {
-        if (cls == null) {
-            cls = "message";
-        }
-        final MessageBroker messageBroker = IsisContext.getMessageBroker();
-        final List<String> messages = messageBroker.getMessages();
-        for (final String message : messages) {
-            buffer.append("<div class=\"" + cls + "\">" + message + "</div>");
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "messages";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
deleted file mode 100644
index 7af46ab..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/SelectedObject.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-/**
- * <swf:selected name="selected" object="${action}" equals="${subaction}" />
- */
-public class SelectedObject extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String name = request.getOptionalProperty(NAME, "selected");
-        final String objectId = request.getRequiredProperty(OBJECT);
-        final String equalsId = request.getOptionalProperty("equals");
-        final String title = request.getOptionalProperty(BUTTON_TITLE);
-
-        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(objectId);
-        final ObjectAdapter other = request.getContext().getMappedObjectOrResult(equalsId);
-        if (object == other || object.equals(title)) {
-            // TODO title is not being used!
-            request.getContext().addVariable(ID, " id=\"" + name + "\" ", Scope.INTERACTION);
-        } else {
-            request.getContext().addVariable(ID, "", Scope.INTERACTION);
-        }
-        request.closeEmpty();
-    }
-
-    @Override
-    public String getName() {
-        return "selected";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
deleted file mode 100644
index 31e903b..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/ShortFormView.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-
-public class ShortFormView extends AbstractFormView {
-
-    @Override
-    protected boolean ignoreField(final ObjectAssociation field) {
-        return field.isOneToManyAssociation();
-    }
-
-    @Override
-    public String getName() {
-        return "short-form";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
deleted file mode 100644
index 2927fab..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBlock.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class TableBlock implements BlockContent {
-
-    // {{ collection
-    private ObjectAdapter collection;
-
-    public void setCollection(final ObjectAdapter collection) {
-        this.collection = collection;
-    }
-
-    public ObjectAdapter getCollection() {
-        return collection;
-    }
-    // }}
-    
-    // {{ linkView
-    private String linkView;
-
-    public String getlinkView() {
-        return linkView;
-    }
-
-    public void setlinkView(final String linkView) {
-        this.linkView = linkView;
-    }
-    // }}
-    
-    // {{ linkName
-    private String linkName;
-
-    public String getlinkName() {
-        return linkName;
-    }
-
-    public void setlinkName(final String linkName) {
-        this.linkName = linkName;
-    }
-    // }}
-
-    // {{ elementName
-    private String elementName;
-
-    public String getElementName() {
-        return elementName;
-    }
-
-    public void setElementName(final String linkObject) {
-        this.elementName = linkObject;
-    }
-    // }}
-
-    private RepeatMarker marker;
-
-    public RepeatMarker getMarker() {
-        return marker;
-    }
-
-    public void setMarker(final RepeatMarker marker) {
-        this.marker = marker;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
deleted file mode 100644
index e726e29..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableBuilder.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-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.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class TableBuilder extends AbstractTableView {
-
-    @Override
-    protected TableContentWriter createRowBuilder(final Request request, final RequestContext context, final String parent, final List<ObjectAssociation> allFields, final ObjectAdapter collection) {
-
-        final String title = request.getOptionalProperty(TABLE_TITLE);
-        final String variable = request.getOptionalProperty(ELEMENT_NAME, ELEMENT);
-        final String headerClass = request.getOptionalProperty("head-" + CLASS);
-
-        final TableBlock block = new TableBlock();
-        block.setCollection(collection);
-        block.setElementName(variable);
-        request.setBlockContent(block);
-        request.pushNewBuffer();
-        request.processUtilCloseTag();
-        final String headers = request.popBuffer();       
-        return new TableContentWriter() {
-
-            @Override
-            public void writeFooters(final PageWriter writer) {
-            }
-
-            public void tidyUp() {
-                request.popBlockContent();
-            }
-            
-            @Override
-            public void writeCaption(PageWriter writer) {
-                if (title != null) {
-                    writer.appendHtml("<caption>");
-                    writer.appendHtml(title);
-                    writer.appendHtml("</thead>");
-                }
-            }
-            
-            @Override
-            public void writeHeaders(final PageWriter writer) {
-                final String headerSegment = headerClass == null ? "" : (" class=\"" + headerClass + "\"");
-                writer.appendHtml("<thead" + headerSegment + ">");
-                writer.appendHtml(headers);
-                writer.appendHtml("</thead>");
-            }
-
-            @Override
-            public void writeElement(final Request request, final RequestContext context, final ObjectAdapter element) {
-                context.addVariable(variable, context.mapObject(element, Scope.REQUEST), Scope.REQUEST);
-                final RepeatMarker end = request.createMarker();
-                final RepeatMarker marker = block.getMarker();
-                marker.repeat();
-                request.processUtilCloseTag();
-                end.repeat();
-            }
-        };
-    }
-
-    @Override
-    public String getName() {
-        return "table-builder";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
deleted file mode 100644
index 3f99218..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableCell.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-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.processor.Request;
-
-public class TableCell extends AbstractElementProcessor {
-
-    // REVIEW: should provide this rendering context, rather than hardcoding.
-    // the net effect currently is that class members annotated with
-    // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
-    // be hidden from all tables but will be visible/enabled (perhaps incorrectly) 
-    // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
-    private final Where where = Where.ALL_TABLES;
-
-    @Override
-    public void process(final Request request) {
-        final TableBlock tableBlock = (TableBlock) request.getBlockContent();
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getRequiredProperty(FIELD);
-        final String linkView = request.getOptionalProperty(LINK_VIEW);
-        String className = request.getOptionalProperty(CLASS);
-        className = className == null ? "" : " class=\"" + className + "\"";
-        RequestContext context = request.getContext();
-        final ObjectAdapter object = context.getMappedObjectOrVariable(id, tableBlock.getElementName());
-        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-        if (field == null) {
-            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
-        }
-        request.appendHtml("<td" + className + ">");
-        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
-            final ObjectAdapter fieldReference = field.get(object);
-            final String source = fieldReference == null ? "" : context.mapObject(fieldReference, Scope.REQUEST);
-            final String name = request.getOptionalProperty(RESULT_NAME, fieldName);
-            context.addVariable(name, Request.getEncoder().encoder(source), Scope.REQUEST);
-
-            if (linkView != null) {
-                final String linkId = context.mapObject(object, Scope.REQUEST);
-                final String linkName = request.getOptionalProperty(LINK_NAME, RequestContext.RESULT);
-                final String linkObject = request.getOptionalProperty(LINK_OBJECT, linkId);
-                request.appendHtml("<a href=\"" + linkView + "?" + linkName + "=" + linkObject + context.encodedInteractionParameters() + "\">");
-            } else if(tableBlock.getlinkView() != null) {
-                String linkObjectInVariable = tableBlock.getElementName();
-                final String linkId = (String) context.getVariable(linkObjectInVariable);
-                request.appendHtml("<a href=\"" + tableBlock.getlinkView() + "?" + tableBlock.getlinkName() + "=" + linkId + context.encodedInteractionParameters() + "\">");                
-            }
-            request.pushNewBuffer();
-            request.processUtilCloseTag();
-            final String buffer = request.popBuffer();
-            if (buffer.trim().length() == 0) {
-                request.appendAsHtmlEncoded(fieldReference == null ? "" : fieldReference.titleString());
-            } else {
-                request.appendHtml(buffer);
-            }
-            if (linkView != null) {
-                request.appendHtml("</a>");
-            }
-        } else {
-            request.skipUntilClose();
-        }
-        request.appendHtml("</td>");
-    }
-
-    @Override
-    public String getName() {
-        return "table-cell";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
deleted file mode 100644
index 10da109..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableContentWriter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public interface TableContentWriter {
-
-    void writeCaption(PageWriter writer);
-
-    void writeHeaders(PageWriter writer);
-
-    void writeFooters(PageWriter writer);
-
-    void writeElement(Request request, RequestContext context, ObjectAdapter element);
-
-    void tidyUp();
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
deleted file mode 100644
index 5595207..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableEmpty.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class TableEmpty extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final TableBlock tableBlock = (TableBlock) request.getBlockContent();
-        final ObjectAdapter collection = tableBlock.getCollection();
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-        if (facet.size(collection) == 0) {
-            String className = request.getOptionalProperty(CLASS);
-            className = className == null ? "" : " class=\"" + className + "\"";
-            request.appendHtml("<tr" + className + ">");
-            request.pushNewBuffer();
-            request.processUtilCloseTag();
-            final String buffer = request.popBuffer();
-            request.appendHtml(buffer);
-            request.appendHtml("</td>");
-        } else {
-            request.skipUntilClose();
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "table-empty";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
deleted file mode 100644
index ff04389..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableHeader.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class TableHeader extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "table-header";
-    }
-
-    @Override
-    public void process(final Request request) {
-        request.appendHtml("<thead><tr>");
-        request.processUtilCloseTag();
-        request.appendHtml("</tr></thead>");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
deleted file mode 100644
index eb92656..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableRow.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request.RepeatMarker;
-
-public class TableRow extends AbstractElementProcessor {
-
-    @Override
-    public String getName() {
-        return "table-row";
-    }
-
-    @Override
-    public void process(final Request request) {
-        final TableBlock block = (TableBlock) request.getBlockContent();
-        
-        final RepeatMarker start = request.createMarker();
-        block.setMarker(start);
-        
-        final String linkView = request.getOptionalProperty(LINK_VIEW);
-        if (linkView != null) {
-            block.setlinkView(linkView);
-            block.setlinkName(request.getOptionalProperty(LINK_NAME, RequestContext.RESULT));
-        }
-        
-        request.skipUntilClose();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
deleted file mode 100644
index caf984f..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/TableView.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- *  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.view.display;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-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.processor.PageWriter;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedFieldsBlock;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-import org.apache.isis.viewer.scimpi.dispatcher.view.simple.RemoveElement;
-
-public class TableView extends AbstractTableView {
-
-   static final class SimpleTableBuilder implements TableContentWriter {
-        private final String parent;
-        private final boolean includeHeader;
-        private final boolean includeFooter;
-        private final String title;
-        private final String[] headers;
-        private final List<ObjectAssociation> fields;
-        private final boolean showTitle;
-        private final boolean showIcons;
-        private final boolean showSelectOption;
-        private final boolean showDeleteOption;
-        private final boolean showEditOption;
-        private final String fieldName;
-        private final LinkedObject[] linkedFields;
-        private final LinkedObject linkRow;
-        private final int noColumns;
-
-        SimpleTableBuilder(
-                final String parent,
-                final boolean includeHeader,
-                final boolean includeFooter,
-                final String title,
-                final int noColumns,
-                final String[] headers,
-                final List<ObjectAssociation> fields,
-                final boolean showTitle,
-                final boolean showIcons,
-                final boolean showSelectOption,
-                final boolean showDeleteOption,
-                final boolean showEditOption,
-                final String fieldName,
-                final LinkedObject[] linkedFields,
-                final LinkedObject linkRow) {
-            this.parent = parent;
-            this.includeHeader = includeHeader;
-            this.includeFooter = includeFooter;
-            this.title = title;
-            this.showTitle = showTitle;
-            this.noColumns = noColumns < 1 ? fields.size() : noColumns;
-            this.headers = headers;
-            this.fields = fields;
-            this.showIcons = showIcons;
-            this.showSelectOption = showSelectOption;
-            this.showDeleteOption = showDeleteOption;
-            this.showEditOption = showEditOption;
-            this.fieldName = fieldName;
-            this.linkedFields = linkedFields;
-            this.linkRow = linkRow;
-        }
-
-        @Override
-        public void writeFooters(final PageWriter writer) {
-            if (includeFooter) {
-                writer.appendHtml("<tfoot>");
-                columnHeaders(writer, headers);
-                writer.appendHtml("</tfoot>");
-            }
-        }
-
-        @Override
-        public void writeCaption(PageWriter writer) {
-            if (title != null) {
-                writer.appendHtml("<caption>");
-                writer.appendHtml(title);
-                writer.appendHtml("</caption>");
-            }
-        }
-        
-        @Override
-        public void writeHeaders(final PageWriter writer) {
-            if (includeHeader) {
-                writer.appendHtml("<thead>");
-                columnHeaders(writer, headers);
-                writer.appendHtml("</thead>");
-            }
-        }
-
-        private void columnHeaders(final PageWriter writer, final String[] headers) {
-            writer.appendHtml("<tr class=\"column-headers\">");
-            if (showTitle) {
-                writer.appendHtml("<th></th>");
-            }
-            final String[] columnHeaders = headers;
-            for (final String columnHeader : columnHeaders) {
-                if (columnHeader != null) {
-                    writer.appendHtml("<th>");
-                    writer.appendAsHtmlEncoded(columnHeader);
-                    writer.appendHtml("</th>");
-                }
-            }
-            writer.appendHtml("<th class=\"controls\"></th>");
-            writer.appendHtml("</tr>");
-        }
-
-        public void tidyUp() {
-       //     request.popBlockContent();
-            
-        //    Is it the block that is left over, or is the collection form not being closed?
-        }
-        
-        @Override
-        public void writeElement(final Request request, final RequestContext context, final ObjectAdapter element) {
-            final String rowId = context.mapObject(element, Scope.INTERACTION);
-            final String scope = linkRow == null ? "" : "&amp;" + SCOPE + "=" + linkRow.getScope();
-            String result = "";
-            result = context.encodedInteractionParameters();
-
-            if (noColumns == 0) {
-                request.appendHtml("<td>");
-                if (linkRow != null) {
-                    request.appendHtml("<td><a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
-                    request.appendAsHtmlEncoded(element.titleString());
-                    request.appendHtml("</a>");
-                } else {
-                    request.appendAsHtmlEncoded(element.titleString());
-                }
-                request.appendHtml("</td>");
-
-            } else {
-                if (showTitle) {
-                    request.appendHtml("<td>");
-                    request.appendAsHtmlEncoded(element.titleString());
-                    request.appendHtml("</td>");
-                }
-
-                for (int i = 0; i < noColumns; i++) {
-                    if (fields.get(i).isOneToManyAssociation()) {
-                        continue;
-                    }
-                    request.appendHtml("<td>");
-                    final ObjectAdapter field = fields.get(i).get(element);
-                    if (field != null) {
-                        if (showIcons && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
-                            request.appendHtml("<img class=\"" + "small-icon" + "\" src=\"" + request.getContext().imagePath(field) + "\" alt=\"" + fields.get(i).getSpecification().getShortIdentifier() + "\"/>");
-                        }
-                        if (linkRow != null) {
-                            request.appendHtml("<a href=\"" + linkRow.getForwardView() + "?" + linkRow.getVariable() + "=" + rowId + result + scope + "\">");
-                        } else if (linkedFields[i] != null) {
-                            final ObjectAdapter fieldObject = fields.get(i).get(element);
-                            final String id = context.mapObject(fieldObject, Scope.INTERACTION);
-                            request.appendHtml("<a href=\"" + linkedFields[i].getForwardView() + "?" + linkedFields[i].getVariable() + "=" + id + "\">");
-                            context.mapObject(fieldObject, RequestContext.scope(linkedFields[i].getScope()));
-
-                        }
-                        try {
-                            request.appendAsHtmlEncoded(field.titleString());
-                        } catch (final ObjectNotFoundException e) {
-                            request.appendAsHtmlEncoded(e.getMessage());
-                        }
-                        if (linkRow != null || linkedFields[i] != null) {
-                            request.appendHtml("</a>");
-                        }
-                    }
-                    request.appendHtml("</td>");
-
-                }
-            }
-            request.appendHtml("<td class=\"controls\">");
-            if (showSelectOption) {
-                request.appendHtml("<a class=\"button element-select\" href=\"" + "_generic." + Dispatcher.EXTENSION + "?" + RequestContext.RESULT + "=" + rowId + result + scope + "\">view</a>");
-            }
-            if (showEditOption) {
-                request.appendHtml(" <a class=\"button element-edit\" href=\"" + "_generic_edit." + Dispatcher.EXTENSION + "?" + RequestContext.RESULT + "=" + rowId + result + scope + "\">edit</a>");
-            }
-
-            if (showDeleteOption && parent != null) {
-                String view = request.getViewPath();
-                view = context.fullFilePath(view == null ? context.getResourceFile() : view);
-                RemoveElement.write(request, context.getMappedObject(parent), fieldName, element, null, view, view, "delete", "action in-line element-delete confirm");
-            }
-
-            request.appendHtml("</td>");
-
-        }
-    }
-
-    @Override
-    protected TableContentWriter createRowBuilder(
-            final Request request,
-            final RequestContext context,
-            final String parent,
-            final List<ObjectAssociation> allFields,
-            final ObjectAdapter collection) {
-        final String fieldName = request.getOptionalProperty(FIELD);
-        final String title = request.getOptionalProperty(FORM_TITLE);
-        return rowBuilder(request, context, title, parent, fieldName, allFields, showIconByDefault());
-    }
-
-    private static TableContentWriter rowBuilder(
-            final Request request,
-            final RequestContext context,
-            final String title,
-            final String object,
-            final String fieldName,
-            final List<ObjectAssociation> allFields,
-            final boolean showIconByDefault) {
-        final String linkRowView = request.getOptionalProperty(LINK_VIEW);
-        final String linkObjectName = request.getOptionalProperty(ELEMENT_NAME, RequestContext.RESULT);
-        final String linkObjectScope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
-        final LinkedObject linkRow = linkRowView == null ? null : new LinkedObject(linkObjectName, linkObjectScope, context.fullUriPath(linkRowView));
-        final boolean includeHeader = request.isRequested(HEADER, true);
-        final boolean includeFooter = request.isRequested(FOOTER, false);
-
-        final boolean linkFields = request.isRequested("link-fields", true);
-        final boolean showTitle = request.isRequested(SHOW_TITLE, false);
-        final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault);
-        final boolean showSelectOption = request.isRequested(SHOW_SELECT, true);
-        final boolean showEditOption = request.isRequested(SHOW_EDIT, true);
-        final boolean showDeleteOption = request.isRequested(SHOW_DELETE, true);
-
-        final String noColumnsString = request.getOptionalProperty("no-columns", "3");
-
-        final LinkedFieldsBlock block = new LinkedFieldsBlock();
-        request.setBlockContent(block);
-        request.processUtilCloseTag();
-        final List<ObjectAssociation> fields = block.includedFields(allFields);
-        final LinkedObject[] linkedFields = block.linkedFields(fields);
-        for (int i = 0; i < linkedFields.length; i++) {
-            if (linkedFields[i] == null && linkFields && !fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
-                linkedFields[i] = new LinkedObject("_generic.shtml");
-            }
-            if (linkedFields[i] != null) {
-                linkedFields[i].setForwardView(context.fullUriPath(linkedFields[i].getForwardView()));
-            }
-        }
-
-        int noColumns;
-        if (noColumnsString.equalsIgnoreCase("all")) {
-            noColumns = fields.size();
-        } else {
-            noColumns = Math.min(fields.size(), Integer.valueOf(noColumnsString));
-        }
-
-        final String headers[] = new String[noColumns];
-        int h = 0;
-        for (int i = 0; i < noColumns; i++) {
-            if (fields.get(i).isOneToManyAssociation()) {
-                continue;
-            }
-            headers[h++] = fields.get(i).getName();
-        }
-
-        request.popBlockContent();
-
-        return new SimpleTableBuilder(object, includeHeader, includeFooter, title, noColumns, headers, fields, showTitle,
-                showIcons, showSelectOption, showDeleteOption, showEditOption, fieldName, linkedFields, linkRow);
-    }
-
-    public static void write(
-            final Request request,
-            final String summary,
-            final ObjectAdapter object,
-            final ObjectAssociation field,
-            final ObjectAdapter collection,
-            final int noColumns,
-            final List<ObjectAssociation> fields,
-            final boolean linkAllFields,
-            final boolean showIconByDefault,
-            final String tableClass,
-            final String[] rowClasses,
-            LinkedObject linkedObject) {
-        final LinkedObject[] linkedFields = new LinkedObject[fields.size()];
-        if (linkAllFields) {
-            for (int i = 0; i < linkedFields.length; i++) {
-                if (fields.get(i).isOneToOneAssociation()) {
-                    linkedFields[i] = linkedObject == null ? new LinkedObject("_generic.shtml") : linkedObject;  
-                }
-            }
-        }
-        
-        final String headers[] = new String[fields.size()];
-        int h = 0;
-        for (int i = 0; i < fields.size(); i++) {
-            if (fields.get(i).isOneToManyAssociation()) {
-                continue;
-            }
-            headers[h++] = fields.get(i).getName();
-        }
-        
-        final RequestContext context = request.getContext();
-        final TableContentWriter rowBuilder = rowBuilder(request, context, null, context.mapObject(object, Scope.REQUEST), field.getIdentifier().getMemberName(), fields, 
-                showIconByDefault);
-        write(request, collection, summary, rowBuilder, null, null, null);
-    }
-
-    @Override
-    public String getName() {
-        return "table";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
deleted file mode 100644
index d3b6904..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  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.view.display;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-
-public class Title extends AbstractElementProcessor {
-
-    @Override
-    public void process(final Request request) {
-        final String id = request.getOptionalProperty(OBJECT);
-        final String fieldName = request.getOptionalProperty(FIELD);
-        final int truncateTo = Integer.valueOf(request.getOptionalProperty(TRUNCATE, "0")).intValue();
-        final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
-        String className = request.getOptionalProperty(CLASS);
-        className = className == null ? "title-icon" : className;
-        ObjectAdapter object = MethodsUtils.findObject(request.getContext(), id);
-        if (fieldName != null) {
-            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE).isVetoed()) {
-                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
-            }
-            object = field.get(object);
-        }
-
-        if (object != null) {
-            request.appendHtml("<span class=\"object\">");
-            IsisContext.getPersistenceSession().resolveImmediately(object);
-            if (isIconShowing) {
-                final String iconPath = request.getContext().imagePath(object);
-                request.appendHtml("<img class=\"" + className + "\" src=\"" + iconPath + "\" />");
-            }
-            request.appendTruncated(object.titleString(), truncateTo);
-            request.appendHtml("</span>");
-        }
-        request.closeEmpty();
-    }
-
-    @Override
-    public String getName() {
-        return "title";
-    }
-
-}


[04/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
new file mode 100644
index 0000000..294a239
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
@@ -0,0 +1,68 @@
+/*
+ *  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.view.edit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
+
+public class FormFieldBlock extends InclusionList {
+    private final Map<String, String> content = new HashMap<String, String>();
+    private final Map<String, String> values = new HashMap<String, String>();
+
+    public void replaceContent(final String field, final String htmlString) {
+        content.put(field, htmlString);
+    }
+
+    public boolean hasContent(final String name) {
+        return content.containsKey(name);
+    }
+
+    public String getContent(final String name) {
+        return content.get(name);
+    }
+
+    public boolean isVisible(final String name) {
+        return true;
+    }
+
+    public boolean isNullable(final String name) {
+        return true;
+    }
+
+    public ObjectAdapter getCurrent(final String name) {
+        return null;
+    }
+
+    public void value(final String field, final String value) {
+        values.put(field, value);
+    }
+
+    public void setUpValues(final InputField[] inputFields) {
+        for (final InputField inputField : inputFields) {
+            final String name = inputField.getName();
+            inputField.setValue(values.get(name));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
new file mode 100644
index 0000000..71019ea
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
@@ -0,0 +1,48 @@
+/*
+ *  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.view.edit;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
+import org.apache.isis.viewer.scimpi.dispatcher.TagOrderException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class HiddenField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final BlockContent blockContent = request.getBlockContent();
+        if (!(blockContent instanceof FormFieldBlock)) {
+            throw new TagOrderException(request);
+        }
+
+        final String field = request.getOptionalProperty("name");
+        final String value = request.getRequiredProperty("value");
+        final FormFieldBlock block = (FormFieldBlock) blockContent;
+        block.value(field, value);
+        block.exclude(field);
+    }
+
+    @Override
+    public String getName() {
+        return "hidden-field";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
new file mode 100644
index 0000000..7b3c1e6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
@@ -0,0 +1,70 @@
+/*
+ *  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.view.edit;
+
+import java.util.Iterator;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+
+public class RadioListField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
+        if (block.isVisible(field)) {
+            final String id = request.getRequiredProperty(COLLECTION);
+            final String exclude = request.getOptionalProperty("exclude");
+
+            final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(id);
+
+            final RequestContext context = request.getContext();
+            final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+            final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+
+            final StringBuffer buffer = new StringBuffer();
+
+            while (iterator.hasNext()) {
+                final ObjectAdapter element = iterator.next();
+                final Scope scope = Scope.INTERACTION;
+                final String elementId = context.mapObject(element, scope);
+                if (exclude != null && context.getMappedObject(exclude) == element) {
+                    continue;
+                }
+                final String title = element.titleString();
+                final String checked = "";
+                buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + " />" + title + "</input><br/>\n");
+            }
+
+            block.replaceContent(field, buffer.toString());
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "radio-list";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
new file mode 100644
index 0000000..e814f28
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
@@ -0,0 +1,158 @@
+/*
+ *  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.view.edit;
+
+import java.util.Iterator;
+
+import org.apache.isis.core.commons.exceptions.UnknownTypeException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
+import org.apache.isis.viewer.scimpi.dispatcher.view.action.CreateFormParameter;
+
+public class Selector extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
+        if (block.isVisible(field)) {
+            processElement(request, block, field);
+        }
+        request.skipUntilClose();
+    }
+
+    private void processElement(final Request request, final FormFieldBlock block, final String field) {
+        final String type = request.getOptionalProperty(TYPE, "dropdown");
+        if (!request.isPropertySpecified(METHOD) && request.isPropertySpecified(COLLECTION)) {
+            final String id = request.getRequiredProperty(COLLECTION, Request.NO_VARIABLE_CHECKING);
+            final String selector = showSelectionList(request, id, block.getCurrent(field), block.isNullable(field), type);
+            block.replaceContent(field, selector);
+        } else {
+            final String objectId = request.getOptionalProperty(OBJECT);
+            final String methodName = request.getRequiredProperty(METHOD);
+            final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+            final ObjectAction action = MethodsUtils.findAction(object, methodName);
+            if (action.getParameterCount() == 0) {
+                final ObjectAdapter collection = action.execute(object, new ObjectAdapter[0]);
+                final String selector = showSelectionList(request, collection, block.getCurrent(field), block.isNullable(field), type);
+                block.replaceContent(field, selector);
+            } else {
+                final String id = "selector_options";
+                final String id2 = (String) request.getContext().getVariable(id);
+                final String selector = showSelectionList(request, id2, block.getCurrent(field), block.isNullable(field), type);
+
+                final CreateFormParameter parameters = new CreateFormParameter();
+                parameters.objectId = objectId;
+                parameters.methodName = methodName;
+                parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE, "Search");
+                parameters.formTitle = request.getOptionalProperty(FORM_TITLE);
+                parameters.className = request.getOptionalProperty(CLASS, "selector");
+                parameters.id = request.getOptionalProperty(ID);
+
+                parameters.resultName = id;
+                parameters.forwardResultTo = request.getContext().getResourceFile();
+                parameters.forwardVoidTo = "error";
+                parameters.forwardErrorTo = parameters.forwardResultTo;
+                parameters.scope = Scope.REQUEST.name();
+                request.pushNewBuffer();
+                ActionForm.createForm(request, parameters);
+                block.replaceContent(field, selector);
+
+                request.appendHtml(request.popBuffer());
+            }
+        }
+    }
+
+    private String showSelectionList(final Request request, final String collectionId, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
+        if (collectionId != null && !collectionId.equals("")) {
+            final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(collectionId);
+            return showSelectionList(request, collection, selectedItem, allowNotSet, type);
+        } else {
+            return null;
+        }
+    }
+
+    private String showSelectionList(final Request request, final ObjectAdapter collection, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
+        final String field = request.getRequiredProperty(FIELD);
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+
+        if (type.equals("radio")) {
+            return radioButtonList(request, field, allowNotSet, collection, selectedItem, facet);
+        } else if (type.equals("list")) {
+            final String size = request.getOptionalProperty("size", "5");
+            return dropdownList(request, field, allowNotSet, collection, selectedItem, size, facet);
+        } else if (type.equals("dropdown")) {
+            return dropdownList(request, field, allowNotSet, collection, selectedItem, null, facet);
+        } else {
+            throw new UnknownTypeException(type);
+        }
+    }
+
+    private String radioButtonList(final Request request, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, final CollectionFacet facet) {
+        final RequestContext context = request.getContext();
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        final StringBuffer buffer = new StringBuffer();
+        if (allowNotSet) {
+            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"null\"></input><br/>\n");
+        }
+        while (iterator.hasNext()) {
+            final ObjectAdapter element = iterator.next();
+            final String elementId = context.mapObject(element, Scope.INTERACTION);
+            final String title = element.titleString();
+            final String checked = element == selectedItem ? "checked=\"checked\"" : "";
+            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + ">" + title + "</input><br/>\n");
+        }
+
+        return buffer.toString();
+    }
+
+    private String dropdownList(final Request request, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, String size, final CollectionFacet facet) {
+        final RequestContext context = request.getContext();
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        final StringBuffer buffer = new StringBuffer();
+        size = size == null ? "" : " size =\"" + size + "\"";
+        buffer.append("<select name=\"" + field + "\"" + size + " >\n");
+        if (allowNotSet) {
+            buffer.append("  <option value=\"null\"></option>\n");
+        }
+        while (iterator.hasNext()) {
+            final ObjectAdapter element = iterator.next();
+            final String elementId = context.mapObject(element, Scope.INTERACTION);
+            final String title = element.titleString();
+            final String checked = element == selectedItem ? "selected=\"selected\"" : "";
+            buffer.append("  <option value=\"" + elementId + "\"" + checked + ">" + title + "</option>\n");
+        }
+        buffer.append("</select>\n");
+        return buffer.toString();
+    }
+
+    @Override
+    public String getName() {
+        return "selector";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
new file mode 100644
index 0000000..0c12990
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
@@ -0,0 +1,39 @@
+/*
+ *  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.view.field;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class ExcludeField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String field = request.getOptionalProperty(NAME);
+        final InclusionList block = (InclusionList) request.getBlockContent();
+        block.exclude(field);
+    }
+
+    @Override
+    public String getName() {
+        return "exclude";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
new file mode 100644
index 0000000..bff9858
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
@@ -0,0 +1,39 @@
+/*
+ *  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.view.field;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class IncludeField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String field = request.getOptionalProperty(NAME);
+        final InclusionList block = (InclusionList) request.getBlockContent();
+        block.include(field);
+    }
+
+    @Override
+    public String getName() {
+        return "include";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
new file mode 100644
index 0000000..1fdc2f6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
@@ -0,0 +1,89 @@
+/*
+ *  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.view.field;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.viewer.scimpi.dispatcher.BlockContent;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
+
+public class InclusionList implements BlockContent {
+    private final Set<String> includedList = new HashSet<String>();
+    private final Set<String> excludedList = new HashSet<String>();
+
+    private boolean inIncludedList(final String fieldName) {
+        return includedList.size() == 0 || includedList.contains(fieldName) || includedList.contains("all");
+    }
+
+    private boolean inExcludedList(final String fieldName) {
+        return excludedList.contains(fieldName) || excludedList.contains("all");
+    }
+
+    public void include(final String field) {
+        includedList.add(field);
+    }
+
+    public void exclude(final String field) {
+        excludedList.add(field);
+    }
+
+    public List<ObjectAssociation> includedFields(final List<ObjectAssociation> originalFields) {
+        final List<ObjectAssociation> includedFields = Lists.newArrayList();
+        for (int i = 0; i < originalFields.size(); i++) {
+            final String id2 = originalFields.get(i).getId();
+            if (includes(id2)) {
+                includedFields.add(originalFields.get(i));
+            }
+        }
+
+        return includedFields;
+    }
+
+    public void hideExcludedParameters(final InputField[] inputFields) {
+        for (final InputField inputField : inputFields) {
+            final String id2 = inputField.getName();
+            if (!includes(id2)) {
+                inputField.setHidden(true);
+            }
+        }
+    }
+
+    public boolean includes(final String id) {
+        return inIncludedList(id) && !inExcludedList(id);
+    }
+
+    public List<ObjectAction> includedActions(final List<ObjectAction> originalActions) {
+        final List<ObjectAction> includedActions = Lists.newArrayList();
+        for (int i = 0; i < originalActions.size(); i++) {
+            final String id2 = originalActions.get(i).getId();
+            if (includes(id2)) {
+                includedActions.add(originalActions.get(i));
+            }
+        }
+
+        return includedActions;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
new file mode 100644
index 0000000..74a24e6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
@@ -0,0 +1,45 @@
+/*
+ *  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.view.field;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+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.processor.Request;
+
+public class LinkField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        final String field = request.getOptionalProperty(NAME);
+        final String variable = request.getOptionalProperty(REFERENCE_NAME, RequestContext.RESULT);
+        final String scope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
+        final String forwardView = request.getOptionalProperty(VIEW, "_generic." + Dispatcher.EXTENSION);
+        final LinkedFieldsBlock tag = (LinkedFieldsBlock) request.getBlockContent();
+        tag.link(field, variable, scope, forwardView);
+    }
+
+    @Override
+    public String getName() {
+        return "link";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
new file mode 100644
index 0000000..5049a3d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.scimpi.dispatcher.view.field;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+
+public class LinkedFieldsBlock extends InclusionList {
+    private final Map<String, LinkedObject> linkedFields = new HashMap<String, LinkedObject>();
+
+    public void link(final String field, final String variable, final String scope, final String forwardView) {
+        include(field);
+        linkedFields.put(field, new LinkedObject(variable, scope, forwardView));
+    }
+
+    public LinkedObject[] linkedFields(final List<ObjectAssociation> fields) {
+        final LinkedObject[] includedFields = new LinkedObject[fields.size()];
+        for (int i = 0; i < fields.size(); i++) {
+            final String id2 = fields.get(i).getId();
+            if (fields.get(i).isOneToOneAssociation() && linkedFields.containsKey(id2)) {
+                includedFields[i] = linkedFields.get(id2);
+            }
+        }
+        return includedFields;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
new file mode 100644
index 0000000..d2c8548
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
@@ -0,0 +1,58 @@
+/*
+ *  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.view.field;
+
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+
+public class LinkedObject {
+    private final String variable;
+    private final String scope;
+    private String forwardView;
+
+    public LinkedObject(final String variable, final String scope, final String forwardView) {
+        this.variable = variable;
+        this.scope = scope;
+        this.forwardView = forwardView;
+    }
+
+    public LinkedObject(final String forwardView) {
+        this.forwardView = forwardView;
+        scope = Scope.INTERACTION.toString();
+        variable = RequestContext.RESULT;
+    }
+
+    public String getVariable() {
+        return variable;
+    }
+
+    public String getScope() {
+        return scope;
+    }
+
+    public String getForwardView() {
+        return forwardView;
+    }
+
+    public void setForwardView(final String path) {
+        forwardView = path;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
new file mode 100644
index 0000000..9245bc6
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
@@ -0,0 +1,41 @@
+/*
+ *  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.view.form;
+
+import org.apache.commons.lang.StringEscapeUtils;
+
+public class HiddenInputField {
+    private final String value;
+    private final String name;
+
+    public HiddenInputField(final String name, final String value) {
+        this.value = value;
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return StringEscapeUtils.escapeHtml(value);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
new file mode 100644
index 0000000..fd44cc8
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
@@ -0,0 +1,214 @@
+/*
+ *  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.view.form;
+
+import org.apache.isis.core.commons.exceptions.UnknownTypeException;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
+
+public class HtmlFormBuilder {
+
+    public static void createForm(
+            final Request request,
+            final String action,
+            final HiddenInputField[] hiddenFields,
+            final InputField[] fields,
+            final String className,
+            final String id,
+            final String formTitle,
+            final String labelDelimiter,
+            final String description,
+            final String helpReference,
+            final String buttonTitle,
+            final String errors,
+            final String cancelTo) {
+
+        String classSegment = " class=\"" + className + (id == null ? "\"" : "\" id=\"" + id + "\"");
+        request.appendHtml("<form " + classSegment + " action=\"" + action + "\" method=\"post\" accept-charset=\"UTF-8\">\n");
+        if (formTitle != null && formTitle.trim().length() > 0) {
+            classSegment = " class=\"title\"";
+            request.appendHtml("<div" + classSegment + ">");
+            request.appendAsHtmlEncoded(formTitle);
+            request.appendHtml("</div>\n");
+        }
+
+        // TODO reinstate fieldsets when we can specify them
+        // request.appendHtml("<fieldset>\n");
+
+        final String cls = "errors";
+        if (errors != null) {
+            request.appendHtml("<div class=\"" + cls + "\">");
+            request.appendAsHtmlEncoded(errors);
+            request.appendHtml("</div>");
+        }
+        for (final HiddenInputField hiddenField : hiddenFields) {
+            if (hiddenField == null) {
+                continue;
+            }
+            request.appendHtml("  <input type=\"hidden\" name=\"" + hiddenField.getName() + "\" value=\"");
+            request.appendAsHtmlEncoded(hiddenField.getValue());
+            request.appendHtml("\" />\n");
+        }
+        request.appendHtml(request.getContext().interactionFields());
+        for (final InputField fld : fields) {
+            if (fld.isHidden()) {
+                request.appendHtml("  <input type=\"hidden\" name=\"" + fld.getName() + "\" value=\"");
+                request.appendAsHtmlEncoded(fld.getValue());
+                request.appendHtml("\" />\n");
+            } else {
+                final String errorSegment = fld.getErrorText() == null ? "" : "<span class=\"error\">" + fld.getErrorText() + "</span>";
+                final String fieldSegment = createField(fld);
+                final String helpSegment = HelpLink.createHelpSegment(fld.getDescription(), fld.getHelpReference());
+                final String title = fld.getDescription().equals("") ? "" : " title=\"" + fld.getDescription() + "\"";
+                request.appendHtml("  <div class=\"field " + fld.getName() + "\"><label class=\"label\" " + title + ">");
+                request.appendAsHtmlEncoded(fld.getLabel());
+                request.appendHtml(labelDelimiter + "</label>" + fieldSegment + errorSegment + helpSegment + "</div>\n");
+            }
+        }
+
+        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"");
+        request.appendAsHtmlEncoded(buttonTitle);
+        request.appendHtml("\" name=\"execute\" />\n");
+        HelpLink.append(request, description, helpReference);
+        // TODO alllow forms to be cancelled, returning to previous page.
+        // request.appendHtml("  <div class=\"action\"><a class=\"button\" href=\"reset\">Cancel</a></div>");
+
+        if (cancelTo != null) {
+            request.appendHtml("  <input class=\"button\" type=\"button\" value=\"");
+            request.appendAsHtmlEncoded("Cancel");
+            request.appendHtml("\" onclick=\"window.location = '" + cancelTo + "'\" name=\"cancel\" />\n");
+        }
+
+        // TODO reinstate fieldsets when we can specify them
+        // request.appendHtml("</fieldset>\n");
+        request.appendHtml("</form>\n");
+    }
+
+    private static String createField(final InputField field) {
+        if (field.isHidden()) {
+            if (field.getType() == InputField.REFERENCE) {
+                return createObjectField(field, "hidden");
+            } else {
+                return "";
+            }
+        } else {
+            if (field.getType() == InputField.HTML) {
+                return "<span class=\"value\">" + field.getHtml() + "</span>";
+            } else if (field.getOptionsText() != null) {
+                return createOptions(field);
+            } else if (field.getType() == InputField.REFERENCE) {
+                return createObjectField(field, "text");
+            } else if (field.getType() == InputField.CHECKBOX) {
+                return createCheckbox(field);
+            } else if (field.getType() == InputField.PASSWORD) {
+                return createPasswordField(field);
+            } else if (field.getType() == InputField.TEXT) {
+                if (field.getHeight() > 1) {
+                    return createTextArea(field);
+                } else {
+                    return createTextField(field);
+                }
+            } else {
+                throw new UnknownTypeException(field.toString());
+            }
+        }
+    }
+
+    private static String createObjectField(final InputField field, final String type) {
+        return field.getHtml();
+    }
+
+    private static String createTextArea(final InputField field) {
+        final String columnsSegment = field.getWidth() == 0 ? "" : " cols=\"" + field.getWidth() / field.getHeight() + "\"";
+        final String rowsSegment = field.getHeight() == 0 ? "" : " rows=\"" + field.getHeight() + "\"";
+        final String wrapSegment = !field.isWrapped() ? "" : " wrap=\"off\"";
+        final String requiredSegment = !field.isRequired() ? "" : " class=\"required\"";
+        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        final String maxLength = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
+        return "<textarea" + requiredSegment + " name=\"" + field.getName() + "\"" + columnsSegment + rowsSegment + wrapSegment
+                + maxLength + disabled + ">" + Request.getEncoder().encoder(field.getValue()) + "</textarea>";
+    }
+
+    private static String createPasswordField(final InputField field) {
+        final String extra = " autocomplete=\"off\"";
+        return createTextField(field, "password", extra);
+    }
+
+    private static String createTextField(final InputField field) {
+        return createTextField(field, "text", "");
+    }
+
+    private static String createTextField(final InputField field, final String type, final String additionalAttributes) {
+        final String value = field.getValue();
+        final String valueSegment = value == null ? "" : " value=\"" + Request.getEncoder().encoder(value) + "\"";
+        final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
+        final String maxLengthSegment = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
+        final String requiredSegment = !field.isRequired() ? "" : " required";
+        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        return "<input class=\"" + field.getDataType() + requiredSegment + "\" type=\"" + type + "\" name=\"" + field.getName() + "\"" + 
+                valueSegment + lengthSegment + maxLengthSegment + disabled + additionalAttributes + " />";
+    }
+
+    private static String createCheckbox(final InputField field) {
+        final String entryText = field.getValue();
+        final String valueSegment = entryText != null && entryText.toLowerCase().equals("true") ? " checked=\"checked\"" : "";
+        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        return "<input type=\"checkbox\" name=\"" + field.getName() + "\" value=\"true\" " + valueSegment + disabled + " />";
+    }
+
+    private static String createOptions(final InputField field) {
+        final String[] options = field.getOptionsText();
+        final String[] ids = field.getOptionValues();
+        final int length = options.length;
+        final String classSegment = field.isRequired() && length == 0 ? " class=\"required\"" : "";
+        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        final StringBuffer str = new StringBuffer();
+        str.append("\n  <select name=\"" + field.getName() + "\"" + disabled  + classSegment + ">\n");
+        boolean offerOther = false;
+        for (int i = 0; i < length; i++) {
+            final String selectedSegment = field.getValue() == null || ids[i].equals(field.getValue()) ? " selected=\"selected\"" : "";
+            if (field.getType() == InputField.TEXT && options[i].equals("__other")) {
+                offerOther = true;
+            } else {
+                str.append("    <option value=\"" + Request.getEncoder().encoder(ids[i]) + "\"" + selectedSegment + ">" + Request.getEncoder().encoder(options[i]) + "</option>\n");
+            }
+        }
+        if (!field.isRequired() || length == 0) {
+            final String selectedSegment = field.getValue() == null || field.getValue().equals("") ? " selected=\"selected\"" : "";
+            str.append("    <option value=\"null\"" + selectedSegment + "></option>\n");
+        }
+        if (offerOther) {
+            str.append("    <option value=\"-OTHER-\">Other:</option>\n");
+        }
+        str.append("  </select>");
+        if (field.getType() == InputField.TEXT) {
+            final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
+            final String hideSegment = " style=\"display: none;\" "; // TODO
+                                                                     // only
+                                                                     // hide
+                                                                     // when JS
+                                                                     // enabled
+            str.append("  <input type=\"text\" name=\"" + field.getName() + "-other\"" + hideSegment + lengthSegment + disabled + " />");
+        }
+        str.append("\n");
+        return str.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
new file mode 100644
index 0000000..0382cc4
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
@@ -0,0 +1,224 @@
+/*
+ *  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.view.form;
+
+import org.apache.isis.core.commons.util.ToString;
+
+public class InputField {
+    public static final int REFERENCE = 1;
+    public static final int TEXT = 2;
+    public static final int PASSWORD = 3;
+    public static final int CHECKBOX = 4;
+    public static final int HTML = 5;
+
+    private int type;
+
+    private String label;
+    private String description = "";
+    private String helpReference;
+    private String errorText;
+    private final String name;
+    private String dataType;
+
+    private int maxLength = 0;
+    private int width;
+    private int height = 1;
+    private boolean isWrapped = false;
+
+    private boolean isRequired = true;
+    private boolean isEditable = true;
+    private boolean isHidden = false;
+
+    private String[] optionsText;
+    private String[] optionValues;
+
+    private String value;
+    private String html;
+
+    public InputField(final String name) {
+        this.name = name;
+    }
+
+    public String getErrorText() {
+        return errorText;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getDataType() {
+        return dataType;
+    }
+    
+    public String getHelpReference() {
+        return helpReference;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean isEditable() {
+        return isEditable;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getHtml() {
+        return html;
+    }
+
+    public boolean isHidden() {
+        return isHidden;
+    }
+
+    public String[] getOptionsText() {
+        return optionsText;
+    }
+
+    public String[] getOptionValues() {
+        return optionValues;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public boolean isWrapped() {
+        return isWrapped;
+    }
+
+    public boolean isRequired() {
+        return isRequired;
+    }
+
+    public int getMaxLength() {
+        return maxLength;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setErrorText(final String errorText) {
+        this.errorText = errorText;
+    }
+
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+
+    public void setHelpReference(final String helpReference) {
+        this.helpReference = helpReference;
+    }
+
+    public void setLabel(final String label) {
+        this.label = label;
+    }
+
+    public void setEditable(final boolean isEditable) {
+        this.isEditable = isEditable;
+        isRequired = isRequired && isEditable;
+    }
+
+    public void setValue(final String entryText) {
+        this.value = entryText;
+    }
+
+    public void setHtml(final String html) {
+        this.html = html;
+    }
+
+    public void setHidden(final boolean isHidden) {
+        this.isHidden = isHidden;
+    }
+
+    public void setWidth(final int width) {
+        this.width = width;
+    }
+
+    public void setOptions(final String[] optionsText, final String[] optionValues) {
+        this.optionsText = optionsText;
+        this.optionValues = optionValues;
+    }
+
+    public void setHeight(final int height) {
+        this.height = height;
+    }
+
+    public void setWrapped(final boolean isWrapped) {
+        this.isWrapped = isWrapped;
+    }
+
+    public void setRequired(final boolean isRequired) {
+        this.isRequired = isRequired;
+    }
+
+    public void setMaxLength(final int maxLength) {
+        this.maxLength = maxLength;
+    }
+
+    public void setType(final int type) {
+        this.type = type;
+    }
+
+    public void setDataType(String dataType) {
+        this.dataType = dataType;
+    }
+    
+    @Override
+    public String toString() {
+        final ToString str = new ToString(this);
+        str.append("name", name);
+        String typeName;
+        switch (type) {
+        case CHECKBOX:
+            typeName = "checkbox";
+            break;
+        case REFERENCE:
+            typeName = "reference";
+            break;
+        case TEXT:
+            typeName = "text";
+            break;
+        default:
+            typeName = "unset";
+            break;
+        }
+        str.append("type", typeName);
+        str.append("datatype", dataType);
+        str.append("editable", isEditable);
+        str.append("hidden", isHidden);
+        str.append("required", isRequired);
+        return str.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
new file mode 100644
index 0000000..1632f5d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logoff.java
@@ -0,0 +1,38 @@
+/*
+ *  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.view.logon;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.logon.LogoutAction;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Logoff extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        LogoutAction.logoutUser(request.getContext());
+    }
+
+    @Override
+    public String getName() {
+        return "logoff";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
new file mode 100644
index 0000000..facd79d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
@@ -0,0 +1,126 @@
+/*
+ *  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.view.logon;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.commons.authentication.AnonymousSession;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+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.edit.FieldEditState;
+import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.HiddenInputField;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
+
+public class Logon extends AbstractElementProcessor {
+
+    @Override
+    public void process(final Request request) {
+        String view = request.getOptionalProperty(VIEW);
+        RequestContext context = request.getContext();
+        if (view == null) {
+            view = (String) context.getVariable("login-path");
+        }
+
+        final boolean isNotLoggedIn = IsisContext.getSession().getAuthenticationSession() instanceof AnonymousSession;
+        if (isNotLoggedIn) {            
+            loginForm(request, view);
+        }
+    }
+
+    public static void loginForm(final Request request, final String view) {
+        final String object = request.getOptionalProperty(OBJECT);
+        final String method = request.getOptionalProperty(METHOD, "logon");
+        final String result = request.getOptionalProperty(RESULT_NAME, "_user");
+        final String resultScope = request.getOptionalProperty(SCOPE, Scope.SESSION.name());
+        final String role = request.getOptionalProperty("field", "roles");
+//        final String isisUser = request.getOptionalProperty("isis-user", "_web_default");
+        final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
+        final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
+
+        // TODO error if all values are not set (not if use type is not set and all others are still defaults);
+
+        if (object != null) {
+            RequestContext context = request.getContext();
+            context.addVariable(LOGON_OBJECT, object, Scope.SESSION);
+            context.addVariable(LOGON_METHOD, method, Scope.SESSION);
+            context.addVariable(LOGON_RESULT_NAME, result, Scope.SESSION);
+            context.addVariable(LOGON_SCOPE, resultScope, Scope.SESSION);
+            context.addVariable(PREFIX + "roles-field", role, Scope.SESSION);
+//            context.addVariable(PREFIX + "isis-user", isisUser, Scope.SESSION);
+            context.addVariable(LOGON_FORM_ID, formId, Scope.SESSION);
+        }
+        
+        final String error = request.getOptionalProperty(ERROR, request.getContext().getRequestedFile());
+        final List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
+        hiddenFields.add(new HiddenInputField(ERROR, error));
+        if (view != null) {
+            hiddenFields.add(new HiddenInputField(VIEW, view));
+        }
+        hiddenFields.add(new HiddenInputField("_" + FORM_ID, formId));
+
+        final FormState entryState = (FormState) request.getContext().getVariable(ENTRY_FIELDS);
+        boolean isforThisForm = entryState != null && entryState.isForForm(formId);
+        if (entryState != null && entryState.isForForm(formId)) {
+        }
+        final InputField nameField = createdField("username", "User Name", InputField.TEXT, isforThisForm ? entryState : null);
+        final String width = request.getOptionalProperty("width");
+        if (width != null) {
+            final int w = Integer.valueOf(width).intValue();
+            nameField.setWidth(w);
+        }
+        final InputField passwordField = createdField("password", "Password", InputField.PASSWORD, isforThisForm ? entryState : null);
+        final InputField[] fields = new InputField[] { nameField, passwordField, };
+
+        final String formTitle = request.getOptionalProperty(FORM_TITLE);
+        final String loginButtonTitle = request.getOptionalProperty(BUTTON_TITLE, "Log in");
+        final String className = request.getOptionalProperty(CLASS, "login");
+        final String id = request.getOptionalProperty(ID, "logon");
+
+        HtmlFormBuilder.createForm(request, "logon.app", hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]), fields,
+                className, id, formTitle, labelDelimiter, null, null, loginButtonTitle,
+                isforThisForm && entryState != null ? entryState.getError() : null , null);        
+    }
+
+    protected static InputField createdField(final String fieldName, final String fieldLabel, final int type, final FormState entryState) {
+        final InputField nameField = new InputField(fieldName);
+        nameField.setType(type);
+        nameField.setLabel(fieldLabel);
+        if (entryState != null) {
+            final FieldEditState fieldState = entryState.getField(fieldName);
+            final String entry = fieldState == null ? "" : fieldState.getEntry();
+            nameField.setValue(entry);
+            final String error = fieldState == null ? "" : fieldState.getError();
+            nameField.setErrorText(error);
+        }
+        return nameField;
+    }
+
+    @Override
+    public String getName() {
+        return "logon";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java
new file mode 100644
index 0000000..83f2597
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/RestrictAccess.java
@@ -0,0 +1,41 @@
+/*
+ *  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.view.logon;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class RestrictAccess extends AbstractElementProcessor {
+    private static final String LOGIN_VIEW = "login-view";
+    private static final String DEFAULT_LOGIN_VIEW = "login." + Dispatcher.EXTENSION;
+
+    public String getName() {
+        return "restrict-access";
+    }
+
+    public void process(Request request) {
+        if (!request.getContext().isUserAuthenticated()) { 
+            final String view = request.getOptionalProperty(LOGIN_VIEW, DEFAULT_LOGIN_VIEW);
+            request.getContext().redirectTo(view);
+        }
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java
new file mode 100644
index 0000000..17cd472
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Secure.java
@@ -0,0 +1,45 @@
+/*
+ *  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.view.logon;
+
+import org.apache.isis.core.commons.authentication.AnonymousSession;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class Secure extends AbstractElementProcessor {
+    private static final String LOGIN_VIEW = "login-view";
+
+    @Override
+    public void process(final Request request) {
+        final boolean isLoggedIn = !(IsisContext.getSession().getAuthenticationSession() instanceof AnonymousSession);
+        if (!isLoggedIn) {
+            IsisContext.getMessageBroker().addWarning("You are not currently logged in! Please log in so you can continue.");
+            final String view = request.getOptionalProperty(LOGIN_VIEW, "/login.shtml");
+            request.getContext().redirectTo(view);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "secure";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java
new file mode 100644
index 0000000..4254746
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/User.java
@@ -0,0 +1,77 @@
+/*
+ *  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.view.logon;
+
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class User extends AbstractElementProcessor {
+    private static final String LOGIN_VIEW = "login-view";
+    private static final String DEFAULT_LOGIN_VIEW = "login." + Dispatcher.EXTENSION;
+    private static final String LOGOUT_VIEW = "logout-view";
+    private static final String DEFAULT_LOGOUT_VIEW = "logout." + Dispatcher.EXTENSION;
+
+    @Override
+    public void process(final Request request) {
+        final boolean isAuthenticatedn = request.getContext().isUserAuthenticated();
+        request.appendHtml("<div class=\"user\">");
+        if (isAuthenticatedn) {
+            displayUserAndLogoutLink(request);
+        } else {
+            displayLoginForm(request);
+        }
+        request.appendHtml("</div>");
+    }
+
+    public void displayLoginForm(final Request request) {
+        String loginView = request.getOptionalProperty(LOGIN_VIEW);
+        if (loginView == null) {
+            Logon.loginForm(request, ".");
+        } else {
+            if (loginView.trim().length() == 0) {
+                loginView = DEFAULT_LOGIN_VIEW;
+            }
+            request.appendHtml("<a div class=\"link\" href=\"" + loginView + "\">Log in</a>");
+        }
+    }
+
+    public void displayUserAndLogoutLink(final Request request) {
+        String user = request.getOptionalProperty(NAME);
+        if (user == null) {
+            user = (String) request.getContext().getVariable("_username");
+        }
+        if (user == null) {
+            user = IsisContext.getAuthenticationSession().getUserName();
+        }
+        request.appendHtml("Welcome <span class=\"name\">");
+        request.appendAsHtmlEncoded(user);
+        request.appendHtml("</span>, ");
+        final String logoutView = request.getOptionalProperty(LOGOUT_VIEW, DEFAULT_LOGOUT_VIEW);
+        request.appendHtml("<a class=\"link\" href=\"logout.app?view=" + logoutView + "\">Log out</a>");
+    }
+
+    @Override
+    public String getName() {
+        return "user";
+    }
+
+}


[09/22] isis git commit: ISIS-720: mothballing scimpi

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
new file mode 100644
index 0000000..8e5822d
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugAction.java
@@ -0,0 +1,257 @@
+/*
+ *  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.debug;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+
+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;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.util.Dump;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.Action;
+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;
+
+public class DebugAction implements Action {
+    private final Dispatcher dispatcher;
+
+    public DebugAction(final Dispatcher dispatcher) {
+        this.dispatcher = dispatcher;
+    }
+
+    @Override
+    public String getName() {
+        return "debug";
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        if (context.isDebugDisabled()) {
+            throw new ForbiddenException("Can't access debug action when debug is disabled");
+        }
+
+        final String action = context.getParameter("action");
+        if ("list-i18n".equals(action)) {
+            i18n(context, null);
+        } else if ("list-authorization".equals(action)) {
+            authorization(context, null);
+        } else if (context.getParameter("mode") != null) {
+            final boolean isDebugOn = context.getParameter("mode").equals("debug");
+            context.addVariable("debug-on", isDebugOn, Scope.SESSION);
+            // TODO need to use configuration to find path
+            context.setRequestPath("/debug/debug.shtml");
+        } else {
+
+            // TODO remove - replaced by Debug tag
+            final DebugHtmlWriter view = new DebugHtmlWriter(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>");
+            view.appendln(" | <a href=\"debug.app?action=list-i18n\">I18N File</a>");
+            view.appendln(" | <a href=\"debug.app?action=list-authorization\">Authorization File</a>");
+            view.appendln(" | <a href=\"debug.app?action=context\">Context</a>");
+            view.appendln(" | <a href=\"debug.app?action=dispatcher\">Dispatcher</a>");
+            view.appendln("</div>");
+
+            if ("specifications".equals(action)) {
+                listSpecifications(view);
+            } else if ("specification".equals(action)) {
+                // specification(context, view);
+            } else if ("object".equals(action)) {
+                object(context, view);
+            } else if ("system".equals(action)) {
+                system(context, view);
+            } else if ("context".equals(action)) {
+                context.append(view);
+            } else if ("dispatcher".equals(action)) {
+                dispatcher.debug(view);
+            }
+
+            context.clearRequestedPath();
+        }
+    }
+
+    private void object(final RequestContext context, final DebugHtmlWriter view) {
+        final ObjectAdapter object = context.getMappedObjectOrResult(context.getParameter("object"));
+        final DebugString str = new DebugString();
+        Dump.adapter(object, str);
+        Dump.graph(object, IsisContext.getAuthenticationSession(), str);
+        view.appendTitle(object.getSpecification().getFullIdentifier());
+        view.appendln("<pre class=\"debug\">" + str + "</pre>");
+    }
+
+    private void system(final RequestContext context, final DebugHtmlWriter view) {
+        final DebuggableWithTitle[] debug = IsisContext.debugSystem();
+        view.appendTitle("System");
+        for (final DebuggableWithTitle element2 : debug) {
+            final DebugString str = new DebugString();
+            element2.debugData(str);
+            view.appendTitle(element2.debugTitle());
+            view.appendln("<pre class=\"debug\">" + str + "</pre>");
+        }
+    }
+
+    private void i18n(final RequestContext context, final DebugHtmlWriter view) {
+        final Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
+        final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications);
+        Collections.sort(specs, new Comparator<ObjectSpecification>() {
+            @Override
+            public int compare(final ObjectSpecification o1, final ObjectSpecification o2) {
+                return o1.getShortIdentifier().compareTo(o2.getShortIdentifier());
+            }
+        });
+        final Function<ObjectSpecification, String> className = ObjectSpecification.FUNCTION_FULLY_QUALIFIED_CLASS_NAME;
+        final List<String> fullIdentifierList = Lists.newArrayList(Collections2.transform(specs, className));
+        for (final String fullIdentifier : fullIdentifierList) {
+            final ObjectSpecification spec = getSpecificationLoader().loadSpecification(fullIdentifier);
+            if (spec.getAssociations(Contributed.EXCLUDED).size() == 0 && spec.getObjectActions(Contributed.EXCLUDED).size() == 0) {
+                continue;
+            }
+            final String name = spec.getIdentifier().toClassIdentityString();
+            context.getWriter().append("# " + spec.getShortIdentifier() + "\n");
+            for (final ObjectAssociation assoc : spec.getAssociations(Contributed.EXCLUDED)) {
+                context.getWriter().append("#" + name + ".property." + assoc.getId() + ".name" + "=\n");
+                context.getWriter().append("#" + name + ".property." + assoc.getId() + ".description" + "=\n");
+                context.getWriter().append("#" + name + ".property." + assoc.getId() + ".help" + "=\n");
+            }
+            for (final ObjectAction action : spec.getObjectActions(Contributed.EXCLUDED)) {
+                context.getWriter().append("#" + name + ".action." + action.getId() + ".name" + "=\n");
+                context.getWriter().append("#" + name + ".action." + action.getId() + ".description" + "=\n");
+                context.getWriter().append("#" + name + ".action." + action.getId() + ".help" + "=\n");
+            }
+            context.getWriter().append("\n");
+        }
+    }
+
+    private void authorization(final RequestContext context, final DebugHtmlWriter view) {
+        final Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
+        final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications);
+        Collections.sort(specs, new Comparator<ObjectSpecification>() {
+            @Override
+            public int compare(final ObjectSpecification o1, final ObjectSpecification o2) {
+                return o1.getShortIdentifier().compareTo(o2.getShortIdentifier());
+            }
+        });
+        final Function<ObjectSpecification, String> className = ObjectSpecification.FUNCTION_FULLY_QUALIFIED_CLASS_NAME;
+        final List<String> fullIdentifierList = Lists.newArrayList(Collections2.transform(specs, className));
+        
+        for (final String fullIdentifier : fullIdentifierList) {
+            final ObjectSpecification spec = getSpecificationLoader().loadSpecification(fullIdentifier);
+            if (spec.getAssociations(Contributed.EXCLUDED).size() == 0 && spec.getObjectActions(Contributed.EXCLUDED).size() == 0) {
+                continue;
+            }
+            final String name = spec.getIdentifier().toClassIdentityString();
+            boolean isAbstract = spec.isAbstract();
+            context.getWriter().append("### " + spec.getShortIdentifier() + (isAbstract ? " (abstract)" : "") + " ###\n");
+            context.getWriter().append((isAbstract ? "#" : "") + name + ":roles\n\n");
+        }
+        context.getWriter().append("\n\n");
+        
+        for (final String fullIdentifier : fullIdentifierList) {
+            final ObjectSpecification spec = getSpecificationLoader().loadSpecification(fullIdentifier);
+            if (spec.getAssociations(Contributed.EXCLUDED).size() == 0 && spec.getObjectActions(Contributed.EXCLUDED).size() == 0) {
+                continue;
+            }
+            final String name = spec.getIdentifier().toClassIdentityString();
+            boolean isAbstract = spec.isAbstract();
+            context.getWriter().append("### " + spec.getShortIdentifier() + (isAbstract ? " (abstract)" : "") + " ###\n");
+            context.getWriter().append((isAbstract ? "#" : "") + name + ":roles\n");
+            for (final ObjectAssociation assoc : spec.getAssociations(Contributed.EXCLUDED)) {
+                context.getWriter().append("#" + name + "#" + assoc.getId() + ":roles\n");
+                // context.getWriter().append("#" + name + ".property." +
+                // assoc.getId() + ".description" + "=\n");
+                // context.getWriter().append("#" + name + ".property." +
+                // assoc.getId() + ".help" + "=\n");
+            }
+            for (final ObjectAction action : spec.getObjectActions(Contributed.EXCLUDED)) {
+                context.getWriter().append("#" + name + "#" + action.getId() + "():roles\n");
+                // context.getWriter().append("#" + name + ".action." +
+                // action.getId() + ".description" + "=\n");
+                // context.getWriter().append("#" + name + ".action." +
+                // action.getId() + ".help" + "=\n");
+            }
+            context.getWriter().append("\n");
+        }
+    }
+
+    private void listSpecifications(final DebugHtmlWriter view) {
+        final List<ObjectSpecification> fullIdentifierList = new ArrayList<ObjectSpecification>(getSpecificationLoader().allSpecifications());
+        Collections.sort(fullIdentifierList, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
+        view.appendTitle("Specifications");
+        for (final ObjectSpecification spec : fullIdentifierList) {
+            final String name = spec.getSingularName();
+            view.appendln(name, "");
+            // view.appendln(name, specificationLink(spec));
+        }
+
+        /*
+         * new Comparator<ObjectSpecification>() { public int
+         * compare(ObjectSpecification o1, ObjectSpecification o2) { return
+         * o1.getSingularName().compareTo(o2.getSingularName()); }});
+         * 
+         * /* Collection<ObjectSpecification> allSpecifications =
+         * getSpecificationLoader().allSpecifications(); Collection<String> list
+         * = Collections2.transform(allSpecifications,
+         * ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE); final
+         * List<String> fullIdentifierList = Lists.newArrayList(list); /*
+         * Collections.sort(fullIdentifierList, new
+         * Comparator<ObjectSpecification>() { public int
+         * compare(ObjectSpecification o1, ObjectSpecification o2) { return
+         * o1.getSingularName().compareTo(o2.getSingularName()); }});
+         */
+        /*
+         * view.divider("Specifications"); for (String fullIdentifier :
+         * fullIdentifierList) { ObjectSpecification spec =
+         * getSpecificationLoader().loadSpecification(fullIdentifier); String
+         * name = spec.getSingularName(); view.appendRow(name,
+         * specificationLink(spec)); }
+         */
+    }
+
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    @Override
+    public void init() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java
new file mode 100644
index 0000000..112bc77
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugHtmlWriter.java
@@ -0,0 +1,45 @@
+/*
+ *  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.debug;
+
+import java.io.PrintWriter;
+
+import org.apache.isis.core.commons.debug.DebugHtmlStringAbstract;
+
+public class DebugHtmlWriter extends DebugHtmlStringAbstract {
+
+    private final PrintWriter writer;
+
+    public DebugHtmlWriter(final PrintWriter writer, final boolean createPage) {
+        super(createPage);
+        this.writer = writer;
+        header();
+    }
+
+    @Override
+    protected void appendHtml(final String html) {
+        writer.println(html);
+    }
+
+    @Override
+    protected void doClose() {
+        footer();
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java
new file mode 100644
index 0000000..461ce84
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUserAction.java
@@ -0,0 +1,71 @@
+/*
+ *  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.debug;
+
+import java.io.IOException;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.Action;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+
+public class DebugUserAction implements Action {
+
+    private final DebugUsers debugUsers;
+
+    public DebugUserAction(final DebugUsers debugUsers) {
+        this.debugUsers = debugUsers;
+    }
+
+    @Override
+    public String getName() {
+        return "debug-user";
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        if (context.isDebugDisabled()) {
+            throw new ForbiddenException("Can't access debug action when debug is disabled");
+        }
+
+        final String method = context.getParameter(METHOD);
+        final String name = context.getParameter(NAME);
+        final String view = context.getParameter(VIEW);
+
+        if (method != null && method.equals("add")) {
+            debugUsers.add(name);
+        } else if (method != null && method.equals("remove")) {
+            debugUsers.remove(name);
+        } else {
+            throw new ScimpiException("Invalid debug-user action");
+        }
+
+        context.setRequestPath(view);
+    }
+
+    @Override
+    public void init() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java
new file mode 100644
index 0000000..20497cc
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsers.java
@@ -0,0 +1,98 @@
+/*
+ *  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.debug;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+
+public class DebugUsers {
+
+    private static Logger LOG = LoggerFactory.getLogger(DebugUsers.class);
+
+    private enum DebugMode {
+        OFF, ON, NAMED, SYSADMIN_ONLY
+    }
+
+    private static List<String> debugUsers = new ArrayList<String>();
+    private static DebugMode debugMode;
+
+    public void initialize() {
+        if (debugMode != null) {
+            throw new ScimpiException("Debug mode is already set up!");
+        }
+
+        final String debugUserEntry = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.debug.users", "");
+        final String[] users = debugUserEntry.split("\\|");
+        for (final String name : users) {
+            debugUsers.add(name.trim());
+        }
+
+        final String debugModeEntry = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.debug.mode");
+        if (debugModeEntry != null) {
+            try {
+                debugMode = DebugMode.valueOf(debugModeEntry.toUpperCase());
+                LOG.info("Debug mode set to " + debugMode);
+            } catch (final IllegalArgumentException e) {
+                LOG.error("Invalid debug mode - " + debugModeEntry + " - mode set to OFF");
+                debugMode = DebugMode.OFF;
+            }
+        } else {
+            debugMode = DebugMode.OFF;
+        }
+    }
+
+    public boolean isDebugEnabled(final AuthenticationSession session) {
+        if (debugMode == DebugMode.ON) {
+            return true;
+        } else if (session != null && debugMode == DebugMode.SYSADMIN_ONLY && session.getRoles().contains("sysadmin")) {
+            return true;
+        } else if (session != null && debugMode == DebugMode.NAMED && (debugUsers.contains(session.getUserName()) || session.getRoles().contains("sysadmin"))) {
+            return true;
+        }
+        return false;
+    }
+
+    public List<String> getNames() {
+        final ArrayList<String> users = new ArrayList<String>(debugUsers);
+        Collections.sort(users);
+        return users;
+    }
+
+    public void add(final String name) {
+        if (!debugUsers.contains(name)) {
+            debugUsers.add(name);
+            LOG.info("Added '" + debugMode + "' to debug users list");
+        }
+    }
+
+    public void remove(final String name) {
+        debugUsers.remove(name);
+        LOG.info("Removed '" + debugMode + "' from debug users list");
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java
new file mode 100644
index 0000000..360c48a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugUsersView.java
@@ -0,0 +1,50 @@
+/*
+ *  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.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class DebugUsersView extends AbstractElementProcessor {
+
+    @Override
+    public String getName() {
+        return "debug-users";
+    }
+
+    @Override
+    public void process(final Request request) {
+        final String view = request.getContext().getContextPath() + request.getContext().getResourceParentPath() + request.getContext().getResourceFile();
+
+        request.appendHtml("<form class=\"generic action\" action=\"debug-user.app\" method=\"post\" accept-charset=\"ISO-8859-1\">\n");
+        request.appendHtml("<div class=\"title\">Add Debug User</div>\n");
+        request.appendHtml("<div class=\"field\"><label>User Name:</label><input type=\"text\" name=\"name\" size=\"30\" /></div>\n");
+        request.appendHtml("<input type=\"hidden\" name=\"method\" value=\"add\" />\n");
+        request.appendHtml("<input type=\"hidden\" name=\"view\" value=\"" + view + "\" />\n");
+        request.appendHtml("<input class=\"button\" type=\"submit\" value=\"Add User\" />\n");
+        request.appendHtml("</form>\n");
+
+        request.appendHtml("<table class=\"debug\">\n<tr><th class=\"title\">Name</th><th class=\"title\"></th></tr>\n");
+        for (final String name : request.getContext().getDebugUsers()) {
+            request.appendHtml("<tr><th>" + name + "</th><th><a href=\"debug-user.app?method=remove&name=" + name + "&view=" + view + " \">remove</a></th></tr>\n");
+        }
+        request.appendHtml("</table>\n");
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java
new file mode 100644
index 0000000..3049b26
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorDetails.java
@@ -0,0 +1,35 @@
+/*
+ *  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.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+
+public class ErrorDetails extends AbstractElementProcessor {
+
+    public String getName() {
+        return "error-details";
+    }
+
+    public void process(final Request request) {
+        request.appendHtml(request.getContext().getErrorDetails());
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java
new file mode 100644
index 0000000..07538ce
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorMessage.java
@@ -0,0 +1,35 @@
+/*
+ *  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.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+
+public class ErrorMessage extends AbstractElementProcessor {
+
+    public String getName() {
+        return "error-message";
+    }
+
+    public void process(final Request request) {
+        request.appendAsHtmlEncoded(request.getContext().getErrorMessage());
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java
new file mode 100644
index 0000000..75700cc
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/ErrorReference.java
@@ -0,0 +1,35 @@
+/*
+ *  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.debug;
+
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+
+public class ErrorReference extends AbstractElementProcessor {
+
+    public String getName() {
+        return "error-reference";
+    }
+
+    public void process(final Request request) {
+        request.appendAsHtmlEncoded(request.getContext().getErrorReference());
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java
new file mode 100644
index 0000000..6c30c19
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/LogAction.java
@@ -0,0 +1,75 @@
+/*
+ *  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.debug;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.viewer.scimpi.dispatcher.Action;
+import org.apache.isis.viewer.scimpi.dispatcher.NotLoggedInException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+
+public class LogAction implements Action {
+
+    private static final Logger LOG = LoggerFactory.getLogger(LogAction.class);
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+
+        final AuthenticationSession session = context.getSession();
+        if (session == null) {
+            throw new NotLoggedInException();
+        }
+
+        final String levelName = (String) context.getVariable("level");
+
+        final org.apache.log4j.Level level = org.apache.log4j.Level.toLevel(levelName);
+        boolean changeLogged = false;
+        if (org.apache.log4j.Level.INFO.isGreaterOrEqual(org.apache.log4j.LogManager.getRootLogger().getLevel())) {
+            LOG.info("log level changed to " + level);
+            changeLogged = true;
+        }
+        org.apache.log4j.LogManager.getRootLogger().setLevel(level);
+        if (!changeLogged) {
+            LOG.info("log level changed to " + level);
+        }
+        final String view = (String) context.getVariable("view");
+        context.setRequestPath(view);
+
+    }
+
+    @Override
+    public String getName() {
+        return "log";
+    }
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
new file mode 100644
index 0000000..852ccea
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
@@ -0,0 +1,266 @@
+/*
+ *  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.edit;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.authentication.AnonymousSession;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+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;
+import org.apache.isis.core.metamodel.consent.Veto;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+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;
+
+public class EditAction implements Action {
+    public static final String ACTION = "edit";
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
+    @Override
+    public String getName() {
+        return ACTION;
+    }
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        AuthenticationSession session = context.getSession();
+        if (session == null) {
+            session = new AnonymousSession();
+        }
+
+        try {
+            final String objectId = context.getParameter("_" + OBJECT);
+            final String version = context.getParameter("_" + VERSION);
+            final String formId = context.getParameter("_" + FORM_ID);
+            String resultName = context.getParameter("_" + RESULT_NAME);
+            resultName = resultName == null ? RequestContext.RESULT : resultName;
+            final String override = context.getParameter("_" + RESULT_OVERRIDE);
+            String message = context.getParameter("_" + MESSAGE);
+
+            final ObjectAdapter adapter = context.getMappedObject(objectId);
+
+            final List<ObjectAssociation> fields = adapter.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, adapter, where));
+
+            for (final ObjectAssociation objectAssociation : fields) {
+                if (objectAssociation.isVisible(session, adapter, where).isVetoed()) {
+                    throw new NotLoggedInException();
+                }
+            }
+
+            final FormState entryState = validateObject(context, adapter, fields);
+            final Version adapterVersion = adapter.getVersion();
+            final Version formVersion = context.getVersion(version);
+            if (formVersion != null && adapterVersion.different(formVersion)) {
+
+                IsisContext.getMessageBroker().addMessage("The " + adapter.getSpecification().getSingularName() + " was edited " + "by another user (" + adapterVersion.getUser() + "). Please  make your changes based on their changes.");
+
+                final String view = context.getParameter("_" + ERROR);
+                context.setRequestPath(view, Dispatcher.EDIT);
+
+                entryState.setForm(formId);
+                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
+                context.addVariable(resultName, objectId, Scope.REQUEST);
+                if (override != null) {
+                    context.addVariable(resultName, override, Scope.REQUEST);
+                }
+
+            } else if (entryState.isValid()) {
+                changeObject(context, adapter, entryState, fields);
+
+                if (adapter.isTransient()) {
+                    IsisContext.getPersistenceSession().makePersistent(adapter);
+                    context.unmapObject(adapter, Scope.REQUEST);
+                }
+
+                String view = context.getParameter("_" + VIEW);
+
+                final String id = context.mapObject(adapter, Scope.REQUEST);
+                context.addVariable(resultName, id, Scope.REQUEST);
+                if (override != null) {
+                    context.addVariable(resultName, override, Scope.REQUEST);
+                }
+
+                final int questionMark = view == null ? -1 : view.indexOf("?");
+                if (questionMark > -1) {
+                    final String params = view.substring(questionMark + 1);
+                    final int equals = params.indexOf("=");
+                    context.addVariable(params.substring(0, equals), params.substring(equals + 1), Scope.REQUEST);
+                    view = view.substring(0, questionMark);
+                }
+                context.setRequestPath(view);
+                if (message == null) {
+                    message = "Saved changes to " + adapter.getSpecification().getSingularName();
+                } else if (message.equals("")) {
+                    message = null;
+                }
+                if (message != null) {
+                    final MessageBroker messageBroker = IsisContext.getMessageBroker();
+                    messageBroker.addMessage(message);
+                }
+
+            } else {
+                final String view = context.getParameter("_" + ERROR);
+                context.setRequestPath(view, Dispatcher.EDIT);
+
+                entryState.setForm(formId);
+                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
+                context.addVariable(resultName, objectId, Scope.REQUEST);
+                if (override != null) {
+                    context.addVariable(resultName, override, Scope.REQUEST);
+                }
+
+                final MessageBroker messageBroker = IsisContext.getMessageBroker();
+                messageBroker.addWarning(entryState.getError());
+            }
+
+        } catch (final RuntimeException e) {
+            IsisContext.getMessageBroker().getMessages();
+            IsisContext.getMessageBroker().getWarnings();
+            throw e;
+        }
+    }
+
+    private FormState validateObject(final RequestContext context, final ObjectAdapter object, final List<ObjectAssociation> fields) {
+        final FormState formState = new FormState();
+        for (int i = 0; i < fields.size(); i++) {
+            final ObjectAssociation field = fields.get(i);
+            final String fieldId = field.getId();
+            String newEntry = context.getParameter(fieldId);
+            if (fields.get(i).isOneToManyAssociation()) {
+                continue;
+            }
+            if (fields.get(i).isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+                continue;
+            }
+            if (field.isUsable(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
+                continue;
+            }
+
+            if (newEntry != null && newEntry.equals("-OTHER-")) {
+                newEntry = context.getParameter(fieldId + "-other");
+            }
+
+            if (newEntry == null) {
+                // TODO duplicated in EditObject; line 97
+                final ObjectSpecification spec = field.getSpecification();
+                if (spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(boolean.class)) || spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(Boolean.class))) {
+                    newEntry = FALSE;
+                } else {
+                    continue;
+                }
+            }
+            final FieldEditState fieldState = formState.createField(fieldId, newEntry);
+
+            Consent consent = null;
+            if (field.isMandatory() && (newEntry.equals("") || newEntry.equals("NULL"))) {
+                consent = new Veto(field.getName() + " required");
+                formState.setError("Not all fields have been set");
+            } else if (field.getSpecification().containsFacet(ParseableFacet.class)) {
+                try {
+                    final ParseableFacet facet = field.getSpecification().getFacet(ParseableFacet.class);
+                    final ObjectAdapter originalValue = field.get(object);
+                    Localization localization = IsisContext.getLocalization(); 
+                    final ObjectAdapter newValue = facet.parseTextEntry(originalValue, newEntry, localization); 
+                    consent = ((OneToOneAssociation) field).isAssociationValid(object, newValue);
+                    fieldState.setValue(newValue);
+                } catch (final TextEntryParseException e) {
+                    consent = new Veto(e.getMessage());
+                    // formState.setError("Not all fields have been entered correctly");
+                }
+
+            } else {
+                final ObjectAdapter associate = newEntry.equals("null") ? null : context.getMappedObject(newEntry);
+                if (associate != null) {
+                    IsisContext.getPersistenceSession().resolveImmediately(associate);
+                }
+                consent = ((OneToOneAssociation) field).isAssociationValid(object, associate);
+                fieldState.setValue(associate);
+
+            }
+            if (consent.isVetoed()) {
+                fieldState.setError(consent.getReason());
+                formState.setError("Not all fields have been entered correctly");
+            }
+        }
+
+        // TODO check the state of the complete object.
+        return formState;
+    }
+
+    private void changeObject(final RequestContext context, final ObjectAdapter object, final FormState editState, final List<ObjectAssociation> fields) {
+        for (int i = 0; i < fields.size(); i++) {
+            final FieldEditState field = editState.getField(fields.get(i).getId());
+            if (field == null) {
+                continue;
+            }
+            final String newEntry = field.getEntry();
+            final ObjectAdapter originalValue = fields.get(i).get(object);
+            final boolean isVisible = fields.get(i).isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed();
+            final boolean isUsable = fields.get(i).isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
+            final boolean bothEmpty = originalValue == null && newEntry.equals("");
+            final boolean bothSame = newEntry.equals(originalValue == null ? "" : originalValue.titleString());
+            if ((!isVisible || !isUsable) || bothEmpty || bothSame) {
+                if (fields.get(i).getSpecification().getFacet(ParseableFacet.class) == null) {
+                    // REVIEW restores object to loader
+                    context.getMappedObject(newEntry);
+                }
+                continue;
+            }
+
+            if (fields.get(i).getSpecification().containsFacet(ParseableFacet.class)) {
+                final ParseableFacet facet = fields.get(i).getSpecification().getFacet(ParseableFacet.class);
+                Localization localization = IsisContext.getLocalization(); 
+                final ObjectAdapter newValue = facet.parseTextEntry(originalValue, newEntry, localization);
+                ((OneToOneAssociation) fields.get(i)).set(object, newValue);
+            } else {
+                ((OneToOneAssociation) fields.get(i)).set(object, field.getValue());
+            }
+        }
+    }
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java
new file mode 100644
index 0000000..70e6789
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FieldEditState.java
@@ -0,0 +1,57 @@
+/*
+ *  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.edit;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+
+public class FieldEditState {
+    private final String entry;
+    private String reason;
+    private ObjectAdapter value;
+
+    public FieldEditState(final String entry) {
+        this.entry = entry;
+    }
+
+    public void setError(final String reason) {
+        this.reason = reason;
+    }
+
+    public boolean isEntryValid() {
+        return reason == null;
+    }
+
+    public String getEntry() {
+        return entry;
+    }
+
+    public String getError() {
+        return reason;
+    }
+
+    public ObjectAdapter getValue() {
+        return value;
+    }
+
+    public void setValue(final ObjectAdapter value) {
+        this.value = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java
new file mode 100644
index 0000000..7349837
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/FormState.java
@@ -0,0 +1,67 @@
+/*
+ *  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.edit;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class FormState {
+    private final Map<String, FieldEditState> fields = new HashMap<String, FieldEditState>();
+    private String error;
+    private String formId;
+
+    public FieldEditState createField(final String name, final String entry) {
+        final FieldEditState fieldEditState = new FieldEditState(entry);
+        fields.put(name, fieldEditState);
+        return fieldEditState;
+    }
+
+    public boolean isValid() {
+        final Iterator<FieldEditState> iterator = fields.values().iterator();
+        while (iterator.hasNext()) {
+            if (!iterator.next().isEntryValid()) {
+                return false;
+            }
+        }
+        return error == null;
+    }
+
+    public FieldEditState getField(final String name) {
+        return fields.get(name);
+    }
+
+    public void setError(final String error) {
+        this.error = error;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setForm(final String formId) {
+        this.formId = formId;
+    }
+
+    public boolean isForForm(final String formId) {
+        return this.formId == null || this.formId.equals(formId);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
new file mode 100644
index 0000000..919ccc2
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
@@ -0,0 +1,114 @@
+/*
+ *  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.edit;
+
+import java.io.IOException;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.commons.authentication.AnonymousSession;
+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.core.runtime.system.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.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
+
+/**
+ * Remove an element from a collection.
+ */
+public class RemoveAction implements Action {
+    public static final String ACTION = "remove";
+
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORMS;
+
+    @Override
+    public String getName() {
+        return ACTION;
+    }
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        AuthenticationSession session = context.getSession();
+        if (session == null) {
+            session = new AnonymousSession();
+        }
+
+        final String parentId = context.getParameter(OBJECT);
+        final String rowId = context.getParameter(ELEMENT);
+
+        try {
+            final ObjectAdapter parent = context.getMappedObject(parentId);
+            final ObjectAdapter row = context.getMappedObject(rowId);
+
+            final String fieldName = context.getParameter(FIELD);
+            final ObjectAssociation field = parent.getSpecification().getAssociation(fieldName);
+            if (field == null) {
+                throw new ScimpiException("No field " + fieldName + " in " + parent.getSpecification().getFullIdentifier());
+            }
+            if (field.isVisible(IsisContext.getAuthenticationSession(), parent, where).isVetoed()) {
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
+            }
+
+            ((OneToManyAssociation) field).removeElement(parent, row);
+
+            // TODO duplicated in EditAction
+            String view = context.getParameter(VIEW);
+            final String override = context.getParameter(RESULT_OVERRIDE);
+
+            String resultName = context.getParameter(RESULT_NAME);
+            resultName = resultName == null ? RequestContext.RESULT : resultName;
+
+            final String id = context.mapObject(parent, Scope.REQUEST);
+            context.addVariable(resultName, id, Scope.REQUEST);
+            if (override != null) {
+                context.addVariable(resultName, override, Scope.REQUEST);
+            }
+
+            final int questionMark = view == null ? -1 : view.indexOf("?");
+            if (questionMark > -1) {
+                final String params = view.substring(questionMark + 1);
+                final int equals = params.indexOf("=");
+                context.addVariable(params.substring(0, equals), params.substring(equals + 1), Scope.REQUEST);
+                view = view.substring(0, questionMark);
+            }
+            context.setRequestPath(view);
+            // TODO end of duplication
+
+        } catch (final RuntimeException e) {
+            IsisContext.getMessageBroker().getMessages();
+            IsisContext.getMessageBroker().getWarnings();
+            throw e;
+        }
+    }
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java
new file mode 100644
index 0000000..55809e0
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/DomainSession.java
@@ -0,0 +1,42 @@
+/*
+ *  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.logon;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSessionAbstract;
+import org.apache.isis.core.commons.encoding.DataInputExtended;
+
+public class DomainSession extends AuthenticationSessionAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String CODE = "";
+
+    public DomainSession(final String username, final List<String> roles) {
+        super(username, roles, CODE);
+    }
+    
+    public DomainSession(final DataInputExtended input) throws IOException {
+        super(input);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
new file mode 100644
index 0000000..e90740a
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogonAction.java
@@ -0,0 +1,175 @@
+/*
+ *  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.logon;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.applib.profiles.Localization;
+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.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.Action;
+import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+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.edit.FieldEditState;
+import org.apache.isis.viewer.scimpi.dispatcher.edit.FormState;
+import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
+
+
+public class LogonAction implements Action {
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        String username = context.getParameter("username");
+        String password = context.getParameter("password");
+        final String actualFormId = context.getParameter("_" + FORM_ID);
+        final String expectedFormId = context.getParameter(LOGON_FORM_ID);
+        boolean isDomainLogon = expectedFormId != null && expectedFormId.equals(actualFormId);
+        boolean isValid;
+
+        if (username == null || password == null) {
+            context.redirectTo("/");
+            return;
+        }
+        AuthenticationSession session = null;
+        if (username.length() == 0 || password.length() == 0) {
+            isValid = false;
+        } else {
+            if (isDomainLogon) {
+                final String objectId = context.getParameter(LOGON_OBJECT);
+                final String scope = context.getParameter(LOGON_SCOPE);
+                final String loginMethodName = context.getParameter(LOGON_METHOD);
+                final String roleFieldName = context.getParameter(PREFIX + "roles-field");
+                String resultName = context.getParameter(LOGON_RESULT_NAME);
+                resultName = resultName == null ? "_" + USER : resultName;
+
+                final ObjectAdapter object = MethodsUtils.findObject(context, objectId);
+                final ObjectAction loginAction = MethodsUtils.findAction(object, loginMethodName);
+                final int parameterCount = loginAction.getParameterCount();
+                final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];
+                List<ObjectActionParameter> parameters2 = loginAction.getParameters();
+                if (parameters.length != 2) {
+                    throw new ScimpiException("Expected two parameters for the log-on method: " + loginMethodName);
+                }
+
+                Localization localization = IsisContext.getLocalization(); 
+                ParseableFacet facet = parameters2.get(0).getSpecification().getFacet(ParseableFacet.class);
+                parameters[0] = facet.parseTextEntry(null, username, localization);
+                facet = parameters2.get(1).getSpecification().getFacet(ParseableFacet.class);
+                parameters[1] = facet.parseTextEntry(null, password, localization);
+                final ObjectAdapter result = loginAction.execute(object, parameters);
+                isValid = result != null;
+                if (isValid) {
+                    ObjectSpecification specification = result.getSpecification();
+                    ObjectAssociation association = specification.getAssociation(roleFieldName);
+                    if (association == null) {
+                        throw new ScimpiException("Expected a role name field called: " + roleFieldName);
+                    }
+                    ObjectAdapter role = association.get(result);
+                    List<String> roles = new ArrayList<String>();
+                    if (role != null) {
+                        String[] split = role.titleString().split("\\|");
+                        for (String r : split) {
+                            roles.add(r);
+                        }
+                    }
+                    //String domainRoleName = role == null ? "" : role.titleString(); 
+                    
+                    
+                    Scope scope2 = scope == null ? Scope.SESSION : RequestContext.scope(scope);
+                    final String resultId = context.mapObject(result, scope2);
+                    context.addVariable(resultName, resultId, scope);
+                    context.addVariable("_username", username, Scope.SESSION);
+                    
+                    context.clearVariable(LOGON_OBJECT, Scope.SESSION);
+                    context.clearVariable(LOGON_METHOD, Scope.SESSION);
+                    context.clearVariable(LOGON_RESULT_NAME, Scope.SESSION);
+                    context.clearVariable(LOGON_SCOPE, Scope.SESSION);
+                    context.clearVariable(PREFIX + "roles-field", Scope.SESSION);
+ //                   context.clearVariable(PREFIX + "isis-user", Scope.SESSION);
+                    context.clearVariable(LOGON_FORM_ID, Scope.SESSION);
+
+                    session = new DomainSession(result.titleString(), roles);
+                } else {
+                    session = context.getSession();
+                }
+                
+            } else {
+                session = UserManager.authenticate(new AuthenticationRequestPassword(username, password));
+                isValid = session != null;
+            }
+        }
+
+        String view;
+        if (!isValid) {
+            final FormState formState = new FormState();
+            formState.setForm(actualFormId);
+            formState.setError("Failed to login. Check the username and ensure that your password was entered correctly");
+            FieldEditState fieldState = formState.createField("username", username);
+            if (username.length() == 0) {
+                fieldState.setError("User Name required");
+            }
+            fieldState = formState.createField("password", password);
+            if (password.length() == 0) {
+                fieldState.setError("Password required");
+            }
+            if (username.length() == 0 || password.length() == 0) {
+                formState.setError("Both the user name and password must be entered");
+            }
+            context.addVariable(ENTRY_FIELDS, formState, Scope.REQUEST);
+
+            view = context.getParameter(ERROR);
+            context.setRequestPath("/" + view, Dispatcher.ACTION);
+        } else {
+            context.setSession(session);
+            context.startHttpSession();
+            context.setUserAuthenticated(true);
+            view = context.getParameter(VIEW);
+            if (view == null) {
+                // REVIEW this is duplicated in Logon.java
+                view = "start." + Dispatcher.EXTENSION;
+            }
+            context.redirectTo(view);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "logon";
+    }
+
+    @Override
+    public void init() {}
+
+    @Override
+    public void debug(final DebugBuilder debug) {}
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
new file mode 100644
index 0000000..a6f4730
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
@@ -0,0 +1,70 @@
+/*
+ *  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.logon;
+
+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.runtime.system.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.context.RequestContext.Scope;
+
+public class LogoutAction implements Action {
+
+    public static void logoutUser(final RequestContext context) {
+        if (context.isUserAuthenticated()) {
+            final AuthenticationSession session = context.getSession();
+            if (session != null) {
+                UserManager.logoffUser(session);
+            }
+            context.endHttpSession();
+            context.setUserAuthenticated(false);
+        }
+        context.clearVariables(Scope.SESSION);
+    }
+
+    @Override
+    public String getName() {
+        return "logout";
+    }
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void process(final RequestContext context) throws IOException {
+        logoutUser(context);
+        
+        String view = context.getParameter("view");
+        if (view == null) {
+            view = context.getContextPath();
+        }
+        context.redirectTo(view);
+    }
+
+    @Override
+    public void debug(final DebugBuilder debug) {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java
new file mode 100644
index 0000000..1efe91e
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Encoder.java
@@ -0,0 +1,26 @@
+/*
+ *  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.processor;
+
+public interface Encoder {
+
+    String encoder(String text);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
new file mode 100644
index 0000000..6730510
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
@@ -0,0 +1,205 @@
+/*
+ *  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.processor;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Stack;
+
+import org.htmlparser.Node;
+import org.htmlparser.Remark;
+import org.htmlparser.lexer.Lexer;
+import org.htmlparser.lexer.Page;
+import org.htmlparser.nodes.TagNode;
+import org.htmlparser.util.ParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
+import org.apache.isis.viewer.scimpi.dispatcher.view.HtmlSnippet;
+import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
+import org.apache.isis.viewer.scimpi.dispatcher.view.SwfTag;
+
+public class HtmlFileParser {
+    private static final Logger LOG = LoggerFactory.getLogger(HtmlFileParser.class);
+    private final ProcessorLookup processors;
+
+    public HtmlFileParser(final ProcessorLookup processors) {
+        this.processors = processors;
+    }
+
+    public Stack<Snippet> parseHtmlFile(final String filePath, final RequestContext context) {
+        final Stack<Snippet> tagsBeforeContent = new Stack<Snippet>();
+        final Stack<Snippet> tagsAfterContent = new Stack<Snippet>();
+        parseHtmlFile("/", filePath, context, tagsBeforeContent, tagsAfterContent);
+        return tagsBeforeContent;
+    }
+
+    public void parseHtmlFile(final String parentPath, final String filePath, final RequestContext context, final Stack<Snippet> allTags, final Stack<Snippet> tagsForPreviousTemplate) {
+        LOG.debug("parent/file: " + parentPath + " & " + filePath);
+        final File directory = filePath.startsWith("/") ? new File(".") : new File(parentPath);
+        final File loadFile = new File(directory.getParentFile(), filePath);
+        final String loadPath = loadFile.getPath().replace('\\', '/');
+        LOG.debug("loading template '" + loadPath + "'");
+        final InputStream in = context.openStream(loadPath);
+
+        Page page;
+        try {
+            page = new Page(in, null);
+        } catch (final UnsupportedEncodingException e) {
+            throw new ScimpiException(e);
+        }
+        final Lexer lexer = new Lexer(page);
+
+        Node node = null;
+        try {
+            Stack<Snippet> tags = allTags;
+            String lineNumbers = "1";
+            String template = null;
+            tags.push(new HtmlSnippet(lineNumbers, filePath));
+
+            // NOTE done like this the tags can be cached for faster processing
+            while ((node = lexer.nextNode()) != null) {
+                if (node instanceof Remark) {
+                    // TODO need to pick up on comments within tags; at the
+                    // moment this splits a tag into two causing a
+                    // failure later
+                    continue;
+
+                } else if (node instanceof TagNode && ((TagNode) node).getTagName().startsWith("SWF:")) {
+                    final TagNode tagNode = (TagNode) node;
+                    final String tagName = tagNode.getTagName().toUpperCase();
+                    LOG.debug(tagName);
+
+                    // TODO remove context & request from Attributes -- the tags
+                    // will be re-used across
+                    // requests
+                    final Attributes attributes = new Attributes(tagNode, context);
+                    int type = 0;
+                    if (tagNode.isEndTag()) {
+                        type = SwfTag.END;
+                    } else {
+                        type = tagNode.isEmptyXmlTag() ? SwfTag.EMPTY : SwfTag.START;
+                    }
+                    testForProcessorForTag(lexer, tagName);
+                    lineNumbers = lineNumbering(node);
+                    final SwfTag tag = new SwfTag(tagName, attributes, type, lineNumbers, loadFile.getCanonicalPath());
+                    tags.push(tag);
+
+                    if (tagName.equals("SWF:IMPORT")) {
+                        if (!tagNode.isEmptyXmlTag()) {
+                            throw new ScimpiException("Import tag must be empty");
+                        }
+                        String importFile = tagNode.getAttribute("file");
+                        if (context.isDebug()) {
+                            context.getWriter().println("<!-- " + "import file " + importFile + " -->");
+                        }
+                        importFile = context.replaceVariables(importFile);
+                        parseHtmlFile(loadPath, importFile, context, tags, tagsForPreviousTemplate);
+                    }
+
+                    if (tagName.equals("SWF:TEMPLATE")) {
+                        if (!tagNode.isEmptyXmlTag()) {
+                            throw new ScimpiException("Template tag must be empty");
+                        }
+                        if (template != null) {
+                            throw new ScimpiException("Template tag can only be used once within a file");
+                        }
+                        template = tagNode.getAttribute("file");
+                        template = context.replaceVariables(template);
+                        if (context.isDebug()) {
+                            context.getWriter().println("<!-- " + "apply template " + template + " -->");
+                        }
+                        tags = new Stack<Snippet>();
+                    }
+
+                    if (tagName.equals("SWF:CONTENT")) {
+                        if (!tagNode.isEmptyXmlTag()) {
+                            throw new ScimpiException("Content tag must be empty");
+                        }
+                        if (context.isDebug()) {
+                            context.getWriter().println("<!-- " + "insert content into template -->");
+                        }
+                        tags.addAll(tagsForPreviousTemplate);
+                    }
+                } else {
+                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
+                    if (snippet instanceof HtmlSnippet) {
+                        ((HtmlSnippet) snippet).append(node.toHtml());
+                    } else {
+                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
+                        htmlSnippet.append(node.toHtml());
+                        tags.push(htmlSnippet);
+                    }
+                }
+
+            }
+            in.close();
+
+            if (template != null) {
+                final String filePathRoot = loadPath.startsWith("/") ? "" : "/";
+                parseHtmlFile(filePathRoot + loadPath, template, context, allTags, tags);
+            }
+
+        } catch (final ParserException e) {
+            exception(loadPath, node, e);
+            // throw new ScimpiException(e);
+        } catch (final RuntimeException e) {
+            // TODO: extend to deal with other exceptions
+            exception(loadPath, node, e);
+        } catch (final IOException e) {
+            throw new ScimpiException(e);
+        }
+    }
+
+    private void exception(final String filePath, final Node node, final Exception e) {
+        String lineNumbers = "";
+        String element = ("" + node).toLowerCase();
+        if (node instanceof TagNode) {
+            lineNumbers = ":" + lineNumbering(node);
+            element = "tag &lt;" + node.getText() + "&gt;";
+        }
+        throw new ScimpiException("Error processing " + element + " in " + filePath + lineNumbers, e);
+    }
+
+    private String lineNumbering(final Node node) {
+        String lineNumbers;
+        final int startingLine = ((TagNode) node).getStartingLineNumber() + 1;
+        final int endingLine = ((TagNode) node).getStartingLineNumber() + 1;
+        if (startingLine == endingLine) {
+            lineNumbers = "" + startingLine;
+        } else {
+            lineNumbers = startingLine + "-" + endingLine;
+        }
+        return lineNumbers;
+    }
+
+    private void testForProcessorForTag(final Lexer lexer, final String tagName) {
+        final ElementProcessor elementProcessor = processors.getFor(tagName);
+        if (elementProcessor == null) {
+            throw new ScimpiException("No processor for tag " + tagName.toLowerCase());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
new file mode 100644
index 0000000..4e11481
--- /dev/null
+++ b/mothballed/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
@@ -0,0 +1,28 @@
+/*
+ *  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.processor;
+
+public interface PageWriter {
+
+    void appendAsHtmlEncoded(String string);
+
+    void appendHtml(String string);
+
+}