Sample code to import TQL into UCMDB, from xml (1209 Views)
Reply
Occasional Visitor
Koert
Posts: 3
Registered: ‎11-08-2010
Message 1 of 7 (1,247 Views)

Sample code to export a TQL to XML

Hopefully somebody can help me here.

I am looking for a simple jython script (or does it have to be Java?) to export a TQL to disk from uCMDB 9.01

 

Background is a 8.03 environment that is upgraded to 9.01 with a custom discovery adapter. The adapter cannot be transferred to 9.01. It is a very simple connector however, so rebuilding it should be no problem imho. But I lack the experience/knowledge at this time.

 

I can create a schedule to mail the report, but I need the file on disk. As far as I know from what I found, this means I will have to use a custom discovery adapter?

 

Could somebody show me a sample script to include in this custom adapter please?

If I have a working example I am pretty sure I can rebuild the old adapter.

 

Thank you in advance for your time.

 

Honored Contributor
Amit Erental
Posts: 1,128
Registered: ‎07-05-2009
Message 2 of 7 (1,247 Views)

Re: Sample code to export a TQL to XML

Hi Koret

 

Are you reffering to TQL result ? you can use one of the UCMDB APIs to exectute TQL and get the results (WebService or Java API). full info and example are here : http://support.openview.hp.com/selfsolve/document/KM939200/binary/UCMDB9.01_Admin.pdf?searchIdentifi...

 

 

 

 

Occasional Visitor
Koert
Posts: 3
Registered: ‎11-08-2010
Message 3 of 7 (1,247 Views)

Re: Sample code to export a TQL to XML

Hi Amit,

 

Thank you for your answer.

Yes, I want to export the results of a TQL to a XML file.

I have already downloaded the developer reference guide, found the pages of example/demo code and am trying to work my way through it. My experience with Java / Jython is rather limited at this time however, so I guess that's what's stopping me.

(I have experience with vb, powershell, and rusty C, and now working to understand Java because of this)

 

I think I need to address the web service API, and use the executeTopologyQueryByName function.

This calls the TQL I made and returns a topologyMap as a result.

 

I found the demo code and want to include the demo and querydemo classes into the package.

From here it gets fuzzy for me.

 

I suppose I can then include the demo classes into the jython script so I can call the functions.

Once I manage to trigger the TQL, how do I write the TopologyMap to XML?

 

I supposed it would be an open&close case for seasoned developers? But if I am hopelessly underestimating the complexity please feel free to point it out too...

 

Honored Contributor
Amit Erental
Posts: 1,128
Registered: ‎07-05-2009
Message 4 of 7 (1,247 Views)

Re: Sample code to export a TQL to XML

Hi,

 

Welcome to Java, its a great language to work with


I think the UCMDB Java API is better, you do not want to handle the SOAP for the Web Serive


You can use executeNamedQuery method of TopologyQueryService to invoke named query


you have the whole SDK docs in the installation 


For the Java to XML: once you have the TopologyCI collection (see Topology Query Example), you can to write the results to any file you like, using any Java code you like. for XML , you have several methods, start with this web site from more info : http://articles.techrepublic.com.com/5100-10878_11-1044810.html

 

Hope this helps,

 

Amit

 



 

Regular Advisor
Christian Doll
Posts: 161
Registered: ‎07-10-2006
Message 5 of 7 (1,247 Views)

Re: Sample code to export a TQL to XML

Hi,

 

do you really need it in XML? If not you can also use the jboss console to retrieve the results or definition of a tql.

 

On version 8 it should be service=CMDB Tql Services

 

regards

Chris

Occasional Visitor
Koert
Posts: 3
Registered: ‎11-08-2010
Message 6 of 7 (1,247 Views)

Re: Sample code to export a TQL to XML

Thanks to everybody for your time and help, but I fear the challenge is a bit too hard for me, so I advised to hire a consultant to build this connector. I seem to have thoroughly underestimated the complexity to build this adapter,

I just can't seem to get a good handle on the problem, and have wasted enough time trying to figure it out.

 

So, thanks for all the help, but I fear it time to throw in the towel and let the expert step in.

 

Occasional Advisor
RohitVerma
Posts: 16
Registered: ‎10-20-2011
Message 7 of 7 (1,209 Views)

Sample code to import TQL into UCMDB, from xml

hi friends.

 

i want to import the TQL into UCMDB, which was exported as XML.

using the JAVA api or Webservice.

 

PLZ HELP....

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.