It's all about the answers!

Ask a question

Accesssing User Information


Jamie Samdal (911) | asked Nov 01 '07, 12:50 p.m.
Is there any information how I can access the username of the current user via my plugin? I didn't see it in any of the component development tutorials...


Thanks,
Jamie

6 answers



permanent link
Jared Burns (4.5k29) | answered Nov 01 '07, 1:07 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Client or server?

On the client, use ITeamRepository#loggedInContributor().

On the server, extenders of AbstractService can call
getAuthenticatedContributor().

- Jared

jsamdal wrote:
Is there any information how I can access the username of the current
user via my plugin? I didn't see it in any of the component
development tutorials...


Thanks,
Jamie

permanent link
Jamie Samdal (911) | answered Nov 04 '07, 4:04 p.m.
How do I access the Team Repository that the user is logged into? I tried using TeamPlatform.getTeamRepositoryService(), but using that service getTeamRepositories returned an empty array of repositories. (This was when running my plugin as an eclipse application - is there a different way I need to test this, in order to ensure that Team Concert loads using a repository?)

Thanks,
Jamie

permanent link
Chris Daly (61651) | answered Nov 05 '07, 7:38 p.m.
JAZZ DEVELOPER
jsamdal wrote:
How do I access the Team Repository that the user is logged into? I
tried using TeamPlatform.getTeamRepositoryService(), but using that
service getTeamRepositories returned an empty array of repositories.
(This was when running my plugin as an eclipse application - is there
a different way I need to test this, in order to ensure that Team
Concert loads using a repository?)

After you start the eclipse application that contains your plug-in, you
will need to define a repository connection. You can do this in the
Team Artifacts view with the context-menu action: New > Jazz Repository
Connection. Then fill out the dialog with the details of your
repository (including the userid/password).

After doing that I would expect that the call to
ITeamRepositoryService.getTeamRepositories() will return the
ITeamRepository for the connection you just created and
ITeamRepository.loggedInContributor() should return the contributor that
matches the userid/password you used when setting up the connection.


You can also do this stuff programatically as shown in the example here:

https://jazz.net/wiki/pub/Main/JazzServerRunAndDebug/JazzLoginTestCase.java

However note that this code uses
ITeamRepositoryService.getUnmanagedRepository(). The Javadoc explains
the details, but to summarize "unmanaged" here means that this
repository will *not* be in the list returned by
ITeamRepositoryService.getTeamRepositories(). So you could change that
code to use getTeamRepository() instead of getUnmanagedRepository() for
your scenario.


Chris

permanent link
Jamie Samdal (911) | answered Nov 10 '07, 4:49 p.m.
When I try to connect to a new repository connection from the 2nd instance of eclipse (the one I'm using to test my plugin):

1) I receive errors if I attempt to connect to ports 9080 (which is the server I am running for my own development use):

Connection error: Unknown host: HTTP error 'java.nio.channels.UnresolvedAddressException' accessing http://localhost:9080/jazz/service/com.ibm.team.repository.common/internal.IRepositoryRemoteService

2) I receive errors if I attempt to connect to ports 8080, which is the second server I run with the Jazz Server for JazzTalk:

Project areas could not be fetched: java.lang.IllegalStateException: Unable to find type for com.ibm.team.process.ProjectArea. See log for more details.

Where is the log that I should be referencing? Do I need to set up a project area somehow on the second server before I can connect?

Thanks,
Jamie

permanent link
Chris Daly (61651) | answered Nov 12 '07, 2:18 p.m.
JAZZ DEVELOPER
jsamdal wrote:
When I try to connect to a new repository connection from the 2nd
instance of eclipse (the one I'm using to test my plugin):

1) I receive errors if I attempt to connect to ports 9080 (which is
the server I am running for my own development use):

Connection error: Unknown host: HTTP error
'java.nio.channels.UnresolvedAddressException' accessing
http://localhost:9080/jazz/service/com.ibm.team.repository.common/internal.IRepositoryRemoteService

2) I receive errors if I attempt to connect to ports 8080, which is
the second server I run with the Jazz Server for JazzTalk:

Project areas could not be fetched: java.lang.IllegalStateException:
Unable to find type for com.ibm.team.process.ProjectArea. See log for
more details.

Where is the log that I should be referencing? Do I need to set up a
project area somehow on the second server before I can connect?

Thanks,
Jamie


Hi Jamie,

I think I understand what's going on with (2), so I'll address that
first. The "Jazz Server for JazzTalk" launch is pretty minimal. It
does not include the Process component, which is the component
responsible for supporting project areas and team areas.

I was able to add the process component to the launch and get around
this problem by doing the following:

First I added these process common/service plugins to the launch:

com.ibm.team.process.common
com.ibm.team.process.service
com.ibm.team.process.definitions.server

Second I clicked the "Validate Bundles" button on the launch dialog and
it gave me a list of additional bundles that are referenced by these
process bundles. Now I iterated, adding bundles and doing "Validate
Bundles" until the validate step says "no problems were detected". In
the end I had added all of these additional plugins to the launch:

com.ibm.team.filesystem.common
com.ibm.team.filesystem.common.workitems
com.ibm.team.filesystem.service
com.ibm.team.filesystem.service.workitems
com.ibm.team.scm.common
com.ibm.team.scm.service
com.ibm.team.foundation.common
com.ibm.team.foundation.service
com.ibm.team.workitem.common
com.ibm.team.workitem.service
com.ibm.team.fulltext.common
com.ibm.team.fulltext.service
org.eclipse.text
javax.mail
org.eclipse.core.commands
com.ibm.icu
org.apache.lucene2

Perhaps a faster way would have been to start with the "Typical" launch
for 0.6M3 that's attached here:

https://jazz.net/wiki/bin/view/Main/JazzServerRunAndDebug

So you could start with that launch and then just add the JazzTalk
plugins to it. (I haven't tried this, but I think it includes all the
plugins listed above and maybe a few more.)


On problem (1), I'm not sure why you wouldn't be able to connect to your
development server. Can you give me more details here? What steps are
you performing in the UI? Are there exception stacks? I assume you
can connect with your normal development client, so I'm not sure what
would be different about this case.


Chris

permanent link
Jamie Samdal (911) | answered Nov 12 '07, 3:39 p.m.
Thanks, I was able to get this working with the Typical launch setup. :) Now I just need to get the server side of my plugin working with the typical launch setup. ;)

Thanks for all your help!
Jamie

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.