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

Reloading the component from EWM client using API

Hello,

We are working on automating  - Replacing the component baseline in a stream and repository workspace in EWM , when I use replaceComponent EWM API to replace the baseline of the component, the component goes out of sync.
The code:

 workspaceConnection.applyComponentOperations(Collections.singletonList(workspaceConnection.componentOpFactory().replaceComponent(componentHandle, baselineConnection, workspaceHandle, false)), monitor);              

To resolve this error , we are trying to reload this “out of sync component” in our local sandbox, I am using “ILoadOperation.requestreload “ API from EWM

code:

ISharingManager sharingManager = FileSystemCore.getSharingManager();
LoadDilemmaHandler loadDilemmaHandler = LoadDilemmaHandler.getDefault();   
ILoadOperation loadOperation= IOperationFactory.instance.getLoadOperation(loadDilemmaHandler);
String sandboxPathName = sandboxPath;
IPath sandboxPath = new Path(sandboxPathName);
ILocation sandboxLocation = new PathLocation(sandboxPath);
ISandbox sandbox = sharingManager.getSandbox(sandboxLocation, false);
IShare[] iShare = sandbox.allShares(monitor);
Collection<IShare> ishareCol = new ArrayList();
for (int j = 0; j < iShare.length; j++) {     
  ishareCol.add(iShare[j]);
  System.out.println(iShare[j]);  

}

IRepositoryResolver resolver = new IRepositoryResolver() {

 

    @Override
    public ITeamRepository getRepoFor(String uri, UUID id) throws TeamRepositoryException {

         return teamRepository;}    

    };      loadOperation.setEclipseSpecificLoadOptions(com.ibm.team.filesystem.client.operations.ILoadOperation.IMPORT_PROJECTS);
loadOperation.setPreserveLocalChanges(true);
 loadOperation.getSharesOutOfSync();
loadOperation.requestReLoad(ishareCol, resolver,true, monitor);
loadOperation.run(monitor);
sharingManager.deregister(sandbox, monitor);
 workspaceConnection.refresh(monitor);  

But this is throwing me this error:

com.ibm.team.filesystem.client.FileSystemStatusException: Status ERROR: com.ibm.team.filesystem.client code=2 Loading the directories in the file system would overwrite/remove existing directories. 

When we reload components from the EWM client ,we have an option for overwriting the local changes. But from the code side , we are unable to figure out how we resolve the issue.
and also when we reload the "out of sync" component from EWM client, it only reloads that specific component, but from the code side it is trying to reload all the components in that particular workspace.

Can anyone suggest any  solution here?

Regards,
Yukti R Bhat

0 votes

Comments

I think it is unlikely you get an answer. Very few people would know that API.  Repository workspaces are not built to be changed on the server. Repository workspaces assume that code changes get checked in. If you change a loaded repository workspace on the server, they go out of sync. 

If you can't find out how the Eclipse client does it - which might include code that is not part of the API - one way of dealing with it would be to unload and reload the component.   


Accepted answer

Permanent link

 Thank you Ralph....Unloading and Reloading that particular component seems to be the effective solution for resolving this issue

Ralph Schoon selected this answer as the correct answer

0 votes

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,937

Question asked: Mar 19, 2:21 a.m.

Question was seen: 486 times

Last updated: Apr 03, 4:50 a.m.

Confirmation Cancel Confirm