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 2010/11/03 02:24:23 UTC

svn commit: r1030308 [2/8] - in /incubator/isis/trunk: alternatives/remoting/common/src/main/java/org/apache/isis/remoting/facade/impl/ alternatives/remoting/common/src/main/java/org/apache/isis/remoting/server/ alternatives/remoting/common/src/test/ja...

Modified: incubator/isis/trunk/alternatives/remoting/common/src/test/java/org/apache/isis/remoting/client/ProxyPersistorTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/remoting/common/src/test/java/org/apache/isis/remoting/client/ProxyPersistorTest.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/alternatives/remoting/common/src/test/java/org/apache/isis/remoting/client/ProxyPersistorTest.java (original)
+++ incubator/isis/trunk/alternatives/remoting/common/src/test/java/org/apache/isis/remoting/client/ProxyPersistorTest.java Wed Nov  3 01:24:18 2010
@@ -17,513 +17,496 @@
  *  under the License.
  */
 
+package org.apache.isis.remoting.client;
 
-package org.apache.isis.remoting.client;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.hamcrest.Matcher;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.adapter.ObjectList;
-import org.apache.isis.metamodel.adapter.ResolveState;
-import org.apache.isis.metamodel.adapter.version.Version;
-import org.apache.isis.metamodel.authentication.AuthenticationSession;
-import org.apache.isis.metamodel.services.ServicesInjectorDefault;
-import org.apache.isis.metamodel.services.container.DomainObjectContainerDefault;
-import org.apache.isis.metamodel.spec.ObjectSpecification;
-import org.apache.isis.metamodel.specloader.SpecificationLoader;
-import org.apache.isis.remoting.client.persistence.ClientSideTransactionManager;
-import org.apache.isis.remoting.client.persistence.PersistenceSessionProxy;
-import org.apache.isis.remoting.client.transaction.ClientTransactionEvent;
-import org.apache.isis.remoting.data.Data;
-import org.apache.isis.remoting.data.DummyEncodeableObjectData;
-import org.apache.isis.remoting.data.DummyIdentityData;
-import org.apache.isis.remoting.data.DummyNullValue;
-import org.apache.isis.remoting.data.DummyObjectData;
-import org.apache.isis.remoting.data.DummyReferenceData;
-import org.apache.isis.remoting.data.common.IdentityData;
-import org.apache.isis.remoting.data.common.NullData;
-import org.apache.isis.remoting.data.common.ObjectData;
-import org.apache.isis.remoting.data.common.ReferenceData;
-import org.apache.isis.remoting.data.query.PersistenceQueryData;
-import org.apache.isis.remoting.exchange.ExecuteClientActionRequest;
-import org.apache.isis.remoting.exchange.ExecuteClientActionResponse;
-import org.apache.isis.remoting.exchange.FindInstancesRequest;
-import org.apache.isis.remoting.exchange.HasInstancesRequest;
-import org.apache.isis.remoting.exchange.KnownObjectsRequest;
-import org.apache.isis.remoting.exchange.ResolveObjectRequest;
-import org.apache.isis.remoting.facade.ServerFacade;
-import org.apache.isis.remoting.protocol.encoding.internal.ObjectEncoderDecoder;
-import org.apache.isis.runtime.context.IsisContext;
-import org.apache.isis.runtime.persistence.PersistenceSessionFactory;
-import org.apache.isis.runtime.persistence.adapterfactory.AdapterFactory;
-import org.apache.isis.runtime.persistence.adapterfactory.pojo.PojoAdapterFactory;
-import org.apache.isis.runtime.persistence.adaptermanager.AdapterManagerDefault;
-import org.apache.isis.runtime.persistence.adaptermanager.AdapterManagerExtended;
-import org.apache.isis.runtime.persistence.internal.RuntimeContextFromSession;
-import org.apache.isis.runtime.persistence.objectfactory.ObjectFactory;
-import org.apache.isis.runtime.persistence.objectfactory.ObjectFactoryBasic;
-import org.apache.isis.runtime.persistence.oidgenerator.OidGenerator;
-import org.apache.isis.runtime.persistence.query.PersistenceQueryFindAllInstances;
-import org.apache.isis.runtime.testdomain.Movie;
-import org.apache.isis.runtime.testdomain.Person;
-import org.apache.isis.runtime.testspec.MovieSpecification;
-import org.apache.isis.runtime.testsystem.ProxyJunit4TestCase;
-import org.apache.isis.runtime.testsystem.TestProxyAdapter;
-import org.apache.isis.runtime.testsystem.TestProxyOid;
-import org.apache.isis.runtime.testsystem.TestProxyOidGenerator;
-import org.apache.isis.runtime.testsystem.TestProxyVersion;
-
-@RunWith(JMock.class)
-public class ProxyPersistorTest extends ProxyJunit4TestCase {
-
-    private Mockery mockery = new JUnit4Mockery();
-
-
-    private PersistenceSessionFactory mockPersistenceSessionFactory;
-    private ServerFacade mockDistribution;
-    private ObjectEncoderDecoder mockEncoder;
-
-    private PersistenceSessionProxy persistenceSessionProxy;
-    private ClientSideTransactionManager transactionManager;
-    private AuthenticationSession session;
-
-
-    private AdapterManagerExtended adapterManager;
-
-
-    private AdapterFactory adapterFactory;
-    private ObjectFactory objectFactory;
-    private OidGenerator oidGenerator;
-
-
-    @Before
-    public void setUp() throws Exception {
-        // createSystem();
-
-
-        mockPersistenceSessionFactory = mockery.mock(PersistenceSessionFactory.class);
-        mockDistribution = mockery.mock(ServerFacade.class);
-        mockEncoder = mockery.mock(ObjectEncoderDecoder.class);
-
-        adapterManager = new AdapterManagerDefault();
-        adapterFactory = new PojoAdapterFactory();
-        objectFactory = new ObjectFactoryBasic();
-        oidGenerator = new TestProxyOidGenerator();
-
-        RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
-        DomainObjectContainerDefault container = new DomainObjectContainerDefault();
-
-        runtimeContext.injectInto(container);
-        runtimeContext.setContainer(container);
-
-        ServicesInjectorDefault servicesInjector = new ServicesInjectorDefault();
-        servicesInjector.setContainer(container);
-
-		persistenceSessionProxy = new PersistenceSessionProxy(
-                mockPersistenceSessionFactory,
-                adapterFactory,
-                objectFactory,
-                servicesInjector,
-                oidGenerator,
-                adapterManager,
-                mockDistribution,
-                mockEncoder);
-
-        persistenceSessionProxy.setSpecificationLoader(system.getReflector());
-        transactionManager = new ClientSideTransactionManager(adapterManager, persistenceSessionProxy, mockDistribution, mockEncoder);
-        transactionManager.injectInto(persistenceSessionProxy);
-
-        session = IsisContext.getAuthenticationSession();
-
-        system.setPersistenceSession(persistenceSessionProxy);
-
-        ignoreCallsToInitializeMocks();
-        persistenceSessionProxy.open();
-    }
-
-    @After
-    public void tearDown() throws Exception {}
-
-	private static SpecificationLoader getSpecificationLoader() {
-		return IsisContext.getSpecificationLoader();
-	}
-
-
-    @Test
-    public void testClientSideMakesNoRemoteCallsWhenNoWorkNeeded() throws Exception {
-        mockery.checking(new Expectations() {
-            {
-                never(mockDistribution);
-            }
-        });
-
-        transactionManager.startTransaction();
-        transactionManager.endTransaction();
-    }
-
-    @Ignore("need to get working after refactoring")
-    @Test
-    public void testFindInstances() throws Exception {
-
-        // The remote interface is asked for instances, which are returned as data objects
-        final DummyObjectData instanceData = new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true,
-                new TestProxyVersion(3));
-
-        // The data then needs to be decoded into the [[NAME]]
-        final TestProxyAdapter dummyObjectAdapter = new TestProxyAdapter();
-        // new DummyOid(12, true), ResolveState.GHOST, "test");
-        dummyObjectAdapter.setupObject(new Movie());
-        dummyObjectAdapter.setupSpecification(new MovieSpecification());
-
-        final PersistenceQueryData c = new TestCriteria();
-        ObjectSpecification noSpec = getSpecificationLoader().loadSpecification(Movie.class);
-		final PersistenceQueryFindAllInstances criteria = new PersistenceQueryFindAllInstances(noSpec);
-
-		final FindInstancesRequest request = new FindInstancesRequest(session, c);
-
-        mockery.checking(new Expectations() {
-            {
-                one(mockEncoder).decode(instanceData);
-                will(returnValue(dummyObjectAdapter));
-
-				one(mockDistribution).findInstances(request);
-                will(returnValue(new ObjectData[] { instanceData }));
-
-                one(mockEncoder).encodePersistenceQuery(criteria);
-                will(returnValue(c));
-            }
-        });
-
-
-		final ObjectAdapter instances = persistenceSessionProxy.findInstances(criteria);
-
-        // the proxy should return one instance, which will be the dummy object created by the encoder's
-        // restore call
-        final ObjectList objects = (ObjectList) instances.getObject();
-        assertEquals(1, objects.size());
-        assertEquals(dummyObjectAdapter, objects.elements().nextElement());
-    }
-
-    @Test
-    public void testResolveImmediatelyIgnoredWhenAlreadyResolving() throws Exception {
-
-        final TestProxyAdapter object = new TestProxyAdapter();
-        object.setupResolveState(ResolveState.RESOLVING);
-
-        // implicit: expect no calls to encoder object
-        mockery.checking(new Expectations() {
-            {
-                never(mockDistribution);
-            }
-        });
-
-        persistenceSessionProxy.resolveImmediately(object);
-    }
-
-    @Ignore("need to get working after refactoring")
-    @Test
-    public void testResolveImmediately() throws Exception {
-
-        final TestProxyAdapter object = new TestProxyAdapter();
-        object.setupOid(new TestProxyOid(5));
-        object.setupResolveState(ResolveState.GHOST);
-
-        final IdentityData identityData = new DummyReferenceData();
-        final ObjectData objectData = new DummyObjectData();
-        final ResolveObjectRequest request = new ResolveObjectRequest(session, identityData);
-
-        mockery.checking(new Expectations() {
-            {
-                // encoder used to create identity data for target object
-                one(mockEncoder).encodeIdentityData(object);
-                will(returnValue(identityData));
-
-				// remote call asks for object's data
-                one(mockDistribution).resolveImmediately(request);
-                will(returnValue(objectData));
-
-                // data decode expected
-                one(mockEncoder).decode(objectData);
-                will(returnValue(null));
-            }
-        });
-
-        persistenceSessionProxy.resolveImmediately(object);
-
-        /*
-         *
-         * assertEquals("ET", movie.getName()); assertEquals(new DummyOid(5), object.getOid());
-         * assertEquals(new DummyVersion(3), object.getVersion());
-         */
-    }
-
-    @Ignore("TODO")
-    @Test
-    public void testResolveField_TBI() {}
-
-
-    @Ignore("need to get working after refactoring")
-    @Test
-    public void testHasInstances() throws Exception {
-
-    	final HasInstancesRequest request = new HasInstancesRequest(session, Movie.class.getName());
-        mockery.checking(new Expectations() {
-            {
-				one(mockDistribution).hasInstances(request);
-                will(returnValue(true));
-
-				one(mockDistribution).hasInstances(request);
-                will(returnValue(false));
-            }
-        });
-
-        final ObjectSpecification type = getSpecificationLoader().loadSpecification(Movie.class);
-        assertTrue(persistenceSessionProxy.hasInstances(type));
-        assertFalse(persistenceSessionProxy.hasInstances(type));
-    }
-
-    public void testFindInstancesButNoneFound() throws Exception {
-
-        // system.addSpecificationToLoader(new MovieSpecification());
-
-        final PersistenceQueryData c = new TestCriteria();
-        ObjectSpecification noSpec = getSpecificationLoader().loadSpecification(Movie.class);
-		final PersistenceQueryFindAllInstances criteria = new PersistenceQueryFindAllInstances(noSpec);
-		final FindInstancesRequest request = new FindInstancesRequest(session, c);
-
-        mockery.checking(new Expectations() {
-            {
-				one(mockDistribution).findInstances(request);
-                will(returnValue(new ObjectData[0]));
-
-                one(mockEncoder).encodePersistenceQuery(criteria);
-                will(returnValue(c));
-            }
-        });
-
-		persistenceSessionProxy.findInstances(criteria);
-    }
-
-    @Test(expected=IllegalStateException.class)
-    public void testClientSideActionThrowsExceptionWhenTransactionNotStarted() throws Exception {
-
-        transactionManager.endTransaction();
-    }
-
-    @Test
-    public void testClientSideActionWhereObjectDeleted() throws Exception {
-
-        final ObjectAdapter movieAdapter = system.createPersistentTestObject();
-
-        // test starts here
-        mockery.checking(new Expectations() {
-            {
-                final DummyIdentityData identityOfObjectToDelete = encoderShouldCreateIdentityDataForMovie(movieAdapter);
-                distributionShouldExecuteClientActionForDeletedMovie(identityOfObjectToDelete);
-            }
-
-            private DummyIdentityData encoderShouldCreateIdentityDataForMovie(final ObjectAdapter movieAdapter) {
-                final DummyIdentityData identityOfObjectToDelete = new DummyIdentityData();
-
-                one(mockEncoder).encodeIdentityData(movieAdapter);
-                will(returnValue(identityOfObjectToDelete));
-                return identityOfObjectToDelete;
-            }
-            private void distributionShouldExecuteClientActionForDeletedMovie(final DummyIdentityData identityOfObjectToDelete) {
-                final Version[] versionUpdates = new Version[] {};
-                one(mockDistribution).executeClientAction(
-                        with(any(ExecuteClientActionRequest.class)));
-                will(returnValue(new ExecuteClientActionResponse(new ObjectData[] {}, versionUpdates, new ObjectData[0])));
-            }
-        });
-
-        // TODO: should look inside the request object and ensure:
-        // with(equalTo(session)),
-        // with(equalTo(new ReferenceData[] { identityOfObjectToDelete })),
-        // with(equalTo(new int[] { ClientTransactionEvent.DELETE })),
-
-        transactionManager.startTransaction();
-        persistenceSessionProxy.destroyObject(movieAdapter);
-        transactionManager.endTransaction();
-        final List<ObjectAdapter> allDisposedObjects = IsisContext.getUpdateNotifier().getDisposedObjects();
-
-        assertFalse(allDisposedObjects.isEmpty());
-        assertEquals(movieAdapter, allDisposedObjects.get(0));
-    }
-
-    @Test
-    public void testClientSideActionWhereObjectChanged() throws Exception {
-
-        final TestProxyAdapter directorAdapter = new TestProxyAdapter();
-        directorAdapter.setupResolveState(ResolveState.RESOLVED);
-
-        final TestProxyAdapter movieAdapter = new TestProxyAdapter();
-        movieAdapter.setupResolveState(ResolveState.RESOLVED);
-
-
-        mockery.checking(new Expectations() {
-            {
-                final DummyObjectData movieData = encoderShouldCreateGraphForChangedMovie(movieAdapter);
-                final DummyObjectData directorData = encoderShouldCreateGraphForChangedDirector(directorAdapter);
-                distributionShouldExecuteClientActionForBothChangedObjects(movieData, directorData);
-            }
-
-            private DummyObjectData encoderShouldCreateGraphForChangedMovie(final TestProxyAdapter movieAdapter) {
-                final DummyObjectData movieData = new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true,
-                        new TestProxyVersion(4));
-                final DummyEncodeableObjectData expectedMovieName = new DummyEncodeableObjectData("War of the Worlds", String.class
-                        .getName());
-                final DummyReferenceData expectedDirectorRef = new DummyReferenceData(new TestProxyOid(14, true), Person.class.getName(),
-                        new TestProxyVersion(8));
-                movieData.setFieldContent(new Data[] { expectedDirectorRef, expectedMovieName });
-
-                one(mockEncoder).encodeGraphForChangedObject(movieAdapter, new KnownObjectsRequest());
-                will(returnValue(movieData));
-                return movieData;
-            }
-            private DummyObjectData encoderShouldCreateGraphForChangedDirector(final TestProxyAdapter directorAdapter) {
-                final DummyObjectData directorData = new DummyObjectData(new TestProxyOid(14, true), Person.class.getName(), true,
-                        new TestProxyVersion(8));
-                final DummyEncodeableObjectData expectedDirectorName = new DummyEncodeableObjectData("Unknown", String.class.getName());
-                directorData.setFieldContent(new Data[] { expectedDirectorName });
-
-                one(mockEncoder).encodeGraphForChangedObject(directorAdapter, new KnownObjectsRequest());
-                will(returnValue(directorData));
-                return directorData;
-            }
-
-            private void distributionShouldExecuteClientActionForBothChangedObjects(
-                    final DummyObjectData movieData,
-                    final DummyObjectData directorData) {
-                // final ObjectData[] changes = new ObjectData[] { movieData, directorData };
-                // final int[] types = new int[] { ClientTransactionEvent.CHANGE, ClientTransactionEvent.CHANGE };
-
-                one(mockDistribution).executeClientAction(
-                        with(any(ExecuteClientActionRequest.class)));
-
-                final Version[] versionUpdates = new Version[] { new TestProxyVersion(5), new TestProxyVersion(9) };
-                will(returnValue(
-                        new ExecuteClientActionResponse(
-                        		new ObjectData[] { movieData, directorData },
-                        		versionUpdates, new ObjectData[0])));
-            }
-        });
-        // TODO: should look inside the request object and ensure:
-        // with(equalTo(session)),
-        // with(equalTo(changes)),
-        // with(equalTo(types)),
-
-
-        transactionManager.startTransaction();
-        persistenceSessionProxy.objectChanged(movieAdapter);
-        persistenceSessionProxy.objectChanged(directorAdapter);
-        transactionManager.endTransaction();
-
-
-        assertEquals(new TestProxyVersion(5), movieAdapter.getVersion());
-        assertEquals(new TestProxyVersion(9), directorAdapter.getVersion());
-    }
-
-    @Test
-    public void testClientSideActionWhereTransientObjectMadePersistent() throws Exception {
-
-        final ObjectAdapter transientObject = system.createTransientTestObject();
-
-        final TestProxyOid previousOid = (TestProxyOid) transientObject.getOid();
-        final DummyObjectData movieData = new DummyObjectData(previousOid, Movie.class.getName(), true, null);
-        final NullData directorData = new DummyNullValue(Person.class.getName());
-        final DummyEncodeableObjectData nameData = new DummyEncodeableObjectData("Star Wars", String.class.getName());
-        movieData.setFieldContent(new Data[] { directorData, nameData });
-
-        mockery.checking(new Expectations() {
-            {
-                // this returns results data with new oid and version
-                final TestProxyOid newOid = new TestProxyOid(123, true);
-                newOid.setupPrevious(previousOid);
-                final DummyReferenceData updateData = new DummyReferenceData(newOid, "type", new TestProxyVersion(456));
-
-                // the server is called with data (movieData) for the object to be persisted
-                one(mockDistribution).executeClientAction(
-                        with(any(ExecuteClientActionRequest.class)));
-
-                will(returnValue(new ExecuteClientActionResponse(new ReferenceData[] { updateData }, null, new ObjectData[0])));
-            }
-
-        });
-        // TODO: should look inside the request object and ensure:
-        // with(equalTo(session)),
-        // with(equalTo(new ReferenceData[] { movieData })),
-        // with(equalTo(new int[] { ClientTransactionEvent.ADD })),
-
-        getAdapterManager().adapterFor(transientObject.getObject());
-
-        // client needs to encode the object's transient aspects
-        mockery.checking(new Expectations() {
-            {
-                one(mockEncoder).encodeMakePersistentGraph(
-                        with(equalTo(transientObject)),
-                        with(any(KnownObjectsRequest.class)));
-                will(returnValue(movieData));
-            }
-        });
-
-        transactionManager.startTransaction();
-        persistenceSessionProxy.makePersistent(transientObject);
-        transactionManager.endTransaction();
-    }
-
-
-
-    ///////////////////////////////
-    // helpers
-    ///////////////////////////////
-
-    private void ignoreCallsToInitializeMocks() {
-        mockery.checking(new Expectations() {
-            {
-                ignoring(mockDistribution).init();
-            }
-        });
-    }
-
-    private void ignoreCallsToDistribution() {
-        mockery.checking(new Expectations() {
-            {
-                ignoring(mockDistribution);
-            }
-        });
-    }
-
-
-}
-
-class TestCriteria implements PersistenceQueryData {
-    private static final long serialVersionUID = 1L;
-
-    public Class getPersistenceQueryClass() {
-        return null;
-    }
-
-    public boolean includeSubclasses() {
-        return false;
-    }
-
-    public String getType() {
-        return null;
-    }
-}
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.adapter.ObjectList;
+import org.apache.isis.metamodel.adapter.ResolveState;
+import org.apache.isis.metamodel.adapter.version.Version;
+import org.apache.isis.metamodel.authentication.AuthenticationSession;
+import org.apache.isis.metamodel.services.ServicesInjectorDefault;
+import org.apache.isis.metamodel.services.container.DomainObjectContainerDefault;
+import org.apache.isis.metamodel.spec.ObjectSpecification;
+import org.apache.isis.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.remoting.client.persistence.ClientSideTransactionManager;
+import org.apache.isis.remoting.client.persistence.PersistenceSessionProxy;
+import org.apache.isis.remoting.data.Data;
+import org.apache.isis.remoting.data.DummyEncodeableObjectData;
+import org.apache.isis.remoting.data.DummyIdentityData;
+import org.apache.isis.remoting.data.DummyNullValue;
+import org.apache.isis.remoting.data.DummyObjectData;
+import org.apache.isis.remoting.data.DummyReferenceData;
+import org.apache.isis.remoting.data.common.IdentityData;
+import org.apache.isis.remoting.data.common.NullData;
+import org.apache.isis.remoting.data.common.ObjectData;
+import org.apache.isis.remoting.data.common.ReferenceData;
+import org.apache.isis.remoting.data.query.PersistenceQueryData;
+import org.apache.isis.remoting.exchange.ExecuteClientActionRequest;
+import org.apache.isis.remoting.exchange.ExecuteClientActionResponse;
+import org.apache.isis.remoting.exchange.FindInstancesRequest;
+import org.apache.isis.remoting.exchange.HasInstancesRequest;
+import org.apache.isis.remoting.exchange.KnownObjectsRequest;
+import org.apache.isis.remoting.exchange.ResolveObjectRequest;
+import org.apache.isis.remoting.facade.ServerFacade;
+import org.apache.isis.remoting.protocol.encoding.internal.ObjectEncoderDecoder;
+import org.apache.isis.runtime.context.IsisContext;
+import org.apache.isis.runtime.persistence.PersistenceSessionFactory;
+import org.apache.isis.runtime.persistence.adapterfactory.AdapterFactory;
+import org.apache.isis.runtime.persistence.adapterfactory.pojo.PojoAdapterFactory;
+import org.apache.isis.runtime.persistence.adaptermanager.AdapterManagerDefault;
+import org.apache.isis.runtime.persistence.adaptermanager.AdapterManagerExtended;
+import org.apache.isis.runtime.persistence.internal.RuntimeContextFromSession;
+import org.apache.isis.runtime.persistence.objectfactory.ObjectFactory;
+import org.apache.isis.runtime.persistence.objectfactory.ObjectFactoryBasic;
+import org.apache.isis.runtime.persistence.oidgenerator.OidGenerator;
+import org.apache.isis.runtime.persistence.query.PersistenceQueryFindAllInstances;
+import org.apache.isis.runtime.testdomain.Movie;
+import org.apache.isis.runtime.testdomain.Person;
+import org.apache.isis.runtime.testspec.MovieSpecification;
+import org.apache.isis.runtime.testsystem.ProxyJunit4TestCase;
+import org.apache.isis.runtime.testsystem.TestProxyAdapter;
+import org.apache.isis.runtime.testsystem.TestProxyOid;
+import org.apache.isis.runtime.testsystem.TestProxyOidGenerator;
+import org.apache.isis.runtime.testsystem.TestProxyVersion;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(JMock.class)
+public class ProxyPersistorTest extends ProxyJunit4TestCase {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private PersistenceSessionFactory mockPersistenceSessionFactory;
+    private ServerFacade mockDistribution;
+    private ObjectEncoderDecoder mockEncoder;
+
+    private PersistenceSessionProxy persistenceSessionProxy;
+    private ClientSideTransactionManager transactionManager;
+    private AuthenticationSession session;
+
+    private AdapterManagerExtended adapterManager;
+
+    private AdapterFactory adapterFactory;
+    private ObjectFactory objectFactory;
+    private OidGenerator oidGenerator;
+
+    @Before
+    public void setUp() throws Exception {
+        // createSystem();
+
+        mockPersistenceSessionFactory = mockery.mock(PersistenceSessionFactory.class);
+        mockDistribution = mockery.mock(ServerFacade.class);
+        mockEncoder = mockery.mock(ObjectEncoderDecoder.class);
+
+        adapterManager = new AdapterManagerDefault();
+        adapterFactory = new PojoAdapterFactory();
+        objectFactory = new ObjectFactoryBasic();
+        oidGenerator = new TestProxyOidGenerator();
+
+        RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        DomainObjectContainerDefault container = new DomainObjectContainerDefault();
+
+        runtimeContext.injectInto(container);
+        runtimeContext.setContainer(container);
+
+        ServicesInjectorDefault servicesInjector = new ServicesInjectorDefault();
+        servicesInjector.setContainer(container);
+
+        persistenceSessionProxy =
+            new PersistenceSessionProxy(mockPersistenceSessionFactory, adapterFactory, objectFactory, servicesInjector,
+                oidGenerator, adapterManager, mockDistribution, mockEncoder);
+
+        persistenceSessionProxy.setSpecificationLoader(system.getReflector());
+        transactionManager =
+            new ClientSideTransactionManager(adapterManager, persistenceSessionProxy, mockDistribution, mockEncoder);
+        transactionManager.injectInto(persistenceSessionProxy);
+
+        session = IsisContext.getAuthenticationSession();
+
+        system.setPersistenceSession(persistenceSessionProxy);
+
+        ignoreCallsToInitializeMocks();
+        persistenceSessionProxy.open();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    private static SpecificationLoader getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    @Test
+    public void testClientSideMakesNoRemoteCallsWhenNoWorkNeeded() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                never(mockDistribution);
+            }
+        });
+
+        transactionManager.startTransaction();
+        transactionManager.endTransaction();
+    }
+
+    @Ignore("need to get working after refactoring")
+    @Test
+    public void testFindInstances() throws Exception {
+
+        // The remote interface is asked for instances, which are returned as data objects
+        final DummyObjectData instanceData =
+            new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true, new TestProxyVersion(3));
+
+        // The data then needs to be decoded into the ObjectAdapter
+        final TestProxyAdapter dummyObjectAdapter = new TestProxyAdapter();
+        // new DummyOid(12, true), ResolveState.GHOST, "test");
+        dummyObjectAdapter.setupObject(new Movie());
+        dummyObjectAdapter.setupSpecification(new MovieSpecification());
+
+        final PersistenceQueryData c = new TestCriteria();
+        ObjectSpecification noSpec = getSpecificationLoader().loadSpecification(Movie.class);
+        final PersistenceQueryFindAllInstances criteria = new PersistenceQueryFindAllInstances(noSpec);
+
+        final FindInstancesRequest request = new FindInstancesRequest(session, c);
+
+        mockery.checking(new Expectations() {
+            {
+                one(mockEncoder).decode(instanceData);
+                will(returnValue(dummyObjectAdapter));
+
+                one(mockDistribution).findInstances(request);
+                will(returnValue(new ObjectData[] { instanceData }));
+
+                one(mockEncoder).encodePersistenceQuery(criteria);
+                will(returnValue(c));
+            }
+        });
+
+        final ObjectAdapter instances = persistenceSessionProxy.findInstances(criteria);
+
+        // the proxy should return one instance, which will be the dummy object created by the encoder's
+        // restore call
+        final ObjectList objects = (ObjectList) instances.getObject();
+        assertEquals(1, objects.size());
+        assertEquals(dummyObjectAdapter, objects.elements().nextElement());
+    }
+
+    @Test
+    public void testResolveImmediatelyIgnoredWhenAlreadyResolving() throws Exception {
+
+        final TestProxyAdapter object = new TestProxyAdapter();
+        object.setupResolveState(ResolveState.RESOLVING);
+
+        // implicit: expect no calls to encoder object
+        mockery.checking(new Expectations() {
+            {
+                never(mockDistribution);
+            }
+        });
+
+        persistenceSessionProxy.resolveImmediately(object);
+    }
+
+    @Ignore("need to get working after refactoring")
+    @Test
+    public void testResolveImmediately() throws Exception {
+
+        final TestProxyAdapter object = new TestProxyAdapter();
+        object.setupOid(new TestProxyOid(5));
+        object.setupResolveState(ResolveState.GHOST);
+
+        final IdentityData identityData = new DummyReferenceData();
+        final ObjectData objectData = new DummyObjectData();
+        final ResolveObjectRequest request = new ResolveObjectRequest(session, identityData);
+
+        mockery.checking(new Expectations() {
+            {
+                // encoder used to create identity data for target object
+                one(mockEncoder).encodeIdentityData(object);
+                will(returnValue(identityData));
+
+                // remote call asks for object's data
+                one(mockDistribution).resolveImmediately(request);
+                will(returnValue(objectData));
+
+                // data decode expected
+                one(mockEncoder).decode(objectData);
+                will(returnValue(null));
+            }
+        });
+
+        persistenceSessionProxy.resolveImmediately(object);
+
+        /*
+         * 
+         * assertEquals("ET", movie.getName()); assertEquals(new DummyOid(5), object.getOid()); assertEquals(new
+         * DummyVersion(3), object.getVersion());
+         */
+    }
+
+    @Ignore("TODO")
+    @Test
+    public void testResolveField_TBI() {
+    }
+
+    @Ignore("need to get working after refactoring")
+    @Test
+    public void testHasInstances() throws Exception {
+
+        final HasInstancesRequest request = new HasInstancesRequest(session, Movie.class.getName());
+        mockery.checking(new Expectations() {
+            {
+                one(mockDistribution).hasInstances(request);
+                will(returnValue(true));
+
+                one(mockDistribution).hasInstances(request);
+                will(returnValue(false));
+            }
+        });
+
+        final ObjectSpecification type = getSpecificationLoader().loadSpecification(Movie.class);
+        assertTrue(persistenceSessionProxy.hasInstances(type));
+        assertFalse(persistenceSessionProxy.hasInstances(type));
+    }
+
+    public void testFindInstancesButNoneFound() throws Exception {
+
+        // system.addSpecificationToLoader(new MovieSpecification());
+
+        final PersistenceQueryData c = new TestCriteria();
+        ObjectSpecification noSpec = getSpecificationLoader().loadSpecification(Movie.class);
+        final PersistenceQueryFindAllInstances criteria = new PersistenceQueryFindAllInstances(noSpec);
+        final FindInstancesRequest request = new FindInstancesRequest(session, c);
+
+        mockery.checking(new Expectations() {
+            {
+                one(mockDistribution).findInstances(request);
+                will(returnValue(new ObjectData[0]));
+
+                one(mockEncoder).encodePersistenceQuery(criteria);
+                will(returnValue(c));
+            }
+        });
+
+        persistenceSessionProxy.findInstances(criteria);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testClientSideActionThrowsExceptionWhenTransactionNotStarted() throws Exception {
+
+        transactionManager.endTransaction();
+    }
+
+    @Test
+    public void testClientSideActionWhereObjectDeleted() throws Exception {
+
+        final ObjectAdapter movieAdapter = system.createPersistentTestObject();
+
+        // test starts here
+        mockery.checking(new Expectations() {
+            {
+                final DummyIdentityData identityOfObjectToDelete =
+                    encoderShouldCreateIdentityDataForMovie(movieAdapter);
+                distributionShouldExecuteClientActionForDeletedMovie(identityOfObjectToDelete);
+            }
+
+            private DummyIdentityData encoderShouldCreateIdentityDataForMovie(final ObjectAdapter movieAdapter) {
+                final DummyIdentityData identityOfObjectToDelete = new DummyIdentityData();
+
+                one(mockEncoder).encodeIdentityData(movieAdapter);
+                will(returnValue(identityOfObjectToDelete));
+                return identityOfObjectToDelete;
+            }
+
+            private void distributionShouldExecuteClientActionForDeletedMovie(
+                final DummyIdentityData identityOfObjectToDelete) {
+                final Version[] versionUpdates = new Version[] {};
+                one(mockDistribution).executeClientAction(with(any(ExecuteClientActionRequest.class)));
+                will(returnValue(new ExecuteClientActionResponse(new ObjectData[] {}, versionUpdates, new ObjectData[0])));
+            }
+        });
+
+        // TODO: should look inside the request object and ensure:
+        // with(equalTo(session)),
+        // with(equalTo(new ReferenceData[] { identityOfObjectToDelete })),
+        // with(equalTo(new int[] { ClientTransactionEvent.DELETE })),
+
+        transactionManager.startTransaction();
+        persistenceSessionProxy.destroyObject(movieAdapter);
+        transactionManager.endTransaction();
+        final List<ObjectAdapter> allDisposedObjects = IsisContext.getUpdateNotifier().getDisposedObjects();
+
+        assertFalse(allDisposedObjects.isEmpty());
+        assertEquals(movieAdapter, allDisposedObjects.get(0));
+    }
+
+    @Test
+    public void testClientSideActionWhereObjectChanged() throws Exception {
+
+        final TestProxyAdapter directorAdapter = new TestProxyAdapter();
+        directorAdapter.setupResolveState(ResolveState.RESOLVED);
+
+        final TestProxyAdapter movieAdapter = new TestProxyAdapter();
+        movieAdapter.setupResolveState(ResolveState.RESOLVED);
+
+        mockery.checking(new Expectations() {
+            {
+                final DummyObjectData movieData = encoderShouldCreateGraphForChangedMovie(movieAdapter);
+                final DummyObjectData directorData = encoderShouldCreateGraphForChangedDirector(directorAdapter);
+                distributionShouldExecuteClientActionForBothChangedObjects(movieData, directorData);
+            }
+
+            private DummyObjectData encoderShouldCreateGraphForChangedMovie(final TestProxyAdapter movieAdapter) {
+                final DummyObjectData movieData =
+                    new DummyObjectData(new TestProxyOid(12, true), Movie.class.getName(), true,
+                        new TestProxyVersion(4));
+                final DummyEncodeableObjectData expectedMovieName =
+                    new DummyEncodeableObjectData("War of the Worlds", String.class.getName());
+                final DummyReferenceData expectedDirectorRef =
+                    new DummyReferenceData(new TestProxyOid(14, true), Person.class.getName(), new TestProxyVersion(8));
+                movieData.setFieldContent(new Data[] { expectedDirectorRef, expectedMovieName });
+
+                one(mockEncoder).encodeGraphForChangedObject(movieAdapter, new KnownObjectsRequest());
+                will(returnValue(movieData));
+                return movieData;
+            }
+
+            private DummyObjectData encoderShouldCreateGraphForChangedDirector(final TestProxyAdapter directorAdapter) {
+                final DummyObjectData directorData =
+                    new DummyObjectData(new TestProxyOid(14, true), Person.class.getName(), true, new TestProxyVersion(
+                        8));
+                final DummyEncodeableObjectData expectedDirectorName =
+                    new DummyEncodeableObjectData("Unknown", String.class.getName());
+                directorData.setFieldContent(new Data[] { expectedDirectorName });
+
+                one(mockEncoder).encodeGraphForChangedObject(directorAdapter, new KnownObjectsRequest());
+                will(returnValue(directorData));
+                return directorData;
+            }
+
+            private void distributionShouldExecuteClientActionForBothChangedObjects(final DummyObjectData movieData,
+                final DummyObjectData directorData) {
+                // final ObjectData[] changes = new ObjectData[] { movieData, directorData };
+                // final int[] types = new int[] { ClientTransactionEvent.CHANGE, ClientTransactionEvent.CHANGE };
+
+                one(mockDistribution).executeClientAction(with(any(ExecuteClientActionRequest.class)));
+
+                final Version[] versionUpdates = new Version[] { new TestProxyVersion(5), new TestProxyVersion(9) };
+                will(returnValue(new ExecuteClientActionResponse(new ObjectData[] { movieData, directorData },
+                    versionUpdates, new ObjectData[0])));
+            }
+        });
+        // TODO: should look inside the request object and ensure:
+        // with(equalTo(session)),
+        // with(equalTo(changes)),
+        // with(equalTo(types)),
+
+        transactionManager.startTransaction();
+        persistenceSessionProxy.objectChanged(movieAdapter);
+        persistenceSessionProxy.objectChanged(directorAdapter);
+        transactionManager.endTransaction();
+
+        assertEquals(new TestProxyVersion(5), movieAdapter.getVersion());
+        assertEquals(new TestProxyVersion(9), directorAdapter.getVersion());
+    }
+
+    @Test
+    public void testClientSideActionWhereTransientObjectMadePersistent() throws Exception {
+
+        final ObjectAdapter transientObject = system.createTransientTestObject();
+
+        final TestProxyOid previousOid = (TestProxyOid) transientObject.getOid();
+        final DummyObjectData movieData = new DummyObjectData(previousOid, Movie.class.getName(), true, null);
+        final NullData directorData = new DummyNullValue(Person.class.getName());
+        final DummyEncodeableObjectData nameData = new DummyEncodeableObjectData("Star Wars", String.class.getName());
+        movieData.setFieldContent(new Data[] { directorData, nameData });
+
+        mockery.checking(new Expectations() {
+            {
+                // this returns results data with new oid and version
+                final TestProxyOid newOid = new TestProxyOid(123, true);
+                newOid.setupPrevious(previousOid);
+                final DummyReferenceData updateData = new DummyReferenceData(newOid, "type", new TestProxyVersion(456));
+
+                // the server is called with data (movieData) for the object to be persisted
+                one(mockDistribution).executeClientAction(with(any(ExecuteClientActionRequest.class)));
+
+                will(returnValue(new ExecuteClientActionResponse(new ReferenceData[] { updateData }, null,
+                    new ObjectData[0])));
+            }
+
+        });
+        // TODO: should look inside the request object and ensure:
+        // with(equalTo(session)),
+        // with(equalTo(new ReferenceData[] { movieData })),
+        // with(equalTo(new int[] { ClientTransactionEvent.ADD })),
+
+        getAdapterManager().adapterFor(transientObject.getObject());
+
+        // client needs to encode the object's transient aspects
+        mockery.checking(new Expectations() {
+            {
+                one(mockEncoder).encodeMakePersistentGraph(with(equalTo(transientObject)),
+                    with(any(KnownObjectsRequest.class)));
+                will(returnValue(movieData));
+            }
+        });
+
+        transactionManager.startTransaction();
+        persistenceSessionProxy.makePersistent(transientObject);
+        transactionManager.endTransaction();
+    }
+
+    // /////////////////////////////
+    // helpers
+    // /////////////////////////////
+
+    private void ignoreCallsToInitializeMocks() {
+        mockery.checking(new Expectations() {
+            {
+                ignoring(mockDistribution).init();
+            }
+        });
+    }
+
+    private void ignoreCallsToDistribution() {
+        mockery.checking(new Expectations() {
+            {
+                ignoring(mockDistribution);
+            }
+        });
+    }
+
+}
+
+class TestCriteria implements PersistenceQueryData {
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Class getPersistenceQueryClass() {
+        return null;
+    }
+
+    public boolean includeSubclasses() {
+        return false;
+    }
+
+    @Override
+    public String getType() {
+        return null;
+    }
+}

