Tabnine Logo
SchemaMeta
Code IndexAdd Tabnine to your IDE (free)

How to use
SchemaMeta
in
io.servicecomb.core.definition

Best Java code snippets using io.servicecomb.core.definition.SchemaMeta (Showing top 19 results out of 315)

origin: io.servicecomb/java-chassis-core

/**
 * consumer端使用,schemaMeta级别的缓存,每次调用根据operationName来执行
 */
public static Invocation forConsumer(ReferenceConfig referenceConfig, SchemaMeta schemaMeta, String operationName,
  Object[] swaggerArguments) {
 OperationMeta operationMeta = schemaMeta.ensureFindOperation(operationName);
 return forConsumer(referenceConfig, operationMeta, swaggerArguments);
}
origin: io.servicecomb/java-chassis-core

public void init(SchemaMeta schemaMeta, Method method, String operationPath, String httpMethod,
  Operation swaggerOperation) {
 this.schemaMeta = schemaMeta;
 schemaQualifiedName = schemaMeta.getSchemaId() + "." + method.getName();
 microserviceQualifiedName = schemaMeta.getMicroserviceName() + "." + schemaQualifiedName;
 this.operationPath = operationPath;
 this.method = method;
 this.httpMethod = httpMethod.toUpperCase(Locale.US);
 this.swaggerOperation = swaggerOperation;
 executor = ExecutorManager.findExecutor(this);
 collectMethodType();
 responsesMeta.init(schemaMeta.getMicroserviceMeta().getClassLoader(),
   schemaMeta.getPackageName(),
   schemaMeta.getSwagger(),
   swaggerOperation,
   method.getGenericReturnType());
}
origin: io.servicecomb/common-rest

public void addSchema(SchemaMeta schemaMeta) {
 if (isSchemaExists(schemaMeta.getSchemaId())) {
  return;
 }
 schemaIdSet.add(schemaMeta.getSchemaId());
 for (OperationMeta operationMeta : schemaMeta.getOperations()) {
  RestOperationMeta restOperationMeta = new RestOperationMeta();
  restOperationMeta.init(operationMeta);
  operationMeta.putExtData(RestConst.SWAGGER_REST_OPERATION, restOperationMeta);
  addResource(restOperationMeta);
 }
 LOGGER.info("add schema to service paths. {}:{}:{}.",
   schemaMeta.getMicroserviceMeta().getAppId(),
   schemaMeta.getMicroserviceName(),
   schemaMeta.getSchemaId());
}
origin: io.servicecomb/java-chassis-core

public List<Handler> getHandlerChain() {
 return (InvocationType.CONSUMER.equals(invocationType)) ? schemaMeta.getConsumerHandlerChain()
   : schemaMeta.getProviderHandlerChain();
}
origin: io.servicecomb/java-chassis-core

public void regSchemaMeta(SchemaMeta schemaMeta) {
 idSchemaMetaMgr.register(schemaMeta.getSchemaId(), schemaMeta);
 regSchemaAndInterface(schemaMeta);
 for (OperationMeta operationMeta : schemaMeta.getOperations()) {
  regOperation(operationMeta.getSchemaQualifiedName(), operationMeta);
 }
}
origin: io.servicecomb/java-chassis-core

 public void init() throws Exception {
  for (ProducerProvider provider : producerProviderList) {
   provider.init();
  }

  Microservice microservice = RegistryUtils.getMicroservice();
  MicroserviceMeta microserviceMeta = microserviceMetaManager.getOrCreateMicroserviceMeta(microservice);
  for (SchemaMeta schemaMeta : microserviceMeta.getSchemaMetas()) {
   String content = SchemaUtils.swaggerToString(schemaMeta.getSwagger());
   microservice.addSchema(schemaMeta.getSchemaId(), content);
  }
 }
}
origin: io.servicecomb/java-chassis-core

