Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

get IShareable / IResource from IFileItem in stream

Dear Jazz participant,

I'm doing some research with the Jazz repository and i need to traverse through all files in a given stream (IFlowNodeConnection). I am able to get all the IFileItems from the stream and now i need to get an IResource from the IFileItem. I wanted to get the local full path of the file by getting an IShareable and use the method getLocalFullPath().
I tried to use some code i found somewhere on the forum:

ISharingManager sm = FileSystemCore.getSharingManager()
IShareable shareable = sm.findShareable(cfaRoot, versionableHandle,
componentHandle, contextHandle, progressMonitor);
IPath localPath = shareable.getLocalFullPath();

The problem is when I try to get the cfaRoot by calling ISharingManager.getDefaultCFARoot() this method returns null.
When I look at the implementation of this method in the source code it looks like all the method does is return null.

I suspect I need to use a different approach to get the IShareable because I'm not working with files that are in a local eclipse workspace, just with files that are somewhere in a stream in the repository on the Jazz server.

How could I get an IShareable or IResource from these IFileItems?



Thanks,
Theo van Oostrum

0 votes



2 answers

Permanent link
Theo,

You can't get an IShareable or an IResource for an IFileItem unless you
load the content from the stream. If you are looking to get the path of
an item, you can get it through the configuration of a component
(IFlowNodeConnection#configuration(IComponentHandle)). You can obtain
the paths for items from the configuration (see iConfiguration#resolvePath).

Michael

gt.oostrum wrote:
Dear Jazz participant,

I'm doing some research with the Jazz repository and i need to
traverse through all files in a given stream (IFlowNodeConnection). I
am able to get all the IFileItems from the stream and now i need to
get an IResource from the IFileItem. I wanted to get the local full
path of the file by getting an IShareable and use the method
getLocalFullPath().
I tried to use some code i found somewhere on the forum:

ISharingManager sm = FileSystemCore.getSharingManager()
IShareable shareable = sm.findShareable(cfaRoot, versionableHandle,
componentHandle, contextHandle, progressMonitor);
IPath localPath = shareable.getLocalFullPath();

The problem is when I try to get the cfaRoot by calling
ISharingManager.getDefaultCFARoot() this method returns null.
When I look at the implementation of this method in the source code it
looks like all the method does is return null.

I suspect I need to use a different approach to get the IShareable
because I'm not working with files that are in a local eclipse
workspace, just with files that are somewhere in a stream in the
repository on the Jazz server.

How could I get an IShareable or IResource from these IFileItems?



Thanks,
Theo van Oostrum

0 votes


Permanent link
...
I suspect I need to use a different approach to get the IShareable because I'm not working with files that are in a local eclipse workspace, just with files that are somewhere in a stream in the repository on the Jazz server.


You can get the current state of the stream/workspace by calling IWorkspaceConnection#configuration(), getting the root items (#childEntriesForRoots()), then walking down each component root calling #fetchCompleteItems(). If you want file content, you can call IFileItem#getContent() for the IVersionables that are instances of IFileItem.

e

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Jun 05 '09, 6:43 p.m.

Question was seen: 6,846 times

Last updated: Jun 05 '09, 6:43 p.m.

Confirmation Cancel Confirm