-
1. Re: DeploymentInfo/Template MCF
starksm64 Oct 10, 2007 11:33 AM (in response to weston.price)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:// Create the deployment template from a template ManagedConnectionFactoryDeploymentGroup ManagedConnectionFactoryDeploymentGroup group = new ManagedConnectionFactoryDeploymentGroup(); // Issue of what ManagedConnectionFactoryDeploymentMetaData subclass to create... // TODO: type should be input from admin client ManagedConnectionFactoryDeploymentMetaData ds = ...; group.getDeployments().add(ds); // Get the template from the ManagedObject // TODO: name and type should be input from admin client ManagedObject groupMO = AbstractManagedObjectFactory.initManagedObject(group, "DefaultDS", "LocalTx"); // TODO: DeploymentTemplateInfo templateInfo = AbstractTemplateInfoFactory.createInfo(groupMO); // ... admin client updates template properties // Profileservice calls to the template with the updated properties public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values) throws Exception { // Need to apply the detached property values to ManagedPropertys bound to a ManagedObject/metadata instance // Create the ManagedObject as above, but this time the ds type, and name should be in the properties. ManagedConnectionFactoryDeploymentGroup group = ...; ManagedObject dsDeploymentMO = AbstractManagedObjectFactory.initManagedObject(group, ...); // Set the dsDeploymentMO ManagedProperty values for(ManagedProperty prop : values.getProperties().values()) { ManagedProperty moProp = dsDeploymentMO.getProperty(prop.getName()); moProp.setValue(prop.getValue()); } // Create the template file from the ManagedConnectionFactoryDeploymentGroup Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class}; JAXBContext context = JAXBContext.newInstance(classes); Marshaller marshaller = context.createMarshaller(); marshaller.marshal(group, fw); ... }
-
2. Re: DeploymentInfo/Template MCF
weston.price Oct 10, 2007 2:18 PM (in response to weston.price)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. -
3. Re: DeploymentInfo/Template MCF
starksm64 Oct 10, 2007 3:09 PM (in response to weston.price)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. -
4. Re: DeploymentInfo/Template MCF
vickyk Nov 28, 2007 3:24 AM (in response to weston.price)// TODO: name and type should be input from admin client
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 ? -
5. Re: DeploymentInfo/Template MCF
starksm64 Nov 28, 2007 1:39 PM (in response to weston.price)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. -
6. Re: DeploymentInfo/Template MCF
vickyk Dec 4, 2007 5:41 AM (in response to weston.price)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 methodprotected ManagementView getManagementView() throws Exception { if( activeView == null ) { InitialContext ctx = getInitialContext(); ProfileService ps = (ProfileService) ctx.lookup("ProfileService"); activeView = ps.getViewManager(); ProfileKey defaultKey = new ProfileKey("default"); activeView.loadProfile(defaultKey); log.info("Loaded profile: "+defaultKey); // Init the VFS to setup the vfs* protocol handlers VFS.init(); } return activeView; }
From the test report I could make the log4j.xml location , putting the TRACE logging for org.jboss.test did not give the info output
Testsuite: org.jboss.test.profileservice.test.ProfileServiceUnitTestCase
Tests run: 4, Failures: 0, Errors: 1, Time elapsed: 3.164 sec
------------- Standard Error -----------------
Found log4j.xml: file:/home/vicky/workspace/jboss5/testsuite/output/resources/log4j.xml
------------- ---------------- ---------------
Testcase: testProfileKeys took 1.241 sec
Testcase: testDeploymentNames took 0.752 sec
Testcase: testTemplateNames took 0.496 sec
Testcase: testAddDataSource took 0.623 sec
Caused an ERROR
obj parameter must not be null
java.lang.IllegalArgumentException: obj parameter must not be null
at javax.xml.bind.helpers.AbstractMarshallerImpl.checkNotNull(AbstractMarshallerImpl.java:417)
Where to enable log tracing ? -
7. Re: DeploymentInfo/Template MCF
vickyk Dec 4, 2007 11:36 AM (in response to weston.price)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
if( group instanceof ManagedConnectionFactoryDeploymentGroup ) { AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory(); ManagedObject dsDeploymentMO = mof.initManagedObject((Serializable)group,"DataSource", "LocalTx"); for(ManagedProperty moprop : values.getProperties().values()) { ManagedProperty moProp = dsDeploymentMO.getProperty(moprop.getName()); moProp.setValue((Serializable)moprop.getValue()); } }
This above code needs to be refactored , may be this could provide some help to Alexey who would be looking at this now .
PS: This code is yet not working -
8. Re: DeploymentInfo/Template MCF
starksm64 Dec 4, 2007 2:04 PM (in response to weston.price)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.
-
9. Re: DeploymentInfo/Template MCF
vickyk Dec 5, 2007 3:39 AM (in response to weston.price)What does this error mean ?
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 codeManagedObjectImpl mo = new ManagedObjectImpl(attachmentName); //JBAS-4671 log.debug("Going to start in DsDataSourceTemplate"); Object attachment = loadClass(attachmentName); log.debug("Added attachment in loadClass"+attachment); Serializable serAttachment = (java.io.Serializable)attachment; mo.setAttachment(serAttachment); log.debug("Done with attaching ."); //JBAS-4671
2) In the writeTemplate of the DsDataSourceTemplateObject group = mo.getAttachment(); log.debug("Getting the name "+mo.getName()); log.debug("Getting the attachment which is added in the DsDataSourceTemplateInfo "+group); if( group instanceof ManagedConnectionFactoryDeploymentGroup ) { //JBAS-4671 log.debug("------------->"+group); AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory(); ManagedObject dsDeploymentMO = mof.initManagedObject((Serializable)group,"DataSource", "NoTx"); log.debug("------------->"+values.getProperties().values()); try{ for(ManagedProperty moprop : values.getProperties().values()) { ManagedProperty moProp = dsDeploymentMO.getProperty(moprop.getName()); if(moProp!=null) moProp.setValue((Serializable)moprop.getValue()); log.debug("setting ManagedProperty "+moprop.getValue()+ "for "+moprop.getName()); } } catch(Exception exp){ log.debug("Eat up this "+exp); } //JBAS-4671 }
Earlier the group was coming as null as the attachment want not added to ManagedObject in Step 1 .
Any clue what it is complaining about now ? -
10. Re: DeploymentInfo/Template MCF
aloubyansky Dec 5, 2007 8:02 AM (in response to weston.price)It's complaining because the class is missing JAXB annotations and the marshaller can't figure out how the object should be marshaled.
-
11. Re: DeploymentInfo/Template MCF
vickyk Dec 5, 2007 8:26 AM (in response to weston.price)Yes I figured out this and I added javax.xml.bind.annotation.XmlRootElement annotations in ManagedConnectionFactoryDeploymentGroup as
*/ @XmlAccessorType(XmlAccessType.NONE) @ManagementObject @XmlRootElement public class ManagedConnectionFactoryDeploymentGroup implements Serializable
After making the changes I am getting some different errorTestcase: 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)
-
12. Re: DeploymentInfo/Template MCF
alesj Dec 5, 2007 8:31 AM (in response to weston.price)"vickyk" wrote:
After making the changes I am getting some different error
Is there a cause?
Check the server side after client invocation for more details. -
13. Re: DeploymentInfo/Template MCF
aloubyansky Dec 5, 2007 4:01 PM (in response to weston.price)It seems like it's not reproducible on every test run. I mean sometime it fails to deploy and that's it but sometimes it keeps logging the error above.
-
14. Re: DeploymentInfo/Template MCF
aloubyansky Dec 5, 2007 4:31 PM (in response to weston.price)Oh, that was supposed to be posted to a different forum, sorry.