use of javax.ws.rs.core.GenericType in project opennms by OpenNMS.
the class RestClient method getAllMinions.
public List<OnmsMinion> getAllMinions() {
GenericType<List<OnmsMinion>> minions = new GenericType<List<OnmsMinion>>() {
};
final WebTarget target = getTargetV2().path("minions");
return getBuilder(target).accept(MediaType.APPLICATION_XML).get(minions);
}
use of javax.ws.rs.core.GenericType in project opennms by OpenNMS.
the class RestClient method getNodes.
public List<OnmsNode> getNodes() {
GenericType<List<OnmsNode>> nodes = new GenericType<List<OnmsNode>>() {
};
final WebTarget target = getTarget().path("nodes");
return getBuilder(target).get(nodes);
}
use of javax.ws.rs.core.GenericType in project opennms by OpenNMS.
the class DefaultRemoteRepository method getReports.
/**
* {@inheritDoc}
*/
@Override
public List<BasicReportDefinition> getReports() {
List<BasicReportDefinition> resultReports = new ArrayList<>();
if (isConfigOk()) {
WebTarget target = getTarget(m_remoteRepositoryDefintion.getURI() + "reports" + "/" + m_jasperReportsVersion);
List<RemoteReportSDO> webCallResult = new ArrayList<>();
try {
webCallResult = getBuilder(target).get(new GenericType<List<RemoteReportSDO>>() {
});
} catch (Exception e) {
logger.error("Error requesting report template from repository. Error message: '{}' Uri was: '{}'", e.getMessage(), target.getUri());
e.printStackTrace();
}
logger.debug("getReports got '{}' RemoteReportSDOs from uri '{}'", webCallResult.size(), target.getUri());
resultReports = this.mapSDOListToBasicReportList(webCallResult);
}
return resultReports;
}
use of javax.ws.rs.core.GenericType in project linuxtools by eclipse.
the class AbstractRegistry method retrieveTagsFromRegistryV1.
/**
* Retrieves the list of tags for a given repository, assuming that the
* target registry is a registry v2 instance.
*
* @param client
* the client to use
* @param repository
* the repository to look-up
* @return the list of tags for the given repository
* @throws CancellationException
* - if the computation was cancelled
* @throws ExecutionException
* - if the computation threw an exception
* @throws InterruptedException
* - if the current thread was interrupted while waiting
*/
private List<IRepositoryTag> retrieveTagsFromRegistryV1(final Client client, final String repository) throws InterruptedException, ExecutionException {
final GenericType<Map<String, String>> REPOSITORY_TAGS_RESULT_LIST = new GenericType<Map<String, String>>() {
};
final WebTarget queryTagsResource = client.target(getHTTPServerAddress()).path(// $NON-NLS-1$
"v1").path("repositories").path(repository).path(// $NON-NLS-1$ //$NON-NLS-2$
"tags");
return queryTagsResource.request(APPLICATION_JSON_TYPE).async().method(GET, REPOSITORY_TAGS_RESULT_LIST).get().entrySet().stream().map(e -> new RepositoryTag(e.getKey(), e.getValue())).collect(Collectors.toList());
}
use of javax.ws.rs.core.GenericType in project linuxtools by eclipse.
the class AbstractRegistry method retrieveTagsFromRegistryV2.
/**
* Retrieves the list of tags for a given repository, assuming that the
* target registry is a registry v1 instance.
*
* @param client
* the client to use
* @param repository
* the repository to look-up
* @return the list of tags for the given repository
* @throws CancellationException
* - if the computation was cancelled
* @throws ExecutionException
* - if the computation threw an exception
* @throws InterruptedException
* - if the current thread was interrupted while waiting
*/
private List<IRepositoryTag> retrieveTagsFromRegistryV2(final Client client, final String repository) throws InterruptedException, ExecutionException {
final GenericType<RepositoryTagV2> REPOSITORY_TAGS_RESULT_LIST = new GenericType<RepositoryTagV2>() {
};
final WebTarget queryTagsResource = client.target(getHTTPServerAddress()).path(// $NON-NLS-1$
"v2").path(repository).path("tags").path(// $NON-NLS-1$ //$NON-NLS-2$
"list");
final RepositoryTagV2 crts = queryTagsResource.request(APPLICATION_JSON_TYPE).async().method(GET, REPOSITORY_TAGS_RESULT_LIST).get();
return crts.getTags();
}
Aggregations