It's all about the answers!

Ask a question

Get IWorkspaceConnection from IVersionable


Francisco Rodriguez (561528) | asked Oct 23 '15, 2:06 p.m.
edited Oct 23 '15, 4:38 p.m.
 Hi,

I'm currently trying to get the stream connection from a file in a change set. I am trying to use the following method I found in this article:

https://www.ibm.com/developerworks/community/blogs/7685ca43-63d4-4946-89fd-58d379a896d1/entry/how_to_read_and_write_a_file_in_the_repository_directly_without_having_to_create_a_workspace?lang=en

public static void applyLock(ITeamRepository repo,
IWorkspaceConnection streamConnection,
IComponentHandle componentHandle, IFileItem fileItem,
IProgressMonitor monitor) throws TeamRepositoryException {
 
IWorkspaceManager wsManager = (IWorkspaceManager) repo
.getClientLibrary(IWorkspaceManager.class);
IVersionableLockOperationFactory lockFactory = wsManager
.lockOperationFactory();
ArrayList<IVersionableLockOperation> lockOperations = new ArrayList<IVersionableLockOperation>();
lockOperations.add(lockFactory.acquire(fileItem, streamConnection,
componentHandle));
wsManager.applyLockOperations(lockOperations, monitor);
}//applyLock

I have the componentHandle and the fileItem but I cannot figure out how to get the streamConnection. Do you have any idea?


Regards,
Francisco R.

Comments
sam detweiler commented Oct 23 '15, 2:22 p.m.

I don't see  away to go back up the tree of objects to the stream.


Francisco Rodriguez commented Oct 23 '15, 4:37 p.m.

 Thanks for your quick reply, Sam. I edited the question so you can understand what I am trying to do. Do you have any suggestion?


sam detweiler commented Oct 23 '15, 5:03 p.m.

still don't see a way back up the tree.. sorry

Be the first one to answer this question!


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.