You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2020/01/13 13:41:00 UTC

[uima-uimaj] branch feature/UIMA-5936-PearSpecifier-should-be-able-to-store-every-parametertype-that-analysisEngines-support updated: [UIMA-5936] PearSpecifier should be able to store every parametertype that analysisEngines support

This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch feature/UIMA-5936-PearSpecifier-should-be-able-to-store-every-parametertype-that-analysisEngines-support
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git


The following commit(s) were added to refs/heads/feature/UIMA-5936-PearSpecifier-should-be-able-to-store-every-parametertype-that-analysisEngines-support by this push:
     new 1b0e3f9  [UIMA-5936] PearSpecifier should be able to store every parametertype that analysisEngines support
1b0e3f9 is described below

commit 1b0e3f9635aff7f5492ed3cd0ac5dc4ab8e74d41
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Mon Jan 13 14:40:50 2020 +0100

    [UIMA-5936] PearSpecifier should be able to store every parametertype that analysisEngines support
    
    - Changed order of elements in PEAR specifier such that pearParameters should be defined before the legacy parameters - this makes IMHO more sense in the documentation
    - Fixed unit tests
---
 uima-docbook-references/src/docbook/ref.pear.xml   | 25 ++++++++++++++++++----
 .../src/docbook/ref.xml.component_descriptor.xml   |  2 +-
 .../uima/resource/impl/PearSpecifier_impl.java     |  2 +-
 .../src/main/resources/resourceSpecifierSchema.xsd | 14 ++++++------
 .../apache/uima/util/impl/XMLParser_implTest.java  |  2 +-
 .../resources/XmlParserTest/TestPearSpecifier.xml  | 16 +++++++-------
 6 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/uima-docbook-references/src/docbook/ref.pear.xml b/uima-docbook-references/src/docbook/ref.pear.xml
index 1130932..47fb02d 100644
--- a/uima-docbook-references/src/docbook/ref.pear.xml
+++ b/uima-docbook-references/src/docbook/ref.pear.xml
@@ -966,8 +966,14 @@ try {
     <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <pearSpecifier xmlns="http://uima.apache.org/resourceSpecifier">
    <pearPath>/home/user/uimaApp/installedPears/testpear</pearPath>
-   <parameters>   <!-- optional -->
-      <parameter> <!-- any number, repeated -->
+   <pearParameters>     <!-- optional -->
+      <nameValuePair>   <!-- any number, repeated -->
+         <name>param1</name>
+         <value><string>stringVal1</string></value>
+      </nameValuePair>
+   </pearParameters>
+   <parameters>         <!-- optional legacy string-valued parameters -->
+      <parameter>       <!-- any number, repeated -->
         <name>name-of-the-parameter</name>
         <value>string-value</value>
       </parameter>
@@ -989,10 +995,21 @@ try {
       </para>
     </note>
     
-    <para>The optional <literal>parameters</literal> section, if used, specifies parameter values,
-      which are used to customize / override parameter values in the PEAR descriptor. 
+    <para>The optional <literal>pearParameters</literal> section, if used, specifies parameter values,
+      which are used to customize / override parameter values in the PEAR descriptor. The format
+      for parameter values used here is the same as in component parameters (see 
+      <olink targetdoc="&uima_docs_ref;" targetptr="ugr.ref.aes.configuration_parameter_settings"/>).
       External Settings overrides continue to work for PEAR descriptors, and have precedence, if specified.
     </para>
+
+    <para>Additionally, there can be a <literal>parameters</literal> section. This section supports
+    only string-valued parameters. Up to Apache UIMA version 2.10.4, this was the only way of
+    providing PEAR parameters. Starting with Apache UIMA version 2.10.4, this way of specifying
+    parameters is deprecated and should no longer be used. Support for will eventually be removed
+    in a future version of Apache UIMA. Parameters set in the <literal>pearParameters</literal> have
+    precedence over parameters defined in <literal>parameters</literal> section. For the time being,
+    both sections can be present simultaneously in a PEAR specifier.
+    </para>
           
   </section>
   
diff --git a/uima-docbook-references/src/docbook/ref.xml.component_descriptor.xml b/uima-docbook-references/src/docbook/ref.xml.component_descriptor.xml
index 36252d3..bb3cd9d 100644
--- a/uima-docbook-references/src/docbook/ref.xml.component_descriptor.xml
+++ b/uima-docbook-references/src/docbook/ref.xml.component_descriptor.xml
@@ -1743,7 +1743,7 @@ uima.tcas.Annotation.</programlisting>
           </section>
         </section>
         
-        <section id="&tp;aes.configuration_parameter_settings">
+        <section id="ugr.ref.aes.configuration_parameter_settings">
           <title>Configuration Parameter Settings</title>
           
           <para>For configuration parameters that are not part of any group, the
diff --git a/uimaj-core/src/main/java/org/apache/uima/resource/impl/PearSpecifier_impl.java b/uimaj-core/src/main/java/org/apache/uima/resource/impl/PearSpecifier_impl.java
index 5936cc3..e0116b4 100644
--- a/uimaj-core/src/main/java/org/apache/uima/resource/impl/PearSpecifier_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/resource/impl/PearSpecifier_impl.java
@@ -77,5 +77,5 @@ public class PearSpecifier_impl extends MetaDataObject_impl implements PearSpeci
   }
 
   static final private XmlizationInfo XMLIZATION_INFO = new XmlizationInfo("pearSpecifier", new PropertyXmlInfo[] {
-      new PropertyXmlInfo("pearPath"), new PropertyXmlInfo("parameters"), new PropertyXmlInfo("pearParameters") });
+      new PropertyXmlInfo("pearPath"), new PropertyXmlInfo("pearParameters"), new PropertyXmlInfo("parameters") });
 }
