use of io.apiman.manager.api.beans.summary.ApiVersionEndpointSummaryBean in project apiman by apiman.
the class ApiService method getApiVersionEndpointInfoFromStorage.
private ApiVersionEndpointSummaryBean getApiVersionEndpointInfoFromStorage(ApiVersionBean apiVersion, String organizationId, String apiId, String version) throws GatewayNotFoundException, GatewayAuthenticationException, StorageException {
Set<ApiGatewayBean> gateways = apiVersion.getGateways();
if (gateways.isEmpty()) {
// $NON-NLS-1$
throw new SystemErrorException("No Gateways for published API!");
}
GatewayBean gateway = storage.getGateway(gateways.iterator().next().getGatewayId());
if (gateway == null) {
throw new GatewayNotFoundException();
} else {
// $NON-NLS-1$
LOGGER.debug(String.format("Got endpoint summary: %s", gateway));
}
IGatewayLink link = gatewayLinkFactory.create(gateway);
ApiEndpoint endpoint = link.getApiEndpoint(organizationId, apiId, version);
ApiVersionEndpointSummaryBean rval = new ApiVersionEndpointSummaryBean();
rval.setManagedEndpoint(endpoint.getEndpoint());
return rval;
}
use of io.apiman.manager.api.beans.summary.ApiVersionEndpointSummaryBean in project apiman by apiman.
the class OrganizationResourceImpl method getApiVersionEndpointInfo.
/**
* @see IOrganizationResource#getApiVersionEndpointInfo(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public ApiVersionEndpointSummaryBean getApiVersionEndpointInfo(String organizationId, String apiId, String version) throws ApiVersionNotFoundException, InvalidApiStatusException {
// No permission check is needed, because this would break All APIs UI
try {
storage.beginTx();
ApiVersionBean apiVersion = getApiVersionFromStorage(organizationId, apiId, version);
if (apiVersion.getStatus() != ApiStatus.Published) {
// $NON-NLS-1$
throw new InvalidApiStatusException(Messages.i18n.format("ApiNotPublished"));
}
ApiVersionEndpointSummaryBean rval = getApiVersionEndpointInfoFromStorage(apiVersion, organizationId, apiId, version);
storage.commitTx();
return rval;
} catch (AbstractRestException e) {
storage.rollbackTx();
throw e;
} catch (Exception e) {
storage.rollbackTx();
throw new SystemErrorException(e);
}
}
use of io.apiman.manager.api.beans.summary.ApiVersionEndpointSummaryBean in project apiman by apiman.
the class OrganizationResourceImpl method getApiVersionEndpointInfoFromStorage.
private ApiVersionEndpointSummaryBean getApiVersionEndpointInfoFromStorage(ApiVersionBean apiVersion, String organizationId, String apiId, String version) throws GatewayNotFoundException, GatewayAuthenticationException, StorageException {
Set<ApiGatewayBean> gateways = apiVersion.getGateways();
if (gateways.isEmpty()) {
// $NON-NLS-1$
throw new SystemErrorException("No Gateways for published API!");
}
GatewayBean gateway = storage.getGateway(gateways.iterator().next().getGatewayId());
if (gateway == null) {
throw new GatewayNotFoundException();
} else {
// $NON-NLS-1$
log.debug(String.format("Got endpoint summary: %s", gateway));
}
IGatewayLink link = gatewayLinkFactory.create(gateway);
ApiEndpoint endpoint = link.getApiEndpoint(organizationId, apiId, version);
ApiVersionEndpointSummaryBean rval = new ApiVersionEndpointSummaryBean();
rval.setManagedEndpoint(endpoint.getEndpoint());
return rval;
}
Aggregations