import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import com.ibm.team.process.client.IProcessItemService;
import com.ibm.team.process.common.IProjectArea;
import com.ibm.team.repository.client.ILoginHandler2;
import com.ibm.team.repository.client.ILoginInfo2;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.login.UsernameAndPasswordLoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;
public class ProjectAreas {
public static void main(String[] args) {
IProgressMonitor monitor = new NullProgressMonitor();
final String userId = "username";
final String password = "password";
String repoUri = "https://RTCSERVER/jazz";
TeamPlatform.startup();
try {
// Login to the repository using the provided credentials
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri);
repo.registerLoginHandler(new ILoginHandler2() {
@Override
public ILoginInfo2 challenge(ITeamRepository repo) {
return new UsernameAndPasswordLoginInfo(userId, password);
}
});
repo.login(monitor);
IProcessItemService connect = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
List p = connect.findAllProjectAreas(null, monitor);
repo.logout();
} catch (TeamRepositoryException e) {
/* Handle repository exceptions such as login problems here. */
} finally {
TeamPlatform.shutdown();
}
}
}
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import com.ibm.team.process.client.IProcessItemService;
import com.ibm.team.process.common.IProjectArea;
import com.ibm.team.repository.client.ILoginHandler2;
import com.ibm.team.repository.client.ILoginInfo2;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.login.UsernameAndPasswordLoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;
public class ProjectAreas {
public static void main(String[] args) {
IProgressMonitor monitor = new NullProgressMonitor();
final String userId = "username";
final String password = "password";
String repoUri = "https://RTCSERVER/jazz";
TeamPlatform.startup();
try {
// Login to the repository using the provided credentials
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri);
repo.registerLoginHandler(new ILoginHandler2() {
@Override
public ILoginInfo2 challenge(ITeamRepository repo) {
return new UsernameAndPasswordLoginInfo(userId, password);
}
});
repo.login(monitor);
IProcessItemService connect = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
List
repo.logout();
} catch (TeamRepositoryException e) {
/* Handle repository exceptions such as login problems here. */
} finally {
TeamPlatform.shutdown();
}
}
}
No comments:
Post a Comment