Taking pojo configuration layer to the next level
starksm64 Oct 22, 2004 1:47 PMOne enhancement I'll looking at adding for 4.0.1 is a simpler mechanism for externalizing java bean configuration without forcing the java bean to implement the evil XmlLoadable interface. The current usecase is the custom server socket factory on the JRMPInvoker. It currently supports propagating the bind address to the RMIServerSocketFactory, but this is a hardcoded behavior of the JRMPInvoker. Now with the need to externalize client auth flag, I need to add more hardcoded configuration, or fix the configuration problem. The simplest solution is to expand the notion of an attribute to allow for a JavaBean type attribute with the bean properties as so:
<mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker" name="jboss:service=invoker,type=jrmp,socketType=SSLSocketFactory,needsClientAuth=true"> <attribute name="RMIObjectPort">0</attribute> <attribute name="RMIClientSocketFactory">org.jboss.security.ssl.RMISSLClientSocketFactory</attribute> <attribute name="RMIServerSocketFactoryBean" javaBean="true" javaBeanClass="org.jboss.security.ssl.RMISSLServerSocketFactory"> <property name="bindAddress" value="${jboss.bind.address}" /> <property name="securityDomain" value="java:/jaas/rmi-ssl" /> <property name="wantsClientAuth" value="true" /> <property name="needsClientAuth" value="false" /> </attribute> </mbean>
More generically we need to start making use of the JBossXB framework to handle this type of issue with more dynamic content models based on namespaces such that one can actually validate the document. Something like:
<jboss-service:mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker" name="jboss:service=invoker,type=jrmp,socketType=SSLSocketFactory,needsClientAuth=true"> <jboss-service:attribute name="RMIObjectPort">0</attribute> <jboss-service:attribute name="RMIClientSocketFactory">org.jboss.security.ssl.RMISSLClientSocketFactory</attribute> <jboss-service:attribute name="RMIServerSocketFactoryBean" javaBean="true" javaBeanClass="org.jboss.security.ssl.RMISSLServerSocketFactory" serialDataType="jbossxb:javaBean"> <jboss-service:property name="bindAddress" value="${jboss.bind.address}" /> <jboss-service:property name="securityDomain" value="java:/jaas/rmi-ssl" /> <jboss-service:property name="wantsClientAuth" value="true" /> <jboss-service:property name="needsClientAuth" value="false" /> </attribute> </jboss-service:mbean>
or for a foreign namespace needing a custom JBossXB mapping
<jboss-service:mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker" name="jboss:service=invoker,type=jrmp,socketType=SSLSocketFactory,needsClientAuth=true"> <jboss-service:attribute name="RMIObjectPort">0</attribute> <jboss-service:attribute name="RMIClientSocketFactory">org.jboss.security.ssl.RMISSLClientSocketFactory</attribute> <jboss-service:attribute name="RMIServerSocketFactoryBean" javaBean="true" javaBeanClass="org.jboss.security.ssl.RMISSLServerSocketFactory" serialDataType="jbossxb:marshaller"> <jbosssx:rmi-socket-factory> <bind-address>${jboss.bind.address}</bind-address> <security-domain>java:/jaas/rmi-ssl</security-domain> <wantsClientAuth flag="true" /> <needsClientAuth flag="false" /> </jbosssx:rmi-socket-factory> </attribute> </jboss-service:mbean>
Other serialDataTypes could be jbossxb:jaxb, jbossxb:xmlbean, etc.