incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1051471 [3/10] - in /incubator/isis/trunk: alternatives/embedded/src/main/java/org/apache/isis/alternatives/embedded/ alternatives/embedded/src/main/java/org/apache/isis/alternatives/embedded/internal/ alternatives/objectstore/nosql/src/te...
Date Tue, 21 Dec 2010 12:06:23 GMT
Added: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookup.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookup.java?rev=1051471&view=auto
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookup.java (added)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookup.java Tue Dec 21 12:06:15 2010
@@ -0,0 +1,31 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.core.metamodel.runtimecontext;
+
+import org.apache.isis.core.commons.components.Injectable;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+
+public interface SpecificationLookup extends Injectable {
+
+    /**
+     * @see #loadSpecification(String)
+     */
+    ObjectSpecification loadSpecification(Class<?> cls);
+
+
+}

Added: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAbstract.java?rev=1051471&view=auto
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAbstract.java (added)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAbstract.java Tue Dec 21 12:06:15 2010
@@ -0,0 +1,31 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.core.metamodel.runtimecontext;
+
+
+public abstract class SpecificationLookupAbstract implements SpecificationLookup {
+
+    @Override
+    public void injectInto(Object candidate) {
+        if (SpecificationLookupAware.class.isAssignableFrom(candidate.getClass())) {
+            SpecificationLookupAware cast = SpecificationLookupAware.class.cast(candidate);
+            cast.setSpecificationLookup(this);
+        }
+    }
+
+    
+}

Added: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAware.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAware.java?rev=1051471&view=auto
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAware.java (added)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupAware.java Tue Dec 21 12:06:15 2010
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.metamodel.runtimecontext;
+
+public interface SpecificationLookupAware {
+	
+	public void setSpecificationLookup(final SpecificationLookup specificationLookup);
+
+}

