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 [8/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
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongValueSemanticsProviderAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongValueSemanticsProviderAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongValueSemanticsProviderAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongValueSemanticsProviderAbstract.java Tue Dec 21 12:06:15 2010
@@ -29,16 +29,16 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public abstract class LongValueSemanticsProviderAbstract extends ValueSemanticsProviderAbstract implements LongValueFacet {
+public abstract class LongValueSemanticsProviderAbstract extends ValueSemanticsProviderAndFacetAbstract<Long> implements LongValueFacet {
 
     public static Class<? extends Facet> type() {
         return LongValueFacet.class;
     }
 
+    private static final Long DEFAULT_VALUE = Long.valueOf(0L);
     private static final int TYPICAL_LENGTH = 18;
     private static final boolean IMMUTABLE = true;
     private static final boolean EQUAL_BY_CONTENT = true;
@@ -46,11 +46,11 @@ public abstract class LongValueSemantics
     private NumberFormat format;
 
     public LongValueSemanticsProviderAbstract(
-    		final FacetHolder holder, final Class<?> adaptedClass, final Object defaultValue,
+    		final FacetHolder holder, 
+    		final Class<Long> adaptedClass, 
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(type(), holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, defaultValue, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, context);
         format = determineNumberFormat("value.format.long");
     }
 
@@ -59,7 +59,7 @@ public abstract class LongValueSemantics
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String entry) {
+    protected Long doParse(final Object context, final String entry) {
         try {
             return Long.valueOf(format.parse(entry).longValue());
         } catch (final ParseException e) {
@@ -87,7 +87,7 @@ public abstract class LongValueSemantics
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected Long doRestore(final String data) {
         return new Long(data);
     }
 
@@ -95,12 +95,14 @@ public abstract class LongValueSemantics
     // LongValueFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public Long longValue(final ObjectAdapter object) {
         return (Long) (object == null ? null : object.getObject());
     }
 
+    @Override
     public ObjectAdapter createValue(final Long value) {
-        return value == null ? null : getRuntimeContext().adapterFor(value);
+        return value == null ? null : getAdapterMap().adapterFor(value);
     }
 
     // // ///// toString ///////

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -24,31 +24,23 @@ import org.apache.isis.applib.adapters.E
 import org.apache.isis.applib.adapters.Parser;
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
 public class LongWrapperValueSemanticsProvider extends LongValueSemanticsProviderAbstract {
 
-    private static final Object DEFAULT_VALUE = Long.valueOf(0L);
-
-    static final Class<?> adaptedClass() {
-        return Long.class;
-    }
-
     /**
      * Required because implementation of {@link Parser} and {@link EncoderDecoder}.
      */
     public LongWrapperValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public LongWrapperValueSemanticsProvider(
     		final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(holder, adaptedClass(), DEFAULT_VALUE, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(holder, Long.class, configuration, context);
     }
 
 }

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/LongWrapperValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class LongWrapperValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class LongWrapperValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Long> {
 
     public LongWrapperValueTypeFacetFactory() {
         super(LongValueFacet.class);
@@ -32,10 +32,10 @@ public class LongWrapperValueTypeFacetFa
 
     @Override
     public boolean process(final Class<?> type, final MethodRemover methodRemover, final FacetHolder holder) {
-        if (type != LongWrapperValueSemanticsProvider.adaptedClass()) {
+        if (type != Long.class) {
             return false;
         }
-        addFacets(new LongWrapperValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new LongWrapperValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -25,6 +25,8 @@ import java.text.NumberFormat;
 import java.text.ParseException;
 import java.util.Currency;
 
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.applib.adapters.Parser;
 import org.apache.isis.applib.value.Money;
@@ -35,13 +37,10 @@ import org.apache.isis.core.metamodel.co
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
 import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-
-import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class MoneyValueSemanticsProvider extends ValueSemanticsProviderAbstract implements MoneyValueFacet {
+public class MoneyValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Money> implements MoneyValueFacet {
 
     private static Class<? extends Facet> type() {
         return MoneyValueFacet.class;
@@ -53,7 +52,7 @@ public class MoneyValueSemanticsProvider
     private static final int TYPICAL_LENGTH = 18;
     private static final boolean IMMUTABLE = true;
     private static final boolean EQUAL_BY_CONTENT = true;
-    private static final Object DEFAULT_VALUE = null; // no default
+    private static final Money DEFAULT_VALUE = null; // no default
 
     private String defaultCurrencyCode;
 
@@ -83,16 +82,14 @@ public class MoneyValueSemanticsProvider
      */
     @SuppressWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
     public MoneyValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public MoneyValueSemanticsProvider(
             final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(type(), holder, Money.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration,
-                specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(type(), holder, Money.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, context);
 
         final String property = ConfigurationConstants.ROOT + "value.money.currency";
         defaultCurrencyCode = configuration.getString(property, LOCAL_CURRENCY_CODE);
@@ -103,7 +100,7 @@ public class MoneyValueSemanticsProvider
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String text) {
+    protected Money doParse(final Object context, final String text) {
         final String entry = text.trim();
         final int pos = entry.lastIndexOf(' ');
         if (endsWithCurrencyCode(entry, pos)) {
@@ -111,7 +108,7 @@ public class MoneyValueSemanticsProvider
             final String code = entry.substring(pos + 1);
             return parseNumberAndCurrencyCode(value, code);
         } else {
-            return parseDerivedValue(original, entry);
+            return parseDerivedValue(context, entry);
         }
     }
 
@@ -122,7 +119,7 @@ public class MoneyValueSemanticsProvider
         return isCurrencyCode;
     }
 
-    private Object parseDerivedValue(final Object original, final String entry) {
+    private Money parseDerivedValue(final Object original, final String entry) {
         Money money = (Money) original;
         if (money == null || money.getCurrency().equals(LOCAL_CURRENCY_CODE)) {
             try {
@@ -142,7 +139,7 @@ public class MoneyValueSemanticsProvider
         }
     }
 
-    private Object parseNumberAndCurrencyCode(final String amount, final String code) {
+    private Money parseNumberAndCurrencyCode(final String amount, final String code) {
         final String currencyCode = code.toUpperCase();
         try {
             Currency.getInstance(currencyCode.toUpperCase());
@@ -172,6 +169,7 @@ public class MoneyValueSemanticsProvider
         }
     }
 
+    @Override
     public String titleStringWithMask(final Object value, final String usingMask) {
         if (value == null) {
             return "";
@@ -192,7 +190,7 @@ public class MoneyValueSemanticsProvider
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected Money doRestore(final String data) {
         final String dataString = data;
         final int pos = dataString.indexOf(' ');
         final String amount = dataString.substring(0, pos);
@@ -204,6 +202,7 @@ public class MoneyValueSemanticsProvider
     // MoneyValueFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public float getAmount(final ObjectAdapter object) {
         final Money money = (Money) object.getObject();
         if (money == null) {
@@ -213,6 +212,7 @@ public class MoneyValueSemanticsProvider
         }
     }
 
+    @Override
     public String getCurrencyCode(final ObjectAdapter object) {
         final Money money = (Money) object.getObject();
         if (money == null) {
@@ -222,8 +222,9 @@ public class MoneyValueSemanticsProvider
         }
     }
 
+    @Override
     public ObjectAdapter createValue(final float amount, final String currencyCode) {
-        return getRuntimeContext().adapterFor(new Money(amount, currencyCode));
+        return getAdapterMap().adapterFor(new Money(amount, currencyCode));
     }
 
     // /////// toString ///////

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/MoneyValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class MoneyValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class MoneyValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<org.apache.isis.applib.value.Money> {
 
     public MoneyValueTypeFacetFactory() {
         super(MoneyValueFacet.class);
@@ -35,7 +35,7 @@ public class MoneyValueTypeFacetFactory 
         if (type != org.apache.isis.applib.value.Money.class) {
             return false;
         }
-        addFacets(new MoneyValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new MoneyValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -27,34 +27,32 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class PasswordValueSemanticsProvider extends ValueSemanticsProviderAbstract implements PasswordValueFacet {
+public class PasswordValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Password> implements PasswordValueFacet {
 
     public static Class<? extends Facet> type() {
         return PasswordValueFacet.class;
     }
 
+    private static final Password DEFAULT_VALUE = null; // no default
     private static final int TYPICAL_LENGTH = 12;
     private static final boolean IMMUTABLE = true;
     private static final boolean EQUAL_BY_CONTENT = true;
-    private static final Object DEFAULT_VALUE = null; // no default
 
     /**
      * Required because implementation of {@link Parser} and {@link EncoderDecoder}.
      */
     public PasswordValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public PasswordValueSemanticsProvider(
     		final FacetHolder holder,
     		final IsisConfiguration configuration,
-    		final SpecificationLoader specificationLoader,
-    		final RuntimeContext runtimeContext) {
-        super(type(), holder, Password.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, specificationLoader, runtimeContext);
+    		final ValueSemanticsProviderContext context) {
+        super(type(), holder, Password.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, context);
     }
 
     // //////////////////////////////////////////////////////////////////
@@ -62,7 +60,7 @@ public class PasswordValueSemanticsProvi
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String text) {
+    protected Password doParse(final Object context, final String text) {
         return new Password(text);
     }
 
@@ -71,6 +69,7 @@ public class PasswordValueSemanticsProvi
         return object == null ? "" : password(object).toString();
     }
 
+    @Override
     public String titleStringWithMask(final Object object, final String usingMask) {
         return titleString(object);
     }
@@ -85,7 +84,7 @@ public class PasswordValueSemanticsProvi
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected Password doRestore(final String data) {
         return new Password(data);
     }
 
@@ -93,16 +92,19 @@ public class PasswordValueSemanticsProvi
     // PasswordValueFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public boolean checkPassword(final ObjectAdapter object, final String password) {
         return password(object.getObject()).checkPassword(password);
     }
 
+    @Override
     public String getEditText(final ObjectAdapter object) {
         return object == null ? "" : password(object).getPassword();
     }
 
+    @Override
     public ObjectAdapter createValue(final String password) {
-        return getRuntimeContext().adapterFor(new Password(password));
+        return getAdapterMap().adapterFor(new Password(password));
     }
 
     private Password password(final Object object) {

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PasswordValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class PasswordValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class PasswordValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<org.apache.isis.applib.value.Password> {
 
     public PasswordValueTypeFacetFactory() {
         super(PasswordValueFacet.class);
@@ -35,7 +35,7 @@ public class PasswordValueTypeFacetFacto
         if (type != org.apache.isis.applib.value.Password.class) {
             return false;
         }
-        addFacets(new PasswordValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new PasswordValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -24,6 +24,8 @@ import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.text.ParseException;
 
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.applib.adapters.Parser;
 import org.apache.isis.applib.value.Percentage;
@@ -33,20 +35,18 @@ import org.apache.isis.core.metamodel.co
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-
-import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class PercentageValueSemanticsProvider extends ValueSemanticsProviderAbstract implements FloatingPointValueFacet {
+public class PercentageValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Percentage> implements FloatingPointValueFacet {
 
     private static final NumberFormat PERCENTAGE_FORMAT = NumberFormat.getPercentInstance();
     private static final NumberFormat DECIMAL_FORMAT = NumberFormat.getNumberInstance();
 
+    private static final Percentage DEFAULT_VALUE = new Percentage(0.0f);
+    private static final int TYPICAL_LENGTH = 12;
     private static final boolean IMMUTABLE = true;
     private static final boolean EQUAL_BY_CONTENT = true;
-    private static final Object DEFAULT_VALUE = new Percentage(0.0f);
 
     public static Class<? extends Facet> type() {
         return FloatingPointValueFacet.class;
@@ -59,15 +59,14 @@ public class PercentageValueSemanticsPro
      */
     @SuppressWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
     public PercentageValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public PercentageValueSemanticsProvider(
     		final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(type(), holder, Percentage.class, 12, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(type(), holder, Percentage.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, context);
 
         final String formatRequired = configuration.getString(
                 ConfigurationConstants.ROOT + "value.format.percentage");
@@ -83,7 +82,7 @@ public class PercentageValueSemanticsPro
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String text) {
+    protected Percentage doParse(final Object context, final String text) {
         try {
             return new Percentage(new Float(format.parse(text).floatValue()));
         } catch (final ParseException e) {
@@ -109,6 +108,7 @@ public class PercentageValueSemanticsPro
         return value == null ? "" : format.format(((Percentage) value).floatValue());
     }
 
+    @Override
     public String titleStringWithMask(final Object value, final String usingMask) {
         return titleString(new DecimalFormat(usingMask), value);
     }
@@ -124,7 +124,7 @@ public class PercentageValueSemanticsPro
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected Percentage doRestore(final String data) {
         return new Percentage(Float.valueOf(data).floatValue());
     }
 
@@ -132,13 +132,15 @@ public class PercentageValueSemanticsPro
     // FloatingPointValueFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public Float floatValue(final ObjectAdapter object) {
         final Percentage per = (Percentage) object.getObject();
         return new Float(per.floatValue());
     }
 
+    @Override
     public ObjectAdapter createValue(final Float value) {
-        return getRuntimeContext().adapterFor(value);
+        return getAdapterMap().adapterFor(value);
     }
 
     // //////////////////////////////////////////////////////////////////

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/PercentageValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class PercentageValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class PercentageValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<org.apache.isis.applib.value.Percentage> {
 
     public PercentageValueTypeFacetFactory() {
         super(FloatingPointValueFacet.class);
@@ -35,7 +35,8 @@ public class PercentageValueTypeFacetFac
         if (type != org.apache.isis.applib.value.Percentage.class) {
             return false;
         }
-        addFacets(new PercentageValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new PercentageValueSemanticsProvider(holder, getConfiguration(), getContext()
+            ));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -26,37 +26,30 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
 import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
 public class ShortPrimitiveValueSemanticsProvider extends ShortValueSemanticsProviderAbstract implements PropertyDefaultFacet {
 
-    private static final Object DEFAULT_VALUE = Short.valueOf((short) 0);
-
-    static final Class<?> adaptedClass() {
-        return short.class;
-    }
-
     /**
      * Required because implementation of {@link Parser} and {@link EncoderDecoder}.
      */
     public ShortPrimitiveValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public ShortPrimitiveValueSemanticsProvider(
     		final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(holder, adaptedClass(), DEFAULT_VALUE, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(holder, short.class, configuration, context);
     }
 
     // //////////////////////////////////////////////////////////////////
     // PropertyDefaultFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public ObjectAdapter getDefault(final ObjectAdapter inObject) {
         return createAdapter(short.class, Short.valueOf((short) 0));
     }

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortPrimitiveValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class ShortPrimitiveValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class ShortPrimitiveValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Short> {
 
     public ShortPrimitiveValueTypeFacetFactory() {
         super(ShortValueFacet.class);
@@ -32,10 +32,10 @@ public class ShortPrimitiveValueTypeFace
 
     @Override
     public boolean process(final Class<?> type, final MethodRemover methodRemover, final FacetHolder holder) {
-        if (type != ShortPrimitiveValueSemanticsProvider.adaptedClass()) {
+        if (type != short.class) {
             return false;
         }
-        addFacets(new ShortPrimitiveValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new ShortPrimitiveValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortValueSemanticsProviderAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortValueSemanticsProviderAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortValueSemanticsProviderAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortValueSemanticsProviderAbstract.java Tue Dec 21 12:06:15 2010
@@ -29,16 +29,16 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class ShortValueSemanticsProviderAbstract extends ValueSemanticsProviderAbstract implements ShortValueFacet {
+public class ShortValueSemanticsProviderAbstract extends ValueSemanticsProviderAndFacetAbstract<Short> implements ShortValueFacet {
 
     public static Class<? extends Facet> type() {
         return ShortValueFacet.class;
     }
 
+    private static final Short DEFAULT_VALUE = Short.valueOf((short) 0);
     private static final int TYPICAL_LENGTH = 6;
     private static final boolean IMMUTABLE = true;
     private static final boolean EQUAL_BY_CONTENT = true;
@@ -46,11 +46,11 @@ public class ShortValueSemanticsProvider
     private final NumberFormat format;
 
     public ShortValueSemanticsProviderAbstract(
-    		final FacetHolder holder, final Class<?> adaptedClass, final Object defaultValue,
+    		final FacetHolder holder, 
+    		final Class<Short> adaptedClass, 
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(type(), holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, defaultValue, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, context);
         format = determineNumberFormat("value.format.short");
     }
 
@@ -59,7 +59,7 @@ public class ShortValueSemanticsProvider
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String entry) {
+    protected Short doParse(final Object context, final String entry) {
         try {
             return Short.valueOf(format.parse(entry).shortValue());
         } catch (final ParseException e) {
@@ -87,7 +87,7 @@ public class ShortValueSemanticsProvider
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected Short doRestore(final String data) {
         return new Short(data);
     }
 
@@ -95,10 +95,12 @@ public class ShortValueSemanticsProvider
     // ShortValueFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public ObjectAdapter createValue(final Short value) {
-        return getRuntimeContext().adapterFor(value);
+        return getAdapterMap().adapterFor(value);
     }
 
+    @Override
     public Short shortValue(final ObjectAdapter object) {
         return (Short) (object == null ? null : object.getObject());
     }

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -24,31 +24,23 @@ import org.apache.isis.applib.adapters.E
 import org.apache.isis.applib.adapters.Parser;
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
 public class ShortWrapperValueSemanticsProvider extends ShortValueSemanticsProviderAbstract {
 
-    private static final Object DEFAULT_VALUE = Short.valueOf((short) 0);
-
-    static final Class<?> adaptedClass() {
-        return Short.class;
-    }
-
     /**
      * Required because implementation of {@link Parser} and {@link EncoderDecoder}.
      */
     public ShortWrapperValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public ShortWrapperValueSemanticsProvider(
     		final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(holder, adaptedClass(), DEFAULT_VALUE, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(holder, Short.class, configuration, context);
     }
 
 }

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ShortWrapperValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class ShortWrapperValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class ShortWrapperValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Short> {
 
     public ShortWrapperValueTypeFacetFactory() {
         super(ShortValueFacet.class);
@@ -32,10 +32,10 @@ public class ShortWrapperValueTypeFacetF
 
     @Override
     public boolean process(final Class<?> type, final MethodRemover methodRemover, final FacetHolder holder) {
-        if (type != ShortWrapperValueSemanticsProvider.adaptedClass()) {
+        if (type != Short.class) {
             return false;
         }
-        addFacets(new ShortWrapperValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new ShortWrapperValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -26,11 +26,10 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class StringValueSemanticsProvider extends ValueSemanticsProviderAbstract implements StringValueFacet {
+public class StringValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<String> implements StringValueFacet {
 
     public static Class<? extends Facet> type() {
         return StringValueFacet.class;
@@ -39,21 +38,20 @@ public class StringValueSemanticsProvide
     private static final int TYPICAL_LENGTH = 25;
     private static final boolean IMMUTABLE = true;
     private static final boolean EQUAL_BY_CONTENT = true;
-    private static final Object DEFAULT_VALUE = null; // no default
+    private static final String DEFAULT_VALUE = null; // no default
 
     /**
      * Required because implementation of {@link Parser} and {@link EncoderDecoder}.
      */
     public StringValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public StringValueSemanticsProvider(
     		final FacetHolder holder,
             final IsisConfiguration configuration, 
-            final SpecificationLoader specificationLoader, 
-            final RuntimeContext runtimeContext) {
-        super(type(), holder, String.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(type(), holder, String.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration, context);
     }
 
     // //////////////////////////////////////////////////////////////////
@@ -61,7 +59,7 @@ public class StringValueSemanticsProvide
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String entry) {
+    protected String doParse(final Object context, final String entry) {
         if (entry.trim().equals("")) {
             return null;
         } else {
@@ -75,6 +73,7 @@ public class StringValueSemanticsProvide
         return string;
     }
 
+    @Override
     public String titleStringWithMask(final Object object, final String usingMask) {
         return titleString(object);
     }
@@ -94,7 +93,7 @@ public class StringValueSemanticsProvide
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected String doRestore(final String data) {
         if (isEscaped(data)) {
             return data.substring(1);
         } else {
@@ -114,12 +113,14 @@ public class StringValueSemanticsProvide
     // StringValueFacet
     // //////////////////////////////////////////////////////////////////
 
+    @Override
     public String stringValue(final ObjectAdapter object) {
         return object == null ? "" : (String) object.getObject();
     }
 
+    @Override
     public ObjectAdapter createValue(final String value) {
-        return getRuntimeContext().adapterFor(value);
+        return getAdapterMap().adapterFor(value);
     }
 
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/StringValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class StringValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class StringValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<String> {
 
     public StringValueTypeFacetFactory() {
         super(StringValueFacet.class);
@@ -35,7 +35,7 @@ public class StringValueTypeFacetFactory
         if (type != String.class) {
             return false;
         }
-        addFacets(new StringValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new StringValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -20,8 +20,13 @@
 
 package org.apache.isis.core.progmodel.facets.value;
 
+import java.text.DateFormat;
 import java.util.Date;
-import java.util.Hashtable;
+import java.util.Map;
+
+import com.google.inject.internal.Maps;
+
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
 
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.applib.adapters.Parser;
@@ -30,19 +35,16 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
 import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-
-import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class TimeStampValueSemanticsProvider extends TimeStampValueSemanticsProviderAbstract {
+public class TimeStampValueSemanticsProvider extends TimeStampValueSemanticsProviderAbstract<TimeStamp> {
 
     public static final boolean isAPropertyDefaultFacet() {
         return PropertyDefaultFacet.class.isAssignableFrom(TimeStampValueSemanticsProvider.class);
     }
 
-    private static Hashtable formats = new Hashtable();
+    private static Map<String,DateFormat> formats = Maps.newHashMap();
 
     static {
         initFormats(formats);
@@ -53,15 +55,14 @@ public class TimeStampValueSemanticsProv
      */
     @SuppressWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
     public TimeStampValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public TimeStampValueSemanticsProvider(
             final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(holder, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(holder, TimeStamp.class, configuration, context);
     }
 
     // //////////////////////////////////////////////////////////////////
@@ -74,17 +75,17 @@ public class TimeStampValueSemanticsProv
     }
 
     @Override
-    protected Hashtable formats() {
+    protected Map<String, DateFormat> formats() {
         return formats;
     }
 
     @Override
-    protected Object now() {
+    protected TimeStamp now() {
         throw new InvalidEntryException("Can't change a timestamp.");
     }
 
     @Override
-    protected Object setDate(final Date date) {
+    protected TimeStamp setDate(final Date date) {
         return new TimeStamp(date.getTime());
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProviderAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProviderAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProviderAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueSemanticsProviderAbstract.java Tue Dec 21 12:06:15 2010
@@ -22,18 +22,16 @@ package org.apache.isis.core.progmodel.f
 
 import java.text.DateFormat;
 import java.util.Date;
-import java.util.Hashtable;
 import java.util.Map;
 
 import org.apache.isis.applib.value.TimeStamp;
 import org.apache.isis.core.metamodel.config.ConfigurationConstants;
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public abstract class TimeStampValueSemanticsProviderAbstract extends ValueSemanticsProviderAbstractTemporal {
+public abstract class TimeStampValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
 
     private static final Object DEFAULT_VALUE = null; // no default
     private static final int TYPICAL_LENGTH = 12;
@@ -48,16 +46,17 @@ public abstract class TimeStampValueSema
         formats.put("short", DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG));
     }
 
+    @SuppressWarnings("unchecked")
     public TimeStampValueSemanticsProviderAbstract(
             final FacetHolder holder,
+            final Class<T> adaptedClass,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super("timestamp", holder, TimeStamp.class, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration,
-                specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super("timestamp", holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, (T)DEFAULT_VALUE, configuration,
+                context);
         final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.timestamp");
         if (formatRequired == null) {
-            format = (DateFormat) formats().get(defaultFormat());
+            format = formats().get(defaultFormat());
         } else {
             setMask(formatRequired);
         }
@@ -69,8 +68,8 @@ public abstract class TimeStampValueSema
     }
 
     @Override
-    protected Object add(
-            final Object original,
+    protected T add(
+            final T original,
             final int years,
             final int months,
             final int days,

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeStampValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -20,11 +20,12 @@
 
 package org.apache.isis.core.progmodel.facets.value;
 
+import org.apache.isis.applib.value.TimeStamp;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class TimeStampValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class TimeStampValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<TimeStamp> {
 
     public TimeStampValueTypeFacetFactory() {
         super(DateValueFacet.class); // as per inherited DateTimeValueSemanticsProvider#facetType
@@ -36,7 +37,7 @@ public class TimeStampValueTypeFacetFact
         if (type != org.apache.isis.applib.value.TimeStamp.class) {
             return false;
         }
-        addFacets(new TimeStampValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new TimeStampValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProvider.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProvider.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProvider.java Tue Dec 21 12:06:15 2010
@@ -24,20 +24,20 @@ import java.text.DateFormat;
 import java.util.Date;
 import java.util.Map;
 
+import com.google.inject.internal.Maps;
+
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.applib.adapters.Parser;
 import org.apache.isis.applib.value.Time;
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-
-import com.google.inject.internal.Maps;
-
-import edu.umd.cs.findbugs.annotations.SuppressWarnings;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public class TimeValueSemanticsProvider extends TimeValueSemanticsProviderAbstract {
+public class TimeValueSemanticsProvider extends TimeValueSemanticsProviderAbstract<org.apache.isis.applib.value.Time> {
+    
     private static final Map<String, DateFormat> formats = Maps.newHashMap();
 
     static {
@@ -49,15 +49,14 @@ public class TimeValueSemanticsProvider 
      */
     @SuppressWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
     public TimeValueSemanticsProvider() {
-        this(null, null, null, null);
+        this(null, null, null);
     }
 
     public TimeValueSemanticsProvider(
     		final FacetHolder holder,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super(holder, org.apache.isis.applib.value.Time.class, configuration, specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super(holder, org.apache.isis.applib.value.Time.class, configuration, context);
     }
 
     @Override
@@ -71,14 +70,14 @@ public class TimeValueSemanticsProvider 
     }
 
     @Override
-    protected Object add(
-            final Object original,
+    protected Time add(
+            final Time original,
             final int years,
             final int months,
             final int days,
             final int hours,
             final int minutes) {
-        Time time = (Time) original;
+        Time time = original;
         time = time.add(hours, minutes);
         return time;
     }
@@ -90,12 +89,12 @@ public class TimeValueSemanticsProvider 
     }
 
     @Override
-    protected Object now() {
+    protected Time now() {
         return new Time();
     }
 
     @Override
-    protected Object setDate(final Date date) {
+    protected Time setDate(final Date date) {
         return new Time(date);
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProviderAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProviderAbstract.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProviderAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueSemanticsProviderAbstract.java Tue Dec 21 12:06:15 2010
@@ -27,11 +27,10 @@ import java.util.Map;
 import org.apache.isis.core.metamodel.config.ConfigurationConstants;
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public abstract class TimeValueSemanticsProviderAbstract extends ValueSemanticsProviderAbstractTemporal {
+public abstract class TimeValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
 
     private static final Object DEFAULT_VALUE = null; // no default
     private static final int TYPICAL_LENGTH = 6;
@@ -49,18 +48,18 @@ public abstract class TimeValueSemantics
         formats.put("short", DateFormat.getTimeInstance(DateFormat.SHORT));
     }
 
+    @SuppressWarnings("unchecked")
     public TimeValueSemanticsProviderAbstract(
             final FacetHolder holder,
-            final Class<?> adaptedClass,
+            final Class<T> adaptedClass,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
-        super("time", holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, DEFAULT_VALUE, configuration,
-                specificationLoader, runtimeContext);
+            final ValueSemanticsProviderContext context) {
+        super("time", holder, adaptedClass, TYPICAL_LENGTH, IMMUTABLE, EQUAL_BY_CONTENT, (T) DEFAULT_VALUE, configuration,
+                context);
 
         final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.time");
         if (formatRequired == null) {
-            format = (DateFormat) formats().get(defaultFormat());
+            format = formats().get(defaultFormat());
         } else {
             setMask(formatRequired);
         }

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueTypeFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueTypeFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/TimeValueTypeFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.MethodRemover;
 
 
-public class TimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory {
+public class TimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<org.apache.isis.applib.value.Time> {
 
     public TimeValueTypeFacetFactory() {
         super(DateValueFacet.class); // as per inherited DateTimeValueSemanticsProvider#facetType
@@ -36,7 +36,7 @@ public class TimeValueTypeFacetFactory e
         if (type != org.apache.isis.applib.value.Time.class) {
             return false;
         }
-        addFacets(new TimeValueSemanticsProvider(holder, getConfiguration(), getSpecificationLoader(), getRuntimeContext()));
+        addFacets(new TimeValueSemanticsProvider(holder, getConfiguration(), getContext()));
         return true;
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java Tue Dec 21 12:06:15 2010
@@ -30,6 +30,8 @@ import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.TimeZone;
 
+import com.google.inject.internal.Maps;
+
 import org.apache.isis.applib.adapters.EncodingException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.TextEntryParseException;
@@ -37,13 +39,10 @@ import org.apache.isis.core.metamodel.co
 import org.apache.isis.core.metamodel.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-
-import com.google.inject.internal.Maps;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public abstract class ValueSemanticsProviderAbstractTemporal extends ValueSemanticsProviderAbstract implements DateValueFacet {
+public abstract class ValueSemanticsProviderAbstractTemporal<T> extends ValueSemanticsProviderAndFacetAbstract<T> implements DateValueFacet {
 
     /**
      * Introduced to allow BDD tests to provide a different format string
@@ -97,16 +96,15 @@ public abstract class ValueSemanticsProv
     public ValueSemanticsProviderAbstractTemporal(
             final String propertyName,
             final FacetHolder holder,
-            final Class<?> adaptedClass,
+            final Class<T> adaptedClass,
             final int typicalLength,
             final boolean immutable,
             final boolean equalByContent,
-            final Object defaultValue,
+            final T defaultValue,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
+            final ValueSemanticsProviderContext context) {
         this(propertyName, type(), holder, adaptedClass, typicalLength, immutable, equalByContent, defaultValue, configuration,
-                specificationLoader, runtimeContext);
+                context);
     }
 
     /**
@@ -116,16 +114,15 @@ public abstract class ValueSemanticsProv
             final String propertyType,
             final Class<? extends Facet> facetType,
             final FacetHolder holder,
-            final Class<?> adaptedClass,
+            final Class<T> adaptedClass,
             final int typicalLength,
             final boolean immutable,
             final boolean equalByContent,
-            final Object defaultValue,
+            final T defaultValue,
             final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final RuntimeContext runtimeContext) {
+            final ValueSemanticsProviderContext context) {
         super(facetType, holder, adaptedClass, typicalLength, immutable, equalByContent, defaultValue, configuration,
-                specificationLoader, runtimeContext);
+                context);
         configureFormats();
         
         this.propertyType = propertyType;
@@ -171,22 +168,22 @@ public abstract class ValueSemanticsProv
     // //////////////////////////////////////////////////////////////////
 
     @Override
-    protected Object doParse(final Object original, final String entry) {
+    protected T doParse(final Object context, final String entry) {
         buildDefaultFormatIfRequired();
         final String dateString = entry.trim();
         final String str = dateString.toLowerCase();
         if (str.equals("today") || str.equals("now")) {
             return now();
         } else if (dateString.startsWith("+")) {
-            return relativeDate(original == null ? now() : original, dateString, true);
+            return relativeDate(context == null ? now() : context, dateString, true);
         } else if (dateString.startsWith("-")) {
-            return relativeDate(original == null ? now() : original, dateString, false);
+            return relativeDate(context == null ? now() : context, dateString, false);
         } else {
-            return parseDate(dateString, original == null ? now() : original);
+            return parseDate(dateString, context == null ? now() : context);
         }
     }
 
-    private Object parseDate(final String dateString, final Object original) {
+    private T parseDate(final String dateString, final Object original) {
         try {
             return setDate(format.parse(dateString));
         } catch (final ParseException e) {
@@ -209,21 +206,25 @@ public abstract class ValueSemanticsProv
         }
     }
 
-    private Object relativeDate(final Object original, final String str, final boolean add) {
+    private T relativeDate(final Object object, final String str, final boolean add) {
         if (str.equals("")) {
             return now();
         }
 
-        Object date = original;
-        final StringTokenizer st = new StringTokenizer(str.substring(1), " ");
-        while (st.hasMoreTokens()) {
-            final String token = st.nextToken();
-            date = relativeDate2(date, token, add);
+        try {
+            T date = (T) object;
+            final StringTokenizer st = new StringTokenizer(str.substring(1), " ");
+            while (st.hasMoreTokens()) {
+                final String token = st.nextToken();
+                date = relativeDate2(date, token, add);
+            }
+            return date;
+        } catch (Exception e) {
+            return now();
         }
-        return date;
     }
 
-    private Object relativeDate2(final Object original, String str, final boolean add) {
+    private T relativeDate2(final T original, String str, final boolean add) {
         int hours = 0;
         int minutes = 0;
         int days = 0;
@@ -297,7 +298,7 @@ public abstract class ValueSemanticsProv
     }
 
     @Override
-    protected Object doRestore(final String data) {
+    protected T doRestore(final String data) {
         final Calendar cal = Calendar.getInstance();
         cal.setTimeZone(UTC_TIME_ZONE);
         
@@ -332,7 +333,7 @@ public abstract class ValueSemanticsProv
 
     @Override
     public final ObjectAdapter createValue(final Date date) {
-        return getRuntimeContext().adapterFor(setDate(date));
+        return getAdapterMap().adapterFor(setDate(date));
     }
 
     /**
@@ -345,7 +346,7 @@ public abstract class ValueSemanticsProv
     // temporal-specific stuff
     // //////////////////////////////////////////////////////////////////
 
-    protected abstract Object add(Object original, int years, int months, int days, int hours, int minutes);
+    protected abstract T add(T original, int years, int months, int days, int hours, int minutes);
 
     protected void clearFields(final Calendar cal) {}
 
@@ -359,9 +360,9 @@ public abstract class ValueSemanticsProv
         return false;
     }
 
-    protected abstract Object now();
+    protected abstract T now();
 
-    protected abstract Object setDate(Date date);
+    protected abstract T setDate(Date date);
 
     public void setMask(final String mask) {
         format = new SimpleDateFormat(mask);

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAndFacetAbstract.java (from r1051018, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstract.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAndFacetAbstract.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAndFacetAbstract.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstract.java&r1=1051018&r2=1051471&rev=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAndFacetAbstract.java Tue Dec 21 12:06:15 2010
@@ -40,19 +40,22 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.FacetAbstract;
 import org.apache.isis.core.metamodel.facets.FacetHolder;
 import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.AuthenticationSessionProvider;
+import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.SpecificationLookup;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public abstract class ValueSemanticsProviderAbstract extends FacetAbstract implements ValueSemanticsProvider, EncoderDecoder,
-        Parser, DefaultsProvider {
+public abstract class ValueSemanticsProviderAndFacetAbstract<T> extends FacetAbstract implements ValueSemanticsProvider<T>, EncoderDecoder<T>,
+        Parser<T>, DefaultsProvider<T> {
 
-    private final Class<?> adaptedClass;
+    private final Class<T> adaptedClass;
     private final int typicalLength;
     private final boolean immutable;
     private final boolean equalByContent;
-    private final Object defaultValue;
+    private final T defaultValue;
 
     /**
      * Lazily looked up per {@link #getSpecification()}.
@@ -60,20 +63,18 @@ public abstract class ValueSemanticsProv
     private ObjectSpecification specification;
     
 	private final IsisConfiguration configuration;
-	private final SpecificationLoader specificationLoader;
-	private final RuntimeContext runtimeContext;
+	private final ValueSemanticsProviderContext context;
 
-    public ValueSemanticsProviderAbstract(
+    public ValueSemanticsProviderAndFacetAbstract(
             final Class<? extends Facet> adapterFacetType,
             final FacetHolder holder,
-            final Class<?> adaptedClass,
+            final Class<T> adaptedClass,
             final int typicalLength,
             final boolean immutable,
             final boolean equalByContent,
-            final Object defaultValue, 
+            final T defaultValue, 
             final IsisConfiguration configuration, 
-            final SpecificationLoader specificationLoader, 
-            final RuntimeContext runtimeContext) {
+            final ValueSemanticsProviderContext context) {
         super(adapterFacetType, holder, false);
         this.adaptedClass = adaptedClass;
         this.typicalLength = typicalLength;
@@ -82,13 +83,12 @@ public abstract class ValueSemanticsProv
         this.defaultValue = defaultValue;
         
         this.configuration = configuration;
-        this.specificationLoader = specificationLoader;
-        this.runtimeContext = runtimeContext;
+        this.context = context;
     }
 
     public ObjectSpecification getSpecification() {
         if (specification == null) {
-            specification = getSpecificationLoader().loadSpecification(getAdaptedClass());
+            specification = getSpecificationLookup().loadSpecification(getAdaptedClass());
         }
         return specification;
     }
@@ -101,7 +101,7 @@ public abstract class ValueSemanticsProv
      * Used to determine whether an empty string can be parsed, (for primitive types a non-null entry is
      * required, see {@link #mustHaveEntry()}), and potentially useful for debugging.
      */
-    public final Class<?> getAdaptedClass() {
+    public final Class<T> getAdaptedClass() {
         return adaptedClass;
     }
 
@@ -120,22 +120,27 @@ public abstract class ValueSemanticsProv
     // ValueSemanticsProvider implementation
     // ///////////////////////////////////////////////////////////////////////////
 
-    public EncoderDecoder getEncoderDecoder() {
+    @Override
+    public EncoderDecoder<T> getEncoderDecoder() {
         return this;
     }
 
-    public Parser getParser() {
+    @Override
+    public Parser<T> getParser() {
         return this;
     }
 
-    public DefaultsProvider getDefaultsProvider() {
+    @Override
+    public DefaultsProvider<T> getDefaultsProvider() {
         return this;
     }
 
+    @Override
     public boolean isEqualByContent() {
         return equalByContent;
     }
 
+    @Override
     public boolean isImmutable() {
         return immutable;
     }
@@ -144,7 +149,8 @@ public abstract class ValueSemanticsProv
     // Parser implementation
     // ///////////////////////////////////////////////////////////////////////////
 
-    public Object parseTextEntry(final Object context, final String entry) {
+    @Override
+    public T parseTextEntry(final Object context, final String entry) {
         if (entry == null) {
             throw new IllegalArgumentException();
         }
@@ -159,12 +165,12 @@ public abstract class ValueSemanticsProv
     }
 
     /**
-     * @param original
+     * @param context
      *            - the underlying object, or <tt>null</tt>.
      * @param entry
      *            - the proposed new object, as a string representation to be parsed
      */
-    protected abstract Object doParse(Object original, String entry);
+    protected abstract T doParse(Object context, String entry);
 
     /**
      * Whether a non-null entry is required, used by parsing.
@@ -176,6 +182,7 @@ public abstract class ValueSemanticsProv
         return adaptedClass.isPrimitive();
     }
 
+    @Override
     public String displayTitleOf(final Object object) {
         if (object == null) {
             return "";
@@ -183,6 +190,7 @@ public abstract class ValueSemanticsProv
         return titleString(object);
     }
 
+    @Override
     public String displayTitleOf(final Object object, final String usingMask) {
         if (object == null) {
             return "";
@@ -193,6 +201,7 @@ public abstract class ValueSemanticsProv
     /**
      * Defaults to {@link #displayTitleOf(Object)}.
      */
+    @Override
     public String parseableTitleOf(final Object existing) {
         return displayTitleOf(existing);
     }
@@ -208,6 +217,7 @@ public abstract class ValueSemanticsProv
 
     public abstract String titleStringWithMask(final Object value, final String usingMask);
 
+    @Override
     public final int typicalLength() {
         return this.typicalLength;
     }
@@ -216,7 +226,8 @@ public abstract class ValueSemanticsProv
     // DefaultsProvider implementation
     // ///////////////////////////////////////////////////////////////////////////
 
-    public Object getDefaultValue() {
+    @Override
+    public T getDefaultValue() {
         return this.defaultValue;
     }
 
@@ -224,11 +235,13 @@ public abstract class ValueSemanticsProv
     // EncoderDecoder implementation
     // ///////////////////////////////////////////////////////////////////////////
 
+    @Override
     public String toEncodedString(final Object object) {
         return doEncode(object);
     }
 
-    public Object fromEncodedString(final String data) {
+    @Override
+    public T fromEncodedString(final String data) {
         return doRestore(data);
     }
 
@@ -240,7 +253,7 @@ public abstract class ValueSemanticsProv
     /**
      * Hook method to perform the actual restoring.
      */
-    protected abstract Object doRestore(String data);
+    protected abstract T doRestore(String data);
     
 
     
@@ -272,9 +285,9 @@ public abstract class ValueSemanticsProv
     ////////////////////////////////////////////////////////////
 
     protected ObjectAdapter createAdapter(final Class<?> type, final Object object) {
-	    final ObjectSpecification specification = getSpecificationLoader().loadSpecification(type);
+	    final ObjectSpecification specification = getSpecificationLookup().loadSpecification(type);
 	    if (specification.isNotCollection()) {
-	        return getRuntimeContext().adapterFor(object);
+	        return getAdapterMap().adapterFor(object);
 	    } else {
 	        throw new UnknownTypeException("not an object, is this a collection?");
 	    }
@@ -289,14 +302,37 @@ public abstract class ValueSemanticsProv
         return configuration;
     }
 
-    protected SpecificationLoader getSpecificationLoader() {
-        return specificationLoader;
+    protected ValueSemanticsProviderContext getContext() {
+        return context;
+    }
+    
+    /**
+     * From {@link #getContext() context.}
+     */
+    protected AdapterMap getAdapterMap() {
+        return context.getAdapterMap();
     }
 
-    protected RuntimeContext getRuntimeContext() {
-        return runtimeContext;
+    /**
+     * From {@link #getContext() context.}
+     */
+    protected SpecificationLookup getSpecificationLookup() {
+        return context.getSpecificationLookup();
     }
 
+    /**
+     * From {@link #getContext() context.}
+     */
+    protected DependencyInjector getDependencyInjector() {
+        return context.getDependencyInjector();
+    }
+    
+    /**
+     * From {@link #getContext() context.}
+     */
+    protected AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        return context.getAuthenticationSessionProvider();
+    }
     ////////////////////////////////////////////////////////////
     // Dependencies (from singleton)
     ////////////////////////////////////////////////////////////

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueUsingValueSemanticsProviderFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueUsingValueSemanticsProviderFacetFactory.java?rev=1051471&r1=1051470&r2=1051471&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueUsingValueSemanticsProviderFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueUsingValueSemanticsProviderFacetFactory.java Tue Dec 21 12:06:15 2010
@@ -25,45 +25,71 @@ import org.apache.isis.core.metamodel.co
 import org.apache.isis.core.metamodel.facets.Facet;
 import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.FacetUtil;
-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.DependencyInjector;
+import org.apache.isis.core.metamodel.runtimecontext.DependencyInjectorAware;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMap;
+import org.apache.isis.core.metamodel.runtimecontext.AdapterMapAware;
 import org.apache.isis.core.metamodel.spec.feature.ObjectFeatureType;
 import org.apache.isis.core.progmodel.facets.object.value.ValueFacetUsingSemanticsProvider;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
 
 
-public abstract class ValueUsingValueSemanticsProviderFacetFactory extends FacetFactoryAbstract implements RuntimeContextAware,
-        IsisConfigurationAware {
+public abstract class ValueUsingValueSemanticsProviderFacetFactory<T> extends FacetFactoryAbstract implements 
+        IsisConfigurationAware, AuthenticationSessionProviderAware, AdapterMapAware, DependencyInjectorAware  {
 
-    private RuntimeContext runtimeContext;
-    private IsisConfiguration configuration;
+    private IsisConfiguration configuration;
+    private AuthenticationSessionProvider authenticationSessionProvider;
+    private AdapterMap adapterManager;
+    private DependencyInjector dependencyInjector;
+    /**
+     * Lazily created.
+     */
+    private ValueSemanticsProviderContext context;
 
     protected ValueUsingValueSemanticsProviderFacetFactory(final Class<? extends Facet> adapterFacetType) {
         super(ObjectFeatureType.OBJECTS_ONLY);
     }
 
-    protected void addFacets(final ValueSemanticsProviderAbstract adapter) {
-        ValueFacetUsingSemanticsProvider facet = new ValueFacetUsingSemanticsProvider(adapter, adapter, getRuntimeContext());
+    protected void addFacets(final ValueSemanticsProviderAndFacetAbstract<T> adapter) {
+        ValueFacetUsingSemanticsProvider facet = new ValueFacetUsingSemanticsProvider(adapter, adapter, getContext());
         FacetUtil.addFacet(facet);
-    }
-
+    }
+
     // ////////////////////////////////////////////////////
     // Dependencies (injected via setter)
     // ////////////////////////////////////////////////////
 
-    protected RuntimeContext getRuntimeContext() {
-        return runtimeContext;
-    }
-
-    public void setRuntimeContext(final RuntimeContext runtimeContext) {
-        this.runtimeContext = runtimeContext;
-    }
-
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public ValueSemanticsProviderContext getContext() {
+        if(context == null) {
+            context = new ValueSemanticsProviderContext(authenticationSessionProvider, getSpecificationLookup(), adapterManager, dependencyInjector);
+        }
+        return context;
+    }
+
+    @Override
     public void setIsisConfiguration(IsisConfiguration configuration) {
         this.configuration = configuration;
     }
 
-    public IsisConfiguration getConfiguration() {
-        return configuration;
-    }
-
+    @Override
+    public void setAuthenticationSessionProvider(AuthenticationSessionProvider authenticationSessionProvider) {
+        this.authenticationSessionProvider = authenticationSessionProvider;
+    }
+
+    @Override
+    public void setAdapterMap(AdapterMap adapterManager) {
+        this.adapterManager = adapterManager;
+    }
+
+    @Override
+    public void setDependencyInjector(DependencyInjector dependencyInjector) {
+        this.dependencyInjector = dependencyInjector;
+    }
+
 }



Mime
View raw message