incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1338472 [4/8] - in /incubator/isis/trunk/framework/runtimes/dflt: objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/ objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/internal/ ob...
Date Mon, 14 May 2012 22:45:03 GMT
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java Mon May 14 22:44:57 2012
@@ -29,7 +29,7 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 
 public class SqlPersistorInstaller extends ObjectStorePersistenceMechanismInstallerAbstract {
@@ -74,11 +74,11 @@ public class SqlPersistorInstaller exten
     }
 
     @Override
-    protected OidGenerator createOidGenerator(final IsisConfiguration configuration) {
+    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
         final DatabaseConnectorFactory connectorFactory = new JdbcConnectorFactory();
         connectionPool = new DatabaseConnectorPool(connectorFactory, 1);
 
-        return new SqlOidGenerator(connectionPool);
+        return new SqlIdentifierGenerator(connectionPool);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java Mon May 14 22:44:57 2012
@@ -43,6 +43,8 @@ import org.apache.isis.runtimes.dflt.obj
 import org.apache.isis.runtimes.dflt.objectstores.sql.mapping.FieldMapping;
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
+
 import org.apache.log4j.Logger;
 
 import com.google.common.collect.Maps;
@@ -296,15 +298,14 @@ public abstract class AbstractAutoMapper
     }
 
     protected ObjectAdapter getAdapter(final ObjectSpecification specification, final Oid oid) {
-        final AdapterManager objectLoader = IsisContext.getPersistenceSession().getAdapterManager();
+        final AdapterManager objectLoader = getPersistenceSession().getAdapterManager();
         final ObjectAdapter adapter = objectLoader.getAdapterFor(oid);
         if (adapter != null) {
             return adapter;
-        } else {
-            return IsisContext.getPersistenceSession().recreateAdapter(oid, specification);
         }
+        return getPersistenceSession().recreateAdapter(specification, oid);
     }
-
+    
     protected FieldMapping fieldMappingFor(final ObjectAssociation field) {
         return fieldMappingByField.get(field);
     }
@@ -348,5 +349,10 @@ public abstract class AbstractAutoMapper
 		return IsisContext.getConfiguration();
 	}
 
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+
 
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java Mon May 14 22:44:57 2012
@@ -30,6 +30,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.ResolveState;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.adapter.util.InvokeUtils;
 import org.apache.isis.core.metamodel.adapter.version.SerialNumberVersion;
 import org.apache.isis.core.metamodel.facets.notpersisted.NotPersistedFacet;
@@ -260,15 +261,16 @@ public class AutoMapper extends Abstract
     }
 
     @Override
-    public ObjectAdapter getObject(final DatabaseConnector connector, final Oid oid, final ObjectSpecification hint) {
+    public ObjectAdapter getObject(final DatabaseConnector connector, final TypedOid typedOid) {
         final StringBuffer sql = createSelectStatement();
         sql.append(" WHERE ");
-        idMapping.appendWhereClause(connector, sql, (RootOid) oid);
+        idMapping.appendWhereClause(connector, sql, (RootOid) typedOid);
         final Results rs = connector.select(completeSelectStatement(sql));
+        final ObjectSpecification objectSpec = getSpecificationLoader().lookupBySpecId(typedOid.getObjectSpecId());
         if (rs.next()) {
-            return loadObject(connector, hint, rs);
+            return loadObject(connector, objectSpec, rs);
         } else {
-            throw new ObjectNotFoundException("No object with with " + oid + " in table " + table);
+            throw new ObjectNotFoundException("No object with with " + typedOid + " in table " + table);
         }
     }
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/PolymorphicForeignKeyInChildCollectionBaseMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/PolymorphicForeignKeyInChildCollectionBaseMapper.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/PolymorphicForeignKeyInChildCollectionBaseMapper.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/PolymorphicForeignKeyInChildCollectionBaseMapper.java Mon May 14 22:44:57 2012
@@ -31,6 +31,7 @@ import org.apache.log4j.Logger;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
@@ -158,9 +159,13 @@ public class PolymorphicForeignKeyInChil
             update.append(") VALUES (");
 
             // Row ID column
-            final RootOid transientOid = oidGenerator.createTransientOid(thisAdapter.getObject());
-            oidGenerator.asPersistent(transientOid);
-            polyIdMapper.appendObjectId(connector, update, transientOid);
+            final Object pojo = thisAdapter.getObject();
+            final RootOid transientRootOid = oidGenerator.createTransientOid(pojo);
+            
+            final RootOid persistentRootOid = oidGenerator.createPersistent(pojo, transientRootOid);
+            
+            polyIdMapper.appendObjectId(connector, update, persistentRootOid);
+            
             // polyIdMapper.appendObjectId(connector, update,
             // thisAdapter.getOid());
             update.append(",");
@@ -215,8 +220,8 @@ public class PolymorphicForeignKeyInChil
 
             // Load new recordSet for the actual class
             final ObjectMapping itemMapper = objectMappingLookup.getMapping(itemSpecification, connector);
-            final Oid oid = idMapping.recreateOid(rs, itemSpecification);
-            final ObjectAdapter loadedObject = itemMapper.getObject(connector, oid, itemSpecification);
+            final TypedOid oid = idMapping.recreateOid(rs, itemSpecification);
+            final ObjectAdapter loadedObject = itemMapper.getObject(connector, oid);
 
             LOG.debug("  element  " + loadedObject.getOid());
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java Mon May 14 22:44:57 2012
@@ -32,6 +32,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 
+import org.apache.isis.core.testsupport.files.Files;
 import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
 import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures.State;
@@ -102,25 +103,6 @@ public abstract class SqlIntegrationTest
     }
 
     
-    /**
-     * Helper, eg to be called within {@link #resetPersistenceStoreDirectlyIfRequired()}.
-     */
-    protected static void deleteFiles(final String directory, final FilenameFilter extension) {
-        final File dir = new File(directory);
-
-        final String[] list = dir.list(extension);
-        File file;
-        if (list.length == 0) {
-            return;
-        }
-
-        for (final String element : list) {
-            file = new File(directory, element);
-            file.delete();
-        }
-    }
-
-
     
     ////////////////////////////////////////////////////////////////////////////////
     // before, after

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java Mon May 14 22:44:57 2012
@@ -25,21 +25,15 @@ package org.apache.isis.runtimes.dflt.ob
 import java.io.File;
 import java.io.FilenameFilter;
 
