Search in sources :

Example 1 with ApiInstanceFactory

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;
}
Also used : CXFApiBuilder(com.symphony.api.bindings.cxf.CXFApiBuilder) TokenManagingApiInstanceFactory(org.finos.symphony.toolkit.spring.api.factories.TokenManagingApiInstanceFactory) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) ApiInstance(org.finos.symphony.toolkit.spring.api.factories.ApiInstance) ApiBuilderFactory(org.finos.symphony.toolkit.spring.api.builders.ApiBuilderFactory) ApiInstanceFactory(org.finos.symphony.toolkit.spring.api.factories.ApiInstanceFactory) TokenManagingApiInstanceFactory(org.finos.symphony.toolkit.spring.api.factories.TokenManagingApiInstanceFactory) CXFApiBuilder(com.symphony.api.bindings.cxf.CXFApiBuilder) ApiBuilder(com.symphony.api.bindings.ApiBuilder) ConfigurableApiBuilder(com.symphony.api.bindings.ConfigurableApiBuilder)

Aggregations

ApiBuilder (com.symphony.api.bindings.ApiBuilder)1 ConfigurableApiBuilder (com.symphony.api.bindings.ConfigurableApiBuilder)1 CXFApiBuilder (com.symphony.api.bindings.cxf.CXFApiBuilder)1 SymphonyIdentity (com.symphony.api.id.SymphonyIdentity)1 ApiBuilderFactory (org.finos.symphony.toolkit.spring.api.builders.ApiBuilderFactory)1 ApiInstance (org.finos.symphony.toolkit.spring.api.factories.ApiInstance)1 ApiInstanceFactory (org.finos.symphony.toolkit.spring.api.factories.ApiInstanceFactory)1 TokenManagingApiInstanceFactory (org.finos.symphony.toolkit.spring.api.factories.TokenManagingApiInstanceFactory)1