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

How can i get the "my repository workspace" programmatically with plain java API

I am able to find the project area,stream and component with the help of  IWorkspaceManager but not able to find the my repository workspace.

I have to do few operation with the following parameters
ITeamRepository repo,
IWorkspaceHandle workspace,
IComponentHandle component,
String sandboxLocation_CanBeNullIfRunningFromWithinEclipseRTC


In all these parameter i am not able to find IWorkspaceHandle workspace programmatically.

Please provide solution ASAP.

Thanks!!

0 votes



One answer

Permanent link
 You will need to search for your workspace. 
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repository)
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
criteria.setExactName(rtcWorkspace); // or use another criteria
criteria.setKind(IWorkspaceSearchCriteria.WORKSPACES); 
List<IWorkspaceHandle> workspaces = wm.findWorkspaces(criteria, maxSize, minitor);
IWorkspaceConnection connection = wm.getWorkspaceConnection(workspaces.get(0), monitor);

1 vote

Comments

i done in the same way but after getting workspace connection when i am calling new function with the following parameter
(IteamRepository arg0,IWorkSpaceHandle arg1, IComponentHandle arg2,String arg4)

i am getting exception
java.lang.RuntimeException: Uanble to find sandbox for given Workspace/Component
    at com.ibm.team.aspice.traceability.TraceabilityRTCPlainJavaAPI.registerSandboxAndCheckWorkspaceComponent(Unknown Source)
    at com.ibm.team.aspice.traceability.TraceabilityRTCPlainJavaAPI.getAssociations(Unknown Source)
    at com.ibm.team.aspice.traceability.TraceabilityRTCPlainJavaAPI.getAllAssociations(Unknown Source)




 What function are you calling after getting WorkspaceConnection ?

It is not a generic method, it was provided by ibm for my organization.

Now i found a problem behind this, before calling that function i have to load workspace.
I am new with RTC, can you help me to load workspace with the help of plain java api.

Thanks!! 

ISharingManager sharingManager = FileSystemCore.getSharingManager();

File workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
PathLocation pathlocation = new PathLocation(workspaceRoot.getAbsolutePath());
ILocation sandBoxLocation = pathlocation.getCanonicalForm();
ISandbox sandbox = sharingManager.getSandbox(sandBoxLocation, false);
LoadDilemmaHandler p = LoadDilemmaHandler.getDefault(); 
IRelativeLocation  relativeLocation = new RelativeLocation(new String[0]);
ILoadOperation loadOp = IOperationFactory.instance.getLoadOperation(p);
loadOp.requestLoad(sandbox, relativeLoadPath, workspaceConnection, componentHandle, Collection<? extends IVersionableHandle> itemsToLoad);
You can also use loadrule to load your workspace -
loadOp.requestLoad(ISandbox sandbox, IRelativeLocation relativeLoadPath, Collection<ILoadRule> loadRules, monitor)

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

Question asked: May 14 '15, 8:43 a.m.

Question was seen: 3,816 times

Last updated: May 18 '15, 1:50 p.m.

Confirmation Cancel Confirm