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
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
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
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(userName, password, jtsURL + "/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();
}