Quellcode durchsuchen

SwaggerConfig使用新的ApiInfo

Airhead vor 8 Jahren
Ursprung
Commit
0f551115e1
27 geänderte Dateien mit 179 neuen und 602 gelöschten Zeilen
  1. 1 9
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/HosArbiterApplication.java
  2. 2 26
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/configuration/ArbiterServerConfiguration.java
  3. 1 2
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/ArbiterServerController.java
  4. 1 2
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/BrokerServerController.java
  5. 1 2
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/EndpointController.java
  6. 19 0
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/ServiceFlowController.java
  7. 11 10
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/ArbiterServerService.java
  8. 1 1
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/BrokerServerService.java
  9. 2 2
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/EndpointService.java
  10. 1 1
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/HealthCheckService.java
  11. 1 1
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/LinuxShellService.java
  12. 1 1
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/MycatService.java
  13. 1 35
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/ServiceFlowService.java
  14. 9 5
      hos-arbiter/src/main/resources/application.yml
  15. 3 1
      hos-broker/src/main/java/com/yihu/hos/broker/HosBrokerApplication.java
  16. 12 63
      hos-broker/src/main/java/com/yihu/hos/broker/daos/BrokerDao.java
  17. 0 187
      hos-broker/src/main/java/com/yihu/hos/broker/models/SystemServiceEndpoint.java
  18. 0 113
      hos-broker/src/main/java/com/yihu/hos/broker/models/SystemServiceFlow.java
  19. 0 75
      hos-broker/src/main/java/com/yihu/hos/broker/models/SystemServiceFlowClass.java
  20. 7 7
      hos-broker/src/main/java/com/yihu/hos/broker/services/ServiceMonitorService.java
  21. 39 39
      hos-broker/src/main/resources/application.yml
  22. 1 1
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/models/ArbiterServer.java
  23. 1 1
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/models/BrokerServer.java
  24. 12 2
      hos-arbiter/src/main/java/com/yihu/hos/arbiter/models/Endpoint.java
  25. 36 0
      hos-web-framework/src/main/java/com/yihu/hos/web/framework/model/bo/ServiceFlow.java
  26. 1 1
      hos-web-framework/src/main/java/com/yihu/hos/web/framework/model/bo/ServiceShell.java
  27. 15 15
      src/main/resources/application.yml

+ 1 - 9
hos-arbiter/src/main/java/com/yihu/hos/arbiter/HosArbiterApplication.java

