In working on this, I just want to make sure there is something I am not missing.

Currently what I consider to be a simple mapping from the DeploymentTemplateInfo to the ManagedConnectionFactoryDeploymentGroup (the group of JCA deployments) involves simply reading the available managed properties and mapping them onto the relevant JCA MetaData

What I am wondering is if this is something I should be doing, or are we working towards an automapping of the TemplateInfo to the relevant MetaData based on the annotation model. I am fine with doing this as described above and then refactoring later, but it would seem that this should be a core component that handles this for the deployer/metadata developer.

The ManagedPropertys of the template should already be wired to the ManagedConnectionFactoryDeploymentMetaData instance. The question is how are the ManagedPropertys of the template being created. It should be from the required properties of the ManagedObject for the root ManagedConnectionFactoryDeploymentGroup with a single ManagedConnectionFactoryDeploymentMetaData in its deployments property.

If a template should include more than just required properties, then we should add a tempate=true/false field to the ManagementProperty annotation to identify these. In psuedo code, creating a ds should entail something like:

Ok, thanks it's a bit clearer but I am still hung up on the first two portions in what layer should creating the ManagedConnectionFactoryDeploymentGroup and it's associated ManagedConnectionFactoryDeploymentMetaData reside? From your example, I am assuming that the admin client is passing enough contextual information to make this happen, but I am not quite clear on *where* it should happen.

In other words, by the time applyTemplates is invoked quite a bit has already been done. It's more of a workflow issue that I am not getting at this point. The primary example provided in the few existing test cases simply call applyTemplates which obviously is not going to work directly.

Its needs to be done in applyTemplates. The initial creation to create the template properties is just a way to leverage the existing annotations and AbstractManagedObjectFactory. In reality that ManagedObject and group are unused. The AbstractTemplateInfoFactory.createInfo(...) call could just as easily take the ManagedConnectionFactoryDeploymentGroup.class and scan for the ManagedPropertys that should be part of the template. It gets away from the issue of knowing what ds type and name are at that point.

One thing we have gotten confused about is that the ManagedPropertys are used in two different ways, as detached by value objects used by admin clients (similar to detached ejb3 entities), and as server side objects that are really proxies for properties on the underlying metadata. Step 1 and the DeploymentTemplateInfo represents the client side case, applyTemplates represents the server side case.

What are the admin clients we are targetting here ? If we have a jmx MBean as a admin client apart from the Jboss ON , will that be helpful? I have been looking at the profileservice implementation at trunk but it seems there are no tests cases there , Where are the test cases ?

There is no specific admin client, we just have a managment api which we support, similar to how jmx was the api in the past. The api is the ProfileService/ManagedObject apis. We will map the ManagedObjects onto jmx, but this will how show a portion of the management capability. You won't be able to create datasource deployments this way.

The testcase is the org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.

I am trying to run the org.jboss.test.profileservice.test.ProfileServiceUnitTestCase which seems to be failing right now .I wanted to enable the debug tracing in the above test where to set it . I wanted to see the following log details in this method

Testcase: testProfileKeys took 1.241 secTestcase: testDeploymentNames took 0.752 secTestcase: testTemplateNames took 0.496 secTestcase: testAddDataSource took 0.623 sec Caused an ERRORobj parameter must not be nulljava.lang.IllegalArgumentException: obj parameter must not be null at javax.xml.bind.helpers.AbstractMarshallerImpl.checkNotNull(AbstractMarshallerImpl.java:417)

After spending some more time analyzing the failure of testAddDataSource I could make that the org.jboss.resource.deployers.management.DsDataSourceTemplate.wrtieTemplate(..) is not implemented fully , the code should be something like

Right, the DeploymentTemplateInfo property values are detached from the server side ManagedObject/ManagedPropertys and need to be mapped onto these in order to be able to create a valid xml representation by marshalling the populated ManagedConnectionFactoryDeploymentGroup.

Testcase: testAddDataSource took 4.34 sec
Caused an ERROR
null
javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup" as an element because it is missing an @XmlRootElement annotation]
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:246)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:120)
at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:61)
at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:550)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
Caused by: com.sun.istack.SAXException2: unable to marshal type "org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup" as an element because it is missing an @XmlRootElement annotation
at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:242)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:303)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:488)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:317)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:246)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:120)
at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:61)
at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:550)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at AOPProxy$1.applyTemplate(AOPProxy$1.java)
at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddDataSource(ProfileServiceUnitTestCase.java:404)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at AOPProxy$1.applyTemplate(AOPProxy$1.java)
at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddDataSource(ProfileServiceUnitTestCase.java:404)

I made the following changes 1) In the start() of the org.jboss.resource.deployers.management.DsDataSourceTemplateInfo I added attachment by calling this code

Testcase: testAddDataSource took 3.002 sec
Caused an ERROR
Failed to map property: password to managed properties for deployment
java.lang.IllegalArgumentException: Failed to map property: password to managed properties for deployment
at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:588)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at AOPProxy$1.applyTemplate(AOPProxy$1.java)
at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddDataSource(ProfileServiceUnitTestCase.java:406)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at AOPProxy$1.applyTemplate(AOPProxy$1.java)
at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddDataSource(ProfileServiceUnitTestCase.java:406)