Search in sources :

Example 1 with ExtensionPointComponent

use of com.alipay.sofa.runtime.ext.component.ExtensionPointComponent in project sofa-boot by sofastack.

the class ExtensionPointFactoryBean method publishAsNuxeoExtensionPoint.

private void publishAsNuxeoExtensionPoint(Class<?> beanClass) throws Exception {
    Assert.notNull(beanClass, "Service must be implement!");
    ExtensionPointBuilder extensionPointBuilder = ExtensionPointBuilder.genericExtensionPoint(this.name, applicationContext.getClassLoader());
    if (this.contribution != null && this.contribution.length != 0) {
        for (int i = 0; i < contribution.length; i++) {
            extensionPointBuilder.addContribution(contribution[i]);
        }
    }
    Assert.hasLength(beanName, "required property 'beanName' has not been set for creating implementation");
    Assert.notNull(applicationContext, "required property 'applicationContext' has not been set for creating implementation");
    Implementation implementation = new SpringImplementationImpl(targetBeanName, applicationContext);
    ComponentInfo extensionPointComponent = new ExtensionPointComponent(extensionPointBuilder.getExtensionPoint(), sofaRuntimeContext, implementation);
    extensionPointComponent.setApplicationContext(applicationContext);
    sofaRuntimeContext.getComponentManager().register(extensionPointComponent);
}
Also used : ComponentInfo(com.alipay.sofa.runtime.spi.component.ComponentInfo) ExtensionPointComponent(com.alipay.sofa.runtime.ext.component.ExtensionPointComponent) Implementation(com.alipay.sofa.runtime.spi.component.Implementation) SpringImplementationImpl(com.alipay.sofa.runtime.spi.spring.SpringImplementationImpl)

Example 2 with ExtensionPointComponent

use of com.alipay.sofa.runtime.ext.component.ExtensionPointComponent in project sofa-boot by alipay.

the class ExtensionClientImpl method publishExtensionPoint.

@Override
public void publishExtensionPoint(ExtensionPointParam extensionPointParam) {
    Assert.notNull(extensionPointParam, "extensionPointParam can not be null.");
    Assert.notNull(extensionPointParam.getName(), "Extension point name can not be null.");
    Assert.notNull(extensionPointParam.getContributionClass(), "Extension point contribution can not be null.");
    Assert.notNull(extensionPointParam.getTarget(), "Extension point target can not be null.");
    ExtensionPoint extensionPoint = new ExtensionPointImpl(extensionPointParam.getName(), extensionPointParam.getContributionClass());
    Implementation implementation = new DefaultImplementation(extensionPointParam.getTargetName());
    implementation.setTarget(extensionPointParam.getTarget());
    ComponentInfo extensionPointComponent = new ExtensionPointComponent(extensionPoint, sofaRuntimeContext, implementation);
    sofaRuntimeContext.getComponentManager().register(extensionPointComponent);
}
Also used : ExtensionPoint(com.alipay.sofa.service.api.component.ExtensionPoint) ExtensionPointImpl(com.alipay.sofa.runtime.ext.component.ExtensionPointImpl) DefaultImplementation(com.alipay.sofa.runtime.spi.component.DefaultImplementation) ComponentInfo(com.alipay.sofa.runtime.spi.component.ComponentInfo) ExtensionPointComponent(com.alipay.sofa.runtime.ext.component.ExtensionPointComponent) DefaultImplementation(com.alipay.sofa.runtime.spi.component.DefaultImplementation) Implementation(com.alipay.sofa.runtime.spi.component.Implementation)

Example 3 with ExtensionPointComponent

use of com.alipay.sofa.runtime.ext.component.ExtensionPointComponent in project sofa-boot by alipay.

the class ExtensionPointFactoryBean method publishAsNuxeoExtensionPoint.

