incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1234453 [32/33] - in /incubator/isis/trunk/framework/core: commons/src/main/java/org/apache/isis/core/commons/authentication/ commons/src/main/java/org/apache/isis/core/commons/components/ commons/src/main/java/org/apache/isis/core/commons...
Date Sun, 22 Jan 2012 06:59:23 GMT
Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XmlSnapshot.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XmlSnapshot.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XmlSnapshot.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XmlSnapshot.java Sun Jan 22 06:58:43 2012
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.snapshot;
 
 import java.util.Collections;
@@ -51,20 +50,28 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-
 /**
- * Traverses object graph from specified root, so that an XML representation of the graph can be returned.
- *
+ * Traverses object graph from specified root, so that an XML representation of
+ * the graph can be returned.
+ * 
  * <p>
  * Initially designed to allow snapshots to be easily created.
  * 
  * <p>
  * Typical use:
+ * 
  * <pre>
- * XmlSnapshot snapshot = new XmlSnapshot(customer); // where customer is a reference to an ObjectAdapter
- * Element customerAsXml = snapshot.toXml(); // returns customer's fields, titles of simple references, number of items in collections
- * snapshot.include(&quot;placeOfBirth&quot;); // navigates to another object represented by simple reference &quot;placeOfBirth&quot;
- * snapshot.include(&quot;orders/product&quot;); // navigates to all <tt>Order</tt>s of <tt>Customer</tt>, and from them for their <tt>Product</tt>s 
+ * XmlSnapshot snapshot = new XmlSnapshot(customer); // where customer is a
+ *                                                   // reference to an
+ *                                                   // ObjectAdapter
+ * Element customerAsXml = snapshot.toXml(); // returns customer's fields, titles
+ *                                           // of simple references, number of
+ *                                           // items in collections
+ * snapshot.include(&quot;placeOfBirth&quot;); // navigates to another object represented by
+ *                                   // simple reference &quot;placeOfBirth&quot;
+ * snapshot.include(&quot;orders/product&quot;); // navigates to all &lt;tt&gt;Order&lt;/tt&gt;s of
+ *                                     // &lt;tt&gt;Customer&lt;/tt&gt;, and from them for
+ *                                     // their &lt;tt&gt;Product&lt;/tt&gt;s
  * </pre>
  */
 public class XmlSnapshot {
@@ -109,9 +116,9 @@ public class XmlSnapshot {
      */
     public XmlSnapshot(final ObjectAdapter rootAdapter, final XmlSchema schema) {
 
-    	if (LOG.isDebugEnabled()) {
-    		LOG.debug(".ctor(" + log("rootObj", rootAdapter) + andlog("schema", schema) + andlog("addOids", "" + true) + ")");
-    	}
+        if (LOG.isDebugEnabled()) {
+            LOG.debug(".ctor(" + log("rootObj", rootAdapter) + andlog("schema", schema) + andlog("addOids", "" + true) + ")");
+        }
 
         this.isisMetaModel = new IsisSchema();
         this.xsMeta = new XsMetaModel();
@@ -135,24 +142,22 @@ public class XmlSnapshot {
             throw new IsisException(e);
         }
 
-		for(String path: getPathsFor(rootAdapter.getObject())) {
-			include(path);
-		}
+        for (final String path : getPathsFor(rootAdapter.getObject())) {
+            include(path);
+        }
 
     }
 
-	private List<String> getPathsFor(Object object) {
-		if (!(object instanceof SnapshottableWithInclusions)) {
-			return Collections.emptyList();
-		}
-		List<String> paths = 
-			((SnapshottableWithInclusions) object).snapshotInclusions();
-		if (paths == null) {
-			return Collections.emptyList();
-		}
-		return paths;
-	}
-	
+    private List<String> getPathsFor(final Object object) {
+        if (!(object instanceof SnapshottableWithInclusions)) {
+            return Collections.emptyList();
+        }
+        final List<String> paths = ((SnapshottableWithInclusions) object).snapshotInclusions();
+        if (paths == null) {
+            return Collections.emptyList();
+        }
+        return paths;
+    }
 
     private String andlog(final String label, final ObjectAdapter object) {
         return ", " + log(label, object);
@@ -163,18 +168,20 @@ public class XmlSnapshot {
     }
 
     /**
-     * Creates an Element representing this object, and appends it as the root element of the Document.
+     * Creates an Element representing this object, and appends it as the root
+     * element of the Document.
      * 
-     * The Document must not yet have a root element Additionally, the supplied schemaManager must be
-     * populated with any application-level namespaces referenced in the document that the parentElement
-     * resides within. (Normally this is achieved simply by using appendXml passing in a new schemaManager -
-     * see {@link #toXml()}or {@link XmlSnapshot}).
+     * The Document must not yet have a root element Additionally, the supplied
+     * schemaManager must be populated with any application-level namespaces
+     * referenced in the document that the parentElement resides within.
+     * (Normally this is achieved simply by using appendXml passing in a new
+     * schemaManager - see {@link #toXml()}or {@link XmlSnapshot}).
      */
     private Place appendXml(final ObjectAdapter object) {
 
-    	if(LOG.isDebugEnabled()) {
-    		LOG.debug("appendXml(" + log("obj", object) + "')");
-    	}
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(" + log("obj", object) + "')");
+        }
 
         final String fullyQualifiedClassName = object.getSpecification().getFullIdentifier();
 
@@ -190,29 +197,29 @@ public class XmlSnapshot {
         final Element element = place.getXmlElement();
         final Element xsElementElement = place.getXsdElement();
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(NO): add as element to XML doc");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(NO): add as element to XML doc");
         }
         getXmlDocument().appendChild(element);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(NO): add as xs:element to xs:schema of the XSD document");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(NO): add as xs:element to xs:schema of the XSD document");
         }
         getXsdElement().appendChild(xsElementElement);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(NO): set target name in XSD, derived from FQCN of obj");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(NO): set target name in XSD, derived from FQCN of obj");
         }
         schema.setTargetNamespace(getXsdDocument(), fullyQualifiedClassName);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(NO): set schema location file name to XSD, derived from FQCN of obj");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(NO): set schema location file name to XSD, derived from FQCN of obj");
         }
         final String schemaLocationFileName = fullyQualifiedClassName + ".xsd";
         schema.assignSchema(getXmlDocument(), fullyQualifiedClassName, schemaLocationFileName);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(NO): copy into snapshot obj");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(NO): copy into snapshot obj");
         }
         setXmlElement(element);
         setSchemaLocationFileName(schemaLocationFileName);
@@ -221,21 +228,25 @@ public class XmlSnapshot {
     }
 
     /**
-     * Creates an Element representing this object, and appends it to the supplied parentElement, provided
-     * that an element for the object is not already appended.
+     * Creates an Element representing this object, and appends it to the
+     * supplied parentElement, provided that an element for the object is not
+     * already appended.
      * 
-     * The method uses the OID to determine if an object's element is already present. If the object is not
-     * yet persistent, then the hashCode is used instead.
+     * The method uses the OID to determine if an object's element is already
+     * present. If the object is not yet persistent, then the hashCode is used
+     * instead.
      * 
-     * The parentElement must have an owner document, and should define the nof namespace. Additionally, the
-     * supplied schemaManager must be populated with any application-level namespaces referenced in the
-     * document that the parentElement resides within. (Normally this is achieved simply by using appendXml
-     * passing in a rootElement and a new schemaManager - see {@link #toXml()}or {@link XmlSnapshot}).
+     * The parentElement must have an owner document, and should define the nof
+     * namespace. Additionally, the supplied schemaManager must be populated
+     * with any application-level namespaces referenced in the document that the
+     * parentElement resides within. (Normally this is achieved simply by using
+     * appendXml passing in a rootElement and a new schemaManager - see
+     * {@link #toXml()}or {@link XmlSnapshot}).
      */
     private Element appendXml(final Place parentPlace, final ObjectAdapter childObject) {
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(" + log("parentPlace", parentPlace) + andlog("childObj", childObject) + ")");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(" + log("parentPlace", parentPlace) + andlog("childObj", childObject) + ")");
         }
 
         final Element parentElement = parentPlace.getXmlElement();
