It's all about the answers!

Ask a question

Load a repository workspace using Plain API


Michele Pegoraro (1.8k14118103) | asked Nov 25 '11, 4:21 a.m.
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



permanent link
Sterling Bates (2311612) | answered Nov 26 '11, 2:01 p.m.
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.

permanent link
Michele Pegoraro (1.8k14118103) | answered Nov 28 '11, 8:26 a.m.
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());

loadOperation.requestLoad(sbox, null, wsManager.getWorkspaceConnection(wsc.getResolvedWorkspace(), null), component,(Collection)Collections.EMPTY_LIST);
loadOperation.run(null);


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.

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.

permanent link
Michele Pegoraro (1.8k14118103) | answered Nov 28 '11, 11:34 a.m.
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.

permanent link
Nick Edgar (6.5k711) | answered Nov 28 '11, 8:00 p.m.
JAZZ DEVELOPER
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.

permanent link
Michele Pegoraro (1.8k14118103) | answered Nov 30 '11, 6:08 a.m.
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.

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


Register or to post your answer.