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

Problem getting list of components from Jazz Team Server

I need to fetch the components deployed on the server.

For this, I got the reference of IServerStatusRestService through JTS, and called its APIs to get the list of components (Steps detailed at the end). This works fine when I launch it through workbench. But, when the plugin is installed, it through error "missing plugin".

As a temporary fix, added the repository_service.jar in the lib folder and bundled it in the installer. Removed the plugin from the dependency list. Now the plugin gets installed. But at runtime its throwing java.lang.ArrayStoreException. If I keep the plugin in the dependency list, the connector does not get installed. But it executes from the workbench.

Is there an alternate way to get the list of components from Jazz Team Server ? (i.e., https://localhost:9443/ccm/admin#action=com.ibm.team.repository.admin.componentStatus)

*****************************************************
I used following steps to get the list of components:

1. Instantiate the team server:
ITeamServer teamServer = TeamServerFactory.INSTANCE.newTeamServerFromURL(repository.getRepositoryURI(), getCertificateHandler()); (Wrote a certificate handler to accept all certificates)

2. Set the credentials:
UsernameAndPasswordLoginInfo loginInfo = (UsernameAndPasswordLoginInfo)repository.getLoginInfo();
teamServer.setCredentials(repository.getUserId(), loginInfo.getPassword());

3. Get the REST service reference:
ITeamService service = teamServer.getService(IServerStatusRestService.class);

4. Get the method reference for components and status:
Method m = service.getMethod("getComponentsAndStatus");

5. Invoke the method:
ComponentStatusDTO[] statusDTOs = (ComponentStatusDTO[])service.invoke(service, m, new Object[]{});

6. Iterate over the components:
for(ComponentStatusDTO status:statusDTOs) System.out.println("Component ID: " + status.getComponent().getId());

0 votes


Accepted answer

Permanent link
A detailed article on using JAZZ APIs for finding components.deployed on a JTS server:

https://jazz.net/library/article/1457
Ralph Schoon selected this answer as the correct answer

0 votes

Comments

I have missed this question. http://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/ also explains how to do that with the API.

Another option would be to use the RTC SCM command line.

@Ralph - There is a difference between this question, and the article I mentioned.

The word "Component" is causing confusion here. In my article, its NOT about components, as is used in source-code control, its about JTS server's components, like preconditions, and other configurable components.

Ah, sorry, there are a lot of terms that are heavily overused in software.

True that :)


One other answer

Permanent link
I just need to fetch the list of components deployed on the Jazz Team Server, is there an alternative way to do so ?

I need to fetch the components deployed on the server.

For this, I got the reference of IServerStatusRestService through JTS, and called its APIs to get the list of components (Steps detailed at the end). This works fine when I launch it through workbench. But, when the plugin is installed, it through error "missing plugin".

As a temporary fix, added the repository_service.jar in the lib folder and bundled it in the installer. Removed the plugin from the dependency list. Now the plugin gets installed. But at runtime its throwing java.lang.ArrayStoreException. If I keep the plugin in the dependency list, the connector does not get installed. But it executes from the workbench.

Is there an alternate way to get the list of components from Jazz Team Server ? (i.e., https://localhost:9443/ccm/admin#action=com.ibm.team.repository.admin.componentStatus)

*****************************************************
I used following steps to get the list of components:

1. Instantiate the team server:
ITeamServer teamServer = TeamServerFactory.INSTANCE.newTeamServerFromURL(repository.getRepositoryURI(), getCertificateHandler()); (Wrote a certificate handler to accept all certificates)

2. Set the credentials:
UsernameAndPasswordLoginInfo loginInfo = (UsernameAndPasswordLoginInfo)repository.getLoginInfo();
teamServer.setCredentials(repository.getUserId(), loginInfo.getPassword());

3. Get the REST service reference:
ITeamService service = teamServer.getService(IServerStatusRestService.class);

4. Get the method reference for components and status:
Method m = service.getMethod("getComponentsAndStatus");

5. Invoke the method:
ComponentStatusDTO[] statusDTOs = (ComponentStatusDTO[])service.invoke(service, m, new Object[]{});

6. Iterate over the components:
for(ComponentStatusDTO status:statusDTOs) System.out.println("Component ID: " + status.getComponent().getId());

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: Sep 29 '11, 1:54 a.m.

Question was seen: 4,577 times

Last updated: Nov 18 '14, 6:33 a.m.

Confirmation Cancel Confirm