public SchemaMeta getOrCreateProducerSchema(String microserviceName, String schemaId,
  Class<?> producerClass,
  Object producerInstance) {
 MicroserviceMeta microserviceMeta = microserviceMetaManager.getOrCreateMicroserviceMeta(microserviceName);
 ProducerSchemaContext context = new ProducerSchemaContext();
 context.setMicroserviceMeta(microserviceMeta);
 context.setSchemaId(schemaId);
 context.setProviderClass(producerClass);
 context.setProducerInstance(producerInstance);
 SchemaMeta schemaMeta = getOrCreateSchema(context);
 SwaggerProducer producer = swaggerEnv.createProducer(producerInstance, schemaMeta.getSwagger());
 for (OperationMeta operationMeta : schemaMeta.getOperations()) {
  SwaggerProducerOperation producerOperation = producer.findOperation(operationMeta.getOperationId());
  operationMeta.putExtData(Const.PRODUCER_OPERATION, producerOperation);
 }
 return schemaMeta;
}
origin: io.servicecomb/java-chassis-core

public SchemaMeta registerSchema(MicroserviceMeta microserviceMeta, String schemaId,
  Swagger swagger) {
 String microserviceName = microserviceMeta.getName();
 LOGGER.info("register schema {}/{}/{}", microserviceMeta.getAppId(), microserviceName, schemaId);
 SchemaMeta schemaMeta = new SchemaMeta(swagger, microserviceMeta, schemaId);
 List<Handler> producerHandlerChain = ProducerHandlerManager.INSTANCE.getOrCreate(microserviceName);
 schemaMeta.setProviderHandlerChain(producerHandlerChain);
 List<Handler> consumerHandlerChain = ConsumerHandlerManager.INSTANCE.getOrCreate(microserviceName);
 schemaMeta.setConsumerHandlerChain(consumerHandlerChain);
 microserviceMeta.regSchemaMeta(schemaMeta);
 putSelfBasePathIfAbsent(microserviceName, swagger.getBasePath());
 return schemaMeta;
}
origin: io.servicecomb/java-chassis-core

private void regSchemaAndInterface(SchemaMeta schemaMeta) {
 Class<?> intf = schemaMeta.getSwaggerIntf();
 synchronized (intfSchemaLock) {
  List<SchemaMeta> schemaList = intfSchemaMetaMgr.computeIfAbsent(intf, k -> new ArrayList<>());
  schemaList.add(schemaMeta);
 }
}
origin: io.servicecomb/java-chassis-core

public String getSchemaId() {
 return schemaMeta.getSchemaId();
}
origin: io.servicecomb/java-chassis-core

public String getMicroserviceName() {
 return schemaMeta.getMicroserviceName();
}
origin: io.servicecomb/java-chassis-core

public String getAppId() {
 return schemaMeta.getMicroserviceMeta().getAppId();
}
origin: io.servicecomb/java-chassis-core

public SchemaMeta(Swagger swagger, MicroserviceMeta microserviceMeta, String schemaId) {
 this.packageName = SchemaUtils.generatePackageName(microserviceMeta, schemaId);
 this.swagger = swagger;
 this.name = schemaId;
 this.microserviceMeta = microserviceMeta;
 this.microserviceQualifiedName = microserviceMeta.getName() + "." + schemaId;
 // 确保swagger对应的接口是存在的
 swaggerIntf = ClassUtils.getOrCreateInterface(swagger, microserviceMeta.getClassLoader(), packageName);
 createOperationMgr("schemaMeta " + schemaId + " operation mgr");
 operationMgr.setRegisterErrorFmt("Operation name repeat, schema=%s, operation=%s");
 initOperations();
}
origin: io.servicecomb/common-rest

