You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by rm...@apache.org on 2013/03/24 18:45:09 UTC

[12/24] Restructuring Scimpi to remove dependencies and enable easier testing.

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromCookie.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromCookie.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromCookie.java
new file mode 100644
index 0000000..ed0467b
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromCookie.java
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either 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.variable;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.viewer.scimpi.Names;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
+
+public class InitializeFromCookie extends AbstractElementProcessor {
+    private static final String SEVEN_DAYS = Integer.toString(60 * 24 * 7);
+
+    @Override
+    public void process(final TemplateProcessor templateProcessor, RequestState state) {
+        final String name = templateProcessor.getRequiredProperty(NAME);
+
+        final Request context = templateProcessor.getContext();
+        if (context.getVariable(name) != null) {
+            templateProcessor.skipUntilClose();
+        } else {
+            final String scopeName = templateProcessor.getOptionalProperty(SCOPE);
+            final Scope scope = Request.scope(scopeName, Scope.SESSION);
+
+            final String cookieName = templateProcessor.getOptionalProperty("cookie", name);
+            final String cookieValue = context.getCookie(cookieName);
+            boolean hasObject;
+            if (cookieValue != null) {
+                try {
+                    context.getMappedObject(cookieValue);
+                    hasObject = true;
+                } catch (final ObjectNotFoundException e) {
+                    hasObject = false;
+                }
+            } else {
+                hasObject = false;
+            }
+
+            if (hasObject) {
+                templateProcessor.skipUntilClose();
+                context.addVariable(name, cookieValue, scope);
+            } else {
+                final String expiresString = templateProcessor.getOptionalProperty("expires", SEVEN_DAYS);
+                templateProcessor.pushNewBuffer();
+                templateProcessor.processUtilCloseTag();
+                templateProcessor.popBuffer();
+                final String id = (String) context.getVariable(Names.RESULT);
+                final ObjectAdapter variable = context.getMappedObject(id);
+                if (variable != null) {
+                    context.addCookie(cookieName, id, Integer.valueOf(expiresString));
+                    context.addVariable(name, id, scope);
+                }
+            }
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "initialize-from-cookie";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromResult.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromResult.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromResult.java
new file mode 100644
index 0000000..cce1a96
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/InitializeFromResult.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either 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.variable;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.Names;
+import org.apache.isis.viewer.scimpi.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
+
+public class InitializeFromResult extends AbstractElementProcessor {
+
+    @Override
+    public void process(final TemplateProcessor templateProcessor, RequestState state) {
+        disallowSourceAndDefault(templateProcessor);
+        final String sourceObjectId = objectOrResult(templateProcessor);
+        final Class<?> cls = forClass(templateProcessor);
+        final String variableName = templateProcessor.getRequiredProperty(NAME);
+        final String defaultObjectId = templateProcessor.getOptionalProperty(DEFAULT);
+        final String scopeName = templateProcessor.getOptionalProperty(SCOPE);
+        final Scope scope = Request.scope(scopeName, Scope.REQUEST);
+
+        final Request context = templateProcessor.getContext();
+        final ObjectAdapter sourceObject = context.getMappedObject(sourceObjectId);
+        final boolean isSourceSet = sourceObject != null;
+        final boolean isSourceAssignable = isSourceSet && (cls == null || cls.isAssignableFrom(sourceObject.getObject().getClass()));
+        if (isSourceAssignable) {
+            templateProcessor.appendDebug("     " + variableName + " set to " + sourceObjectId + " (" + scope + ")");
+            context.addVariable(variableName, sourceObjectId, scope);
+        } else {
+            templateProcessor.appendDebug("     " + variableName + " set to " + sourceObjectId + " (" + scope + ")");
+            if (defaultObjectId != null) {
+                context.addVariable(variableName, defaultObjectId, scope);
+            }
+            context.changeScope(variableName, scope);
+        }
+    }
+
+    private String objectOrResult(final TemplateProcessor templateProcessor) {
+        final String sourceObjectId = templateProcessor.getOptionalProperty(OBJECT);
+        if (sourceObjectId == null) {
+            return (String) templateProcessor.getContext().getVariable(Names.RESULT);
+        } else {
+            return sourceObjectId;
+        }
+    }
+
+    private void disallowSourceAndDefault(final TemplateProcessor templateProcessor) {
+        if (templateProcessor.getOptionalProperty(DEFAULT) != null && templateProcessor.getOptionalProperty(OBJECT) != null) {
+            throw new ScimpiException("Cannot specify both " + OBJECT + " and " + DEFAULT + " for the " + getName() + " element");
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "initialize";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/PageTitle.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/PageTitle.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/PageTitle.java
new file mode 100644
index 0000000..96e94a8
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/PageTitle.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.variable;
+
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+
+public class PageTitle extends Variable {
+    @Override
+    public void process(final TemplateProcessor templateProcessor, RequestState state) {
+        process(templateProcessor, "title", null, null, false, Scope.REQUEST);
+    }
+
+    @Override
+    public String getName() {
+        return "page-title";
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetCookieFromField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetCookieFromField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetCookieFromField.java
new file mode 100644
index 0000000..7a92a71
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetCookieFromField.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either 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.variable;
+
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
+
+public class SetCookieFromField extends AbstractElementProcessor {
+
+    @Override
+    public void process(final TemplateProcessor templateProcessor, RequestState state) {
+        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/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetFieldFromCookie.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetFieldFromCookie.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetFieldFromCookie.java
new file mode 100644
index 0000000..8b02691
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/SetFieldFromCookie.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.variable;
+
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
+
+public class SetFieldFromCookie extends AbstractElementProcessor {
+
+    @Override
+    public void process(final TemplateProcessor templateProcessor, RequestState state) {
+        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/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/Variable.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/Variable.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/Variable.java
new file mode 100644
index 0000000..645ff45
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/variable/Variable.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.variable;
+
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
+
+public class Variable extends AbstractElementProcessor {
+
+    @Override
+    public void process(final TemplateProcessor templateProcessor, RequestState state) {
+        final String name = templateProcessor.getOptionalProperty(NAME);
+        final String value = templateProcessor.getOptionalProperty(VALUE);
+        final String defaultTo = templateProcessor.getOptionalProperty(DEFAULT);
+        final String scopeName = templateProcessor.getOptionalProperty(SCOPE);
+        final boolean isClear = templateProcessor.getOptionalProperty("action", "set").equals("clear");
+        final Scope scope = Request.scope(scopeName, isClear ? Scope.SESSION : Scope.REQUEST);
+        process(templateProcessor, name, value, defaultTo, isClear, scope);
+    }
+
+    protected void process(final TemplateProcessor templateProcessor, final String name, final String value, final String defaultTo, final boolean isClear, final Scope scope) {
+        templateProcessor.pushNewBuffer();
+        templateProcessor.processUtilCloseTag();
+        String source = templateProcessor.popBuffer();
+        if (isClear) {
+            templateProcessor.appendDebug("variable: " + name + " (cleared)");
+            templateProcessor.getContext().clearVariable(name, scope);
+        } else {
+            if (source.length() == 0 && value != null) {
+                source = value;
+            }
+            if (source.length() == 0) {
+                source = defaultTo;
+            }
+            templateProcessor.appendDebug("    " + name + " (" + scope + ") set to " + source);
+            templateProcessor.getContext().addVariable(name, source, scope);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "variable";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FieldFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FieldFactory.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FieldFactory.java
deleted file mode 100644
index 1936055..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FieldFactory.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.widget;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.help.HelpFacet;
-import org.apache.isis.core.metamodel.facets.maxlen.MaxLengthFacet;
-import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacet;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectFeature;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.progmodel.facets.value.booleans.BooleanValueFacet;
-import org.apache.isis.core.progmodel.facets.value.password.PasswordValueFacet;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class FieldFactory {
-
-    public static void initializeField(final Request context, final ObjectAdapter object, final ObjectFeature param, final ObjectAdapter[] optionsForParameter, final boolean isRequired, final InputField field) {
-
-        field.setLabel(param.getName());
-        field.setDescription(param.getDescription());
-        field.setDataType(param.getSpecification().getShortIdentifier());
-        if (param instanceof ObjectMember) {
-            field.setHelpReference(((ObjectMember) param).getHelp());
-        } else {
-            final HelpFacet helpFacet = param.getFacet(HelpFacet.class);
-            final String value = helpFacet.value();
-            field.setHelpReference(value);
-        }
-        field.setRequired(isRequired);
-        field.setHidden(false);
-
-        if (param.getSpecification().getFacet(ParseableFacet.class) != null) {
-            final int maxLength = param.getFacet(MaxLengthFacet.class).value();
-            field.setMaxLength(maxLength);
-
-            final TypicalLengthFacet typicalLengthFacet = param.getFacet(TypicalLengthFacet.class);
-            if (typicalLengthFacet.isDerived() && maxLength > 0) {
-                field.setWidth(maxLength);
-            } else {
-                field.setWidth(typicalLengthFacet.value());
-            }
-
-            final MultiLineFacet multiLineFacet = param.getFacet(MultiLineFacet.class);
-            field.setHeight(multiLineFacet.numberOfLines());
-            field.setWrapped(!multiLineFacet.preventWrapping());
-
-            final ObjectSpecification spec = param.getSpecification();
-            if (spec.containsFacet(BooleanValueFacet.class)) {
-                field.setType(InputField.CHECKBOX);
-            } else if (spec.containsFacet(PasswordValueFacet.class)) {
-                field.setType(InputField.PASSWORD);
-            } else {
-                field.setType(InputField.TEXT);
-            }
-
-        } else {
-            field.setType(InputField.REFERENCE);
-        }
-
-        if (optionsForParameter != null) {
-            final int noOptions = optionsForParameter.length;
-            final String[] optionValues = new String[noOptions];
-            final String[] optionTitles = new String[noOptions];
-            for (int j = 0; j < optionsForParameter.length; j++) {
-                final int i = j; // + (field.isRequired() ? 0 : 1);
-                optionValues[i] = getValue(context, optionsForParameter[j]);
-                optionTitles[i] = optionsForParameter[j].titleString();
-            }
-            field.setOptions(optionTitles, optionValues);
-        }
-    }
-
-    private static String getValue(final Request context, final ObjectAdapter field) {
-        if (field == null) {
-            return "";
-        }
-        if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
-            return context.mapObject(field, Scope.INTERACTION);
-        } else {
-            return field.getObject().toString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormEntry.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormEntry.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormEntry.java
deleted file mode 100644
index 7b1b86c..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormEntry.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.widget;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class FormEntry extends AbstractElementProcessor {
-
-    @Override
-    public void process(final TagProcessor tagProcessor) {
-        final FormFieldBlock block = (FormFieldBlock) tagProcessor.getBlockContent();
-        final String field = tagProcessor.getRequiredProperty(FIELD);
-        final String value = tagProcessor.getRequiredProperty(VALUE);
-        final boolean isHidden = tagProcessor.isRequested(HIDDEN, true);
-        block.exclude(field);
-        // TODO this is replaced because the field is marked as hidden!
-        final String content = "reference <input type=\"" + (isHidden ? "hidden" : "text") + "\" disabled=\"disabled\" name=\"" + field + "\" value=\"" + value + "\" />";
-        block.replaceContent(field, content);
-    }
-
-    @Override
-    public String getName() {
-        return "form-entry";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormField.java
deleted file mode 100644
index 2707c3d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormField.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.widget;
-
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class FormField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final TagProcessor tagProcessor) {
-        final FormFieldBlock block = (FormFieldBlock) tagProcessor.getBlockContent();
-        final String field = tagProcessor.getRequiredProperty(FIELD);
-        if (block.isVisible(field)) {
-            tagProcessor.pushNewBuffer();
-            tagProcessor.processUtilCloseTag();
-            final String content = tagProcessor.popBuffer();
-            block.replaceContent(field, content);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "form-field";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormFieldBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormFieldBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormFieldBlock.java
deleted file mode 100644
index 36cf5d8..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/FormFieldBlock.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.widget;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.InclusionList;
-import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
-
-public class FormFieldBlock extends InclusionList {
-    private final Map<String, String> content = new HashMap<String, String>();
-    private final Map<String, String> values = new HashMap<String, String>();
-
-    public void replaceContent(final String field, final String htmlString) {
-        content.put(field, htmlString);
-    }
-
-    public boolean hasContent(final String name) {
-        return content.containsKey(name);
-    }
-
-    public String getContent(final String name) {
-        return content.get(name);
-    }
-
-    public boolean isVisible(final String name) {
-        return true;
-    }
-
-    public boolean isNullable(final String name) {
-        return true;
-    }
-
-    public ObjectAdapter getCurrent(final String name) {
-        return null;
-    }
-
-    public void value(final String field, final String value) {
-        values.put(field, value);
-    }
-
-    public void setUpValues(final InputField[] inputFields) {
-        for (final InputField inputField : inputFields) {
-            final String name = inputField.getName();
-            inputField.setValue(values.get(name));
-        }
-    }
-
-}

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

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/RadioListField.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/RadioListField.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/RadioListField.java
deleted file mode 100644
index 7bd51e1..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/RadioListField.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.widget;
-
-import java.util.Iterator;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-
-public class RadioListField extends AbstractElementProcessor {
-
-    @Override
-    public void process(final TagProcessor tagProcessor) {
-        final FormFieldBlock block = (FormFieldBlock) tagProcessor.getBlockContent();
-        final String field = tagProcessor.getRequiredProperty(FIELD);
-        if (block.isVisible(field)) {
-            final String id = tagProcessor.getRequiredProperty(COLLECTION);
-            final String exclude = tagProcessor.getOptionalProperty("exclude");
-
-            final ObjectAdapter collection = tagProcessor.getContext().getMappedObjectOrResult(id);
-
-            final Request context = tagProcessor.getContext();
-            final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-            final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-
-            final StringBuffer buffer = new StringBuffer();
-
-            while (iterator.hasNext()) {
-                final ObjectAdapter element = iterator.next();
-                final Scope scope = Scope.INTERACTION;
-                final String elementId = context.mapObject(element, scope);
-                if (exclude != null && context.getMappedObject(exclude) == element) {
-                    continue;
-                }
-                final String title = element.titleString();
-                final String checked = "";
-                buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + " />" + title + "</input><br/>\n");
-            }
-
-            block.replaceContent(field, buffer.toString());
-        }
-    }
-
-    @Override
-    public String getName() {
-        return "radio-list";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/Selector.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/Selector.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/Selector.java
deleted file mode 100644
index 8c0b47e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/widget/Selector.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.widget;
-
-import java.util.Iterator;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.context.Request.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.TagProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
-import org.apache.isis.viewer.scimpi.dispatcher.view.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
-import org.apache.isis.viewer.scimpi.dispatcher.view.action.CreateFormParameter;
-
-public class Selector extends AbstractElementProcessor {
-
-    @Override
-    public void process(final TagProcessor tagProcessor) {
-        final FormFieldBlock block = (FormFieldBlock) tagProcessor.getBlockContent();
-        final String field = tagProcessor.getRequiredProperty(FIELD);
-        if (block.isVisible(field)) {
-            processElement(tagProcessor, block, field);
-        }
-        tagProcessor.skipUntilClose();
-    }
-
-    private void processElement(final TagProcessor tagProcessor, final FormFieldBlock block, final String field) {
-        final String type = tagProcessor.getOptionalProperty(TYPE, "dropdown");
-        if (!tagProcessor.isPropertySpecified(METHOD) && tagProcessor.isPropertySpecified(COLLECTION)) {
-            final String id = tagProcessor.getRequiredProperty(COLLECTION, TagProcessor.NO_VARIABLE_CHECKING);
-            final String selector = showSelectionList(tagProcessor, id, block.getCurrent(field), block.isNullable(field), type);
-            block.replaceContent(field, selector);
-        } else {
-            final String objectId = tagProcessor.getOptionalProperty(OBJECT);
-            final String methodName = tagProcessor.getRequiredProperty(METHOD);
-            final ObjectAdapter object = MethodsUtils.findObject(tagProcessor.getContext(), objectId);
-            final ObjectAction action = MethodsUtils.findAction(object, methodName);
-            if (action.getParameterCount() == 0) {
-                final ObjectAdapter collection = action.execute(object, new ObjectAdapter[0]);
-                final String selector = showSelectionList(tagProcessor, collection, block.getCurrent(field), block.isNullable(field), type);
-                block.replaceContent(field, selector);
-            } else {
-                final String id = "selector_options";
-                final String id2 = (String) tagProcessor.getContext().getVariable(id);
-                final String selector = showSelectionList(tagProcessor, id2, block.getCurrent(field), block.isNullable(field), type);
-
-                final CreateFormParameter parameters = new CreateFormParameter();
-                parameters.objectId = objectId;
-                parameters.methodName = methodName;
-                parameters.buttonTitle = tagProcessor.getOptionalProperty(BUTTON_TITLE, "Search");
-                parameters.formTitle = tagProcessor.getOptionalProperty(FORM_TITLE);
-                parameters.className = tagProcessor.getOptionalProperty(CLASS, "selector");
-                parameters.id = tagProcessor.getOptionalProperty(ID);
-
-                parameters.resultName = id;
-                parameters.forwardResultTo = tagProcessor.getContext().getResourceFile();
-                parameters.forwardVoidTo = "error";
-                parameters.forwardErrorTo = parameters.forwardResultTo;
-                parameters.scope = Scope.REQUEST.name();
-                tagProcessor.pushNewBuffer();
-                ActionForm.createForm(tagProcessor, parameters);
-                block.replaceContent(field, selector);
-
-                tagProcessor.appendHtml(tagProcessor.popBuffer());
-            }
-        }
-    }
-
-    private String showSelectionList(final TagProcessor tagProcessor, final String collectionId, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
-        if (collectionId != null && !collectionId.equals("")) {
-            final ObjectAdapter collection = tagProcessor.getContext().getMappedObjectOrResult(collectionId);
-            return showSelectionList(tagProcessor, collection, selectedItem, allowNotSet, type);
-        } else {
-            return null;
-        }
-    }
-
-    private String showSelectionList(final TagProcessor tagProcessor, final ObjectAdapter collection, final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
-        final String field = tagProcessor.getRequiredProperty(FIELD);
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-
-        if (type.equals("radio")) {
-            return radioButtonList(tagProcessor, field, allowNotSet, collection, selectedItem, facet);
-        } else if (type.equals("list")) {
-            final String size = tagProcessor.getOptionalProperty("size", "5");
-            return dropdownList(tagProcessor, field, allowNotSet, collection, selectedItem, size, facet);
-        } else if (type.equals("dropdown")) {
-            return dropdownList(tagProcessor, field, allowNotSet, collection, selectedItem, null, facet);
-        } else {
-            throw new UnknownTypeException(type);
-        }
-    }
-
-    private String radioButtonList(final TagProcessor tagProcessor, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, final CollectionFacet facet) {
-        final Request context = tagProcessor.getContext();
-        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        final StringBuffer buffer = new StringBuffer();
-        if (allowNotSet) {
-            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"null\"></input><br/>\n");
-        }
-        while (iterator.hasNext()) {
-            final ObjectAdapter element = iterator.next();
-            final String elementId = context.mapObject(element, Scope.INTERACTION);
-            final String title = element.titleString();
-            final String checked = element == selectedItem ? "checked=\"checked\"" : "";
-            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + ">" + title + "</input><br/>\n");
-        }
-
-        return buffer.toString();
-    }
-
-    private String dropdownList(final TagProcessor tagProcessor, final String field, final boolean allowNotSet, final ObjectAdapter collection, final ObjectAdapter selectedItem, String size, final CollectionFacet facet) {
-        final Request context = tagProcessor.getContext();
-        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        final StringBuffer buffer = new StringBuffer();
-        size = size == null ? "" : " size =\"" + size + "\"";
-        buffer.append("<select name=\"" + field + "\"" + size + " >\n");
-        if (allowNotSet) {
-            buffer.append("  <option value=\"null\"></option>\n");
-        }
-        while (iterator.hasNext()) {
-            final ObjectAdapter element = iterator.next();
-            final String elementId = context.mapObject(element, Scope.INTERACTION);
-            final String title = element.titleString();
-            final String checked = element == selectedItem ? "selected=\"selected\"" : "";
-            buffer.append("  <option value=\"" + elementId + "\"" + checked + ">" + title + "</option>\n");
-        }
-        buffer.append("</select>\n");
-        return buffer.toString();
-    }
-
-    @Override
-    public String getName() {
-        return "selector";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/DebugUsers.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/DebugUsers.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/DebugUsers.java
deleted file mode 100644
index 212c6c5..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/DebugUsers.java
+++ /dev/null
@@ -1,97 +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.security;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-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.ScimpiException;
-
-public class DebugUsers {
-
-    private static Logger LOG = Logger.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/7700b437/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/UserManager.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/UserManager.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/UserManager.java
deleted file mode 100644
index db2b6d7..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/security/UserManager.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.scimpi.security;
-
-import org.apache.isis.core.commons.authentication.AnonymousSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.log4j.Logger;
-
-public class UserManager {
-
-    private static final Logger LOG = Logger.getLogger(UserManager.class);
-    private static UserManager instance;
-
-    private static AuthenticationManager getAuthenticationManager() {
-        if (instance == null) {
-            throw new IllegalStateException("Server initialisation failed, or not defined as a context listener");
-        }
-        return instance.authenticationManager;
-    }
-
-    public static AuthenticationSession startRequest(final AuthenticationSession session) {
-        AuthenticationSession useSession;
-        if (session == null) {
-            useSession = new AnonymousSession();
-            LOG.debug("start anonymous request: " + session);
-        } else {
-            useSession = session;
-            LOG.debug("start request for: " + session.getUserName());
-        }
-        IsisContext.closeSession();
-        IsisContext.openSession(useSession);
-        return useSession;
-    }
-
-    public static AuthenticationSession authenticate(final AuthenticationRequestPassword passwordAuthenticationRequest) {
-        final AuthenticationSession session = getAuthenticationManager().authenticate(passwordAuthenticationRequest);
-        if (session != null) {
-            LOG.info("log on user " + session.getUserName());
-            IsisContext.closeSession();
-            IsisContext.openSession(session);
-        }
-        return session;
-    }
-
-    public static void endRequest(final AuthenticationSession session) {
-        if (session == null) {
-            LOG.debug("end anonymous request");
-        } else {
-            LOG.debug("end request for: " + session.getUserName());
-        }
-        IsisContext.closeSession();
-    }
-
-    public static void logoffUser(final AuthenticationSession session) {
-        LOG.info("log off user " + session.getUserName());
-        IsisContext.closeSession();
-        getAuthenticationManager().closeSession(session);
-
-        final AnonymousSession replacementSession = new AnonymousSession();
-        IsisContext.openSession(replacementSession);
-    }
-
-    private final AuthenticationManager authenticationManager;
-
-    public UserManager(final AuthenticationManager authenticationManager) {
-        this.authenticationManager = authenticationManager;
-        UserManager.instance = this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/ElementProcessorTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/ElementProcessorTest.java b/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/ElementProcessorTest.java
new file mode 100644
index 0000000..b5dc774
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/ElementProcessorTest.java
@@ -0,0 +1,61 @@
+package org.apache.isis.viewer.scimpi.dispatcher.view;
+
+import java.util.Stack;
+
+import org.apache.isis.viewer.scimpi.Names;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Snippet;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.SwfTag;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TagAttributes;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.htmlparser.nodes.TagNode;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+
+public class ElementProcessorTest {
+
+    @Test
+    public void test() {
+        ExampleElementProcessor processor = new ExampleElementProcessor();
+        
+        TagNode tagNode = new TagNode();
+        tagNode.setTagName("swf:test");
+        tagNode.setAttribute(Names.NAME, "attribute-name");
+        tagNode.setAttribute(Names.ACTION, "attribute-name-2");
+
+        TagAttributes tagAttributes = new TagAttributes(tagNode, null);
+        Stack<Snippet> snippets = new Stack<Snippet>();
+        Snippet snippet = new SwfTag("", tagAttributes , SwfTag.EMPTY, "", "") ;
+        snippets.push(snippet);
+        
+        TestRequestState state = new TestRequestState();
+        TemplateProcessor templateProcessor = new TemplateProcessor(null, state, null, snippets, null);
+        
+        processor.process(templateProcessor, state);
+        String content = templateProcessor.popBuffer().toString();
+        assertThat(content, equalTo("<p>html-code</p>a &amp; b &gt; c<div>attribute-name</div><div>attribute-name-2</div>"));
+    }
+}
+
+
+    
+class ExampleElementProcessor extends AbstractElementProcessor {
+
+    public String getName() {
+        return "test";
+    }
+
+    public void process(TemplateProcessor templateProcessor, RequestState state) {
+        templateProcessor.appendHtml("<p>html-code</p>");
+        templateProcessor.appendAsHtmlEncoded("a & b > c");
+        
+        final String name = templateProcessor.getOptionalProperty(NAME);
+        templateProcessor.appendHtml("<div>" + name + "</div>");
+        final String var = templateProcessor.getRequiredProperty(ACTION);
+        templateProcessor.appendHtml("<div>" + var + "</div>");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/TestRequestState.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/TestRequestState.java b/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/TestRequestState.java
new file mode 100644
index 0000000..bd82751
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/TestRequestState.java
@@ -0,0 +1,32 @@
+package org.apache.isis.viewer.scimpi.dispatcher.view;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestState;
+
+public class TestRequestState implements RequestState {
+
+    private ObjectAdapter adapter;
+
+    public String replaceVariables(String value) {
+        return value;
+    }
+
+    public String getErrorMessage() {
+        return "an error" ;
+    }
+
+    public String getStringVariable(String result) {
+        return "string-var";
+    }
+
+    public ObjectAdapter getMappedObject(String objectId) {
+        return adapter;
+    }
+
+    public void setObject(ObjectAdapter adapter) {
+        this.adapter = adapter;}
+    
+    
+    
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/message/ErrorMessageTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/message/ErrorMessageTest.java b/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/message/ErrorMessageTest.java
new file mode 100644
index 0000000..e94ae6e
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/test/java/org/apache/isis/viewer/scimpi/dispatcher/view/message/ErrorMessageTest.java
@@ -0,0 +1,42 @@
+package org.apache.isis.viewer.scimpi.dispatcher.view.message;
+
+import java.util.Stack;
+
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Snippet;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.SwfTag;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TagAttributes;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.TemplateProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.view.TestRequestState;
+import org.htmlparser.nodes.TagNode;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.*;
+
+public class ErrorMessageTest {
+
+    @Test
+    public void test() {
+        TagNode tagNode = new TagNode();
+
+        TagAttributes tagAttributes = new TagAttributes(tagNode, null);
+        Stack<Snippet> snippets = new Stack<Snippet>();
+        Snippet snippet = new SwfTag("", tagAttributes , SwfTag.EMPTY, "", "") ;
+        snippets.push(snippet);
+        
+        TestRequestState state = new TestRequestState();
+        TemplateProcessor templateProcessor = new TemplateProcessor(null, state, null, snippets, null);
+        
+        //       tagNode.setTagName("swf:error-message");
+        
+        
+        
+        ErrorMessage processor = new ErrorMessage();        
+        processor.process(templateProcessor, state);
+        String content = templateProcessor.popBuffer().toString();
+        
+        assertThat(content, equalTo("an error"));
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/pom.xml b/component/viewer/scimpi/pom.xml
index 86949c1..330d7f2 100644
--- a/component/viewer/scimpi/pom.xml
+++ b/component/viewer/scimpi/pom.xml
@@ -29,7 +29,7 @@
 
 	<groupId>org.apache.isis.viewer</groupId>
 	<artifactId>isis-viewer-scimpi</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>1.0.0-restructure-SNAPSHOT</version>
 	
 	<name>Isis Scimpi Viewer</name>
 	

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/servlet/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/pom.xml b/component/viewer/scimpi/servlet/pom.xml
index 51526e3..dbb479f 100644
--- a/component/viewer/scimpi/servlet/pom.xml
+++ b/component/viewer/scimpi/servlet/pom.xml
@@ -23,7 +23,7 @@
 	<parent>
         <groupId>org.apache.isis.viewer</groupId>
 	    <artifactId>isis-viewer-scimpi</artifactId>
-		<version>1.0.0-SNAPSHOT</version>
+		<version>1.0.0-restructure-SNAPSHOT</version>
 	</parent>
 
 	<artifactId>isis-viewer-scimpi-servlet</artifactId>

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
index 0e61c46..9b2a166 100644
--- a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
+++ b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
@@ -29,9 +29,9 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.Response;
-import org.apache.isis.viewer.scimpi.security.DebugUsers;
-import org.apache.isis.viewer.scimpi.security.UserManager;
+import org.apache.isis.viewer.scimpi.dispatcher.context.DebugUsers;
+import org.apache.isis.viewer.scimpi.dispatcher.context.Response;
+import org.apache.isis.viewer.scimpi.dispatcher.util.UserManager;
 import org.apache.log4j.Logger;
 
 public class DispatcherServlet extends HttpServlet {

http://git-wip-us.apache.org/repos/asf/isis/blob/7700b437/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
index 8c6386b..eb00f5b 100644
--- a/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
+++ b/component/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/ServletRequestContext.java
@@ -39,10 +39,10 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.viewer.scimpi.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.DispatchException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiNotFoundException;
+import org.apache.isis.viewer.scimpi.dispatcher.context.DebugUsers;
 import org.apache.isis.viewer.scimpi.dispatcher.context.ErrorCollator;
 import org.apache.isis.viewer.scimpi.dispatcher.context.Request;
-import org.apache.isis.viewer.scimpi.security.DebugUsers;
+import org.apache.isis.viewer.scimpi.dispatcher.context.ScimpiNotFoundException;
 
 public class ServletRequestContext extends Request {
     private HttpServletRequest request;