use of org.finos.symphony.toolkit.spring.api.factories.ApiInstanceFactory in project spring-bot by finos.
the class SymphonyAdminController method getAPI.
protected <X> X getAPI(Class<X> x) throws IOException, Exception {
Config config = getConfig();
SymphonyIdentity identity = IdentityProperties.instantiateIdentityFromDetails(rl, config.getIdentityProperties(), getObjectMapper());
ApiBuilderFactory abf = new ApiBuilderFactory() {
@Override
public boolean isSingleton() {
return false;
}
@Override
public Class<?> getObjectType() {
return ApiBuilder.class;
}
@Override
public ConfigurableApiBuilder getObject() throws Exception {
return new CXFApiBuilder();
}
};
ApiInstanceFactory apiInstanceFactory = new TokenManagingApiInstanceFactory(abf);
ApiInstance instance = apiInstanceFactory.createApiInstance(identity, config.getPodProperties(), null);
X out = instance.getAgentApi(x);
return out;
}
Aggregations