Search in sources :

Example 1 with AppConfiguration

use of com.alipay.sofa.runtime.api.component.AppConfiguration in project sofa-boot by alipay.

the class SofaFrameworkInitializer method addSofaRuntimeManager.

private static void addSofaRuntimeManager(String appName, ConfigurableApplicationContext applicationContext) {
    if (!SofaFrameworkHolder.containsSofaFramework()) {
        SofaFrameworkHolder.setSofaFramework(new SofaFrameworkImpl());
    }
    SofaFrameworkImpl sofaFramework = (SofaFrameworkImpl) SofaFrameworkHolder.getSofaFramework();
    AppConfiguration applicationConfiguration = createAppConfigurationImpl(applicationContext);
    ClientFactoryInternal clientFactoryInternal = new ClientFactoryImpl();
    SofaRuntimeManager sofaRuntimeManager = new StandardSofaRuntimeManager(appName, SofaFrameworkInitializer.class.getClassLoader(), applicationConfiguration, clientFactoryInternal);
    ComponentManager componentManager = sofaRuntimeManager.getComponentManager();
    // register service client & reference client
    componentManager.registerComponentClient(ServiceClient.class, new ServiceClientImpl(sofaRuntimeManager.getSofaRuntimeContext()));
    componentManager.registerComponentClient(ReferenceClient.class, new ReferenceClientImpl(sofaRuntimeManager.getSofaRuntimeContext()));
    sofaFramework.registerSofaRuntimeManager(sofaRuntimeManager);
}
Also used : ClientFactoryImpl(com.alipay.sofa.runtime.client.impl.ClientFactoryImpl) ClientFactoryInternal(com.alipay.sofa.runtime.spi.client.ClientFactoryInternal) SofaFrameworkImpl(com.alipay.sofa.runtime.SofaFrameworkImpl) AppConfiguration(com.alipay.sofa.runtime.api.component.AppConfiguration) ComponentManager(com.alipay.sofa.runtime.spi.component.ComponentManager) ReferenceClientImpl(com.alipay.sofa.runtime.service.client.ReferenceClientImpl) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ServiceClientImpl(com.alipay.sofa.runtime.service.client.ServiceClientImpl) SofaRuntimeManager(com.alipay.sofa.runtime.spi.component.SofaRuntimeManager) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager)

Aggregations

SofaFrameworkImpl (com.alipay.sofa.runtime.SofaFrameworkImpl)1 AppConfiguration (com.alipay.sofa.runtime.api.component.AppConfiguration)1 ClientFactoryImpl (com.alipay.sofa.runtime.client.impl.ClientFactoryImpl)1 StandardSofaRuntimeManager (com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager)1 ReferenceClientImpl (com.alipay.sofa.runtime.service.client.ReferenceClientImpl)1 ServiceClientImpl (com.alipay.sofa.runtime.service.client.ServiceClientImpl)1 ClientFactoryInternal (com.alipay.sofa.runtime.spi.client.ClientFactoryInternal)1 ComponentManager (com.alipay.sofa.runtime.spi.component.ComponentManager)1 SofaRuntimeManager (com.alipay.sofa.runtime.spi.component.SofaRuntimeManager)1