How to create reference of ITeamRepository, IProjectArea and IProgressMonitor
Hi All,
I am following this link "https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/"
I am getting trouble in main method. It is asking me to create objects of TeamRepository, IProjectArea and IProgressMonitor.
for IProgressMonitor I found following way to create object.
"IProgressMonitor monitor = new NullProgressMonitor();"
but I am unable to figure out how to create objects of ITeamRepository and IProjectArea.
can anyone please tell me how can I do this in this context.
Thanks
3 answers
See the code for main in https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ or download any code attached to any of the client API example e.g. https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ or look into https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation the Plain-Java Client section or look into the snippets that come with the Plain Java API for example code for the basics needed in main.
Comments
How to create a project area is described here: https://rsjazz.wordpress.com/2013/09/18/deploying-templates-and-creating-projects-using-the-plain-java-clients-library/ which is actually the post that is mentioned to be read in the one you mention and that shows how to create a project area and also shows the other code you are missing. Usually you don't create them, but you search for them as explained in other posts in the blog.
but I am unable to figure out how to create objects of ITeamRepository and IProjectArea.
If you are using Plain Java API, you obtain the ITeamRepository instance logging in to the repository:
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoURI);
repo.registerLoginHandler(new LoginHandler(userId, password));
repo.login(monitor);
You can refer to https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples#First_things_First_Connecting_to for a fully Java client example.
Once you got the repo connection, you can obtain a IProjectArea instance from a project area name using the repository client services:
IProcessClientService processClient = (IProcessClientService) repo.getClientLibrary(IProcessClientService.class);You will find a lot of examples on wiki as well as on forum! And on Ralph Schoon's blog, too ;)
URI uri = URI.create(prjAreaName.replaceAll(" ", "%20"));
IProjectArea prjArea = (IProjectArea) processClient.findProcessArea(uri, IProcessClientService.ALL_PROPERTIES, monitor);
Cheers.
Hi,
I looked into some example to learn how to create ITeamRepository and IProjectArea object.
In many example I seen them declared exact same way "SEC Servizi" mentioned in his answer. That was useful. Example provided on "https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/" link I tried to run it.
I figured that new three components will be created but as my code is not running properly I am unable to see its output.
Could anybody please tell me what happens when we run this code.
Comments
This is an iterative process.
-
You set up your environment for debugging.
- You start with the snippets that come with the Plain Java Client Libraries
- You download examples that work and have a description how they work
- You play around with the examples in debug mode and understand how they work
- You get adventurous and start your own examples based on the existing code
This is something you have to do on your own. Doing this on the forum, if you have not even understood the very basics is just not possible.