You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2010/11/03 02:24:23 UTC
svn commit: r1030308 [5/8] - in /incubator/isis/trunk:
alternatives/remoting/common/src/main/java/org/apache/isis/remoting/facade/impl/
alternatives/remoting/common/src/main/java/org/apache/isis/remoting/server/
alternatives/remoting/common/src/test/ja...
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/modify/PropertySetterFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/modify/PropertySetterFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/modify/PropertySetterFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/modify/PropertySetterFacet.java Wed Nov 3 01:24:18 2010
@@ -17,28 +17,26 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.properties.modify;
-package org.apache.isis.metamodel.facets.properties.modify;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-import org.apache.isis.metamodel.facets.propcoll.access.PropertyAccessorFacet;
-
-
-/**
- * The mechanism by which the value of the property can be set.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the mutator method for a property.
- *
- * @see PropertyAccessorFacet
- * @see PropertyClearFacet
- * @see PropertyInitializationFacet
- */
-public interface PropertySetterFacet extends Facet {
-
- /**
- * Sets the value of this property.
- */
- public void setProperty(ObjectAdapter inObject, ObjectAdapter value);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+import org.apache.isis.metamodel.facets.propcoll.access.PropertyAccessorFacet;
+
+/**
+ * The mechanism by which the value of the property can be set.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the mutator method for a property.
+ *
+ * @see PropertyAccessorFacet
+ * @see PropertyClearFacet
+ * @see PropertyInitializationFacet
+ */
+public interface PropertySetterFacet extends Facet {
+
+ /**
+ * Sets the value of this property.
+ */
+ public void setProperty(ObjectAdapter inObject, ObjectAdapter value);
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/validate/PropertyValidateFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/validate/PropertyValidateFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/validate/PropertyValidateFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/properties/validate/PropertyValidateFacet.java Wed Nov 3 01:24:18 2010
@@ -17,34 +17,32 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.properties.validate;
-package org.apache.isis.metamodel.facets.properties.validate;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.Facet;
-import org.apache.isis.metamodel.facets.properties.modify.PropertySetterFacet;
-import org.apache.isis.metamodel.facets.properties.modify.PropertySetterFacetAbstract;
-import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
-
-
-/**
- * The mechanism by which the proposed value of a property can be validated, called immediately before
- * {@link PropertySetterFacetAbstract setting the value}.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to invoking the <tt>validateXxx</tt> method
- * for a property with an accessor of <tt>getXxx</tt>.
- *
- * @see PropertySetterFacet
- */
-
-public interface PropertyValidateFacet extends Facet, ValidatingInteractionAdvisor {
-
- /**
- * The reason why the proposed value is invalid.
- *
- * <p>
- * Should return <tt>null</tt> if the value is in fact valid.
- */
- public String invalidReason(ObjectAdapter targetObject, ObjectAdapter proposedValue);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.Facet;
+import org.apache.isis.metamodel.facets.properties.modify.PropertySetterFacet;
+import org.apache.isis.metamodel.facets.properties.modify.PropertySetterFacetAbstract;
+import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
+
+/**
+ * The mechanism by which the proposed value of a property can be validated, called immediately before
+ * {@link PropertySetterFacetAbstract setting the value}.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to invoking the <tt>validateXxx</tt> method for a property
+ * with an accessor of <tt>getXxx</tt>.
+ *
+ * @see PropertySetterFacet
+ */
+
+public interface PropertyValidateFacet extends Facet, ValidatingInteractionAdvisor {
+
+ /**
+ * The reason why the proposed value is invalid.
+ *
+ * <p>
+ * Should return <tt>null</tt> if the value is in fact valid.
+ */
+ public String invalidReason(ObjectAdapter targetObject, ObjectAdapter proposedValue);
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/multiline/MultiLineFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/multiline/MultiLineFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/multiline/MultiLineFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/multiline/MultiLineFacet.java Wed Nov 3 01:24:18 2010
@@ -27,7 +27,7 @@ import org.apache.isis.metamodel.facets.
* Whether the (string) property or parameter should be rendered over multiple lines.
*
* <p>
- * In the standard [[NAME]] Programming Model, corresponds to the <tt>@MultiLine</tt> annotation.
+ * In the standard Apache Isis Programming Model, corresponds to the <tt>@MultiLine</tt> annotation.
*/
public interface MultiLineFacet extends MultipleValueFacet {
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/typicallength/TypicalLengthFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/typicallength/TypicalLengthFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/typicallength/TypicalLengthFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/typicallength/TypicalLengthFacet.java Wed Nov 3 01:24:18 2010
@@ -17,23 +17,22 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.propparam.typicallength;
-package org.apache.isis.metamodel.facets.propparam.typicallength;
-
-import org.apache.isis.metamodel.facets.SingleIntValueFacet;
-
-
-/**
- * The typical length of a property or a parameter.
- *
- * <p>
- * Intended to be used by the viewer as a rendering hint to size the UI field to an appropriate size.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to the <tt>@TypicalLength</tt> annotation.
- */
-public interface TypicalLengthFacet extends SingleIntValueFacet {
-
- public int value();
-
-}
+import org.apache.isis.metamodel.facets.SingleIntValueFacet;
+
+/**
+ * The typical length of a property or a parameter.
+ *
+ * <p>
+ * Intended to be used by the viewer as a rendering hint to size the UI field to an appropriate size.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to the <tt>@TypicalLength</tt> annotation.
+ */
+public interface TypicalLengthFacet extends SingleIntValueFacet {
+
+ @Override
+ public int value();
+
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacet.java Wed Nov 3 01:24:18 2010
@@ -35,7 +35,7 @@ import org.apache.isis.metamodel.interac
* mandatory parameter, the action cannot be invoked without the value being provided.
*
* <p>
- * In the standard [[NAME]] Programming Model, specify mandatory by <i>omitting</i> the
+ * In the standard Apache Isis Programming Model, specify mandatory by <i>omitting</i> the
* <tt>@Optional</tt> annotation.
*/
public interface MandatoryFacet extends MarkerFacet, ValidatingInteractionAdvisor {
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacetDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacetDefault.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacetDefault.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mandatory/MandatoryFacetDefault.java Wed Nov 3 01:24:18 2010
@@ -17,45 +17,45 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.propparam.validate.mandatory;
-package org.apache.isis.metamodel.facets.propparam.validate.mandatory;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.FacetHolder;
-
-
-/**
- * Whether a property or a parameter is mandatory (not optional).
- *
- * <p>
- * For a mandatory property, the object cannot be saved/updated without the value being provided. For a
- * mandatory parameter, the action cannot be invoked without the value being provided.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, specify mandatory by <i>omitting</i> the
- * <tt>@Optional</tt> annotation.
- */
-public class MandatoryFacetDefault extends MandatoryFacetAbstract {
-
- public MandatoryFacetDefault(final FacetHolder holder) {
- super(holder);
- }
-
- /**
- * If not specified or, if a string, then zero length.
- */
- public boolean isRequiredButNull(final ObjectAdapter adapter) {
- final Object object = unwrapObject(adapter);
- if (object == null) {
- return true;
- }
- // special case string handling.
- final String str = unwrapString(adapter);
- return str != null && str.length() == 0;
- }
-
- public boolean isInvertedSemantics() {
- return false;
- }
-
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.FacetHolder;
+
+/**
+ * Whether a property or a parameter is mandatory (not optional).
+ *
+ * <p>
+ * For a mandatory property, the object cannot be saved/updated without the value being provided. For a mandatory
+ * parameter, the action cannot be invoked without the value being provided.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, specify mandatory by <i>omitting</i> the <tt>@Optional</tt>
+ * annotation.
+ */
+public class MandatoryFacetDefault extends MandatoryFacetAbstract {
+
+ public MandatoryFacetDefault(final FacetHolder holder) {
+ super(holder);
+ }
+
+ /**
+ * If not specified or, if a string, then zero length.
+ */
+ @Override
+ public boolean isRequiredButNull(final ObjectAdapter adapter) {
+ final Object object = unwrapObject(adapter);
+ if (object == null) {
+ return true;
+ }
+ // special case string handling.
+ final String str = unwrapString(adapter);
+ return str != null && str.length() == 0;
+ }
+
+ @Override
+ public boolean isInvertedSemantics() {
+ return false;
+ }
+
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mask/MaskFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mask/MaskFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mask/MaskFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/mask/MaskFacet.java Wed Nov 3 01:24:18 2010
@@ -17,30 +17,28 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.propparam.validate.mask;
-package org.apache.isis.metamodel.facets.propparam.validate.mask;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.SingleStringValueFacet;
-import org.apache.isis.metamodel.facets.propparam.validate.regex.RegExFacet;
-import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
-
-
-/**
- * Whether the (string) property or a parameter must correspond to a specific mask.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to the <tt>@Mask</tt> annotation.
- *
- * <p>
- * TODO: not yet implemented by the framework or any viewer.
- *
- * @see RegExFacet
- */
-public interface MaskFacet extends SingleStringValueFacet, ValidatingInteractionAdvisor {
-
- /**
- * Whether the provided string matches the mask.
- */
- public boolean doesNotMatch(ObjectAdapter adapter);
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.SingleStringValueFacet;
+import org.apache.isis.metamodel.facets.propparam.validate.regex.RegExFacet;
+import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
+
+/**
+ * Whether the (string) property or a parameter must correspond to a specific mask.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to the <tt>@Mask</tt> annotation.
+ *
+ * <p>
+ * TODO: not yet implemented by the framework or any viewer.
+ *
+ * @see RegExFacet
+ */
+public interface MaskFacet extends SingleStringValueFacet, ValidatingInteractionAdvisor {
+
+ /**
+ * Whether the provided string matches the mask.
+ */
+ public boolean doesNotMatch(ObjectAdapter adapter);
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/maxlength/MaxLengthFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/maxlength/MaxLengthFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/maxlength/MaxLengthFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/maxlength/MaxLengthFacet.java Wed Nov 3 01:24:18 2010
@@ -17,25 +17,23 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.propparam.validate.maxlength;
-package org.apache.isis.metamodel.facets.propparam.validate.maxlength;
-
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.facets.SingleIntValueFacet;
-import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
-
-
-/**
- * Whether the (string) property or a parameter's length must not exceed a certain length.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to the <tt>@MaxLength</tt> annotation.
- */
-public interface MaxLengthFacet extends SingleIntValueFacet, ValidatingInteractionAdvisor {
-
- /**
- * Whether the provided string exceeds the maximum length.
- */
- public boolean exceeds(ObjectAdapter adapter);
-
-}
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.facets.SingleIntValueFacet;
+import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
+
+/**
+ * Whether the (string) property or a parameter's length must not exceed a certain length.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to the <tt>@MaxLength</tt> annotation.
+ */
+public interface MaxLengthFacet extends SingleIntValueFacet, ValidatingInteractionAdvisor {
+
+ /**
+ * Whether the provided string exceeds the maximum length.
+ */
+ public boolean exceeds(ObjectAdapter adapter);
+
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/regex/RegExFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/regex/RegExFacet.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/regex/RegExFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/facets/propparam/validate/regex/RegExFacet.java Wed Nov 3 01:24:18 2010
@@ -17,32 +17,30 @@
* under the License.
*/
+package org.apache.isis.metamodel.facets.propparam.validate.regex;
-package org.apache.isis.metamodel.facets.propparam.validate.regex;
-
-import org.apache.isis.metamodel.facets.MultipleValueFacet;
-import org.apache.isis.metamodel.facets.propparam.validate.mask.MaskFacet;
-import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
-
-
-/**
- * Whether the (string) property or a parameter must correspond to a specific regular expression.
- *
- * <p>
- * In the standard [[NAME]] Programming Model, corresponds to the <tt>@RegEx</tt> annotation.
- *
- * @see MaskFacet
- */
-public interface RegExFacet extends MultipleValueFacet, ValidatingInteractionAdvisor {
-
- public String validation();
-
- public String format();
-
- public boolean caseSensitive();
-
- public boolean doesNotMatch(String proposed);
-
- public String format(String text);
-
-}
+import org.apache.isis.metamodel.facets.MultipleValueFacet;
+import org.apache.isis.metamodel.facets.propparam.validate.mask.MaskFacet;
+import org.apache.isis.metamodel.interactions.ValidatingInteractionAdvisor;
+
+/**
+ * Whether the (string) property or a parameter must correspond to a specific regular expression.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to the <tt>@RegEx</tt> annotation.
+ *
+ * @see MaskFacet
+ */
+public interface RegExFacet extends MultipleValueFacet, ValidatingInteractionAdvisor {
+
+ public String validation();
+
+ public String format();
+
+ public boolean caseSensitive();
+
+ public boolean doesNotMatch(String proposed);
+
+ public String format(String text);
+
+}
Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/java5/FallbackFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/java5/FallbackFacetFactory.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/java5/FallbackFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/metamodel/java5/FallbackFacetFactory.java Wed Nov 3 01:24:18 2010
@@ -17,120 +17,117 @@
* under the License.
*/
+package org.apache.isis.metamodel.java5;
-package org.apache.isis.metamodel.java5;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.isis.metamodel.facets.Facet;
-import org.apache.isis.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.metamodel.facets.FacetHolder;
-import org.apache.isis.metamodel.facets.FacetUtil;
-import org.apache.isis.metamodel.facets.MethodRemover;
-import org.apache.isis.metamodel.facets.actions.choices.ActionChoicesFacetNone;
-import org.apache.isis.metamodel.facets.actions.defaults.ActionDefaultsFacetNone;
-import org.apache.isis.metamodel.facets.actions.executed.ExecutedFacetAtDefault;
-import org.apache.isis.metamodel.facets.help.HelpFacetNone;
-import org.apache.isis.metamodel.facets.naming.describedas.DescribedAsFacetNone;
-import org.apache.isis.metamodel.facets.naming.named.NamedFacetNone;
-import org.apache.isis.metamodel.facets.object.ident.title.TitleFacetNone;
-import org.apache.isis.metamodel.facets.object.notpersistable.NotPersistableFacetNull;
-import org.apache.isis.metamodel.facets.propparam.multiline.MultiLineFacetNone;
-import org.apache.isis.metamodel.facets.propparam.validate.maxlength.MaxLengthFacetUnlimited;
-import org.apache.isis.metamodel.spec.feature.ObjectFeatureType;
-import org.apache.isis.metamodel.specloader.internal.peer.JavaObjectActionParamPeer;
-import org.apache.isis.metamodel.specloader.internal.peer.JavaObjectActionPeer;
-import org.apache.isis.metamodel.specloader.internal.peer.JavaObjectMemberPeer;
-import org.apache.isis.metamodel.specloader.internal.peer.JavaOneToOneAssociationPeer;
-
-
-/**
- * Central point for providing some kind of default for any {@link Facet}s required by the [[NAME]]
- * Framework itself.
- *
- */
-public class FallbackFacetFactory extends FacetFactoryAbstract {
-
- @SuppressWarnings("unused")
- private final static Map<Class<?>, Integer> TYPICAL_LENGTHS_BY_CLASS = new HashMap<Class<?>, Integer>() {
- private static final long serialVersionUID = 1L;
- {
- putTypicalLength(byte.class, Byte.class, 3);
- putTypicalLength(short.class, Short.class, 5);
- putTypicalLength(int.class, Integer.class, 10);
- putTypicalLength(long.class, Long.class, 20);
- putTypicalLength(float.class, Float.class, 20);
- putTypicalLength(double.class, Double.class, 20);
- putTypicalLength(char.class, Character.class, 1);
- putTypicalLength(boolean.class, Boolean.class, 1);
- }
-
- private void putTypicalLength(final Class<?> primitiveClass, final Class<?> wrapperClass, final int length) {
- put(primitiveClass, Integer.valueOf(length));
- put(wrapperClass, Integer.valueOf(length));
- }
- };
-
- public FallbackFacetFactory() {
- super(ObjectFeatureType.EVERYTHING);
- }
-
- public boolean recognizes(final Method method) {
- return false;
- }
-
- @Override
- public boolean process(final Class<?> type, final MethodRemover methodRemover, final FacetHolder holder) {
- return FacetUtil.addFacets(new Facet[] { new DescribedAsFacetNone(holder),
- // commenting these out, think this whole isNoop business is a little bogus
- // new ImmutableFacetNever(holder),
- new NotPersistableFacetNull(holder), new TitleFacetNone(holder), });
- }
-
- @Override
- public boolean process(Class<?> cls, final Method method, final MethodRemover methodRemover, final FacetHolder holder) {
- final List<Facet> facets = new ArrayList<Facet>();
-
- if (holder instanceof JavaObjectMemberPeer) {
- facets.add(new NamedFacetNone(holder));
- facets.add(new DescribedAsFacetNone(holder));
- facets.add(new HelpFacetNone(holder));
- }
-
- if (holder instanceof JavaOneToOneAssociationPeer) {
- facets.add(new MaxLengthFacetUnlimited(holder));
- facets.add(new MultiLineFacetNone(true, holder));
- }
-
- if (holder instanceof JavaObjectActionPeer) {
- facets.add(new ExecutedFacetAtDefault(holder));
- facets.add(new ActionDefaultsFacetNone(holder));
- facets.add(new ActionChoicesFacetNone(holder));
- }
-
- return FacetUtil.addFacets(facets);
- }
-
- @Override
- public boolean processParams(final Method method, final int paramNum, final FacetHolder holder) {
- final List<Facet> facets = new ArrayList<Facet>();
-
- if (holder instanceof JavaObjectActionParamPeer) {
-
- facets.add(new NamedFacetNone(holder));
- facets.add(new DescribedAsFacetNone(holder));
- facets.add(new HelpFacetNone(holder));
- facets.add(new MultiLineFacetNone(false, holder));
-
- facets.add(new MaxLengthFacetUnlimited(holder));
- }
-
- return FacetUtil.addFacets(facets);
- }
-
-}
-
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.isis.metamodel.facets.Facet;
+import org.apache.isis.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.metamodel.facets.FacetHolder;
+import org.apache.isis.metamodel.facets.FacetUtil;
+import org.apache.isis.metamodel.facets.MethodRemover;
+import org.apache.isis.metamodel.facets.actions.choices.ActionChoicesFacetNone;
+import org.apache.isis.metamodel.facets.actions.defaults.ActionDefaultsFacetNone;
+import org.apache.isis.metamodel.facets.actions.executed.ExecutedFacetAtDefault;
+import org.apache.isis.metamodel.facets.help.HelpFacetNone;
+import org.apache.isis.metamodel.facets.naming.describedas.DescribedAsFacetNone;
+import org.apache.isis.metamodel.facets.naming.named.NamedFacetNone;
+import org.apache.isis.metamodel.facets.object.ident.title.TitleFacetNone;
+import org.apache.isis.metamodel.facets.object.notpersistable.NotPersistableFacetNull;
+import org.apache.isis.metamodel.facets.propparam.multiline.MultiLineFacetNone;
+import org.apache.isis.metamodel.facets.propparam.validate.maxlength.MaxLengthFacetUnlimited;
+import org.apache.isis.metamodel.spec.feature.ObjectFeatureType;
+import org.apache.isis.metamodel.specloader.internal.peer.JavaObjectActionParamPeer;
+import org.apache.isis.metamodel.specloader.internal.peer.JavaObjectActionPeer;
+import org.apache.isis.metamodel.specloader.internal.peer.JavaObjectMemberPeer;
+import org.apache.isis.metamodel.specloader.internal.peer.JavaOneToOneAssociationPeer;
+
+/**
+ * Central point for providing some kind of default for any {@link Facet}s required by the Apache Isis framework itself.
+ *
+ */
+public class FallbackFacetFactory extends FacetFactoryAbstract {
+
+ @SuppressWarnings("unused")
+ private final static Map<Class<?>, Integer> TYPICAL_LENGTHS_BY_CLASS = new HashMap<Class<?>, Integer>() {
+ private static final long serialVersionUID = 1L;
+ {
+ putTypicalLength(byte.class, Byte.class, 3);
+ putTypicalLength(short.class, Short.class, 5);
+ putTypicalLength(int.class, Integer.class, 10);
+ putTypicalLength(long.class, Long.class, 20);
+ putTypicalLength(float.class, Float.class, 20);
+ putTypicalLength(double.class, Double.class, 20);
+ putTypicalLength(char.class, Character.class, 1);
+ putTypicalLength(boolean.class, Boolean.class, 1);
+ }
+
+ private void putTypicalLength(final Class<?> primitiveClass, final Class<?> wrapperClass, final int length) {
+ put(primitiveClass, Integer.valueOf(length));
+ put(wrapperClass, Integer.valueOf(length));
+ }
+ };
+
+ public FallbackFacetFactory() {
+ super(ObjectFeatureType.EVERYTHING);
+ }
+
+ public boolean recognizes(final Method method) {
+ return false;
+ }
+
+ @Override
+ public boolean process(final Class<?> type, final MethodRemover methodRemover, final FacetHolder holder) {
+ return FacetUtil.addFacets(new Facet[] { new DescribedAsFacetNone(holder),
+ // commenting these out, think this whole isNoop business is a little bogus
+ // new ImmutableFacetNever(holder),
+ new NotPersistableFacetNull(holder), new TitleFacetNone(holder), });
+ }
+
+ @Override
+ public boolean process(Class<?> cls, final Method method, final MethodRemover methodRemover,
+ final FacetHolder holder) {
+ final List<Facet> facets = new ArrayList<Facet>();
+
+ if (holder instanceof JavaObjectMemberPeer) {
+ facets.add(new NamedFacetNone(holder));
+ facets.add(new DescribedAsFacetNone(holder));
+ facets.add(new HelpFacetNone(holder));
+ }
+
+ if (holder instanceof JavaOneToOneAssociationPeer) {
+ facets.add(new MaxLengthFacetUnlimited(holder));
+ facets.add(new MultiLineFacetNone(true, holder));
+ }
+
+ if (holder instanceof JavaObjectActionPeer) {
+ facets.add(new ExecutedFacetAtDefault(holder));
+ facets.add(new ActionDefaultsFacetNone(holder));
+ facets.add(new ActionChoicesFacetNone(holder));
+ }
+
+ return FacetUtil.addFacets(facets);
+ }
+
+ @Override
+ public boolean processParams(final Method method, final int paramNum, final FacetHolder holder) {
+ final List<Facet> facets = new ArrayList<Facet>();
+
+ if (holder instanceof JavaObjectActionParamPeer) {
+
+ facets.add(new NamedFacetNone(holder));
+ facets.add(new DescribedAsFacetNone(holder));
+ facets.add(new HelpFacetNone(holder));
+ facets.add(new MultiLineFacetNone(false, holder));
+
+ facets.add(new MaxLengthFacetUnlimited(holder));
+ }
+
+ return FacetUtil.addFacets(facets);
+ }
+
+}
Modified: incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/about/AboutIsis.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/about/AboutIsis.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/about/AboutIsis.java (original)
+++ incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/about/AboutIsis.java Wed Nov 3 01:24:18 2010
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtime.about;
import java.io.IOException;
@@ -29,7 +28,6 @@ import java.util.ResourceBundle;
import org.apache.isis.commons.exceptions.IsisException;
-
public class AboutIsis {
private static String applicationCopyrightNotice;
private static String applicationName;
@@ -43,7 +41,7 @@ public class AboutIsis {
static {
try {
- final ResourceBundle bundle = ResourceBundle.getBundle("nof-version");
+ final ResourceBundle bundle = ResourceBundle.getBundle("isis-version");
logo = bundle.getString("framework.logo");
frameworkVersion = bundle.getString("framework.version");
frameworkName = bundle.getString("framework.name");
@@ -52,7 +50,7 @@ public class AboutIsis {
} catch (final MissingResourceException ex) {
logo = "splash-logo";
frameworkVersion = "${project.version}-r${buildNumber}";
- frameworkCopyright = "Copyright (c) 2002~2009 [[NAME]] Group";
+ frameworkCopyright = "Copyright (c) 2010 Apache Software Foundation";
frameworkName = "${project.parent.name}";
}
@@ -63,8 +61,8 @@ public class AboutIsis {
try {
String moduleId = "org.apache.isis.plugins:dndviewer";
String module = moduleId.replace(":", "/");
- InputStream resourceAsStream = AboutIsis.class.getClassLoader().getResourceAsStream(
- "META-INF/maven/" + module + "/pom.properties");
+ InputStream resourceAsStream =
+ AboutIsis.class.getClassLoader().getResourceAsStream("META-INF/maven/" + module + "/pom.properties");
if (resourceAsStream == null) {
return "no version";
}
@@ -91,7 +89,7 @@ public class AboutIsis {
}
public static String getFrameworkCopyrightNotice() {
- return select(frameworkCopyright, "Copyright [[NAME]] Group");
+ return select(frameworkCopyright, "Copyright Apache Software Foundation");
}
public static String getFrameworkCompileDate() {
@@ -99,7 +97,7 @@ public class AboutIsis {
}
public static String getFrameworkName() {
- return select(frameworkName, "[[NAME]] Framework");
+ return select(frameworkName, "Apache Isis (incubating)");
}
public static String getImageName() {
@@ -108,11 +106,10 @@ public class AboutIsis {
public static String getFrameworkVersion() {
String version = "Version " + select(frameworkVersion, "unreleased");
- /* NOT in use yet:
- for (ComponentDetails details : componentDetails) {
- version += "\n" + details.getName() + " " + details.getModule() + " " + details.getVersion();
- }
- */
+ /*
+ * NOT in use yet: for (ComponentDetails details : componentDetails) { version += "\n" + details.getName() + " "
+ * + details.getModule() + " " + details.getVersion(); }
+ */
return version;
}
Modified: incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContext.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContext.java (original)
+++ incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContext.java Wed Nov 3 01:24:18 2010
@@ -17,19 +17,15 @@
* under the License.
*/
-
package org.apache.isis.runtime.context;
import java.util.List;
-import org.apache.log4j.Logger;
import org.apache.isis.commons.components.TransactionScopedComponent;
import org.apache.isis.commons.debug.DebugInfo;
import org.apache.isis.commons.debug.DebugList;
import org.apache.isis.commons.debug.DebugString;
import org.apache.isis.commons.exceptions.IsisException;
-import org.apache.isis.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.commons.lang.Maybe;
import org.apache.isis.metamodel.authentication.AuthenticationSession;
import org.apache.isis.metamodel.config.ConfigurationException;
import org.apache.isis.metamodel.config.IsisConfiguration;
@@ -47,15 +43,12 @@ import org.apache.isis.runtime.transacti
import org.apache.isis.runtime.transaction.updatenotifier.UpdateNotifier;
import org.apache.isis.runtime.userprofile.UserProfile;
import org.apache.isis.runtime.userprofile.UserProfileLoader;
-
-import com.google.inject.Injector;
-
+import org.apache.log4j.Logger;
/**
- * Provides singleton <i>access to</i> the current (session scoped) {@link IsisSession}, along with
- * convenience methods to obtain application-scoped components and also any transaction-scoped components
- * {@link TransactionScopedComponent}s if a {@link IsisTransaction}
- * {@link IsisSession#getCurrentTransaction() is in progress}.
+ * Provides singleton <i>access to</i> the current (session scoped) {@link IsisSession}, along with convenience methods
+ * to obtain application-scoped components and also any transaction-scoped components {@link TransactionScopedComponent}
+ * s if a {@link IsisTransaction} {@link IsisSession#getCurrentTransaction() is in progress}.
*
* <p>
* Somewhat analogous to (the static methods in) <tt>HibernateUtil</tt>.
@@ -124,12 +117,10 @@ public abstract class IsisContext implem
* Will throw an exception if an instance has already been created and is not
* {@link ContextReplacePolicy#REPLACEABLE}.
*/
- protected IsisContext(
- final ContextReplacePolicy replacePolicy,
- final SessionClosePolicy sessionClosePolicy,
- final IsisSessionFactory sessionFactory) {
+ protected IsisContext(final ContextReplacePolicy replacePolicy, final SessionClosePolicy sessionClosePolicy,
+ final IsisSessionFactory sessionFactory) {
if (singleton != null && !singleton.isContextReplaceable()) {
- throw new IsisException("[[NAME]] Context already set up and cannot be replaced");
+ throw new IsisException("Isis Context already set up and cannot be replaced");
}
singleton = this;
this.sessionFactory = sessionFactory;
@@ -199,11 +190,10 @@ public abstract class IsisContext implem
* Ignored if already closed.
*
* <p>
- * This method is <i>not</i> marked <tt>final</tt> so it can be overridden if necessarily.
- * Generally speaking this shouldn't be necessary; one case where it might though is
- * if an implementation has multiple concurrent uses of a session, in which case "closing"
- * the session really means just deregistering the usage of it by a particular thread; only
- * when all threads have finished with a session can it really be closed.
+ * This method is <i>not</i> marked <tt>final</tt> so it can be overridden if necessarily. Generally speaking this
+ * shouldn't be necessary; one case where it might though is if an implementation has multiple concurrent uses of a
+ * session, in which case "closing" the session really means just deregistering the usage of it by a particular
+ * thread; only when all threads have finished with a session can it really be closed.
*/
public void closeSessionInstance() {
if (getSessionInstance() != null) {
@@ -213,22 +203,21 @@ public abstract class IsisContext implem
}
/**
- * Overridable hook method called from {@link #closeSessionInstance()}, allowing subclasses to clean up
- * (for example datastructures).
+ * Overridable hook method called from {@link #closeSessionInstance()}, allowing subclasses to clean up (for example
+ * datastructures).
*
* <p>
- * The {@link #getSessionInstance() current} {@link IsisSession} will already have been
- * {@link IsisSession#close() closed}.
+ * The {@link #getSessionInstance() current} {@link IsisSession} will already have been {@link IsisSession#close()
+ * closed}.
*/
- protected void doClose() {}
+ protected void doClose() {
+ }
/**
* Shutdown the application.
*/
protected abstract void closeAllSessionsInstance();
-
-
// ///////////////////////////////////////////////////////////
// getSession()
// ///////////////////////////////////////////////////////////
@@ -237,8 +226,8 @@ public abstract class IsisContext implem
* Locates the current {@link IsisSession}.
*
* <p>
- * This might just be a singleton (eg {@link IsisContextStatic}), or could be retrieved from the
- * thread (eg {@link IsisContextThreadLocal}).
+ * This might just be a singleton (eg {@link IsisContextStatic}), or could be retrieved from the thread (eg
+ * {@link IsisContextThreadLocal}).
*/
public abstract IsisSession getSessionInstance();
@@ -278,8 +267,7 @@ public abstract class IsisContext implem
}
/**
- * Convenience method to return {@link IsisSession} for specified
- * {@link IsisSession#getId()}.
+ * Convenience method to return {@link IsisSession} for specified {@link IsisSession#getId()}.
*
* <p>
* Provided primarily for debugging.
@@ -297,7 +285,7 @@ public abstract class IsisContext implem
LOG.info("closing all instances");
IsisContext instance = getInstance();
if (instance != null) {
- instance.closeAllSessionsInstance();
+ instance.closeAllSessionsInstance();
}
}
@@ -306,8 +294,7 @@ public abstract class IsisContext implem
// ///////////////////////////////////////////////////////////
/**
- * Convenience method returning the {@link IsisSessionFactory} of the current {@link #getSession()
- * session}.
+ * Convenience method returning the {@link IsisSessionFactory} of the current {@link #getSession() session}.
*/
public static IsisSessionFactory getSessionFactory() {
return getInstance().getSessionFactoryInstance();
@@ -324,9 +311,9 @@ public abstract class IsisContext implem
}
// REVIEW
return configuration;
- //return getSessionFactory().getConfiguration();
+ // return getSessionFactory().getConfiguration();
}
-
+
public static void setConfiguration(IsisConfiguration configuration) {
IsisContext.configuration = configuration;
}
@@ -363,10 +350,9 @@ public abstract class IsisContext implem
*
* @see IsisSessionFactory#getAuthorizationManager()
*/
- public static AuthorizationManager getAuthorizationManager() {
- return getSessionFactory().getAuthorizationManager();
- }
-
+ public static AuthorizationManager getAuthorizationManager() {
+ return getSessionFactory().getAuthorizationManager();
+ }
/**
* Convenience method.
@@ -376,7 +362,7 @@ public abstract class IsisContext implem
public static TemplateImageLoader getTemplateImageLoader() {
return getSessionFactory().getTemplateImageLoader();
}
-
+
public static UserProfileLoader getUserProfileLoader() {
return getSessionFactory().getUserProfileLoader();
}
@@ -384,14 +370,13 @@ public abstract class IsisContext implem
public static List<Object> getServices() {
return getSessionFactory().getServices();
}
-
// ///////////////////////////////////////////////////////////
// Static Convenience methods (session scoped)
// ///////////////////////////////////////////////////////////
public static boolean inSession() {
- IsisSession session = getInstance().getSessionInstance();
+ IsisSession session = getInstance().getSessionInstance();
return session != null;
}
@@ -407,8 +392,8 @@ public abstract class IsisContext implem
}
/**
- * Convenience method to return the {@link #getSession() current} {@link IsisSession}'s
- * {@link IsisSession#getId() id}.
+ * Convenience method to return the {@link #getSession() current} {@link IsisSession}'s {@link IsisSession#getId()
+ * id}.
*
* @see IsisSession#getId()
*/
@@ -456,17 +441,15 @@ public abstract class IsisContext implem
// ///////////////////////////////////////////////////////////
public static boolean inTransaction() {
- return inSession() &&
- getCurrentTransaction() != null &&
- !getCurrentTransaction().getState().isComplete();
+ return inSession() && getCurrentTransaction() != null && !getCurrentTransaction().getState().isComplete();
}
/**
* Convenience method, returning the current {@link IsisTransaction transaction} (if any).
*
* <p>
- * Transactions are managed using the {@link IsisTransactionManager} obtainable from the
- * {@link IsisSession's} {@link PersistenceSession}.
+ * Transactions are managed using the {@link IsisTransactionManager} obtainable from the {@link IsisSession's}
+ * {@link PersistenceSession}.
*
* @see IsisSession#getCurrentTransaction()
* @see PersistenceSession#getTransactionManager()
@@ -496,9 +479,9 @@ public abstract class IsisContext implem
// ///////////////////////////////////////////////////////////
public static DebugInfo[] debugSystem() {
- DebugList debugList = new DebugList("[[NAME]] System");
+ DebugList debugList = new DebugList("Apache Isis System");
debugList.add("Context", getInstance());
- debugList.add("[[NAME]] session factory", getSessionFactory());
+ debugList.add("Apache Isis session factory", getSessionFactory());
debugList.add(" Authentication manager", getSessionFactory().getAuthenticationManager());
debugList.add(" Persistence session factory", getSessionFactory().getPersistenceSessionFactory());
debugList.add("User profile loader", getUserProfileLoader());
@@ -512,25 +495,26 @@ public abstract class IsisContext implem
debugList.add("Services", getServices());
return debugList.debug();
}
-
+
public static DebugInfo[] debugSession() {
- DebugList debugList = new DebugList("[[NAME]] Session");
- debugList.add("[[NAME]] session", getSession());
+ DebugList debugList = new DebugList("Apache Isis Session");
+ debugList.add("Apache Isis session", getSession());
debugList.add("Authentication session", getAuthenticationSession());
debugList.add("User profile", getUserProfile());
-
+
debugList.add("Persistence Session", getPersistenceSession());
debugList.add("Transaction Manager", getTransactionManager());
-
+
debugList.add("Service injector", getPersistenceSession().getServicesInjector());
debugList.add("Adapter factory", getPersistenceSession().getAdapterFactory());
debugList.add("Object factory", getPersistenceSession().getObjectFactory());
debugList.add("OID generator", getPersistenceSession().getOidGenerator());
debugList.add("Adapter manager", getPersistenceSession().getAdapterManager());
debugList.add("Services", getPersistenceSession().getServices());
- return debugList.debug();
+ return debugList.debug();
}
+ @Override
public void debugData(final DebugString debug) {
debug.appendln("context ", this);
}
Modified: incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextPipe.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextPipe.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextPipe.java (original)
+++ incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextPipe.java Wed Nov 3 01:24:18 2010
@@ -17,48 +17,40 @@
* under the License.
*/
-
package org.apache.isis.runtime.context;
import org.apache.isis.commons.debug.DebugString;
-import org.apache.isis.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.commons.lang.Maybe;
import org.apache.isis.metamodel.authentication.AuthenticationSession;
import org.apache.isis.runtime.session.IsisSession;
import org.apache.isis.runtime.session.IsisSessionFactory;
-import com.google.inject.Injector;
-
-
/**
- * A specialised IsisContext implementation that provides two sets of components: one for the server;
- * and one for the client. This simply determines the current thread and if that thread is the server thread
- * then it provides server data. For any other thread the client data is used.
+ * A specialised IsisContext implementation that provides two sets of components: one for the server; and one for the
+ * client. This simply determines the current thread and if that thread is the server thread then it provides server
+ * data. For any other thread the client data is used.
*/
public class IsisContextPipe extends IsisContextMultiUser {
-
+
public static IsisContext createInstance(final IsisSessionFactory sessionFactory) {
return new IsisContextPipe(sessionFactory);
}
-
private IsisSession clientSession;
private IsisSession serverSession;
-
+
private Thread server;
-
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
// Constructor
- /////////////////////////////////////////////////////
-
+ // ///////////////////////////////////////////////////
+
private IsisContextPipe(final IsisSessionFactory sessionFactory) {
super(sessionFactory);
}
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
// Server (not API)
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
public void setServer(final Thread server) {
this.server = server;
@@ -68,10 +60,9 @@ public class IsisContextPipe extends Isi
return Thread.currentThread() == server;
}
-
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
// getCurrent() Hook
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
@Override
protected IsisSession getSessionInstance(final String sessionId) {
@@ -86,7 +77,8 @@ public class IsisContextPipe extends Isi
return clientSession;
}
}
-
+
+ @Override
public IsisSession openSessionInstance(final AuthenticationSession authenticationSession) {
applySessionClosePolicy();
IsisSession newSession = getSessionFactoryInstance().openSession(authenticationSession);
@@ -98,31 +90,30 @@ public class IsisContextPipe extends Isi
return newSession;
}
-
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
// shutdown
- /////////////////////////////////////////////////////
-
+ // ///////////////////////////////////////////////////
@Override
- public void closeAllSessionsInstance() {}
+ public void closeAllSessionsInstance() {
+ }
-
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
// Execution Context Ids
- /////////////////////////////////////////////////////
-
+ // ///////////////////////////////////////////////////
+
@Override
public String[] allSessionIds() {
return new String[] { clientSession.getId(), serverSession.getId() };
}
-
- /////////////////////////////////////////////////////
+
+ // ///////////////////////////////////////////////////
// Debugging
- /////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////
+ @Override
public String debugTitle() {
- return "[[NAME]] (pipe) " + Thread.currentThread().getName();
+ return "Isis (pipe) " + Thread.currentThread().getName();
}
@Override
@@ -131,6 +122,4 @@ public class IsisContextPipe extends Isi
debug.appendln("Server thread", server);
}
-
-
}
Modified: incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextThreadLocal.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextThreadLocal.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextThreadLocal.java (original)
+++ incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/context/IsisContextThreadLocal.java Wed Nov 3 01:24:18 2010
@@ -17,24 +17,22 @@
* under the License.
*/
-
package org.apache.isis.runtime.context;
import java.util.HashMap;
import java.util.Map;
-import org.apache.log4j.Logger;
import org.apache.isis.commons.debug.DebugString;
import org.apache.isis.metamodel.authentication.AuthenticationSession;
import org.apache.isis.runtime.session.IsisSession;
import org.apache.isis.runtime.session.IsisSessionFactory;
-
+import org.apache.log4j.Logger;
/**
* Basic multi-user implementation of Isis that stores a set of components for each thread in use.
*/
public class IsisContextThreadLocal extends IsisContextMultiUser {
-
+
private static final Logger LOG = Logger.getLogger(IsisContextThreadLocal.class);
public static IsisContext createInstance(final IsisSessionFactory sessionFactory) {
@@ -47,23 +45,19 @@ public class IsisContextThreadLocal exte
super(sessionFactory);
}
-
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
// Session
- ///////////////////////////////////////////////////////////
-
+ // /////////////////////////////////////////////////////////
-
@Override
public void closeAllSessionsInstance() {
shutdownAllThreads();
}
-
protected void shutdownAllThreads() {
synchronized (sessionsByThread) {
int i = 0;
- for (Thread thread: sessionsByThread.keySet()) {
+ for (Thread thread : sessionsByThread.keySet()) {
LOG.info("Shutting down thread: " + i++);
IsisSession data = sessionsByThread.get(thread);
data.closeAll();
@@ -71,35 +65,33 @@ public class IsisContextThreadLocal exte
}
}
-
@Override
protected void doClose() {
sessionsByThread.remove(Thread.currentThread());
}
-
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
// Execution Context Ids
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
@Override
public String[] allSessionIds() {
final String[] ids = new String[sessionsByThread.size()];
int i = 0;
- for(Thread thread: sessionsByThread.keySet()) {
+ for (Thread thread : sessionsByThread.keySet()) {
final IsisSession data = sessionsByThread.get(thread);
ids[i++] = data.getId();
}
return ids;
}
-
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
// Debugging
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
+ @Override
public String debugTitle() {
- return "[[NAME]] (by thread) " + Thread.currentThread().getName();
+ return "Isis (by thread) " + Thread.currentThread().getName();
}
@Override
@@ -107,7 +99,7 @@ public class IsisContextThreadLocal exte
super.debugData(debug);
debug.appendln();
debug.appendTitle("Threads based Contexts");
- for(Thread thread: sessionsByThread.keySet()) {
+ for (Thread thread : sessionsByThread.keySet()) {
final IsisSession data = sessionsByThread.get(thread);
debug.appendln(thread.toString(), data);
}
@@ -115,8 +107,8 @@ public class IsisContextThreadLocal exte
@Override
protected IsisSession getSessionInstance(final String executionContextId) {
- for(Thread thread: sessionsByThread.keySet()) {
- final IsisSession data = (IsisSession) sessionsByThread.get(thread);
+ for (Thread thread : sessionsByThread.keySet()) {
+ final IsisSession data = sessionsByThread.get(thread);
if (data.getId().equals(executionContextId)) {
return data;
}
@@ -124,12 +116,9 @@ public class IsisContextThreadLocal exte
return null;
}
-
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
// open, close
- ///////////////////////////////////////////////////////////
-
-
+ // /////////////////////////////////////////////////////////
/**
* Is only intended to be called through {@link IsisContext#openSession(AuthenticationSession)}.
@@ -142,18 +131,20 @@ public class IsisContextThreadLocal exte
Thread thread = Thread.currentThread();
synchronized (sessionsByThread) {
applySessionClosePolicy();
- IsisSession session = getSessionFactoryInstance().openSession(authenticationSession);
- LOG.info(" opening session " + session + " (count " + sessionsByThread.size() + ") for " + authenticationSession.getUserName());
- saveSession(thread, session);
- session.open();
- return session;
+ IsisSession session = getSessionFactoryInstance().openSession(authenticationSession);
+ LOG.info(" opening session " + session + " (count " + sessionsByThread.size() + ") for "
+ + authenticationSession.getUserName());
+ saveSession(thread, session);
+ session.open();
+ return session;
}
}
- protected IsisSession createAndOpenSession(final Thread thread, AuthenticationSession authenticationSession) {
+ protected IsisSession createAndOpenSession(final Thread thread, AuthenticationSession authenticationSession) {
IsisSession session = getSessionFactoryInstance().openSession(authenticationSession);
session.open();
- LOG.info(" opening session " + session + " (count " + sessionsByThread.size() + ") for " + authenticationSession.getUserName());
+ LOG.info(" opening session " + session + " (count " + sessionsByThread.size() + ") for "
+ + authenticationSession.getUserName());
return session;
}
@@ -165,11 +156,9 @@ public class IsisContextThreadLocal exte
return session;
}
-
-
- ///////////////////////////////////////////////////////////
- // getCurrent() (Hook)
- ///////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////
+ // getCurrent() (Hook)
+ // /////////////////////////////////////////////////////////
/**
* Get {@link IsisSession execution context} used by the current thread.
@@ -179,14 +168,12 @@ public class IsisContextThreadLocal exte
@Override
public IsisSession getSessionInstance() {
final Thread thread = Thread.currentThread();
- IsisSession session = (IsisSession) sessionsByThread.get(thread);
- /* REVIEW this has been moved to IsisContext.getSession()
- if (session == null) {
- throw new IllegalStateException("No Session opened for this thread");
- }*/
+ IsisSession session = sessionsByThread.get(thread);
+ /*
+ * REVIEW this has been moved to IsisContext.getSession() if (session == null) { throw new
+ * IllegalStateException("No Session opened for this thread"); }
+ */
return session;
}
-
-
}
Modified: incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/memento/Memento.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/memento/Memento.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/memento/Memento.java (original)
+++ incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/memento/Memento.java Wed Nov 3 01:24:18 2010
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtime.memento;
import java.io.IOException;
@@ -25,7 +24,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
import org.apache.isis.commons.debug.DebugString;
import org.apache.isis.commons.exceptions.IsisException;
import org.apache.isis.commons.exceptions.UnknownTypeException;
@@ -48,17 +46,16 @@ import org.apache.isis.runtime.context.I
import org.apache.isis.runtime.persistence.PersistenceSession;
import org.apache.isis.runtime.persistence.PersistenceSessionHydrator;
import org.apache.isis.runtime.persistence.PersistorUtil;
+import org.apache.log4j.Logger;
import com.google.common.collect.Lists;
-
/**
* Holds the state for the specified object in serializable form.
- *
+ *
* <p>
- * This object is {@link Serializable} and can be passed over the network easily. Also for a persistent
- * objects only the reference's {@link Oid}s are held, avoiding the need for serializing the whole object
- * graph.
+ * This object is {@link Serializable} and can be passed over the network easily. Also for a persistent objects only the
+ * reference's {@link Oid}s are held, avoiding the need for serializing the whole object graph.
*/
public class Memento implements Serializable {
@@ -67,12 +64,12 @@ public class Memento implements Serializ
private static final Logger LOG = Logger.getLogger(Memento.class);
private Data state;
- private List<Oid> transientObjects = new ArrayList<Oid>();
+ private final List<Oid> transientObjects = new ArrayList<Oid>();
public Memento(final ObjectAdapter object) {
state = object == null ? null : createData(object);
if (LOG.isDebugEnabled()) {
- LOG.debug("created memento for " + this);
+ LOG.debug("created memento for " + this);
}
}
@@ -89,13 +86,13 @@ public class Memento implements Serializ
final Data[] collData = new Data[facet.size(object)];
int i = 0;
for (ObjectAdapter ref : facet.iterable(object)) {
- String resolveStateName = ref.getResolveState().name();
- String specName = ref.getSpecification().getFullName();
- Oid oid = ref.getOid();
- collData[i++] = new Data(oid, resolveStateName, specName);
+ String resolveStateName = ref.getResolveState().name();
+ String specName = ref.getSpecification().getFullName();
+ Oid oid = ref.getOid();
+ collData[i++] = new Data(oid, resolveStateName, specName);
}
String elementTypeSpecName = object.getSpecification().getFullName();
- return new CollectionData(object.getOid(), object.getResolveState(), elementTypeSpecName , collData);
+ return new CollectionData(object.getOid(), object.getResolveState(), elementTypeSpecName, collData);
}
private ObjectData createObjectData(final ObjectAdapter adapter) {
@@ -103,12 +100,13 @@ public class Memento implements Serializ
final ObjectAssociation[] fields = cls.getAssociations();
final ObjectData data = new ObjectData(adapter.getOid(), adapter.getResolveState().name(), cls.getFullName());
for (int i = 0; i < fields.length; i++) {
- if (fields[i].isNotPersisted()){
- if( fields[i].isOneToManyAssociation()) {
+ if (fields[i].isNotPersisted()) {
+ if (fields[i].isOneToManyAssociation()) {
continue;
}
- if (fields[i].containsFacet(PropertyAccessorFacet.class) && !fields[i].containsFacet(PropertySetterFacet.class)) {
- LOG.debug("ignoring not-settable field " + fields[i].getName());
+ if (fields[i].containsFacet(PropertyAccessorFacet.class)
+ && !fields[i].containsFacet(PropertySetterFacet.class)) {
+ LOG.debug("ignoring not-settable field " + fields[i].getName());
continue;
}
}
@@ -142,7 +140,7 @@ public class Memento implements Serializ
Oid refOid = ref.getOid();
if (refOid == null) {
- return createStandaloneData(ref);
+ return createStandaloneData(ref);
}
if (refOid.isTransient() && !transientObjects.contains(refOid)) {
@@ -157,14 +155,14 @@ public class Memento implements Serializ
}
private Data createStandaloneData(ObjectAdapter adapter) {
- return new StandaloneData(adapter);
- }
+ return new StandaloneData(adapter);
+ }
protected Data getData() {
return state;
}
- public Oid getOid() {
+ public Oid getOid() {
return state.getOid();
}
@@ -173,50 +171,50 @@ public class Memento implements Serializ
return null;
}
final ObjectSpecification spec = getSpecificationLoader().loadSpecification(state.getClassName());
- ObjectAdapter object;
- ResolveState targetState;
- if (getOid().isTransient()) {
- object = getHydrator().recreateAdapter(getOid(), spec);
- targetState = ResolveState.SERIALIZING_TRANSIENT;
- } else {
- object = getHydrator().recreateAdapter(getOid(), spec);
- targetState = ResolveState.UPDATING;
- }
- if (object.getSpecification().isCollection()) {
- populateCollection(object, (CollectionData) state, targetState);
- } else {
- updateObject(object, state, targetState);
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("recreated object " + object.getOid());
- }
- return object;
+ ObjectAdapter object;
+ ResolveState targetState;
+ if (getOid().isTransient()) {
+ object = getHydrator().recreateAdapter(getOid(), spec);
+ targetState = ResolveState.SERIALIZING_TRANSIENT;
+ } else {
+ object = getHydrator().recreateAdapter(getOid(), spec);
+ targetState = ResolveState.UPDATING;
+ }
+ if (object.getSpecification().isCollection()) {
+ populateCollection(object, (CollectionData) state, targetState);
+ } else {
+ updateObject(object, state, targetState);
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("recreated object " + object.getOid());
+ }
+ return object;
}
private void populateCollection(ObjectAdapter collection, CollectionData state, ResolveState targetState) {
ObjectAdapter[] initData = new ObjectAdapter[state.elements.length];
int i = 0;
for (Data elementData : state.elements) {
- initData[i++] = recreateReference(elementData);
+ initData[i++] = recreateReference(elementData);
}
CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
facet.init(collection, initData);
}
private ObjectAdapter recreateReference(final Data data) {
- final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
+ final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
- if (data instanceof StandaloneData) {
- StandaloneData standaloneData = (StandaloneData) data;
- return standaloneData.getAdapter();
- }
+ if (data instanceof StandaloneData) {
+ StandaloneData standaloneData = (StandaloneData) data;
+ return standaloneData.getAdapter();
+ }
final Oid oid = data.getOid();
if (oid == null) {
return null;
}
- ObjectAdapter ref;
+ ObjectAdapter ref;
if (oid.isTransient()) {
ref = getHydrator().recreateAdapter(oid, spec);
} else {
@@ -234,12 +232,11 @@ public class Memento implements Serializ
}
/**
- * Updates the specified object (assuming it is the correct object for this memento) with the state held
- * by this memento.
- *
+ * Updates the specified object (assuming it is the correct object for this memento) with the state held by this
+ * memento.
+ *
* @throws IllegalArgumentException
- * if the memento was created from different logical object to the one specified (i.e. its oid
- * differs).
+ * if the memento was created from different logical object to the one specified (i.e. its oid differs).
*/
public void updateObject(final ObjectAdapter object) {
updateObject(object, state, ResolveState.RESOLVING);
@@ -248,8 +245,9 @@ public class Memento implements Serializ
private void updateObject(final ObjectAdapter object, final Data state, final ResolveState resolveState) {
final Object oid = object.getOid();
if (oid != null && !oid.equals(state.getOid())) {
- throw new IllegalArgumentException("This memento can only be used to update the [[NAME]] with the Oid "
- + state.getOid() + " but is " + oid);
+ throw new IllegalArgumentException(
+ "This memento can only be used to update the ObjectAdapter with the Oid " + state.getOid() + " but is "
+ + oid);
} else {
if (!(state instanceof ObjectData)) {
@@ -258,7 +256,7 @@ public class Memento implements Serializ
updateObject(object, resolveState, state);
}
if (LOG.isDebugEnabled()) {
- LOG.debug("object updated " + object.getOid());
+ LOG.debug("object updated " + object.getOid());
}
}
@@ -275,7 +273,7 @@ public class Memento implements Serializ
final ObjectData od = (ObjectData) state;
if (od.containsField()) {
throw new IsisException("Resolve state (for " + object
- + ") inconsistent with fact that data exists for fields");
+ + ") inconsistent with fact that data exists for fields");
}
}
}
@@ -284,12 +282,12 @@ public class Memento implements Serializ
final ObjectData od = (ObjectData) state;
final ObjectAssociation[] fields = object.getSpecification().getAssociations();
for (ObjectAssociation field : fields) {
- if (field.isNotPersisted()) {
- if( field.isOneToManyAssociation()) {
+ if (field.isNotPersisted()) {
+ if (field.isOneToManyAssociation()) {
continue;
}
if (field.containsFacet(PropertyAccessorFacet.class) && !field.containsFacet(PropertySetterFacet.class)) {
- LOG.debug("ignoring not-settable field " + field.getName());
+ LOG.debug("ignoring not-settable field " + field.getName());
continue;
}
}
@@ -313,24 +311,22 @@ public class Memento implements Serializ
}
}
- private void updateOneToManyAssociation(
- final ObjectAdapter object,
- final OneToManyAssociation field,
- final CollectionData collectionData) {
+ private void updateOneToManyAssociation(final ObjectAdapter object, final OneToManyAssociation field,
+ final CollectionData collectionData) {
final ObjectAdapter collection = field.get(object);
final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
final List<ObjectAdapter> original = Lists.newArrayList();
for (ObjectAdapter adapter : facet.iterable(collection)) {
- original.add(adapter);
- }
+ original.add(adapter);
+ }
Data[] elements = collectionData.elements;
for (Data data : elements) {
final ObjectAdapter element = recreateReference(data);
if (!facet.contains(collection, element)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" association " + field + " changed, added " + element.getOid());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" association " + field + " changed, added " + element.getOid());
+ }
field.addElement(object, element);
} else {
field.removeElement(object, element);
@@ -338,57 +334,54 @@ public class Memento implements Serializ
}
for (ObjectAdapter element : original) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" association " + field + " changed, removed " + element.getOid());
- }
- field.removeElement(object, element);
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" association " + field + " changed, removed " + element.getOid());
+ }
+ field.removeElement(object, element);
+ }
}
- private void updateOneToOneAssociation(final ObjectAdapter object, final OneToOneAssociation field, final Data fieldData) {
+ private void updateOneToOneAssociation(final ObjectAdapter object, final OneToOneAssociation field,
+ final Data fieldData) {
if (fieldData == null) {
field.initAssociation(object, null);
} else {
final ObjectAdapter ref = recreateReference(fieldData);
if (field.get(object) != ref) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" association " + field + " changed to " + ref.getOid());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" association " + field + " changed to " + ref.getOid());
+ }
field.initAssociation(object, ref);
}
}
}
public void encodedData(final DataOutputStreamExtended outputImpl) throws IOException {
- outputImpl.writeEncodable(state);
+ outputImpl.writeEncodable(state);
}
public void restore(final DataInputStreamExtended inputImpl) throws IOException {
state = inputImpl.readEncodable(Data.class);
}
-
-
- /////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////
// toString, debug
- /////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////
@Override
public String toString() {
return "[" + (state == null ? null : state.getClassName() + "/" + state.getOid() + state) + "]";
}
-
public void debug(final DebugString debug) {
if (state != null) {
state.debug(debug);
}
}
-
- /////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////
// Dependencies (from context)
- /////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////
private static SpecificationLoader getSpecificationLoader() {
return IsisContext.getSpecificationLoader();
@@ -402,5 +395,4 @@ public class Memento implements Serializ
return getPersistenceSession();
}
-
}
Modified: incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/persistence/PersistenceSessionContainer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/persistence/PersistenceSessionContainer.java?rev=1030308&r1=1030307&r2=1030308&view=diff
==============================================================================
--- incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/persistence/PersistenceSessionContainer.java (original)
+++ incubator/isis/trunk/core/runtime/src/main/java/org/apache/isis/runtime/persistence/PersistenceSessionContainer.java Wed Nov 3 01:24:18 2010
@@ -17,155 +17,139 @@
* under the License.
*/
+package org.apache.isis.runtime.persistence;
-package org.apache.isis.runtime.persistence;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.metamodel.adapter.ResolveState;
-import org.apache.isis.metamodel.adapter.oid.Oid;
-import org.apache.isis.metamodel.services.container.query.QueryCardinality;
-import org.apache.isis.metamodel.spec.ObjectSpecification;
-import org.apache.isis.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.runtime.persistence.query.PersistenceQuery;
-
-/**
- * PersistenceSession as it appears to most typical client-side code.
- */
-public interface PersistenceSessionContainer {
-
-
- ///////////////////////////////////////////////////////////
- // Creation
- ///////////////////////////////////////////////////////////
-
- /**
- * Creates a new instance of the specified type and returns it in an adapter whose resolved state set to
- * {@link ResolveState#TRANSIENT} (except if the type is marked as {@link ObjectSpecification#isValueOrIsAggregated() aggregated}
- * in which case it will be set to {@link ResolveState#VALUE}).
- *
- * <p>
- * <b><i>
- * REVIEW: not sure about {@link ResolveState#VALUE} - see comments in
- * {@link #adapterFor(Object, Oid, Version)}.</i></b>
- *
- * <p>
- * While creating the object the it will be initialised with default values and its created
- * lifecycle method (its logical constructor) will be invoked. Contrast this with
- * {@link #recreateTransientInstance(Oid, ObjectSpecification)}.
- *
- * <p>
- * This method is ultimately delegated to by the {@link DomainObjectContainer}.
- */
- ObjectAdapter createInstance(ObjectSpecification specification);
-
-
-
- ///////////////////////////////////////////////////////////
- // Finding
- ///////////////////////////////////////////////////////////
-
-
- /**
- * Loads the object identified by the specified {@link Oid} from the persisted
- * set of objects.
- *
- * <p>
- * As used primarily by <tt>ServerDistribution</tt>.
- */
- ObjectAdapter loadObject(Oid oid, ObjectSpecification spec);
-
-
- /**
- * Finds and returns instances that match the specified query.
- *
- * <p>
- * The {@link QueryCardinality} determines whether all instances or just the first matching instance is returned.
- *
- * @throws UnsupportedFindException
- * if the criteria is not support by this persistor
- */
- <T> ObjectAdapter findInstances(Query<T> query, QueryCardinality cardinality);
-
- /**
- * Finds and returns instances that match the specified {@link PersistenceQuery}.
- *
- * <p>
- * Compared to {@link #findInstances(Query, QueryCardinality)}, not that there is no
- * {@link QueryCardinality} parameter. That's because {@link PersistenceQuery} intrinsically
- * carry the knowledge as to how many rows they return.
- *
- * @throws UnsupportedFindException
- * if the criteria is not support by this persistor
- */
- ObjectAdapter findInstances(PersistenceQuery criteria);
-
- /**
- * Whether there are any instances of the specified {@link ObjectSpecification type}.
- *
- * <p>
- * Used (ostensibly) by client-side code.
- */
- boolean hasInstances(ObjectSpecification specification);
-
-
-
- ///////////////////////////////////////////////////////////
- // Resolving
- ///////////////////////////////////////////////////////////
-
- /**
- * Re-initialises the fields of an object. If the object is unresolved then the object's missing data
- * should be retrieved from the persistence mechanism and be used to set up the value objects and
- * associations.
- */
- void resolveImmediately(ObjectAdapter object);
-
- /**
- * Hint that specified field within the specified object is likely to be needed soon. This allows the
- * object's data to be loaded, ready for use.
- *
- * <p>
- * This method need not do anything, but offers the object store the opportunity to load in objects before
- * their use. Contrast this with resolveImmediately, which requires an object to be loaded before
- * continuing.
- *
- * @see #resolveImmediately(ObjectAdapter)
- */
- void resolveField(ObjectAdapter object, ObjectAssociation association);
-
-
- ///////////////////////////////////////////////////////////
- // Persisting
- ///////////////////////////////////////////////////////////
-
- /**
- * Makes a [[NAME]] persistent. The specified object should be stored away via this object store's
- * persistence mechanism, and have an new and unique OID assigned to it (by calling the object's
- * <code>setOid</code> method). The object, should also be added to the cache as the object is implicitly
- * 'in use'.
- *
- * <p>
- * If the object has any associations then each of these, where they aren't already persistent, should
- * also be made persistent by recursively calling this method.
- * </p>
- *
- * <p>
- * If the object to be persisted is a collection, then each element of that collection, that is not
- * already persistent, should be made persistent by recursively calling this method.
- * </p>
- */
- void makePersistent(ObjectAdapter object);
-
- /**
- * Mark the {@link ObjectAdapter} as changed, and therefore requiring flushing
- * to the persistence mechanism.
- */
- void objectChanged(ObjectAdapter object);
-
- void destroyObject(ObjectAdapter object);
-
-}
-
-
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.metamodel.adapter.ResolveState;
+import org.apache.isis.metamodel.adapter.oid.Oid;
+import org.apache.isis.metamodel.services.container.query.QueryCardinality;
+import org.apache.isis.metamodel.spec.ObjectSpecification;
+import org.apache.isis.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.runtime.persistence.query.PersistenceQuery;
+
+/**
+ * PersistenceSession as it appears to most typical client-side code.
+ */
+public interface PersistenceSessionContainer {
+
+ // /////////////////////////////////////////////////////////
+ // Creation
+ // /////////////////////////////////////////////////////////
+
+ /**
+ * Creates a new instance of the specified type and returns it in an adapter whose resolved state set to
+ * {@link ResolveState#TRANSIENT} (except if the type is marked as
+ * {@link ObjectSpecification#isValueOrIsAggregated() aggregated} in which case it will be set to
+ * {@link ResolveState#VALUE}).
+ *
+ * <p>
+ * <b><i> REVIEW: not sure about {@link ResolveState#VALUE} - see comments in
+ * {@link #adapterFor(Object, Oid, Version)}.</i></b>
+ *
+ * <p>
+ * While creating the object the it will be initialised with default values and its created lifecycle method (its
+ * logical constructor) will be invoked. Contrast this with
+ * {@link #recreateTransientInstance(Oid, ObjectSpecification)}.
+ *
+ * <p>
+ * This method is ultimately delegated to by the {@link DomainObjectContainer}.
+ */
+ ObjectAdapter createInstance(ObjectSpecification specification);
+
+ // /////////////////////////////////////////////////////////
+ // Finding
+ // /////////////////////////////////////////////////////////
+
+ /**
+ * Loads the object identified by the specified {@link Oid} from the persisted set of objects.
+ *
+ * <p>
+ * As used primarily by <tt>ServerDistribution</tt>.
+ */
+ ObjectAdapter loadObject(Oid oid, ObjectSpecification spec);
+
+ /**
+ * Finds and returns instances that match the specified query.
+ *
+ * <p>
+ * The {@link QueryCardinality} determines whether all instances or just the first matching instance is returned.
+ *
+ * @throws UnsupportedFindException
+ * if the criteria is not support by this persistor
+ */
+ <T> ObjectAdapter findInstances(Query<T> query, QueryCardinality cardinality);
+
+ /**
+ * Finds and returns instances that match the specified {@link PersistenceQuery}.
+ *
+ * <p>
+ * Compared to {@link #findInstances(Query, QueryCardinality)}, not that there is no {@link QueryCardinality}
+ * parameter. That's because {@link PersistenceQuery} intrinsically carry the knowledge as to how many rows they
+ * return.
+ *
+ * @throws UnsupportedFindException
+ * if the criteria is not support by this persistor
+ */
+ ObjectAdapter findInstances(PersistenceQuery criteria);
+
+ /**
+ * Whether there are any instances of the specified {@link ObjectSpecification type}.
+ *
+ * <p>
+ * Used (ostensibly) by client-side code.
+ */
+ boolean hasInstances(ObjectSpecification specification);
+
+ // /////////////////////////////////////////////////////////
+ // Resolving
+ // /////////////////////////////////////////////////////////
+
+ /**
+ * Re-initialises the fields of an object. If the object is unresolved then the object's missing data should be
+ * retrieved from the persistence mechanism and be used to set up the value objects and associations.
+ */
+ void resolveImmediately(ObjectAdapter object);
+
+ /**
+ * Hint that specified field within the specified object is likely to be needed soon. This allows the object's data
+ * to be loaded, ready for use.
+ *
+ * <p>
+ * This method need not do anything, but offers the object store the opportunity to load in objects before their
+ * use. Contrast this with resolveImmediately, which requires an object to be loaded before continuing.
+ *
+ * @see #resolveImmediately(ObjectAdapter)
+ */
+ void resolveField(ObjectAdapter object, ObjectAssociation association);
+
+ // /////////////////////////////////////////////////////////
+ // Persisting
+ // /////////////////////////////////////////////////////////
+
+ /**
+ * Makes an {@link ObjectAdapter} persistent. The specified object should be stored away via this object store's
+ * persistence mechanism, and have an new and unique OID assigned to it (by calling the object's <code>setOid</code>
+ * method). The object, should also be added to the cache as the object is implicitly 'in use'.
+ *
+ * <p>
+ * If the object has any associations then each of these, where they aren't already persistent, should also be made
+ * persistent by recursively calling this method.
+ * </p>
+ *
+ * <p>
+ * If the object to be persisted is a collection, then each element of that collection, that is not already
+ * persistent, should be made persistent by recursively calling this method.
+ * </p>
+ */
+ void makePersistent(ObjectAdapter object);
+
+ /**
+ * Mark the {@link ObjectAdapter} as changed, and therefore requiring flushing to the persistence mechanism.
+ */
+ void objectChanged(ObjectAdapter object);
+
+ void destroyObject(ObjectAdapter object);
+
+}