Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Lock/Unlock RRC artifacts using OSLC API

I had a mechanism to programatically lock/unlock artifacts using OSLC for RRC. This worked fine in version 4.0.3 however is not running in the upgraded version 5.0.1 and throwing an exception 400/Bad Request.

The code snippet for locking an artifact is as follows-

https://inmbzp4102.in.dst.ibm.com:9443/rm/locks/"+artifactURI - the locking URI

public String getLockUnlockResource(String uri) {
        HttpGet get = new HttpGet(uri);
        get.setHeader("Accept", "application/xml");
        get.setHeader("OSLC-Core-Version", "2.0");
        get.setHeader("X-Jazz-CSRF-Prevent","0000UfsWrlfdGf4tF6SMIpVjnly:-1");
        String responseXML =  getResourceForLock(get);   

        return responseXML;
    }

public String getResourceForLock(HttpGet get) {
        String resourceXML="";
        System.out.println("\n=== " + get.getRequestLine());
        HttpResponse jfsResponse;

        try {
            jfsResponse = HttpUtils.sendGetForSecureDocument(
                    server, get, login, password, httpclient, JTS_Server);
            getResponseCode = jfsResponse.getStatusLine().getStatusCode();
           
            if(getResponseCode==404)
            {
                jfsResponse.getEntity().consumeContent();
                return "404";
            }
            if(jfsResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                throw new Error("Bad status: " +  jfsResponse.getStatusLine() + " for " + get.getRequestLine());
            }

            HttpEntity responseEntity = jfsResponse.getEntity();
            resourceXML = printEntity(responseEntity);
            jfsResponse.getEntity().consumeContent();
        } catch (Throwable t) {
            // TODO Auto-generated catch block
            t.printStackTrace();
        }

        return resourceXML;
    }

0 votes



One answer

Permanent link
The underlying structure of locks changed quite dramatically after 4.0.3. I'm not sure it was ever supported to be able to programatically lock/unlock artifacts via OSLC or if it would even be possible now given the new internal strucutre used by the locking mechanism.

1 vote

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,939

Question asked: Dec 16 '14, 11:23 p.m.

Question was seen: 3,997 times

Last updated: Dec 17 '14, 12:16 p.m.

Confirmation Cancel Confirm