[ 
https://issues.apache.org/jira/browse/UIMA-3776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13979956#comment-13979956
 ] 

Richard Eckart de Castilho commented on UIMA-3776:
--------------------------------------------------

MetaDataObject_impl.getAttributes() does not automatically detect the attribute 
"delegateAnalysisEngineSpecifiers" because it has no setter. 
AnalysisEngineDescription_impl.getAdditionalAttributes() does not return 
"delegateAnalysisEngineSpecifiers", only 
"delegateAnalysisEngineSpecifiersWithImports".
However, AnalysisEngineDescription_impl.writePropertyAsElement(PropertyXmlInfo, 
String, ContentHandler) has the following logic:

{noformat}
String propName = PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS;
      if (mDelegateAnalysisEngineSpecifiers.isEmpty()) {
        propName = PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS_WITH_IMPORTS;
      }
      writeMapPropertyToXml(propName, ELEM_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS, 
"key",
              "delegateAnalysisEngine", aPropInfo.omitIfNull, aNamespace, 
aContentHandler);
{noformat}

Note that writeMapPropertyToXml uses MetaDataObject_impl.getAttributes() 
internally. Thus, after resolving imports and thus causing 
mDelegateAnalysisEngineSpecifiers not to be empty anymore, the delegates are no 
longer serialized because writeMapPropertyToXml has no access to 
"delegateAnalysisEngineSpecifiers".

It should be save to e add a read-only attribute for 
delegateAnalysisEngineSpecifiers to AnalysisEngineDescription_impl using 
getDelegateAnalysisEngineSpecifiers() as a getter method. 

> Delegate AEs no longer serialized to XML after resolving imports on aggregate
> -----------------------------------------------------------------------------
>
>                 Key: UIMA-3776
>                 URL: https://issues.apache.org/jira/browse/UIMA-3776
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>            Reporter: Richard Eckart de Castilho
>             Fix For: 2.6.0SDK
>
>
> This is a regression in the UIMA SDK 2.6.0 RC 1 and worked in UIMA SDK 2.5.0.
> * Add a full delegate description to an AAE.
> * Serialize to XML: delegate description is serialized.
> * Call resolveImports()
> * Serialize to XML: delegate description is no longer serialized.
> {noformat}
>   public void testNoDelegatesToResolve() throws Exception {
>     ResourceSpecifierFactory f = UIMAFramework.getResourceSpecifierFactory();
>     AnalysisEngineDescription outer = f.createAnalysisEngineDescription();
>     AnalysisEngineDescription inner = f.createAnalysisEngineDescription();
>     outer.getDelegateAnalysisEngineSpecifiersWithImports().put("inner", 
> inner);
>     StringWriter outerXml = new StringWriter();
>     outer.toXML(outerXml);
>     
>     // Resolving the imports removes the inner AE description
>     outer.resolveImports(UIMAFramework.newDefaultResourceManager());
>     
>     StringWriter outerXml2 = new StringWriter();
>     outer.toXML(outerXml2);
>     Assert.assertEquals(outerXml.toString(), outerXml2.toString());
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to