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

Fetching artifacts from a Stream

Hi,

I've developed an Eclipse plug-in that feeds Eclipse workspace resources into a repository and annotates them with authorship information at the line level. I do this using annotation blocks.

I've already developed a CVS extractor to get authorship information from a team's CVS repository, but now I'm trying to build an additional extractor for the Jazz SCM.

Basically, I'm trying to use the same resources model to get the corresponding artifacts from a Jazz stream and then annotate them with authorship information. I've figured out how to connect to the team repository and get the components from the repository, but I'm unsure of how to proceed from here. I think I'm on the right track because each component, according to the quick reference guide, has "their own tree of folders and files, and their own change history."

For now, I just want the most up-to-date copy of a project from the stream. I'm not so much interested in individual users' repository workspaces. And if I can reuse annotation blocks to get authorship information, that would be great.

Can someone point me in the right direction? Thanks!

Best,
Erik

0 votes



7 answers

Permanent link
On Mon, 01 Oct 2007 01:07:53 +0000, AnErikSupreme wrote:

Basically, I'm trying to use the same resources model to get the
corresponding artifacts from a Jazz stream and then annotate them with
authorship information. I've figured out how to connect to the team
repository and get the components from the repository, but I'm unsure of
how to proceed from here. I think I'm on the right track because each
component, according to the quick reference guide, has "their own tree
of folders and files, and their own change history."

Once you have the components you can call
IFlowNodeConnection.configuration(IComponentHandle), using the
IConfiguration you can find the root folder and fetch child entries or
resolve a path to obtain the IFileItemHandle that corresponds to the file
you want to get authorship information for. Once you have the file you
can call FileSystemCore.getFileSystemManager
(workspaceConnection.teamRepository()).getFileSystemView
(workspaceConnection).getBlame().


- Dmitry

0 votes


Permanent link
Dmitry,

Thank you for the help. I'm still confused on how I get an object that implements IFlowNodeConnection so I can get an IConfiguration. I have an instance of IWorkspaceManager and it looks like I can get a WorkspaceConnection from the manager by calling getWorkspaceConnection(..), but I don't know how to get the Workspace or WorkspaceHandle I need.

Erik

0 votes


Permanent link
On Mon, 01 Oct 2007 05:17:50 +0000, AnErikSupreme wrote:

I don't know how to get the Workspace or
WorkspaceHandle I need.

What do you have?
I suppose from your earlier description you have an eclipse IFile? If so
then you can do:

IShareable s = (IShareable)IFile.getAdapter(IShareable.class);
ISharingDescriptor sd = s.getShare().getSharingDescriptor();
IWorkspaceHandle ws = (IWorkspaceHandle)sd.getConnectionHandle();
IComponent c = sd.getComponent();
IFileItemHandle fi = (IFileItemHandle)s.getVersionable();

To be absolutely correct you'd need to check that getShare() didn't
return null (it will if the file is not shared with jazz) and that
sd.getConnectionHandle() in fact returns an IWorkspaceHandle (it could
return an IBaselineHandle instead) and that s.getVersionable() returns an
IFileItemhandle (it could return an IFolderHandle or null).

- Dmitry

0 votes


Permanent link
On Mon, 01 Oct 2007 19:37:55 +0000, AnErikSupreme wrote:

I had actually tried to get the components by calling the
WorkspaceManager's findComponents method.

That will get you a list of components, but you cannot do much with it
without the context of a workspace or baseline.

I guess I need more details about what you are trying to do in order to
be able to help you.

- Dmitry

0 votes


Permanent link
What do you have?


I had actually tried to get the components by calling the WorkspaceManager's findComponents method.

Erik

0 votes


Permanent link
On Mon, 01 Oct 2007 19:37:55 +0000, AnErikSupreme wrote:

I had actually tried to get the components by calling the
WorkspaceManager's findComponents method.

That will get you a list of components, but you cannot do much with it
without the context of a workspace or baseline.

I guess I need more details about what you are trying to do in order to
be able to help you.

- Dmitry

I think what you've told me will help. To summarize, I want to feed my SCM extractor IResources from the Eclipse workspace, match the IResources that are files to their corresponding resources or files in the Stream, and get Annotations for each file so I can get authorship info all the way down to the line level. I already know the line ranges for each class and method that I want to collect authorship for.

Ideally I'd like to use a map to store an Eclispe IResource as a key and the corresponding SCM element as a value so I can translate between the two. This is how I've implemented the CVS extractor - I store the IResource as a key and the corresponding ICVSResource as the value.

Hope that clarifies a bit.

Thanks again!

0 votes


Permanent link
Looks like I have a working version of this, although I need to do some more testing to make sure :)

Once I got a list of change set handles for each line in the file by calling the getBlame() method, I looked up each change set in the Repository item manager and got the corresponding contributor and userID, and thus authorship for each line in the file.

Thanks again.

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,940

Question asked: Sep 30 '07, 9:00 p.m.

Question was seen: 9,905 times

Last updated: Sep 30 '07, 9:00 p.m.

Confirmation Cancel Confirm