diff --git a/uimaj-core/src/main/resources/resourceSpecifierSchema.xsd b/uimaj-core/src/main/resources/resourceSpecifierSchema.xsd
index fc701e2..828f888 100644
--- a/uimaj-core/src/main/resources/resourceSpecifierSchema.xsd
+++ b/uimaj-core/src/main/resources/resourceSpecifierSchema.xsd
@@ -675,6 +675,13 @@
     <complexType>
       <sequence>
         <element name="pearPath" type="string"/>
+        <element name="pearParameters" minOccurs="0">
+          <complexType>
+            <sequence>
+              <element name="nameValuePair" type="rs:NameValuePairType" minOccurs="0" maxOccurs="unbounded" />
+            </sequence>
+          </complexType>
+        </element>
         <element name="parameters" minOccurs="0">
           <complexType>
             <sequence>
@@ -687,13 +694,6 @@
             </sequence>
           </complexType>
         </element>
-        <element name="pearParameters" minOccurs="0">
-          <complexType>
-            <sequence>
-              <element name="nameValuePair" type="rs:NameValuePairType" minOccurs="0" maxOccurs="unbounded" />
-            </sequence>
-          </complexType>
-        </element>
       </sequence>
     </complexType>
   </element>  
diff --git a/uimaj-core/src/test/java/org/apache/uima/util/impl/XMLParser_implTest.java b/uimaj-core/src/test/java/org/apache/uima/util/impl/XMLParser_implTest.java
index 0ec53ae..4d25d98 100644
--- a/uimaj-core/src/test/java/org/apache/uima/util/impl/XMLParser_implTest.java
+++ b/uimaj-core/src/test/java/org/apache/uima/util/impl/XMLParser_implTest.java
@@ -192,7 +192,7 @@ public class XMLParser_implTest extends TestCase {
     
     assertThat(pearSpec.getParameters())
         .extracting(Parameter::getName, Parameter::getValue)
-        .containsExactly(tuple("param1", "val1"), tuple("param2", "val2"));
+        .containsExactly(tuple("legacyParam1", "legacyVal1"), tuple("legacyParam2", "legacyVal2"));
 
     assertThat(pearSpec.getPearParameters())
         .extracting(NameValuePair::getName, NameValuePair::getValue)
diff --git a/uimaj-core/src/test/resources/XmlParserTest/TestPearSpecifier.xml b/uimaj-core/src/test/resources/XmlParserTest/TestPearSpecifier.xml
index 09fa76e..f3d3d27 100644
--- a/uimaj-core/src/test/resources/XmlParserTest/TestPearSpecifier.xml
+++ b/uimaj-core/src/test/resources/XmlParserTest/TestPearSpecifier.xml
@@ -18,18 +18,18 @@
  -->
 <pearSpecifier xmlns="http://uima.apache.org/resourceSpecifier">
    <pearPath>/home/user/uimaApp/installedPears/testpear</pearPath>
-   <parameters>
-     <parameter name="legacyParam1" value="legacyVal1"/>
-     <parameter name="legacyParam2" value="legacyVal2"/>
-   </parameters>
    <pearParameters>
      <nameValuePair>
-     	<name>param1</name>
-     	<value><string>stringVal1</string></value>
+      <name>param1</name>
+      <value><string>stringVal1</string></value>
      </nameValuePair>
      <nameValuePair>
-     	<name>param2</name>
-     	<value><string>stringVal2</string></value>
+      <name>param2</name>
+      <value><string>stringVal2</string></value>
      </nameValuePair>
    </pearParameters>
+   <parameters>
+     <parameter name="legacyParam1" value="legacyVal1"/>
+     <parameter name="legacyParam2" value="legacyVal2"/>
+   </parameters>
 </pearSpecifier>
\ No newline at end of file