It's all about the answers!

Ask a question

[closed] Extending Jazz Build Engine - How to create a workspace from tag and then load that workspace


William Lacy (3136) | asked Aug 28 '14, 12:42 p.m.
closed Aug 28 '14, 4:19 p.m. by Tim Mok (6.6k38)
I am working on a preBuildParticipant that will, take a builddefinitionid and label, get the asociated snapshot, create a repository worksapce and then load that workspace.

I have managed to get a snapshot as a "IBaselineSet". From here, I am unsure how I will actually create a workspace. I have tried to use the createWorkspaceFromBaselineSet in the IScmService, with no joy.

Code as follows (where getSnapshot is my method):

IBaselineSet snapshot = getSnapshot(buildClient, buildResult,
monitor, repo);
getBuildLog().println("creating workspace manager");
WorkspaceManager workspaceManager = (WorkspaceManager) SCMPlatform.getWorkspaceManager(repo);
getBuildLog().println("creating contributionHandler");
IContributorHandle contributorHandle = (IContributorHandle) IContributor.ITEM_TYPE.createItemHandle(snapshot.getItemId(),null);
getBuildLog().println("creating scm service");
IScmService service = workspaceManager.getServerConfigurationService();
getBuildLog().println("creating baselinesethandle");
IBaselineSetHandle baselineSetHandle = (IBaselineSetHandle) IBaselineSet.ITEM_TYPE.createItemHandle(snapshot.getItemId(),null);
getBuildLog().println("executing create workspace");
WorkspaceRefreshResult result = service.createWorkspaceFromBaselineSet(contributorHandle, snapshot.getName() + "_test!!!!",
                   "test", baselineSetHandle,IRepositoryProgressMonitor.ITEM_FACTORY.createItem(monitor));
//checkoutSnapshot(snapshot);
return BuildStatus.OK;

The question has been closed for the following reason: "Duplicate Question https://jazz.net/forum/questions/162155/extending-jazz-build-engine-how-to-create-a-workspace-from-tag-and-then-load-that-workspace" by tmok Aug 28 '14, 4:19 p.m.