It's all about the answers!

Ask a question

Reloading the component from EWM client using API

Yukti Bhat (261) | asked Mar 19, 2:21 a.m.


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


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++) {     


IRepositoryResolver resolver = new IRepositoryResolver() {


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

         return teamRepository;}    

    };      loadOperation.setEclipseSpecificLoadOptions(;
loadOperation.requestReLoad(ishareCol, resolver,true, monitor);;
sharingManager.deregister(sandbox, monitor);

But this is throwing me this error: Status ERROR: 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?

Yukti R Bhat

Ralph Schoon commented Mar 20, 3:32 a.m. | edited Mar 20, 3:32 a.m.

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
Yukti Bhat (261) | answered Apr 03, 4:44 a.m.

 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

Your answer

Register or 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.