You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/11/25 19:24:12 UTC

[3/5] isis git commit: ISIS-803: new annotation attributes allowing suclasses of the lifecycle events to be posted (or disabled altogether). also updated docs.

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistedEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistedEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistedEvent.java
index f585170..de2aa7c 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistedEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistedEvent.java
@@ -22,6 +22,13 @@ public abstract class ObjectPersistedEvent<S> extends AbstractLifecycleEvent<S>
 
     private static final long serialVersionUID = 1L;
 
+    //region > Default class
+    /**
+     * This class is the default for the
+     * {@link org.apache.isis.applib.annotation.DomainObject#persistedLifecycleEvent()} annotation attribute.  Whether this
+     * raises an event or not depends upon the "isis.reflector.facet.domainObjectAnnotation.persistedLifecycleEvent.postForDefault"
+     * configuration property.
+     */
     public static class Default extends ObjectPersistedEvent<Object> {
         private static final long serialVersionUID = 1L;
         public Default() {}
@@ -31,6 +38,29 @@ public abstract class ObjectPersistedEvent<S> extends AbstractLifecycleEvent<S>
             return "ObjectPersistedEvent$Default{source=" + getSource() + "}";
         }
     }
+    //endregion
+
+    //region > Noop class
+
+    /**
+     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event.
+     */
+    public static class Noop extends ObjectPersistedEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
+
+    //region > Doop class
+
+    /**
+     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event..
+     */
+    public static class Doop extends ObjectPersistedEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
 
     public ObjectPersistedEvent() {
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistingEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistingEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistingEvent.java
index 9d5c985..9d18165 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistingEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectPersistingEvent.java
@@ -22,6 +22,13 @@ public abstract class ObjectPersistingEvent<S> extends AbstractLifecycleEvent<S>
 
     private static final long serialVersionUID = 1L;
 
+    //region > Default class
+    /**
+     * This class is the default for the
+     * {@link org.apache.isis.applib.annotation.DomainObject#persistingLifecycleEvent()} annotation attribute.  Whether this
+     * raises an event or not depends upon the "isis.reflector.facet.domainObjectAnnotation.persistingLifecycleEvent.postForDefault"
+     * configuration property.
+     */
     public static class Default extends ObjectPersistingEvent<Object> {
         private static final long serialVersionUID = 1L;
         public Default() {}
@@ -31,6 +38,29 @@ public abstract class ObjectPersistingEvent<S> extends AbstractLifecycleEvent<S>
             return "ObjectPersistingEvent$Default{source=" + getSource() + "}";
         }
     }