@ -25,17 +25,9 @@ public class HosArbiterApplication implements CommandLineRunner {
    @Override
    public void run(String... strings) throws Exception {
//        if (configuration.isCentral()) {
//            MqServerConfig config = new MqServerConfig();
//            config.serverPort = configuration.getCentralPort();
//            config.storePath = configuration.getCentralStore();
//            final MqServer server = new MqServer(config);
//            server.start();
//        }
        proxyService.start();
        shellService.start();
        mycatProxy.start();;
        mycatProxy.start();
    }
    @Autowired

+ 2 - 26
hos-arbiter/src/main/java/com/yihu/hos/arbiter/configuration/ArbiterServerConfiguration.java

@ -1,6 +1,5 @@
package com.yihu.hos.arbiter.configuration;
import com.yihu.hos.core.datatype.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -16,10 +15,6 @@ import java.io.IOException;
public class ArbiterServerConfiguration {
    @Value("${arbiter.central.url}")
    private String centralUrl;
    @Value("${arbiter.central.port}")
    private Integer centralPort;
    @Value("${arbiter.central.store}")
    private String centralStore;
    @Value("${arbiter.terminal.url}")
    private String terminalUrl;
    @Value("${arbiter.tenant.name}")
@ -45,26 +40,11 @@ public class ArbiterServerConfiguration {
        return tenant;
    }
    public boolean isCentral() {
        return StringUtil.isEmpty(centralUrl);
    }
    public Integer getCentralPort() {
        return centralPort;
    }
    public String getCentralStore() {
        return centralStore;
    }
    @Bean
    public ZbusBroker getZbusBroker() {
        try {
            if (isCentral()){
                zbusBroker = new ZbusBroker(this.terminalUrl);
            }else {
                zbusBroker = new ZbusBroker(this.centralUrl);
            }
            zbusBroker = new ZbusBroker(this.centralUrl);
            return zbusBroker;
        } catch (IOException e) {
            e.printStackTrace();
@ -80,8 +60,4 @@ public class ArbiterServerConfiguration {
        super.finalize();
    }
//    public boolean isTerminal() {
//        return !isCentral();
//    }
}

+ 1 - 2
hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/ArbiterServerController.java

@ -1,7 +1,7 @@
package com.yihu.hos.arbiter.controllers;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.models.ArbiterServer;
import com.yihu.hos.web.framework.model.bo.ArbiterServer;
import com.yihu.hos.arbiter.services.ArbiterServerService;
import com.yihu.hos.core.datatype.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Date;
/**
 * @author Airhead

+ 1 - 2
hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/BrokerServerController.java

@ -2,7 +2,7 @@ package com.yihu.hos.arbiter.controllers;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.models.BrokerServer;
import com.yihu.hos.web.framework.model.bo.BrokerServer;
import com.yihu.hos.arbiter.services.BrokerServerService;
import com.yihu.hos.core.datatype.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Date;
/**
 * @created Airhead 2016/7/27.

+ 1 - 2
hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/EndpointController.java

@ -1,7 +1,7 @@
package com.yihu.hos.arbiter.controllers;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.models.Endpoint;
import com.yihu.hos.web.framework.model.bo.Endpoint;
import com.yihu.hos.arbiter.services.EndpointService;
import com.yihu.hos.core.datatype.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Date;
/**
 * @created Airhead 2016/7/27.

+ 19 - 0
hos-arbiter/src/main/java/com/yihu/hos/arbiter/controllers/ServiceFlowController.java

@ -0,0 +1,19 @@
package com.yihu.hos.arbiter.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author Airhead
 * @since 2017/2/6.
 */
@RestController
@RequestMapping("/serviceFlow")
public class ServiceFlowController {
    @RequestMapping(method = RequestMethod.GET)
    public String get() {
        return "{}";
    }
}

+ 11 - 10
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/ArbiterServerService.java

@ -1,8 +1,7 @@
package com.yihu.hos.arbiter.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.configuration.ArbiterServerConfiguration;
import com.yihu.hos.arbiter.models.ArbiterServer;
import com.yihu.hos.web.framework.model.bo.ArbiterServer;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,21 +19,23 @@ import org.springframework.stereotype.Service;
public class ArbiterServerService {
    private static final Logger logger = LogManager.getLogger(ArbiterServerService.class);
    @Autowired
    private MongoOperations mongoOperations;
    @Autowired
    private ArbiterServerConfiguration configuration;
    @Autowired
    private ObjectMapper objectMapper;
    public ArbiterServerService() {
    }
    @Autowired
    public void setMongoOperations(MongoOperations mongoOperations){
        this.mongoOperations = mongoOperations;
    }
    @Autowired
    public void setConfiguration(ArbiterServerConfiguration configuration){
        this.configuration = configuration;
    }
    public void start() {
        //中心Arbiter服务器直接注册
        if (configuration.isCentral()) {
            return;
        }
        ArbiterServer arbiterServer = new ArbiterServer();
        arbiterServer.setTenant(configuration.getTenant());

+ 1 - 1
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/BrokerServerService.java

@ -3,7 +3,7 @@ package com.yihu.hos.arbiter.services;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.WriteResult;
import com.yihu.hos.arbiter.models.BrokerServer;
import com.yihu.hos.web.framework.model.bo.BrokerServer;
import com.yihu.hos.core.http.HTTPResponse;
import com.yihu.hos.core.http.HttpClientKit;
import com.yihu.hos.web.framework.constant.ServiceFlowConstant;

+ 2 - 2
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/EndpointService.java

@ -1,8 +1,8 @@
package com.yihu.hos.arbiter.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.models.BrokerServer;
import com.yihu.hos.arbiter.models.Endpoint;
import com.yihu.hos.web.framework.model.bo.BrokerServer;
import com.yihu.hos.web.framework.model.bo.Endpoint;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.log4j.LogManager;

+ 1 - 1
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/HealthCheckService.java

@ -1,6 +1,6 @@
package com.yihu.hos.arbiter.services;
import com.yihu.hos.arbiter.models.Endpoint;
import com.yihu.hos.web.framework.model.bo.Endpoint;
import org.springframework.stereotype.Service;
import java.util.ArrayList;

+ 1 - 1
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/LinuxShellService.java

@ -1,7 +1,7 @@
package com.yihu.hos.arbiter.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.models.BrokerServer;
import com.yihu.hos.web.framework.model.bo.BrokerServer;
import com.yihu.hos.core.http.HTTPResponse;
import com.yihu.hos.core.http.HttpClientKit;
import com.yihu.hos.web.framework.constant.ServiceFlowConstant;

+ 1 - 1
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/MycatService.java

@ -1,7 +1,7 @@
package com.yihu.hos.arbiter.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.arbiter.models.BrokerServer;
import com.yihu.hos.web.framework.model.bo.BrokerServer;
import com.yihu.hos.core.http.HTTPResponse;
import com.yihu.hos.core.http.HttpClientKit;
import com.yihu.hos.web.framework.constant.ServiceFlowConstant;

+ 1 - 35
hos-arbiter/src/main/java/com/yihu/hos/arbiter/services/ServiceFlowService.java

@ -3,13 +3,11 @@ package com.yihu.hos.arbiter.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.BasicDBObject;
import com.mongodb.WriteResult;
import com.yihu.hos.arbiter.models.BrokerServer;
import com.yihu.hos.web.framework.model.bo.BrokerServer;
import com.yihu.hos.core.http.HTTPResponse;
import com.yihu.hos.core.http.HttpClientKit;
import com.yihu.hos.web.framework.constant.ServiceFlowConstant;
import com.yihu.hos.web.framework.model.bo.ServiceFlow;
import org.apache.camel.Body;
import org.apache.camel.Headers;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,7 +20,6 @@ import org.zbus.broker.ZbusBroker;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
 * Broker原则上具有等同性,这样Arbiter无论选择了哪个Broker能提供的服务都是一样的。
@ -349,37 +346,6 @@ public class ServiceFlowService {
        //可以不用处理。
    }
    /**
     * SAAS化的管理端过来的消息会被proxy进行中转,之后发送到终端的Arbiter对Broker进行实际的控制。
     *
     * @param header 消息头部信息
     * @param msg    消息
     */
    public void proxy(@Headers Map<String, String> header, @Body String msg) {
//        if (zbusBroker == null) {
//            logger.error("zbusBroker is null.");
//            return;
//        }
//
//        try {
//            Producer producer = new Producer(zbusBroker, ServiceFlowConstant.SSH + "@" + header.get("tenant"));
//            producer.createMQ();    //确定为创建消息队列需要显示调用
//            Message message = new Message();
//            message.setHead("event", header.get("event"));
//            message.setHead("tenant", header.get("tenant"));
////            message.setHead(header);
//            message.setMethod("POST");
//            message.setBody(msg);
//            message = producer.sendSync(message);
//            logger.debug(message);
////            System.out.println("test");
//        } catch (IOException | InterruptedException e) {
//            logger.error(e.getMessage());
//            e.printStackTrace();
//        }
    }
    @Autowired
    public void setZbusBroker(ZbusBroker zbusBroker) {
        this.zbusBroker = zbusBroker;

+ 9 - 5
hos-arbiter/src/main/resources/application.yml

@ -36,27 +36,29 @@ spring:
  profiles: test
  data:
    mongodb:
      host: 172.19.103.58
      host: 172.19.103.57
      port: 27017
      username: esb
      password: esb
      authenticationDatabase: admin
      database: configuration
      database: runtime
  activemq:
    broker-url: tcp://172.19.103.58:61616
    broker-url: tcp://172.19.103.57:61616
    user: admin
    password: admin
arbiter:
  timer:
      period: 10000
    period: 10000
  central:
    url:
    port: 15555
    store: ./store
  terminal:
    url: 127.0.0.1:15555
    url: 192.168.131.119:15555
  tenant:
    name: jkzl
  mycat:
    name: mycat192.168.75.128    ##mycat 服务器标识,规则:“mycat"+ 本机IP
---
spring:
  profiles: prod
@ -109,6 +111,8 @@ arbiter:
    url: 192.168.131.38:15555
  tenant:
    name: yichang
  mycat:
    name: mycat192.168.131.38    ##mycat 服务器标识,规则:“mycat"+ 本机IP
#jcraft shell操作
jcraft:
  host: 172.19.103.57

+ 3 - 1
hos-broker/src/main/java/com/yihu/hos/broker/HosBrokerApplication.java

@ -6,13 +6,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.mongodb.gridfs.GridFsOperations;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class HosBrokerApplication extends SpringBootServletInitializer implements CommandLineRunner {
    @Autowired
    private GridFsOperations operations;

+ 12 - 63
hos-broker/src/main/java/com/yihu/hos/broker/daos/BrokerDao.java

@ -1,78 +1,27 @@
package com.yihu.hos.broker.daos;
import com.yihu.hos.broker.common.constants.BrokerConstant;
import com.yihu.hos.broker.models.SystemServiceEndpoint;
import com.yihu.hos.broker.models.SystemServiceFlow;
import com.yihu.hos.broker.models.SystemServiceFlowClass;
import com.yihu.hos.web.framework.model.bo.Endpoint;
import com.yihu.hos.web.framework.model.bo.ServiceFlow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.stereotype.Repository;
import java.util.*;
import java.util.List;
@Repository("BrokerDao")
@Repository
public class BrokerDao {
    public static final String BEAN_ID = "BrokerDao";
    private MongoOperations mongoOperations;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public List<SystemServiceFlow> getSystemServiceFlowList() throws Exception {
        List<SystemServiceFlow> systemServiceFlowList = new ArrayList<>();;
        String sql = "select * from system_service_flow t where t.file_type='"+ BrokerConstant.CLASS +"'";
        List list = jdbcTemplate.queryForList(sql);
        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Map map = (Map) iterator.next();
            SystemServiceFlow systemServiceFlow = new SystemServiceFlow();
            systemServiceFlow.setId((Integer) map.get("id"));
            systemServiceFlow.setCode((String) map.get("code"));
            systemServiceFlow.setName((String) map.get("name"));
            systemServiceFlow.setDescription((String) map.get("description"));
            systemServiceFlow.setPath((String) map.get("path"));
            systemServiceFlow.setChart((String) map.get("chart"));
            systemServiceFlow.setValid((Integer) map.get("valid"));
            systemServiceFlow.setCreateDate((Date) map.get("create_date"));
            systemServiceFlowList.add(systemServiceFlow);
        }
        return systemServiceFlowList;
    public void setMongoOperations(MongoOperations mongoOperations) {
        this.mongoOperations = mongoOperations;
    }
    public List<SystemServiceEndpoint> getSystemServiceEndpointList() throws Exception {
        List<SystemServiceEndpoint> systemServieEndpointList = new ArrayList<>();
        String sql = "select * from system_service_endpoint";
        List list = jdbcTemplate.queryForList(sql);
        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Map map = (Map) iterator.next();
            SystemServiceEndpoint systemServiceEndpoint = new SystemServiceEndpoint();
            systemServiceEndpoint.setId((String) map.get("id"));
            systemServiceEndpoint.setCode((String) map.get("code"));
            systemServiceEndpoint.setName((String) map.get("name"));
            systemServieEndpointList.add(systemServiceEndpoint);
        }
        return systemServieEndpointList;
    public List<ServiceFlow> getServiceFlowList() {
        return mongoOperations.findAll(ServiceFlow.class);
    }
    public List<SystemServiceFlowClass> getSystemServiceFlowClassList() throws Exception {
        List<SystemServiceFlowClass> systemServiceFlowClassList = new ArrayList<>();;
        String sql = "select * from system_service_flow_class";
        List list = jdbcTemplate.queryForList(sql);
        Iterator iterator = list.iterator();
        SystemServiceFlowClass systemServiceFlowClass = null;
        while (iterator.hasNext()) {
            Map map = (Map) iterator.next();
            systemServiceFlowClass = new SystemServiceFlowClass();
            systemServiceFlowClass.setId((Integer) map.get("id"));
            systemServiceFlowClass.setClassName((String) map.get("class_name"));
            systemServiceFlowClass.setPackageName((String) map.get("package_name"));
            systemServiceFlowClass.setClassPath((String) map.get("class_path"));
            systemServiceFlowClass.setFlowId((Integer) map.get("flow_id"));
            systemServiceFlowClass.setType((String) map.get("type"));
            systemServiceFlowClassList.add(systemServiceFlowClass);
        }
        return systemServiceFlowClassList;
    public List<Endpoint> getEndPointList() {
        return mongoOperations.findAll(Endpoint.class);
    }
}

+ 0 - 187
hos-broker/src/main/java/com/yihu/hos/broker/models/SystemServiceEndpoint.java

@ -1,187 +0,0 @@
package com.yihu.hos.broker.models;
/**
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/16.
 */
public class SystemServiceEndpoint implements java.io.Serializable {
    private String id;
    private String code;
    private String name;
    private String appId;
    private String version;
    private String description;
    private String endpoint;
    private String requestProtocol;
    private String requestParameterList;
    private String requesModule;
    private String requestMethod;
    private String responeResult;
    private String responeError;
    private Integer healthReportType;
    private String healthEndpoint;
    private Integer metricsReportType;
    private String metricsEndpoint;
    private Integer valid;
    private String requestFormat;
    public SystemServiceEndpoint() {
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getEndpoint() {
        return endpoint;
    }
    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }
    public String getRequestProtocol() {
        return requestProtocol;
    }
    public void setRequestProtocol(String requestProtocol) {
        this.requestProtocol = requestProtocol;
    }
    public String getRequestParameterList() {
        return requestParameterList;
    }
    public void setRequestParameterList(String requestParameterList) {
        this.requestParameterList = requestParameterList;
    }
    public String getRequesModule() {
        return requesModule;
    }
    public void setRequesModule(String requesModule) {
        this.requesModule = requesModule;
    }
    public String getRequestMethod() {
        return requestMethod;
    }
    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }
    public String getResponeResult() {
        return responeResult;
    }
    public void setResponeResult(String responeResult) {
        this.responeResult = responeResult;
    }
    public String getResponeError() {
        return responeError;
    }
    public void setResponeError(String responeError) {
        this.responeError = responeError;
    }
    public Integer getHealthReportType() {
        return healthReportType;
    }
    public void setHealthReportType(Integer healthReportType) {
        this.healthReportType = healthReportType;
    }
    public String getHealthEndpoint() {
        return healthEndpoint;
    }
    public void setHealthEndpoint(String healthEndpoint) {
        this.healthEndpoint = healthEndpoint;
    }
    public Integer getMetricsReportType() {
        return metricsReportType;
    }
    public void setMetricsReportType(Integer metricsReportType) {
        this.metricsReportType = metricsReportType;
    }
    public String getMetricsEndpoint() {
        return metricsEndpoint;
    }
    public void setMetricsEndpoint(String metricsEndpoint) {
        this.metricsEndpoint = metricsEndpoint;
    }
    public Integer getValid() {
        return valid;
    }
    public void setValid(Integer valid) {
        this.valid = valid;
    }
    public String getRequestFormat() {
        return requestFormat;
    }
    public void setRequestFormat(String requestFormat) {
        this.requestFormat = requestFormat;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
}

+ 0 - 113
hos-broker/src/main/java/com/yihu/hos/broker/models/SystemServiceFlow.java

@ -1,113 +0,0 @@
package com.yihu.hos.broker.models;
import java.util.Date;
import java.util.List;
/**
 *  系统管理-服务流程
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/19.
 */
public class SystemServiceFlow implements java.io.Serializable {
    private Integer id;
    private String code;
    private String name;
    private String path;//流程路径
    private String chart;//流程图路径
    private String description;
    private Integer valid;
    private Date createDate;
    private String fileType;
    private String flowClassList;
    private List<SystemServiceFlowClass> flowClassArray;
    public String getFileType() {
        return fileType;
    }
    public void setFileType(String fileType) {
        this.fileType = fileType;
    }
    public String getFlowClassList() {
        return flowClassList;
    }
    public void setFlowClassList(String flowClassList) {
        this.flowClassList = flowClassList;
    }
    public List<SystemServiceFlowClass> getFlowClassArray() {
        return flowClassArray;
    }
    public void setFlowClassArray(List<SystemServiceFlowClass> flowClassArray) {
        this.flowClassArray = flowClassArray;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public String getChart() {
        return chart;
    }
    public void setChart(String chart) {
        this.chart = chart;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public Integer getValid() {
        return valid;
    }
    public void setValid(Integer valid) {
        this.valid = valid;
    }
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
}

+ 0 - 75
hos-broker/src/main/java/com/yihu/hos/broker/models/SystemServiceFlowClass.java

@ -1,75 +0,0 @@
package com.yihu.hos.broker.models;
/**
 *  系统服务流程class
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/19.
 */
public class SystemServiceFlowClass implements java.io.Serializable {
    private Integer id;
    private String className;
    private String packageName;
    private String classPath;
    private Integer flowId;
    private String type;
    //标识 是否有做文件上传
    private String isUpdate;
    public String getIsUpdate() {
        return isUpdate;
    }
    public void setIsUpdate(String isUpdate) {
        this.isUpdate = isUpdate;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getClassName() {
        return className;
    }
    public void setClassName(String className) {
        this.className = className;
    }
    public String getPackageName() {
        return packageName;
    }
    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }
    public String getClassPath() {
        return classPath;
    }
    public void setClassPath(String classPath) {
        this.classPath = classPath;
    }
    public Integer getFlowId() {
        return flowId;
    }
    public void setFlowId(Integer flowId) {
        this.flowId = flowId;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

+ 7 - 7
hos-broker/src/main/java/com/yihu/hos/broker/services/ServiceMonitorService.java

@ -5,11 +5,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.*;
import com.yihu.hos.broker.common.constants.MonitorConstant;
import com.yihu.hos.broker.daos.BrokerDao;
import com.yihu.hos.broker.models.SystemServiceEndpoint;
import com.yihu.hos.broker.models.SystemServiceFlow;
import com.yihu.hos.core.datatype.DateUtil;
import com.yihu.hos.core.datatype.NumberUtil;
import com.yihu.hos.core.datatype.StringUtil;
import com.yihu.hos.web.framework.model.bo.Endpoint;
import com.yihu.hos.web.framework.model.bo.ServiceFlow;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -47,14 +47,14 @@ public class ServiceMonitorService {
            Date beforeDate = new Date(now.getTime() - 60000);
            String beginTime = DateUtil.toString(beforeDate, DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
            String endTime = DateUtil.toString(now, DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
            List<SystemServiceFlow> flowList = brokerDao.getSystemServiceFlowList();
            List<SystemServiceEndpoint> endpointList = brokerDao.getSystemServiceEndpointList();
            List<ServiceFlow> flowList = brokerDao.getServiceFlowList();
            List<Endpoint> endpointList = brokerDao.getEndPointList();
            List<String> codeList = new ArrayList<>();
            for (SystemServiceFlow systemServiceFlow : flowList) {
                codeList.add(systemServiceFlow.getCode());
            for (ServiceFlow systemServiceFlow : flowList) {
                codeList.add(systemServiceFlow.getRouteCode());
            }
            for (SystemServiceEndpoint systemServiceEndpoint : endpointList) {
            for (Endpoint systemServiceEndpoint : endpointList) {
                codeList.add(systemServiceEndpoint.getCode());
            }

+ 39 - 39
hos-broker/src/main/resources/application.yml

@ -17,19 +17,19 @@ camel:
---
spring:
  profiles: dev
  datasource:
    driverClassName: com.mysql.jdbc.Driver
    url: jdbc:mysql://192.168.1.220:8066/hos2?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
    username: hos
    password: 123456
    test-on-borrow: true
    validation-query: SELECT 1
    test-while-idle: true
    max-active: 30
    default-auto-commit: true
    max-idle: 30
    min-idle: 10
    initial-size: 10
#  datasource:
#    driverClassName: com.mysql.jdbc.Driver
#    url: jdbc:mysql://192.168.1.220:8066/hos2?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
#    username: hos
#    password: 123456
#    test-on-borrow: true
#    validation-query: SELECT 1
#    test-while-idle: true
#    max-active: 30
#    default-auto-commit: true
#    max-idle: 30
#    min-idle: 10
#    initial-size: 10
  activemq:
      broker-url: tcp://172.19.103.57:61616
      user: admin
@ -70,19 +70,19 @@ hos:
---
spring:
  profiles: test
  datasource:
      driverClassName: com.mysql.jdbc.Driver
      url: jdbc:mysql://192.168.1.220:8066/hos1?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
      username: hos
      password: 123456
      test-on-borrow: true
      validation-query: SELECT 1
      test-while-idle: true
      max-active: 30
      default-auto-commit: true
      max-idle: 30
      min-idle: 10
      initial-size: 10
#  datasource:
#      driverClassName: com.mysql.jdbc.Driver
#      url: jdbc:mysql://192.168.1.220:8066/hos1?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
#      username: hos
#      password: 123456
#      test-on-borrow: true
#      validation-query: SELECT 1
#      test-while-idle: true
#      max-active: 30
#      default-auto-commit: true
#      max-idle: 30
#      min-idle: 10
#      initial-size: 10
  activemq:
      broker-url: tcp://172.19.103.58:61616
      user: admin
@ -113,19 +113,19 @@ hos:
---
spring:
  profiles: lfq
  datasource:
      driverClassName: com.mysql.jdbc.Driver
      url: jdbc:mysql://172.19.103.57:3306/db1?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
      username: esb
      password: esb
      test-on-borrow: true
      validation-query: SELECT 1
      test-while-idle: true
      max-active: 30
      default-auto-commit: true
      max-idle: 30
      min-idle: 10
      initial-size: 10
#  datasource:
#      driverClassName: com.mysql.jdbc.Driver
#      url: jdbc:mysql://172.19.103.57:3306/db1?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
#      username: esb
#      password: esb
#      test-on-borrow: true
#      validation-query: SELECT 1
#      test-while-idle: true
#      max-active: 30
#      default-auto-commit: true
#      max-idle: 30
#      min-idle: 10
#      initial-size: 10
  activemq:
      broker-url: tcp://172.19.103.58:61616
      user: admin

+ 1 - 1
hos-arbiter/src/main/java/com/yihu/hos/arbiter/models/ArbiterServer.java

@ -1,4 +1,4 @@
package com.yihu.hos.arbiter.models;
package com.yihu.hos.web.framework.model.bo;
import com.yihu.hos.core.datatype.DateUtil;
import org.springframework.data.annotation.Id;

+ 1 - 1
hos-arbiter/src/main/java/com/yihu/hos/arbiter/models/BrokerServer.java

@ -1,4 +1,4 @@
package com.yihu.hos.arbiter.models;
package com.yihu.hos.web.framework.model.bo;
import com.yihu.hos.core.datatype.DateUtil;
import org.springframework.data.annotation.Id;

+ 12 - 2
hos-arbiter/src/main/java/com/yihu/hos/arbiter/models/Endpoint.java

@ -1,4 +1,4 @@
package com.yihu.hos.arbiter.models;
package com.yihu.hos.web.framework.model.bo;
import com.yihu.hos.core.datatype.DateUtil;
import org.springframework.data.annotation.Id;
@ -14,9 +14,11 @@ import java.util.Date;
public class Endpoint {
    @Id
    private String id;
    @Indexed
    private String code;
    private String name;
    private String endpoint;
    @Indexed(name = "updateTime_1", expireAfterSeconds = 30)
//    @Indexed(name = "updateTime_1", expireAfterSeconds = 30)
    private Date updateTime;
    private String event;
    private Integer healthCheckType;
@ -108,4 +110,12 @@ public class Endpoint {
    public void setMetricsURL(String metricsURL) {
        this.metricsURL = metricsURL;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 36 - 0
hos-web-framework/src/main/java/com/yihu/hos/web/framework/model/bo/ServiceFlow.java

@ -15,6 +15,10 @@ public class ServiceFlow {
    @Id
    private String id;
    private String routeCode;
    private String name;
    private String chart;
    private String description;
    private Integer valid;
    private ArrayList<HandleFile> handleFiles;
    private Date updated;
    private String flowType;    //pull or push?
@ -76,6 +80,38 @@ public class ServiceFlow {
        this.flowType = flowType;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getChart() {
        return chart;
    }
    public void setChart(String chart) {
        this.chart = chart;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public Integer getValid() {
        return valid;
    }
    public void setValid(Integer valid) {
        this.valid = valid;
    }
    static public class HandleFile {
        private String usage;   //router or processor
        private String packageName;

+ 1 - 1
hos-web-framework/src/main/java/com/yihu/hos/web/framework/model/bo/ServiceShell.java

@ -15,7 +15,7 @@ public class ServiceShell {
    @Id
    private String id;
    private String name;
    private String type;    //send or acept?
    private String type;    //send or accept?
    private Date updated;
    private String fromHost;
    private String tenant;

+ 15 - 15
src/main/resources/application.yml

@ -49,11 +49,11 @@ spring:
      password: esb
      authenticationDatabase: admin
      gridFsDatabase: dfs
  activemq:
    broker-url: tcp://172.19.103.57:61616?wireFormat.maxInactivityDuration=0
    user: admin
    password: admin
    pooled: false
#  activemq:
#    broker-url: tcp://172.19.103.57:61616?wireFormat.maxInactivityDuration=0
#    user: admin
#    password: admin
#    pooled: false
  aop:
    proxy-target-class: true
hos:
@ -95,11 +95,11 @@ spring:
      password: esb
      authenticationDatabase: admin
      gridFsDatabase: dfs
  activemq:
    broker-url: tcp://172.19.103.57:61616?wireFormat.maxInactivityDuration=0
    user: admin
    password: admin
    pooled: false
#  activemq:
#    broker-url: tcp://172.19.103.57:61616?wireFormat.maxInactivityDuration=0
#    user: admin
#    password: admin
#    pooled: false
  aop:
    proxy-target-class: true
---
@ -135,11 +135,11 @@ spring:
      password: esb
      authenticationDatabase: admin
      gridFsDatabase: dfs
  activemq:
    broker-url: tcp://172.19.103.57:61616?wireFormat.maxInactivityDuration=0
    user: admin
    password: admin
    pooled: false
#  activemq:
#    broker-url: tcp://172.19.103.57:61616?wireFormat.maxInactivityDuration=0
#    user: admin
#    password: admin
#    pooled: false
  aop:
    proxy-target-class: true
hos: