JBREM-63, configuration pojofication
starksm64 Apr 17, 2007 11:27 AM"ron.sigal@jboss.com" wrote:
My interpretation is that I should just get rid of the code in Connector that parses the "config" element. It looks like JBossXB can unmarshal all of the constructs in the Connector mbean, so, with the right XML schema, we can leave the mbean in its current form. Is that your intention?
Also, there are a couple of problems with ripping the parsing code out of Connector.
1. The Remoting documentation suggests the use of the Connector.setConfiguration() method. E.g.,
// Set xml configuration element.
StringBuffer buf = new StringBuffer();
buf.append("<?xml version=\"1.0\"?>\n");
buf.append("<config>");
buf.append(" <invoker transport=\"socket\">");
buf.append(" <attribute name=\"serverBindAddress\">test.somedomain.com</attribute>");
buf.append(" <attribute name=\"serverBindPort\">8084</attribute>");
buf.append(" <attribute name=\"clientLeasePeriod\">10000</attribute>");
buf.append(" </invoker>");
buf.append(" <handlers>");
buf.append(" <handler subsystem=\"mock\">");
buf.append(" org.jboss.remoting.transport.mock.SampleInvocationHandler");
buf.append(" </handler>");
buf.append(" </handlers>");
buf.append("</config>");
ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
connector.setConfiguration(xml.getDocumentElement());
This comes from a time before Connector accepted configuration maps, and it's no longer necessary, but there could be working code out there that expects the setConfiguration() method.
In my discussion with Tom the Connector object itself seemed superfluous as its just aggregating configuration and parsing. The first step is to ensure that every externalizable behavior has a pojo metadata object. Once that exists, the connector for a given transport should just be configured by specifying its bean descriptor along with its dependencies/properties. The Connector can be kept around for legacy uses, but it should be stripped down to just performing the legacy parsing to produce the new pojo metadata. In general this won't keep up the evolution of the pojos, so it should be deprecated.
"ron.sigal@jboss.com" wrote:
2. A number of Remoting unit tests (particularly older ones) use the setConfiguration() method.
What do you think of replacing the current do-it-yourself setConfiguration() method with one that calls JBossXB?
In general use of jbossxb is an improvement, so its a question of porting the testcase descriptors vs producing the pojo metadata using jbossxb parsing. Both should be done. If you look at the mc tests, there is typically a pure programmatic version that only uses the java spis without any descriptors, and a subclass version that produces the same metadata by parsing an external descriptor.