It's all about the answers!

Ask a question

DNG custmization : Is it possible to fetch DNG artifact using java client api ? or Is there any Java client api available to access DNG artifact


Nilesh Patil (1732247) | asked Mar 26 '15, 8:31 a.m.

Hi ,

I am new to DNG. I have requirement where, I have to fetch Artifact and update link info in respective artifact. Is there any java client side api available to achieve same. I have data input in XML according to that need update the artifcat 

Please let me know if there is any other alternate way

3 answers



permanent link
Thomas Noack (5025) | answered Mar 26 '15, 8:04 p.m.
edited Mar 26 '15, 8:08 p.m.
Hello Nilesh,

if you want to use Java, you should have a look at the Eclipse Lyo project which implements the OSLC RM specification (Lyo Tutorial). But, Lyo (more precisely OSLC) does not provide full accessibility concerning DNG (see my question). 

If you only need to get artifacts from the database, update links and write the changes back to the database, Lyo's DNG support could be fine for you.
If you need full accessibility, you should think about using the DNG Javascript API (which provides more and more functions) - check the links in Roberts post.

Best regards
-- Thomas Noack

Comments
Nilesh Patil commented Mar 30 '15, 5:13 a.m.

Hi Thomas,
Thank you for your answer. Could you please provide sample code for connecting DNG artifact and fetching data


permanent link
Thomas Noack (5025) | answered Apr 29 '15, 3:22 p.m.
Hi Nilesh,

sorry for the late answer. I had problems with my Jazz account and wasn't able to use the forum in the last week. 

First of all you have to include the jar packages of Eclipse Lyo into your project. Download OSLC4J 2.1 SDK with Dependencies and include all jars from the 'dist' and 'lib' folder.

Please have a look at the example below. It opens a module and prints the title of all included artifacts. I hope I could help you.

Best regards

-- Thomas

 

#### Minimal example ####

String jtsURL = "https://ToDo:9443";

String userName = "ToDo";

String password = "ToDo";

                  

// Get URL from properties of a module artifact

String moduleURL = "https://ToDo:9443/rm/resources/_Qe73hMy-EeS1FtpXUHbX_A";

                  

JazzRootServicesHelper helper = new JazzRootServicesHelper(jtsURL + "/rm" , OSLCConstants.OSLC_RM_V2 );

JazzFormAuthClient client = helper.initFormClient(userNamepasswordjtsURL + "/jts");

                  

client.formLogin();

                  

ClientResponse response = client.getResource(moduleURL , OslcMediaType.APPLICATION_RDF_XML);             

RequirementCollection requirementCollection = response.getEntity(RequirementCollection.class);

                  

System.out.println("Name of collection: " + requirementCollection.getTitle());

                  

URI[] uriL = requirementCollection.getUses();

for(URI uri : uriL) {

    response = client.getResource(uri.toString() , OslcMediaType.APPLICATION_RDF_XML);

    Requirement r = response.getEntity(Requirement.class);

                       

    System.out.println("Name of artifact: " + r.getTitle());

    response.consumeContent();

} 


permanent link
robert genzinger (1613) | answered Mar 26 '15, 10:39 a.m.
You can use JavaScript Client Extension or OSLC

see an easy example explained in detail
https://haunkofer.wordpress.com/2013/12/13/doors-next-generation-javascript-client-extension/

see the lient extension API documentation
https://jazz.net/wiki/bin/view/Main/RMExtensions405API

Your answer


Register or to post your answer.