+import org.apache.isis.core.testsupport.files.Files;
+import org.apache.isis.core.testsupport.files.Files.Recursion;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
 
 public class HsqlTest extends SqlIntegrationTestData {
 
     @Override
     public void resetPersistenceStoreDirectlyIfRequired() {
-        
-        // Delete all HSQL Database files.
-        deleteFiles("hsql-db", new FilenameFilter() {
-
-            @Override
-            public boolean accept(final File arg0, final String arg1) {
-                return arg1.endsWith(".xml");
-            }
-        });
+        Files.deleteFiles("hsql-db", ".xml", Recursion.DONT_RECURSE);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java Mon May 14 22:44:57 2012
@@ -28,6 +28,8 @@ import java.util.List;
 
 import org.junit.Test;
 
+import org.apache.isis.core.testsupport.files.Files;
+import org.apache.isis.core.testsupport.files.Files.Recursion;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestCommonBase;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures.State;
@@ -61,15 +63,7 @@ public class PolymorphismTest extends Sq
 
     @Override
     public void resetPersistenceStoreDirectlyIfRequired() {
-        
-        // Delete all HSQL Database files.
-        deleteFiles("hsql-db", new FilenameFilter() {
-
-            @Override
-            public boolean accept(final File arg0, final String arg1) {
-                return arg1.endsWith(".xml");
-            }
-        });
+        Files.deleteFiles("hsql-db", ".xml", Recursion.DONT_RECURSE);
     }
 
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java Mon May 14 22:44:57 2012
@@ -22,10 +22,10 @@
  */
 package org.apache.isis.runtimes.dflt.objectstores.sql.crosscheck;
 
-import java.io.File;
-import java.io.FilenameFilter;
 import java.util.Properties;
 
+import org.apache.isis.core.testsupport.files.Files;
+import org.apache.isis.core.testsupport.files.Files.Recursion;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
 
 public class XmlPersistenceTest extends SqlIntegrationTestData {
@@ -33,14 +33,7 @@ public class XmlPersistenceTest extends 
 
     @Override
     public void resetPersistenceStoreDirectlyIfRequired() {
-        // Delete all XML files.
-        deleteFiles("xml/objects", new FilenameFilter() {
-
-            @Override
-            public boolean accept(final File arg0, final String arg1) {
-                return arg1.endsWith(".xml");
-            }
-        });
+        Files.deleteFiles("xml/objects", ".xml", Recursion.DONT_RECURSE);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java Mon May 14 22:44:57 2012
@@ -32,9 +32,9 @@ import org.apache.isis.core.commons.exce
 import org.apache.isis.core.commons.xml.XmlFile;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
 import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
@@ -127,7 +127,7 @@ public class XmlObjectStore implements O
     @Override
     public boolean hasInstances(final ObjectSpecification cls) {
         LOG.debug("checking instance of " + cls);
-        final ObjectData data = new ObjectData(null, null);
+        final ObjectData data = new ObjectData(RootOidDefault.create(cls.getSpecId(), "---dummy-value-never-used---"), null);
         return dataManager.numberOfInstances(data) > 0;
     }
 
@@ -186,7 +186,7 @@ public class XmlObjectStore implements O
         final Data fieldData = dataManager.loadData(referenceOid);
 
         if (fieldData == null) {
-            final ObjectAdapter adapter = getPersistenceSession().recreateAdapter(referenceOid, field.getSpecification());
+            final ObjectAdapter adapter = getPersistenceSession().recreateAdapter(field.getSpecification(), referenceOid);
             if (!adapter.getResolveState().isDestroyed()) {
                 adapter.changeState(ResolveState.DESTROYED);
             }
@@ -194,7 +194,7 @@ public class XmlObjectStore implements O
 
             LOG.warn("No data found for " + referenceOid + " so field '" + field.getName() + "' not set in object '" + object.titleString() + "'");
         } else {
-            final ObjectAdapter reference = getPersistenceSession().recreateAdapter(referenceOid, specFor(fieldData));
+            final ObjectAdapter reference = getPersistenceSession().recreateAdapter(specFor(fieldData), referenceOid);
             ((OneToOneAssociation) field).initAssociation(object, reference);
         }
 
@@ -236,7 +236,7 @@ public class XmlObjectStore implements O
                 ObjectAdapter adapter;
                 adapter = getAdapterManager().getAdapterFor(elementOid);
                 if (adapter == null) {
-                    adapter = getObject(elementOid, null);
+                    adapter = getObject(elementOid);
                 }
                 elements[j] = adapter;
             }
@@ -301,8 +301,9 @@ public class XmlObjectStore implements O
     // getObject, resolveImmediately, resolveField
     // /////////////////////////////////////////////////////////
 
+
     @Override
-    public ObjectAdapter getObject(final Oid oid, final ObjectSpecification hint) {
+    public ObjectAdapter getObject(final TypedOid oid) {
         LOG.debug("getObject " + oid);
         final Data data = dataManager.loadData((RootOidDefault) oid);
         LOG.debug("  data read " + data);
@@ -339,7 +340,7 @@ public class XmlObjectStore implements O
     private ObjectAdapter recreateObject(final ObjectData data) {
         final RootOid oid = data.getRootOid();
         final ObjectSpecification spec = specFor(data);
-        final ObjectAdapter object = getPersistenceSession().recreateAdapter(oid, spec);
+        final ObjectAdapter object = getPersistenceSession().recreateAdapter(spec, oid);
         initObject(object, data);
         return object;
     }
@@ -358,7 +359,7 @@ public class XmlObjectStore implements O
 
         final ObjectSpecification objSpec = builtIn.getSpecification();
         LOG.debug("getInstances of " + objSpec + " where " + builtIn);
-        final RootOid oid = RootOidDefault.create(objSpec.getObjectType(), "dummy");
+        final RootOid oid = RootOidDefault.create(objSpec.getSpecId(), "dummy");
         final ObjectData patternData = new ObjectData(oid, null);
         final ObjectAdapter[] instances = getInstances(patternData, builtIn);
         return instances;
@@ -376,7 +377,7 @@ public class XmlObjectStore implements O
             final RootOid oid = instanceData.getRootOid();
 
             final ObjectSpecification spec = specFor(instanceData);
-            final ObjectAdapter instance = getPersistenceSession().recreateAdapter(oid, spec);
+            final ObjectAdapter instance = getPersistenceSession().recreateAdapter(spec, oid);
             LOG.debug("recreated instance " + instance);
             initObject(instance, instanceData);
 
@@ -391,7 +392,7 @@ public class XmlObjectStore implements O
     }
 
     private ObjectSpecification specFor(final Data data) {
-        return getSpecificationLoader().lookupByObjectType(data.getObjectType());
+        return getSpecificationLookup().lookupBySpecId(data.getObjectSpecId());
     }
 
     // /////////////////////////////////////////////////////////
@@ -400,7 +401,7 @@ public class XmlObjectStore implements O
 
     @Override
     public RootOid getOidForService(ObjectSpecification serviceSpec) {
-        return serviceManager.getOidForService(serviceSpec.getObjectType());
+        return serviceManager.getOidForService(serviceSpec.getSpecId());
     }
 
     @Override
@@ -439,7 +440,7 @@ public class XmlObjectStore implements O
     // Dependencies (from singleton)
     // /////////////////////////////////////////////////////////
 
-    protected SpecificationLoader getSpecificationLoader() {
+    protected SpecificationLoader getSpecificationLookup() {
         return IsisContext.getSpecificationLoader();
     }
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java Mon May 14 22:44:57 2012
@@ -19,15 +19,17 @@
 
 package org.apache.isis.runtimes.dflt.objectstores.xml;
 
+import java.util.Date;
+
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.clock.DefaultClock;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.ObjectStorePersistenceMechanismInstallerAbstract;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStore;
-import org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.serial.RootOidGeneratorSeededOnCurrentTime;
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGeneratorDefault;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 
 public class XmlPersistenceMechanismInstaller extends ObjectStorePersistenceMechanismInstallerAbstract {
@@ -50,8 +52,9 @@ public class XmlPersistenceMechanismInst
     }
 
     @Override
-    protected OidGenerator createOidGenerator(final IsisConfiguration configuration) {
-        return new RootOidGeneratorSeededOnCurrentTime();
+    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
+        final long currentTime = new Date().getTime();
+        return new IdentifierGeneratorDefault(currentTime);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/CollectionData.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/CollectionData.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/CollectionData.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/CollectionData.java Mon May 14 22:44:57 2012
@@ -46,6 +46,6 @@ public class CollectionData extends Data
 
     @Override
     public String toString() {
-        return "CollectionData[type=" + getObjectType() + ",elements=" + elements + "]";
+        return "CollectionData[type=" + getObjectSpecId() + ",elements=" + elements + "]";
     }
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/Data.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/Data.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/Data.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/Data.java Mon May 14 22:44:57 2012
@@ -22,6 +22,7 @@ package org.apache.isis.runtimes.dflt.ob
 import com.google.common.base.Objects;
 
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLookup;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion;
@@ -45,12 +46,12 @@ public abstract class Data {
     }
 
     public ObjectSpecification getSpecification(SpecificationLookup specificationLookup) {
-        final String objectType = oid.getObjectType();
-        return specificationLookup.lookupByObjectType(objectType);
+        final ObjectSpecId objectSpecId = oid.getObjectSpecId();
+        return specificationLookup.lookupBySpecId(objectSpecId);
     }
 
-    public String getObjectType() {
-        return getRootOid().getObjectType();
+    public ObjectSpecId getObjectSpecId() {
+        return getRootOid().getObjectSpecId();
     }
 
     @Override
@@ -61,7 +62,7 @@ public abstract class Data {
 
         if (obj instanceof Data) {
             final Data data = (Data) obj;
-            return Objects.equal(data.getObjectType(), getObjectType()) && Objects.equal(data.oid, oid);
+            return Objects.equal(data.getObjectSpecId(), getObjectSpecId()) && Objects.equal(data.oid, oid);
         }
 
         return false;
@@ -70,7 +71,7 @@ public abstract class Data {
     @Override
     public int hashCode() {
         int h = 17;
-        h = 37 * h + getObjectType().hashCode();
+        h = 37 * h + getObjectSpecId().hashCode();
         h = 37 * h + oid.hashCode();
         return h;
     }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectData.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectData.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectData.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectData.java Mon May 14 22:44:57 2012
@@ -151,7 +151,7 @@ public class ObjectData extends Data {
 
     @Override
     public String toString() {
-        return "ObjectData[type=" + getObjectType() + ",oid=" + getRootOid() + ",fields=" + fieldById + "]";
+        return "ObjectData[type=" + getObjectSpecId() + ",oid=" + getRootOid() + ",fields=" + fieldById + "]";
     }
 
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManager.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManager.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManager.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManager.java Mon May 14 22:44:57 2012
@@ -33,6 +33,7 @@ import org.apache.isis.core.commons.ensu
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.commons.xml.ContentWriter;
 import org.apache.isis.core.commons.xml.XmlFile;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -131,9 +132,8 @@ public class XmlDataManager implements D
     }
 
     private static RootOidDefault oidFrom(final Attributes attributes) {
-        final String objectType = attributes.getValue("type");
-        final String identifier = attributes.getValue("id");
-        return RootOidDefault.create(objectType, identifier);
+        final String oid = attributes.getValue("oid");
+        return RootOidDefault.deString(oid);
     }
 
     private static FileVersion fileVersionFrom(final Attributes attributes) {
@@ -155,9 +155,8 @@ public class XmlDataManager implements D
         public void startElement(final String ns, final String name, final String tagName, final Attributes attrs) throws SAXException {
             if (tagName.equals("instance")) {
                 
-                final String objectType = attrs.getValue("type");
-                final String identifier = attrs.getValue("id");
-                final RootOidDefault oid = RootOidDefault.create(objectType, identifier);
+                final String oidStr = attrs.getValue("oid");
+                final RootOidDefault oid = RootOidDefault.deString(oidStr);
                 
                 instances.addElement(oid);
             }
@@ -399,8 +398,7 @@ public class XmlDataManager implements D
 
                 for (final RootOid elementAt : instances) {
                     writer.append("  <instance");
-                    Utils.appendAttribute(writer, "type", elementAt.getObjectType());
-                    Utils.appendAttribute(writer, "id", elementAt.getIdentifier());
+                    Utils.appendAttribute(writer, "oid", elementAt.enString());
                     writer.append("/>\n");
                 }
                 writer.append("</instances>");
@@ -430,8 +428,7 @@ public class XmlDataManager implements D
                 writer.write("<");
                 writer.write(tag);
                 final RootOid oid = data.getRootOid();
-                Utils.appendAttribute(writer, "type", oid.getObjectType());
-                Utils.appendAttribute(writer, "id", oid.getIdentifier());
+                Utils.appendAttribute(writer, "oid", oid.enString());
                 Utils.appendAttribute(writer, "user", "" + getAuthenticationSession().getUserName());
 
                 final long sequence = data.getVersion().getSequence();
@@ -473,12 +470,11 @@ public class XmlDataManager implements D
     }
 
     private void writeAssociationField(final Writer writer, final String field, final Object entry) throws IOException {
-        final RootOidDefault rootOidDefault = (RootOidDefault) entry;
+        final Oid rootOidDefault = (Oid)entry;
         Assert.assertFalse(rootOidDefault.isTransient());
         writer.append("  <association");
         Utils.appendAttribute(writer, "field", field);
-        Utils.appendAttribute(writer, "type", rootOidDefault.getObjectType());
-        Utils.appendAttribute(writer, "id", rootOidDefault.getIdentifier());
+        Utils.appendAttribute(writer, "oid", rootOidDefault.enString());
         writer.append("/>\n");
     }
 
@@ -496,8 +492,7 @@ public class XmlDataManager implements D
                     throw new ObjectPersistenceException("Can't add tranisent OID (" + oid + ") to " + field + " element.");
                 }
                 writer.append("    <element ");
-                Utils.appendAttribute(writer, "type", rootOidDefault.getObjectType());
-                Utils.appendAttribute(writer, "id", rootOidDefault.getIdentifier());
+                Utils.appendAttribute(writer, "oid", rootOidDefault.enString());
                 writer.append("/>\n");
             }
             writer.append("  </multiple-association>\n");
@@ -520,15 +515,14 @@ public class XmlDataManager implements D
             final Object oid = refs.elementAt(i);
             writer.append("  <element");
             final RootOid rootOid = (RootOid) oid;
-            Utils.appendAttribute(writer, "type", rootOid.getObjectType());
-            Utils.appendAttribute(writer, "id", rootOid.getIdentifier());
+            Utils.appendAttribute(writer, "oid", rootOid.enString());
             writer.append("/>\n");
         }
     }
 
     
     private static String filename(final RootOid oid) {
-        return oid.getObjectType() + File.separator + oid.getIdentifier();
+        return oid.getObjectSpecId() + File.separator + oid.getIdentifier();
     }
 
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/ServiceManager.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/ServiceManager.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/ServiceManager.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/ServiceManager.java Mon May 14 22:44:57 2012
@@ -20,6 +20,7 @@
 package org.apache.isis.runtimes.dflt.objectstores.xml.internal.services;
 
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 
 public interface ServiceManager {
 
@@ -27,6 +28,6 @@ public interface ServiceManager {
 
     void registerService(RootOid rootOid);
 
-    RootOid getOidForService(String objectType);
+    RootOid getOidForService(ObjectSpecId objectSpecId);
 
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/xml/XmlServiceManager.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/xml/XmlServiceManager.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/xml/XmlServiceManager.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/services/xml/XmlServiceManager.java Mon May 14 22:44:57 2012
@@ -32,8 +32,10 @@ import org.xml.sax.helpers.DefaultHandle
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.xml.ContentWriter;
 import org.apache.isis.core.commons.xml.XmlFile;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.xml.Utils;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.services.ServiceManager;
 
@@ -48,9 +50,9 @@ public class XmlServiceManager implement
     }
 
     @Override
-    public RootOid getOidForService(final String objectType) {
+    public RootOid getOidForService(final ObjectSpecId objectSpecId) {
         for (final ServiceElement element: services) {
-            if (element.oid.getObjectType().equals(objectType)) {
+            if (element.oid.getObjectSpecId().equals(objectSpecId)) {
                 return element.oid;
             }
         }
@@ -80,8 +82,11 @@ public class XmlServiceManager implement
                 writer.append("<" + tag + ">\n");
                 for (final ServiceElement element: services) {
                     writer.append("  <service");
-                    Utils.appendAttribute(writer, "type", element.oid.getObjectType());
-                    Utils.appendAttribute(writer, "id", element.oid.getIdentifier());
+//                    Utils.appendAttribute(writer, "type", element.oid.getObjectSpecId());
+//                    Utils.appendAttribute(writer, "id", element.oid.getIdentifier());
+
+                  Utils.appendAttribute(writer, "oid", element.oid.enString());
+
                     writer.append("/>\n");
                 }
                 writer.append("</" + tag + ">\n");
@@ -91,9 +96,9 @@ public class XmlServiceManager implement
 }
 
 class ServiceElement {
-    final RootOidDefault oid;
+    final RootOid oid;
 
-    public ServiceElement(final RootOidDefault oid) {
+    public ServiceElement(final RootOid oid) {
         Assert.assertNotNull("oid", oid.enString());
         this.oid = oid;
     }
@@ -105,10 +110,18 @@ class ServiceHandler extends DefaultHand
     @Override
     public void startElement(final String ns, final String name, final String tagName, final Attributes attrs) throws SAXException {
         if (tagName.equals("service")) {
-            final String objectType = attrs.getValue("type");
-            final String identifier = attrs.getValue("id");
-            final ServiceElement service = new ServiceElement(RootOidDefault.create(objectType, identifier));
+//            final String objectType = attrs.getValue("type");
+//            final String identifier = attrs.getValue("id");
+//             final RootOid rootOid = RootOidDefault.create(objectType, identifier);
+            
+            final String oidStr = attrs.getValue("oid");
+            RootOid rootOid = getOidMarshaller().unmarshal(oidStr, RootOid.class);
+            final ServiceElement service = new ServiceElement(rootOid);
             services.add(service);
         }
     }
+
+    protected OidMarshaller getOidMarshaller() {
+        return new OidMarshaller();
+    }
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_persist.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_persist.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_persist.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_persist.java Mon May 14 22:44:57 2012
@@ -19,6 +19,11 @@
 
 package org.apache.isis.runtimes.dflt.objectstores.xml;
 
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.apache.isis.core.testsupport.files.Files;
+import org.apache.isis.core.testsupport.files.Files.Recursion;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
 import org.apache.isis.runtimes.dflt.testsupport.tck.ObjectStoreContractTest_persist;
 
@@ -28,4 +33,23 @@ public class XmlObjectStoreTest_persist 
     protected PersistenceMechanismInstaller createPersistenceMechanismInstaller() {
         return new XmlPersistenceMechanismInstaller();
     }
+
+    protected void resetPersistenceStore() {
+        Files.deleteFiles("xml/objects", Files.and(endsWithXml(), notServicesXml()), Recursion.DO_RECURSE);
+    }
+
+    private static FilenameFilter notServicesXml() {
+        return new FilenameFilter() {
+            
+            @Override
+            public boolean accept(File parentDirectory, String fileName) {
+                return !fileName.equals("services.xml");
+            }
+        };
+    }
+
+    private static FilenameFilter endsWithXml() {
+        return Files.filterFileNameExtension(".xml");
+    }
+
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_toRefactor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_toRefactor.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_toRefactor.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStoreTest_toRefactor.java Mon May 14 22:44:57 2012
@@ -32,6 +32,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.adapter.version.Version;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
@@ -153,7 +154,8 @@ public class XmlObjectStoreTest_toRefact
     public void validatesObjectStoreGetObject() throws Exception {
         final SaveObjectCommand command = objectStore.createSaveObjectCommand(adapter1);
         objectStore.execute(Collections.<PersistenceCommand> singletonList(command));
-        assertTrue(objectStore.getObject(adapter1.getOid(), adapter1.getSpecification()).getOid().equals(adapter1.getOid()));
+        final ObjectAdapter retrievedAdapter = objectStore.getObject((TypedOid) adapter1.getOid());
+        assertTrue(retrievedAdapter.getOid().equals(adapter1.getOid()));
     }
 
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataTest.java Mon May 14 22:44:57 2012
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import junit.framework.TestCase;
 
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.testspec.ObjectSpecificationStub;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.clock.DefaultClock;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion;
@@ -36,7 +37,7 @@ public class ObjectDataTest extends Test
         FileVersion.setClock(new DefaultClock());
 
         final ObjectSpecificationStub type = new ObjectSpecificationStub("test");
-        final ObjectData objectData = new ObjectData(RootOidDefault.create(objectType, ""+13), new FileVersion(""));
+        final ObjectData objectData = new ObjectData(RootOidDefault.create(ObjectSpecId.of(objectType), ""+13), new FileVersion(""));
 
         assertEquals(null, objectData.get("name"));
         objectData.set("name", "value");

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataVectorTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataVectorTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataVectorTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ObjectDataVectorTest.java Mon May 14 22:44:57 2012
@@ -26,7 +26,9 @@ import java.util.Collections;
 import org.junit.Before;
 import org.junit.Test;
 
+import org.apache.isis.core.metamodel.adapter.oid.Oid.State;
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.testspec.ObjectSpecificationStub;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion;
 
@@ -42,8 +44,8 @@ public class ObjectDataVectorTest {
 
     @Before
     public void setUp() throws Exception {
-        final boolean isTransient = true;
-        oid = isTransient ? RootOidDefault.createTransient(objectType, ""+1) : RootOidDefault.create(objectType, ""+1);
+        final ObjectSpecId objectSpecId = ObjectSpecId.of(objectType);
+        oid = new RootOidDefault(objectSpecId, ""+1, State.TRANSIENT);
 
         spec = new ObjectSpecificationStub(this.getClass());
         spec.fields = Collections.emptyList();

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ReferenceVectorTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ReferenceVectorTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ReferenceVectorTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/ReferenceVectorTest.java Mon May 14 22:44:57 2012
@@ -26,6 +26,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 
 public class ReferenceVectorTest {
     
@@ -36,7 +37,7 @@ public class ReferenceVectorTest {
 
     @Before
     public void setUp() throws Exception {
-        oid = RootOidDefault.createTransient(objectType, ""+1);
+        oid = RootOidDefault.createTransient(ObjectSpecId.of(objectType), ""+1);
         listOfRootOid = new ListOfRootOid();
     }
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java Mon May 14 22:44:57 2012
@@ -32,6 +32,7 @@ import org.junit.Test;
 
 import org.apache.isis.core.commons.xml.XmlFile;
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.runtimes.dflt.objectstores.xml.XmlPersistenceMechanismInstaller;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.clock.DefaultClock;
@@ -88,7 +89,7 @@ public class XmlDataManagerTest {
         final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
 
         assertEquals(data.getRootOid(), read.getRootOid());
-        assertEquals(data.getObjectType(), read.getObjectType());
+        assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
         assertEquals(data.getVersion(), read.getVersion());
     }
 
@@ -103,7 +104,7 @@ public class XmlDataManagerTest {
     @Test
     public void testInsertObjectWithFields() throws ObjectPersistenceException {
         final ObjectData data = createData(Role.class, 99, new FileVersion("user", 13));
-        data.set("Person", RootOidDefault.create("RLE", ""+101));
+        data.set("Person", RootOidDefault.create(ObjectSpecId.of("RLE"), ""+101));
         assertNotNull(data.get("Person"));
         data.set("Name", "Harry");
         assertNotNull(data.get("Name"));
@@ -112,7 +113,7 @@ public class XmlDataManagerTest {
 
         final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
         assertEquals(data.getRootOid(), read.getRootOid());
-        assertEquals(data.getObjectType(), read.getObjectType());
+        assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
 
         assertEquals(data.get("Person"), read.get("Person"));
         assertEquals(data.get("Name"), read.get("Name"));
@@ -128,7 +129,7 @@ public class XmlDataManagerTest {
 
         final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
         assertEquals(data.getRootOid(), read.getRootOid());
-        assertEquals(data.getObjectType(), read.getObjectType());
+        assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
 
         final ListOfRootOid c = read.elements("Members");
         assertNull(c);
@@ -141,14 +142,14 @@ public class XmlDataManagerTest {
         data.initCollection("Members");
         final RootOidDefault oid[] = new RootOidDefault[3];
         for (int i = 0; i < oid.length; i++) {
-            oid[i] = RootOidDefault.create("TEA", ""+ (104 + i));
+            oid[i] = RootOidDefault.create(ObjectSpecId.of("TEA"), ""+ (104 + i));
             data.addElement("Members", oid[i]);
         }
         manager.insertObject(data);
 
         final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
         assertEquals(data.getRootOid(), read.getRootOid());
-        assertEquals(data.getObjectType(), read.getObjectType());
+        assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
 
         final ListOfRootOid c = read.elements("Members");
         for (int i = 0; i < oid.length; i++) {
@@ -160,8 +161,8 @@ public class XmlDataManagerTest {
     private ObjectData createData(final Class<?> type, final long id, final FileVersion version) {
 
         final ObjectSpecification objSpec = IsisContext.getSpecificationLoader().loadSpecification(type);
-        final String objectType = objSpec.getObjectType();
-        final RootOidDefault oid = RootOidDefault.create(objectType, ""+id);
+        final ObjectSpecId objectSpecId = objSpec.getSpecId();
+        final RootOidDefault oid = RootOidDefault.create(objectSpecId, ""+id);
         return new ObjectData(oid, version);
     }
     /*

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java Mon May 14 22:44:57 2012
@@ -34,6 +34,7 @@ import org.junit.Test;
 import org.apache.isis.core.commons.xml.XmlFile;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.runtimes.dflt.objectstores.xml.XmlPersistenceMechanismInstaller;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.clock.DefaultClock;
 import org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.ObjectData;
@@ -69,9 +70,9 @@ public class XmlDataManagerTest_instance
         oids = new RootOid[SIZE];
         data = new ObjectData[SIZE];
 
-        pattern = new ObjectData(RootOidDefault.create("RLE|1"), new FileVersion("user", 13));
+        pattern = new ObjectData(RootOidDefault.deString("RLE:1"), new FileVersion("user", 13));
         for (int i = 0; i < SIZE; i++) {
-            oids[i] = RootOidDefault.create("RLE", ""+i);
+            oids[i] = RootOidDefault.create(ObjectSpecId.of("RLE"), ""+i);
             data[i] = new ObjectData(oids[i], new FileVersion("user", 13));
             manager.insertObject(data[i]);
         }
@@ -116,7 +117,7 @@ public class XmlDataManagerTest_instance
 
     @Test
     public void testSaveObject() throws Exception {
-        data[2].set("Person", RootOidDefault.create("PER", ""+231));
+        data[2].set("Person", RootOidDefault.create(ObjectSpecId.of("PER"), ""+231));
         data[2].set("Name", "Fred");
         manager.save(data[2]);
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/ObjectStorePersistenceMechanismInstallerAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/ObjectStorePersistenceMechanismInstallerAbstract.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/ObjectStorePersistenceMechanismInstallerAbstract.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/ObjectStorePersistenceMechanismInstallerAbstract.java Mon May 14 22:44:57 2012
@@ -29,17 +29,15 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.services.ServicesInjector;
 import org.apache.isis.core.runtime.logging.Logger;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.AdapterManagerExtended;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.IsisStoreLogger;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.IsisObjectStoreLogger;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStore;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStorePersistence;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStoreTransactionManagement;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.PersistenceSessionObjectStore;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.dflt.DefaultPersistAlgorithm;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.ObjectStoreTransactionManager;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionTransactionManagement;
@@ -58,7 +56,7 @@ public abstract class ObjectStorePersist
      * to downcast if required.
      */
     @Override
-    protected PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory, final AdapterManagerExtended adapterManager, final ObjectAdapterFactory adapterFactory, final ObjectFactory objectFactory, final OidGenerator oidGenerator,
+    protected PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory, final AdapterManagerExtended adapterManager, final ObjectAdapterFactory adapterFactory, final ObjectFactory objectFactory, final IdentifierGenerator identifierGenerator,
             final ServicesInjector servicesInjector) {
 
         final PersistAlgorithm persistAlgorithm = createPersistAlgorithm(getConfiguration());
@@ -69,10 +67,10 @@ public abstract class ObjectStorePersist
 
         if (getConfiguration().getBoolean(LOGGING_PROPERTY, false)) {
             final String level = getConfiguration().getString(LOGGING_PROPERTY + ".level", "debug");
-            objectStore = new IsisStoreLogger(objectStore, level);
+            objectStore = new IsisObjectStoreLogger(objectStore, level);
         }
 
-        final PersistenceSessionObjectStore persistenceSession = createObjectStorePersistor(persistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, oidGenerator, adapterManager, persistAlgorithm, objectStore);
+        final PersistenceSession persistenceSession = createObjectStorePersistor(persistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, identifierGenerator, adapterManager, persistAlgorithm, objectStore);
 
         final IsisTransactionManager transactionManager = createTransactionManager(persistenceSession, objectStore);
 
@@ -94,9 +92,9 @@ public abstract class ObjectStorePersist
      * Can optionally be overridden, but by default creates an
      * {@link PersistenceSessionObjectStore}.
      */
-    protected PersistenceSessionObjectStore createObjectStorePersistor(final PersistenceSessionFactory persistenceSessionFactory, final ObjectAdapterFactory adapterFactory, final ObjectFactory objectFactory, final ServicesInjector servicesInjector, final OidGenerator oidGenerator,
+    protected PersistenceSession createObjectStorePersistor(final PersistenceSessionFactory persistenceSessionFactory, final ObjectAdapterFactory adapterFactory, final ObjectFactory objectFactory, final ServicesInjector servicesInjector, final IdentifierGenerator identifierGenerator,
             final AdapterManagerExtended adapterManager, final PersistAlgorithm persistAlgorithm, final ObjectStorePersistence objectStore) {
-        return new PersistenceSessionObjectStore(persistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, oidGenerator, adapterManager, persistAlgorithm, objectStore);
+        return new PersistenceSession(persistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, identifierGenerator, adapterManager, persistAlgorithm, objectStore);
     }
 
     /**
@@ -116,7 +114,7 @@ public abstract class ObjectStorePersist
      * By default returns a {@link ObjectStoreTransactionManager}.
      */
     protected IsisTransactionManager createTransactionManager(final PersistenceSessionTransactionManagement persistor, final ObjectStoreTransactionManagement objectStore) {
-        return new ObjectStoreTransactionManager(persistor, objectStore);
+        return new IsisTransactionManager(persistor, objectStore);
     }
 
     // ///////////////////////////////////////////

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java Mon May 14 22:44:57 2012
@@ -39,11 +39,11 @@ import org.apache.isis.core.metamodel.se
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookup;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookupAware;
 import org.apache.isis.runtimes.dflt.runtime.persistence.PersistenceConstants;
-import org.apache.isis.runtimes.dflt.runtime.persistence.PersistenceSessionLogger;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adapterfactory.pojo.PojoAdapterFactory;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.AdapterManagerDefault;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.AdapterManagerExtended;
 import org.apache.isis.runtimes.dflt.runtime.persistence.internal.RuntimeContextFromSession;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
@@ -84,11 +84,11 @@ public abstract class PersistenceMechani
      * 
      * @see #createPersistenceSession(PersistenceSessionFactory,
      *      AdapterManagerExtended, ObjectAdapterFactory, ObjectFactory,
-     *      OidGenerator, ServicesInjector)
+     *      IdentifierGenerator, ServicesInjector)
      * @see #createAdapterFactory(IsisConfiguration)
      * @see #createAdapterManager(IsisConfiguration)
      * @see #createContainer(IsisConfiguration)
-     * @see #createOidGenerator(IsisConfiguration)
+     * @see #createIdentifierGenerator(IsisConfiguration)
      * @see #createRuntimeContext(IsisConfiguration)
      * @see #createServicesInjector(IsisConfiguration)
      */
@@ -101,7 +101,7 @@ public abstract class PersistenceMechani
         final AdapterManagerExtended adapterManager = createAdapterManager(getConfiguration());
         final ObjectAdapterFactory adapterFactory = createAdapterFactory(getConfiguration());
         final ObjectFactory objectFactory = createObjectFactory(getConfiguration());
-        final OidGenerator oidGenerator = createOidGenerator(getConfiguration());
+        final IdentifierGenerator identifierGenerator = createIdentifierGenerator(getConfiguration());
 
         final RuntimeContext runtimeContext = createRuntimeContext(getConfiguration());
         final DomainObjectContainer container = createContainer(getConfiguration());
@@ -112,7 +112,7 @@ public abstract class PersistenceMechani
         ensureThatArg(adapterManager, is(not(nullValue())));
         ensureThatArg(adapterFactory, is(not(nullValue())));
         ensureThatArg(objectFactory, is(not(nullValue())));
-        ensureThatArg(oidGenerator, is(not(nullValue())));
+        ensureThatArg(identifierGenerator, is(not(nullValue())));
 
         ensureThatArg(runtimeContext, is(not(nullValue())));
         ensureThatArg(container, is(not(nullValue())));
@@ -127,13 +127,7 @@ public abstract class PersistenceMechani
         servicesInjector.setServices(serviceList);
         persistenceSessionFactory.getSpecificationLoader().injectInto(runtimeContext);
 
-        PersistenceSession persistenceSession = createPersistenceSession(persistenceSessionFactory, adapterManager, adapterFactory, objectFactory, oidGenerator, servicesInjector);
-
-        if (getConfiguration().getBoolean(LOGGING_PROPERTY, false)) {
-            final String level = getConfiguration().getString(LOGGING_PROPERTY + ".level", "debug");
-            persistenceSession = new PersistenceSessionLogger(persistenceSession, level);
-        }
-
+        final PersistenceSession persistenceSession = createPersistenceSession(persistenceSessionFactory, adapterManager, adapterFactory, objectFactory, identifierGenerator, servicesInjector);
         return persistenceSession;
     }
 
@@ -148,7 +142,7 @@ public abstract class PersistenceMechani
      * 
      * @see #createPersistenceSession(PersistenceSessionFactory)
      */
-    protected abstract PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory, final AdapterManagerExtended adapterManager, final ObjectAdapterFactory adapterFactory, final ObjectFactory objectFactory, final OidGenerator oidGenerator,
+    protected abstract PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory, final AdapterManagerExtended adapterManager, final ObjectAdapterFactory adapterFactory, final ObjectFactory objectFactory, final IdentifierGenerator identifierGenerator,
             final ServicesInjector servicesInjector);
 
     // ///////////////////////////////////////////
@@ -210,13 +204,13 @@ public abstract class PersistenceMechani
      * <p>
      * By default, looks up implementation from provided
      * {@link IsisConfiguration} using
-     * {@link PersistenceConstants#OID_GENERATOR_CLASS_NAME}. If no
+     * {@link PersistenceConstants#IDENTIFIER_GENERATOR_CLASS_NAME}. If no
      * implementation is specified, then defaults to
-     * {@value PersistenceConstants#OID_GENERATOR_CLASS_NAME_DEFAULT}.
+     * {@value PersistenceConstants#IDENTIFIER_GENERATOR_CLASS_NAME_DEFAULT}.
      */
-    protected OidGenerator createOidGenerator(final IsisConfiguration configuration) {
-        final String oidGeneratorClassName = configuration.getString(PersistenceConstants.OID_GENERATOR_CLASS_NAME, PersistenceConstants.OID_GENERATOR_CLASS_NAME_DEFAULT);
-        return InstanceUtil.createInstance(oidGeneratorClassName, OidGenerator.class);
+    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
+        final String identifierGeneratorClassName = configuration.getString(PersistenceConstants.IDENTIFIER_GENERATOR_CLASS_NAME, PersistenceConstants.IDENTIFIER_GENERATOR_CLASS_NAME_DEFAULT);
+        return InstanceUtil.createInstance(identifierGeneratorClassName, IdentifierGenerator.class);
     }
 
     /**

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java Mon May 14 22:44:57 2012
@@ -29,9 +29,7 @@ import org.apache.log4j.Logger;
 
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.encoding.DataInputStreamExtended;
-import org.apache.isis.core.commons.encoding.DataOutputExtended;
 import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
-import org.apache.isis.core.commons.encoding.Encodable;
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.commons.exceptions.UnknownTypeException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -193,10 +191,10 @@ public class Memento implements Serializ
         ObjectAdapter adapter;
         ResolveState targetState;
         if (getOid().isTransient()) {
-            adapter = getHydrator().recreateAdapter(getOid(), spec);
+            adapter = getHydrator().recreateAdapter(spec, getOid());
             targetState = ResolveState.SERIALIZING_TRANSIENT;
         } else {
-            adapter = getHydrator().recreateAdapter(getOid(), spec);
+            adapter = getHydrator().recreateAdapter(spec, getOid());
             targetState = ResolveState.UPDATING;
         }
         
@@ -233,7 +231,7 @@ public class Memento implements Serializ
                 return null;
             }
             ObjectAdapter ref;
-            ref = getHydrator().recreateAdapter(oid, spec);
+            ref = getHydrator().recreateAdapter(spec, oid);
             if (data instanceof ObjectData) {
                 if (oid.isTransient() || spec.isParented()) {
                     final ResolveState resolveState = spec.isParented() ? ResolveState.GHOST : ResolveState.TRANSIENT;

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java Mon May 14 22:44:57 2012
@@ -27,9 +27,9 @@ import org.apache.isis.core.metamodel.se
 import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
 import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adapterfactory.pojo.PojoAdapterFactory;
-import org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.serial.RootOidGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGeneratorDefault;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
 
 public final class PersistenceConstants {
 
@@ -41,11 +41,11 @@ public final class PersistenceConstants 
     public static final String ADAPTER_FACTORY_CLASS_NAME_DEFAULT = PojoAdapterFactory.class.getName();
 
     /**
-     * Key used to lookup implementation of {@link OidGenerator} in
+     * Key used to lookup implementation of {@link IdentifierGenerator} in
      * {@link IsisConfiguration}.
      */
-    public static final String OID_GENERATOR_CLASS_NAME = ConfigurationConstants.ROOT + "persistor.oid-generator";
-    public static final String OID_GENERATOR_CLASS_NAME_DEFAULT = RootOidGenerator.class.getName();
+    public static final String IDENTIFIER_GENERATOR_CLASS_NAME = ConfigurationConstants.ROOT + "persistor.identifier-generator";
+    public static final String IDENTIFIER_GENERATOR_CLASS_NAME_DEFAULT = IdentifierGeneratorDefault.class.getName();
 
     /**
      * Key used to lookup implementation of {@link ObjectFactory} in

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java Mon May 14 22:44:57 2012
@@ -36,6 +36,7 @@ import org.apache.isis.core.commons.debu
 import org.apache.isis.core.commons.debug.DebuggableWithTitle;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.ensure.Ensure;
+import org.apache.isis.core.commons.ensure.IsisAssertException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactoryAware;
@@ -44,6 +45,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.oid.CollectionOid;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.adapter.version.Version;
 import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
 import org.apache.isis.core.metamodel.facets.object.aggregated.ParentedFacet;
@@ -52,17 +54,17 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjectorAware;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.internal.OidAdapterHashMap;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.internal.OidAdapterMap;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.internal.PojoAdapterHashMap;
 import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.internal.PojoAdapterMap;
-import org.apache.isis.runtimes.dflt.runtime.persistence.oidgenerator.OidGeneratorAware;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGeneratorAware;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
 
 public class AdapterManagerDefault extends AdapterManagerAbstract implements ObjectAdapterFactoryAware, SpecificationLoaderAware, OidGeneratorAware, DependencyInjectorAware, DebuggableWithTitle {
@@ -207,7 +209,7 @@ public class AdapterManagerDefault exten
      * {@inheritDoc}
      */
     @Override
-    public ObjectAdapter adapterFor(final Object pojo, final ObjectAdapter parentAdapter, final ObjectAssociation association) {
+    public ObjectAdapter adapterFor(final Object pojo, final ObjectAdapter parentAdapter, final OneToManyAssociation collection) {
 
         // attempt to locate adapter for the pojo
         final ObjectAdapter adapter = getAdapterFor(pojo);
@@ -226,22 +228,16 @@ public class AdapterManagerDefault exten
         // as explained in the AdapterMap javadoc
         final ObjectAdapter newAdapter;
         if (parentAdapter != null) {
-            if (association != null) {
-                if(association.isOneToManyAssociation()) {
-                    // the List, Set etc. instance gets wrapped in its own adapter
-                    final OneToManyAssociation collection = (OneToManyAssociation) association;
-                    newAdapter = createCollectionAdapter(pojo, parentAdapter, collection);
-                } else {
-                    newAdapter = createTransientRootAdapter(pojo);
-                }
-            } else {
+            if (collection == null) {
                 if(isAggregated(objSpec)) {
-                    final String aggregateLocalId = getOidGenerator().createAggregateLocalId(pojo);
-                    final AggregatedOid aggregatedOid = new AggregatedOid(parentAdapter.getOid(), aggregateLocalId);
+                    final AggregatedOid aggregatedOid = getOidGenerator().createAggregateOid(pojo, parentAdapter);
                     newAdapter = createAggregatedAdapter(pojo, aggregatedOid);
                 } else {
                     newAdapter = createTransientRootAdapter(pojo);
                 }
+            } else {
+                // the List, Set etc. instance gets wrapped in its own adapter
+                newAdapter = createCollectionAdapter(pojo, parentAdapter, collection);
             }
         } else {
             // not parented
@@ -272,7 +268,7 @@ public class AdapterManagerDefault exten
         final Oid parentOid = parentAdapter.getOid();
 
         // persistence of collection follows the parent
-        final CollectionOid collectionOid = new CollectionOid(parentOid, otma);
+        final CollectionOid collectionOid = new CollectionOid((TypedOid) parentOid, otma);
         final ObjectAdapter collectionAdapter = createCollectionAdapterAndInferResolveState(pojo, collectionOid);
 
         // we copy over the type onto the adapter itself
@@ -284,7 +280,6 @@ public class AdapterManagerDefault exten
 
         return collectionAdapter;
     }
-    
 
     private static boolean isAggregated(final ObjectSpecification objSpec) {
         return objSpec.containsFacet(ParentedFacet.class);
@@ -317,13 +312,13 @@ public class AdapterManagerDefault exten
     private ObjectAdapter createRootOrAggregatedAdapter(final Oid oid, final Object pojo) {
         final ObjectAdapter createdAdapter;
         if(oid instanceof RootOid) {
-            RootOid rootOid = (RootOid) oid;
+            final RootOid rootOid = (RootOid) oid;
             createdAdapter = createRootAdapterAndInferResolveState(pojo, rootOid);
         } else if (oid instanceof CollectionOid){
-            CollectionOid collectionOid = (CollectionOid) oid;
+            final CollectionOid collectionOid = (CollectionOid) oid;
             createdAdapter = createCollectionAdapterAndInferResolveState(pojo, collectionOid);
         } else {
-            AggregatedOid aggregatedOid = (AggregatedOid) oid;
+            final AggregatedOid aggregatedOid = (AggregatedOid) oid;
             createdAdapter = createAggregatedAdapter(pojo, aggregatedOid);
         }
         return createdAdapter;
@@ -375,11 +370,11 @@ public class AdapterManagerDefault exten
      * practice this is done by the <tt>ObjectAdapterStore</tt> implementation
      * delegated by the <tt>PersistenceSessionObjectStore</tt>, and propagated
      * back to client-side as required).
+     * 
+     * @param hintRootOid - intended for testing, allow a different persistent root oid to be provided.  Must be persistent and compatible with the adapter's type
      */
     @Override
-    public void remapAsPersistent(final ObjectAdapter adapter) {
-        // ??? REVIEW: don't do this because the Oid has been updated already
-        // ensureMapsConsistent(adapter);
+    public void remapAsPersistent(final ObjectAdapter adapter, RootOid hintRootOid) {
         
         final ObjectAdapter rootAdapter = adapter.getAggregateRoot();
         final RootOid transientRootOid = (RootOid) rootAdapter.getOid();
@@ -419,7 +414,25 @@ public class AdapterManagerDefault exten
         if (LOG.isDebugEnabled()) {
             LOG.debug("updating the Oid");
         }
-        final RootOid persistedRootOid = getOidGenerator().asPersistent(transientRootOid);
+        
+        // intended for testing (bit nasty)
+        final RootOid persistedRootOid;
+        if(hintRootOid != null) {
+            if(hintRootOid.isTransient()) {
+                throw new IsisAssertException("hintRootOid must be persistent");
+            }
+            final ObjectSpecId hintRootOidObjectSpecId = hintRootOid.getObjectSpecId();
+            final ObjectSpecId adapterObjectSpecId = adapter.getSpecification().getSpecId();
+            if(!hintRootOidObjectSpecId.equals(adapterObjectSpecId)) {
+                throw new IsisAssertException("hintRootOid's objectType must be same as that of adapter " +
+                		"(was: '" + hintRootOidObjectSpecId + "'; adapter's is " + adapterObjectSpecId + "'");
+            }
+            // ok
+            persistedRootOid = hintRootOid;
+        } else {
+            // normal flow - delegate to OidGenerator to obtain a persistent root oid
+            persistedRootOid = getOidGenerator().createPersistent(adapter.getObject(), transientRootOid);
+        }
         
         // associate root adapter with the new Oid, and remap
         if (LOG.isDebugEnabled()) {

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerPersist.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerPersist.java?rev=1338472&r1=1338471&r2=1338472&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerPersist.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerPersist.java Mon May 14 22:44:57 2012
@@ -23,7 +23,9 @@ import org.apache.isis.applib.annotation
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ResolveState;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
 
 /**
@@ -45,8 +47,10 @@ public interface AdapterManagerPersist {
      * As a consequence of this call, the adapter's {@link Oid} will be
      * {@link ObjectAdapter#replaceOid(Oid) replaced} (Oids are now immutable).
      * The same is true of the associated collection adapters.
+     * 
+     * @param hintRootOid - primarily for testing purposes, to set the adapter with a specific rootOid.  Is passed through to the {@link OidGenerator}.
      */
-    void remapAsPersistent(ObjectAdapter adapter);
+    void remapAsPersistent(ObjectAdapter adapter, RootOid hintRootOid);
 
     /**
      * Either returns an existing {@link ObjectAdapter adapter} (as per



Mime
View raw message