本文整理了Java中io.apiman.gateway.engine.beans.Api.getOrganizationId()
方法的一些代码示例,展示了Api.getOrganizationId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Api.getOrganizationId()
方法的具体详情如下:
包路径:io.apiman.gateway.engine.beans.Api
类名称:Api
方法名:getOrganizationId
暂无
代码示例来源:origin: apiman/apiman
@Override
public void listApis(String organizationId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
// For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
List<String> res = map.entrySet().stream()
.map(Map.Entry::getValue)
.filter(entity -> entity instanceof Api)
.map(entity -> (Api) entity)
.filter(api -> api.getOrganizationId().equals(organizationId))
.map(api -> api.getApiId())
.distinct()
.collect(Collectors.toList());
handler.handle(AsyncResultImpl.create(res));
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
@Override
public void listApiVersions(String organizationId, String apiId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
// For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
List<String> res = map.entrySet().stream()
.map(Map.Entry::getValue)
.filter(entity -> entity instanceof Api)
.map(entity -> (Api) entity)
.filter(api -> api.getOrganizationId().equals(organizationId) && api.getApiId().equals(apiId))
.map(api -> api.getVersion())
.distinct()
.collect(Collectors.toList());
handler.handle(AsyncResultImpl.create(res));
}
代码示例来源:origin: apiman/apiman
@Override
public void listApiVersions(String organizationId, String apiId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
// For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
List<String> res = map.entrySet().stream()
.map(Map.Entry::getValue)
.filter(entity -> entity instanceof Api)
.map(entity -> (Api) entity)
.filter(api -> api.getOrganizationId().equals(organizationId) && api.getApiId().equals(apiId))
.map(api -> api.getVersion())
.distinct()
.collect(Collectors.toList());
handler.handle(AsyncResultImpl.create(res));
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
@Override
public void listApis(String organizationId, int page, int pageSize, IAsyncResultHandler<List<String>> handler) {
// For now, ignore paging, but it's there for future. Would need to ensure stable ordering.
List<String> res = map.entrySet().stream()
.map(Map.Entry::getValue)
.filter(entity -> entity instanceof Api)
.map(entity -> (Api) entity)
.filter(api -> api.getOrganizationId().equals(organizationId))
.map(api -> api.getApiId())
.distinct()
.collect(Collectors.toList());
handler.handle(AsyncResultImpl.create(res));
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
@Override
public void listOrgs(IAsyncResultHandler<List<String>> handler) {
// TODO: We should track set of OrgId -> AtomicCounter if this API has meaningfully high usage.
List<String> res = map.entrySet().stream()
.map(Map.Entry::getValue)
.map(elem -> {
if (elem instanceof Api) {
return ((Api) elem).getOrganizationId();
} else {
return ((Client) elem).getOrganizationId();
}
})
.distinct()
.collect(Collectors.toList());
handler.handle(AsyncResultImpl.create(res));
}
代码示例来源:origin: apiman/apiman
@Override
public void listOrgs(IAsyncResultHandler<List<String>> handler) {
// TODO: We should track set of OrgId -> AtomicCounter if this API has meaningfully high usage.
List<String> res = map.entrySet().stream()
.map(Map.Entry::getValue)
.map(elem -> {
if (elem instanceof Api) {
return ((Api) elem).getOrganizationId();
} else {
return ((Client) elem).getOrganizationId();
}
})
.distinct()
.collect(Collectors.toList());
handler.handle(AsyncResultImpl.create(res));
}
代码示例来源:origin: apiman/apiman
/**
* Generates an in-memory key for an api, used to index the client for later quick
* retrieval.
* @param api an api
* @return a api key
*/
private String getApiIndex(Api api) {
return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-es
/**
* Generates a valid document ID for a api, used to index the api in ES.
* @param api an api
* @return a api key
*/
private String getApiId(Api api) {
return getApiId(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: apiman/apiman
/**
* Generates a valid document ID for a api, used to index the api in ES.
* @param api an api
* @return a api key
*/
private String getApiId(Api api) {
return getApiId(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
/**
* Generates an in-memory key for an api, used to index the client for later quick
* retrieval.
* @param api an api
* @return a api key
*/
private String getApiIndex(Api api) {
return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: apiman/apiman
private String getApiIndex(Api api) {
return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-vertx-shareddata
private String getApiIndex(Api api) {
return getApiIndex(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: apiman/apiman
/**
* @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
*/
@Override
public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
List<Policy> policies = api.getApiPolicies();
encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
delegate.publishApi(api, handler);
decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
/**
* @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
*/
@Override
public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
List<Policy> policies = api.getApiPolicies();
encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
delegate.publishApi(api, handler);
decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
}
代码示例来源:origin: apiman/apiman
/**
* @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
*/
@Override
public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
Connection conn = null;
try {
conn = ds.getConnection();
conn.setAutoCommit(false);
QueryRunner run = new QueryRunner();
// First delete any record we might already have.
run.update(conn, "DELETE FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$
api.getOrganizationId(), api.getApiId(), api.getVersion());
// Now insert a row for the api.
String bean = mapper.writeValueAsString(api);
run.update(conn, "INSERT INTO gw_apis (org_id, id, version, bean) VALUES (?, ?, ?, ?)", //$NON-NLS-1$
api.getOrganizationId(), api.getApiId(), api.getVersion(), bean);
DbUtils.commitAndClose(conn);
handler.handle(AsyncResultImpl.create((Void) null, Void.class));
} catch (SQLException | JsonProcessingException e) {
handler.handle(AsyncResultImpl.create(e));
}
}
代码示例来源:origin: apiman/apiman
/**
* @see io.apiman.manager.api.gateway.IGatewayLink#retireApi(io.apiman.gateway.engine.beans.Api)
*/
@Override
public void retireApi(Api api) throws PublishingException, GatewayAuthenticationException {
if (!isGatewayUp()) {
throw new PublishingException(Messages.i18n.format("RestGatewayLink.GatewayNotRunning")); //$NON-NLS-1$
}
getClient().retire(api.getOrganizationId(), api.getApiId(), api.getVersion());
}
代码示例来源:origin: apiman/apiman
/**
* @see io.apiman.gateway.engine.IRegistry#retireApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
*/
@Override
public void retireApi(Api api, IAsyncResultHandler<Void> handler) {
QueryRunner run = new QueryRunner(ds);
try {
run.update("DELETE FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$
api.getOrganizationId(), api.getApiId(), api.getVersion());
handler.handle(AsyncResultImpl.create((Void) null, Void.class));
} catch (SQLException e) {
handler.handle(AsyncResultImpl.create(e));
}
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-jdbc
/**
* @see io.apiman.gateway.engine.IRegistry#retireApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
*/
@Override
public void retireApi(Api api, IAsyncResultHandler<Void> handler) {
QueryRunner run = new QueryRunner(ds);
try {
run.update("DELETE FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$
api.getOrganizationId(), api.getApiId(), api.getVersion());
handler.handle(AsyncResultImpl.create((Void) null, Void.class));
} catch (SQLException e) {
handler.handle(AsyncResultImpl.create(e));
}
}
代码示例来源:origin: apiman/apiman
@Override
public void handle(IAsyncResult<ApiContract> result) {
if (result.isSuccess()) {
ApiContract contract = result.getResult();
List<Policy> policies = contract.getPolicies();
decryptPolicies(contract.getClient().getOrganizationId(),
contract.getClient().getClientId(), contract.getClient().getVersion(),
EntityType.ClientApp, policies);
Api api = contract.getApi();
if (api != null) {
List<Policy> apiPolicies = api.getApiPolicies();
decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
EntityType.Api, apiPolicies);
decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
api.getVersion(), EntityType.Api, api.getEndpointProperties());
}
}
handler.handle(result);
}
});
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
@Override
public void handle(IAsyncResult<ApiContract> result) {
if (result.isSuccess()) {
ApiContract contract = result.getResult();
List<Policy> policies = contract.getPolicies();
decryptPolicies(contract.getClient().getOrganizationId(),
contract.getClient().getClientId(), contract.getClient().getVersion(),
EntityType.ClientApp, policies);
Api api = contract.getApi();
if (api != null) {
List<Policy> apiPolicies = api.getApiPolicies();
decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
EntityType.Api, apiPolicies);
decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
api.getVersion(), EntityType.Api, api.getEndpointProperties());
}
}
handler.handle(result);
}
});
内容来源于网络,如有侵权,请联系作者删除!