svn commit: r1795382 - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 22:12:46 2017
New Revision: 1795382

URL: http://svn.apache.org/viewvc?rev=1795382&view=rev
Log:
Merge from JDK7 branch.

Modified:
sis/trunk/   (props changed)

sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java

sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

Propchange: sis/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 16 22:12:46 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394364-1758914
-/sis/branches/JDK7:1394913-1795335
-/sis/branches/JDK8:1584960-1795334
+/sis/branches/JDK7:1394913-1795380
+/sis/branches/JDK8:1584960-1795379
 /sis/branches/JDK9:1773327-1789983

Modified: 
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1795382&r1=1795381&r2=1795382&view=diff
==
--- 
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] Tue May 16 22:12:46 2017
@@ -363,7 +363,7 @@ public abstract class AbstractFeature im
  * }
  *
  * @param  name  the name of the operation to execute. The caller is 
responsible to ensure that the
- *   property type for that name is an instance of {@link 
Operation}.
+ *   property type for that name is an instance of {@link 
AbstractOperation}.
  * @return the result value of the given operation, or {@code null} if 
none.
  *
  * @since 0.8
@@ -390,7 +390,7 @@ public abstract class AbstractFeature im
  * but the {@linkplain FeatureOperations#link link} operation for instance 
does.
  *
  * @param  name   the name of the operation to execute. The caller is 
responsible to ensure that the
- *property type for that name is an instance of {@link 
Operation}.
+ *property type for that name is an instance of {@link 
AbstractOperation}.
  * @param  value  the value to assign to the result of the named operation.
  * @throws IllegalStateException if the operation of the given name does 
not accept assignment.
  *

Modified: 
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1795382&r1=1795381&r2=1795382&view=diff
==
--- 
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] Tue May 16 22:12:46 2017
@@ -266,6 +266,17 @@ public class MetadataSource implements A
 private transient volatile ObjectConverter lastConverter;
 
 /**
+ * The last "method name to column name" map returned by {@link 
#asNameMap(Class)}.
+ * Cached on assumption that the same map will be used more than once 
before to move to another metadata object.
+ */
+private transient Map lastNameMap;
+
+/**
+ * The {@code type} argument in the last call to {@link #asNameMap(Class)}.
+ */
+private transient Class lastNameMapType;
+
+/**
  * Where to report the warnings. This is not necessarily a logger, since 
users can register listeners.
  *
  * @see #getValue(Class, Method, Dispatcher)
@@ -544,18 +555,6 @@ public class MetadataSource implements A
 }
 
 /**
- * Returns the column name for the specified method.
- */
-private static String getColumnName(final Method method) {
-final UML annotation = method.getAnnotation(UML.class);
-if (annotation == null) {
-return method.getName();
-}
-final String name = annotation.identifier();
-return name.substring(name.lastIndexOf('.') + 1);
-}
-
-/**
  * If the given metadata is a proxy generated by this {@code 
MetadataSource}, returns the
  * identifier of that proxy. Such metadata do not need to be inserted 
again in the database.
  *
@@ -567,6 +566,25 @@ public class MetadataSource implements A
 }
 
 /**
+ * Maps method names to the name of columns in the table for the given 
metadata. The values in the
+ * returned map must be the same than the keys in the map returned by 
{@link #asValueMap(Object)}.
+ *
+ * @param  type  the type of metadata object for which to get column names.
+ * @return a map from method names to column names.
+ * @throws ClassCastExce

svn commit: r1795380 - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 22:08:05 2017
New Revision: 1795380

URL: http://svn.apache.org/viewvc?rev=1795380&view=rev
Log:
Merge bug fix from JDK8 branch.

Modified:
sis/branches/JDK7/   (props changed)

sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

Propchange: sis/branches/JDK7/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 16 22:08:05 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1795377
+/sis/branches/JDK8:1584960-1795379
 /sis/branches/JDK9:1773327-1789983
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: 
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1795380&r1=1795379&r2=1795380&view=diff
==
--- 
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] Tue May 16 22:08:05 2017
@@ -578,6 +578,7 @@ public class MetadataSource implements A
 private Map asNameMap(final Class type) throws 
ClassCastException {
 assert Thread.holdsLock(this);
 if (type != lastNameMapType) {
+lastNameMapType = type;
 lastNameMap = standard.asNameMap(type, KeyNamePolicy.METHOD_NAME, 
KeyNamePolicy.UML_IDENTIFIER);
 }
 return lastNameMap;




svn commit: r1795379 - /sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 22:04:52 2017
New Revision: 1795379

URL: http://svn.apache.org/viewvc?rev=1795379&view=rev
Log:
Fix a bug that prevented the cache from being used.

Modified:

sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

Modified: 
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1795379&r1=1795378&r2=1795379&view=diff
==
--- 
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] Tue May 16 22:04:52 2017
@@ -578,6 +578,7 @@ public class MetadataSource implements A
 private Map asNameMap(final Class type) throws 
ClassCastException {
 assert Thread.holdsLock(this);
 if (type != lastNameMapType) {
+lastNameMapType = type;
 lastNameMap = standard.asNameMap(type, KeyNamePolicy.METHOD_NAME, 
KeyNamePolicy.UML_IDENTIFIER);
 }
 return lastNameMap;




svn commit: r1795378 - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 21:59:21 2017
New Revision: 1795378

URL: http://svn.apache.org/viewvc?rev=1795378&view=rev
Log:
Merge from JDK8 branch.

Modified:
sis/branches/JDK7/   (props changed)

sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

Propchange: sis/branches/JDK7/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 16 21:59:21 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1795334
+/sis/branches/JDK8:1584960-1795377
 /sis/branches/JDK9:1773327-1789983
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: 
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1795378&r1=1795377&r2=1795378&view=diff
==
--- 
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] Tue May 16 21:59:21 2017
@@ -266,6 +266,17 @@ public class MetadataSource implements A
 private transient volatile ObjectConverter lastConverter;
 
 /**
+ * The last "method name to column name" map returned by {@link 
#asNameMap(Class)}.
+ * Cached on assumption that the same map will be used more than once 
before to move to another metadata object.
+ */
+private transient Map lastNameMap;
+
+/**
+ * The {@code type} argument in the last call to {@link #asNameMap(Class)}.
+ */
+private transient Class lastNameMapType;
+
+/**
  * Where to report the warnings. This is not necessarily a logger, since 
users can register listeners.
  *
  * @see #getValue(Class, Method, Dispatcher)
@@ -544,18 +555,6 @@ public class MetadataSource implements A
 }
 
 /**
- * Returns the column name for the specified method.
- */
-private static String getColumnName(final Method method) {
-final UML annotation = method.getAnnotation(UML.class);
-if (annotation == null) {
-return method.getName();
-}
-final String name = annotation.identifier();
-return name.substring(name.lastIndexOf('.') + 1);
-}
-
-/**
  * If the given metadata is a proxy generated by this {@code 
MetadataSource}, returns the
  * identifier of that proxy. Such metadata do not need to be inserted 
again in the database.
  *
@@ -567,6 +566,24 @@ public class MetadataSource implements A
 }
 
 /**
+ * Maps method names to the name of columns in the table for the given 
metadata. The values in the
+ * returned map must be the same than the keys in the map returned by 
{@link #asValueMap(Object)}.
+ *
+ * @param  type  the type of metadata object for which to get column names.
+ * @return a map from method names to column names.
+ * @throws ClassCastException if the metadata object type does not extend 
a metadata interface
+ * of the expected package.
+ */
+@SuppressWarnings("ReturnOfCollectionOrArrayField")
+private Map asNameMap(final Class type) throws 
ClassCastException {
+assert Thread.holdsLock(this);
+if (type != lastNameMapType) {
+lastNameMap = standard.asNameMap(type, KeyNamePolicy.METHOD_NAME, 
KeyNamePolicy.UML_IDENTIFIER);
+}
+return lastNameMap;
+}
+
+/**
  * Returns a view of the given metadata as a map. This method returns 
always a map using UML identifier
  * and containing all entries including the null ones because the {@code 
MetadataSource} implementation
  * assumes so.
@@ -837,10 +854,11 @@ public class MetadataSource implements A
 final Class elementType= wantCollection ? 
Classes.boundOfParameterizedProperty(method) : returnType;
 final boolean  isMetadata = standard.isMetadata(elementType);
 final String   tableName  = getTableName(type);
-final String   columnName = getColumnName(method);
+final String   columnName;
 final boolean  isArray;
 Object value;
 synchronized (this) {
+columnName = asNameMap(type).get(method.getName());
 if (!getExistingColumns(tableName).contains(columnName)) {
 value   = null;
 isArray = false;




svn commit: r1795376 - /sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 21:55:35 2017
New Revision: 1795376

URL: http://svn.apache.org/viewvc?rev=1795376&view=rev
Log:
Compute the column name at reading time in a way more consistent with the way 
it is computed at writing time.

Modified:

sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java

Modified: 
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java?rev=1795376&r1=1795375&r2=1795376&view=diff
==
--- 
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
 [UTF-8] Tue May 16 21:55:35 2017
@@ -266,6 +266,17 @@ public class MetadataSource implements A
 private transient volatile ObjectConverter lastConverter;
 
 /**
+ * The last "method name to column name" map returned by {@link 
#asNameMap(Class)}.
+ * Cached on assumption that the same map will be used more than once 
before to move to another metadata object.
+ */
+private transient Map lastNameMap;
+
+/**
+ * The {@code type} argument in the last call to {@link #asNameMap(Class)}.
+ */
+private transient Class lastNameMapType;
+
+/**
  * Where to report the warnings. This is not necessarily a logger, since 
users can register listeners.
  *
  * @see #getValue(Class, Method, Dispatcher)
@@ -544,18 +555,6 @@ public class MetadataSource implements A
 }
 
 /**
- * Returns the column name for the specified method.
- */
-private static String getColumnName(final Method method) {
-final UML annotation = method.getAnnotation(UML.class);
-if (annotation == null) {
-return method.getName();
-}
-final String name = annotation.identifier();
-return name.substring(name.lastIndexOf('.') + 1);
-}
-
-/**
  * If the given metadata is a proxy generated by this {@code 
MetadataSource}, returns the
  * identifier of that proxy. Such metadata do not need to be inserted 
again in the database.
  *
@@ -567,6 +566,24 @@ public class MetadataSource implements A
 }
 
 /**
+ * Maps method names to the name of columns in the table for the given 
metadata. The values in the
+ * returned map must be the same than the keys in the map returned by 
{@link #asValueMap(Object)}.
+ *
+ * @param  type  the type of metadata object for which to get column names.
+ * @return a map from method names to column names.
+ * @throws ClassCastException if the metadata object type does not extend 
a metadata interface
+ * of the expected package.
+ */
+@SuppressWarnings("ReturnOfCollectionOrArrayField")
+private Map asNameMap(final Class type) throws 
ClassCastException {
+assert Thread.holdsLock(this);
+if (type != lastNameMapType) {
+lastNameMap = standard.asNameMap(type, KeyNamePolicy.METHOD_NAME, 
KeyNamePolicy.UML_IDENTIFIER);
+}
+return lastNameMap;
+}
+
+/**
  * Returns a view of the given metadata as a map. This method returns 
always a map using UML identifier
  * and containing all entries including the null ones because the {@code 
MetadataSource} implementation
  * assumes so.
@@ -837,10 +854,11 @@ public class MetadataSource implements A
 final Class elementType= wantCollection ? 
Classes.boundOfParameterizedProperty(method) : returnType;
 final boolean  isMetadata = standard.isMetadata(elementType);
 final String   tableName  = getTableName(type);
-final String   columnName = getColumnName(method);
+final String   columnName;
 final boolean  isArray;
 Object value;
 synchronized (this) {
+columnName = asNameMap(type).get(method.getName());
 if (!getExistingColumns(tableName).contains(columnName)) {
 value   = null;
 isArray = false;




svn commit: r1795339 - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 16:37:58 2017
New Revision: 1795339

URL: http://svn.apache.org/viewvc?rev=1795339&view=rev
Log:
Merge from JDK7 branch.

Modified:
sis/trunk/   (props changed)

sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java

Propchange: sis/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 16 16:37:58 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394364-1758914
-/sis/branches/JDK7:1394913-1795072
-/sis/branches/JDK8:1584960-1795070
+/sis/branches/JDK7:1394913-1795335
+/sis/branches/JDK8:1584960-1795334
 /sis/branches/JDK9:1773327-1789983

Modified: 
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1795339&r1=1795338&r2=1795339&view=diff
==
--- 
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] Tue May 16 16:37:58 2017
@@ -240,6 +240,8 @@ public abstract class AbstractFeature im
 
 /**
  * Executes the parameterless operation of the given name and returns its 
result.
+ *
+ * @see #getOperationValue(String)
  */
 final Object getOperationResult(final String name) {
 /*
@@ -252,41 +254,6 @@ public abstract class AbstractFeature im
 }
 
 /**
- * Executes the parameterless operation of the given name and returns the 
value of its result.
- */
-final Object getOperationValue(final String name) {
-final AbstractOperation operation = (AbstractOperation) 
type.getProperty(name);
-if (operation instanceof LinkOperation) {
-return getPropertyValue(((LinkOperation) operation).referentName);
-}
-final Object result = operation.apply(this, null);
-if (result instanceof AbstractAttribute) {
-return getAttributeValue((AbstractAttribute) result);
-} else if (result instanceof AbstractAssociation) {
-return getAssociationValue((AbstractAssociation) result);
-} else {
-return null;
-}
-}
-
-/**
- * Executes the parameterless operation of the given name and sets the 
value of its result.
- */
-final void setOperationValue(final String name, final Object value) {
-final AbstractOperation operation = (AbstractOperation) 
type.getProperty(name);
-if (operation instanceof LinkOperation) {
-setPropertyValue(((LinkOperation) operation).referentName, value);
-} else {
-final Object result = operation.apply(this, null);
-if (result instanceof Property) {
-setPropertyValue((Property) result, value);
-} else {
-throw new 
IllegalStateException(Resources.format(Resources.Keys.CanNotSetPropertyValue_1, 
name));
-}
-}
-}
-
-/**
  * Returns the default value to be returned by {@link 
#getPropertyValue(String)}
  * for the property of the given name.
  *
@@ -377,6 +344,73 @@ public abstract class AbstractFeature im
 public abstract void setPropertyValue(final String name, final Object 
value) throws IllegalArgumentException;
 
 /**
+ * Executes the parameterless operation of the given name and returns the 
value of its result.
+ * This is a convenience method for sub-classes where some properties may 
be operations that
+ * {@linkplain AbstractOperation#getDependencies() depend} on other 
properties of this {@code Feature} instance
+ * (for example a {@linkplain FeatureOperations#link link} to another 
property value).
+ * Invoking this method is equivalent to performing the following steps:
+ *
+ * {@preformat java
+ * Operation operation = (Operation) type.getProperty(name);
+ * Property result = operation.apply(this, null);
+ * if (result instanceof Attribute) {
+ * return ...;  // the 
attribute value.
+ * } else if (result instanceof FeatureAssociation) {
+ * return ...;  // the 
associated feature.
+ * } else {
+ * return null;
+ * }
+ * }
+ *
+ * @param  name  the name of the operation to execute. The caller is 
responsible to ensure that the
+ *   property type for that name is an instance of {@link 
Operation}.
+ * @return the result value of the given operation, or {@code null} if 
none.
+ *
+ * @since 0.8
+ */
+protected Object getOperationValue(final String name) {
+final AbstractOperation

svn commit: r1795335 - in /sis/branches/JDK7: ./ core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTe

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 16:03:28 2017
New Revision: 1795335

URL: http://svn.apache.org/viewvc?rev=1795335&view=rev
Log:
Merge from JDK8 branch.

Modified:
sis/branches/JDK7/   (props changed)

sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java

sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java

Propchange: sis/branches/JDK7/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 16 16:03:28 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1795070
+/sis/branches/JDK8:1584960-1795334
 /sis/branches/JDK9:1773327-1789983
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: 
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1795335&r1=1795334&r2=1795335&view=diff
==
--- 
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] Tue May 16 16:03:28 2017
@@ -248,6 +248,8 @@ public abstract class AbstractFeature im
 
 /**
  * Executes the parameterless operation of the given name and returns its 
result.
+ *
+ * @see #getOperationValue(String)
  */
 final Property getOperationResult(final String name) {
 /*
@@ -260,41 +262,6 @@ public abstract class AbstractFeature im
 }
 
 /**
- * Executes the parameterless operation of the given name and returns the 
value of its result.
- */
-final Object getOperationValue(final String name) {
-final Operation operation = (Operation) type.getProperty(name);
-if (operation instanceof LinkOperation) {
-return getPropertyValue(((LinkOperation) operation).referentName);
-}
-final Property result = operation.apply(this, null);
-if (result instanceof Attribute) {
-return getAttributeValue((Attribute) result);
-} else if (result instanceof FeatureAssociation) {
-return getAssociationValue((FeatureAssociation) result);
-} else {
-return null;
-}
-}
-
-/**
- * Executes the parameterless operation of the given name and sets the 
value of its result.
- */
-final void setOperationValue(final String name, final Object value) {
-final Operation operation = (Operation) type.getProperty(name);
-if (operation instanceof LinkOperation) {
-setPropertyValue(((LinkOperation) operation).referentName, value);
-} else {
-final Property result = operation.apply(this, null);
-if (result != null) {
-setPropertyValue(result, value);
-} else {
-throw new 
IllegalStateException(Resources.format(Resources.Keys.CanNotSetPropertyValue_1, 
name));
-}
-}
-}
-
-/**
  * Returns the default value to be returned by {@link 
#getPropertyValue(String)}
  * for the property of the given name.
  *
@@ -387,6 +354,73 @@ public abstract class AbstractFeature im
 public abstract void setPropertyValue(final String name, final Object 
value) throws IllegalArgumentException;
 
 /**
+ * Executes the parameterless operation of the given name and returns the 
value of its result.
+ * This is a convenience method for sub-classes where some properties may 
be operations that
+ * {@linkplain AbstractOperation#getDependencies() depend} on other 
properties of this {@code Feature} instance
+ * (for example a {@linkplain FeatureOperations#link link} to another 
property value).
+ * Invoking this method is equivalent to performing the following steps:
+ *
+ * {@preformat java
+ * Operation operation = (Operation) type.getProperty(name);
+ * Property result = operation.apply(this, null);
+ * if (result instanceof Attribute) {
+ * return ...;  // the 
attribute value.
+ * } else if (result instanceof FeatureAssociation) {
+ * return ...;  // the 
associated feature.
+ * } else {
+ * return null;
+ * }
+ * }
+ *
+ * @param  name  the name of the operation to execute. The caller is 
responsible to ensure that the
+ *   property type for that name is an instance of {@link 
Operation}.
+ * @return the result value of the given operation, or {@code null} if 
none.
+ *
+ * @since 0.8
+ */
+protected Object getOp

svn commit: r1795334 - in /sis/branches/JDK8/core: sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java

2017-05-16 Thread desruisseaux
Author: desruisseaux
Date: Tue May 16 15:58:40 2017
New Revision: 1795334

URL: http://svn.apache.org/viewvc?rev=1795334&view=rev
Log:
Give protected access to AbstractFeature.get|setOperationValue(…) for easier 
usage by subclasses defined outside Apache SIS.

Modified:

sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java

sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataWriterTest.java

Modified: 
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1795334&r1=1795333&r2=1795334&view=diff
==
--- 
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
 [UTF-8] Tue May 16 15:58:40 2017
@@ -248,6 +248,8 @@ public abstract class AbstractFeature im
 
 /**
  * Executes the parameterless operation of the given name and returns its 
result.
+ *
+ * @see #getOperationValue(String)
  */
 final Property getOperationResult(final String name) {
 /*
@@ -260,41 +262,6 @@ public abstract class AbstractFeature im
 }
 
 /**
- * Executes the parameterless operation of the given name and returns the 
value of its result.
- */
-final Object getOperationValue(final String name) {
-final Operation operation = (Operation) type.getProperty(name);
-if (operation instanceof LinkOperation) {
-return getPropertyValue(((LinkOperation) operation).referentName);
-}
-final Property result = operation.apply(this, null);
-if (result instanceof Attribute) {
-return getAttributeValue((Attribute) result);
-} else if (result instanceof FeatureAssociation) {
-return getAssociationValue((FeatureAssociation) result);
-} else {
-return null;
-}
-}
-
-/**
- * Executes the parameterless operation of the given name and sets the 
value of its result.
- */
-final void setOperationValue(final String name, final Object value) {
-final Operation operation = (Operation) type.getProperty(name);
-if (operation instanceof LinkOperation) {
-setPropertyValue(((LinkOperation) operation).referentName, value);
-} else {
-final Property result = operation.apply(this, null);
-if (result != null) {
-setPropertyValue(result, value);
-} else {
-throw new 
IllegalStateException(Resources.format(Resources.Keys.CanNotSetPropertyValue_1, 
name));
-}
-}
-}
-
-/**
  * Returns the default value to be returned by {@link 
#getPropertyValue(String)}
  * for the property of the given name.
  *
@@ -387,6 +354,73 @@ public abstract class AbstractFeature im
 public abstract void setPropertyValue(final String name, final Object 
value) throws IllegalArgumentException;
 
 /**
+ * Executes the parameterless operation of the given name and returns the 
value of its result.
+ * This is a convenience method for sub-classes where some properties may 
be operations that
+ * {@linkplain AbstractOperation#getDependencies() depend} on other 
properties of this {@code Feature} instance
+ * (for example a {@linkplain FeatureOperations#link link} to another 
property value).
+ * Invoking this method is equivalent to performing the following steps:
+ *
+ * {@preformat java
+ * Operation operation = (Operation) type.getProperty(name);
+ * Property result = operation.apply(this, null);
+ * if (result instanceof Attribute) {
+ * return ...;  // the 
attribute value.
+ * } else if (result instanceof FeatureAssociation) {
+ * return ...;  // the 
associated feature.
+ * } else {
+ * return null;
+ * }
+ * }
+ *
+ * @param  name  the name of the operation to execute. The caller is 
responsible to ensure that the
+ *   property type for that name is an instance of {@link 
Operation}.
+ * @return the result value of the given operation, or {@code null} if 
none.
+ *
+ * @since 0.8
+ */
+protected Object getOperationValue(final String name) {
+final Operation operation = (Operation) type.getProperty(name);
+if (operation instanceof LinkOperation) {
+return getPropertyValue(((LinkOperation) operation).referentName);
+}
+final Property result = operation.apply(this, null);
+if (result instanceof Attribute) {
+ 

[jira] [Created] (SIS-359) Support coordinate transformations between CRS having duplicated axis orientations

2017-05-16 Thread Martin Desruisseaux (JIRA)
Martin Desruisseaux created SIS-359:
---

 Summary: Support coordinate transformations between CRS having 
duplicated axis orientations
 Key: SIS-359
 URL: https://issues.apache.org/jira/browse/SIS-359
 Project: Spatial Information Systems
  Issue Type: Improvement
  Components: Referencing
Affects Versions: 0.7, 0.6
Reporter: Martin Desruisseaux
Assignee: Martin Desruisseaux
Priority: Minor


Coordinate systems are usually not allowed to have two axes with the same 
orientation. For example it is considered an error to have two axes oriented 
toward East. But there is at least two exceptions to this rule:

* {{AxisDirection.OTHER}}: there is actually no way to know which direction it 
is, so two {{OTHER}} orientations may be actually different directions.
* {{AxisDirection.FUTURE}}: meteorological data can have two time axes. For 
more information, see [OGC Best Practice for using Web Map Services (WMS) with 
Time-Dependent or Elevation-Dependent 
Data|http://www.opengis.net/doc/bp/wms-tnz/1.0] (OGC 12-111r1).

Currently, attempt to transform two CRS having duplicated axis orientation 
produces an exception like below:

{noformat}
org.opengis.util.FactoryException: Ne peut pas créer l’objet géodétique pour « 
CompoundCRS[“grib-lonlat-crs+Java…”] → CompoundCRS[“grib-lonlat-crs+Java…”] ».
at 
org.apache.sis.referencing.operation.CoordinateOperationFinder.createOperation(CoordinateOperationFinder.java:206)
at 
org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:750)
at org.apache.sis.referencing.CRS.findOperation(CRS.java:610)
... 22 more
Caused by: java.lang.IllegalArgumentException: Les directions d’axes Other 
et Other sont colinéaires.
at 
org.apache.sis.referencing.operation.matrix.Matrices.createTransform(Matrices.java:267)
at 
org.apache.sis.referencing.operation.matrix.Matrices.createTransform(Matrices.java:440)
at 
org.apache.sis.referencing.cs.CoordinateSystems.swapAndScaleAxes(CoordinateSystems.java:280)
at 
org.apache.sis.referencing.operation.CoordinateOperationFinder.createOperation(CoordinateOperationFinder.java:204)
... 26 more
{noformat}

One possible approach may be to remember the indirect association between axes 
and CRS during the computation performed by {{Matrices.createTransform(…)}}. If 
two axes have the same axis direction but we can still distinguish the axes by 
the enclosing CRS instance, then we can avoid throwing the exception.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)