It's all about the answers!

Ask a question

Java API for listing/retrieving files in Jazz SCM repository


James Bognar (14334) | asked Apr 10 '10, 3:33 p.m.
JAZZ DEVELOPER
I need to write some standalone Java code for scanning the contents of files in a Jazz repository. Is there a simple Java library somewhere that allows access to files in a Jazz SCM repository? A simple OSGI plugin is fine, as long as it doesn't prereq any eclipse plugins.

I could just write a wrapper around the SCM CLI, but I'd like a solution that doesn't include the overhead of starting up a JVM for every command I issue.

In particular, I need to be able to...
    - List all workspaces in a repository for a given user.
    - List all components in a workspace.
    - List all files in a component or subdirectory (preferably one level at a time...not the entire tree, and also preferably including various meta-data such as last-modified timestamps and file sizes).
    - Retrieve the contents of a single file (preferrably as an input stream, not just copied to the local file system).
    - Retrieve the contents of all files in an entire component or subdirectory.


Any suggestions?

3 answers



permanent link
Neerav Salaria (3132) | answered May 12 '10, 5:18 a.m.
I need to write some standalone Java code for scanning the contents of files in a Jazz repository. Is there a simple Java library somewhere that allows access to files in a Jazz SCM repository? A simple OSGI plugin is fine, as long as it doesn't prereq any eclipse plugins.

I could just write a wrapper around the SCM CLI, but I'd like a solution that doesn't include the overhead of starting up a JVM for every command I issue.

In particular, I need to be able to...
    - List all workspaces in a repository for a given user.
    - List all components in a workspace.
    - List all files in a component or subdirectory (preferably one level at a time...not the entire tree, and also preferably including various meta-data such as last-modified timestamps and file sizes).
    - Retrieve the contents of a single file (preferrably as an input stream, not just copied to the local file system).
    - Retrieve the contents of all files in an entire component or subdirectory.


Any suggestions?
hello jbognar .. i just saw ur query even i am facing the same issue ...i am using a scm load command to load a workspace but i need some code in java api to load a workspace or component for me ...are u verse with any such api

with regards
Neerav

permanent link
James Bognar (14334) | answered May 12 '10, 10:38 a.m.
JAZZ DEVELOPER
Hi Neerav,

No, I have not received an answer to my question yet. Therefore, my assumption is that such a Java API does not exist.

I have postponed my work until a suitable solution becomes available.

permanent link
Giacomo Tonucci (2631) | answered May 18 '10, 11:37 a.m.
Hi Neerav,

No, I have not received an answer to my question yet. Therefore, my assumption is that such a Java API does not exist.

I have postponed my work until a suitable solution becomes available.



For question number1 (find workspaces)


String udc = "stream_name";
String ownerName = "admin_RTC";
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
criteria = criteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
criteria.setExactOwnerName(ownerName);
//criteria = criteria.setExactName(udc);
List<IWorkspaceHandle> repwsList = wm.findWorkspaces(criteria, 100, null);
if (repwsList.size()==0) {
System.out.println("No WS"+udc+" was found.");
return false;
}
if (repwsList.size()>1) {
System.out.println("Found "+repwsList.size()+" Repository WS named "+udc+".");
return false;
}

IWorkspaceHandle repwsHan = repwsList.get(0);
IItemManager itemman = teamRepository.itemManager();
IWorkspace myWS= (IWorkspace) itemman.fetchCompleteItem(repwsHan, IItemManager.DEFAULT, null);



This should be the first brick...

Your answer


Register or to post your answer.