How to Deliver Component using Java API after sharing folders with scm command?
![]() Hi How to Deliver Component using Java API after sharing folders with scm command?
I have to do the following actions: Login i am using -java api Create stream using -java api Create workspace using -java api Create component using -java api Share folders to component using -SCM command How to deliver components to stream using -java API (I need the java code to deliver the components which has be shared with files using scm command ) _______________________________________________ |
One answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Jul 03 '14, 7:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Start here: http://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/
Comments Hi Ralph Schoon, Thank you for the reply I have refered the link before and the deliver for the change sets is not working i.e. for list of components
NOT WORKING example: for(int=0;i<listofcomponents.size();i++) { synchr =workspace.compareTo(streamname, WorkspaceCompFlags.CHANGE_SET_COMPARISON_ONLY,Collections.EMPTY_LIST, monitor);
workspacename.deliver(streamname, synchr, Collections.EMPTY_LIST,synchr.outgoingChangeSets(listofcomponents), monitor); } -----------------NOT WORKING--------------------
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Not working is a too general statement. What does not work?
That code is for delivering change sets. If you're going to add a component to a workspace/stream, you should refer to the section of the blog about adding a component.
I have tried to add a component to stream using
stream. it says Unable to obtain components locks Hi Ralph, Thank you for the reply The code which is not working is the code which i have mentioned as an example All i need is the Java code equivalent of scm deilver -r repoID -u userID -p password -s workspaceName -C componentstobedelivered there is not ONE api.. multiple apis required..
You cannot obtain the locks on the components for some reason. I see in your original post that you want to create the stream, workspace, and components. In your snippet, you're adding the components use the workspace as a source. Have you added the components to the workspace at that point? This may be your problem because it can't get component locks in the workspace when they don't exist in the workspace.
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As Tim points out, I add the components to the stream/workspace using
private IComponentHandle renameOrCreateComponent( ITeamRepository teamRepository, IWorkspaceManager wm, IProjectArea area, IComponentHandle componentHandle, String componentName, IProgressMonitor monitor) throws TeamRepositoryException { if (componentHandle == null) { // Rename component componentHandle = wm.createComponent(componentName, teamRepository.loggedInContributor(), monitor); wm.setComponentOwner(componentHandle, area, monitor); } else { // Rename component wm.renameComponent(componentHandle, componentName, monitor); wm.setComponentOwner(componentHandle, area, monitor); } return componentHandle; } Once the component is part of the workspace, it can be used for checkin and delivery. I think I also add them to both the workspace and the stream. I am not sure if a deliver would add the components to the stream automatically. but that should only create the component in this project area. the Workspace.addComponent() (deprecated), now use ComponentOp, is what is used to add the newly existent component TO the stream/workspace.
showing 5 of 9
show 4 more comments
|
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.