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:31 UTC

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

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