use of org.apache.dubbo.rpc.model.ServiceDescriptor in project dubbo by alibaba.
the class SimpleRegistryExporter method registerProvider.
private void registerProvider(URL url, RegistryService registryService) {
ServiceRepository repository = ApplicationModel.getServiceRepository();
ServiceDescriptor serviceDescriptor = repository.registerService(RegistryService.class);
repository.registerProvider(url.getServiceKey(), registryService, serviceDescriptor, null, null);
}
use of org.apache.dubbo.rpc.model.ServiceDescriptor in project dubbo by alibaba.
the class ReferenceConfig method checkAndUpdateSubConfigs.
/**
* This method should be called right after the creation of this class's instance, before any property in other config modules is used.
* Check each config modules are created properly and override their properties if necessary.
*/
public void checkAndUpdateSubConfigs() {
if (StringUtils.isEmpty(interfaceName)) {
throw new IllegalStateException("<dubbo:reference interface=\"\" /> interface not allow null!");
}
completeCompoundConfigs(consumer);
// get consumer's global configuration
checkDefault();
// init some null configuration.
List<ConfigInitializer> configInitializers = ExtensionLoader.getExtensionLoader(ConfigInitializer.class).getActivateExtension(URL.valueOf("configInitializer://"), (String[]) null);
configInitializers.forEach(e -> e.initReferConfig(this));
this.refresh();
if (getGeneric() == null && getConsumer() != null) {
setGeneric(getConsumer().getGeneric());
}
if (ProtocolUtils.isGeneric(generic)) {
interfaceClass = GenericService.class;
} else {
try {
interfaceClass = Class.forName(interfaceName, true, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e.getMessage(), e);
}
checkInterfaceAndMethods(interfaceClass, getMethods());
}
initServiceMetadata(consumer);
serviceMetadata.setServiceType(getActualInterface());
// TODO, uncomment this line once service key is unified
serviceMetadata.setServiceKey(URL.buildKey(interfaceName, group, version));
ServiceRepository repository = ApplicationModel.getServiceRepository();
ServiceDescriptor serviceDescriptor = repository.registerService(interfaceClass);
repository.registerConsumer(serviceMetadata.getServiceKey(), serviceDescriptor, this, null, serviceMetadata);
resolveFile();
ConfigValidationUtils.validateReferenceConfig(this);
postProcessConfig();
}
use of org.apache.dubbo.rpc.model.ServiceDescriptor in project dubbo by alibaba.
the class ListTelnetHandlerTest method registerProvider.
private void registerProvider(String key, Object impl, Class<?> interfaceClass) {
ServiceConfigBase sc = mock(ServiceConfigBase.class);
given(sc.getRegistries()).willReturn(new ArrayList<>());
ServiceDescriptor serviceDescriptor = repository.registerService(interfaceClass);
repository.registerProvider(key, impl, serviceDescriptor, sc, null);
}
use of org.apache.dubbo.rpc.model.ServiceDescriptor in project dubbo by alibaba.
the class SelectTelnetHandlerTest method registerProvider.
private void registerProvider(String key, Object impl, Class<?> interfaceClass) {
ServiceDescriptor serviceDescriptor = repository.registerService(interfaceClass);
repository.registerProvider(key, impl, serviceDescriptor, null, null);
}
use of org.apache.dubbo.rpc.model.ServiceDescriptor in project dubbo by alibaba.
the class RpcInvocation method initParameterDesc.
private void initParameterDesc() {
ServiceRepository repository = ApplicationModel.getServiceRepository();
if (StringUtils.isNotEmpty(serviceName)) {
ServiceDescriptor serviceDescriptor = repository.lookupService(serviceName);
if (serviceDescriptor != null) {
MethodDescriptor methodDescriptor = serviceDescriptor.getMethod(methodName, parameterTypes);
if (methodDescriptor != null) {
this.parameterTypesDesc = methodDescriptor.getParamDesc();
this.compatibleParamSignatures = methodDescriptor.getCompatibleParamSignatures();
this.returnTypes = methodDescriptor.getReturnTypes();
this.returnType = methodDescriptor.getReturnClass();
}
}
}
if (parameterTypesDesc == null) {
this.parameterTypesDesc = ReflectUtils.getDesc(this.getParameterTypes());
this.compatibleParamSignatures = Stream.of(this.parameterTypes).map(Class::getName).toArray(String[]::new);
this.returnTypes = RpcUtils.getReturnTypes(this);
this.returnType = RpcUtils.getReturnType(this);
}
}
Aggregations