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 17:43:49 UTC

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

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;
-    }
-
-}