It's all about the answers!

Ask a question

Getting a file info through a plain Java API.


Tomohiro Fujii (122) | asked Mar 22 '12, 10:41 p.m.
Hello,

My customer needs a list of all file's info in a specific project-steam-workspace.
#because of compliance reqson...

Here, " file's info" consist of...
- path (*Windows directory name is OK)
- filename
- a latest date which modified
- who modified last

Platform :Windows 7, RTC and Plain Java API lib are 3.0.1.2.

I try to get these info through the plain Java API. I refered the sample code "Snippet4.java"(contained in a distribution of the plain Java API), and modified Snippet4.printComponentFileTree() method.

///////// part of a modified-Snippet4.printComponentFileTree()
for (String name : children.keySet()) {
IVersionableHandle item = children.get(name);
if(item instanceof IFolderHandle){
printComponentFileTree(workspace, component, configuration, (IFolderHandle)item, indent + " ", monitor);
}else{
monitor.subTask(indent + name);
// How do I get info of each file ????
//
}
}
/////////////////////

I can get an instance of IVersionableHandle, but don't know how to access a each file and get info listed above.

If someone know how to do that,please give me advise.

regards,

One answer



permanent link
Dong Young Kim (1931820) | answered Jul 01 '12, 7:34 a.m.
JAZZ DEVELOPER
You can just check if IVersionableHandle is IFileItemHandle.

if (item instanceof IFileItemHandle)
{
   ....
}

Your answer


Register or to post your answer.