Modified: incubator/isis/trunk/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java (original)
+++ incubator/isis/trunk/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java Wed Nov  3 01:24:18 2010
@@ -17,38 +17,38 @@
  *  under the License.
  */
 
-
 package org.apache.isis.applib.util;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 /**
- * Title buffer is a utility class to help produce titles for objects without having to add lots of guard
- * code. It provides two basic method: one to concatenate a title to the buffer; another to append a title
- * with a joiner string, taking care adding in necessary spaces. The benefits of using this class is that null
- * references are safely ignored (rather than appearing as 'null'), and joiners (a space by default) are only
- * added when needed.
+ * Title buffer is a utility class to help produce titles for objects without having to add lots of guard code. It
+ * provides two basic method: one to concatenate a title to the buffer; another to append a title with a joiner string,
+ * taking care adding in necessary spaces. The benefits of using this class is that null references are safely ignored
+ * (rather than appearing as 'null'), and joiners (a space by default) are only added when needed.
  */
 public class TitleBuffer {
     private static final String SPACE = " ";
 
     /**
-     * Determines if the specified object's title (from its <code>toString</code> method) is empty. Will
-     * return true if either: the specified reference is null; the object's <code>toString</code> method
-     * returns null; or if the <code>toString</code> returns an empty string.
+     * Determines if the specified object's title (from its <code>toString</code> method) is empty. Will return true if
+     * either: the specified reference is null; the object's <code>toString</code> method returns null; or if the
+     * <code>toString</code> returns an empty string.
      */
     public static boolean isEmpty(final Object object) {
         String title = titleFor(object);
-        return title == null ||  title.equals("");
+        return title == null || title.equals("");
     }
 
     /**
-     * Reflectively run the <tt>String title()</tt> method if it exists, else fall back to the <tt>toString()</tt> method.
+     * Reflectively run the <tt>String title()</tt> method if it exists, else fall back to the <tt>toString()</tt>
+     * method.
      */
     private static String titleFor(Object object) {
-        if(object == null) {return null;} 
-        else {
+        if (object == null) {
+            return null;
+        } else {
             Method method;
             try {
                 method = object.getClass().getMethod("title", new Class[0]);
@@ -68,8 +68,8 @@ public class TitleBuffer {
     }
 
     /**
-     * Determines if the specified text is empty. Will return true if either: the specified reference is null;
-     * or if the reference is an empty string.
+     * Determines if the specified text is empty. Will return true if either: the specified reference is null; or if the
+     * reference is an empty string.
      */
     public static boolean isEmpty(final String text) {
         return text == null || text.equals("");
@@ -131,8 +131,8 @@ public class TitleBuffer {
     }
 
     /**
-     * Appends the title of the specified object, or the specified text if the objects title is null or empty.
-     * Prepends a space if there is already some text in this title object.
+     * Appends the title of the specified object, or the specified text if the objects title is null or empty. Prepends
+     * a space if there is already some text in this title object.
      * 
      * @param object
      *            the object whose title is to be appended to this title.
@@ -162,8 +162,8 @@ public class TitleBuffer {
     }
 
     /**
-     * Appends the joining string and the title of the specified object (from its <code>toString</code>
-     * method). If the object is empty then nothing will be appended.
+     * Appends the joining string and the title of the specified object (from its <code>toString</code> method). If the
+     * object is empty then nothing will be appended.
      * 
      * @see #isEmpty(Object)
      */
@@ -176,11 +176,10 @@ public class TitleBuffer {
     }
 
     /**
-     * Append the <code>joiner</code> text, a space, and the title of the specified [[NAME]] (<code>object</code>)
-     * (got by calling the objects title() method) to the text of this TitleString object. If the title of the
-     * specified object is null then use the <code>defaultValue</code> text. If both the objects title and
-     * the default value are null or equate to a zero-length string then no text will be appended ; not even
-     * the joiner text.
+     * Append the <code>joiner</code> text, a space, and the title of the specified ObjectAdapter (<code>object</code>)
+     * (got by calling the objects title() method) to the text of this TitleString object. If the title of the specified
+     * object is null then use the <code>defaultValue</code> text. If both the objects title and the default value are
+     * null or equate to a zero-length string then no text will be appended ; not even the joiner text.
      * 
      * @param joiner
      *            text to append before the title
@@ -201,8 +200,8 @@ public class TitleBuffer {
     }
 
     /**
-     * Appends the joiner text, a space, and the text to the text of this TitleString object. If no text yet
-     * exists in the object then the joiner text and space are omitted.
+     * Appends the joiner text, a space, and the text to the text of this TitleString object. If no text yet exists in
+     * the object then the joiner text and space are omitted.
      * 
      * @return a reference to the called object (itself).
      */
@@ -221,9 +220,8 @@ public class TitleBuffer {
     }
 
     /**
-     * Append a space to the text of this TitleString object if, and only if, there is some existing text
-     * i.e., a space is only added to existing text and will not create a text entry consisting of only one
-     * space.
+     * Append a space to the text of this TitleString object if, and only if, there is some existing text i.e., a space
+     * is only added to existing text and will not create a text entry consisting of only one space.
      * 
      * @return a reference to the called object (itself).
      */
@@ -240,11 +238,11 @@ public class TitleBuffer {
     }
 
     /**
-     * Concatenate the the title value (the result of calling an objects label() method) to this TitleString
-     * object. If the value is null the no text is added.
+     * Concatenate the the title value (the result of calling an objects label() method) to this TitleString object. If
+     * the value is null the no text is added.
      * 
      * @param object
-     *            the [[NAME]] to get a title from
+     *            the ObjectAdapter to get a title from
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final Object object) {
@@ -253,13 +251,13 @@ public class TitleBuffer {
     }
 
     /**
-     * Concatenate the the title value (the result of calling an objects label() method), or the specified
-     * default value if the title is equal to null or is empty, to this TitleString object.
+     * Concatenate the the title value (the result of calling an objects label() method), or the specified default value
+     * if the title is equal to null or is empty, to this TitleString object.
      * 
      * @param object
-     *            the [[NAME]] to get a title from
+     *            the ObjectAdapter to get a title from
      * @param defaultValue
-     *            the default text to use when the [[NAME]] is null
+     *            the default text to use when the ObjectAdapter is null
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final Object object, final String defaultValue) {
@@ -312,8 +310,8 @@ public class TitleBuffer {
     }
 
     /**
-     * Truncates this title so it has a maximum number of words. Spaces are used to determine words, thus two
-     * spaces in a title will cause two words to be mistakenly identified.
+     * Truncates this title so it has a maximum number of words. Spaces are used to determine words, thus two spaces in
+     * a title will cause two words to be mistakenly identified.
      * 
      * @param noWords
      *            the number of words to show
@@ -340,4 +338,3 @@ public class TitleBuffer {
     }
 
 }
-

Modified: incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java (original)
+++ incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java Wed Nov  3 01:24:18 2010
@@ -72,7 +72,7 @@ public abstract class BusinessValueHolde
      * Returns a string representation of this object.
      * <p>
      * The specification of this string representation is not fixed, but, at the time of writing, consists of
-     * <i>title [short[[NAME]]ClassName] </i>
+     * <i>title [short ObjectAdapterClassName] </i>
      * </p>
      * 
      * @return string representation of object.

Modified: incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/RtfValue.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/RtfValue.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/RtfValue.java (original)
+++ incubator/isis/trunk/applib/src/main/src-archived/old-valueholders/RtfValue.java Wed Nov  3 01:24:18 2010
@@ -30,7 +30,7 @@ import org.apache.isis.application.value
  * <h3>Implementation Notes</h3>
  * 
  * This is a little risky, but just using <code>data.getBytes(&quot;UTF-8&quot;)</code>. This perhaps
- * should be replaced with UUDecoding, or (more fundamentally) the [[NAME]]Value interface should change.
+ * should be replaced with UUDecoding, or (more fundamentally) the Value interface should change.
  * <p>
  * But the above *might* do (haven't tested this out yet), because RTF uses either 7-bit or (for MS Word)
  * 8-bit character sets and no more. To quote the RTF 1.5 spec:

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectAdapter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectAdapter.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectAdapter.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectAdapter.java Wed Nov  3 01:24:18 2010
@@ -17,16 +17,14 @@
  *  under the License.
  */
 
-
 package org.apache.isis.metamodel.adapter;
 
 import org.apache.isis.metamodel.adapter.oid.Oid;
 import org.apache.isis.metamodel.adapter.version.Version;
 
-
 /**
- * [[NAME]] are adapters to domain objects, where the application is written in terms of domain objects
- * and those objects are represented within the NOF through these adapter, and not directly.
+ * Adapters to domain objects, where the application is written in terms of domain objects and those objects are
+ * represented within the NOF through these adapter, and not directly.
  * 
  * @see ObjectMetaModel
  */
@@ -56,8 +54,7 @@ public interface ObjectAdapter extends O
     void checkLock(Version version);
 
     /**
-     * The objects unique id. This id allows the object to added to, stored by, and retrieved from the object
-     * store.
+     * The objects unique id. This id allows the object to added to, stored by, and retrieved from the object store.
      */
     Oid getOid();
 
@@ -80,11 +77,8 @@ public interface ObjectAdapter extends O
 
     void fireChangedEvent();
 
-    
-
     /**
-     * Whether this instance belongs to another object (meaning its {@link #getOid()} will
-     * be <tt>AggregatedOid</tt>.
+     * Whether this instance belongs to another object (meaning its {@link #getOid()} will be <tt>AggregatedOid</tt>.
      */
     boolean isAggregated();
 

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectMetaModel.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectMetaModel.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectMetaModel.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/ObjectMetaModel.java Wed Nov  3 01:24:18 2010
@@ -17,115 +17,104 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.adapter;
 
-package org.apache.isis.metamodel.adapter;
-
-import org.apache.isis.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.metamodel.spec.ObjectSpecification;
-import org.apache.isis.metamodel.spec.Specification;
-
-/**
- * [[NAME]] are adapters to domain objects, where the application is written in terms of domain objects
- * and those objects are represented within the NOF through these adapter, and not directly.
- * 
- * <p>
- * This interface defines just those aspects of the adapter that are of interest to the
- * meta-model (hence the 'MM' suffix), while the {@link ObjectAdapter} subtype defines additional properties
- * used by the framework (<tt>PersistenceSession</tt>s et al) for tracking the persistence state
- * of the object.  In theory it ought to be possible to move {@link ObjectAdapter} interface out of
- * the metamodel module.  However, this would require either lots of genericizing or lots of downcasting
- * to ensure that the framework is only ever handed or deals with the {@link ObjectAdapter}s.
- * 
- * @see ObjectAdapter
- */
-public interface ObjectMetaModel extends Instance {
-
-
-	/**
-	 * Refines {@link Instance#getSpecification()}.
-	 */
-	ObjectSpecification getSpecification();
-
-
-    /**
-     * Returns the adapted domain object, the POJO, that this adapter represents with the NOF.
-     */
-    Object getObject();
-
-	
-    /**
-     * Returns the title to display this object with, which is usually got from the wrapped
-     * {@link #getObject() domain object}.
-     */
-    String titleString();
-
-    /**
-     * Return an {@link Instance} of the specified {@link Specification} with respect
-     * to this {@link ObjectAdapter}.
-     * 
-     * <p>
-     * If called with {@link ObjectSpecification}, then just returns <tt>this</tt>). 
-     * If called for other subinterfaces, then should provide an appropriate
-     * {@link Instance} implementation.
-     * 
-     * <p>
-     * Designed to be called in a double-dispatch design from {@link Specification#getInstance(ObjectAdapter)}.
-     * 
-     * <p>
-     * Note: this method will throw an {@link UnsupportedOperationException} unless the
-     * extended <tt>PojoAdapterXFactory</tt> is configured.  (That is, only
-     * <tt>PojoAdapterX</tt> provides support for this; the regular <tt>PojoAdapter</tt>
-     * does not currently.
-     *   
-     * @param adapter
-     * @return
-     */
-    Instance getInstance(Specification specification);
-
-
-    /**
-     * Whether the object is persisted.
-     * 
-     * <p>
-     * Note: not necessarily the reciprocal of {@link #isTransient()};
-     * standalone adapters (with {@link ResolveState#VALUE}) report as neither persistent or transient. 
-     */
-    boolean isPersistent();
-    
-    /**
-     * Whether the object is transient.
-     * 
-     * <p>
-     * Note: not necessarily the reciprocal of {@link #isPersistent()};
-     * standalone adapters (with {@link ResolveState#VALUE}) report as neither persistent or transient. 
-     */
-    boolean isTransient();
-    
-
-    /**
-     * Sometimes it is necessary to manage the replacement of the underlying domain object (by another
-     * component such as an object store). This method allows the adapter to be kept while the domain object
-     * is replaced.
-     */
-    void replacePojo(Object pojo);
-
-
-    /**
-     * Gets the type of facet for this object, defaulting to the facet held by the underlying specification.
-     * This is needed by collections that can have an element type but is not held by the collection, such as
-     * generic collections that lose the type information through type erasure.
-     * 
-     * REVIEW should this and the {@link #setTypeOfFacet(TypeOfFacet)} be more generic allowing other facets
-     * to be added to adapters.
-     */
-    TypeOfFacet getTypeOfFacet();
-
-    /**
-     * Sets the element type facet, typically by copying it from the method or association information.
-     * 
-     * @see #getTypeOfFacet()
-     */
-    void setTypeOfFacet(TypeOfFacet typeOfFacet);
-
-
-}
+import org.apache.isis.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.metamodel.spec.ObjectSpecification;
+import org.apache.isis.metamodel.spec.Specification;
+
+/**
+ * Adapters to domain objects, where the application is written in terms of domain objects and those objects are
+ * represented within the NOF through these adapter, and not directly.
+ * 
+ * <p>
+ * This interface defines just those aspects of the adapter that are of interest to the meta-model (hence the 'MM'
+ * suffix), while the {@link ObjectAdapter} subtype defines additional properties used by the framework (
+ * <tt>PersistenceSession</tt>s et al) for tracking the persistence state of the object. In theory it ought to be
+ * possible to move {@link ObjectAdapter} interface out of the metamodel module. However, this would require either lots
+ * of genericizing or lots of downcasting to ensure that the framework is only ever handed or deals with the
+ * {@link ObjectAdapter}s.
+ * 
+ * @see ObjectAdapter
+ */
+public interface ObjectMetaModel extends Instance {
+
+    /**
+     * Refines {@link Instance#getSpecification()}.
+     */
+    @Override
+    ObjectSpecification getSpecification();
+
+    /**
+     * Returns the adapted domain object, the POJO, that this adapter represents with the NOF.
+     */
+    Object getObject();
+
+    /**
+     * Returns the title to display this object with, which is usually got from the wrapped {@link #getObject() domain
+     * object}.
+     */
+    String titleString();
+
+    /**
+     * Return an {@link Instance} of the specified {@link Specification} with respect to this {@link ObjectAdapter}.
+     * 
+     * <p>
+     * If called with {@link ObjectSpecification}, then just returns <tt>this</tt>). If called for other subinterfaces,
+     * then should provide an appropriate {@link Instance} implementation.
+     * 
+     * <p>
+     * Designed to be called in a double-dispatch design from {@link Specification#getInstance(ObjectAdapter)}.
+     * 
+     * <p>
+     * Note: this method will throw an {@link UnsupportedOperationException} unless the extended
+     * <tt>PojoAdapterXFactory</tt> is configured. (That is, only <tt>PojoAdapterX</tt> provides support for this; the
+     * regular <tt>PojoAdapter</tt> does not currently.
+     * 
+     * @param adapter
+     * @return
+     */
+    Instance getInstance(Specification specification);
+
+    /**
+     * Whether the object is persisted.
+     * 
+     * <p>
+     * Note: not necessarily the reciprocal of {@link #isTransient()}; standalone adapters (with
+     * {@link ResolveState#VALUE}) report as neither persistent or transient.
+     */
+    boolean isPersistent();
+
+    /**
+     * Whether the object is transient.
+     * 
+     * <p>
+     * Note: not necessarily the reciprocal of {@link #isPersistent()}; standalone adapters (with
+     * {@link ResolveState#VALUE}) report as neither persistent or transient.
+     */
+    boolean isTransient();
+
+    /**
+     * Sometimes it is necessary to manage the replacement of the underlying domain object (by another component such as
+     * an object store). This method allows the adapter to be kept while the domain object is replaced.
+     */
+    void replacePojo(Object pojo);
+
+    /**
+     * Gets the type of facet for this object, defaulting to the facet held by the underlying specification. This is
+     * needed by collections that can have an element type but is not held by the collection, such as generic
+     * collections that lose the type information through type erasure.
+     * 
+     * REVIEW should this and the {@link #setTypeOfFacet(TypeOfFacet)} be more generic allowing other facets to be added
+     * to adapters.
+     */
+    TypeOfFacet getTypeOfFacet();
+
+    /**
+     * Sets the element type facet, typically by copying it from the method or association information.
+     * 
+     * @see #getTypeOfFacet()
+     */
+    void setTypeOfFacet(TypeOfFacet typeOfFacet);
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/exceptions/ModelException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/exceptions/ModelException.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/exceptions/ModelException.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/exceptions/ModelException.java Wed Nov  3 01:24:18 2010
@@ -17,13 +17,12 @@
  *  under the License.
  */
 
-
 package org.apache.isis.metamodel.exceptions;
 
 import org.apache.isis.commons.exceptions.IsisException;
 
 /**
- * Thrown when a problem is found with the domain model, and [[NAME]] cannot proceed.
+ * Thrown when a problem is found with the domain model, and Isis cannot proceed.
  */
 public class ModelException extends IsisException {
     private static final long serialVersionUID = 1L;

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actcoll/typeof/TypeOfFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actcoll/typeof/TypeOfFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actcoll/typeof/TypeOfFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actcoll/typeof/TypeOfFacet.java Wed Nov  3 01:24:18 2010
@@ -17,18 +17,16 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actcoll.typeof;
 
-package org.apache.isis.metamodel.facets.actcoll.typeof;
-
-import org.apache.isis.metamodel.facets.SingleClassValueFacet;
-
-
-/**
- * The type of the collection or the action.
- * 
- * <p>
- * In the standard [[NAME]] 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 {
-}
+import org.apache.isis.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 {
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionChoicesFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionChoicesFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionChoicesFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionChoicesFacet.java Wed Nov  3 01:24:18 2010
@@ -17,21 +17,19 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.choices;
 
-package org.apache.isis.metamodel.facets.actions.choices;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Obtain choices for each of the parameters of the action.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the <tt>choicesXxx</tt> support
- * method for an action.
- */
-public interface ActionChoicesFacet extends Facet {
-
-    public Object[][] getChoices(ObjectAdapter inObject);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.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);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionParameterChoicesFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionParameterChoicesFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionParameterChoicesFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/choices/ActionParameterChoicesFacet.java Wed Nov  3 01:24:18 2010
@@ -17,22 +17,19 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.choices;
 
-package org.apache.isis.metamodel.facets.actions.choices;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Obtain choices for each of the parameters of the action.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the <tt>choicesNXxx</tt> support
- * method for an action (where N is the 0-based parameter number).
- */
-public interface ActionParameterChoicesFacet extends Facet {
-
-    public Object[] getChoices(ObjectAdapter inObject);
-}
-
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Obtain choices for each of the parameters of the action.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the <tt>choicesNXxx</tt> support method for an
+ * action (where N is the 0-based parameter number).
+ */
+public interface ActionParameterChoicesFacet extends Facet {
+
+    public Object[] getChoices(ObjectAdapter inObject);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/debug/DebugFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/debug/DebugFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/debug/DebugFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/debug/DebugFacet.java Wed Nov  3 01:24:18 2010
@@ -17,19 +17,16 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.debug;
 
-package org.apache.isis.metamodel.facets.actions.debug;
-
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Indicates that the action should only be available in a special <i>debug</i> mode.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to annotating the action method using
- * <tt>@Debug</tt>.
- */
-public interface DebugFacet extends Facet {
-
-}
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Indicates that the action should only be available in a special <i>debug</i> mode.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the action method using <tt>@Debug</tt>.
+ */
+public interface DebugFacet extends Facet {
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionDefaultsFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionDefaultsFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionDefaultsFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionDefaultsFacet.java Wed Nov  3 01:24:18 2010
@@ -17,21 +17,19 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.defaults;
 
-package org.apache.isis.metamodel.facets.actions.defaults;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Obtain defaults for each of the parameters of the action.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the <tt>defaultsXxx(...)</tt>
- * support method for an action.
- */
-public interface ActionDefaultsFacet extends Facet {
-
-    public abstract Object[] getDefaults(ObjectAdapter inObject);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Obtain defaults for each of the parameters of the action.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the <tt>defaultsXxx(...)</tt> support method
+ * for an action.
+ */
+public interface ActionDefaultsFacet extends Facet {
+
+    public abstract Object[] getDefaults(ObjectAdapter inObject);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionParameterDefaultsFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionParameterDefaultsFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionParameterDefaultsFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/defaults/ActionParameterDefaultsFacet.java Wed Nov  3 01:24:18 2010
@@ -17,21 +17,19 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.defaults;
 
-package org.apache.isis.metamodel.facets.actions.defaults;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Obtain defaults for each of the parameters of the action.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the <tt>defaultsNXxx(...)</tt>
- * support method for an action (where N is the 0-based parameter number).
- */
-public interface ActionParameterDefaultsFacet extends Facet {
-
-    public abstract Object getDefault(ObjectAdapter inObject);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Obtain defaults for each of the parameters of the action.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the <tt>defaultsNXxx(...)</tt> support method
+ * for an action (where N is the 0-based parameter number).
+ */
+public interface ActionParameterDefaultsFacet extends Facet {
+
+    public abstract Object getDefault(ObjectAdapter inObject);
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/executed/ExecutedFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/executed/ExecutedFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/executed/ExecutedFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/executed/ExecutedFacet.java Wed Nov  3 01:24:18 2010
@@ -17,37 +17,34 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.executed;
 
-package org.apache.isis.metamodel.facets.actions.executed;
-
-import org.apache.isis.metamodel.facets.EnumerationAbstract;
-import org.apache.isis.metamodel.facets.Facet;
-import org.apache.isis.metamodel.spec.Target;
-
-
-/**
- * Whether the action should be invoked locally, remotely, or on the default location depending on its
- * persistence state.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to annotating the action method using
- * <tt>@Executed</tt>.
- */
-public interface ExecutedFacet extends Facet {
-
-    public static final class Where extends EnumerationAbstract {
-
-        public static Where DEFAULT = new Where(0, "DEFAULT", "Default");
-        public static Where LOCALLY = new Where(1, "LOCAL", "Locally");
-        public static Where REMOTELY = new Where(2, "REMOTE", "Remotely");
-
-        private Where(final int num, final String nameInCode, final String friendlyName) {
-            super(num, nameInCode, friendlyName);
-        }
-
-    }
-
-    public Where value();
-
-    public Target getTarget();
-}
+import org.apache.isis.metamodel.facets.EnumerationAbstract;
+import org.apache.isis.metamodel.facets.Facet;
+import org.apache.isis.metamodel.spec.Target;
+
+/**
+ * Whether the action should be invoked locally, remotely, or on the default location depending on its persistence
+ * state.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the action method using <tt>@Executed</tt>.
+ */
+public interface ExecutedFacet extends Facet {
+
+    public static final class Where extends EnumerationAbstract {
+
+        public static Where DEFAULT = new Where(0, "DEFAULT", "Default");
+        public static Where LOCALLY = new Where(1, "LOCAL", "Locally");
+        public static Where REMOTELY = new Where(2, "REMOTE", "Remotely");
+
+        private Where(final int num, final String nameInCode, final String friendlyName) {
+            super(num, nameInCode, friendlyName);
+        }
+
+    }
+
+    public Where value();
+
+    public Target getTarget();
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/exploration/ExplorationFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/exploration/ExplorationFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/exploration/ExplorationFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/exploration/ExplorationFacet.java Wed Nov  3 01:24:18 2010
@@ -17,19 +17,17 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.exploration;
 
-package org.apache.isis.metamodel.facets.actions.exploration;
-
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Indicates that the action should only be available in a special <i>exploration</i> mode.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to annotating the action method using
- * <tt>@Exploration</tt>.
- */
-public interface ExplorationFacet extends Facet {
-
-}
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Indicates that the action should only be available in a special <i>exploration</i> mode.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the action method using
+ * <tt>@Exploration</tt>.
+ */
+public interface ExplorationFacet extends Facet {
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/invoke/ActionInvocationFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/invoke/ActionInvocationFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/invoke/ActionInvocationFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/invoke/ActionInvocationFacet.java Wed Nov  3 01:24:18 2010
@@ -17,19 +17,17 @@
  *  under the License.
  */
 
-
 package org.apache.isis.metamodel.facets.actions.invoke;
 
 import org.apache.isis.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.metamodel.facets.Facet;
 import org.apache.isis.metamodel.spec.ObjectSpecification;
 
-
 /**
  * Represents the mechanism by which the action should be invoked.
  * 
  * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the actual action method itself (a
+ * In the standard Apache Isis Programming Model, corresponds to invoking the actual action method itself (a
  * <tt>public</tt> method that does not represent a property, a collection or any of the supporting methods).
  */
 public interface ActionInvocationFacet extends Facet {
@@ -41,4 +39,3 @@ public interface ActionInvocationFacet e
     public ObjectSpecification getOnType();
 
 }
-

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/prototype/PrototypeFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/prototype/PrototypeFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/prototype/PrototypeFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/actions/prototype/PrototypeFacet.java Wed Nov  3 01:24:18 2010
@@ -17,19 +17,16 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.actions.prototype;
 
-package org.apache.isis.metamodel.facets.actions.prototype;
-
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Indicates that the action should only be available in a special <i>prototype</i> mode.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to annotating the action method using
- * <tt>@Prototype</tt>.
- */
-public interface PrototypeFacet extends Facet {
-
-}
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Indicates that the action should only be available in a special <i>prototype</i> mode.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the action method using <tt>@Prototype</tt>.
+ */
+public interface PrototypeFacet extends Facet {
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionAddToFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionAddToFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionAddToFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionAddToFacet.java Wed Nov  3 01:24:18 2010
@@ -17,22 +17,20 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.collections.modify;
 
-package org.apache.isis.metamodel.facets.collections.modify;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Add object to a collection.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the <tt>addToXxx</tt> support
- * method for a collection.
- */
-public interface CollectionAddToFacet extends Facet {
-
-    public void add(ObjectAdapter inObject, ObjectAdapter value);
-
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Add object to a collection.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the <tt>addToXxx</tt> support method for a
+ * collection.
+ */
+public interface CollectionAddToFacet extends Facet {
+
+    public void add(ObjectAdapter inObject, ObjectAdapter value);
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionClearFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionClearFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionClearFacet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/collections/modify/CollectionClearFacet.java Wed Nov  3 01:24:18 2010
@@ -17,21 +17,19 @@
  *  under the License.
  */
 
+package org.apache.isis.metamodel.facets.collections.modify;
 
-package org.apache.isis.metamodel.facets.collections.modify;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-
-
-/**
- * Clear all objects from a collection.
- * 
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to either invoking the <tt>clearXxx</tt>
- * support method, or just invoking <tt>clear</tt> on the collection returned by the accessor method.
- */
-public interface CollectionClearFacet extends Facet {
-
-    public void clear(ObjectAdapter inObject);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+
+/**
+ * Clear all objects from a collection.
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to either invoking the <tt>clearXxx</tt> support method,
+ * or just invoking <tt>clear</tt> on the collection returned by the accessor method.
+ */
+public interface CollectionClearFacet extends Facet {
+
+    public void clear(ObjectAdapter inObject);
+}