Would a AdminObjectObjectModelFactory suffice or does it need to be abstracted out so that both *-ds.xml and jboss.xml could do it?
I'm currently writing and using JCA 1.5 connectors to decouple a set of quite large J2EE apps in order to reduce the number of compile time dependencies. The nice thing about JCA is that you can code the connector in a typed way and yet have no type dependencies on the connector implementation for the client using the connector if the client uses the CCI interface.
The only dependency that remains is the instanciation of InteractionSpec Implementations within the client code. This can be overcome, if InteractionSpec implementations are bound into the JNDI space as administered objects and looked up by the client code.
Therefore I was searching for a way to instantiate administered objects within Jboss. After a while I found this posting and was glad to see that this functionality has been added recently.
HOWEVER, the current implementation seems to be limited to admin objects specified by J2EE1.4 message driven beans.
The JCA Spec. 1.5 says that InteractionSpec objects are also to be considered administered objects:
22.214.171.124 Administered Object
An InteractionSpec instance may be, though it is not required to be, registered as
an administered object in the JNDI namespace. This enables a component provider
to access InteractionSpec instances using logical names, called resource
environment references. Resource environment references are special entries in the
component?s environment. The deployer binds a resource environment reference to
an InteractionSpec administered object in the operational environment.
I looked into the Jboss code and saw that AdminObjects are looked up by their interface and instanciated with the help of AdminObjectMetaData descriptions.
I thought about extending this code to deal with InteractionSpecs also, but decided not to because there'd be several ways to do this.
At first, I thought to just incorporate InteractionSpec implementations within the list of administered objects of the ConnectorMetaData structure. However, this doesn't seem to be a good solution because this mixes up InteractionSpec AdminObjects with those registered with Message Driven Beans. What's more, the current AdminObjectMetaData definitions are looked up by their Interface name which obviously doesn't work with InteractionSpec Implementations as they all implement the same interface and there can be several implementations of this interface within one ResourceAdapter a.s.o.
Adrian: I must say, that I liked your first posting in which you said that the possibility to instanciate and bind JavaBeans classes could be added to the jboss descriptor.
I would like such a generalised approach much better than the current one. Admin Objects can be anything and need not be tied to specific resource adapters necessarily. My clear preference would be to have an additional section within a jboss.xml descriptor for admin objects.
The interface type AND the implementation class need to be specified, so that the whole thing works with InteractionSpec implementations as well.
I'm willing to provide implementations for this, but it would be the first time for me to contribute to JBoss and I think that I shouldn't dare to make design decisions myself but at most take over the implementation effort.
I desperately need JBoss to be able to do the above and would be glad if someone answered to this posting. I apologize for posting into the developers forum if inappropriate, but as I regard the matter of this posting to be rather a feature request than a user question I thought that this is the right place.
<?xml version="1.0" encoding="UTF-8"?> <server> <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.test:name=TestInterface"> <attribute name="JNDIName">test/jca/TestInterface</attribute> <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='testadminobject.rar'</depends> <attribute name="Type">org.jboss.test.jca.adminobject.TestInterface</attribute> <attribute name="Properties"> StringProperty=StringValue IntegerProperty=123 </attribute> </mbean> <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.test:name=TestInterface2"> <attribute name="JNDIName">test/jca/TestInterface2</attribute> <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='testadminobject.rar'</depends> <attribute name="Type">org.jboss.test.jca.adminobject.TestInterface2</attribute> <attribute name="Properties"> stringProperty=456 </attribute> </mbean> </server>
<?xml version="1.0" encoding="UTF-8"?> <connector xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" version="1.5"> <description>Test Resource Adapter for new jca 1.5 features</description> <display-name>Admin Object Test Resource Adapter</display-name> <vendor-name>JBoss, Inc</vendor-name> <eis-type>JBoss Testsuite</eis-type> <resourceadapter-version>4.0</resourceadapter-version> <license> <description> COPYRIGHT AND PERMISSION NOTICE Copyright (c) 2004 JBoss, Inc This is released under the terms of the LGPL. See gnu.org for details. </description> <license-required>true</license-required> </license> <resourceadapter> <resourceadapter-class>org.jboss.test.jca.adminobject.TestResourceAdapter</resourceadapter-class> <adminobject> <adminobject-interface>org.jboss.test.jca.adminobject.TestInterface</adminobject-interface> <adminobject-class>org.jboss.test.jca.adminobject.TestImplementation</adminobject-class> <config-property> <config-property-name>StringProperty</config-property-name> <config-property-type>java.lang.String</config-property-type> </config-property> <config-property> <config-property-name>IntegerProperty</config-property-name> <config-property-type>java.lang.Integer</config-property-type> </config-property> </adminobject> <adminobject> <adminobject-interface>org.jboss.test.jca.adminobject.TestInterface2</adminobject-interface> <adminobject-class>org.jboss.test.jca.adminobject.TestImplementation2</adminobject-class> <config-property> <config-property-name>stringProperty</config-property-name> <config-property-type>java.lang.Integer</config-property-type> </config-property> </adminobject> </resourceadapter> </connector>
Wow, that was fast! Thanks a LOT. This worked for me.
I misread the connector_1_5.xsd schema and assumed adminobject to be a subelement of inbound-resource-adapter. This was reinforced by the annotation for the adminobjectType which starts off like this:
The adminobjectType specifies information about an administered object. Administered objects are specific to a messaging style or message provider.
This is why I abandoned the idea of using the adminobject element to declare my InteractionSpec implementations.
But it works! Again: many thanks, this helped me a lot.
A post about adding admin objects to other deployments
has been HIJACKED into "I can't read the spec/docs/examples" on plain
Scott, please don't encourage people HIJACKING threads.
The irrelevent posts should be deleted rather than answered, especially
when people are posting in the dev forums rather than the user forums.
you are very funny.
Next time I need a person without error to throw stones at others who are not I'll notify you so that you can take over...
I searched the internet and all Jboss docs I could get hold of (the company I'm working for has liscenced JBoss documentation ...) and the only pointer towards AdminObjects I could find was this ONE posting within the developers forum and the Wiki page it referenced.
I may claim your title of "chief/senior scientist/architect" for myself as well. Whenever you see me post a feature request you may assume it to be profound. Whenever you see me post a question you may assume that many other users are having the same problem. Taking my feedback seriously is a chance to improve the JBoss codebase and user documentation.