Load a repository workspace using Plain API
Hi,
how can I load a repository workspace into a local directory using Plain API? I could use scm CLI but I'd like to perform more action and so I don't like too much to launch external command from java. What is the Class/Methods I can use? Thanks, Michele |
5 answers
Thanks,
I'll take a look on it. Best regards, Michele. There's a fair bit of work involved in getting ILoadOperation configured properly to handle conflicts, load rules, etc. |
It was my fault. I did not understand that I must provide a list of element to load and not only if I want a subset.
Thanks, Michele. |
You're looking at a bunch of classes and methods. The primary classes involved in manually downloading a repository workspace are IWorkspace, IComponent, IVersionable, IVersionableHandle (and its descendents IFolderHandle and IFileItemHandle), IFileSystemManager, FileSystemServiceProxy, LoadTree (which is internal, but required for any performance-sensitive loading), and possibly a few others.
The process description is relatively simple: for each component in a workspace, get the file tree for that component, then for each file in the tree get its stream and save the contents to the local disk. Implementing that will probably be more involved. What that will not get you is the .jazz5 folder with all the metadata, and as far as I can tell it is not a standards-based file with a publicly supported format. If you want instead to use an existing RTC operation class to run it you'll get the metadata but it'll operate pretty much like the SCM command. That is, unless there are hooks that I'm unaware of. |
Thank you for the anwser.
I was looking to something which performs like SCM so I think I'll going to use operations. I tryed with ILoadOperation but I still have a problem: it does not appear to run. This is my code: ILoadOperation loadOperation = IOperationFactory.instance.getLoadOperation(LoadDilemmaHandler.getDefault()); When I run it nothing happends Do you know if I'm using something wrong? You're looking at a bunch of classes and methods. The primary classes involved in manually downloading a repository workspace are IWorkspace, IComponent, IVersionable, IVersionableHandle (and its descendents IFolderHandle and IFileItemHandle), IFileSystemManager, FileSystemServiceProxy, LoadTree (which is internal, but required for any performance-sensitive loading), and possibly a few others. |
There's a fair bit of work involved in getting ILoadOperation configured properly to handle conflicts, load rules, etc.
I suggest browsing the code for com.ibm.team.build.internal.scm.SourceControlUtility.updateFileCopyArea(IWorkspaceConnection, String, boolean, Collection<IComponentHandle>, boolean, Collection<ILoadRule2>, boolean, IProgressMonitor) which is used by JBE and the teamFetch Ant task. |
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.