[jboss-dev-forums] [Design of POJO Server] - Re: java.beans.XMLEncoder Useless?

scott.stark@jboss.org do-not-reply at jboss.com
Sun Oct 12 20:17:39 EDT 2008


Since we should be using jaxb for metadata that is annotated with it, and I see that you can use jaxb even when its not annotated, I'm looking at that instead. For metadata like the datasource which does have jaxb annotations:


  |    public void testJaxbMCFXml()
  |       throws Exception
  |    {
  |       ManagedConnectionFactoryDeploymentGroup mcfs = initMCFDG();
  |    
  |       JAXBContext ctx = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
  |       Marshaller marshaller = ctx.createMarshaller();
  |       marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
  |       QName mcfsName = new QName("datasources");
  |       JAXBElement<ManagedConnectionFactoryDeploymentGroup> root = new
  |          JAXBElement<ManagedConnectionFactoryDeploymentGroup>(mcfsName,
  |                ManagedConnectionFactoryDeploymentGroup.class, mcfs);
  |       marshaller.marshal(root, System.out);
  |    }
  | 

with initMCFDG() populating the mcfs similar to that shown above, jaxb output produces:

  | <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <datasources>
  |     <local-tx-datasource>
  |         <rar-name>jboss-local-jdbc.rar</rar-name>
  |         <use-java-context>true</use-java-context>
  |         <connection-definition>conn def</connection-definition>
  |         <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
  |         <min-pool-size>1</min-pool-size>
  |         <max-pool-size>100</max-pool-size>
  |         <blocking-timeout-millis>5000</blocking-timeout-millis>
  |         <idle-timeout-minutes>15</idle-timeout-minutes>
  |         <prefill>true</prefill>
  |         <background-validation>true</background-validation>
  |         <background-validation-millis>5000</background-validation-millis>
  |         <validate-on-match>true</validate-on-match>
  |         <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
  |         <isSameRM-override-value>false</isSameRM-override-value>
  |         <depends>jboss:service=Naming</depends>
  |         <depends>jboss:service=Hypersonic,database=localDB</depends>
  |         <metadata>
  |             <type-mapping>Hypersonic SQL</type-mapping>
  |         </metadata>
  |         <local-transaction/>
  |         <user-name>user</user-name>
  |         <password>password</password>
  |         <new-connection-sql>run this on a new conn</new-connection-sql>
  |         <check-valid-connection-sql>select something from somewhere</check-valid-connection-sql>
  |         <exception-sorter-class-name>org.jboss.jdbc.SomeExceptionSorter</exception-sorter-class-name>
  |         <prepared-statement-cache-size>50</prepared-statement-cache-size>
  |         <share-prepared-statements>false</share-prepared-statements>
  |         <set-tx-query-timeout>false</set-tx-query-timeout>
  |         <query-timeout>30000</query-timeout>
  |         <use-try-lock>0</use-try-lock>
  |         <driver-class>org.jboss.jdbc.SomeDriver</driver-class>
  |         <connection-url>jdbc:xyz:a=b</connection-url>
  |         <connection-property name="cp1-name">cp1-value</connection-property>
  |         <connection-property name="cp2-name">cp2-value</connection-property>
  |     </local-tx-datasource>
  | </datasources>
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181724#4181724

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181724



More information about the jboss-dev-forums mailing list