RTC Java API Logging Into the Server
Logging Into the Server
RTC provide some java api to Logging Into the Server and you can interact to the server. In order to log in you will need a valid set of credentials (user name and password) for that server. Those credentials will need to have permission to access everything that you need in order for your program to work such as project areas, team areas, source control streams and components.class Login {
public static void main(String[] args) {
IProgressMonitor myProgressMonitor = ...;
// Create a progress monitor
String userId = ...;
// Retrieve the userId in a secure way
String password = ...;
// Retrieve the password in a secure way
String repoUri = "https://host:9443/ccm";
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(myProgressMonitor);
/* Do all of my work with myserver here. */
repo.logout();
}
catch (TeamRepositoryException e) {
/* Handle repository exceptions such as login problems here. */
}
finally {
TeamPlatform.shutdown();
}
}
}
Comments
Post a Comment