@@ -245,37 +256,31 @@ public class XmlSnapshot {
             throw new IllegalArgumentException("parent XML Element must have snapshot's XML document as its owner");
         }
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(Pl, NO): invoking objectToElement() for " + log("childObj", childObject));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(Pl, NO): invoking objectToElement() for " + log("childObj", childObject));
         }
         final Place childPlace = objectToElement(childObject);
         Element childElement = childPlace.getXmlElement();
         final Element childXsElement = childPlace.getXsdElement();
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(Pl, NO): invoking mergeTree of parent with child");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(Pl, NO): invoking mergeTree of parent with child");
         }
         childElement = mergeTree(parentElement, childElement);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXml(Pl, NO): adding XS Element to schema if required");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXml(Pl, NO): adding XS Element to schema if required");
         }
         schema.addXsElementIfNotPresent(parentXsElement, childXsElement);
 
         return childElement;
     }
 
-    private boolean appendXmlThenIncludeRemaining(
-            final Place parentPlace,
-            final ObjectAdapter referencedObject,
-            final Vector fieldNames,
-            final String annotation) {
-
-        if(LOG.isDebugEnabled()) {
-	        LOG.debug("appendXmlThenIncludeRemaining(: " + log("parentPlace", parentPlace)
-	                + andlog("referencedObj", referencedObject) + andlog("fieldNames", fieldNames) + andlog("annotation", annotation)
-	                + ")");
-	        LOG.debug("appendXmlThenIncludeRemaining(..): invoking appendXml(parentPlace, referencedObject)");
+    private boolean appendXmlThenIncludeRemaining(final Place parentPlace, final ObjectAdapter referencedObject, final Vector fieldNames, final String annotation) {
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXmlThenIncludeRemaining(: " + log("parentPlace", parentPlace) + andlog("referencedObj", referencedObject) + andlog("fieldNames", fieldNames) + andlog("annotation", annotation) + ")");
+            LOG.debug("appendXmlThenIncludeRemaining(..): invoking appendXml(parentPlace, referencedObject)");
         }
 
         final Element referencedElement = appendXml(parentPlace, referencedObject);
@@ -283,9 +288,8 @@ public class XmlSnapshot {
 
         final boolean includedField = includeField(referencedPlace, fieldNames, annotation);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("appendXmlThenIncludeRemaining(..): invoked includeField(referencedPlace, fieldNames)"
-                + andlog("returned", "" + includedField));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("appendXmlThenIncludeRemaining(..): invoked includeField(referencedPlace, fieldNames)" + andlog("returned", "" + includedField));
         }
 
         return includedField;
@@ -318,8 +322,8 @@ public class XmlSnapshot {
     /**
      * The name of the <code>xsi:schemaLocation</code> in the XML document.
      * 
-     * Taken from the <code>fullyQualifiedClassName</code> (which also is used as the basis for the
-     * <code>targetNamespace</code>.
+     * Taken from the <code>fullyQualifiedClassName</code> (which also is used
+     * as the basis for the <code>targetNamespace</code>.
      * 
      * Populated in {@link #appendXml(ObjectAdapter)}.
      */
@@ -332,8 +336,8 @@ public class XmlSnapshot {
     }
 
     /**
-     * The root element of {@link #getXmlDocument()}. Returns <code>null</code> until the snapshot has
-     * actually been built.
+     * The root element of {@link #getXmlDocument()}. Returns <code>null</code>
+     * until the snapshot has actually been built.
      */
     public Element getXmlElement() {
         return xmlElement;
@@ -344,8 +348,8 @@ public class XmlSnapshot {
     }
 
     /**
-     * The root element of {@link #getXsdDocument()}. Returns <code>null</code> until the snapshot has
-     * actually been built.
+     * The root element of {@link #getXsdDocument()}. Returns <code>null</code>
+     * until the snapshot has actually been built.
      */
     public Element getXsdElement() {
         return xsdElement;
@@ -362,32 +366,32 @@ public class XmlSnapshot {
         for (final StringTokenizer tok = new StringTokenizer(path, "/"); tok.hasMoreTokens();) {
             final String token = tok.nextToken();
 
-            if(LOG.isDebugEnabled()) {
-            	LOG.debug("include(..): " + log("token", token));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("include(..): " + log("token", token));
             }
             fieldNames.addElement(token);
         }
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("include(..): " + log("fieldNames", fieldNames));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("include(..): " + log("fieldNames", fieldNames));
         }
 
         // navigate first field, from the root.
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("include(..): invoking includeField");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("include(..): invoking includeField");
         }
         includeField(rootPlace, fieldNames, annotation);
     }
 
     /**
-     * @return true if able to navigate the complete vector of field names successfully; false if a field
-     *         could not be located or it turned out to be a value.
+     * @return true if able to navigate the complete vector of field names
+     *         successfully; false if a field could not be located or it turned
+     *         out to be a value.
      */
     private boolean includeField(final Place place, final Vector fieldNames, final String annotation) {
 
-        if(LOG.isDebugEnabled()) {
-	        LOG.debug("includeField(: " + log("place", place) + andlog("fieldNames", fieldNames) + andlog("annotation", annotation)
-	                + ")");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("includeField(: " + log("place", place) + andlog("fieldNames", fieldNames) + andlog("annotation", annotation) + ")");
         }
 
         final ObjectAdapter object = place.getObject();
@@ -410,8 +414,8 @@ public class XmlSnapshot {
         final String fieldName = (String) names.elementAt(0);
         names.removeElementAt(0);
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("includeField(Pl, Vec, Str):" + log("processing field", fieldName) + andlog("left", "" + names.size()));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("includeField(Pl, Vec, Str):" + log("processing field", fieldName) + andlog("left", "" + names.size()));
         }
 
         // locate the field in the object's class
@@ -422,8 +426,8 @@ public class XmlSnapshot {
             // check first.
             field = nos.getAssociation(fieldName);
         } catch (final ObjectSpecificationException ex) {
-            if(LOG.isInfoEnabled()) {
-            	LOG.info("includeField(Pl, Vec, Str): could not locate field, skipping");
+            if (LOG.isInfoEnabled()) {
+                LOG.info("includeField(Pl, Vec, Str): could not locate field, skipping");
             }
             return false;
         }
@@ -431,14 +435,13 @@ public class XmlSnapshot {
         // locate the corresponding XML element
         // (the corresponding XSD element will later be attached to xmlElement
         // as its userData)
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("includeField(Pl, Vec, Str): locating corresponding XML element");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("includeField(Pl, Vec, Str): locating corresponding XML element");
         }
         final Vector xmlFieldElements = elementsUnder(xmlElement, field.getId());
         if (xmlFieldElements.size() != 1) {
-            if(LOG.isInfoEnabled()) {
-	            LOG.info("includeField(Pl, Vec, Str): could not locate " + log("field", field.getId())
-	                    + andlog("xmlFieldElements.size", "" + xmlFieldElements.size()));
+            if (LOG.isInfoEnabled()) {
+                LOG.info("includeField(Pl, Vec, Str): could not locate " + log("field", field.getId()) + andlog("xmlFieldElements.size", "" + xmlFieldElements.size()));
             }
             return false;
         }
@@ -453,14 +456,14 @@ public class XmlSnapshot {
 
         if (field instanceof OneToOneAssociation) {
             if (field.getSpecification().getAssociations().size() == 0) {
-            	if(LOG.isDebugEnabled()) {
-            		LOG.debug("includeField(Pl, Vec, Str): field is value; done");
-            	}
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("includeField(Pl, Vec, Str): field is value; done");
+                }
                 return false;
             }
 
-            if(LOG.isDebugEnabled()) {
-            	LOG.debug("includeField(Pl, Vec, Str): field is 1->1");
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("includeField(Pl, Vec, Str): field is 1->1");
             }
 
             final OneToOneAssociation oneToOneAssociation = ((OneToOneAssociation) field);
@@ -470,35 +473,32 @@ public class XmlSnapshot {
                 return true; // not a failure if the reference was null
             }
 
-            final boolean appendedXml = appendXmlThenIncludeRemaining(fieldPlace, referencedObject, names,
-                    annotation);
-            if(LOG.isDebugEnabled()) {
-	            LOG.debug("includeField(Pl, Vec, Str): 1->1: invoked appendXmlThenIncludeRemaining for "
-	                    + log("referencedObj", referencedObject) + andlog("returned", "" + appendedXml));
+            final boolean appendedXml = appendXmlThenIncludeRemaining(fieldPlace, referencedObject, names, annotation);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("includeField(Pl, Vec, Str): 1->1: invoked appendXmlThenIncludeRemaining for " + log("referencedObj", referencedObject) + andlog("returned", "" + appendedXml));
             }
 
             return appendedXml;
 
         } else if (field instanceof OneToManyAssociation) {
-        	if(LOG.isDebugEnabled()) {
-        		LOG.debug("includeField(Pl, Vec, Str): field is 1->M");
-        	}
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("includeField(Pl, Vec, Str): field is 1->M");
+            }
 
             final OneToManyAssociation oneToManyAssociation = (OneToManyAssociation) field;
             final ObjectAdapter collection = oneToManyAssociation.get(fieldPlace.getObject());
             final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
 
-            if(LOG.isDebugEnabled()) {
-            	LOG.debug("includeField(Pl, Vec, Str): 1->M: " + log("collection.size", "" + facet.size(collection)));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("includeField(Pl, Vec, Str): 1->M: " + log("collection.size", "" + facet.size(collection)));
             }
             boolean allFieldsNavigated = true;
             final Enumeration elements = facet.elements(collection);
             while (elements.hasMoreElements()) {
                 final ObjectAdapter referencedObject = (ObjectAdapter) elements.nextElement();
                 final boolean appendedXml = appendXmlThenIncludeRemaining(fieldPlace, referencedObject, names, annotation);
-                if(LOG.isDebugEnabled()) {
-                	LOG.debug("includeField(Pl, Vec, Str): 1->M: + invoked appendXmlThenIncludeRemaining for "
-                        + log("referencedObj", referencedObject) + andlog("returned", "" + appendedXml));
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("includeField(Pl, Vec, Str): 1->M: + invoked appendXmlThenIncludeRemaining for " + log("referencedObj", referencedObject) + andlog("returned", "" + appendedXml));
                 }
                 allFieldsNavigated = allFieldsNavigated && appendedXml;
             }
@@ -519,33 +519,35 @@ public class XmlSnapshot {
     }
 
     /**
-     * Merges the tree of Elements whose root is <code>childElement</code> underneath the
-     * <code>parentElement</code>.
+     * Merges the tree of Elements whose root is <code>childElement</code>
+     * underneath the <code>parentElement</code>.
      * 
-     * If the <code>parentElement</code> already has an element that matches the <code>childElement</code>,
-     * then recursively attaches the grandchildren instead.
+     * If the <code>parentElement</code> already has an element that matches the
+     * <code>childElement</code>, then recursively attaches the grandchildren
+     * instead.
      * 
-     * The element returned will be either the supplied <code>childElement</code>, or an existing child
-     * element if one already existed under <code>parentElement</code>.
+     * The element returned will be either the supplied
+     * <code>childElement</code>, or an existing child element if one already
+     * existed under <code>parentElement</code>.
      */
     private Element mergeTree(final Element parentElement, final Element childElement) {
 
-    	if(LOG.isDebugEnabled()) {
-    		LOG.debug("mergeTree(" + log("parent", parentElement) + andlog("child", childElement));
-    	}
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mergeTree(" + log("parent", parentElement) + andlog("child", childElement));
+        }
 
         final String childElementOid = isisMetaModel.getAttribute(childElement, "oid");
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("mergeTree(El,El): " + log("childOid", childElementOid));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mergeTree(El,El): " + log("childOid", childElementOid));
         }
         if (childElementOid != null) {
 
             // before we add the child element, check to see if it is already
             // there
-        	if(LOG.isDebugEnabled()) {
-        		LOG.debug("mergeTree(El,El): check if child already there");
-        	}
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("mergeTree(El,El): check if child already there");
+            }
             final Vector existingChildElements = elementsUnder(parentElement, childElement.getLocalName());
             for (final Enumeration childEnum = existingChildElements.elements(); childEnum.hasMoreElements();) {
                 final Element possibleMatchingElement = (Element) childEnum.nextElement();
@@ -555,8 +557,8 @@ public class XmlSnapshot {
                     continue;
                 }
 
-                if(LOG.isDebugEnabled()) {
-                	LOG.debug("mergeTree(El,El): child already there; merging grandchildren");
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("mergeTree(El,El): child already there; merging grandchildren");
                 }
 
                 // match: transfer the children of the child (grandchildren) to
@@ -568,8 +570,8 @@ public class XmlSnapshot {
                     final Element grandchildElement = (Element) grandchildEnum.nextElement();
                     childElement.removeChild(grandchildElement);
 
-                    if(LOG.isDebugEnabled()) {
-                    	LOG.debug("mergeTree(El,El): merging " + log("grandchild", grandchildElement));
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("mergeTree(El,El): merging " + log("grandchild", grandchildElement));
                     }
 
                     mergeTree(existingChildElement, grandchildElement);
@@ -584,26 +586,25 @@ public class XmlSnapshot {
 
     Place objectToElement(final ObjectAdapter object) {
 
-    	if(LOG.isDebugEnabled()) {
-    		LOG.debug("objectToElement(" + log("object", object) + ")");
-    	}
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("objectToElement(" + log("object", object) + ")");
+        }
 
         final ObjectSpecification nos = object.getSpecification();
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("objectToElement(NO): create element and nof:title");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("objectToElement(NO): create element and nof:title");
         }
-        final Element element = schema.createElement(getXmlDocument(), nos.getShortIdentifier(), nos.getFullIdentifier(), nos
-                .getSingularName(), nos.getPluralName());
+        final Element element = schema.createElement(getXmlDocument(), nos.getShortIdentifier(), nos.getFullIdentifier(), nos.getSingularName(), nos.getPluralName());
         isisMetaModel.appendNofTitle(element, object.titleString());
 
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("objectToElement(NO): create XS element for NOF class");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("objectToElement(NO): create XS element for NOF class");
         }
-        final Element xsElement = schema.createXsElementForNofClass(getXsdDocument(), element, topLevelElementWritten, FacetUtil
-                .getFacetsByType(nos));
+        final Element xsElement = schema.createXsElementForNofClass(getXsdDocument(), element, topLevelElementWritten, FacetUtil.getFacetsByType(nos));
 
-        // hack: every element in the XSD schema apart from first needs minimum cardinality setting.
+        // hack: every element in the XSD schema apart from first needs minimum
+        // cardinality setting.
         topLevelElementWritten = true;
 
         final Place place = new Place(object, element);
@@ -611,15 +612,15 @@ public class XmlSnapshot {
         isisMetaModel.setAttributesForClass(element, oidOrHashCode(object).toString());
 
         final List<ObjectAssociation> fields = nos.getAssociations();
-        if(LOG.isDebugEnabled()) {
-        	LOG.debug("objectToElement(NO): processing fields");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("objectToElement(NO): processing fields");
         }
         eachField: for (int i = 0; i < fields.size(); i++) {
             final ObjectAssociation field = fields.get(i);
             final String fieldName = field.getId();
 
-            if(LOG.isDebugEnabled()) {
-            	LOG.debug("objectToElement(NO): " + log("field", fieldName));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("objectToElement(NO): " + log("field", fieldName));
             }
 
             // Skip field if we have seen the name already
@@ -641,7 +642,9 @@ public class XmlSnapshot {
                 }
             }
 
-            Element xmlFieldElement = getXmlDocument().createElementNS(schema.getUri(), // scoped by namespace
+            Element xmlFieldElement = getXmlDocument().createElementNS(schema.getUri(), // scoped
+                                                                                        // by
+                                                                                        // namespace
                     // of class of
                     // containing object
                     schema.getPrefix() + ":" + fieldName);
@@ -649,9 +652,9 @@ public class XmlSnapshot {
             Element xsdFieldElement = null;
 
             if (field.getSpecification().containsFacet(ValueFacet.class)) {
-            	if(LOG.isDebugEnabled()) {
-            		LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is value");
-            	}
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is value");
+                }
 
                 final ObjectSpecification fieldNos = field.getSpecification();
                 // skip fields of type XmlValue
@@ -663,7 +666,10 @@ public class XmlSnapshot {
                 }
 
                 final OneToOneAssociation valueAssociation = ((OneToOneAssociation) field);
-                final Element xmlValueElement = xmlFieldElement; // more meaningful locally scoped name
+                final Element xmlValueElement = xmlFieldElement; // more
+                                                                 // meaningful
+                                                                 // locally
+                                                                 // scoped name
 
                 ObjectAdapter value;
                 try {
@@ -676,17 +682,17 @@ public class XmlSnapshot {
 
                     // return parsed string, else encoded string, else title.
                     String valueStr;
-                    ParseableFacet parseableFacet = fieldNos.getFacet(ParseableFacet.class);
-                    EncodableFacet encodeableFacet = fieldNos.getFacet(EncodableFacet.class);
-                    if(parseableFacet != null) {
-                    	valueStr = parseableFacet.parseableTitle(value);
-                    } else if(encodeableFacet != null) {
-                    	valueStr = encodeableFacet.toEncodedString(value);
+                    final ParseableFacet parseableFacet = fieldNos.getFacet(ParseableFacet.class);
+                    final EncodableFacet encodeableFacet = fieldNos.getFacet(EncodableFacet.class);
+                    if (parseableFacet != null) {
+                        valueStr = parseableFacet.parseableTitle(value);
+                    } else if (encodeableFacet != null) {
+                        valueStr = encodeableFacet.toEncodedString(value);
                     } else {
-                    	valueStr = value.titleString();
+                        valueStr = value.titleString();
                     }
-                    
-					final boolean notEmpty = (valueStr.length() > 0);
+
+                    final boolean notEmpty = (valueStr.length() > 0);
                     if (notEmpty) {
                         xmlValueElement.appendChild(getXmlDocument().createTextNode(valueStr));
                     } else {
@@ -694,23 +700,25 @@ public class XmlSnapshot {
                     }
 
                 } catch (final Exception ex) {
-                    LOG.warn("objectToElement(NO): " + log("field", fieldName)
-                            + ": getField() threw exception - skipping XML generation");
+                    LOG.warn("objectToElement(NO): " + log("field", fieldName) + ": getField() threw exception - skipping XML generation");
                 }
 
                 // XSD
-                xsdFieldElement = schema.createXsElementForNofValue(xsElement, xmlValueElement, FacetUtil
-                        .getFacetsByType(valueAssociation));
+                xsdFieldElement = schema.createXsElementForNofValue(xsElement, xmlValueElement, FacetUtil.getFacetsByType(valueAssociation));
 
             } else if (field instanceof OneToOneAssociation) {
 
-            	if(LOG.isDebugEnabled()) {
-            		LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is OneToOneAssociation");
-            	}
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is OneToOneAssociation");
+                }
 
                 final OneToOneAssociation oneToOneAssociation = ((OneToOneAssociation) field);
                 final String fullyQualifiedClassName = nos.getFullIdentifier();
-                final Element xmlReferenceElement = xmlFieldElement; // more meaningful locally scoped name
+                final Element xmlReferenceElement = xmlFieldElement; // more
+                                                                     // meaningful
+                                                                     // locally
+                                                                     // scoped
+                                                                     // name
 
                 ObjectAdapter referencedObjectAdapter;
 
@@ -727,22 +735,24 @@ public class XmlSnapshot {
                     }
 
                 } catch (final Exception ex) {
-                    LOG.warn("objectToElement(NO): " + log("field", fieldName)
-                            + ": getAssociation() threw exception - skipping XML generation");
+                    LOG.warn("objectToElement(NO): " + log("field", fieldName) + ": getAssociation() threw exception - skipping XML generation");
                 }
 
                 // XSD
-                xsdFieldElement = schema.createXsElementForNofReference(xsElement, xmlReferenceElement, oneToOneAssociation
-                        .getSpecification().getFullIdentifier(), FacetUtil.getFacetsByType(oneToOneAssociation));
+                xsdFieldElement = schema.createXsElementForNofReference(xsElement, xmlReferenceElement, oneToOneAssociation.getSpecification().getFullIdentifier(), FacetUtil.getFacetsByType(oneToOneAssociation));
 
             } else if (field instanceof OneToManyAssociation) {
 
-            	if(LOG.isDebugEnabled()) {
-            		LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is OneToManyAssociation");
-            	}
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is OneToManyAssociation");
+                }
 
                 final OneToManyAssociation oneToManyAssociation = (OneToManyAssociation) field;
-                final Element xmlCollectionElement = xmlFieldElement; // more meaningful locally scoped name
+                final Element xmlCollectionElement = xmlFieldElement; // more
+                                                                      // meaningful
+                                                                      // locally
+                                                                      // scoped
+                                                                      // name
 
                 ObjectAdapter collection;
                 try {
@@ -753,18 +763,16 @@ public class XmlSnapshot {
                     // XML
                     isisMetaModel.setIsisCollection(xmlCollectionElement, schema.getPrefix(), fullyQualifiedClassName, collection);
                 } catch (final Exception ex) {
-                    LOG.warn("objectToElement(NO): " + log("field", fieldName)
-                            + ": get(obj) threw exception - skipping XML generation");
+                    LOG.warn("objectToElement(NO): " + log("field", fieldName) + ": get(obj) threw exception - skipping XML generation");
                 }
 
                 // XSD
-                xsdFieldElement = schema.createXsElementForNofCollection(xsElement, xmlCollectionElement, oneToManyAssociation
-                        .getSpecification().getFullIdentifier(), FacetUtil.getFacetsByType(oneToManyAssociation));
+                xsdFieldElement = schema.createXsElementForNofCollection(xsElement, xmlCollectionElement, oneToManyAssociation.getSpecification().getFullIdentifier(), FacetUtil.getFacetsByType(oneToManyAssociation));
 
             } else {
-            	if(LOG.isInfoEnabled()) {
-            		LOG.info("objectToElement(NO): " + log("field", fieldName) + " is unknown type; ignored");
-            	}
+                if (LOG.isInfoEnabled()) {
+                    LOG.info("objectToElement(NO): " + log("field", fieldName) + " is unknown type; ignored");
+                }
                 continue;
             }
 
@@ -773,16 +781,16 @@ public class XmlSnapshot {
             }
 
             // XML
-            if(LOG.isDebugEnabled()) {
-            	LOG.debug("objectToElement(NO): invoking mergeTree for field");
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("objectToElement(NO): invoking mergeTree for field");
             }
             xmlFieldElement = mergeTree(element, xmlFieldElement);
 
             // XSD
             if (xsdFieldElement != null) {
-            	if(LOG.isDebugEnabled()) {
-            		LOG.debug("objectToElement(NO): adding XS element for field to schema");
-            	}
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("objectToElement(NO): adding XS element for field to schema");
+                }
                 schema.addFieldXsElement(xsElement, xsdFieldElement);
             }
         }
@@ -796,14 +804,14 @@ public class XmlSnapshot {
          * if (oid == null) { return "" + object.hashCode(); }
          */
         if (oid instanceof DirectlyStringableOid) {
-			DirectlyStringableOid directlyStringableOid = (DirectlyStringableOid) oid;
-        	return directlyStringableOid.enString();
+            final DirectlyStringableOid directlyStringableOid = (DirectlyStringableOid) oid;
+            return directlyStringableOid.enString();
         } else {
-        	return oid.toString();
+            return oid.toString();
         }
         /*
-         * InlineTransferableWriter itw = new InlineTransferableWriter(); oid.writeData(itw); itw.close();
-         * return itw.toString();
+         * InlineTransferableWriter itw = new InlineTransferableWriter();
+         * oid.writeData(itw); itw.close(); return itw.toString();
          */
     }
 
@@ -822,5 +830,5 @@ public class XmlSnapshot {
     private void setXmlElement(final Element xmlElement) {
         this.xmlElement = xmlElement;
     }
-    
+
 }

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XsMetaModel.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XsMetaModel.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XsMetaModel.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/snapshot/XsMetaModel.java Sun Jan 22 06:58:43 2012
@@ -17,24 +17,25 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.snapshot;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-
 /**
- * Stateless utility methods relating to the w3.org schema and schema-instance meta models.
+ * Stateless utility methods relating to the w3.org schema and schema-instance
+ * meta models.
  */
 public final class XsMetaModel {
 
     private final Helper helper;
     /**
-     * URI representing the namespace of the in-built xmlns namespace as defined by w3.org.
+     * URI representing the namespace of the in-built xmlns namespace as defined
+     * by w3.org.
      * 
-     * The NamespaceManager will not allow any namespaces with this URI to be added.
+     * The NamespaceManager will not allow any namespaces with this URI to be
+     * added.
      */
     public static final String W3_ORG_XMLNS_URI = "http://www.w3.org/2000/xmlns/";
     /**
@@ -72,14 +73,15 @@ public final class XsMetaModel {
     }
 
     /**
-     * Creates an &lt;xs:schema&gt; element for the document to the provided element, attaching to root of
-     * supplied Xsd doc.
+     * Creates an &lt;xs:schema&gt; element for the document to the provided
+     * element, attaching to root of supplied Xsd doc.
      * 
      * In addition:
      * <ul>
      * <li>the elementFormDefault is set
      * <li>the NOF namespace is set
-     * <li>the <code>xs:import</code> element referencing the NOF namespace is added as a child
+     * <li>the <code>xs:import</code> element referencing the NOF namespace is
+     * added as a child
      * </ul>
      */
     Element createXsSchemaElement(final Document xsdDoc) {
@@ -116,15 +118,14 @@ public final class XsMetaModel {
     }
 
     /**
-     * Creates an element in the XS namespace, adding the definition of the namespace to the root element of
-     * the document if required,
+     * Creates an element in the XS namespace, adding the definition of the
+     * namespace to the root element of the document if required,
      */
     Element createXsElement(final Document xsdDoc, final String localName) {
 
         final Element element = xsdDoc.createElementNS(XsMetaModel.W3_ORG_XS_URI, XsMetaModel.W3_ORG_XS_PREFIX + ":" + localName);
         // xmlns:xs="..." added to root
-        helper.rootElementFor(element).setAttributeNS(XsMetaModel.W3_ORG_XMLNS_URI,
-                XsMetaModel.W3_ORG_XMLNS_PREFIX + ":" + XsMetaModel.W3_ORG_XS_PREFIX, XsMetaModel.W3_ORG_XS_URI);
+        helper.rootElementFor(element).setAttributeNS(XsMetaModel.W3_ORG_XMLNS_URI, XsMetaModel.W3_ORG_XMLNS_PREFIX + ":" + XsMetaModel.W3_ORG_XS_PREFIX, XsMetaModel.W3_ORG_XS_URI);
         return element;
     }
 
@@ -139,32 +140,29 @@ public final class XsMetaModel {
     // }
 
     /**
-     * Creates an xs:attribute ref="nof:xxx" element, and appends to specified owning element.
+     * Creates an xs:attribute ref="nof:xxx" element, and appends to specified
+     * owning element.
      */
     Element addXsNofAttribute(final Element parentXsElement, final String nofAttributeRef) {
         return addXsNofAttribute(parentXsElement, nofAttributeRef, null);
     }
 
     /**
-     * Adds <code>xs:attribute ref="nof:xxx" fixed="yyy"</code> element, and appends to specified parent XSD
-     * element.
+     * Adds <code>xs:attribute ref="nof:xxx" fixed="yyy"</code> element, and
+     * appends to specified parent XSD element.
      */
     Element addXsNofAttribute(final Element parentXsElement, final String nofAttributeRef, final String fixedValue) {
         return addXsNofAttribute(parentXsElement, nofAttributeRef, fixedValue, true);
     }
 
     /**
-     * Adds <code>xs:attribute ref="nof:xxx" default="yyy"</code> element, and appends to specified parent
-     * XSD element.
+     * Adds <code>xs:attribute ref="nof:xxx" default="yyy"</code> element, and
+     * appends to specified parent XSD element.
      * 
-     * The last parameter determines whether to use <code>fixed="yyy"</code> rather than
-     * <code>default="yyy"</code>.
+     * The last parameter determines whether to use <code>fixed="yyy"</code>
+     * rather than <code>default="yyy"</code>.
      */
-    Element addXsNofAttribute(
-            final Element parentXsElement,
-            final String nofAttributeRef,
-            final String value,
-            final boolean useFixed) {
+    Element addXsNofAttribute(final Element parentXsElement, final String nofAttributeRef, final String value, final boolean useFixed) {
         final Element xsNofAttributeElement = createXsElement(helper.docFor(parentXsElement), "attribute");
         xsNofAttributeElement.setAttribute("ref", IsisSchema.NS_PREFIX + ":" + nofAttributeRef);
         parentXsElement.appendChild(xsNofAttributeElement);
@@ -179,8 +177,9 @@ public final class XsMetaModel {
     }
 
     /**
-     * Adds <code>xs:attribute ref="nof:feature" fixed="(feature)"</code> element as child to supplied XSD
-     * element, presumed to be an <xs:complexType</code>.
+     * Adds <code>xs:attribute ref="nof:feature" fixed="(feature)"</code>
+     * element as child to supplied XSD element, presumed to be an
+     * <xs:complexType</code>.
      */
     Element addXsNofFeatureAttributeElements(final Element parentXsElement, final String feature) {
         final Element xsNofFeatureAttributeElement = createXsElement(helper.docFor(parentXsElement), "attribute");
@@ -191,24 +190,27 @@ public final class XsMetaModel {
     }
 
     /**
-     * returns child <code>xs:complexType</code> element allowing mixed content for supplied parent XSD
-     * element, creating and appending if necessary.
+     * returns child <code>xs:complexType</code> element allowing mixed content
+     * for supplied parent XSD element, creating and appending if necessary.
      * 
      * <p>
-     * The supplied element is presumed to be one for which <code>xs:complexType</code> is valid as a child
-     * (eg <code>xs:element</code>).
+     * The supplied element is presumed to be one for which
+     * <code>xs:complexType</code> is valid as a child (eg
+     * <code>xs:element</code>).
      */
     Element complexTypeFor(final Element parentXsElement) {
         return complexTypeFor(parentXsElement, true);
     }
 
     /**
-     * returns child <code>xs:complexType</code> element, optionally allowing mixed content, for supplied
-     * parent XSD element, creating and appending if necessary.
+     * returns child <code>xs:complexType</code> element, optionally allowing
+     * mixed content, for supplied parent XSD element, creating and appending if
+     * necessary.
      * 
      * <p>
-     * The supplied element is presumed to be one for which <code>xs:complexType</code> is valid as a child
-     * (eg <code>xs:element</code>).
+     * The supplied element is presumed to be one for which
+     * <code>xs:complexType</code> is valid as a child (eg
+     * <code>xs:element</code>).
      */
     Element complexTypeFor(final Element parentXsElement, final boolean mixed) {
         final Element el = childXsElement(parentXsElement, "complexType");
@@ -219,22 +221,24 @@ public final class XsMetaModel {
     }
 
     /**
-     * returns child <code>xs:sequence</code> element for supplied parent XSD element, creating and
-     * appending if necessary.
+     * returns child <code>xs:sequence</code> element for supplied parent XSD
+     * element, creating and appending if necessary.
      * 
-     * The supplied element is presumed to be one for which <code>xs:simpleContent</code> is valid as a
-     * child (eg <code>xs:complexType</code>).
+     * The supplied element is presumed to be one for which
+     * <code>xs:simpleContent</code> is valid as a child (eg
+     * <code>xs:complexType</code>).
      */
     Element sequenceFor(final Element parentXsElement) {
         return childXsElement(parentXsElement, "sequence");
     }
 
     /**
-     * returns child <code>xs:choice</code> element for supplied parent XSD element, creating and appending
-     * if necessary.
+     * returns child <code>xs:choice</code> element for supplied parent XSD
+     * element, creating and appending if necessary.
      * 
-     * The supplied element is presumed to be one for which <code>xs:simpleContent</code> is valid as a
-     * child (eg <code>xs:complexType</code>).
+     * The supplied element is presumed to be one for which
+     * <code>xs:simpleContent</code> is valid as a child (eg
+     * <code>xs:complexType</code>).
      */
     Element choiceFor(final Element parentXsElement) {
         return childXsElement(parentXsElement, "choice");
@@ -249,8 +253,8 @@ public final class XsMetaModel {
     }
 
     /**
-     * Returns the <code>xs:choice</code> or <code>xs:sequence</code> element under the supplied XSD
-     * element, or null if neither can be found.
+     * Returns the <code>xs:choice</code> or <code>xs:sequence</code> element
+     * under the supplied XSD element, or null if neither can be found.
      */
     Element choiceOrSequenceFor(final Element parentXsElement) {
         final NodeList choiceNodeList = parentXsElement.getElementsByTagNameNS(XsMetaModel.W3_ORG_XS_URI, "choice");
@@ -265,22 +269,25 @@ public final class XsMetaModel {
     }
 
     /**
-     * returns child <code>xs:simpleContent</code> element for supplied parent XSD element, creating and
-     * appending if necessary.
+     * returns child <code>xs:simpleContent</code> element for supplied parent
+     * XSD element, creating and appending if necessary.
      * 
-     * The supplied element is presumed to be one for which <code>xs:simpleContent</code> is valid as a
-     * child (eg <code>xs:complexType</code>).
+     * The supplied element is presumed to be one for which
+     * <code>xs:simpleContent</code> is valid as a child (eg
+     * <code>xs:complexType</code>).
      */
     Element simpleContentFor(final Element parentXsElement) {
         return childXsElement(parentXsElement, "simpleContent");
     }
 
     /**
-     * returns child <code>xs:extension</code> element for supplied parent XSD element, creating and
-     * appending if nec; also sets the <code>base</code> attribute.
-     * 
-     * The supplied element is presumed to be one for which <code>xs:extension</code> is valid as a child
-     * (eg <code>xs:complexType</code>).
+     * returns child <code>xs:extension</code> element for supplied parent XSD
+     * element, creating and appending if nec; also sets the <code>base</code>
+     * attribute.
+     * 
+     * The supplied element is presumed to be one for which
+     * <code>xs:extension</code> is valid as a child (eg
+     * <code>xs:complexType</code>).
      */
     Element extensionFor(final Element parentXsElement, final String base) {
         final Element childXsElement = childXsElement(parentXsElement, "extension");
@@ -301,15 +308,17 @@ public final class XsMetaModel {
     }
 
     /**
-     * @return the <code>xs:schema</code> element (the root element of the owning XSD Doc).
+     * @return the <code>xs:schema</code> element (the root element of the
+     *         owning XSD Doc).
      */
     Element schemaFor(final Element xsElement) {
         return xsElement.getOwnerDocument().getDocumentElement();
     }
 
     /**
-     * Sets the <code>minOccurs</code> and <code>maxOccurs</code> attributes for provided
-     * <code>element</code> (presumed to be an XSD element for which these attributes makes sense.
+     * Sets the <code>minOccurs</code> and <code>maxOccurs</code> attributes for
+     * provided <code>element</code> (presumed to be an XSD element for which
+     * these attributes makes sense.
      */
     Element setXsCardinality(final Element xsElement, final int minOccurs, final int maxOccurs) {
         if (maxOccurs >= 0) {

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/sysout/SystemPrinter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/sysout/SystemPrinter.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/sysout/SystemPrinter.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/sysout/SystemPrinter.java Sun Jan 22 06:58:43 2012
@@ -72,7 +72,7 @@ public class SystemPrinter {
             final String property = properties.getProperty(name);
             final StringBuilder buf = new StringBuilder();
             if (name.endsWith(".path") || name.endsWith(".dirs")) {
-                String[] split = property.split(":");
+                final String[] split = property.split(":");
                 buf.append(split[0]);
                 for (int i = 1; i < split.length; i++) {
                     buf.append("\n\t\t" + split[i]);
@@ -85,13 +85,13 @@ public class SystemPrinter {
         if (file.isDirectory()) {
             final String[] files = file.list(new FilenameFilter() {
                 @Override
-                public boolean accept(File dir, String name) {
+                public boolean accept(final File dir, final String name) {
                     return name.endsWith(".jar");
                 }
             });
             printBlock("Libs");
-            for (int i = 0; i < files.length; i++) {
-                print(files[i]);
+            for (final String file2 : files) {
+                print(file2);
             }
         }
 
@@ -103,28 +103,28 @@ public class SystemPrinter {
         if (file.isDirectory()) {
             final String[] files = file.list(new FilenameFilter() {
                 @Override
-                public boolean accept(File dir, String name) {
+                public boolean accept(final File dir, final String name) {
                     return new File(dir, name).isFile();
                 }
             });
             printBlock("Config files");
-            for (int i = 0; i < files.length; i++) {
-                print(files[i]);
+            for (final String file2 : files) {
+                print(file2);
             }
 
-            for (int i = 0; i < files.length; i++) {
+            for (final String file2 : files) {
                 print("");
                 print("--------------------------------------------------------------------------------------------------------");
-                print(files[i]);
+                print(file2);
                 print("");
                 LineNumberReader fileInputStream = null;
                 try {
-                    fileInputStream = new LineNumberReader(new FileReader(new File(file, files[i])));
+                    fileInputStream = new LineNumberReader(new FileReader(new File(file, file2)));
                     String line;
                     while ((line = fileInputStream.readLine()) != null) {
                         print(fileInputStream.getLineNumber() + "  " + line);
                     }
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     throw new IsisException(e);
                 } finally {
                     IoUtils.closeSafely(fileInputStream);
@@ -141,7 +141,7 @@ public class SystemPrinter {
         print(AboutIsis.getFrameworkName() + ", " + AboutIsis.getFrameworkVersion() + compileDate);
     }
 
-    public void printErrorMessage(String message) {
+    public void printErrorMessage(final String message) {
         output.println("Error: " + message);
     }
 

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/Options.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/Options.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/Options.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/Options.java Sun Jan 22 06:58:43 2012
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.userprofile;
 
 import java.util.Enumeration;
@@ -27,44 +26,48 @@ import java.util.Properties;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.debug.DebuggableWithTitle;
 
-
 public class Options implements DebuggableWithTitle {
 
     private final Properties properties = new Properties();
 
-    public void addOption(String name, String value) {
+    public void addOption(final String name, final String value) {
         properties.put(name, value);
     }
-    
-    public void addOptions(String name, Options options) {
+
+    public void addOptions(final String name, final Options options) {
         properties.put(name, options);
     }
 
     public Iterator<String> names() {
-    	final Enumeration<?> propertyNames = properties.propertyNames();
-    	return new Iterator<String>() {
-			public boolean hasNext() {
-				return propertyNames.hasMoreElements();
-			}
-			public String next() {
-				return (String) propertyNames.nextElement();
-			}
-
-			public void remove() {
-				throw new UnsupportedOperationException();
-			}};
+        final Enumeration<?> propertyNames = properties.propertyNames();
+        return new Iterator<String>() {
+            @Override
+            public boolean hasNext() {
+                return propertyNames.hasMoreElements();
+            }
+
+            @Override
+            public String next() {
+                return (String) propertyNames.nextElement();
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        };
     }
-    
-    public String getString(String name) {
+
+    public String getString(final String name) {
         return properties.getProperty(name);
     }
 
-    public String getString(String name, String defaultValue) {
+    public String getString(final String name, final String defaultValue) {
         return properties.getProperty(name, defaultValue);
     }
 
-    public int getInteger(String name, int defaultValue) {
-        String value = getString(name);
+    public int getInteger(final String name, final int defaultValue) {
+        final String value = getString(name);
         if (value == null) {
             return defaultValue;
         } else {
@@ -72,7 +75,7 @@ public class Options implements Debuggab
         }
     }
 
-    public Options getOptions(String name) {
+    public Options getOptions(final String name) {
         Options options = (Options) properties.get(name);
         if (options == null) {
             options = new Options();
@@ -81,32 +84,30 @@ public class Options implements Debuggab
         return options;
     }
 
-    public boolean isOptions(String name) {
+    public boolean isOptions(final String name) {
         return properties.get(name) instanceof Options;
     }
 
-    
-    public void copy(Options options) {
+    public void copy(final Options options) {
         properties.putAll(options.properties);
     }
 
-
-    /////////////////////////////////
+    // ///////////////////////////////
     // Debugging
-    /////////////////////////////////
+    // ///////////////////////////////
 
+    @Override
     public String debugTitle() {
         return "Options";
     }
 
-    public void debugData(DebugBuilder debug) {
-        Enumeration<Object> keys = properties.keys();
+    @Override
+    public void debugData(final DebugBuilder debug) {
+        final Enumeration<Object> keys = properties.keys();
         while (keys.hasMoreElements()) {
-            String name = (String) keys.nextElement();
+            final String name = (String) keys.nextElement();
             debug.appendln(name, properties.get(name));
         }
     }
 
-
 }
-

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/OptionsClient.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/OptionsClient.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/OptionsClient.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/OptionsClient.java Sun Jan 22 06:58:43 2012
@@ -17,15 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.userprofile;
 
-
 public interface OptionsClient {
-    
+
     void loadOptions(Options viewOptions);
-    
+
     void saveOptions(Options viewOptions);
 }
-
-

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/PerspectiveEntry.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/PerspectiveEntry.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/PerspectiveEntry.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/PerspectiveEntry.java Sun Jan 22 06:58:43 2012
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.userprofile;
 
 import java.util.List;
@@ -28,19 +27,20 @@ import com.google.common.collect.Lists;
 
 public class PerspectiveEntry {
 
-    public PerspectiveEntry() {}
+    public PerspectiveEntry() {
+    }
 
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // Name & Title
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
     private String name;
 
     public String getName() {
         return name;
     }
-    
-    public void setName(String name) {
+
+    public void setName(final String name) {
         this.name = name;
     }
 
@@ -48,39 +48,37 @@ public class PerspectiveEntry {
         return name + " (" + services.size() + " classes)";
     }
 
-
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // Objects, save
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
     private final List<Object> objects = Lists.newArrayList();
 
-
     // REVIEW should this deal with Isis, and the services with IDs (or Isis)
     public List<Object> getObjects() {
         return objects;
     }
 
-    public void addToObjects(Object obj) {
+    public void addToObjects(final Object obj) {
         if (!objects.contains(obj)) {
             objects.add(obj);
         }
     }
 
-    public void removeFromObjects(Object obj) {
+    public void removeFromObjects(final Object obj) {
         objects.remove(obj);
     }
 
-    public void save(List<ObjectAdapter> adapters) {
+    public void save(final List<ObjectAdapter> adapters) {
         this.objects.clear();
-        for (ObjectAdapter adapter : adapters) {
+        for (final ObjectAdapter adapter : adapters) {
             addToObjects(adapter.getObject());
         }
     }
 
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // Services
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
     private final List<Object> services = Lists.newArrayList();
 
@@ -88,34 +86,30 @@ public class PerspectiveEntry {
         return services;
     }
 
-    public void addToServices(Object service) {
+    public void addToServices(final Object service) {
         if (service != null && !services.contains(service)) {
             services.add(service);
         }
     }
 
-    public void removeFromServices(Object service) {
+    public void removeFromServices(final Object service) {
         if (service != null && services.contains(service)) {
             services.remove(service);
         }
     }
 
-
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // copy
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
-    public void copy(PerspectiveEntry template) {
+    public void copy(final PerspectiveEntry template) {
         name = template.getName();
-        for (Object service : template.getServices()) {
+        for (final Object service : template.getServices()) {
             addToServices(service);
         }
-        for (Object obj : template.getObjects()) {
+        for (final Object obj : template.getObjects()) {
             addToObjects(obj);
         }
     }
 
-
 }
-
-

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserLocalization.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserLocalization.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserLocalization.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserLocalization.java Sun Jan 22 06:58:43 2012
@@ -28,18 +28,19 @@ public class UserLocalization implements
     private final TimeZone timeZone;
     private final Locale locale;
 
-    public UserLocalization(Locale locale, TimeZone timeZone) {
+    public UserLocalization(final Locale locale, final TimeZone timeZone) {
         this.locale = locale == null ? Locale.getDefault() : locale;
         this.timeZone = timeZone == null ? TimeZone.getDefault() : timeZone;
     }
 
+    @Override
     public Locale getLocale() {
         return locale;
     }
 
+    @Override
     public TimeZone getTimeZone() {
         return timeZone;
     }
 
 }
-

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfile.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfile.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfile.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfile.java Sun Jan 22 06:58:43 2012
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.userprofile;
 
 import java.util.Collections;
@@ -30,14 +29,13 @@ import org.apache.isis.core.metamodel.ad
 import com.google.common.collect.Lists;
 
 public class UserProfile {
-	
 
-    public UserProfile() {}
+    public UserProfile() {
+    }
 
-    
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // Perspective
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
     private PerspectiveEntry entry;
 
@@ -52,7 +50,7 @@ public class UserProfile {
         return entry;
     }
 
-    public PerspectiveEntry newPerspective(String name) {
+    public PerspectiveEntry newPerspective(final String name) {
         entry = new PerspectiveEntry();
         entry.setName(name);
         entries.add(entry);
@@ -66,15 +64,14 @@ public class UserProfile {
         }
     }
 
-    
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // Perspective Entries
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
     private final List<PerspectiveEntry> entries = Lists.newArrayList();
 
-    public PerspectiveEntry getPerspective(String name) {
-        for (PerspectiveEntry entry : entries) {
+    public PerspectiveEntry getPerspective(final String name) {
+        for (final PerspectiveEntry entry : entries) {
             if (entry.getName().equals(name)) {
                 return entry;
             }
@@ -82,23 +79,22 @@ public class UserProfile {
         throw new IsisException("No perspective " + name);
     }
 
-    public void  addToPerspectives(PerspectiveEntry perspective) {
-        PerspectiveEntry e = new PerspectiveEntry();
+    public void addToPerspectives(final PerspectiveEntry perspective) {
+        final PerspectiveEntry e = new PerspectiveEntry();
         e.copy(perspective);
         entries.add(e);
     }
 
-
     public List<String> list() {
-        List<String> list = Lists.newArrayList();
-        for (PerspectiveEntry entry : entries) {
+        final List<String> list = Lists.newArrayList();
+        for (final PerspectiveEntry entry : entries) {
             list.add(entry.getName());
         }
         return list;
     }
 
-    public void select(String name) {
-        for (PerspectiveEntry entry : entries) {
+    public void select(final String name) {
+        for (final PerspectiveEntry entry : entries) {
             if (entry.getName().equals(name)) {
                 this.entry = entry;
                 break;
@@ -106,9 +102,9 @@ public class UserProfile {
         }
     }
 
-    public void copy(UserProfile template) {
-        for (PerspectiveEntry entry : template.entries) {
-            PerspectiveEntry e = new PerspectiveEntry();
+    public void copy(final UserProfile template) {
+        for (final PerspectiveEntry entry : template.entries) {
+            final PerspectiveEntry e = new PerspectiveEntry();
             e.copy(entry);
             entries.add(e);
         }
@@ -121,11 +117,10 @@ public class UserProfile {
     public List<PerspectiveEntry> getEntries() {
         return Collections.unmodifiableList(entries);
     }
-    
 
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
     // Options
-    /////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////
 
     private final Options options = new Options();
 
@@ -133,36 +128,30 @@ public class UserProfile {
         return options;
     }
 
-    public void addToOptions(String name, String value) {
+    public void addToOptions(final String name, final String value) {
         options.addOption(name, value);
     }
-    
-    
-    /////////////////////////////////
+
+    // ///////////////////////////////
     // Localization
-    /////////////////////////////////
+    // ///////////////////////////////
 
     private Localization localization;
+
     public Localization getLocalization() {
         return localization;
     }
-    
-    public void setLocalization(Localization localization) {
+
+    public void setLocalization(final Localization localization) {
         this.localization = localization;
     }
 
-    
-
-    /////////////////////////////////
+    // ///////////////////////////////
     // Save
-    /////////////////////////////////
+    // ///////////////////////////////
 
-    public void saveObjects(List<ObjectAdapter> objects) {
+    public void saveObjects(final List<ObjectAdapter> objects) {
         entry.save(objects);
     }
 
-
-    
-
 }
-

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileLoader.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileLoader.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileLoader.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileLoader.java Sun Jan 22 06:58:43 2012
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.userprofile;
 
 import java.util.List;
@@ -27,64 +26,53 @@ import org.apache.isis.core.commons.comp
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 
 /**
- * Intended to acts like a bridge, loading the profile from the underlying store.
+ * Intended to acts like a bridge, loading the profile from the underlying
+ * store.
  * 
  * <p>
- * This is an interface only to make it easy to mock in tests.  In practice
- * there is only a single implementation, {@link UserProfileLoaderDefault}.
+ * This is an interface only to make it easy to mock in tests. In practice there
+ * is only a single implementation, {@link UserProfileLoaderDefault}.
  */
 public interface UserProfileLoader extends ApplicationScopedComponent {
-	
-    
-    ////////////////////////////////////////////////////////
+
+    // //////////////////////////////////////////////////////
     // Fixtures
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
 
     /**
      * @see PersistenceSession#isFixturesInstalled()
      */
     public boolean isFixturesInstalled();
 
-
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
     // saveAs...
-    ////////////////////////////////////////////////////////
-    
+    // //////////////////////////////////////////////////////
+
     public void saveAsDefault(UserProfile userProfile);
 
     public void saveForUser(String userName, UserProfile userProfile);
 
-    
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
     // saveSession
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
 
     public void saveSession(List<ObjectAdapter> objects);
 
-    
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
     // getProfile
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
 
     public UserProfile getProfile(AuthenticationSession session);
 
-    
     @Deprecated
     public UserProfile getProfile();
 
-
-    ////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////
     // Services
-    ////////////////////////////////////////////////////////
-
-	public void setServices(List<Object> servicesList);
-	
-	
-    public List<Object> getServices();
+    // //////////////////////////////////////////////////////
 
+    public void setServices(List<Object> servicesList);
 
-    
+    public List<Object> getServices();
 
 }
-
-

Modified: incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileStore.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileStore.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileStore.java (original)
+++ incubator/isis/trunk/framework/core/runtime/src/main/java/org/apache/isis/core/runtime/userprofile/UserProfileStore.java Sun Jan 22 06:58:43 2012
@@ -17,11 +17,8 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.runtime.userprofile;
 
-
-
 public interface UserProfileStore {
 
     boolean isFixturesInstalled();
@@ -30,7 +27,4 @@ public interface UserProfileStore {
 
     UserProfile getUserProfile(String userName);
 
-
 }
-
-

Modified: incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java (original)
+++ incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java Sun Jan 22 06:58:43 2012
@@ -22,49 +22,48 @@ package org.apache.isis.core.testsupport
 import org.jmock.Expectations;
 import org.jmock.integration.junit4.JUnitRuleMockery;
 import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
 
 /**
- * Use as a <tt>@Rule</tt>, meaning that the <tt>@RunWith(JMock.class)</tt>
- * can be ignored.
+ * Use as a <tt>@Rule</tt>, meaning that the <tt>@RunWith(JMock.class)</tt> can
+ * be ignored.
  * 
  * <pre>
  * public class MyTest {
  * 
- *     @Rule
+ *     &#064;Rule
  *     public final Junit4Mockery2 context = Junit4Mockery2.createFor(Mode.INTERFACES);
- *
+ * 
  * }
  * </pre>
  * 
  * <p>
- * The class also adds some convenience methods, and uses a factory method
- * to make it explicit whether the context can mock only interfaces or
- * interfaces and classes.
+ * The class also adds some convenience methods, and uses a factory method to
+ * make it explicit whether the context can mock only interfaces or interfaces
+ * and classes.
  */
 public class JUnitRuleMockery2 extends JUnitRuleMockery {
-    
+
     public static enum Mode {
-        INTERFACES_ONLY,
-        INTERFACES_AND_CLASSES;
+        INTERFACES_ONLY, INTERFACES_AND_CLASSES;
     }
 
     /**
      * Factory method.
      */
-    public static JUnitRuleMockery2 createFor(Mode mode) {
-        JUnitRuleMockery2 jUnitRuleMockery2 = new JUnitRuleMockery2();
-        if(mode == Mode.INTERFACES_AND_CLASSES) {
+    public static JUnitRuleMockery2 createFor(final Mode mode) {
+        final JUnitRuleMockery2 jUnitRuleMockery2 = new JUnitRuleMockery2();
+        if (mode == Mode.INTERFACES_AND_CLASSES) {
             jUnitRuleMockery2.setImposteriser(ClassImposteriser.INSTANCE);
         }
         return jUnitRuleMockery2;
     }
-    
-    private JUnitRuleMockery2() {}
-    
+
+    private JUnitRuleMockery2() {
+    }
+
     /**
-     * Ignoring any interaction with the mock; an allowing/ignoring mock will be returned in turn.
+     * Ignoring any interaction with the mock; an allowing/ignoring mock will be
+     * returned in turn.
      */
     public <T> T ignoring(final T mock) {
         checking(new Expectations() {
@@ -76,7 +75,8 @@ public class JUnitRuleMockery2 extends J
     }
 
     /**
-     * Allow any interaction with the mock; an allowing mock will be returned in turn.
+     * Allow any interaction with the mock; an allowing mock will be returned in
+     * turn.
      */
     public <T> T allowing(final T mock) {
         checking(new Expectations() {

Modified: incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java (original)
+++ incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java Sun Jan 22 06:58:43 2012
@@ -61,7 +61,8 @@ public class Movie {
     }
 
     /*
-     * public static void aboutActionFindMovie(ActionAbout about, String name, Person director, Person actor) {
-     * about.setParameter(0, "Name"); about.setParameter(1, "Director"); about.setParameter(2, "Actor"); }
+     * public static void aboutActionFindMovie(ActionAbout about, String name,
+     * Person director, Person actor) { about.setParameter(0, "Name");
+     * about.setParameter(1, "Director"); about.setParameter(2, "Actor"); }
      */
 }

Modified: incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java (original)
+++ incubator/isis/trunk/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java Sun Jan 22 06:58:43 2012
@@ -16,81 +16,82 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.core.testsupport.value;
-
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Contract test for value types ({@link #equals(Object)} and {@link #hashCode()}).
- */
-public abstract class ValueTypeContractTestAbstract<T> {
-
-    @Before
-    public void setUp() throws Exception {
-        assertSizeAtLeast(getObjectsWithSameValue(), 2);
-        assertSizeAtLeast(getObjectsWithDifferentValue(), 1);
-    }
-
-    private void assertSizeAtLeast(final List<T> objects, final int i) {
-        assertThat(objects, is(notNullValue()));
-        assertThat(objects.size(), is(greaterThan(i - 1)));
-    }
-
-    @Test
-    public void notEqualToNull() throws Exception {
-        for (final T o1 : getObjectsWithSameValue()) {
-            assertThat(o1.equals(null), is(false));
-        }
-        for (final T o1 : getObjectsWithDifferentValue()) {
-            assertThat(o1.equals(null), is(false));
-        }
-    }
-
-    @Test
-    public void reflexiveAndSymmetric() throws Exception {
-        for (final T o1 : getObjectsWithSameValue()) {
-            for (final T o2 : getObjectsWithSameValue()) {
-                assertThat(o1.equals(o2), is(true));
-                assertThat(o2.equals(o1), is(true));
-                assertThat(o1.hashCode(), is(equalTo(o2.hashCode())));
-            }
-        }
-    }
-
-    @Test
-    public void notEqual() throws Exception {
-        for (final T o1 : getObjectsWithSameValue()) {
-            for (final T o2 : getObjectsWithDifferentValue()) {
-                assertThat(o1.equals(o2), is(false));
-                assertThat(o2.equals(o1), is(false));
-            }
-        }
-    }
-
-    @Test
-    public void transitiveWhenEqual() throws Exception {
-        for (final T o1 : getObjectsWithSameValue()) {
-            for (final T o2 : getObjectsWithSameValue()) {
-                for (final Object o3 : getObjectsWithSameValue()) {
-                    assertThat(o1.equals(o2), is(true));
-                    assertThat(o2.equals(o3), is(true));
-                    assertThat(o1.equals(o3), is(true));
-                }
-            }
-        }
-    }
-
-    protected abstract List<T> getObjectsWithSameValue();
-
-    protected abstract List<T> getObjectsWithDifferentValue();
-
-}
+package org.apache.isis.core.testsupport.value;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Contract test for value types ({@link #equals(Object)} and
+ * {@link #hashCode()}).
+ */
+public abstract class ValueTypeContractTestAbstract<T> {
+
+    @Before
+    public void setUp() throws Exception {
+        assertSizeAtLeast(getObjectsWithSameValue(), 2);
+        assertSizeAtLeast(getObjectsWithDifferentValue(), 1);
+    }
+
+    private void assertSizeAtLeast(final List<T> objects, final int i) {
+        assertThat(objects, is(notNullValue()));
+        assertThat(objects.size(), is(greaterThan(i - 1)));
+    }
+
+    @Test
+    public void notEqualToNull() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            assertThat(o1.equals(null), is(false));
+        }
+        for (final T o1 : getObjectsWithDifferentValue()) {
+            assertThat(o1.equals(null), is(false));
+        }
+    }
+
+    @Test
+    public void reflexiveAndSymmetric() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            for (final T o2 : getObjectsWithSameValue()) {
+                assertThat(o1.equals(o2), is(true));
+                assertThat(o2.equals(o1), is(true));
+                assertThat(o1.hashCode(), is(equalTo(o2.hashCode())));
+            }
+        }
+    }
+
+    @Test
+    public void notEqual() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            for (final T o2 : getObjectsWithDifferentValue()) {
+                assertThat(o1.equals(o2), is(false));
+                assertThat(o2.equals(o1), is(false));
+            }
+        }
+    }
+
+    @Test
+    public void transitiveWhenEqual() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            for (final T o2 : getObjectsWithSameValue()) {
+                for (final Object o3 : getObjectsWithSameValue()) {
+                    assertThat(o1.equals(o2), is(true));
+                    assertThat(o2.equals(o3), is(true));
+                    assertThat(o1.equals(o3), is(true));
+                }
+            }
+        }
+    }
+
+    protected abstract List<T> getObjectsWithSameValue();
+
+    protected abstract List<T> getObjectsWithDifferentValue();
+
+}

Modified: incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java (original)
+++ incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java Sun Jan 22 06:58:43 2012
@@ -24,7 +24,7 @@ BUSINESS INTERRUPTION) HOWEVER CAUSED AN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
 WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGE.
-*/
+ */
 package org.jmock.auto;
 
 import static java.lang.annotation.ElementType.FIELD;

Modified: incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java (original)
+++ incubator/isis/trunk/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java Sun Jan 22 06:58:43 2012
@@ -24,7 +24,7 @@ BUSINESS INTERRUPTION) HOWEVER CAUSED AN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
 WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGE.
-*/
+ */
 package org.jmock.auto;
 
 import static java.lang.annotation.ElementType.FIELD;
@@ -33,7 +33,6 @@ import static java.lang.annotation.Reten
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
-
 @Retention(RUNTIME)
 @Target(FIELD)
 public @interface Mock {



Mime
View raw message