+    //endregion
+
+    //region > Noop class
+
+    /**
+     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event.
+     */
+    public static class Noop extends ObjectPersistingEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
+
+    //region > Doop class
+
+    /**
+     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event..
+     */
+    public static class Doop extends ObjectPersistingEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
 
     public ObjectPersistingEvent() {
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectRemovingEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectRemovingEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectRemovingEvent.java
index 945156a..b7f8186 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectRemovingEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectRemovingEvent.java
@@ -22,6 +22,13 @@ public abstract class ObjectRemovingEvent<S> extends AbstractLifecycleEvent<S> {
 
     private static final long serialVersionUID = 1L;
 
+    //region > Default class
+    /**
+     * This class is the default for the
+     * {@link org.apache.isis.applib.annotation.DomainObject#removingLifecycleEvent()} annotation attribute.  Whether this
+     * raises an event or not depends upon the "isis.reflector.facet.domainObjectAnnotation.removingLifecycleEvent.postForDefault"
+     * configuration property.
+     */
     public static class Default extends ObjectRemovingEvent<Object> {
         private static final long serialVersionUID = 1L;
         public Default() {}
@@ -31,6 +38,29 @@ public abstract class ObjectRemovingEvent<S> extends AbstractLifecycleEvent<S> {
             return "ObjectRemovingEvent$Default{source=" + getSource() + "}";
         }
     }
+    //endregion
+
+    //region > Noop class
+
+    /**
+     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event.
+     */
+    public static class Noop extends ObjectRemovingEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
+
+    //region > Doop class
+
+    /**
+     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event..
+     */
+    public static class Doop extends ObjectRemovingEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
 
     public ObjectRemovingEvent() {
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatedEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatedEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatedEvent.java
index 49ceb19..94e763b 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatedEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatedEvent.java
@@ -22,6 +22,13 @@ public abstract class ObjectUpdatedEvent<S> extends AbstractLifecycleEvent<S> {
 
     private static final long serialVersionUID = 1L;
 
+    //region > Default class
+    /**
+     * This class is the default for the
+     * {@link org.apache.isis.applib.annotation.DomainObject#updatedLifecycleEvent()} annotation attribute.  Whether this
+     * raises an event or not depends upon the "isis.reflector.facet.domainObjectAnnotation.updatedLifecycleEvent.postForDefault"
+     * configuration property.
+     */
     public static class Default extends ObjectUpdatedEvent<Object> {
         private static final long serialVersionUID = 1L;
         public Default() {}
@@ -31,6 +38,29 @@ public abstract class ObjectUpdatedEvent<S> extends AbstractLifecycleEvent<S> {
             return "ObjectUpdatedEvent$Default{source=" + getSource() + "}";
         }
     }
+    //endregion
+
+    //region > Noop class
+
+    /**
+     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event.
+     */
+    public static class Noop extends ObjectUpdatedEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
+
+    //region > Doop class
+
+    /**
+     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event..
+     */
+    public static class Doop extends ObjectUpdatedEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
 
     public ObjectUpdatedEvent() {
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatingEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatingEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatingEvent.java
index 88f3775..a7d39b0 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatingEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ObjectUpdatingEvent.java
@@ -22,6 +22,13 @@ public abstract class ObjectUpdatingEvent<S> extends AbstractLifecycleEvent<S> {
 
     private static final long serialVersionUID = 1L;
 
+    //region > Default class
+    /**
+     * This class is the default for the
+     * {@link org.apache.isis.applib.annotation.DomainObject#updatingLifecycleEvent()} annotation attribute.  Whether this
+     * raises an event or not depends upon the "isis.reflector.facet.domainObjectAnnotation.updatingLifecycleEvent.postForDefault"
+     * configuration property.
+     */
     public static class Default extends ObjectUpdatingEvent<Object> {
         private static final long serialVersionUID = 1L;
         public Default() {}
@@ -31,6 +38,29 @@ public abstract class ObjectUpdatingEvent<S> extends AbstractLifecycleEvent<S> {
             return "ObjectUpdatingEvent$Default{source=" + getSource() + "}";
         }
     }
+    //endregion
+
+    //region > Noop class
+
+    /**
+     * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event.
+     */
+    public static class Noop extends ObjectUpdatingEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
+
+    //region > Doop class
+
+    /**
+     * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+     * property setting for the {@link Default} event..
+     */
+    public static class Doop extends ObjectUpdatingEvent<Object> {
+        private static final long serialVersionUID = 1L;
+    }
+    //endregion
 
     public ObjectUpdatingEvent() {
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
index c1f61e3..2c5e6f2 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
@@ -148,9 +148,6 @@ public abstract class ActionDomainEventFacetAbstract
         return value();
     }
 
-    /**
-     * For testing only.
-     */
     public Class<? extends ActionDomainEvent<?>> getEventType() {
         //noinspection unchecked
         return eventType();

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

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetFactory.java
new file mode 100644
index 0000000..3c4ed37
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetFactory.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixConstants;
+
+public class CreatedCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.CREATED_PREFIX, };
+
+    public CreatedCallbackFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.CREATED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            facets.add(new CreatedCallbackFacetViaMethod(method, holder));
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..8fea409
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedCallbackFacetViaMethod.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.core.metamodel.facets.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+
+public class CreatedCallbackFacetViaMethod extends CreatedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public CreatedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public Intent getIntent(final Method method) {
+        return Intent.LIFECYCLE;
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        ObjectAdapter.InvokeUtils.invokeAll(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacet.java
new file mode 100644
index 0000000..8afa6f1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacet.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacet;
+
+/**
+ * Corresponds to {@link DomainObject#createdLifecycleEvent()}<tt>.
+ */
+public interface CreatedLifecycleEventFacet  extends SingleClassValueFacet, LifecycleEventFacet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacetForDomainObjectAnnotation.java
new file mode 100644
index 0000000..5e3e43d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/CreatedLifecycleEventFacetForDomainObjectAnnotation.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.object.callbacks;
+
+import org.apache.isis.applib.services.eventbus.AbstractLifecycleEvent;
+import org.apache.isis.applib.services.eventbus.ObjectCreatedEvent;
+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 class CreatedLifecycleEventFacetForDomainObjectAnnotation extends SingleClassValueFacetAbstract implements CreatedLifecycleEventFacet {
+
+    static Class<CreatedLifecycleEventFacet> type() {
+        return CreatedLifecycleEventFacet.class;
+    }
+
+    public CreatedLifecycleEventFacetForDomainObjectAnnotation(
+            final FacetHolder holder,
+            final Class<? extends ObjectCreatedEvent<?>> value,
+            final SpecificationLoader specificationLoader) {
+        super(type(), holder, value, specificationLoader);
+    }
+
+    public Class<? extends AbstractLifecycleEvent<?>> getEventType() {
+        //noinspection unchecked
+        return eventType();
+    }
+
+    Class eventType() {
+        return value();
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadCallbackFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadCallbackFacetFactory.java
new file mode 100644
index 0000000..44696e6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadCallbackFacetFactory.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixConstants;
+
+public class LoadCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.LOADED_PREFIX, MethodPrefixConstants.LOADING_PREFIX, };
+
+    public LoadCallbackFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.LOADING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            facets.add(new LoadingCallbackFacetViaMethod(method, facetHolder));
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.LOADED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            facets.add(new LoadedCallbackFacetViaMethod(method, facetHolder));
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetAbstract.java
new file mode 100644
index 0000000..9389015
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetAbstract.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.object.callbacks;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.LoadedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class LoadedCallbackFacetAbstract extends CallbackFacetAbstract implements LoadedCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return LoadedCallbackFacet.class;
+    }
+
+    public LoadedCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..8b3ef2a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedCallbackFacetViaMethod.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.core.metamodel.facets.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+
+public class LoadedCallbackFacetViaMethod extends LoadedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public LoadedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public Intent getIntent(final Method method) {
+        return Intent.LIFECYCLE;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        ObjectAdapter.InvokeUtils.invokeAll(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacet.java
new file mode 100644
index 0000000..bfd8904
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacet.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacet;
+
+/**
+ * Corresponds to {@link DomainObject#loadedLifecycleEvent()}<tt>.
+ */
+public interface LoadedLifecycleEventFacet extends SingleClassValueFacet, LifecycleEventFacet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacetForDomainObjectAnnotation.java
new file mode 100644
index 0000000..963f4f5
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadedLifecycleEventFacetForDomainObjectAnnotation.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.object.callbacks;
+
+import org.apache.isis.applib.services.eventbus.ObjectLoadedEvent;
+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 class LoadedLifecycleEventFacetForDomainObjectAnnotation extends SingleClassValueFacetAbstract implements LoadedLifecycleEventFacet {
+
+    static Class<LoadedLifecycleEventFacet> type() {
+        return LoadedLifecycleEventFacet.class;
+    }
+
+    public LoadedLifecycleEventFacetForDomainObjectAnnotation(
+            final FacetHolder holder,
+            final Class<? extends ObjectLoadedEvent<?>> value,
+            final SpecificationLoader specificationLoader) {
+        super(type(), holder, value, specificationLoader);
+    }
+
+    public Class<? extends ObjectLoadedEvent<?>> getEventType() {
+        //noinspection unchecked
+        return eventType();
+    }
+
+    Class eventType() {
+        return value();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetAbstract.java
new file mode 100644
index 0000000..08a5d49
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetAbstract.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.object.callbacks;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.LoadingCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackFacetAbstract;
+
+/**
+ * @deprecated - THIS CAN NEVER BE CALLED (BY JDO OBJECTSTORE AT LEAST)
+ */
+@Deprecated
+public abstract class LoadingCallbackFacetAbstract extends CallbackFacetAbstract implements LoadingCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return LoadingCallbackFacet.class;
+    }
+
+    public LoadingCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetViaMethod.java
new file mode 100644
index 0000000..ad1057a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/LoadingCallbackFacetViaMethod.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.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+
+/**
+ * @deprecated - THIS CAN NEVER BE CALLED (BY JDO OBJECTSTORE AT LEAST)
+ */
+@Deprecated
+public class LoadingCallbackFacetViaMethod extends LoadingCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public LoadingCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public Intent getIntent(final Method method) {
+        return Intent.LIFECYCLE;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        ObjectAdapter.InvokeUtils.invokeAll(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackFacetFactory.java
new file mode 100644
index 0000000..a6b641a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackFacetFactory.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixConstants;
+
+public class PersistCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.PERSISTED_PREFIX, MethodPrefixConstants.PERSISTING_PREFIX, };
+
+    public PersistCallbackFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.PERSISTING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistingCallbackFacet facet = facetHolder.getFacet(PersistingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistingCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.PERSISTED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistedCallbackFacet facet = facetHolder.getFacet(PersistedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistedCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackViaSaveMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackViaSaveMethodFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackViaSaveMethodFacetFactory.java
new file mode 100644
index 0000000..e1c6c19
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistCallbackViaSaveMethodFacetFactory.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixConstants;
+
+public class PersistCallbackViaSaveMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.SAVED_PREFIX, MethodPrefixConstants.SAVING_PREFIX, };
+
+    public PersistCallbackViaSaveMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.SAVING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistingCallbackFacet facet = facetHolder.getFacet(PersistingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistingCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.SAVED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final PersistedCallbackFacet facet = facetHolder.getFacet(PersistedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new PersistedCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetAbstract.java
new file mode 100644
index 0000000..6a8f651
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetAbstract.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.object.callbacks;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class PersistedCallbackFacetAbstract extends CallbackFacetAbstract implements PersistedCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return PersistedCallbackFacet.class;
+    }
+
+    public PersistedCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..0f9988d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedCallbackFacetViaMethod.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.core.metamodel.facets.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+
+public class PersistedCallbackFacetViaMethod extends PersistedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public PersistedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public Intent getIntent(final Method method) {
+        return Intent.LIFECYCLE;
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        ObjectAdapter.InvokeUtils.invokeAll(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacet.java
new file mode 100644
index 0000000..ac7d973
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacet.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacet;
+
+/**
+ * Corresponds to {@link DomainObject#persistedLifecycleEvent()}<tt>.
+ */
+public interface PersistedLifecycleEventFacet extends SingleClassValueFacet, LifecycleEventFacet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacetForDomainObjectAnnotation.java
new file mode 100644
index 0000000..1d1da5b
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistedLifecycleEventFacetForDomainObjectAnnotation.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.object.callbacks;
+
+import org.apache.isis.applib.services.eventbus.ObjectPersistedEvent;
+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 class PersistedLifecycleEventFacetForDomainObjectAnnotation extends SingleClassValueFacetAbstract implements LoadedLifecycleEventFacet {
+
+    static Class<PersistedLifecycleEventFacet> type() {
+        return PersistedLifecycleEventFacet.class;
+    }
+
+    public PersistedLifecycleEventFacetForDomainObjectAnnotation(
+            final FacetHolder holder,
+            final Class<? extends ObjectPersistedEvent<?>> value,
+            final SpecificationLoader specificationLoader) {
+        super(type(), holder, value, specificationLoader);
+    }
+
+    public Class<? extends ObjectPersistedEvent<?>> getEventType() {
+        //noinspection unchecked
+        return eventType();
+    }
+
+    Class eventType() {
+        return value();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetAbstract.java
new file mode 100644
index 0000000..b9f0323
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetAbstract.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.object.callbacks;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackFacetAbstract;
+
+public abstract class PersistingCallbackFacetAbstract extends CallbackFacetAbstract implements PersistingCallbackFacet {
+
+    public static Class<? extends Facet> type() {
+        return PersistingCallbackFacet.class;
+    }
+
+    public PersistingCallbackFacetAbstract(final FacetHolder holder) {
+        super(type(), holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetViaMethod.java
new file mode 100644
index 0000000..4adcae8
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingCallbackFacetViaMethod.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.core.metamodel.facets.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+
+public class PersistingCallbackFacetViaMethod extends PersistingCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public PersistingCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public Intent getIntent(final Method method) {
+        return Intent.LIFECYCLE;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        ObjectAdapter.InvokeUtils.invokeAll(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacet.java
new file mode 100644
index 0000000..11ac50f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacet.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacet;
+
+/**
+ * Corresponds to {@link DomainObject#persistingLifecycleEvent()}<tt>.
+ */
+public interface PersistingLifecycleEventFacet extends SingleClassValueFacet, LifecycleEventFacet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacetForDomainObjectAnnotation.java
new file mode 100644
index 0000000..6ee15e3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/PersistingLifecycleEventFacetForDomainObjectAnnotation.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.callbacks;
+
+import org.apache.isis.applib.services.eventbus.ObjectPersistingEvent;
+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 class PersistingLifecycleEventFacetForDomainObjectAnnotation extends SingleClassValueFacetAbstract implements LoadedLifecycleEventFacet {
+
+    static Class<PersistingLifecycleEventFacet> type() {
+        return PersistingLifecycleEventFacet.class;
+    }
+
+    public PersistingLifecycleEventFacetForDomainObjectAnnotation(
+            final FacetHolder holder,
+            final Class<? extends ObjectPersistingEvent<?>> value,
+            final SpecificationLoader specificationLoader) {
+        super(type(), holder, value, specificationLoader);
+    }
+
+    public Class<? extends ObjectPersistingEvent<?>> getEventType() {
+        //noinspection unchecked
+        return eventType();
+    }
+
+    Class eventType() {
+        return value();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackFacetFactory.java
new file mode 100644
index 0000000..f084f90
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackFacetFactory.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixConstants;
+
+public class RemoveCallbackFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.REMOVED_PREFIX, MethodPrefixConstants.REMOVING_PREFIX, };
+
+    public RemoveCallbackFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.REMOVING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovingCallbackFacet facet = facetHolder.getFacet(RemovingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovingCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.REMOVED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovedCallbackFacet facet = facetHolder.getFacet(RemovedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovedCallbackFacetViaMethod(method, facetHolder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackViaDeleteMethodFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackViaDeleteMethodFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackViaDeleteMethodFacetFactory.java
new file mode 100644
index 0000000..4056797
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemoveCallbackViaDeleteMethodFacetFactory.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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.methodutils.MethodScope;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodPrefixConstants;
+
+public class RemoveCallbackViaDeleteMethodFacetFactory extends MethodPrefixBasedFacetFactoryAbstract {
+
+    private static final String[] PREFIXES = { MethodPrefixConstants.DELETED_PREFIX, MethodPrefixConstants.DELETING_PREFIX, };
+
+    public RemoveCallbackViaDeleteMethodFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        final List<Facet> facets = new ArrayList<Facet>();
+        final List<Method> methods = new ArrayList<Method>();
+
+        Method method = null;
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.DELETING_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovingCallbackFacet facet = holder.getFacet(RemovingCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovingCallbackFacetViaMethod(method, holder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        method = MethodFinderUtils.findMethod(cls, MethodScope.OBJECT, MethodPrefixConstants.DELETED_PREFIX, void.class, NO_PARAMETERS_TYPES);
+        if (method != null) {
+            methods.add(method);
+            final RemovedCallbackFacet facet = holder.getFacet(RemovedCallbackFacet.class);
+            if (facet == null) {
+                facets.add(new RemovedCallbackFacetViaMethod(method, holder));
+            } else {
+                facet.addMethod(method);
+            }
+        }
+
+        processClassContext.removeMethods(methods);
+        FacetUtil.addFacets(facets);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacet.java
index 21b6e81..ce70073 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacet.java
@@ -27,7 +27,9 @@ package org.apache.isis.core.metamodel.facets.object.callbacks;
  * <tt>deleted</tt> method.
  * 
  * @see RemovingCallbackFacet
+ * @deprecated - cannot touch a pojo once deleted
  */
+@Deprecated
 public interface RemovedCallbackFacet extends CallbackFacet {
 
 }

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

http://git-wip-us.apache.org/repos/asf/isis/blob/8cf480de/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacetViaMethod.java
new file mode 100644
index 0000000..f41a90f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/RemovedCallbackFacetViaMethod.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.object.callbacks;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+
+/**
+ * @deprecated - cannot touch a pojo once deleted
+ */
+@Deprecated
+public class RemovedCallbackFacetViaMethod extends RemovedCallbackFacetAbstract implements ImperativeFacet {
+
+    private final List<Method> methods = new ArrayList<Method>();
+
+    public RemovedCallbackFacetViaMethod(final Method method, final FacetHolder holder) {
+        super(holder);
+        addMethod(method);
+    }
+
+    @Override
+    public void addMethod(final Method method) {
+        methods.add(method);
+    }
+
+    @Override
+    public List<Method> getMethods() {
+        return Collections.unmodifiableList(methods);
+    }
+
+    @Override
+    public Intent getIntent(final Method method) {
+        return Intent.LIFECYCLE;
+    }
+
+    @Override
+    public void invoke(final ObjectAdapter adapter) {
+        ObjectAdapter.InvokeUtils.invokeAll(methods, adapter);
+    }
+
+    @Override
+    protected String toStringValues() {
+        return "methods=" + methods;
+    }
+
+}