License & repo permission information using RTC Plain Java API ?
Is there a way to get a list of assigned licenses and repository roles (jazzUser, jazzAdmin ...) from the RTC Plain Java Client ?
I found some info for the server-side API:
However, this does not work on the client side. The only thing I can get is
This does not seem to provide API for finding out enough about license assignments for contributors.
I found some info for the server-side API:
ILicenseAdminService licAdminService = (ILicenseAdminService) ((TeamRepository) teamRepository).getServiceInterface(ILicenseAdminService.class);
However, this does not work on the client side. The only thing I can get is
teamRepository.getClientLibrary(ILicenseClient.class)
This does not seem to provide API for finding out enough about license assignments for contributors.
Accepted answer
There isn't a client library for the license admin service, but your client code can invoke the remote service itself. In your client library, it would look something like this:
public IContributorLicenseType[] getLicenseTypes(IProgressMonitor monitor) throws TeamRepositoryException {
final ILicenseAdminService licenseAdminService = (ILicenseAdminService) clientLibraryContext.getServiceInterface(ILicenseAdminService.class);
return (IContributorLicenseType[]) clientLibraryContext.callCancelableService(new IClientLibraryContext.IServiceRunnable() {
public Object run(IProgressMonitor monitor) throws TeamRepositoryException {
return licenseAdminService.getLicenseTypes();
}
}, monitor);
}
Comments
2 other answers
Hey ,
with the same context I am getting null pointer exception on line 3 of code below. remeber my teamRepository object is not null and logged in before I come to this line of code.
==============================================================
System.out.println("Logged In "+teamRepository.loggedIn());
IClientLibraryContext clientLibraryContext = (IClientLibraryContext) teamRepository.getClientLibrary(IClientLibraryContext.class);
final ILicenseAdminService licenseAdminService = (ILicenseAdminService) clientLibraryContext.getServiceInterface(ILicenseAdminService.class);
==============================================================
it says
true
NULL pointer Exception.
============================================================
Am I missing something ?
Thanks -
Praveen
with the same context I am getting null pointer exception on line 3 of code below. remeber my teamRepository object is not null and logged in before I come to this line of code.
==============================================================
System.out.println("Logged In "+teamRepository.loggedIn());
IClientLibraryContext clientLibraryContext = (IClientLibraryContext) teamRepository.getClientLibrary(IClientLibraryContext.class);
final ILicenseAdminService licenseAdminService = (ILicenseAdminService) clientLibraryContext.getServiceInterface(ILicenseAdminService.class);
==============================================================
it says
true
NULL pointer Exception.
============================================================
Am I missing something ?
Thanks -
Praveen
See https://rsjazz.wordpress.com/2017/03/29/managing-contributor-licenses-using-the-plain-java-client-libraries/ for how to get the ILicenseAdminService