public void regSchemaMeta(SchemaMeta schemaMeta) { idSchemaMetaMgr.register(schemaMeta.getSchemaId(), schemaMeta); regSchemaAndInterface(schemaMeta); for (OperationMeta operationMeta : schemaMeta.getOperations()) { regOperation(operationMeta.getSchemaQualifiedName(), operationMeta); } }
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()); }
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; }