Child pages
  • OpenEAI MessageObjectConfig docUri Attribute - docUriBase System Property
Skip to end of metadata
Go to start of metadata

Background

The app config currently load the document from files.  The deployment environment plans to use http.  Since most current docUri use relative fiel path, it would be ideal if we can switch to http-based MessageObjectConfig with little or no change with the appConfig file.  This design with docUriBase system property makes it completely backward-compatible (when resource files have relative paths) and transparent to appConfig (no change needed for appConfig to switch between file-based and http-based documents)

Runtime: appConfig load EOs and sample messages

<MessageObjectConfig xmlDocumentValidation="false" translationType="application" deferInitialization="false" name="HelloHibernateGw.v1_0">
<SenderAppId>edu.emory.HelloHibernateGwService</SenderAppId>
<Authentication>
<UserId>edu.emory.HelloHibernateGwService</UserId>
<Signature>unknown</Signature>
</Authentication>
<CommandName>HelloHibernateGw</CommandName>
<PrimedXmlDocuments>
<PrimedXmlDocument type="create">http://dev-config.app.emory.edu/message/releases/edu/emory/Examples/HelloHibernateGw/1.0/xml/Create-Request.xml</PrimedXmlDocument>
<PrimedXmlDocument type="query">./message/releases/edu/emory/Examples/HelloHibernateGw/1.0/xml/Query-Request.xml</PrimedXmlDocument>
<PrimedXmlDocument type="provide">message/releases/edu/emory/Examples/HelloHibernateGw/1.0/xml/Provide-Reply.xml</PrimedXmlDocument>
</PrimedXmlDocuments>
<ConfigClass>org.openeai.config.MessageObjectConfig</ConfigClass>
<ObjectClass>edu.emory.moa.jmsobjects.examples.v1_0.HelloHibernateGw</ObjectClass>
<EnterpriseObjectDocument ignoreValidation="false" ignoreMissingFields="false" docUri="configs/messaging/Environments/Examples/EnterpriseObjects/3.0/edu/emory/Examples/1.0/HelloHibernateGwEO.xml"/>
<LayoutManager>
<InputLayout type="xml">
<ObjectClass>org.openeai.layouts.XmlLayout</ObjectClass>
</InputLayout>
<OutputLayout type="xml">
<ObjectClass>org.openeai.layouts.XmlLayout</ObjectClass>
</OutputLayout>
</LayoutManager>
</MessageObjectConfig>

 

docUriBase System Property

 

In relationship to the existing docUri attribute inside MessageObjectConfig, docUriBase system property is now added so that existing relative path inside appConfig file can be used to load documents from http document server.

 

For ESB service using OpenEAI Console

For ESB WebService Facade, doUriBase parameter is added to services.xml inside .aar file

 

This may not work for jboss 5.1 as all .aar webservice share the same JVM/classloader.  Therefore, we need to find a common place to add the system property once.

 

For jboss eap, doUriBase system property is added so that all .aar can use this same property.

 

Document Server

File structure on the document server has to be consistent with existing runtime file structure

 

OpenEAI-servicegen configuration

 

Implementation in org.openeai.xml.XmlDocumentReader

           

     * It will load the resource in the following order:

     * <ol>if docUriString is an absolute file such as http://www.emory.edu/YourEO.xml or file://xxx/yyy/YourEO.xml, it will load it.</ol>

     * <ol>if there is a system property docUriBase set, it will prefix the docUriString with the value of docUriBase and load it if it exists.</ol>

     * <ol>load the resource as if docUriString is a relative file path.</ol>

 

 String docUriBase = System.getProperty(DOC_URI_BASE);

            if (docUriString.toLowerCase().indexOf("http") == 0 || docUriString.toLowerCase().indexOf("file") == 0) {

                doc = buildDocFromUrl(docUriString, builder);

                //sometimes undefined  docUriBase can have value of '${docUriBase}'

            } else if (docUriBase != null && docUriBase.trim().length() > 0 && !docUriBase.contains("docUriBase")&&urlExists(docUriBase+docUriString)) {

                doc = buildDocFromUrl(docUriBase + docUriString, builder);

            } else {

                doc = builder.build(new File(docUriString));

            }

  • No labels