public void init(OperationMeta operationMeta) {
 this.operationMeta = operationMeta;
 Swagger swagger = operationMeta.getSchemaMeta().getSwagger();
 Operation operation = operationMeta.getSwaggerOperation();
 this.produces = operation.getProduces();
 if (produces == null) {
  this.produces = swagger.getProduces();
 }
 this.createProduceProcessors();
 Method method = operationMeta.getMethod();
 Type[] genericParamTypes = method.getGenericParameterTypes();
 if (genericParamTypes.length != operation.getParameters().size()) {
  throw new Error("Param count is not equal between swagger and method,  path=" + absolutePath);
 }
 // 初始化所有rest param
 for (int idx = 0; idx < genericParamTypes.length; idx++) {
  Parameter parameter = operation.getParameters().get(idx);
  Type genericParamType = genericParamTypes[idx];
  if ("formData".equals(parameter.getIn())) {
   formData = true;
  }
  RestParam param = new RestParam(idx, parameter, genericParamType);
  addParam(param);
 }
 setAbsolutePath(concatPath(swagger.getBasePath(), operationMeta.getOperationPath()));
}
origin: io.servicecomb/provider-pojo

protected void prepare() {
 referenceConfig = ReferenceConfigUtils.getForInvoke(microserviceName);
 MicroserviceMeta microserviceMeta = referenceConfig.getMicroserviceMeta();
 if (StringUtils.isEmpty(schemaId)) {
  // 未指定schemaId,看看consumer接口是否等于契约接口
  schemaMeta = microserviceMeta.findSchemaMeta(consumerIntf);
  if (schemaMeta == null) {
   // 尝试用consumer接口名作为schemaId
   schemaId = consumerIntf.getName();
   schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
  }
 } else {
  schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
 }
 this.swaggerConsumer = CseContext.getInstance().getSwaggerEnvironment().createConsumer(consumerIntf,
   schemaMeta.getSwaggerIntf());
}
origin: io.servicecomb/java-chassis-core

Operation operation = operationEntry.getValue();
if (operation.getOperationId() == null) {
 throw ExceptionUtils.operationIdInvalid(getSchemaId(), strPath);
   operation.getOperationId(),
   swaggerIntf.getName(),
   getSchemaId());
 continue;
origin: io.servicecomb/java-chassis-core

public String getMicroserviceName() {
 return schemaMeta.getMicroserviceName();
}
origin: io.servicecomb/common-rest

@Override
public void onSchemaLoaded(SchemaMeta... schemaMetas) {
 // 此时相应的ServicePathManager可能正在被使用,为避免太高的复杂度,使用copy on write逻辑
 Map<String, ServicePathManager> mgrMap = new HashMap<>();
 for (SchemaMeta schemaMeta : schemaMetas) {
  MicroserviceMeta microserviceMeta = schemaMeta.getMicroserviceMeta();
  ServicePathManager mgr = findPathManager(mgrMap, microserviceMeta);
  mgr.addSchema(schemaMeta);
 }
 for (ServicePathManager mgr : mgrMap.values()) {
  // 对具有动态path operation进行排序
  mgr.sortPath();
  mgr.saveToMicroserviceMeta();
 }
}
origin: io.servicecomb/transport-grpc

private void doInit(RoutingContext routingContext) throws Exception {
  String schemaId = routingContext.pathParam("schema");
  String operationName = routingContext.pathParam("operation");
  MicroserviceMeta microserviceMeta =
    microserviceMetaManager.ensureFindValue(routingContext.request().getHeader(Const.DEST_MICROSERVICE));
  SchemaMeta schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
  this.routingContext = routingContext;
  this.operationMeta = schemaMeta.ensureFindOperation(operationName);
  this.operationProtobuf = ProtobufManager.getOrCreateOperation(operationMeta);
}
io.servicecomb.core.definitionSchemaMeta

Most used methods

  • ensureFindOperation
  • getMicroserviceMeta
  • getMicroserviceName
  • getOperations
  • getSchemaId
  • getSwagger
  • getSwaggerIntf
  • <init>
  • createOperationMgr
  • getConsumerHandlerChain
  • getMicroserviceQualifiedName
  • getName
  • getMicroserviceQualifiedName,
  • getName,
  • getPackageName,
  • getProviderHandlerChain,
  • initOperations,
  • setConsumerHandlerChain,
  • setProviderHandlerChain

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Permission (java.security)
    Legacy security code; do not use.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Notification (javax.management)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now