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 2014/07/11 12:57:01 UTC

[49/61] [partial] ISIS-831: digression: moving progmodel/facets into metamodel/facets

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/file/internal/HelpManagerUsingFiles.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/file/internal/HelpManagerUsingFiles.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/file/internal/HelpManagerUsingFiles.java
new file mode 100644
index 0000000..11d094e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/file/internal/HelpManagerUsingFiles.java
@@ -0,0 +1,147 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.help.file.internal;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetdecorator.help.HelpManagerAbstract;
+
+public class HelpManagerUsingFiles extends HelpManagerAbstract {
+
+    private static final Logger LOG = LoggerFactory.getLogger(HelpManagerUsingFiles.class);
+
+    /**
+     * The name of the file used unless overridden with
+     * {@link #setFileName(String)}.
+     */
+    public static final String DEFAULT_FILE_NAME = "help.txt";
+    private static final String CLASS_PREFIX = "c:";
+    private static final String NAME_PREFIX = "m:";
+
+    private String fileName = DEFAULT_FILE_NAME;
+
+    @SuppressWarnings("unused")
+    private final IsisConfiguration configuration;
+
+    public HelpManagerUsingFiles(final IsisConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public void setFileName(final String fileName) {
+        this.fileName = fileName;
+    }
+
+    @Override
+    public String getHelpText(final Identifier identifier) {
+        BufferedReader reader = null;
+        try {
+            reader = getReader();
+
+            if (reader == null) {
+                return "No help available (no file found)";
+            }
+
+            final String className = CLASS_PREFIX + identifier.getClassName().toLowerCase();
+            final String name = NAME_PREFIX + identifier.getMemberName().toLowerCase();
+
+            final StringBuffer str = new StringBuffer();
+            String line;
+
+            boolean lookingForClass = true;
+            boolean lookingForName = identifier.getMemberName().length() > 0;
+            /*
+             * Read through each line in file.
+             */
+            while ((line = reader.readLine()) != null) {
+                // Skip comments - lines begining with hash
+                if (line.length() > 0 && line.charAt(0) == '#') {
+                    continue;
+                }
+
+                /*
+                 * Look for class.
+                 */
+                if (line.toLowerCase().equals(className)) {
+                    lookingForClass = false;
+                    continue;
+                }
+
+                if (lookingForClass) {
+                    continue;
+                } else if (line.toLowerCase().startsWith(CLASS_PREFIX)) {
+                    break;
+                }
+
+                /*
+                 * Look for field/method.
+                 */
+                if (line.toLowerCase().equals(name)) {
+                    lookingForName = false;
+                    continue;
+                }
+
+                if (lookingForName) {
+                    continue;
+                } else if (line.toLowerCase().startsWith(NAME_PREFIX)) {
+                    break;
+                }
+
+                str.append(line);
+                str.append('\n');
+            }
+
+            return str.toString();
+
+        } catch (final FileNotFoundException e) {
+            LOG.error("opening help file", e);
+            return "Failure opening help file: " + e.getMessage();
+        } catch (final IOException e) {
+            LOG.error("reading help file", e);
+            return "Failure reading help file: " + e.getMessage();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (final IOException ignore) {
+                }
+            }
+        }
+    }
+
+    protected BufferedReader getReader() throws FileNotFoundException {
+        final File file = new File(fileName);
+        if (!file.exists()) {
+            final String message = "No help file found: " + file.getAbsolutePath();
+            LOG.warn(message);
+            return null;
+        }
+
+        return new BufferedReader(new FileReader(file));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/package-info.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/package-info.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/package-info.java
new file mode 100644
index 0000000..db2b2d7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/help/package-info.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * Help API, utilizing the {@link org.apache.isis.core.metamodel.facetdecorator.FacetDecorator} mechanism..
+ * 
+ * <p>
+ * At the time of writing - unlike
+ * authorisation - there is no help-proxy implementation.  Therefore for client/server deployments
+ * any help content must be deployed locally.
+ */
+package org.apache.isis.core.metamodel.facetdecorator.help;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nFacetDecorator.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nFacetDecorator.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nFacetDecorator.java
new file mode 100644
index 0000000..ac444d2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nFacetDecorator.java
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecoratorAbstract;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.help.HelpFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facetdecorator.i18n.internal.DescribedAsFacetWrapI18n;
+import org.apache.isis.core.metamodel.facetdecorator.i18n.internal.HelpFacetWrapI18n;
+import org.apache.isis.core.metamodel.facetdecorator.i18n.internal.NamedFacetWrapI18n;
+
+public class I18nFacetDecorator extends FacetDecoratorAbstract {
+    private final I18nManager i18nManager;
+
+    public I18nFacetDecorator(final I18nManager manager) {
+        i18nManager = manager;
+    }
+
+    @Override
+    public Facet decorate(final Facet facet, final FacetHolder facetHolder) {
+        if (!(facetHolder instanceof IdentifiedHolder)) {
+            return null;
+        }
+
+        final IdentifiedHolder identifiedHolder = (IdentifiedHolder) facetHolder;
+
+        final Class<?> facetType = facet.facetType();
+        if (facetType == NamedFacet.class) {
+            return decorateWithNamedFacet(facet, identifiedHolder);
+        }
+        if (facetType == DescribedAsFacet.class) {
+            return decorateWithDescribedAsFacet(facet, identifiedHolder);
+        }
+        if (facetType == HelpFacet.class) {
+            return decorateWithHelpFacet(facet, identifiedHolder);
+        }
+        return null;
+    }
+
+    private Facet decorateWithNamedFacet(final Facet facet, final IdentifiedHolder identifiedHolder) {
+
+        final Identifier identifier = identifiedHolder.getIdentifier();
+        final String i18nName = i18nManager.getName(identifier);
+        if (i18nName == null) {
+            return null;
+        }
+        final NamedFacetWrapI18n decoratingFacet = new NamedFacetWrapI18n(i18nName, facet.getFacetHolder());
+        identifiedHolder.addFacet(decoratingFacet);
+        return decoratingFacet;
+    }
+
+    private Facet decorateWithDescribedAsFacet(final Facet facet, final IdentifiedHolder identifiedHolder) {
+        final Identifier identifier = identifiedHolder.getIdentifier();
+        final String i18nDescription = i18nManager.getDescription(identifier);
+        if (i18nDescription == null) {
+            return null;
+        }
+        final DescribedAsFacetWrapI18n decoratingFacet = new DescribedAsFacetWrapI18n(i18nDescription, facet.getFacetHolder());
+        identifiedHolder.addFacet(decoratingFacet);
+        return decoratingFacet;
+    }
+
+    private Facet decorateWithHelpFacet(final Facet facet, final IdentifiedHolder identifiedHolder) {
+        final Identifier identifier = identifiedHolder.getIdentifier();
+        final String i18nHelp = i18nManager.getHelp(identifier);
+        if (i18nHelp == null) {
+            return null;
+        }
+        final HelpFacetWrapI18n decoratingFacet = new HelpFacetWrapI18n(i18nHelp, facet.getFacetHolder());
+        identifiedHolder.addFacet(decoratingFacet);
+        return decoratingFacet;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Class<? extends Facet>[] getFacetTypes() {
+        return new Class[] { NamedFacet.class, DescribedAsFacet.class, HelpFacet.class };
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nManager.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nManager.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nManager.java
new file mode 100644
index 0000000..cac1002
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/I18nManager.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n;
+
+import java.util.List;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.components.ApplicationScopedComponent;
+
+/**
+ * Authorises the user in the current session view and use members of an object.
+ * 
+ * <p>
+ * TODO: allow description and help to be found for parameters
+ */
+public interface I18nManager extends ApplicationScopedComponent {
+
+    /**
+     * Get the localized name for the specified identified action/property.
+     * 
+     * <p>
+     * Returns null if no name available.
+     */
+    String getName(Identifier identifier);
+
+    /**
+     * Get the localized description for the specified identified
+     * action/property.
+     * 
+     * <p>
+     * Returns null if no description available.
+     */
+    String getDescription(Identifier identifier);
+
+    /**
+     * Get the localized help text for the specified identified action/property.
+     * 
+     * <p>
+     * Returns null if no help text available.
+     */
+    String getHelp(Identifier identifier);
+
+    /**
+     * Get the localized parameter names for the specified identified
+     * action/property.
+     * 
+     * <p>
+     * Returns null if no parameters are available. Otherwise returns an array
+     * of String objects the size of the number of parameters, where each
+     * element is the localised name for the corresponding parameter, or is null
+     * if no parameter name is available.
+     */
+    List<String> getParameterNames(Identifier identifier);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/DescribedAsFacetWrapI18n.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/DescribedAsFacetWrapI18n.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/DescribedAsFacetWrapI18n.java
new file mode 100644
index 0000000..192ac65
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/DescribedAsFacetWrapI18n.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n.internal;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetWrapI18n extends DescribedAsFacetAbstract {
+
+    public DescribedAsFacetWrapI18n(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/HelpFacetWrapI18n.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/HelpFacetWrapI18n.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/HelpFacetWrapI18n.java
new file mode 100644
index 0000000..78ab912
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/HelpFacetWrapI18n.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n.internal;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.help.HelpFacetAbstract;
+
+public class HelpFacetWrapI18n extends HelpFacetAbstract {
+
+    public HelpFacetWrapI18n(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/NamedFacetWrapI18n.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/NamedFacetWrapI18n.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/NamedFacetWrapI18n.java
new file mode 100644
index 0000000..609c98f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/internal/NamedFacetWrapI18n.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n.internal;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+public class NamedFacetWrapI18n extends NamedFacetAbstract {
+
+    public NamedFacetWrapI18n(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/I18nDecoratorUsingResourceBundleInstaller.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/I18nDecoratorUsingResourceBundleInstaller.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/I18nDecoratorUsingResourceBundleInstaller.java
new file mode 100644
index 0000000..9097d5a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/I18nDecoratorUsingResourceBundleInstaller.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n.resourcebundle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.isis.core.commons.config.InstallerAbstract;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.specloader.FacetDecoratorInstaller;
+import org.apache.isis.core.metamodel.facetdecorator.i18n.I18nFacetDecorator;
+import org.apache.isis.core.metamodel.facetdecorator.i18n.resourcebundle.internal.I18nManagerUsingResourceBundle;
+
+public class I18nDecoratorUsingResourceBundleInstaller extends InstallerAbstract implements FacetDecoratorInstaller {
+
+    public I18nDecoratorUsingResourceBundleInstaller() {
+        super(FacetDecoratorInstaller.TYPE, "resource-i18n");
+    }
+
+    @Override
+    public List<FacetDecorator> createDecorators() {
+        final I18nManagerUsingResourceBundle manager = new I18nManagerUsingResourceBundle(getConfiguration());
+        manager.init();
+        return Arrays.<FacetDecorator> asList(new I18nFacetDecorator(manager));
+    }
+
+    @Override
+    public List<Class<?>> getTypes() {
+        return listOf(List.class); // ie, of List<FacetDecorator>
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/internal/I18nManagerUsingResourceBundle.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/internal/I18nManagerUsingResourceBundle.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/internal/I18nManagerUsingResourceBundle.java
new file mode 100644
index 0000000..ac7a8d5
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetdecorator/i18n/resourcebundle/internal/I18nManagerUsingResourceBundle.java
@@ -0,0 +1,183 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facetdecorator.i18n.resourcebundle.internal;
+
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetdecorator.i18n.I18nManager;
+
+/**
+ * REVIEW: why isn't there a type for collections also?
+ */
+public class I18nManagerUsingResourceBundle implements I18nManager {
+
+    private static final Logger LOG = LoggerFactory.getLogger(I18nManagerUsingResourceBundle.class);
+
+    private static final String BASE_FILE_NAME = "i18n";
+
+    private static final String MEMBER_TYPE_PROPERTY = "property";
+    private static final String MEMBER_TYPE_COLLECTION = "collection";
+    private static final String MEMBER_TYPE_ACTION = "action";
+    private static final String MEMBER_TYPE_PARAMETER = "parameter";
+
+    private static final String TEXT_TYPE_NAME = "name";
+    private static final String TEXT_TYPE_DESCRIPTION = "description";
+    private static final String TEXT_TYPE_HELP = "help";
+
+    private ResourceBundle bundle;
+
+    @SuppressWarnings("unused")
+    private final IsisConfiguration configuration;
+
+    // //////////////////////////////////////////////////////////////
+    // Contructor, init, shutdown
+    // //////////////////////////////////////////////////////////////
+
+    public I18nManagerUsingResourceBundle(final IsisConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    @Override
+    public void init() {
+        try {
+            bundle = ResourceBundle.getBundle(BASE_FILE_NAME);
+        } catch (final MissingResourceException e) {
+            LOG.warn("Missing resource bundle: " + e.getMessage());
+        }
+
+    }
+
+    @Override
+    public void shutdown() {
+    }
+
+    // //////////////////////////////////////////////////////////////
+    // Members
+    // //////////////////////////////////////////////////////////////
+
+    @Override
+    public String getName(final Identifier identifier) {
+        return internalizedTextForClassMember(identifier, TEXT_TYPE_NAME);
+    }
+
+    @Override
+    public String getDescription(final Identifier identifier) {
+        return internalizedTextForClassMember(identifier, TEXT_TYPE_DESCRIPTION);
+    }
+
+    @Override
+    public String getHelp(final Identifier identifier) {
+        return internalizedTextForClassMember(identifier, TEXT_TYPE_HELP);
+    }
+
+    private String internalizedTextForClassMember(final Identifier identifier, final String textType) {
+        if (bundle == null) {
+            return null;
+        }
+        final List<String> key = buildMemberTypeKey(identifier, textType);
+        return lookupTextFromBundle(key);
+    }
+
+    private static List<String> buildMemberTypeKey(final Identifier identifier, final String textType) {
+        final List<String> keys = Lists.newArrayList();
+
+        if (identifier.isPropertyOrCollection()) {
+            keys.add(buildMemberTypeKey(identifier, textType, MEMBER_TYPE_PROPERTY));
+            keys.add(buildMemberTypeKey(identifier, textType, MEMBER_TYPE_COLLECTION));
+        } else {
+            keys.add(buildMemberTypeKey(identifier, textType, MEMBER_TYPE_ACTION));
+        }
+        return keys;
+    }
+
+    private static String buildMemberTypeKey(final Identifier identifier, final String textType, final String memberType) {
+        final StringBuilder sb = new StringBuilder();
+        sb.append(identifier.getClassName()).append(".");
+        sb.append(memberType);
+        final String memberName = identifier.getMemberName();
+        if (!Strings.isNullOrEmpty(memberName)) {
+            sb.append(".").append(memberName);
+        }
+        sb.append(".").append(textType);
+        return sb.toString();
+    }
+
+    // //////////////////////////////////////////////////////////////
+    // Parameters
+    // //////////////////////////////////////////////////////////////
+
+    @Override
+    public List<String> getParameterNames(final Identifier identifier) {
+        return internalizedTextForParameter(identifier, TEXT_TYPE_NAME);
+    }
+
+    private List<String> internalizedTextForParameter(final Identifier identifier, final String textType) {
+        if (bundle == null) {
+            return null;
+        }
+        final List<String> internalizedText = Lists.newArrayList();
+        final List<String> memberParameterNames = identifier.getMemberParameterNames();
+        int paramNum = 0;
+        for (@SuppressWarnings("unused")
+        final String dummy : memberParameterNames) {
+            final String key = buildParameterTypeKey(identifier, textType, paramNum);
+            internalizedText.add(lookupTextFromBundle(key));
+            paramNum++;
+        }
+        return internalizedText;
+    }
+
+    private static String buildParameterTypeKey(final Identifier identifier, final String textType, final int paramNum) {
+        return identifier.getClassName() + "." + MEMBER_TYPE_ACTION + "." + identifier.getMemberName() + "." + MEMBER_TYPE_PARAMETER + (paramNum + 1) + "." + textType;
+    }
+
+    // //////////////////////////////////////////////////////////////
+    // Helpers
+    // //////////////////////////////////////////////////////////////
+
+    private String lookupTextFromBundle(final List<String> keys) {
+        for (final String key : keys) {
+            final String text = lookupTextFromBundle(key);
+            if (text != null) {
+                return text;
+            }
+        }
+        return null;
+    }
+
+    private String lookupTextFromBundle(final String key) {
+        try {
+            return bundle.getString(key);
+        } catch (final MissingResourceException e) {
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/CollectionUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/CollectionUtils.java
new file mode 100644
index 0000000..220b0e9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/CollectionUtils.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public final class CollectionUtils {
+    private CollectionUtils() {
+    }
+
+    public static Object[] getCollectionAsObjectArray(final Object option, final ObjectSpecification spec, final AdapterManager adapterMap) {
+        final ObjectAdapter collection = adapterMap.adapterFor(option);
+        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
+        final Object[] optionArray = new Object[facet.size(collection)];
+        int j = 0;
+        for (final ObjectAdapter nextElement : facet.iterable(collection)) {
+            optionArray[j++] = nextElement != null? nextElement.getObject(): null;
+        }
+        return optionArray;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
new file mode 100644
index 0000000..416414c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
@@ -0,0 +1,181 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets;
+
+import org.apache.isis.applib.FatalException;
+import org.apache.isis.applib.services.eventbus.*;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
+import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
+import org.apache.isis.core.metamodel.facets.actions.invoke.ActionInteractionFacet;
+import org.apache.isis.core.metamodel.facets.collections.interaction.InteractionWithCollectionAddFacet;
+import org.apache.isis.core.metamodel.facets.collections.interaction.InteractionWithCollectionRemoveFacet;
+import org.apache.isis.core.metamodel.facets.properties.interaction.InteractionWithPropertyClearFacet;
+import org.apache.isis.core.metamodel.facets.properties.interaction.InteractionWithPropertySetterFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+
+public class InteractionHelper {
+
+    private final ServicesInjector servicesInjector;
+    private final AbstractInteractionEvent.Mode mode;
+
+    private EventBusService eventBusService;
+    private boolean searchedForEventBusService = false;
+
+    public InteractionHelper(
+            final ServicesInjector servicesInjector,
+            final AbstractInteractionEvent.Mode mode) {
+        this.servicesInjector = servicesInjector;
+        this.mode = mode;
+    }
+
+    @SuppressWarnings({ "rawtypes" })
+    public ActionInteractionEvent<?> postEventForAction(
+            final Class eventType,
+            final IdentifiedHolder identified,
+            final ObjectAdapter targetAdapter,
+            final ObjectAdapter[] argumentAdapters) {
+
+        if(!hasEventBusService()) {
+            return null;
+        }
+        try {
+            final Object source = AdapterUtils.unwrap(targetAdapter);
+            final Object[] arguments = AdapterUtils.unwrap(argumentAdapters);
+            final ActionInteractionEvent<?> event =
+                    ActionInteractionFacet.Util.newEvent(
+                            eventType, source, identified.getIdentifier(), arguments);
+            event.setMode(mode);
+            getEventBusService().post(event);
+            return event;
+        } catch (Exception e) {
+            throw new FatalException(e);
+        }
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public PropertyInteractionEvent<?, ?> postEventForPropertySet(
+            final Class eventType,
+            final ObjectAdapter targetAdapter,
+            final IdentifiedHolder identified,
+            final Object oldValue,
+            final Object newValue) {
+
+        if(!hasEventBusService()) {
+            return null;
+        }
+        try {
+            final Object source = ObjectAdapter.Util.unwrap(targetAdapter);
+            final PropertyInteractionEvent<?, ?> event =
+                    InteractionWithPropertySetterFacet.Util.newEvent(
+                            eventType, source, identified.getIdentifier(), oldValue, newValue);
+            event.setMode(mode);
+            getEventBusService().post(event);
+            return event;
+        } catch (Exception e) {
+            throw new FatalException(e);
+        }
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public PropertyInteractionEvent<?, ?> postEventForPropertyClear(
+            final Class eventType,
+            final ObjectAdapter targetAdapter,
+            final IdentifiedHolder identified,
+            final Object oldValue,
+            final Object newValue) {
+
+        if(!hasEventBusService()) {
+            return null;
+        }
+        try {
+            final Object source = ObjectAdapter.Util.unwrap(targetAdapter);
+            final PropertyInteractionEvent<?, ?> event =
+                    InteractionWithPropertyClearFacet.Util.newEvent(
+                            eventType, source, identified.getIdentifier(), oldValue, newValue);
+            event.setMode(mode);
+            getEventBusService().post(event);
+            return event;
+        } catch (Exception e) {
+            throw new FatalException(e);
+        }
+    }
+
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public CollectionInteractionEvent<?, ?> postEventForCollectionAdd(
+            final Class eventType,
+            final ObjectAdapter targetAdapter,
+            final IdentifiedHolder identified,
+            final Object addedReference) {
+
+        if(!hasEventBusService()) {
+            return null;
+        }
+        try {
+            final Object source = AdapterUtils.unwrap(targetAdapter);
+            final CollectionInteractionEvent<?, ?> event =
+                    InteractionWithCollectionAddFacet.Util.newEvent(
+                            eventType, source, identified.getIdentifier(), addedReference);
+            event.setMode(mode);
+            getEventBusService().post(event);
+            return event;
+        } catch (Exception e) {
+            throw new FatalException(e);
+        }
+    }
+
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public CollectionInteractionEvent<?, ?> postEventForCollectionRemove(
+            final Class eventType,
+            final ObjectAdapter targetAdapter,
+            final IdentifiedHolder identified,
+            final Object removedReference) {
+        if(!hasEventBusService()) {
+            return null;
+        }
+        try {
+            final Object source = AdapterUtils.unwrap(targetAdapter);
+            final CollectionInteractionEvent<?, ?> event =
+                    InteractionWithCollectionRemoveFacet.Util.newEvent(
+                            eventType, source, identified.getIdentifier(), removedReference);
+            event.setMode(mode);
+            getEventBusService().post(event);
+            return event;
+        } catch (Exception e) {
+            throw new FatalException(e);
+        }
+    }
+
+    public boolean hasEventBusService() {
+        return getEventBusService() != null;
+    }
+
+    private EventBusService getEventBusService() {
+        if (!searchedForEventBusService) {
+            eventBusService = this.servicesInjector.lookupService(EventBusService.class);
+        }
+        searchedForEventBusService = true;
+        return eventBusService;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
new file mode 100644
index 0000000..d2a9cb6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
@@ -0,0 +1,184 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.core.metamodel.facets;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.MethodRemover;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+public final class MethodFinderUtils {
+
+    private MethodFinderUtils() {
+    }
+
+    public static Method findMethodWithOrWithoutParameters(final Class<?> type, final MethodScope classMethod, final String name, final Class<?> returnType, final Class<?>[] paramTypes) {
+        Method method = MethodFinderUtils.findMethod(type, classMethod, name, returnType, paramTypes);
+        if (method == null) {
+            method = MethodFinderUtils.findMethod(type, classMethod, name, returnType, MethodPrefixBasedFacetFactoryAbstract.NO_PARAMETERS_TYPES);
+        }
+        return method;
+    }
+
+    /**
+     * Returns a specific public methods that: have the specified prefix; have
+     * the specified return type (or some subtype), and has the
+     * specified number of parameters.
+     * 
+     * <p>
+     * If the returnType is specified as null then the return type is ignored.
+     * If void.class is passed in, then searches for void methods.
+     * 
+     * <p>
+     * If the parameter type array is null, is also not checked.
+     */
+    public static Method findMethod(
+            final Class<?> type, 
+            final MethodScope methodScope, 
+            final String name, 
+            final Class<?> returnType, 
+            final Class<?>[] paramTypes) {
+        
+        Method method;
+        try {
+            method = type.getMethod(name, paramTypes);
+        } catch (final SecurityException e) {
+            return null;
+        } catch (final NoSuchMethodException e) {
+            return null;
+        }
+
+        final int modifiers = method.getModifiers();
+
+        if (!Modifier.isPublic(modifiers)) {
+            return null;
+        }
+
+        // check for scope modifier
+        if (!methodScope.matchesScopeOf(method)) {
+            return null;
+        }
+
+        if (!method.getName().equals(name)) {
+            return null;
+        }
+
+        if (returnType != null && !returnType.isAssignableFrom(method.getReturnType())) {
+            return null;
+        }
+
+        if (paramTypes != null) {
+            final Class<?>[] parameterTypes = method.getParameterTypes();
+            if (paramTypes.length != parameterTypes.length) {
+                return null;
+            }
+
+            for (int c = 0; c < paramTypes.length; c++) {
+                if ((paramTypes[c] != null) && (paramTypes[c] != parameterTypes[c])) {
+                    return null;
+                }
+            }
+        }
+
+        return method;
+    }
+
+    protected static boolean doesNotMatchScope(final MethodScope methodScope, final Method method) {
+        return methodScope.doesNotMatchScope(method);
+    }
+
+    public static Method findMethod(final Class<?> type, final MethodScope methodScope, final String name, final Class<?> returnType) {
+        try {
+            final Method[] methods = type.getMethods();
+            for (final Method method2 : methods) {
+                final Method method = method2;
+                final int modifiers = method.getModifiers();
+                // check for public modifier
+                if (!Modifier.isPublic(modifiers)) {
+                    continue;
+                }
+
+                // check correct scope (static vs instance)
+                if (!methodScope.matchesScopeOf(method)) {
+                    continue;
+                }
+
+                // check for name
+                if (!method.getName().equals(name)) {
+                    continue;
+                }
+
+                // check for return type
+                if (returnType != null && returnType != method.getReturnType()) {
+                    continue;
+                }
+                return method;
+            }
+        } catch (final SecurityException e) {
+            return null;
+        }
+        return null;
+    }
+
+    public static List<Method> findMethodsWithAnnotation(final Class<?> type, final MethodScope methodScope, final Class<? extends Annotation> annotationClass) {
+
+        final List<Method> methods = new ArrayList<Method>();
+
+        // Validate arguments
+        if ((type == null) || (methodScope == null) || (annotationClass == null)) {
+            throw new IllegalArgumentException("One or more arguments are 'null' valued");
+        }
+
+        // Find methods annotated with the specified annotation
+        for (final Method method : type.getMethods()) {
+            if (!methodScope.matchesScopeOf(method)) {
+                continue;
+            }
+
+            if (method.isAnnotationPresent(annotationClass)) {
+                methods.add(method);
+            }
+        }
+
+        return methods;
+    }
+
+    public static void removeMethod(final MethodRemover methodRemover, final Method method) {
+        if (methodRemover != null && method != null) {
+            methodRemover.removeMethod(method);
+        }
+    }
+
+    public static Class<?>[] paramTypesOrNull(final Class<?> type) {
+        return type == null ? null : new Class[] { type };
+    }
+
+    public static boolean allParametersOfSameType(final Class<?>[] params) {
+        final Class<?> firstParam = params[0];
+        for (int i = 1; i < params.length; i++) {
+            if (params[i] != firstParam) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
new file mode 100644
index 0000000..6384bbd
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactory;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting;
+import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
+
+public abstract class MethodPrefixBasedFacetFactoryAbstract extends FacetFactoryAbstract implements MethodPrefixBasedFacetFactory {
+
+    private final List<String> prefixes;
+
+    protected static final Object[] NO_PARAMETERS = new Object[0];
+    protected static final Class<?>[] NO_PARAMETERS_TYPES = new Class<?>[0];
+
+    private final OrphanValidation orphanValidation;
+
+    protected enum OrphanValidation {
+        VALIDATE,
+        DONT_VALIDATE
+    }
+    
+    public MethodPrefixBasedFacetFactoryAbstract(final List<FeatureType> featureTypes, OrphanValidation orphanValidation, final String... prefixes) {
+        super(featureTypes);
+        this.orphanValidation = orphanValidation;
+        this.prefixes = Collections.unmodifiableList(Arrays.asList(prefixes));
+    }
+
+    @Override
+    public List<String> getPrefixes() {
+        return prefixes;
+    }
+
+    @Override
+    public void refineMetaModelValidator(MetaModelValidatorComposite metaModelValidator, IsisConfiguration configuration) {
+        if(orphanValidation == OrphanValidation.DONT_VALIDATE) {
+            return;
+        }
+        metaModelValidator.add(new MetaModelValidatorVisiting(new MetaModelValidatorVisiting.Visitor() {
+
+            @Override
+            public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
+                List<ObjectAction> objectActions = objectSpec.getObjectActions(Contributed.EXCLUDED);
+                for (ObjectAction objectAction : objectActions) {
+                    for (String prefix : prefixes) {
+                        final String actionId = objectAction.getId();
+                        if (actionId.startsWith(prefix) && prefix.length() < actionId.length()) {
+                            validationFailures.add("%s#%s has prefix %s, has probably been orphaned.  If not an orphan, then rename and use @Named annotation", objectSpec.getIdentifier().getClassName(), actionId, prefix);
+                        }
+                    }
+                }
+                return true;
+            }
+        }));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixConstants.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixConstants.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixConstants.java
new file mode 100644
index 0000000..9e112f4
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixConstants.java
@@ -0,0 +1,69 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.core.metamodel.facets;
+
+import org.apache.isis.core.commons.lang.StringExtensions;
+
+public class MethodPrefixConstants {
+
+    public static final String GET_PREFIX = "get";
+    public static final String IS_PREFIX = "is";
+    public static final String SET_PREFIX = "set";
+    public static final String CLEAR_PREFIX = "clear";
+    public static final String MODIFY_PREFIX = "modify";
+    public static final String ADD_TO_PREFIX = "addTo";
+    public static final String REMOVE_FROM_PREFIX = "removeFrom";
+
+    public static final String NAME_PREFIX = "name";
+    public static final String DESCRIPTION_PREFIX = "description";
+    public static final String OPTIONAL_PREFIX = "optional";
+
+    public static final String DEFAULT_PREFIX = "default";
+    public static final String CHOICES_PREFIX = "choices";
+    public static final String AUTO_COMPLETE_PREFIX = "autoComplete";
+
+    public static final String HIDE_PREFIX = "hide";
+    public static final String ALWAYS_HIDE_PREFIX = "alwaysHide";
+
+    public static final String DISABLE_PREFIX = "disable";
+    public static final String PROTECT_PREFIX = "protect";
+
+    public static final String VALIDATE_PREFIX = "validate";
+    public static final String VALIDATE_ADD_TO_PREFIX = VALIDATE_PREFIX + ADD_TO_PREFIX;
+    public static final String VALIDATE_ADD_TO_PREFIX_2 = VALIDATE_PREFIX + StringExtensions.capitalize(ADD_TO_PREFIX);
+    public static final String VALIDATE_REMOVE_FROM_PREFIX = VALIDATE_PREFIX + REMOVE_FROM_PREFIX;
+    public static final String VALIDATE_REMOVE_FROM_PREFIX_2 = VALIDATE_PREFIX + StringExtensions.capitalize(REMOVE_FROM_PREFIX);
+
+    public static final String FIELD_PREFIX = "field";
+    public static final String ACTION_PREFIX = "action";
+
+    public static final String CREATED_PREFIX = "created";
+    public static final String LOADED_PREFIX = "loaded";
+    public static final String LOADING_PREFIX = "loading";
+    public static final String SAVED_PREFIX = "saved";
+    public static final String SAVING_PREFIX = "saving";
+    public static final String PERSISTED_PREFIX = "persisted";
+    public static final String PERSISTING_PREFIX = "persisting";
+    public static final String DELETED_PREFIX = "deleted";
+    public static final String DELETING_PREFIX = "deleting";
+    public static final String REMOVED_PREFIX = "removed";
+    public static final String REMOVING_PREFIX = "removing";
+    public static final String UPDATED_PREFIX = "updated";
+    public static final String UPDATING_PREFIX = "updating";
+    public static final String SINGULAR_NAME = "singularName";
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PropertyOrCollectionIdentifyingFacetFactoryAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PropertyOrCollectionIdentifyingFacetFactoryAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PropertyOrCollectionIdentifyingFacetFactoryAbstract.java
new file mode 100644
index 0000000..a98d2be
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PropertyOrCollectionIdentifyingFacetFactoryAbstract.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryAware;
+
+public abstract class PropertyOrCollectionIdentifyingFacetFactoryAbstract extends MethodPrefixBasedFacetFactoryAbstract implements PropertyOrCollectionIdentifyingFacetFactory, CollectionTypeRegistryAware {
+
+    private CollectionTypeRegistry collectionTypeRegistry;
+
+    public PropertyOrCollectionIdentifyingFacetFactoryAbstract(final List<FeatureType> featureTypes, final String... prefixes) {
+        super(featureTypes, OrphanValidation.DONT_VALIDATE, prefixes);
+    }
+
+    protected boolean isCollectionOrArray(final Class<?> cls) {
+        return getCollectionTypeRepository().isCollectionType(cls) || getCollectionTypeRepository().isArrayType(cls);
+    }
+
+    // /////////////////////////////////////////////////////////////////////////
+    // Injected: CollectionTypeRegistry
+    // /////////////////////////////////////////////////////////////////////////
+
+    protected CollectionTypeRegistry getCollectionTypeRepository() {
+        return collectionTypeRegistry;
+    }
+
+    /**
+     * Injected so can propogate to any {@link #registerFactory(FacetFactory)
+     * registered} {@link FacetFactory} s that are also
+     * {@link CollectionTypeRegistryAware}.
+     */
+    @Override
+    public void setCollectionTypeRegistry(final CollectionTypeRegistry collectionTypeRegistry) {
+        this.collectionTypeRegistry = collectionTypeRegistry;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacet.java
deleted file mode 100644
index 5d6beec..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacet.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.metamodel.facets.accessor;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-
-/**
- * The mechanism by which the value of the property can be accessed.
- * 
- * <p>
- * In the standard Apache Isis Programming Model, corresponds to invoking the
- * accessor method for a property OR a collection.
- */
-public interface PropertyOrCollectionAccessorFacet extends Facet {
-
-    /**
-     * Gets the value of this property or collection from this object.
-     */
-    public Object getProperty(ObjectAdapter inObject);
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacetAbstract.java
deleted file mode 100644
index bc26a4d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/accessor/PropertyOrCollectionAccessorFacetAbstract.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.metamodel.facets.accessor;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-public abstract class PropertyOrCollectionAccessorFacetAbstract extends FacetAbstract implements PropertyOrCollectionAccessorFacet {
-
-    public static Class<? extends Facet> type() {
-        return PropertyOrCollectionAccessorFacet.class;
-    }
-
-    public PropertyOrCollectionAccessorFacetAbstract(final FacetHolder holder) {
-        super(type(), holder, Derivation.NOT_DERIVED);
-    }
-
-    @Override
-    public abstract Object getProperty(ObjectAdapter inObject);
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/ElementSpecificationProviderFromTypeOfFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/ElementSpecificationProviderFromTypeOfFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/ElementSpecificationProviderFromTypeOfFacet.java
new file mode 100644
index 0000000..a99d448
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/ElementSpecificationProviderFromTypeOfFacet.java
@@ -0,0 +1,43 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.core.metamodel.facets.actcoll.typeof;
+
+import org.apache.isis.core.metamodel.spec.ElementSpecificationProvider;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class ElementSpecificationProviderFromTypeOfFacet implements ElementSpecificationProvider {
+
+    public static ElementSpecificationProvider createFrom(final TypeOfFacet typeOfFacet) {
+        if (typeOfFacet == null) {
+            return null;
+        }
+        final ObjectSpecification spec = typeOfFacet.valueSpec();
+        return new ElementSpecificationProviderFromTypeOfFacet(spec);
+    }
+
+    private final ObjectSpecification spec;
+
+    public ElementSpecificationProviderFromTypeOfFacet(final ObjectSpecification spec) {
+        this.spec = spec;
+    }
+
+    @Override
+    public ObjectSpecification getElementType() {
+        return spec;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacet.java
new file mode 100644
index 0000000..67bd5b5
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacet.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actcoll.typeof;
+
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacet;
+
+/**
+ * The type of the collection or the action.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the
+ * collection's accessor or the action's invoker method with the
+ * <tt>@TypeOf</tt> annotation.
+ */
+public interface TypeOfFacet extends SingleClassValueFacet {
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetAbstract.java
new file mode 100644
index 0000000..8e42302
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetAbstract.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.core.metamodel.facets.actcoll.typeof;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacetAbstract;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public abstract class TypeOfFacetAbstract extends SingleClassValueFacetAbstract implements TypeOfFacet {
+
+    public static Class<? extends Facet> type() {
+        return TypeOfFacet.class;
+    }
+
+    public TypeOfFacetAbstract(final Class<?> type, final FacetHolder holder, final SpecificationLoader specificationLookup) {
+        super(type(), holder, type, specificationLookup);
+    }
+
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + " [type=" + value() + "]";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetDefaultToObject.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetDefaultToObject.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetDefaultToObject.java
new file mode 100644
index 0000000..4d6a25c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetDefaultToObject.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actcoll.typeof;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class TypeOfFacetDefaultToObject extends TypeOfFacetAbstract {
+
+    public TypeOfFacetDefaultToObject(final FacetHolder holder, final SpecificationLoader specificationLookup) {
+        super(Object.class, holder, specificationLookup);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromArray.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromArray.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromArray.java
new file mode 100644
index 0000000..ea26ca1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromArray.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actcoll.typeof;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class TypeOfFacetInferredFromArray extends TypeOfFacetAbstract {
+
+    public TypeOfFacetInferredFromArray(final Class<?> type, final FacetHolder holder, final SpecificationLoader specificationLookup) {
+        super(type, holder, specificationLookup);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromGenerics.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromGenerics.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromGenerics.java
new file mode 100644
index 0000000..46c43e4
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actcoll/typeof/TypeOfFacetInferredFromGenerics.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actcoll.typeof;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class TypeOfFacetInferredFromGenerics extends TypeOfFacetAbstract {
+
+    public TypeOfFacetInferredFromGenerics(final Class<?> type, final FacetHolder holder, final SpecificationLoader specificationLookup) {
+        super(type, holder, specificationLookup);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacet.java
new file mode 100644
index 0000000..c272e39
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacet.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.core.metamodel.facets.actions.bulk;
+
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.core.metamodel.facets.SingleValueFacet;
+
+/**
+ * Indicates that the action (entity or service) can also be used as a bulk
+ * action against collections of objects.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the
+ * action method using <tt>@Bulk</tt>.
+ */
+public interface BulkFacet extends SingleValueFacet<Bulk.AppliesTo> {
+
+    public Bulk.AppliesTo value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacetAbstract.java
new file mode 100644
index 0000000..c980932
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/BulkFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.bulk;
+
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+
+public abstract class BulkFacetAbstract extends SingleValueFacetAbstract<Bulk.AppliesTo> implements BulkFacet {
+
+    public static Class<? extends Facet> type() {
+        return BulkFacet.class;
+    }
+
+    public BulkFacetAbstract(Bulk.AppliesTo appliesTo, final FacetHolder holder) {
+        super(type(), appliesTo, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotation.java
new file mode 100644
index 0000000..313025a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotation.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.bulk.annotation;
+
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.actions.bulk.BulkFacetAbstract;
+
+public class BulkFacetAnnotation extends BulkFacetAbstract {
+
+    public BulkFacetAnnotation(Bulk.AppliesTo value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotationFactory.java
new file mode 100644
index 0000000..856590e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/bulk/annotation/BulkFacetAnnotationFactory.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.bulk.annotation;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.actions.bulk.BulkFacet;
+
+public class BulkFacetAnnotationFactory extends FacetFactoryAbstract {
+
+    public BulkFacetAnnotationFactory() {
+        super(FeatureType.ACTIONS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        Method method = processMethodContext.getMethod();
+        final Bulk annotation = Annotations.getAnnotation(method, Bulk.class);
+        FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
+    }
+
+    private BulkFacet create(final Bulk annotation, final FacetHolder holder) {
+        return annotation == null ? null : new BulkFacetAnnotation(annotation.value(), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/7227418b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/choices/ActionChoicesFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/choices/ActionChoicesFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/choices/ActionChoicesFacet.java
deleted file mode 100644
index bd6c9d6..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/choices/ActionChoicesFacet.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.metamodel.facets.actions.choices;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-
-/**
- * Obtain choices for each of the parameters of the action.
- * 
- * <p>
- * In the standard Apache Isis Programming Model, corresponds to invoking the
- * <tt>choicesXxx</tt> support method for an action.
- */
-public interface ActionChoicesFacet extends Facet {
-
-    public Object[][] getChoices(ObjectAdapter inObject);
-}