It's all about the answers!

Ask a question

Fetching artifacts from a Stream


Erik Trainer (21) | asked Sep 30 '07, 9:00 p.m.
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

7 answers



permanent link
Dmitry Karasik (1.8k11) | answered Sep 30 '07, 9:00 p.m.
JAZZ DEVELOPER
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

permanent link
Erik Trainer (21) | answered Oct 01 '07, 1:10 a.m.
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

permanent link
Dmitry Karasik (1.8k11) | answered Oct 01 '07, 3:57 a.m.
JAZZ DEVELOPER
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

permanent link
Dmitry Karasik (1.8k11) | answered Oct 01 '07, 11:56 a.m.
JAZZ DEVELOPER
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

permanent link
Erik Trainer (21) | answered Oct 01 '07, 3:34 p.m.
What do you have?


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

Erik

permanent link
Erik Trainer (21) | answered Oct 01 '07, 5:22 p.m.
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!

permanent link
Erik Trainer (21) | answered Oct 05 '07, 4:09 p.m.
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.

Your answer


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