Added: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupDelegator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupDelegator.java?rev=1051471&view=auto
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupDelegator.java (added)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/SpecificationLookupDelegator.java Tue Dec 21 12:06:15 2010
@@ -0,0 +1,41 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.core.metamodel.runtimecontext;
+
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+/**
+ * Allows a SpecificationLookup to be provided even if the 
+ * concrete implementation is only available later.
+ */
+public class SpecificationLookupDelegator extends SpecificationLookupAbstract {
+
+    private SpecificationLookup specificationLookupDelegate;
+    
+    public void setDelegate(SpecificationLookup specificationLookupDelegate) {
+        this.specificationLookupDelegate = specificationLookupDelegate;
+    }
+    
+    @Override
+    public ObjectSpecification loadSpecification(Class<?> cls) {
+        if(specificationLookupDelegate == null) {
+            throw new IllegalStateException("No SpecificationLookup provided");
+        }
+        return specificationLookupDelegate.loadSpecification(cls);
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java Tue Dec 21 12:06:15 2010
@@ -20,126 +20,94 @@
 
 package org.apache.isis.core.metamodel.runtimecontext.noruntime;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.applib.query.Query;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.runtimecontext.ObjectInstantiationException;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
+import org.apache.isis.core.metamodel.runtimecontext.DependencyInjectorAbstract;
+import org.apache.isis.core.metamodel.runtimecontext.DomainObjectServices;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectDirtier;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectInstantiator;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectPersistor;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
 import org.apache.isis.core.metamodel.runtimecontext.RuntimeContextAbstract;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesProvider;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesProviderAbstract;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.identifier.Identified;
 
 public class RuntimeContextNoRuntime extends RuntimeContextAbstract {
-
-	public RuntimeContextNoRuntime() {
-	}
-	
-
-	/////////////////////////////////////////////
-	// AuthenticationSession
-	/////////////////////////////////////////////
-
-	public AuthenticationSession getAuthenticationSession() {
-		return new AuthenticationSessionNoRuntime();
-	}
-
-	/////////////////////////////////////////////
-	// getAdapterFor, adapterFor
-	/////////////////////////////////////////////
-
-	public ObjectAdapter getAdapterFor(Object pojo) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-	
-	public ObjectAdapter getAdapterFor(Oid oid) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-	
-	public ObjectAdapter adapterFor(Object pattern) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-	
-	public ObjectAdapter adapterFor(Object pojo, ObjectAdapter ownerAdapter,
-			Identified identified) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
-	
-	/////////////////////////////////////////////
-	// createTransientInstance, instantiate
-	/////////////////////////////////////////////
-
-	public ObjectAdapter createTransientInstance(ObjectSpecification spec) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	public Object instantiate(Class<?> cls) throws ObjectInstantiationException {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
-	
-	/////////////////////////////////////////////
-	// resolve, objectChanged
-	/////////////////////////////////////////////
-
-	public void resolve(Object parent) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void resolve(Object parent, Object field) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void objectChanged(ObjectAdapter inObject) {
-		throw new UnsupportedOperationException(
-				"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void objectChanged(Object object) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	
-	/////////////////////////////////////////////
-	// makePersistent, remove
-	/////////////////////////////////////////////
-	
-	public void makePersistent(ObjectAdapter adapter) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void remove(ObjectAdapter adapter) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	/////////////////////////////////////////////
-	// flush, commit
-	/////////////////////////////////////////////
-	
-	public boolean flush() {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void commit() {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
+
+	private DependencyInjector dependencyInjector;
+
+    public RuntimeContextNoRuntime() {
+        dependencyInjector = new DependencyInjectorAbstract() {
+            
+            /**
+             * Unlike most of the methods in this implementation, does nothing (because
+             * this will always be called, even in a no-runtime context).
+             */
+            @Override
+            public void injectDependenciesInto(Object domainObject) {
+                
+            }
+        };
 	}
 
+
+	/////////////////////////////////////////////
+	// Components
+	/////////////////////////////////////////////
+
+    @Override
+    public AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+    
+    @Override
+    public AdapterMap getAdapterMap() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+
+    @Override
+    public ObjectInstantiator getObjectInstantiator() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+    
+    @Override
+    public ObjectDirtier getObjectDirtier() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+
+    @Override
+    public ObjectPersistor getObjectPersistor() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+
+    @Override
+    public DomainObjectServices getDomainObjectServices() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+
+    @Override
+    public QuerySubmitter getQuerySubmitter() {
+        throw new UnsupportedOperationException(
+        "Not supported by this implementation of RuntimeContext");
+    }
+
+    @Override
+    public DependencyInjector getDependencyInjector() {
+        return dependencyInjector;
+    }
+    
 	
 	/////////////////////////////////////////////
 	// allInstances, allMatching*
@@ -150,57 +118,26 @@ public class RuntimeContextNoRuntime ext
 		"Not supported by this implementation of RuntimeContext");
 	}
 
-	public <T> List<ObjectAdapter> allMatchingQuery(Query<T> query) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
-	public <T> ObjectAdapter firstMatchingQuery(Query<T> query) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
-    ////////////////////////////////////////////////////////////////////
-    // info, warn, error messages
-    ////////////////////////////////////////////////////////////////////
-
-
-	public void informUser(String message) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void warnUser(String message) {
-		throw new UnsupportedOperationException(
-			"Not supported by this implementation of RuntimeContext");
-	}
-
-	public void raiseError(String message) {
-		throw new UnsupportedOperationException(
-		"Not supported by this implementation of RuntimeContext");
-	}
-
 	
 	/////////////////////////////////////////////
 	// getServices, injectDependenciesInto
 	/////////////////////////////////////////////
-
-	/**
-	 * Just returns an empty array.
-	 */
-	public List<ObjectAdapter> getServices() {
-		return new ArrayList<ObjectAdapter>();
-	}
-
-
-	/**
-	 * Unlike most of the methods in this implementation, does nothing (because
-	 * this will always be called, even in a no-runtime context).
-	 */
-	public void injectDependenciesInto(Object object) {
-		// does nothing.
+
+	@Override
+    public ServicesProvider getServicesProvider() {
+	    return new ServicesProviderAbstract() {
+	        /**
+	         * Just returns an empty array.
+	         */
+	        @Override
+            public List<ObjectAdapter> getServices() {
+	            return Collections.emptyList();
+	        }
+	    };
 	}
 
 
+
+
 
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/IntrospectableSpecificationAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/IntrospectableSpecificationAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/IntrospectableSpecificationAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/IntrospectableSpecificationAbstract.java Tue Dec 21 12:06:15 2010
@@ -49,7 +49,9 @@ import org.apache.isis.core.metamodel.in
 import org.apache.isis.core.metamodel.interactions.InteractionUtils;
 import org.apache.isis.core.metamodel.interactions.ObjectTitleContext;
 import org.apache.isis.core.metamodel.interactions.ObjectValidityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectInstantiator;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesProvider;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.ObjectActionSet;
 import org.apache.isis.core.metamodel.spec.IntrospectableSpecification;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -69,8 +71,11 @@ public abstract class IntrospectableSpec
 		extends FacetHolderImpl
 		implements ObjectSpecification, IntrospectableSpecification {
 
-	private boolean introspected = false;
+    private final AuthenticationSessionProvider authenticationSessionProvider;
+    private final ServicesProvider servicesProvider;
+    private final ObjectInstantiator objectInstantiator;
 
+	private boolean introspected = false;
 
     protected String fullName;
     protected List<ObjectAssociation> fields;
@@ -78,15 +83,18 @@ public abstract class IntrospectableSpec
     protected ObjectSpecification superClassSpecification;
     protected Identifier identifier;
 
-	private final RuntimeContext runtimeContext;
 
     // //////////////////////////////////////////////////////////////////////
     // Constructor
     // //////////////////////////////////////////////////////////////////////
 
     public IntrospectableSpecificationAbstract(
-    		final RuntimeContext runtimeContext) {
-    	this.runtimeContext = runtimeContext;
+    		final AuthenticationSessionProvider authenticationSessionProvider,
+    		final ServicesProvider servicesProvider,
+    		final ObjectInstantiator objectInstantiator) {
+    	this.authenticationSessionProvider = authenticationSessionProvider;
+    	this.servicesProvider = servicesProvider;
+    	this.objectInstantiator = objectInstantiator;
     }
 
     // //////////////////////////////////////////////////////////////////////
@@ -296,7 +304,7 @@ public abstract class IntrospectableSpec
 
     @Override
     public List<ObjectAction> getServiceActionsFor(final ObjectActionType... types) {
-        final List<ObjectAdapter> services = getRuntimeContext().getServices();
+        final List<ObjectAdapter> services = getServicesProvider().getServices();
         final List<ObjectAction> relatedActions = new ArrayList<ObjectAction>();
             for (ObjectAdapter serviceAdapter : services) {
                 final List<ObjectAction> matchingActions = new ArrayList<ObjectAction>();
@@ -318,8 +326,7 @@ public abstract class IntrospectableSpec
                 }
             }
             if (matchingActions.size() > 0) {
-                final ObjectActionSet set = new ObjectActionSet("id", serviceAdapter.titleString(), matchingActions,
-                        runtimeContext);
+                final ObjectActionSet set = new ObjectActionSet("id", serviceAdapter.titleString(), matchingActions);
                 relatedActions.add(set);
             }
         }
@@ -381,7 +388,7 @@ public abstract class IntrospectableSpec
         if (isService()) {
             return Collections.emptyList();
         }
-        final List<ObjectAdapter> services = getRuntimeContext().getServices();
+        final List<ObjectAdapter> services = getServicesProvider().getServices();
 
         // will populate an ActionSet with all actions contributed by each service
         final List<ObjectAction> serviceActionSets = Lists.newArrayList();
@@ -408,7 +415,7 @@ public abstract class IntrospectableSpec
             // only add if there are matching subactions.
             if (matchingServiceActions.size() > 0) {
                 final ObjectActionSet objectActionSet = new ObjectActionSet("id", serviceAdapter.titleString(),
-                    matchingServiceActions, runtimeContext);
+                    matchingServiceActions);
                 serviceActionSets.add(objectActionSet);
             }
 
@@ -534,21 +541,26 @@ public abstract class IntrospectableSpec
         return str.toString();
     }
 
+    protected final AuthenticationSession getAuthenticationSession() {
+        return getAuthenticationSessionProvider().getAuthenticationSession();
+    }
+
+
     // //////////////////////////////////////////////////////////////////////
     // Dependencies (injected in constructor)
     // //////////////////////////////////////////////////////////////////////
 
-    public RuntimeContext getRuntimeContext() {
-        return runtimeContext;
+    protected AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        return authenticationSessionProvider;
     }
 
-    /**
-     * Derived from {@link #getRuntimeContext() runtime context}.
-     */
-    protected final AuthenticationSession getAuthenticationSession() {
-        return getRuntimeContext().getAuthenticationSession();
+    public ServicesProvider getServicesProvider() {
+        return servicesProvider;
     }
 
-
+    public ObjectInstantiator getObjectInstantiator() {
+        return objectInstantiator;
+    }
+    
 }
 

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/ObjectSpecificationNoMember.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/ObjectSpecificationNoMember.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/ObjectSpecificationNoMember.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/ObjectSpecificationNoMember.java Tue Dec 21 12:06:15 2010
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.runtimecontext.spec;
 
-package org.apache.isis.core.metamodel.runtimecontext.spec;
-
 import java.util.Collections;
 import java.util.List;
 
@@ -32,118 +31,115 @@ import org.apache.isis.core.metamodel.co
 import org.apache.isis.core.metamodel.consent.Veto;
 import org.apache.isis.core.metamodel.facetdecorator.FacetDecoratorSet;
 import org.apache.isis.core.metamodel.interactions.InteractionContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectInstantiator;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.Persistability;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionType;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.util.NameUtils;
-
-
-/**
- * A simple implementation used for objects that have no members (fields or actions). Used for primitives and
- * as a fall-back if no specification can be otherwise generated.
- */
-public class ObjectSpecificationNoMember extends IntrospectableSpecificationAbstract {
-    private final String name;
-
-    public ObjectSpecificationNoMember(
-    		final String className, final RuntimeContext runtimeContext) {
-    	super(runtimeContext);
-        this.fullName = className;
-        this.name = NameUtils.simpleName(className.substring(className.lastIndexOf('.') + 1));
-        identifier = Identifier.classIdentifier(className);
-
-        throw new UnexpectedCallException(className);
-
-    }
-
-    @Override
-    public void markAsService() {}
-
-    @Override
-    public void introspect(final FacetDecoratorSet decorator) {
-        fields = Collections.emptyList();
-        superClassSpecification = null;
-        
-        setIntrospected(true);
-    }
-
-    @Override
-    public String getTitle(final ObjectAdapter adapter) {
-        return "no title";
-    }
-
-    @Override
-    public String getShortName() {
-        return name;
-    }
-
-    @Override
-    public String getSingularName() {
-        return name;
-    }
-
-    @Override
-    public String getPluralName() {
-        return name;
-    }
-
-    @Override
-    public String getDescription() {
-        return name;
-    }
-
-    @Override
-    public ObjectAssociation getAssociation(final String name) {
-        return null;
-    }
-
-    @Override
-    public List<ObjectAction> getObjectActions(final ObjectActionType... type) {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public ObjectAction getObjectAction(
-            final ObjectActionType type,
-            final String id,
-            final List<ObjectSpecification> parameters) {
-        return null;
-    }
-
-    @Override
-    public ObjectAction getObjectAction(final ObjectActionType type, final String id) {
-        return null;
-    }
-
-    @Override
-    public Consent isValid(final ObjectAdapter transientObject) {
-        return Veto.DEFAULT;
-    }
-
-    @Override
-    public Persistability persistability() {
-        return Persistability.TRANSIENT;
-    }
-
-    public void debugData(final DebugString debug) {
-        debug.append("There are no reflective actions");
-    }
-
-    public String debugTitle() {
-        return "NO Member Specification";
-    }
-
-    /**
-     * Does nothing, but should never be called.
-     */
-    public InteractionContext createPersistInteractionContext(
-            final AuthenticationSession session,
-            final boolean programmatic,
-            final ObjectAdapter targetObjectAdapter) {
-        return null;
-    }
-
-}
+
+/**
+ * A simple implementation used for objects that have no members (fields or actions). Used for primitives and as a
+ * fall-back if no specification can be otherwise generated.
+ */
+public class ObjectSpecificationNoMember extends IntrospectableSpecificationAbstract {
+    private final String name;
+
+    public ObjectSpecificationNoMember(final String className,
+        final AuthenticationSessionProvider authenticationSessionProvider, final ObjectInstantiator objectInstantiator) {
+        super(authenticationSessionProvider, null, objectInstantiator);
+        this.fullName = className;
+        this.name = NameUtils.simpleName(className.substring(className.lastIndexOf('.') + 1));
+        identifier = Identifier.classIdentifier(className);
+
+        throw new UnexpectedCallException(className);
+
+    }
+
+    @Override
+    public void markAsService() {
+    }
+
+    @Override
+    public void introspect(final FacetDecoratorSet decorator) {
+        fields = Collections.emptyList();
+        superClassSpecification = null;
+
+        setIntrospected(true);
+    }
+
+    @Override
+    public String getTitle(final ObjectAdapter adapter) {
+        return "no title";
+    }
+
+    @Override
+    public String getShortName() {
+        return name;
+    }
+
+    @Override
+    public String getSingularName() {
+        return name;
+    }
+
+    @Override
+    public String getPluralName() {
+        return name;
+    }
+
+    @Override
+    public String getDescription() {
+        return name;
+    }
+
+    @Override
+    public ObjectAssociation getAssociation(final String name) {
+        return null;
+    }
+
+    @Override
+    public List<ObjectAction> getObjectActions(final ObjectActionType... type) {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public ObjectAction getObjectAction(final ObjectActionType type, final String id,
+        final List<ObjectSpecification> parameters) {
+        return null;
+    }
+
+    @Override
+    public ObjectAction getObjectAction(final ObjectActionType type, final String id) {
+        return null;
+    }
+
+    @Override
+    public Consent isValid(final ObjectAdapter transientObject) {
+        return Veto.DEFAULT;
+    }
+
+    @Override
+    public Persistability persistability() {
+        return Persistability.TRANSIENT;
+    }
+
+    public void debugData(final DebugString debug) {
+        debug.append("There are no reflective actions");
+    }
+
+    public String debugTitle() {
+        return "NO Member Specification";
+    }
+
+    /**
+     * Does nothing, but should never be called.
+     */
+    public InteractionContext createPersistInteractionContext(final AuthenticationSession session,
+        final boolean programmatic, final ObjectAdapter targetObjectAdapter) {
+        return null;
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectActionSet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectActionSet.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectActionSet.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectActionSet.java Tue Dec 21 12:06:15 2010
@@ -37,7 +37,6 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.interactions.ActionInvocationContext;
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.Target;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
@@ -50,17 +49,14 @@ public class ObjectActionSet implements 
     private final String name;
     private final String id;
     private final List<ObjectAction> actions;
-	private final RuntimeContext runtimeContext;
 	
     public ObjectActionSet(
     		final String id, 
     		final String name, 
-    		final List<ObjectAction> actions, 
-    		final RuntimeContext runtimeContext) {
+    		final List<ObjectAction> actions) {
         this.id = id;
         this.name = name;
         this.actions = actions;
-        this.runtimeContext = runtimeContext;
     }
 
     @Override
@@ -369,15 +365,5 @@ public class ObjectActionSet implements 
         ObjectAction specification = this;
         return adapter.getInstance(specification);
     }
-
-    
-    // /////////////////////////////////////////////////////////////
-    // RuntimeContext
-    // /////////////////////////////////////////////////////////////
-
-	public RuntimeContext getRuntimeContext() {
-		return runtimeContext;
-	}
 
-
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectAssociationAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectAssociationAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectAssociationAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectAssociationAbstract.java Tue Dec 21 12:06:15 2010
@@ -25,7 +25,10 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacet;
 import org.apache.isis.core.metamodel.facets.properties.choices.PropertyChoicesFacet;
 import org.apache.isis.core.metamodel.facets.propparam.validate.mandatory.MandatoryFacet;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.identifier.Identified;
@@ -41,8 +44,11 @@ public abstract class ObjectAssociationA
             final ObjectSpecification specification,
             final FeatureType memberType,
             final Identified facetHolder, 
-            final RuntimeContext runtimeContext) {
-        super(associationId, facetHolder, memberType, runtimeContext);
+            final AuthenticationSessionProvider authenticationSessionProvider,
+            final SpecificationLookup specificationLookup,
+            final AdapterMap adapterManager,
+            final QuerySubmitter querySubmitter) {
+        super(associationId, facetHolder, memberType, authenticationSessionProvider, specificationLookup, adapterManager, querySubmitter);
         if (specification == null) {
             throw new IllegalArgumentException("field type for '" + associationId + "' must exist");
         }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectMemberAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectMemberAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectMemberAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/spec/feature/ObjectMemberAbstract.java Tue Dec 21 12:06:15 2010
@@ -38,26 +38,39 @@ import org.apache.isis.core.metamodel.in
 import org.apache.isis.core.metamodel.interactions.InteractionUtils;
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
 import org.apache.isis.core.metamodel.spec.identifier.Identified;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
 import org.apache.isis.core.metamodel.util.NameUtils;
 
 
 public abstract class ObjectMemberAbstract implements ObjectMember {
 
+    public static ObjectSpecification getSpecification(final SpecificationLookup specificationLookup, final Class<?> type) {
+        return type == null ? null : specificationLookup.loadSpecification(type);
+    }
+
     protected final String defaultName;
     private final String id;
     private final Identified facetHolder;
     private final FeatureType featureType;
-	private RuntimeContext runtimeContext;
+    private final AuthenticationSessionProvider authenticationSessionProvider;
+    private final SpecificationLookup specificationLookup;
+    private final AdapterMap adapterMap;
+    private final QuerySubmitter querySubmitter;
 
     protected ObjectMemberAbstract(
     		final String id, 
     		final Identified facetHolder, 
     		final FeatureType memberType, 
-    		final RuntimeContext runtimeContext) {
+            final AuthenticationSessionProvider authenticationSessionProvider,
+    		final SpecificationLookup specificationLookup,
+            final AdapterMap adapterManager,
+            final QuerySubmitter querySubmitter) {
         if (id == null) {
             throw new IllegalArgumentException("Name must always be set");
         }
@@ -65,7 +78,10 @@ public abstract class ObjectMemberAbstra
         this.defaultName = NameUtils.naturalName(id);
         this.facetHolder = facetHolder;
         this.featureType = memberType;
-        this.runtimeContext = runtimeContext;
+        this.authenticationSessionProvider = authenticationSessionProvider;
+        this.specificationLookup = specificationLookup;
+        this.adapterMap = adapterManager;
+        this.querySubmitter = querySubmitter;
     }
 
 
@@ -238,6 +254,18 @@ public abstract class ObjectMemberAbstra
         return featureType.isProperty();
     }
 
+    // //////////////////////////////////////////////////////////////////
+    // Convenience
+    // //////////////////////////////////////////////////////////////////
+
+    /**
+     * The current {@link AuthenticationSession} (can change over time so
+     * do not cache).
+     */
+    protected AuthenticationSession getAuthenticationSession() {
+        return authenticationSessionProvider.getAuthenticationSession();
+    }
+
 
     // //////////////////////////////////////////////////////////////////
     // toString
@@ -247,23 +275,26 @@ public abstract class ObjectMemberAbstra
     public String toString() {
         return String.format("id=%s,name='%s'", getId(), getName());
     }
-    
+
+
     // //////////////////////////////////////////////////////////////////
     // Dependencies
     // //////////////////////////////////////////////////////////////////
 
-    public RuntimeContext getRuntimeContext() {
-    	return runtimeContext;
+    public AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        return authenticationSessionProvider;
     }
     
-    protected AuthenticationSession getAuthenticationSession() {
-        return getRuntimeContext().getAuthenticationSession();
+    public SpecificationLookup getSpecificationLookup() {
+        return specificationLookup;
     }
-
-    protected SpecificationLoader getSpecificationLoader() {
-        return getRuntimeContext().getSpecificationLoader();
+    
+    public AdapterMap getAdapterMap() {
+        return adapterMap;
     }
 
-    
+    public QuerySubmitter getQuerySubmitter() {
+        return querySubmitter;
+    }
 
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java Tue Dec 21 12:06:15 2010
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.services.container;
 
 import java.util.ArrayList;
@@ -35,30 +34,51 @@ import org.apache.isis.core.commons.ensu
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.consent.InteractionResult;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContextAware;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProviderAware;
+import org.apache.isis.core.metamodel.runtimecontext.DomainObjectServices;
+import org.apache.isis.core.metamodel.runtimecontext.DomainObjectServicesAware;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMapAware;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectDirtier;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectDirtierAware;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectPersistor;
+import org.apache.isis.core.metamodel.runtimecontext.ObjectPersistorAware;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitterAware;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookupAware;
 import org.apache.isis.core.metamodel.services.container.query.QueryFindByPattern;
 import org.apache.isis.core.metamodel.services.container.query.QueryFindByTitle;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.util.IsisUtils;
 
+public class DomainObjectContainerDefault implements DomainObjectContainer, QuerySubmitterAware, ObjectDirtierAware,
+    DomainObjectServicesAware, ObjectPersistorAware, SpecificationLookupAware, AuthenticationSessionProviderAware, AdapterMapAware {
+
+    private ObjectDirtier objectDirtier;
+    private ObjectPersistor objectPersistor;
+    private QuerySubmitter querySubmitter;
+    private SpecificationLookup specificationLookup;
+    private DomainObjectServices domainObjectServices;
+    private AuthenticationSessionProvider authenticationSessionProvider;
+    private AdapterMap adapterMap;
 
-public class DomainObjectContainerDefault implements DomainObjectContainer, RuntimeContextAware {
-	
-	private RuntimeContext runtimeContext;
+    public DomainObjectContainerDefault() {
 
+    }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // newInstance, disposeInstance
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
-	/**
+    /**
      * @see #doCreateTransientInstance(ObjectSpecification)
      */
     @Override
     @SuppressWarnings("unchecked")
     public <T> T newTransientInstance(final Class<T> ofClass) {
-        final ObjectSpecification spec = getRuntimeContext().getSpecificationLoader().loadSpecification(ofClass);
+        final ObjectSpecification spec = getSpecificationLookup().loadSpecification(ofClass);
         final ObjectAdapter adapter = doCreateTransientInstance(spec);
         return (T) adapter.getObject();
     }
@@ -89,7 +109,7 @@ public class DomainObjectContainerDefaul
      * Factored out as a potential hook method for subclasses.
      */
     protected ObjectAdapter doCreateTransientInstance(final ObjectSpecification spec) {
-    	return getRuntimeContext().createTransientInstance(spec);
+        return getDomainObjectServices().createTransientInstance(spec);
     }
 
     @Override
@@ -97,14 +117,14 @@ public class DomainObjectContainerDefaul
         if (persistentObject == null) {
             throw new IllegalArgumentException("Must specify a reference for disposing an object");
         }
-        final ObjectAdapter adapter = getRuntimeContext().getAdapterFor(persistentObject);
+        final ObjectAdapter adapter = getAdapterMap().getAdapterFor(persistentObject);
         if (!isPersistent(persistentObject)) {
             throw new RepositoryException("Object not persistent: " + adapter);
         }
-        
-        getRuntimeContext().remove(adapter);
+
+        getObjectPersistor().remove(adapter);
     }
-    
+
     @Override
     public void removeIfNotAlready(final Object object) {
         if (!isPersistent(object)) {
@@ -113,77 +133,74 @@ public class DomainObjectContainerDefaul
         remove(object);
     }
 
-
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // resolve, objectChanged
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
     @Override
     public void resolve(final Object parent) {
-    	runtimeContext.resolve(parent);
+        getDomainObjectServices().resolve(parent);
     }
 
     @Override
     public void resolve(final Object parent, final Object field) {
-    	runtimeContext.resolve(parent, field);
+        getDomainObjectServices().resolve(parent, field);
     }
 
     @Override
     public void objectChanged(final Object object) {
-    	runtimeContext.objectChanged(object);
+        getObjectDirtier().objectChanged(object);
     }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // flush, commit
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
     @Override
     public boolean flush() {
-    	return runtimeContext.flush();
+        return getDomainObjectServices().flush();
     }
 
     @Override
     public void commit() {
-    	runtimeContext.commit();
+        getDomainObjectServices().commit();
     }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // isValid, validate
-    ////////////////////////////////////////////////////////////////////
-
+    // //////////////////////////////////////////////////////////////////
 
-	@Override
+    @Override
     public boolean isValid(final Object domainObject) {
-		return validate(domainObject) == null;
-	}
+        return validate(domainObject) == null;
+    }
 
-	@Override
+    @Override
     public String validate(final Object domainObject) {
-		final ObjectAdapter adapter = getRuntimeContext().adapterFor(domainObject);
-		InteractionResult validityResult = adapter.getSpecification().isValidResult(adapter);
-		return validityResult.getReason();
-	}
-
+        final ObjectAdapter adapter = getAdapterMap().adapterFor(domainObject);
+        InteractionResult validityResult = adapter.getSpecification().isValidResult(adapter);
+        return validityResult.getReason();
+    }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // persistence
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
     @Override
     public boolean isPersistent(final Object domainObject) {
-        final ObjectAdapter adapter = getRuntimeContext().adapterFor(domainObject);
+        final ObjectAdapter adapter = getAdapterMap().adapterFor(domainObject);
         return adapter.isPersistent();
     }
 
     @Override
     public void persist(final Object transientObject) {
-        final ObjectAdapter adapter = getRuntimeContext().getAdapterFor(transientObject);
+        final ObjectAdapter adapter = getAdapterMap().getAdapterFor(transientObject);
         if (isPersistent(transientObject)) {
             throw new PersistFailedException("Object already persistent: " + adapter);
         }
-        getRuntimeContext().makePersistent(adapter);
+        getObjectPersistor().makePersistent(adapter);
     }
-    
+
     @Override
     public void persistIfNotAlready(final Object object) {
         if (isPersistent(object)) {
@@ -192,13 +209,13 @@ public class DomainObjectContainerDefaul
         persist(object);
     }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // security
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
     @Override
     public UserMemento getUser() {
-        final AuthenticationSession session = getRuntimeContext().getAuthenticationSession();
+        final AuthenticationSession session = getAuthenticationSessionProvider().getAuthenticationSession();
 
         final String name = session.getUserName();
         final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());
@@ -210,20 +227,20 @@ public class DomainObjectContainerDefaul
     private List<RoleMemento> asRoleMementos(List<String> roles) {
         List<RoleMemento> mementos = new ArrayList<RoleMemento>();
         if (roles != null) {
-            for(String role: roles) {
+            for (String role : roles) {
                 mementos.add(new RoleMemento(role));
             }
         }
         return mementos;
     }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // properties
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
     @Override
     public String getProperty(String name) {
-        return runtimeContext.getProperty(name) ;
+        return getDomainObjectServices().getProperty(name);
     }
 
     @Override
@@ -231,54 +248,53 @@ public class DomainObjectContainerDefaul
         String value = getProperty(name);
         return value == null ? defaultValue : value;
     }
-    
+
     @Override
     public List<String> getPropertyNames() {
-        return runtimeContext.getPropertyNames() ;
+        return getDomainObjectServices().getPropertyNames();
     }
-    
-    ////////////////////////////////////////////////////////////////////
+
+    // //////////////////////////////////////////////////////////////////
     // info, warn, error messages
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
     @Override
     public void informUser(final String message) {
-        getRuntimeContext().informUser(message);
+        getDomainObjectServices().informUser(message);
     }
 
     @Override
     public void raiseError(final String message) {
-    	getRuntimeContext().raiseError(message);
+        getDomainObjectServices().raiseError(message);
     }
 
     @Override
     public void warnUser(final String message) {
-    	getRuntimeContext().warnUser(message);
+        getDomainObjectServices().warnUser(message);
     }
 
-    
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // allInstances, allMatches
-    ////////////////////////////////////////////////////////////////////
-    
-	@Override
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
     public <T> List<T> allInstances(final Class<T> type) {
         return allMatches(new QueryFindAllInstances<T>(type));
     }
 
-	@Override
+    @Override
     public <T> List<T> allMatches(final Class<T> cls, final Filter<T> filter) {
-		final List<T> allInstances = allInstances(cls);
-		final List<T> filtered = new ArrayList<T>();
-		for (T instance: allInstances) {
-			if (filter.accept(instance)) {
-				filtered.add(instance);
-			}
-		}
-		return filtered;
-	}
+        final List<T> allInstances = allInstances(cls);
+        final List<T> filtered = new ArrayList<T>();
+        for (T instance : allInstances) {
+            if (filter.accept(instance)) {
+                filtered.add(instance);
+            }
+        }
+        return filtered;
+    }
 
-	@Override
+    @Override
     public <T> List<T> allMatches(final Class<T> type, final T pattern) {
         Assert.assertTrue("pattern not compatible with type", type.isAssignableFrom(pattern.getClass()));
         return allMatches(new QueryFindByPattern<T>(type, pattern));
@@ -291,25 +307,25 @@ public class DomainObjectContainerDefaul
 
     @Override
     public <T> List<T> allMatches(final Query<T> query) {
-        List<ObjectAdapter> allMatching = getRuntimeContext().allMatchingQuery(query);
-		return IsisUtils.unwrap(allMatching);
+        List<ObjectAdapter> allMatching = getQuerySubmitter().allMatchingQuery(query);
+        return IsisUtils.unwrap(allMatching);
     }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // firstMatch
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
-	@Override
+    @Override
     public <T> T firstMatch(final Class<T> cls, final Filter<T> filter) {
-		final List<T> allInstances = allInstances(cls);
-		for (T instance: allInstances) {
-			if (filter.accept(instance)) {
-				return instance;
-			}
-		}
-		return null;
-	}
-    
+        final List<T> allInstances = allInstances(cls);
+        for (T instance : allInstances) {
+            if (filter.accept(instance)) {
+                return instance;
+            }
+        }
+        return null;
+    }
+
     @Override
     public <T> T firstMatch(final Class<T> type, final T pattern) {
         final List<T> instances = allMatches(type, pattern);
@@ -324,24 +340,23 @@ public class DomainObjectContainerDefaul
 
     @Override
     @SuppressWarnings("unchecked")
-	public <T> T firstMatch(final Query<T> query) {
-        ObjectAdapter firstMatching = getRuntimeContext().firstMatchingQuery(query);
+    public <T> T firstMatch(final Query<T> query) {
+        ObjectAdapter firstMatching = getQuerySubmitter().firstMatchingQuery(query);
         return (T) IsisUtils.unwrap(firstMatching);
     }
 
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
     // uniqueMatch
-    ////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////
 
-	@Override
+    @Override
     public <T> T uniqueMatch(final Class<T> type, final Filter<T> filter) {
-		final List<T> instances = allMatches(type, filter);
-		if (instances.size() > 1) {
-			throw new RepositoryException(
-					"Found more than one instance of " + type + " matching filter " + filter);
-		}
-		return firstInstanceElseNull(instances);
-	}
+        final List<T> instances = allMatches(type, filter);
+        if (instances.size() > 1) {
+            throw new RepositoryException("Found more than one instance of " + type + " matching filter " + filter);
+        }
+        return firstInstanceElseNull(instances);
+    }
 
     @Override
     public <T> T uniqueMatch(final Class<T> type, final T pattern) {
@@ -374,29 +389,70 @@ public class DomainObjectContainerDefaul
         return instances.size() == 0 ? null : instances.get(0);
     }
 
+    // //////////////////////////////////////////////////////////////////
+    // Dependencies
+    // //////////////////////////////////////////////////////////////////
+
+    protected QuerySubmitter getQuerySubmitter() {
+        return querySubmitter;
+    }
+
+    @Override
+    public void setQuerySubmitter(QuerySubmitter querySubmitter) {
+        this.querySubmitter = querySubmitter;
+    }
+
+    protected DomainObjectServices getDomainObjectServices() {
+        return domainObjectServices;
+    }
+
+    @Override
+    public void setDomainObjectServices(DomainObjectServices domainObjectServices) {
+        this.domainObjectServices = domainObjectServices;
+    }
+
+    protected SpecificationLookup getSpecificationLookup() {
+        return specificationLookup;
+    }
+
+    @Override
+    public void setSpecificationLookup(SpecificationLookup specificationLookup) {
+        this.specificationLookup = specificationLookup;
+    }
+
+    protected AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        return authenticationSessionProvider;
+    }
+
+    @Override
+    public void setAuthenticationSessionProvider(AuthenticationSessionProvider authenticationSessionProvider) {
+        this.authenticationSessionProvider = authenticationSessionProvider;
+    }
+
+    protected AdapterMap getAdapterMap() {
+        return adapterMap;
+    }
+
+    @Override
+    public void setAdapterMap(AdapterMap adapterManager) {
+        this.adapterMap = adapterManager;
+    }
 
-    
-    ////////////////////////////////////////////////////////////////////
-    // Dependencies (due to being RuntimeContextAware)
-    ////////////////////////////////////////////////////////////////////
-	
-	/**
-	 * The {@link RuntimeContext}, as provided by the constructor.
-	 * 
-	 * <p>
-	 * Not API.
-	 */
-	public RuntimeContext getRuntimeContext() {
-		return runtimeContext;
-	}
-
-	@Override
-    public void setRuntimeContext(RuntimeContext runtimeContext) {
-		this.runtimeContext = runtimeContext;
-		runtimeContext.setContainer(this);
-	}
-	
+    protected ObjectDirtier getObjectDirtier() {
+        return objectDirtier;
+    }
 
+    @Override
+    public void setObjectDirtier(ObjectDirtier objectDirtier) {
+        this.objectDirtier = objectDirtier;
+    }
 
+    protected ObjectPersistor getObjectPersistor() {
+        return objectPersistor;
+    }
 
+    @Override
+    public void setObjectPersistor(ObjectPersistor objectPersistor) {
+        this.objectPersistor = objectPersistor;
+    }
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/identifier/Util.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/identifier/Util.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/identifier/Util.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/identifier/Util.java Tue Dec 21 12:06:15 2010
@@ -21,7 +21,6 @@ import java.util.List;
 
 import com.google.inject.internal.Lists;
 
-import org.apache.isis.applib.Identifier;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.FeatureType;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
@@ -30,7 +29,7 @@ import org.apache.isis.core.metamodel.sp
 
 public class Util {
 
-    public static List<TypedHolder> getParamPeers(final Method actionMethod, SpecificationLoader specificationLoader) {
+    public static List<TypedHolder> getParamPeers(final Method actionMethod) {
         final Class<?>[] parameterTypes = actionMethod.getParameterTypes();
         final int numParameters = parameterTypes.length;
         final List<TypedHolder> actionParams = Lists.newArrayList();

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorAbstract.java Tue Dec 21 12:06:15 2010
@@ -321,9 +321,8 @@ public abstract class ObjectReflectorAbs
 
 	private ObjectSpecification internalLoadSpecification(final Class<?> type) {
 		Class<?> substitutedType = getClassSubstitutor().getClass(type);
-		ObjectSpecification objectSpecification = substitutedType != null ? loadSpecificationForSubstitutedClass(substitutedType)
+		return substitutedType != null ? loadSpecificationForSubstitutedClass(substitutedType)
 				: null;
-		return objectSpecification;
 	}
 
 	private ObjectSpecification loadSpecificationForSubstitutedClass(

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoader.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoader.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoader.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoader.java Tue Dec 21 12:06:15 2010
@@ -23,19 +23,15 @@ package org.apache.isis.core.metamodel.s
 import java.util.List;
 
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
-import org.apache.isis.core.commons.components.Injectable;
 import org.apache.isis.core.commons.debug.DebugInfo;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 
 
-public interface SpecificationLoader extends ApplicationScopedComponent, Injectable, DebugInfo {
+public interface SpecificationLoader extends ApplicationScopedComponent, DebugInfo, SpecificationLookup {
 
     ObjectSpecification[] allSpecifications();
 
-    /**
-     * @see #loadSpecification(String)
-     */
-    ObjectSpecification loadSpecification(Class<?> cls);
 
     /**
      * Return the specification for the specified class of object.

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionImpl.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionImpl.java Tue Dec 21 12:06:15 2010
@@ -53,7 +53,11 @@ import org.apache.isis.core.metamodel.in
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.ValidityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesProvider;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.FeatureType;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.ObjectMemberAbstract;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -77,7 +81,9 @@ public class ObjectActionImpl extends Ob
     	return type;
     }
 
+    private final ServicesProvider servicesProvider;
     private final ObjectMemberPeer memberPeer;
+    
     /**
      * Lazily initialized by {@link #getParameters()} (so don't use directly!)
      */
@@ -101,9 +107,14 @@ public class ObjectActionImpl extends Ob
     public ObjectActionImpl(
     		final String methodId, 
     		final ObjectMemberPeer memberPeer, 
-    		final RuntimeContext runtimeContext) {
-        super(methodId, memberPeer, FeatureType.ACTION, runtimeContext);
+            final AuthenticationSessionProvider authenticationSessionProvider,
+            final SpecificationLookup specificationLookup, 
+            final AdapterMap adapterManager,
+            final ServicesProvider servicesProvider,
+            final QuerySubmitter querySubmitter) {
+        super(methodId, memberPeer, FeatureType.ACTION, authenticationSessionProvider, specificationLookup, adapterManager, querySubmitter);
         this.memberPeer = memberPeer;
+        this.servicesProvider = servicesProvider;
     }
 
     // //////////////////////////////////////////////////////////////////
@@ -232,7 +243,7 @@ public class ObjectActionImpl extends Ob
             final List<TypedHolder> paramPeers = memberPeer.getChildren();
             for (int i = 0; i < parameterCount; i++) {
                 TypedHolder paramPeer = paramPeers.get(i);
-                final ObjectSpecification specification = paramPeer.getSpecification(getSpecificationLoader());
+                final ObjectSpecification specification = ObjectMemberAbstract.getSpecification(getSpecificationLookup(), paramPeer.getType());
                 if (specification.isParseable()) {
                     parameters.add(new ObjectActionParameterParseable(i, this, paramPeer));
                 } else if (specification.isNotCollection()) {
@@ -397,7 +408,7 @@ public class ObjectActionImpl extends Ob
     }
 
     private ObjectAdapter findService() {
-        final List<ObjectAdapter> services = getRuntimeContext().getServices();
+        final List<ObjectAdapter> services = getServicesProvider().getServices();
         for (ObjectAdapter serviceAdapter : services) {
             if (serviceAdapter.getSpecification() == getOnType()) {
                 return serviceAdapter;
@@ -439,7 +450,7 @@ public class ObjectActionImpl extends Ob
             } 
             for (int i = 0; i < parameterCount; i++) {
                 if (parameterDefaultPojos[i] != null) {
-                     ObjectSpecification componentSpec = getRuntimeContext().getSpecificationLoader().loadSpecification(
+                     ObjectSpecification componentSpec = getSpecificationLookup().loadSpecification(
                             parameterDefaultPojos[i].getClass());
                     ObjectSpecification parameterSpec = parameters.get(i).getSpecification();
                     if (!componentSpec.isOfType(parameterSpec)) {
@@ -481,7 +492,7 @@ public class ObjectActionImpl extends Ob
     }
 
     private ObjectAdapter adapterFor(final Object pojo) {
-        return pojo == null ? null : getRuntimeContext().adapterFor(pojo);
+        return pojo == null ? null : getAdapterMap().adapterFor(pojo);
     }
 
 
@@ -530,14 +541,14 @@ public class ObjectActionImpl extends Ob
             final ObjectSpecification paramSpec = parameters.get(i).getSpecification();
 
             if (parameterChoicesPojos[i] != null && parameterChoicesPojos[i].length > 0) {
-                ObjectActionParameterAbstract.checkChoicesType(getRuntimeContext(), parameterChoicesPojos[i], paramSpec);
+                ObjectActionParameterAbstract.checkChoicesType(getSpecificationLookup(), parameterChoicesPojos[i], paramSpec);
                 parameterChoicesAdapters[i] = new ObjectAdapter[parameterChoicesPojos[i].length];
                 for (int j = 0; j < parameterChoicesPojos[i].length; j++) {
                     parameterChoicesAdapters[i][j] = adapterFor(parameterChoicesPojos[i][j]);
                 }
             } else if (SpecificationFacets.isBoundedSet(paramSpec)) {
                 QueryFindAllInstances query = new QueryFindAllInstances(paramSpec.getFullName());
-				final List<ObjectAdapter> allInstancesAdapter = getRuntimeContext().allMatchingQuery(query);
+				final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
                 parameterChoicesAdapters[i] = new ObjectAdapter[allInstancesAdapter.size()];
                 int j = 0;
                 for(ObjectAdapter adapter: allInstancesAdapter) {
@@ -589,9 +600,13 @@ public class ObjectActionImpl extends Ob
         return sb.toString();
     }
 
-
-
-
-
-
+    
+    //////////////////////////////////////////////////////
+    // Dependencies (from constructor)
+    //////////////////////////////////////////////////////
+    
+    public ServicesProvider getServicesProvider() {
+        return servicesProvider;
+    }
+    
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterAbstract.java Tue Dec 21 12:06:15 2010
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.query.Query;
 import org.apache.isis.applib.query.QueryFindAllInstances;
 import org.apache.isis.core.commons.filters.Filter;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -40,7 +41,11 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.naming.named.NamedFacet;
 import org.apache.isis.core.metamodel.facets.propparam.validate.mandatory.MandatoryFacet;
 import org.apache.isis.core.metamodel.interactions.ActionArgumentContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
+import org.apache.isis.core.metamodel.runtimecontext.spec.feature.ObjectMemberAbstract;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationFacets;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
@@ -94,7 +99,7 @@ public abstract class ObjectActionParame
 
     @Override
     public ObjectSpecification getSpecification() {
-        return peer.getSpecification(getRuntimeContext().getSpecificationLoader());
+        return ObjectMemberAbstract.getSpecification(getSpecificationLookup(), peer.getType());
     }
 
     @Override
@@ -106,7 +111,7 @@ public abstract class ObjectActionParame
     public String getName() {
         final NamedFacet facet = getFacet(NamedFacet.class);
         String name = facet == null ? null : facet.value();
-        name = name == null ? peer.getSpecification(getRuntimeContext().getSpecificationLoader()).getSingularName() : name;
+        name = name == null ? getSpecification().getSingularName() : name;
         return name;
     }
 
@@ -201,14 +206,14 @@ public abstract class ObjectActionParame
 
         if (choicesFacet != null) {
             Object[] choices = choicesFacet.getChoices(parentAction.realTarget(adapter));
-            checkChoicesType(getRuntimeContext(), choices, getSpecification());
+            checkChoicesType(getSpecificationLookup(), choices, getSpecification());
             for (Object choice : choices) {
-                parameterChoices.add(getRuntimeContext().adapterFor(choice));
+                parameterChoices.add(getAdapterMap().adapterFor(choice));
             }
         }
         if (parameterChoices.size() == 0 && SpecificationFacets.isBoundedSet(getSpecification())) {
-            QueryFindAllInstances query = new QueryFindAllInstances(getSpecification().getFullName());
-			final List<ObjectAdapter> allInstancesAdapter = getRuntimeContext().allMatchingQuery(query);
+            Query query = new QueryFindAllInstances(getSpecification().getFullName());
+			final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
             for (ObjectAdapter choiceAdapter: allInstancesAdapter) {
                 parameterChoices.add(choiceAdapter);
             }
@@ -216,9 +221,9 @@ public abstract class ObjectActionParame
         return parameterChoices.toArray(new ObjectAdapter[0]);
     }
 
-    protected static void checkChoicesType(RuntimeContext runtimeContext, Object[] objects, ObjectSpecification paramSpec) {
+    protected static void checkChoicesType(SpecificationLookup specificationLookup, Object[] objects, ObjectSpecification paramSpec) {
         for (Object object : objects) {
-            ObjectSpecification componentSpec = runtimeContext.getSpecificationLoader().loadSpecification(object.getClass());
+            ObjectSpecification componentSpec = specificationLookup.loadSpecification(object.getClass());
             if (!componentSpec.isOfType(paramSpec)) {
                 throw new ModelException("Choice type incompatible with parameter type; expected " + paramSpec.getFullName() + ", but was " + componentSpec.getFullName());
             }
@@ -240,22 +245,36 @@ public abstract class ObjectActionParame
             	// is unable to return a default.
             	return null;
             }
-			return getRuntimeContext().adapterFor(dflt);
+			return getAdapterMap().adapterFor(dflt);
         }
         return null;
     }
     
-    
+
+    protected AuthenticationSession getAuthenticationSession() {
+        return getAuthenticationSessionProvider().getAuthenticationSession();
+    }
+
     // /////////////////////////////////////////////////////////////
-    // Dependencies (from context)
+    // Dependencies (from parent)
     // /////////////////////////////////////////////////////////////
 
-    protected RuntimeContext getRuntimeContext() {
-        return parentAction.getRuntimeContext();
-    }
-
-    protected AuthenticationSession getAuthenticationSession() {
-        return getRuntimeContext().getAuthenticationSession();
-    }
+    protected SpecificationLookup getSpecificationLookup() {
+        return parentAction.getSpecificationLookup();
+    }
+
+    protected AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        return parentAction.getAuthenticationSessionProvider();
+    }
+
+    protected AdapterMap getAdapterMap() {
+        return parentAction.getAdapterMap();
+    }
+
+    protected QuerySubmitter getQuerySubmitter() {
+        return parentAction.getQuerySubmitter();
+    }
+
+    
 
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterParseable.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterParseable.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterParseable.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/ObjectActionParameterParseable.java Tue Dec 21 12:06:15 2010
@@ -149,7 +149,7 @@ public class ObjectActionParameterParsea
     public ObjectAdapter get(ObjectAdapter owner) {
         MutableProposedHolder proposedHolder = getProposedHolder(owner);
         Object proposed = proposedHolder.getProposed();
-        return getRuntimeContext().adapterFor(proposed);
+        return getAdapterMap().adapterFor(proposed);
     }
 
     /**

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToManyAssociationImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToManyAssociationImpl.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToManyAssociationImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToManyAssociationImpl.java Tue Dec 21 12:06:15 2010
@@ -42,7 +42,10 @@ import org.apache.isis.core.metamodel.in
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.ValidityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.FeatureType;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.ObjectAssociationAbstract;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
@@ -53,14 +56,18 @@ import org.apache.isis.core.metamodel.ut
 public class OneToManyAssociationImpl extends ObjectAssociationAbstract implements OneToManyAssociation {
 
     private final ObjectMemberPeer reflectiveAdapter;
-
+    
     public OneToManyAssociationImpl(
-    		final ObjectMemberPeer association, 
-    		final RuntimeContext runtimeContext) {
-        super(association.getIdentifier().getMemberName(), association.getSpecification(runtimeContext.getSpecificationLoader()), FeatureType.COLLECTION, association, runtimeContext);
+    		final ObjectMemberPeer association,
+            final AuthenticationSessionProvider authenticationSessionProvider,
+    		final SpecificationLookup specificationLookup,
+    		final AdapterMap adapterManager,
+            final QuerySubmitter querySubmitter) {
+        super(association.getIdentifier().getMemberName(), getSpecification(specificationLookup, association.getType()), FeatureType.COLLECTION, association, authenticationSessionProvider, specificationLookup, adapterManager, querySubmitter);
         this.reflectiveAdapter = association;
     }
 
+
     public ObjectMemberPeer getAssociationPeer(){
     	return reflectiveAdapter;
     }
@@ -163,11 +170,12 @@ public class OneToManyAssociationImpl ex
         if (collection == null) {
             return null;
         }
-        return getRuntimeContext().adapterFor(collection, ownerAdapter, this);
+        return getAdapterMap().adapterFor(collection, ownerAdapter, this);
     }
 
 
 
+
     @Override
     public boolean isEmpty(final ObjectAdapter parentAdapter) {
         // REVIEW should we be able to determine if a collection is empty without loading it?

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneActionParameterImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneActionParameterImpl.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneActionParameterImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneActionParameterImpl.java Tue Dec 21 12:06:15 2010
@@ -77,7 +77,7 @@ public class OneToOneActionParameterImpl
     public ObjectAdapter get(ObjectAdapter owner) {
         MutableProposedHolder proposedHolder = getProposedHolder(owner);
         Object proposed = proposedHolder.getProposed();
-        return getRuntimeContext().adapterFor(proposed);
+        return getAdapterMap().adapterFor(proposed);
     }
 
     /**

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneAssociationImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneAssociationImpl.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneAssociationImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/internal/OneToOneAssociationImpl.java Tue Dec 21 12:06:15 2010
@@ -47,7 +47,10 @@ import org.apache.isis.core.metamodel.in
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.ValidityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.QuerySubmitter;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.FeatureType;
 import org.apache.isis.core.metamodel.runtimecontext.spec.feature.ObjectAssociationAbstract;
 import org.apache.isis.core.metamodel.spec.SpecificationFacets;
@@ -61,8 +64,11 @@ public class OneToOneAssociationImpl ext
 
     public OneToOneAssociationImpl(
     		final ObjectMemberPeer association, 
-    		final RuntimeContext runtimeContext) {
-        super(association.getIdentifier().getMemberName(), association.getSpecification(runtimeContext.getSpecificationLoader()), FeatureType.PROPERTY, association, runtimeContext);
+            final AuthenticationSessionProvider authenticationSessionProvider,
+            final SpecificationLookup specificationLookup,
+            final AdapterMap adapterManager,
+            final QuerySubmitter querySubmitter) {
+        super(association.getIdentifier().getMemberName(), getSpecification(specificationLookup, association.getType()), FeatureType.PROPERTY, association, authenticationSessionProvider, specificationLookup, adapterManager, querySubmitter);
         this.associationPeer = association;
     }
 
@@ -143,7 +149,7 @@ public class OneToOneAssociationImpl ext
             return null;
         }
         
-        return getRuntimeContext().adapterFor(referencedPojo, ownerAdapter, this);
+        return getAdapterMap().adapterFor(referencedPojo, ownerAdapter, this);
     }
 
 
@@ -245,17 +251,17 @@ public class OneToOneAssociationImpl ext
     @Override
     public ObjectAdapter[] getChoices(final ObjectAdapter ownerAdapter) {
         final PropertyChoicesFacet propertyChoicesFacet = getFacet(PropertyChoicesFacet.class);
-        final Object[] pojoOptions = propertyChoicesFacet == null ? null : propertyChoicesFacet.getChoices(ownerAdapter, getSpecificationLoader());
+        final Object[] pojoOptions = propertyChoicesFacet == null ? null : propertyChoicesFacet.getChoices(ownerAdapter, getSpecificationLookup());
         if (pojoOptions != null) {
             final ObjectAdapter[] options = new ObjectAdapter[pojoOptions.length];
             for (int i = 0; i < options.length; i++) {
-                options[i] = getRuntimeContext().adapterFor(pojoOptions[i]);
+                options[i] = getAdapterMap().adapterFor(pojoOptions[i]);
             }
             return options;
         } else if (SpecificationFacets.isBoundedSet(getSpecification())) {
         	
             QueryFindAllInstances query = new QueryFindAllInstances(getSpecification().getFullName());
-			final List<ObjectAdapter> allInstancesAdapter = getRuntimeContext().allMatchingQuery(query);
+			final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
         	final ObjectAdapter[] options = new ObjectAdapter[allInstancesAdapter.size()];
         	int j = 0;
             for (ObjectAdapter adapter: allInstancesAdapter) {



Mime
View raw message