Author: desruisseaux
Date: Tue Mar  5 16:43:25 2013
New Revision: 1452887

URL: http://svn.apache.org/r1452887
Log:
IP review.

Added:
    sis/ip-review/ISOMetadata.xhtml   (with props)
    sis/ip-review/InvalidMetadataException.xhtml   (with props)
    sis/ip-review/rev/06942/ISOMetadata.xhtml   (with props)
    sis/ip-review/rev/07197/ISOMetadata.xhtml   (with props)
    sis/ip-review/rev/20874/ISOMetadata.xhtml   (with props)
    sis/ip-review/rev/24820/ISOMetadata.xhtml   (with props)
Modified:
    sis/ip-review/rev/06942/ModifiableMetadata.xhtml
    sis/ip-review/rev/07197/ModifiableMetadata.xhtml

Added: sis/ip-review/ISOMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/ISOMetadata.xhtml?rev=1452887&view=auto
==============================================================================
--- sis/ip-review/ISOMetadata.xhtml (added)
+++ sis/ip-review/ISOMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+  <head>
+    <meta charset="UTF-8"/>
+    <title>ISOMetadata history</title>
+    <style type="text/css" media="all">
+      @import url("./reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>ISOMetadata history</h1>
+  <p>Click on the commit message for inspecting the <code>diff</code> and how 
the code has been rewritten.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn log -r31996:6943 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/MetadataEntity.java</code></blockquote>
+<table>
+  <tr>
+    <th>Rev.</th>
+    <th>Date</th>
+    <th>Author</th>
+    <th class="last">Message</th>
+  </tr>
+<tr><td 
class="rev">31557</td><td>2008-09-19</td><td>desruisseaux</td><td>Removed JAXB 
annotations.</td></tr>
+<tr><td 
class="rev">30792</td><td>2008-06-23</td><td>desruisseaux</td><td>Synchronized 
the collections used in metadata. Javadoc cleanup.</td></tr>
+<tr><td class="rev">30640</td><td>2008-06-12</td><td>acuster</td><td>Copyright 
headers: lib/metadata, this time with feeling (and the el in Toolkit)</td></tr>
+<tr><td class="rev">30519</td><td>2008-06-05</td><td>acuster</td><td>Metadata 
header cleanup and copyright review.</td></tr>
+<tr><td class="rev">30258</td><td>2008-05-08</td><td>acuster</td><td>Reshuffle 
the top level repo: drop uDig, move up trunk, tags, and branches.</td></tr>
+<tr><td class="rev">30257</td><td>2008-05-08</td><td>acuster</td><td>Move 
trunk/gt/ directory contents up to trunk/ and drop gt</td></tr>
+<tr><td 
class="rev">30043</td><td>2008-04-25</td><td>desruisseaux</td><td>Reverted back 
the ThreadLocal variable type to Boolean (last change from Boolean to current 
Thread was a mistake). Opportunist usage of hashCode in 
AbstractMetadata.equals(...).</td></tr>
+<tr><td 
class="rev">30041</td><td>2008-04-25</td><td>desruisseaux</td><td>Renamed 
'isMarshalling(boolean)' as 'xmlMarshalling(boolean)' and added a warning 
telling that it is a problematic patch. Removed the synchronized keyword in 
AbstractMetadata.equals(Object) as a fix of GEOT-1777).</td></tr>
+<tr><td class="rev">29685</td><td>2008-03-20</td><td>cedricbr</td><td>Third 
part of the JAXB proposal, the annotations.</td></tr>
+<tr><td class="rev">28922</td><td>2008-01-24</td><td>acuster</td><td>Bump the 
(at)since version to 2.5 since WKTParser was cut from 2.4</td></tr>
+<tr><td class="rev">28540</td><td>2007-12-29</td><td>acuster</td><td>Hide 
buttons which are not yet used</td></tr>
+<tr><td class="rev">28051</td><td>2007-11-26</td><td>desruisseaux</td><td>More 
Java 5 parameterized types. Include a fix for GEOT-1599 
(CitationImpl.getIdentifiers() should returns a set of Identifiers, not a set 
of Strings).</td></tr>
+<tr><td 
class="rev">25189</td><td>2007-04-17</td><td>desruisseaux</td><td>Removed 
useless import statements.</td></tr>
+<tr><td 
class="rev">25175</td><td>2007-04-16</td><td>desruisseaux</td><td>Removed 
'equals', 'hashCode', 'toString' and 'freeze' methods from every metadata 
implementation. They are now implemented by generic methods inherited from 
AbstractMetadata, which perform their work using Java reflection. This way we 
avoid lot of redundancy, some errors introduced by maintenance ('equals' method 
not updated in the way they should), more systematic implementations (espcially 
for the 'toString' method, which was not implemented at all for a majority of 
metadata), more support for future introduction of other metadata standards 
than ISO 19115, etc. The cost is more runtime overhead, but it still possible 
to provide custom implementations for 'equals' and 'hashCode' only in the class 
that appear to be bottleneck, if we want.</td></tr>
+<tr><td 
class="rev">25157</td><td>2007-04-12</td><td>desruisseaux</td><td>Metadata 
review. Also provided a first draft of support classes for new 'equals(...)' 
copy constructor implementations backed by Java reflection.</td></tr>
+<tr><td 
class="rev">25098</td><td>2007-04-10</td><td>desruisseaux</td><td>Review of 
metadata changes.</td></tr>
+<tr><td class="rev">24820</td><td>2007-03-20</td><td 
class="unav">chorner</td><td><a 
href="rev/24820/ISOMetadata.xhtml">synchronization with GEO-95 
changes</a></td></tr>
+<tr><td 
class="rev">22443</td><td>2006-10-27</td><td>desruisseaux</td><td>Splitted 
referencing, extracting metadata in their own module (GEOT-983). As a side 
effect, replaced some calls of CRSUtilities.foo(...) by CRS.foo(...).</td></tr>
+<tr><td 
class="rev">22327</td><td>2006-10-23</td><td>desruisseaux</td><td>GEOT-982: 
regroup 'module', 'plugin', 'ext' and 'unsupported' in a common 
directory.</td></tr>
+<tr><td 
class="rev">22315</td><td>2006-10-22</td><td>desruisseaux</td><td>Reorganisation
 of directory tree structure (GEOT-982) phase 1: moved 'src' to 