private void publishAsNuxeoExtensionPoint(Class<?> beanClass) throws Exception {
    Assert.notNull(beanClass, "Service must be implement!");
    ExtensionPointBuilder extensionPointBuilder = ExtensionPointBuilder.genericExtensionPoint(this.name, applicationContext.getClassLoader());
    if (this.contribution != null && this.contribution.length != 0) {
        for (int i = 0; i < contribution.length; i++) {
            extensionPointBuilder.addContribution(contribution[i]);
        }
    }
    Assert.hasLength(beanName, "required property 'beanName' has not been set for creating implementation");
    Assert.notNull(applicationContext, "required property 'applicationContext' has not been set for creating implementation");
    Implementation implementation = new SpringImplementationImpl(targetBeanName, applicationContext);
    ComponentInfo extensionPointComponent = new ExtensionPointComponent(extensionPointBuilder.getExtensionPoint(), sofaRuntimeContext, implementation);
    extensionPointComponent.setApplicationContext(applicationContext);
    sofaRuntimeContext.getComponentManager().register(extensionPointComponent);
}
Also used : ComponentInfo(com.alipay.sofa.runtime.spi.component.ComponentInfo) ExtensionPointComponent(com.alipay.sofa.runtime.ext.component.ExtensionPointComponent) Implementation(com.alipay.sofa.runtime.spi.component.Implementation) SpringImplementationImpl(com.alipay.sofa.runtime.spi.spring.SpringImplementationImpl)

Example 4 with ExtensionPointComponent

use of com.alipay.sofa.runtime.ext.component.ExtensionPointComponent in project sofa-boot by sofastack.

the class ExtensionClientImpl method publishExtensionPoint.

@Override
public void publishExtensionPoint(ExtensionPointParam extensionPointParam) {
    Assert.notNull(extensionPointParam, "extensionPointParam can not be null.");
    Assert.notNull(extensionPointParam.getName(), "Extension point name can not be null.");
    Assert.notNull(extensionPointParam.getContributionClass(), "Extension point contribution can not be null.");
    Assert.notNull(extensionPointParam.getTarget(), "Extension point target can not be null.");
    ExtensionPoint extensionPoint = new ExtensionPointImpl(extensionPointParam.getName(), extensionPointParam.getContributionClass());
    Implementation implementation = new DefaultImplementation(extensionPointParam.getTargetName());
    implementation.setTarget(extensionPointParam.getTarget());
    ComponentInfo extensionPointComponent = new ExtensionPointComponent(extensionPoint, sofaRuntimeContext, implementation);
    sofaRuntimeContext.getComponentManager().register(extensionPointComponent);
}
Also used : ExtensionPoint(com.alipay.sofa.service.api.component.ExtensionPoint) ExtensionPointImpl(com.alipay.sofa.runtime.ext.component.ExtensionPointImpl) DefaultImplementation(com.alipay.sofa.runtime.spi.component.DefaultImplementation) ComponentInfo(com.alipay.sofa.runtime.spi.component.ComponentInfo) ExtensionPointComponent(com.alipay.sofa.runtime.ext.component.ExtensionPointComponent) DefaultImplementation(com.alipay.sofa.runtime.spi.component.DefaultImplementation) Implementation(com.alipay.sofa.runtime.spi.component.Implementation)

Aggregations

ExtensionPointComponent (com.alipay.sofa.runtime.ext.component.ExtensionPointComponent)4 ComponentInfo (com.alipay.sofa.runtime.spi.component.ComponentInfo)4 Implementation (com.alipay.sofa.runtime.spi.component.Implementation)4 ExtensionPointImpl (com.alipay.sofa.runtime.ext.component.ExtensionPointImpl)2 DefaultImplementation (com.alipay.sofa.runtime.spi.component.DefaultImplementation)2 SpringImplementationImpl (com.alipay.sofa.runtime.spi.spring.SpringImplementationImpl)2 ExtensionPoint (com.alipay.sofa.service.api.component.ExtensionPoint)2