'src/main/java'.</td></tr>
+<tr><td class="rev">20874</td><td>2006-08-07</td><td 
class="unav">jgarnett</td><td><a href="rev/20874/ISOMetadata.xhtml">ip 
review</a></td></tr>
+<tr><td 
class="rev">17672</td><td>2006-01-19</td><td>desruisseaux</td><td>Added @source 
tag.</td></tr>
+<tr><td 
class="rev">17660</td><td>2006-01-18</td><td>desruisseaux</td><td>Fixed SVN 
attributes, including the addition of URL attribute.</td></tr>
+<tr><td 
class="rev">15350</td><td>2005-08-16</td><td>desruisseaux</td><td>Merged the 
'split-main' branch to trunk (GEOT-662)</td></tr>
+<tr><td 
class="rev">15299</td><td>2005-08-11</td><td>desruisseaux</td><td>Added 
CRS.VALID.AREA formula in OpenOffice addin / Added convenience methods for 
fetching GeographicBoundingBox and for fetching coordinate operation accuracy / 
Bug fix for parameter using dimensionless unit in EPGS database</td></tr>
+<tr><td 
class="rev">15256</td><td>2005-08-09</td><td>desruisseaux</td><td>Extraction of 
referencing module from main</td></tr>
+<tr><td 
class="rev">15255</td><td>2005-08-09</td><td>desruisseaux</td><td>Prepare 
branch for splitting main</td></tr>
+<tr><td 
class="rev">13925</td><td>2005-05-30</td><td>desruisseaux</td><td>Added @since 
javadoc tag</td></tr>
+<tr><td 
class="rev">13752</td><td>2005-05-23</td><td>desruisseaux</td><td>Added the 
'Impl' suffix to direct implementations of all metadata interfaces; deprecated 
the old implementations (not yet deleted).</td></tr>
+<tr><td 
class="rev">13078</td><td>2005-04-13</td><td>desruisseaux</td><td>Removed 
catalog dependencies in metadata package, including the removal of the whole 
'iso19115' deprecated package. The BeanInfo code still available in the SVN 
history. We may reuse the BeanInfo code later, but it should be put in some 
metadata wrapper (not directly in MetadataEntity subclass), because some 
implementation do not extends MetadataEntity (e.g. the SQL package using 
java.lang.reflect.Proxy). The catalog dependency removal was done because the 
GeoAPI interfaces were built on top of old 1.0 specification. Degree is about 
to commit new interfaces (2.0 based) in replacement, which is going to create 
some conflict if we don't remove 1.0 dependencies.</td></tr>
+<tr><td 
class="rev">12952</td><td>2005-04-03</td><td>desruisseaux</td><td>Updated 
metadata implementation for GeoAPI changes (GEO-51 and GEO-56)</td></tr>
+<tr><td 
class="rev">12536</td><td>2005-03-22</td><td>desruisseaux</td><td>Deprecated 
legacy metadata classes and catalog API / Removed test exclusions / Fixed (x,y) 
order in Geometry.toString() (GEOT-179)</td></tr>
+<tr><td class="rev">8518</td><td>2004-10-11</td><td>desruisseaux</td><td>Apply 
changes voted in OGC meeting at Southampton: use of Identifier and 
GenericName</td></tr>
+<tr><td class="rev">8358</td><td>2004-10-04</td><td>desruisseaux</td><td>Added 
main Metadata class</td></tr>
+<tr><td class="rev">8102</td><td>2004-09-21</td><td>desruisseaux</td><td>Added 
new metadata implementations</td></tr>
+<tr><td class="rev">8073</td><td>2004-09-20</td><td>desruisseaux</td><td>Added 
new metadata implementations</td></tr>
+<tr><td class="rev">7197</td><td>2004-07-22</td><td 
class="unav">jeichar</td><td><a 
href="rev/07197/ISOMetadata.xhtml">MetadataEntity fixed</a></td></tr>
+<tr><td class="rev">7133</td><td>2004-07-21</td><td>desruisseaux</td><td>Added 
support for unmodifiable metadata</td></tr>
+<tr><td 
class="rev">7098</td><td>2004-07-20</td><td>desruisseaux</td><td>Refactored 
iso19115.AbstractMetadata as MetadataEntity</td></tr>
+<tr><td class="rev">6942</td><td>2004-07-16</td><td 
class="unav">jeichar</td><td><a href="rev/06942/ISOMetadata.xhtml">metadata and 
catalog moved to geoapi</a></td></tr>
+<tr><td class="rev">6937</td><td>2004-07-16</td><td 
class="unav">jgarnett</td><td><a href="rev/06942/ISOMetadata.xhtml">juggle 
Metadata to MetadataElement</a></td></tr>
+<tr><td class="rev">6921</td><td>2004-07-15</td><td 
class="unav">jgarnett</td><td><a href="rev/06942/ISOMetadata.xhtml">changed to 
elements()</a></td></tr>
+<tr><td class="rev">6908</td><td>2004-07-14</td><td 
class="unav">jgarnett</td><td><a href="rev/06942/ISOMetadata.xhtml">first run 
at connecting both maetadata apis</a></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/InvalidMetadataException.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/InvalidMetadataException.xhtml?rev=1452887&view=auto
==============================================================================
--- sis/ip-review/InvalidMetadataException.xhtml (added)
+++ sis/ip-review/InvalidMetadataException.xhtml Tue Mar  5 16:43:25 2013
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+  <head>
+    <meta charset="UTF-8"/>
+    <title>InvalidMetadataException history</title>
+    <style type="text/css" media="all">
+      @import url("./reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>InvalidMetadataException history</h1>
+  <p>Click on the commit message for inspecting the <code>diff</code> and how 
the code has been rewritten.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn log -r31996:1 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/InvalidMetadataException.java</code></blockquote>
+<table>
+  <tr>
+    <th>Rev.</th>
+    <th>Date</th>
+    <th>Author</th>
+    <th class="last">Message</th>
+  </tr>
+<tr><td class="rev">30640</td><td>2008-06-12</td><td>acuster</td><td>Copyright 
headers: lib/metadata, this time with feeling (and the el in Toolkit)</td></tr>
+<tr><td 
class="rev">30547</td><td>2008-06-06</td><td>desruisseaux</td><td>Added a few 
MetadataStandard constants. Make the error message slightly more explicit when 
there is no setter for a given property.</td></tr>
+<tr><td class="rev">30519</td><td>2008-06-05</td><td>acuster</td><td>Metadata 
header cleanup and copyright review.</td></tr>
+<tr><td class="rev">30258</td><td>2008-05-08</td><td>acuster</td><td>Reshuffle 
the top level repo: drop uDig, move up trunk, tags, and branches.</td></tr>
+<tr><td class="rev">30257</td><td>2008-05-08</td><td>acuster</td><td>Move 
trunk/gt/ directory contents up to trunk/ and drop gt</td></tr>
+<tr><td class="rev">28922</td><td>2008-01-24</td><td>acuster</td><td>Bump the 
(at)since version to 2.5 since WKTParser was cut from 2.4</td></tr>
+<tr><td class="rev">28540</td><td>2007-12-29</td><td>acuster</td><td>Hide 
buttons which are not yet used</td></tr>
+<tr><td class="rev">28051</td><td>2007-11-26</td><td>desruisseaux</td><td>More 
Java 5 parameterized types. Include a fix for GEOT-1599 
(CitationImpl.getIdentifiers() should returns a set of Identifiers, not a set 
of Strings).</td></tr>
+<tr><td 
class="rev">25175</td><td>2007-04-16</td><td>desruisseaux</td><td>Removed 
'equals', 'hashCode', 'toString' and 'freeze' methods from every metadata 
implementation. They are now implemented by generic methods inherited from 
AbstractMetadata, which perform their work using Java reflection. This way we 
avoid lot of redundancy, some errors introduced by maintenance ('equals' method 
not updated in the way they should), more systematic implementations (espcially 
for the 'toString' method, which was not implemented at all for a majority of 
metadata), more support for future introduction of other metadata standards 
than ISO 19115, etc. The cost is more runtime overhead, but it still possible 
to provide custom implementations for 'equals' and 'hashCode' only in the class 
that appear to be bottleneck, if we want.</td></tr>
+<tr><td 
class="rev">25157</td><td>2007-04-12</td><td>desruisseaux</td><td>Metadata 
review. Also provided a first draft of support classes for new 'equals(...)' 
copy constructor implementations backed by Java reflection.</td></tr>
+<tr><td 
class="rev">25098</td><td>2007-04-10</td><td>desruisseaux</td><td>Review of 
metadata changes.</td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/InvalidMetadataException.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/InvalidMetadataException.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/rev/06942/ISOMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/rev/06942/ISOMetadata.xhtml?rev=1452887&view=auto
==============================================================================
--- sis/ip-review/rev/06942/ISOMetadata.xhtml (added)
+++ sis/ip-review/rev/06942/ISOMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -0,0 +1,402 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+  <head>
+    <meta charset="UTF-8"/>
+    <title>ISOMetadata changes for revisions 6943:6942</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>ISOMetadata changes for revisions 6943:6942</h1>
+<p>This code does not exist anymore in SIS or Geotk. We can recognize some 
ideas, for example
+the <code>toMap()</code> method, but the implementation it completely 
different. For example
+the SIS <code>Map</code> is a view instead of a copy.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn cat -r6942 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/MetadataEntity.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 6942</th></tr><tr>
+<td><pre><span class="add">/*
+ *    Geotools2 - OpenSource mapping toolkit
+ *    http://geotools.org
+ *    (C) 2002, Geotools Project Managment Committee (PMC)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ */
+package org.geotools.metadata.iso19115;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.opengis.catalog.MetadataEntity;
+
+import org.geotools.catalog.XPath;
+import org.opengis.metadata.MetaData;
+
+/**
+ * A superclass for implementing ISO19115 MetaData interfaces and allowing
+ * Expr based query via geotools Metadata.Entity and Metadata.Element.
+ *
+ * A subclass implements *MUST* implement minimum one subinterface of
+ * the ISO MetaData interface provided by GeoAPI.
+ *
+ * ISOMetadata uses BeanInfo style reflection to identify all the attributes
+ * implemented by the subclass as part of a GeoAPI MetaData interface.
+ *
+ * The BeanInfo attributes are used to construct all the Metadata.Entity
+ * and Metadata.Element objects.
+ *
+ * The type of each attribue is used to determine whether the element is a
+ * simple Metadata.Element or an Metadata.Entity.
+ * Attributes that subclass GeoAPI ISO19115 MetaData
+ * are turned into Metadata Entities.
+ *
+ * @author jgarnett
+ * @since 2.1
+ */
+public abstract class AbstractMetaData implements MetadataEntity, MetaData {
+    ISO19115Entity entity;
+
+    /**
+     * @see org.geotools.metadata.Metadata#elements()
+     */
+    public final List elements() {
+       ISO19115Entity entity = (ISO19115Entity) getEntityType();
+       List elements = new ArrayList( entity.getElements().size() );
+
+        for (Iterator iter = entity.propertyMap().values().iterator(); 
iter.hasNext();) {
+            PropertyDescriptor descriptor =(PropertyDescriptor) iter.next();
+            Method read = descriptor.getReadMethod();
+            Method method = (Method) descriptor.getReadMethod();
+            try {
+               Object value = read.invoke( this, null );
+               elements.add( value );
+            } catch (Exception e) {
+                throw new RuntimeException("There must be a bug in the 
EntityImpl class during the introspection.",
+                    e);
+            }
+        }
+        return elements;
+    }
+
+    /**
+     * @see org.geotools.metadata.Metadata#getElement(java.lang.String)
+     */
+    public final Object getElement(String xpath) {
+        List elements = XPath.getValue(xpath, this);
+
+        if (elements.isEmpty()) {
+            return null;
+        }
+
+        if (elements.size() == 1) {
+            return elements.get(0);
+        }
+
+        return elements;
+    }
+
+    /**
+     * @see 
org.geotools.metadata.Metadata#getElement(org.geotools.metadata.ElementType)
+     */
+    public Object getElement(Element element) {
+        ISO19115Element elemImpl;
+
+        if (element instanceof ISO19115Element) {
+            elemImpl = (ISO19115Element) element;
+        } else {
+            elemImpl = (ISO19115Element) 
getEntityType().getElement(element.getName());
+        }
+        PropertyDescriptor descriptor = elemImpl.getProperty();
+        Method read = descriptor.getReadMethod();
+        try {
+            return read.invoke( this, null );
+        } catch (Exception e) {
+            throw new RuntimeException("There must be a bug in the EntityImpl 
class during the introspection.",
+                e);
+        }
+    }
+
+
+    /**
+     * @see org.geotools.metadata.Metadata#getEntity()
+     */
+    public EntityType getEntityType() {
+        if (entity == null) {
+            entity = ISO19115Entity.getEntity(getClass());
+        }
+        return entity;
+    }
+
+    /**
+     * The EntityImpl class uses reflection to examine the structure of a 
metadata
+     *
+     * @see org.geotools.metadata.Metadata.Entity
+     *
+     * @author $author$
+     * @version $Revision: 1.9 $
+     */
+    private static class ISO19115Entity implements EntityType {
+        static HashMap entityMap = new HashMap();
+
+        /** Map of PropertyDescriptor by name */
+        Map propertyMap;
+
+        private ArrayList elements;
+
+        private ISO19115Entity(Class clazz) {
+            init(clazz);
+        }
+
+        /**
+         * Gets or creates the Enity instance that descibes the Class passed 
in as an argument
+         *
+         * @param clazz The class of a metadata to be inspected
+         *
+         * @return A Metadata.Entity that descibes the class passed in by the 
class clazz
+         */
+        public static ISO19115Entity getEntity(Class clazz) {
+            if (!entityMap.containsKey(clazz)) {
+                entityMap.put(clazz, new ISO19115Entity(clazz));
+            }
+            return (ISO19115Entity) entityMap.get(clazz);
+        }
+        /**
+         * Returns Map of attribtues by name for all this class.
+         * &lt;p&gt;
+         * Should only be called against interfaces that extend
+         * the GeoAPI ISO MetaData interface.
+         * &lt;/p&gt;
+         * @param type
+         * @return
+         */
+        private final Map introspectISO19115( Class metaDataType ){
+            BeanInfo beanInfo;
+                try {
+                    beanInfo = Introspector.getBeanInfo( metaDataType );
+                    return toMap( beanInfo.getPropertyDescriptors() );
+                } catch (IntrospectionException e) {
+                    throw new RuntimeException(
+                            "Could not inspect "+ metaDataType.getName() +
+                            " for 
"+this.getClass().getName()+":"+e.getMessage(),
+                            e);
+                }
+        }
+        /**
+         * Convert to Map of PropertyDescriptor by name.
+         * &lt;p&gt;
+         * Not only properties that can be read will be added.
+         */
+        private final Map toMap( PropertyDescriptor descriptors[] ){
+            if( descriptors == null ){
+                return Collections.EMPTY_MAP;
+            }
+            Map map = new HashMap();
+            for( int i=0; i&lt;descriptors.length; i++){
+                PropertyDescriptor descriptor = descriptors[i];
+                if( descriptor.getReadMethod() != null ){
+                    map.put( descriptor.getName(), descriptor );
+                }
+            }
+            return map;
+        }
+        private final boolean isMetaDataInterface( Class type ){
+            if( type == null ){
+                return false;
+            }
+            if ( org.opengis.metadata.MetaData.class == type ){
+                return true;
+            }
+            Class interfaces[] = type.getInterfaces();
+            for( int i=0; i&lt;interfaces.length; i++){
+                if( isMetaDataInterface( interfaces[i] )){
+                        return true;
+                }
+            }
+            return isMetaDataInterface( type.getSuperclass() );
+        }
+        private final Map introspect( Class baseType ){
+            Map map = new TreeMap();
+
+            for( Class type=baseType; type != null; type = 
type.getSuperclass() ){
+                Class interfaces[] = type.getInterfaces();
+                if( interfaces != null){
+                    for( int i=0; i&lt;interfaces.length; i++){
+                        //System.out.println("\t interface "+interfaces[i] + " 
"+isMetaDataInterface( interfaces[i] ) );
+                        if( isMetaDataInterface( interfaces[i] ) ){
+                            Map properties = introspectISO19115( interfaces[i] 
);
+                            map.putAll( properties );
+                        }
+                    }
+                }
+            }
+            return map;
+        }
+        private void init(Class type) {
+            propertyMap = introspect( type );
+
+            elements = new ArrayList( propertyMap.size() );
+            for( Iterator i=propertyMap.values().iterator(); i.hasNext(); ){
+                PropertyDescriptor property = (PropertyDescriptor) i.next();
+                ISO19115Element element = new ISO19115Element( property );
+                elements.add( element );
+            }
+        }
+        private Map propertyMap(){
+            return propertyMap;
+        }
+        private PropertyDescriptor property( String name ){
+            return (PropertyDescriptor) propertyMap.get( name );
+        }
+
+        /**
+         * @see 
org.geotools.metadata.Metadata.Entity#getElement(java.lang.String)
+         */
+        public Object getElement(String xpath) {
+            List result = XPath.getElement(xpath, this);
+
+            if (result.isEmpty()) {
+                return null;
+            }
+
+            if (result.size() == 1) {
+                return result.get(0);
+            }
+
+            return result;
+        }
+        /**
+         * @see org.geotools.metadata.Metadata.Entity#getElements()
+         */
+        public List getElements() {
+            return elements;
+        }
+
+        /**
+         * @param elementClass
+         * @return Trye if type is a GeoAPI ISO Metadata class
+         */
+        public static boolean isEntity(Class type) {
+            return MetaData.class.isAssignableFrom(type);
+        }
+    }
+
+    /**
+     * A basic implementation of the Metadata.Element class
+     * @see org.geotools.metadata.Metadata.Element
+     *
+     * @author $author$
+     * @version $Revision: 1.9 $
+     */
+    private static class ISO19115Element implements Element {
+        private PropertyDescriptor property;
+        private EntityType entity;
+
+        /**
+         * @param elementClass
+         */
+        public ISO19115Element( PropertyDescriptor property) {
+            this.property = property;
+            Class type = property.getPropertyType();
+            if( ISO19115Entity.isEntity( type )) {
+                entity = ISO19115Entity.getEntity( type );
+            }
+            else {
+               entity = null;
+            }
+        }
+
+        /**
+         * Returns the java.lang.reflect.Method that can access the element 
data.
+         */
+        public PropertyDescriptor getProperty() {
+            return property;
+        }
+
+        /**
+         * @see org.geotools.metadata.Metadata.Element#getType()
+         */
+        public Class getType() {
+            return property.getPropertyType();
+        }
+
+        /**
+         * @see org.geotools.metadata.Metadata.Element#getName()
+         */
+        public String getName() {
+            return property.getName();
+        }
+
+        /**
+         * @see org.geotools.metadata.Metadata.Element#isNillable()
+         */
+        public boolean isNillable() {
+            return false;
+        }
+
+        /**
+         * @see org.geotools.metadata.Metadata.Element#isMetadataEntity()
+         */
+        public boolean isMetadataEntity() {
+            return entity != null;
+        }
+
+        /**
+         * @see org.geotools.metadata.Metadata.Element#isMetadataEntity()
+         */
+        public EntityType getEntityType() {
+            return entity;
+        }
+        public String toString(){
+            return property.getName();
+        }
+    }
+
+       /* (non-Javadoc)
+        * @see org.opengis.metadata.MetaData#getFileIdentifier()
+        */
+       public String getFileIdentifier() {
+            String className = getClass().getName();
+            String name = className.substring( className.lastIndexOf(".") );
+            return  name+".java";
+       }
+
+       /* (non-Javadoc)
+        * @see org.opengis.metadata.MetaData#getLanguage()
+        */
+       public Locale getLanguage() {
+            return Locale.getDefault();
+       }
+
+       public String getMetadataStandardName() {
+            return "ISO19115";
+       }
+       public String getMetadataStandardVersion() {
+            return "5.0";
+       }
+}</span></pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/06942/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/06942/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: sis/ip-review/rev/06942/ModifiableMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/rev/06942/ModifiableMetadata.xhtml?rev=1452887&r1=1452886&r2=1452887&view=diff
==============================================================================
--- sis/ip-review/rev/06942/ModifiableMetadata.xhtml (original)
+++ sis/ip-review/rev/06942/ModifiableMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -35,7 +35,7 @@
         Geotk provides a dynamic <code>java.util.Map</code> instead, which is 
a <em>view</em> (not a copy) of the metadata object:
         calls to <code>Map.get(Object)</code> are lazily delegated to the bean 
property getter.</li>
 
-        <li>The <code>getElement(String)</code> method does not exist anymore 
in Geotk since its work is performed
+        <li>The <code>getElement(String)</code> method does not exist anymore 
in SIS or Geotk since its work is performed
         by the above-cited <code>java.util.Map</code> view.</li>
 
         <li>The <code>ISO19115Entity</code> internal class in this commit 
performs a work similar to the <code>PropertyAccessor</code>
@@ -48,8 +48,7 @@
 <p><b>Command line:</b></p>
 <blockquote><code>svn cat -r6942 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/ModifiableMetadata.java</code></blockquote>
 <table class="changes">
-<tr><th>Revision 6907</th><th>Revision 6942</th></tr>
-<tr><td></td>
+<tr><th>Revision 6942</th></tr><tr>
 <td><pre><span class="add">/*
  *    Geotools2 - OpenSource mapping toolkit
  *    http://geotools.org

Added: sis/ip-review/rev/07197/ISOMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/rev/07197/ISOMetadata.xhtml?rev=1452887&view=auto
==============================================================================
--- sis/ip-review/rev/07197/ISOMetadata.xhtml (added)
+++ sis/ip-review/rev/07197/ISOMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+  <head>
+    <meta charset="UTF-8"/>
+    <title>ISOMetadata changes for revisions 7196:7197</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>ISOMetadata changes for revisions 7196:7197</h1>
+<p>This commit contains change in code that do not exist anymore in SIS or 
Geotk.
+SIS/Geotk metadata no longer work with XPath.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn diff --extensions "--unified --ignore-space-change 
--ignore-all-space --ignore-eol-style" -r7196:7197 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/MetadataEntity.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 7196</th><th>Revision 7197</th></tr>
+<tr><td><pre>import org.opengis.util.Cloneable;
+
+// Geotools dependencies
+<span class="del">import org.geotools.catalog.XPath;</span>
+import org.geotools.resources.Utilities;
+import org.geotools.resources.rsc.Resources;
+import org.geotools.resources.rsc.ResourceKeys;
+
+
+/**</pre></td>
+<td><pre>import org.opengis.util.Cloneable;
+
+// Geotools dependencies
+import org.geotools.resources.Utilities;
+import org.geotools.resources.rsc.Resources;
+import org.geotools.resources.rsc.ResourceKeys;
+<span class="add">import org.geotools.xml.XPathFactory;</span>
+
+
+/**</pre></td></tr>
+<tr><td><pre> * @return element value, List of element value, or null if xPath 
did not match anything.
+ */
+public final Object getElement(final String xpath) {
+<span class="del">    final List elements = XPath.getValue(xpath, this);</span>
+    switch (elements.size()) {
+        case 0:  return null;
+        case 1:  return elements.get(0);</pre></td>
+<td><pre> * @return element value, List of element value, or null if xPath did 
not match anything.
+ */
+public final Object getElement(final String xpath) {
+<span class="add">    final List elements = XPathFactory.value(xpath, 
this);</span>
+    switch (elements.size()) {
+        case 0:  return null;
+        case 1:  return elements.get(0);</pre></td></tr>
+<tr><td><pre> *      A List is many Elements are found to match the xpath.
+ */
+public Object getElement(final String xpath) {
+<span class="del">    final List result = XPath.getElement(xpath, this);</span>
+    switch (result.size()) {
+        case 0:  return null;
+        case 1:  return result.get(0);</pre></td>
+<td><pre> *      A List is many Elements are found to match the xpath.
+ */
+public Object getElement(final String xpath) {
+<span class="add">    final List result = XPathFactory.find(xpath, 
this);</span>
+    switch (result.size()) {
+        case 0:  return null;
+        case 1:  return result.get(0);</pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/07197/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/07197/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: sis/ip-review/rev/07197/ModifiableMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/rev/07197/ModifiableMetadata.xhtml?rev=1452887&r1=1452886&r2=1452887&view=diff
==============================================================================
--- sis/ip-review/rev/07197/ModifiableMetadata.xhtml (original)
+++ sis/ip-review/rev/07197/ModifiableMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -10,7 +10,7 @@
   <body>
     <div>
       <h1>ModifiableMetadata changes for revisions 7196:7197</h1>
-      <p>This commit contains change in code that do not exist anymore in 
Geotk.
+      <p>This commit contains change in code that do not exist anymore in SIS 
or Geotk.
       See <a href="../06942/ModifiableMetadata.xhtml">revision 6942</a> for 
more information.</p>
 
 <p><b>Command line:</b></p>

Added: sis/ip-review/rev/20874/ISOMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/rev/20874/ISOMetadata.xhtml?rev=1452887&view=auto
==============================================================================
--- sis/ip-review/rev/20874/ISOMetadata.xhtml (added)
+++ sis/ip-review/rev/20874/ISOMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+  <head>
+    <meta charset="UTF-8"/>
+    <title>ISOMetadata changes for revisions 20873:20874</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>ISOMetadata changes for revisions 20873:20874</h1>
+<p>Changes in GeoTools header only. The removal of the "<cite>or (at your 
option) any later version</cite>" clause
+must be keep in Geotk for every classes having contribution from a developer 
other than those who accepted re-licensing.
+This header does not apply to Apache SIS, since the above-cited contributions 
are omitted.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn diff --extensions "--unified --ignore-space-change 
--ignore-all-space --ignore-eol-style" -r20873:20874 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/MetadataEntity.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 20873</th><th>Revision 20874</th></tr>
+<tr><td><pre>/*
+<span class="del"> *    Geotools2 - OpenSource mapping toolkit</span>
+ *    http://geotools.org
+<span class="del"> *    (C) 2002, Geotools Project Managment Committee 
(PMC)</span>
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public</pre></td>
+<td><pre>/*
+<span class="add"> *    GeoTools - OpenSource mapping toolkit</span>
+ *    http://geotools.org
+<span class="add"> *    (C) 2004-2006, GeoTools Project Managment Committee 
(PMC)</span>
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General 
Public</pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/20874/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/20874/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/rev/24820/ISOMetadata.xhtml
URL: 
http://svn.apache.org/viewvc/sis/ip-review/rev/24820/ISOMetadata.xhtml?rev=1452887&view=auto
==============================================================================
--- sis/ip-review/rev/24820/ISOMetadata.xhtml (added)
+++ sis/ip-review/rev/24820/ISOMetadata.xhtml Tue Mar  5 16:43:25 2013
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+  <head>
+    <meta charset="UTF-8"/>
+    <title>ISOMetadata changes for revisions 24819:24820</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>ISOMetadata changes for revisions 24819:24820</h1>
+<p>This commit contains change in code that do not exist anymore in SIS or 
Geotk.
+SIS/Geotk metadata no longer work with XPath.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn diff --extensions "--unified --ignore-space-change 
--ignore-all-space --ignore-eol-style" -r24819:24820 
http://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/MetadataEntity.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 24819</th><th>Revision 24820</th></tr>
+<tr><td><pre>            buffer.append(System.getProperty("line.separator", 
"\n"));
+        }
+    }
+}</pre></td>
+<td><pre>            buffer.append(System.getProperty("line.separator", "\n"));
+        }
+    }
+<span class="add"></span>
+<span class="add">    /**</span>
+<span class="add">     * Add the contents of a collection to the provided 
buffer.</span>
+<span class="add">     * This convenience method is used for {@link #toString) 
implementations.</span>
+<span class="add">     * Output will be: "label: [1,2,3]"</span>
+<span class="add">     *</span>
+<span class="add">     * @param buffer     string buffer to add the collection 
contents to</span>
+<span class="add">     * @param label      label for easy identification</span>
+<span class="add">     * @param collection source object</span>
+<span class="add">     */</span>
+<span class="add">    protected static void appendCollection(final 
StringBuffer buffer, String label, Collection collection) {</span>
+<span class="add">        buffer.append(label);</span>
+<span class="add">        buffer.append(": [");</span>
+<span class="add">        if (collection != null &amp;&amp; 
!collection.isEmpty()) {</span>
+<span class="add">            Iterator it = collection.iterator();</span>
+<span class="add">            while (it.hasNext()) {</span>
+<span class="add">                buffer.append(it.next().toString());</span>
+<span class="add">                if (it.hasNext()) {</span>
+<span class="add">                    buffer.append(",");</span>
+}
+<span class="add">            }</span>
+<span class="add">            it.remove();</span>
+<span class="add">            it = null;</span>
+<span class="add">        }</span>
+<span class="add">        buffer.append("]");</span>
+<span class="add">    }</span>
+<span class="add">}</span></pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/24820/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/24820/ISOMetadata.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html


Reply via email to