├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── configcenter-assemble ├── pom.xml └── src │ └── main │ ├── java │ └── org │ │ └── antframework │ │ └── configcenter │ │ └── Main.java │ └── resources │ ├── application-dev.properties │ └── application.properties ├── configcenter-biz ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── antframework │ └── configcenter │ └── biz │ ├── BizConfiguration.java │ ├── converter │ └── BranchConverter.java │ ├── provider │ ├── AppServiceProvider.java │ ├── BranchRuleServiceProvider.java │ ├── BranchServiceProvider.java │ ├── ConfigServiceProvider.java │ ├── ProfileServiceProvider.java │ ├── PropertyKeyServiceProvider.java │ ├── PropertyValueServiceProvider.java │ ├── RefreshServiceProvider.java │ └── ReleaseServiceProvider.java │ ├── service │ ├── AddBranchService.java │ ├── AddOrModifyAppService.java │ ├── AddOrModifyBranchRuleService.java │ ├── AddOrModifyProfileService.java │ ├── AddOrModifyPropertyKeyService.java │ ├── AddOrModifyPropertyValueService.java │ ├── ComputeBranchMergenceService.java │ ├── ComputeBranchRulesService.java │ ├── DeleteAppService.java │ ├── DeleteBranchRuleService.java │ ├── DeleteBranchService.java │ ├── DeleteProfileService.java │ ├── DeletePropertyKeyService.java │ ├── DeletePropertyValueService.java │ ├── FindAppService.java │ ├── FindAppTreeService.java │ ├── FindBranchRulesService.java │ ├── FindBranchService.java │ ├── FindBranchesService.java │ ├── FindConfigService.java │ ├── FindInheritedAppPropertyKeysService.java │ ├── FindInheritedAppReleasesService.java │ ├── FindInheritedAppsService.java │ ├── FindInheritedProfilesService.java │ ├── FindProfileService.java │ ├── FindProfileTreeService.java │ ├── FindPropertyKeysService.java │ ├── FindPropertyValuesService.java │ ├── FindReleaseService.java │ ├── MergeBranchService.java │ ├── ProduceReleaseVersionService.java │ ├── RefreshClientsService.java │ ├── ReleaseBranchService.java │ ├── RevertBranchService.java │ └── RevertPropertyValuesService.java │ └── util │ ├── Apps.java │ ├── BranchRules.java │ ├── Branches.java │ ├── Configs.java │ ├── Profiles.java │ ├── Properties.java │ ├── PropertyKeys.java │ ├── PropertyValues.java │ ├── QueryUtils.java │ ├── Refreshes.java │ └── Releases.java ├── configcenter-client ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── antframework │ └── configcenter │ └── client │ ├── Config.java │ ├── ConfigContext.java │ ├── ConfigListener.java │ ├── core │ ├── ChangedProperty.java │ ├── ConfigProperties.java │ ├── ConfigurableConfigProperties.java │ └── DefaultConfigProperties.java │ └── support │ ├── ConfigListeners.java │ ├── ConfigRefresher.java │ ├── ServerListener.java │ ├── ServerRequester.java │ └── TaskExecutor.java ├── configcenter-common ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── antframework │ └── configcenter │ └── common │ └── constant │ └── CacheConstant.java ├── configcenter-dal ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── antframework │ └── configcenter │ └── dal │ ├── DalConfiguration.java │ ├── dao │ ├── AppDao.java │ ├── BranchDao.java │ ├── BranchRuleDao.java │ ├── MergenceDao.java │ ├── ProfileDao.java │ ├── PropertyKeyDao.java │ ├── PropertyValueDao.java │ └── ReleaseDao.java │ └── entity │ ├── App.java │ ├── Branch.java │ ├── BranchRule.java │ ├── Mergence.java │ ├── Profile.java │ ├── PropertyKey.java │ ├── PropertyValue.java │ └── Release.java ├── configcenter-facade ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── antframework │ └── configcenter │ └── facade │ ├── api │ ├── AppService.java │ ├── BranchRuleService.java │ ├── BranchService.java │ ├── ConfigService.java │ ├── ProfileService.java │ ├── PropertyKeyService.java │ ├── PropertyValueService.java │ ├── RefreshService.java │ └── ReleaseService.java │ ├── info │ ├── AppInfo.java │ ├── AppPropertyKey.java │ ├── AppRelease.java │ ├── AppTree.java │ ├── BranchInfo.java │ ├── BranchRuleInfo.java │ ├── ProfileInfo.java │ ├── ProfileTree.java │ ├── PropertyChange.java │ ├── PropertyDifference.java │ ├── PropertyKeyInfo.java │ ├── PropertyValueInfo.java │ └── ReleaseInfo.java │ ├── order │ ├── AddBranchOrder.java │ ├── AddOrModifyAppOrder.java │ ├── AddOrModifyBranchRuleOrder.java │ ├── AddOrModifyProfileOrder.java │ ├── AddOrModifyPropertyKeyOrder.java │ ├── AddOrModifyPropertyValueOrder.java │ ├── ComputeBranchMergenceOrder.java │ ├── ComputeBranchRulesOrder.java │ ├── DeleteAppOrder.java │ ├── DeleteBranchOrder.java │ ├── DeleteBranchRuleOrder.java │ ├── DeleteProfileOrder.java │ ├── DeletePropertyKeyOrder.java │ ├── DeletePropertyValueOrder.java │ ├── FindAppOrder.java │ ├── FindAppTreeOrder.java │ ├── FindBranchOrder.java │ ├── FindBranchRulesOrder.java │ ├── FindBranchesOrder.java │ ├── FindConfigOrder.java │ ├── FindInheritedAppPropertyKeysOrder.java │ ├── FindInheritedAppReleasesOrder.java │ ├── FindInheritedAppsOrder.java │ ├── FindInheritedProfilesOrder.java │ ├── FindProfileOrder.java │ ├── FindProfileTreeOrder.java │ ├── FindPropertyKeysOrder.java │ ├── FindPropertyValuesOrder.java │ ├── FindReleaseOrder.java │ ├── MergeBranchOrder.java │ ├── ProduceReleaseVersionOrder.java │ ├── QueryAppsOrder.java │ ├── QueryProfilesOrder.java │ ├── QueryReleasesOrder.java │ ├── RefreshClientsOrder.java │ ├── ReleaseBranchOrder.java │ ├── ReleaseBranchResult.java │ ├── RevertBranchOrder.java │ └── RevertPropertyValuesOrder.java │ ├── result │ ├── ComputeBranchMergenceResult.java │ ├── ComputeBranchRulesResult.java │ ├── FindAppResult.java │ ├── FindAppTreeResult.java │ ├── FindBranchResult.java │ ├── FindBranchRulesResult.java │ ├── FindBranchesResult.java │ ├── FindConfigResult.java │ ├── FindInheritedAppPropertyKeysResult.java │ ├── FindInheritedAppReleasesResult.java │ ├── FindInheritedAppsResult.java │ ├── FindInheritedProfilesResult.java │ ├── FindProfileResult.java │ ├── FindProfileTreeResult.java │ ├── FindPropertyKeysResult.java │ ├── FindPropertyValuesResult.java │ ├── FindReleaseResult.java │ ├── MergeBranchResult.java │ ├── ProduceReleaseVersionResult.java │ ├── QueryAppsResult.java │ ├── QueryProfilesResult.java │ └── QueryReleasesResult.java │ └── vo │ ├── BranchConstants.java │ ├── ConfigTopic.java │ ├── Property.java │ ├── RedisConstant.java │ ├── RefreshClientsEvent.java │ ├── ReleaseConstant.java │ ├── ResultCode.java │ └── Scope.java ├── configcenter-spring-boot-starter ├── pom.xml └── src │ └── main │ ├── java │ └── org │ │ └── antframework │ │ └── configcenter │ │ └── spring │ │ ├── ConfigContexts.java │ │ └── boot │ │ ├── ConfigContextLifeCycle.java │ │ ├── ConfigcenterProperties.java │ │ └── EnvironmentInitializer.java │ └── resources │ └── META-INF │ ├── additional-spring-configuration-metadata.json │ └── spring.factories ├── configcenter-test ├── pom.xml └── src │ └── test │ └── java │ └── org │ └── antframework │ └── configcenter │ └── test │ ├── AbstractTest.java │ ├── client │ └── ConfigContextTest.java │ └── facade │ └── api │ ├── AppServiceTest.java │ ├── BranchRuleServiceTest.java │ ├── BranchServiceTest.java │ ├── ConfigServiceTest.java │ ├── ProfileServiceTest.java │ ├── PropertyKeyServiceTest.java │ ├── PropertyValueServiceTest.java │ ├── RefreshServiceTest.java │ └── ReleaseServiceTest.java ├── configcenter-web ├── pom.xml └── src │ └── main │ ├── java │ └── org │ │ └── antframework │ │ └── configcenter │ │ └── web │ │ ├── WebConfiguration.java │ │ ├── common │ │ ├── AppPropertyTypes.java │ │ ├── GlobalExceptionHandler.java │ │ ├── ListeningClientsContainer.java │ │ ├── ManagerApps.java │ │ └── PropertyType.java │ │ └── controller │ │ ├── ConfigController.java │ │ └── manage │ │ ├── AppController.java │ │ ├── BranchController.java │ │ ├── BranchRuleController.java │ │ ├── ProfileController.java │ │ ├── PropertyKeyController.java │ │ ├── PropertyTypeController.java │ │ ├── PropertyValueController.java │ │ ├── RefreshController.java │ │ └── ReleaseController.java │ └── resources │ └── static │ ├── common │ ├── common.js │ └── import.js │ ├── components │ ├── Apps.html │ ├── Apps.js │ ├── Branches.html │ ├── Branches.js │ ├── Configs.html │ ├── Configs.js │ ├── ManagerApps.html │ ├── ManagerApps.js │ ├── Profiles.html │ ├── Profiles.js │ ├── PropertyKeys.html │ ├── PropertyKeys.js │ ├── PropertyTypes.html │ ├── PropertyTypes.js │ ├── PropertyValues.html │ ├── PropertyValues.js │ ├── Releases.html │ └── Releases.js │ ├── favicon.ico │ ├── html │ ├── initAdmin.html │ ├── login.html │ └── main.html │ ├── index.html │ └── lib │ └── icon │ ├── demo.css │ ├── demo_fontclass.html │ ├── demo_symbol.html │ ├── demo_unicode.html │ ├── iconfont.css │ ├── iconfont.eot │ ├── iconfont.js │ ├── iconfont.svg │ ├── iconfont.ttf │ └── iconfont.woff └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # maven ignore 2 | target/ 3 | *.jar 4 | *.war 5 | *.zip 6 | *.tar 7 | *.tar.gz 8 | 9 | # eclipse ignore 10 | .settings/ 11 | .project 12 | .classpath 13 | 14 | # idea ignore 15 | .idea/ 16 | *.ipr 17 | *.iml 18 | *.iws 19 | 20 | # temp ignore 21 | *.log 22 | *.cache 23 | *.diff 24 | *.patch 25 | *.tmp 26 | 27 | # system ignore 28 | .DS_Store 29 | Thumbs.db 30 | 31 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM store/oracle/serverjre:8 2 | COPY /configcenter-assemble/target/configcenter-exec.jar /apps/configcenter/configcenter-exec.jar 3 | VOLUME /var/apps 4 | EXPOSE 6220 5 | ENV JAVA_OPTS="" 6 | ENTRYPOINT java $JAVA_OPTS -jar /apps/configcenter/configcenter-exec.jar 7 | -------------------------------------------------------------------------------- /configcenter-assemble/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-assemble 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.configcenter 21 | configcenter-web 22 | ${project.parent.version} 23 | 24 | 25 | org.antframework.boot 26 | ant-boot-starter-lang 27 | 28 | 29 | org.antframework.boot 30 | ant-boot-starter-logging 31 | 32 | 33 | 34 | 35 | configcenter 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-maven-plugin 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /configcenter-assemble/src/main/java/org/antframework/configcenter/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-22 15:48 创建 8 | */ 9 | package org.antframework.configcenter; 10 | 11 | import org.antframework.boot.lang.AntBootApplication; 12 | import org.antframework.boot.lang.Apps; 13 | import org.springframework.boot.SpringApplication; 14 | 15 | /** 16 | * 程序启动入口 17 | */ 18 | @AntBootApplication(appId = "configcenter") 19 | public class Main { 20 | public static void main(String[] args) { 21 | Apps.setProfileIfAbsent("dev"); 22 | SpringApplication.run(Main.class, args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-assemble/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #\u6570\u636E\u5E93 2 | spring.datasource.url=jdbc:mysql://localhost:3306/configcenter_online?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 3 | spring.datasource.username=root 4 | spring.datasource.password=root 5 | #spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/configcenter_online?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 6 | #spring.datasource.username=postgres 7 | #spring.datasource.password=12345678 8 | #JPA 9 | spring.jpa.hibernate.ddl-auto=update 10 | #Redis 11 | spring.redis.host=localhost 12 | spring.redis.port=6379 13 | spring.redis.password=123 14 | #\u83B7\u53D6\u914D\u7F6E\u662F\u9700\u8981\u7BA1\u7406\u5458\u8BA4\u8BC1 15 | #configcenter.config.fetch-need-manager=true 16 | -------------------------------------------------------------------------------- /configcenter-assemble/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #\u7AEF\u53E3 2 | server.port=6220 3 | #\u6570\u636E\u5E93 4 | spring.datasource.hikari.auto-commit=false 5 | #\u7F13\u5B58 6 | spring.cache.type=redis 7 | spring.cache.redis.time-to-live=5m 8 | #Session 9 | spring.session.store-type=redis 10 | -------------------------------------------------------------------------------- /configcenter-biz/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-biz 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.configcenter 21 | configcenter-facade 22 | ${project.parent.version} 23 | 24 | 25 | org.antframework.configcenter 26 | configcenter-dal 27 | ${project.parent.version} 28 | 29 | 30 | org.antframework.boot 31 | ant-boot-starter-bekit 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-redis 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/BizConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-22 15:42 创建 8 | */ 9 | package org.antframework.configcenter.biz; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.extern.slf4j.Slf4j; 13 | import org.antframework.configcenter.facade.vo.RedisConstant; 14 | import org.antframework.configcenter.facade.vo.RefreshClientsEvent; 15 | import org.bekit.event.EventPublisher; 16 | import org.springframework.context.annotation.Bean; 17 | import org.springframework.context.annotation.Configuration; 18 | import org.springframework.data.redis.connection.Message; 19 | import org.springframework.data.redis.connection.MessageListener; 20 | import org.springframework.data.redis.connection.RedisConnectionFactory; 21 | import org.springframework.data.redis.core.RedisTemplate; 22 | import org.springframework.data.redis.listener.ChannelTopic; 23 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; 24 | 25 | /** 26 | * biz层配置 27 | */ 28 | @Configuration 29 | @AllArgsConstructor 30 | @Slf4j 31 | public class BizConfiguration { 32 | // redis操作类 33 | private final RedisTemplate redisTemplate; 34 | // 事件发布器 35 | private final EventPublisher eventPublisher; 36 | 37 | // 配置redis消息监听器容器 38 | @Bean 39 | public RedisMessageListenerContainer refreshClientsListenerContainer(RedisConnectionFactory redisConnectionFactory) { 40 | RedisMessageListenerContainer container = new RedisMessageListenerContainer(); 41 | container.setConnectionFactory(redisConnectionFactory); 42 | container.addMessageListener(new RefreshClientsMessageListener(), new ChannelTopic(RedisConstant.REFRESH_CLIENTS_CHANNEL)); 43 | return container; 44 | } 45 | 46 | // 刷新客户端消息监听器 47 | private class RefreshClientsMessageListener implements MessageListener { 48 | @Override 49 | public void onMessage(Message message, byte[] pattern) { 50 | RefreshClientsEvent event = (RefreshClientsEvent) redisTemplate.getValueSerializer().deserialize(message.getBody()); 51 | log.debug("从Redis接收到刷新客户端消息:{}", event); 52 | eventPublisher.publish(event); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/converter/BranchConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-30 23:14 创建 8 | */ 9 | package org.antframework.configcenter.biz.converter; 10 | 11 | import org.antframework.common.util.facade.BizException; 12 | import org.antframework.common.util.facade.CommonResultCode; 13 | import org.antframework.common.util.facade.FacadeUtils; 14 | import org.antframework.common.util.facade.Status; 15 | import org.antframework.configcenter.biz.util.Releases; 16 | import org.antframework.configcenter.dal.entity.Branch; 17 | import org.antframework.configcenter.facade.info.BranchInfo; 18 | import org.antframework.configcenter.facade.info.ReleaseInfo; 19 | import org.springframework.core.convert.converter.Converter; 20 | 21 | /** 22 | * 分支转换器 23 | */ 24 | public class BranchConverter implements Converter { 25 | // 转换器 26 | private static final Converter CONVERTER = new FacadeUtils.DefaultConverter<>(BranchInfo.class); 27 | 28 | @Override 29 | public BranchInfo convert(Branch source) { 30 | ReleaseInfo release = Releases.findRelease(source.getAppId(), source.getProfileId(), source.getReleaseVersion()); 31 | if (release == null) { 32 | throw new BizException(Status.FAIL, CommonResultCode.ILLEGAL_STATE.getCode(), String.format("分支[appId=%s,profileId=%s,branchId=%s]对应的发布版本[%d]不存在", source.getAppId(), source.getProfileId(), source.getBranchId(), source.getReleaseVersion())); 33 | } 34 | BranchInfo branch = CONVERTER.convert(source); 35 | branch.setRelease(release); 36 | return branch; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/AppServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 14:59 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.boot.bekit.CommonQueries; 13 | import org.antframework.common.util.facade.EmptyResult; 14 | import org.antframework.configcenter.biz.util.QueryUtils; 15 | import org.antframework.configcenter.dal.dao.AppDao; 16 | import org.antframework.configcenter.facade.api.AppService; 17 | import org.antframework.configcenter.facade.order.*; 18 | import org.antframework.configcenter.facade.result.*; 19 | import org.bekit.service.ServiceEngine; 20 | import org.springframework.stereotype.Service; 21 | 22 | /** 23 | * 应用服务提供者 24 | */ 25 | @Service 26 | @AllArgsConstructor 27 | public class AppServiceProvider implements AppService { 28 | // 服务引擎 29 | private final ServiceEngine serviceEngine; 30 | 31 | @Override 32 | public EmptyResult addOrModifyApp(AddOrModifyAppOrder order) { 33 | return serviceEngine.execute("addOrModifyAppService", order); 34 | } 35 | 36 | @Override 37 | public ProduceReleaseVersionResult produceReleaseVersion(ProduceReleaseVersionOrder order) { 38 | return serviceEngine.execute("produceReleaseVersionService", order); 39 | } 40 | 41 | @Override 42 | public EmptyResult deleteApp(DeleteAppOrder order) { 43 | return serviceEngine.execute("deleteAppService", order); 44 | } 45 | 46 | @Override 47 | public FindAppResult findApp(FindAppOrder order) { 48 | return serviceEngine.execute("findAppService", order); 49 | } 50 | 51 | @Override 52 | public FindInheritedAppsResult findInheritedApps(FindInheritedAppsOrder order) { 53 | return serviceEngine.execute("findInheritedAppsService", order); 54 | } 55 | 56 | @Override 57 | public FindAppTreeResult findAppTree(FindAppTreeOrder order) { 58 | return serviceEngine.execute("findAppTreeService", order); 59 | } 60 | 61 | @Override 62 | public QueryAppsResult queryApps(QueryAppsOrder order) { 63 | CommonQueries.CommonQueryResult result = serviceEngine.execute(CommonQueries.SERVICE_NAME, order, QueryUtils.buildCommonQueryAttachment(AppDao.class)); 64 | return result.convertTo(QueryAppsResult.class); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/BranchRuleServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 18:33 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.facade.api.BranchRuleService; 14 | import org.antframework.configcenter.facade.order.AddOrModifyBranchRuleOrder; 15 | import org.antframework.configcenter.facade.order.ComputeBranchRulesOrder; 16 | import org.antframework.configcenter.facade.order.DeleteBranchRuleOrder; 17 | import org.antframework.configcenter.facade.order.FindBranchRulesOrder; 18 | import org.antframework.configcenter.facade.result.ComputeBranchRulesResult; 19 | import org.antframework.configcenter.facade.result.FindBranchRulesResult; 20 | import org.bekit.service.ServiceEngine; 21 | import org.springframework.stereotype.Service; 22 | 23 | /** 24 | * 分支规则服务提供者 25 | */ 26 | @Service 27 | @AllArgsConstructor 28 | public class BranchRuleServiceProvider implements BranchRuleService { 29 | // 服务引擎 30 | private final ServiceEngine serviceEngine; 31 | 32 | @Override 33 | public EmptyResult addOrModifyBranchRule(AddOrModifyBranchRuleOrder order) { 34 | return serviceEngine.execute("addOrModifyBranchRuleService", order); 35 | } 36 | 37 | @Override 38 | public EmptyResult deleteBranchRule(DeleteBranchRuleOrder order) { 39 | return serviceEngine.execute("deleteBranchRuleService", order); 40 | } 41 | 42 | @Override 43 | public FindBranchRulesResult findBranchRules(FindBranchRulesOrder order) { 44 | return serviceEngine.execute("findBranchRulesService", order); 45 | } 46 | 47 | @Override 48 | public ComputeBranchRulesResult computeBranchRules(ComputeBranchRulesOrder order) { 49 | return serviceEngine.execute("computeBranchRulesService", order); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/BranchServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-17 22:07 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.facade.api.BranchService; 14 | import org.antframework.configcenter.facade.order.*; 15 | import org.antframework.configcenter.facade.result.ComputeBranchMergenceResult; 16 | import org.antframework.configcenter.facade.result.FindBranchResult; 17 | import org.antframework.configcenter.facade.result.FindBranchesResult; 18 | import org.antframework.configcenter.facade.result.MergeBranchResult; 19 | import org.bekit.service.ServiceEngine; 20 | import org.springframework.stereotype.Service; 21 | 22 | /** 23 | * 分支服务提供者 24 | */ 25 | @Service 26 | @AllArgsConstructor 27 | public class BranchServiceProvider implements BranchService { 28 | // 服务引擎 29 | private final ServiceEngine serviceEngine; 30 | 31 | @Override 32 | public EmptyResult addBranch(AddBranchOrder order) { 33 | return serviceEngine.execute("addBranchService", order); 34 | } 35 | 36 | @Override 37 | public ReleaseBranchResult releaseBranch(ReleaseBranchOrder order) { 38 | return serviceEngine.execute("releaseBranchService", order); 39 | } 40 | 41 | @Override 42 | public EmptyResult revertBranch(RevertBranchOrder order) { 43 | return serviceEngine.execute("revertBranchService", order); 44 | } 45 | 46 | @Override 47 | public MergeBranchResult mergeBranch(MergeBranchOrder order) { 48 | return serviceEngine.execute("mergeBranchService", order); 49 | } 50 | 51 | @Override 52 | public ComputeBranchMergenceResult computeBranchMergence(ComputeBranchMergenceOrder order) { 53 | return serviceEngine.execute("computeBranchMergenceService", order); 54 | } 55 | 56 | @Override 57 | public EmptyResult deleteBranch(DeleteBranchOrder order) { 58 | return serviceEngine.execute("deleteBranchService", order); 59 | } 60 | 61 | @Override 62 | public FindBranchResult findBranch(FindBranchOrder order) { 63 | return serviceEngine.execute("findBranchService", order); 64 | } 65 | 66 | @Override 67 | public FindBranchesResult findBranches(FindBranchesOrder order) { 68 | return serviceEngine.execute("findBranchesService", order); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/ConfigServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 21:42 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.configcenter.facade.api.ConfigService; 13 | import org.antframework.configcenter.facade.order.FindConfigOrder; 14 | import org.antframework.configcenter.facade.order.FindInheritedAppReleasesOrder; 15 | import org.antframework.configcenter.facade.result.FindConfigResult; 16 | import org.antframework.configcenter.facade.result.FindInheritedAppReleasesResult; 17 | import org.bekit.service.ServiceEngine; 18 | import org.springframework.stereotype.Service; 19 | 20 | /** 21 | * 配置服务提供者 22 | */ 23 | @Service 24 | @AllArgsConstructor 25 | public class ConfigServiceProvider implements ConfigService { 26 | // 服务引擎 27 | private final ServiceEngine serviceEngine; 28 | 29 | @Override 30 | public FindConfigResult findConfig(FindConfigOrder order) { 31 | return serviceEngine.execute("findConfigService", order); 32 | } 33 | 34 | @Override 35 | public FindInheritedAppReleasesResult findInheritedAppReleases(FindInheritedAppReleasesOrder order) { 36 | return serviceEngine.execute("findInheritedAppReleasesService", order); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/ProfileServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 15:31 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.boot.bekit.CommonQueries; 13 | import org.antframework.common.util.facade.EmptyResult; 14 | import org.antframework.configcenter.biz.util.QueryUtils; 15 | import org.antframework.configcenter.dal.dao.ProfileDao; 16 | import org.antframework.configcenter.facade.api.ProfileService; 17 | import org.antframework.configcenter.facade.order.*; 18 | import org.antframework.configcenter.facade.result.FindInheritedProfilesResult; 19 | import org.antframework.configcenter.facade.result.FindProfileResult; 20 | import org.antframework.configcenter.facade.result.FindProfileTreeResult; 21 | import org.antframework.configcenter.facade.result.QueryProfilesResult; 22 | import org.bekit.service.ServiceEngine; 23 | import org.springframework.stereotype.Service; 24 | 25 | /** 26 | * 环境服务提供者 27 | */ 28 | @Service 29 | @AllArgsConstructor 30 | public class ProfileServiceProvider implements ProfileService { 31 | // 服务引擎 32 | private final ServiceEngine serviceEngine; 33 | 34 | @Override 35 | public EmptyResult addOrModifyProfile(AddOrModifyProfileOrder order) { 36 | return serviceEngine.execute("addOrModifyProfileService", order); 37 | } 38 | 39 | @Override 40 | public EmptyResult deleteProfile(DeleteProfileOrder order) { 41 | return serviceEngine.execute("deleteProfileService", order); 42 | } 43 | 44 | @Override 45 | public FindProfileResult findProfile(FindProfileOrder order) { 46 | return serviceEngine.execute("findProfileService", order); 47 | } 48 | 49 | @Override 50 | public FindInheritedProfilesResult findInheritedProfiles(FindInheritedProfilesOrder order) { 51 | return serviceEngine.execute("findInheritedProfilesService", order); 52 | } 53 | 54 | @Override 55 | public FindProfileTreeResult findProfileTree(FindProfileTreeOrder order) { 56 | return serviceEngine.execute("findProfileTreeService", order); 57 | } 58 | 59 | @Override 60 | public QueryProfilesResult queryProfiles(QueryProfilesOrder order) { 61 | CommonQueries.CommonQueryResult result = serviceEngine.execute(CommonQueries.SERVICE_NAME, order, QueryUtils.buildCommonQueryAttachment(ProfileDao.class)); 62 | return result.convertTo(QueryProfilesResult.class); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/PropertyKeyServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 20:39 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.facade.api.PropertyKeyService; 14 | import org.antframework.configcenter.facade.order.AddOrModifyPropertyKeyOrder; 15 | import org.antframework.configcenter.facade.order.DeletePropertyKeyOrder; 16 | import org.antframework.configcenter.facade.order.FindInheritedAppPropertyKeysOrder; 17 | import org.antframework.configcenter.facade.order.FindPropertyKeysOrder; 18 | import org.antframework.configcenter.facade.result.FindInheritedAppPropertyKeysResult; 19 | import org.antframework.configcenter.facade.result.FindPropertyKeysResult; 20 | import org.bekit.service.ServiceEngine; 21 | import org.springframework.stereotype.Service; 22 | 23 | /** 24 | * 配置key服务提供者 25 | */ 26 | @Service 27 | @AllArgsConstructor 28 | public class PropertyKeyServiceProvider implements PropertyKeyService { 29 | // 服务引擎 30 | private final ServiceEngine serviceEngine; 31 | 32 | @Override 33 | public EmptyResult addOrModifyPropertyKey(AddOrModifyPropertyKeyOrder order) { 34 | return serviceEngine.execute("addOrModifyPropertyKeyService", order); 35 | } 36 | 37 | @Override 38 | public EmptyResult deletePropertyKey(DeletePropertyKeyOrder order) { 39 | return serviceEngine.execute("deletePropertyKeyService", order); 40 | } 41 | 42 | @Override 43 | public FindPropertyKeysResult findPropertyKeys(FindPropertyKeysOrder order) { 44 | return serviceEngine.execute("findPropertyKeysService", order); 45 | } 46 | 47 | @Override 48 | public FindInheritedAppPropertyKeysResult findInheritedAppPropertyKeys(FindInheritedAppPropertyKeysOrder order) { 49 | return serviceEngine.execute("findInheritedAppPropertyKeysService", order); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/PropertyValueServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 21:03 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.facade.api.PropertyValueService; 14 | import org.antframework.configcenter.facade.order.AddOrModifyPropertyValueOrder; 15 | import org.antframework.configcenter.facade.order.DeletePropertyValueOrder; 16 | import org.antframework.configcenter.facade.order.FindPropertyValuesOrder; 17 | import org.antframework.configcenter.facade.order.RevertPropertyValuesOrder; 18 | import org.antframework.configcenter.facade.result.FindPropertyValuesResult; 19 | import org.bekit.service.ServiceEngine; 20 | import org.springframework.stereotype.Service; 21 | 22 | /** 23 | * 配置value服务提供者 24 | */ 25 | @Service 26 | @AllArgsConstructor 27 | public class PropertyValueServiceProvider implements PropertyValueService { 28 | // 服务引擎 29 | private final ServiceEngine serviceEngine; 30 | 31 | @Override 32 | public EmptyResult addOrModifyPropertyValue(AddOrModifyPropertyValueOrder order) { 33 | return serviceEngine.execute("addOrModifyPropertyValueService", order); 34 | } 35 | 36 | @Override 37 | public EmptyResult deletePropertyValue(DeletePropertyValueOrder order) { 38 | return serviceEngine.execute("deletePropertyValueService", order); 39 | } 40 | 41 | @Override 42 | public EmptyResult revertPropertyValues(RevertPropertyValuesOrder order) { 43 | return serviceEngine.execute("revertPropertyValuesService", order); 44 | } 45 | 46 | @Override 47 | public FindPropertyValuesResult findPropertyValues(FindPropertyValuesOrder order) { 48 | return serviceEngine.execute("findPropertyValuesService", order); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/RefreshServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-16 13:55 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.facade.api.RefreshService; 14 | import org.antframework.configcenter.facade.order.RefreshClientsOrder; 15 | import org.bekit.service.ServiceEngine; 16 | import org.springframework.stereotype.Service; 17 | 18 | /** 19 | * 刷新服务提供者 20 | */ 21 | @Service 22 | @AllArgsConstructor 23 | public class RefreshServiceProvider implements RefreshService { 24 | // 服务引擎 25 | private final ServiceEngine serviceEngine; 26 | 27 | @Override 28 | public EmptyResult refreshClients(RefreshClientsOrder order) { 29 | return serviceEngine.execute("refreshClientsService", order); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/provider/ReleaseServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 21:04 创建 8 | */ 9 | package org.antframework.configcenter.biz.provider; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.boot.bekit.CommonQueries; 13 | import org.antframework.configcenter.biz.util.QueryUtils; 14 | import org.antframework.configcenter.dal.dao.ReleaseDao; 15 | import org.antframework.configcenter.facade.api.ReleaseService; 16 | import org.antframework.configcenter.facade.order.FindReleaseOrder; 17 | import org.antframework.configcenter.facade.order.QueryReleasesOrder; 18 | import org.antframework.configcenter.facade.result.FindReleaseResult; 19 | import org.antframework.configcenter.facade.result.QueryReleasesResult; 20 | import org.bekit.service.ServiceEngine; 21 | import org.springframework.stereotype.Service; 22 | 23 | /** 24 | * 发布服务提供者 25 | */ 26 | @Service 27 | @AllArgsConstructor 28 | public class ReleaseServiceProvider implements ReleaseService { 29 | // 服务引擎 30 | private final ServiceEngine serviceEngine; 31 | 32 | @Override 33 | public FindReleaseResult findRelease(FindReleaseOrder order) { 34 | return serviceEngine.execute("findReleaseService", order); 35 | } 36 | 37 | @Override 38 | public QueryReleasesResult queryReleases(QueryReleasesOrder order) { 39 | CommonQueries.CommonQueryResult result = serviceEngine.execute(CommonQueries.SERVICE_NAME, order, QueryUtils.buildCommonQueryAttachment(ReleaseDao.class)); 40 | return result.convertTo(QueryReleasesResult.class); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/AddOrModifyPropertyKeyService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 20:42 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.BizException; 13 | import org.antframework.common.util.facade.CommonResultCode; 14 | import org.antframework.common.util.facade.EmptyResult; 15 | import org.antframework.common.util.facade.Status; 16 | import org.antframework.configcenter.dal.dao.AppDao; 17 | import org.antframework.configcenter.dal.dao.PropertyKeyDao; 18 | import org.antframework.configcenter.dal.entity.App; 19 | import org.antframework.configcenter.dal.entity.PropertyKey; 20 | import org.antframework.configcenter.facade.order.AddOrModifyPropertyKeyOrder; 21 | import org.bekit.service.annotation.service.Service; 22 | import org.bekit.service.annotation.service.ServiceExecute; 23 | import org.bekit.service.engine.ServiceContext; 24 | import org.springframework.beans.BeanUtils; 25 | 26 | /** 27 | * 添加或修改配置key服务 28 | */ 29 | @Service(enableTx = true) 30 | @AllArgsConstructor 31 | public class AddOrModifyPropertyKeyService { 32 | // 应用dao 33 | private final AppDao appDao; 34 | // 配置key dao 35 | private final PropertyKeyDao propertyKeyDao; 36 | 37 | @ServiceExecute 38 | public void execute(ServiceContext context) { 39 | AddOrModifyPropertyKeyOrder order = context.getOrder(); 40 | 41 | App app = appDao.findLockByAppId(order.getAppId()); 42 | if (app == null) { 43 | throw new BizException(Status.FAIL, CommonResultCode.INVALID_PARAMETER.getCode(), String.format("应用[%s]不存在", order.getAppId())); 44 | } 45 | PropertyKey propertyKey = propertyKeyDao.findLockByAppIdAndKey(order.getAppId(), order.getKey()); 46 | if (propertyKey == null) { 47 | propertyKey = new PropertyKey(); 48 | } 49 | BeanUtils.copyProperties(order, propertyKey); 50 | 51 | propertyKeyDao.save(propertyKey); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/AddOrModifyPropertyValueService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 22:42 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.BizException; 13 | import org.antframework.common.util.facade.CommonResultCode; 14 | import org.antframework.common.util.facade.EmptyResult; 15 | import org.antframework.common.util.facade.Status; 16 | import org.antframework.configcenter.dal.dao.BranchDao; 17 | import org.antframework.configcenter.dal.dao.PropertyValueDao; 18 | import org.antframework.configcenter.dal.entity.Branch; 19 | import org.antframework.configcenter.dal.entity.PropertyValue; 20 | import org.antframework.configcenter.facade.order.AddOrModifyPropertyValueOrder; 21 | import org.bekit.service.annotation.service.Service; 22 | import org.bekit.service.annotation.service.ServiceExecute; 23 | import org.bekit.service.engine.ServiceContext; 24 | import org.springframework.beans.BeanUtils; 25 | 26 | /** 27 | * 新增或删除配置value服务 28 | */ 29 | @Service(enableTx = true) 30 | @AllArgsConstructor 31 | public class AddOrModifyPropertyValueService { 32 | // 分支dao 33 | private final BranchDao branchDao; 34 | // 配置value dao 35 | private final PropertyValueDao propertyValueDao; 36 | 37 | @ServiceExecute 38 | public void execute(ServiceContext context) { 39 | AddOrModifyPropertyValueOrder order = context.getOrder(); 40 | // 校验入参 41 | Branch branch = branchDao.findLockByAppIdAndProfileIdAndBranchId(order.getAppId(), order.getProfileId(), order.getBranchId()); 42 | if (branch == null) { 43 | throw new BizException(Status.FAIL, CommonResultCode.INVALID_PARAMETER.getCode(), String.format("分支[appId=%s,profileId=%s,branchId=%s]不存在", order.getAppId(), order.getProfileId(), order.getBranchId())); 44 | } 45 | // 新增或修改配置value 46 | PropertyValue propertyValue = propertyValueDao.findLockByAppIdAndProfileIdAndBranchIdAndKey(order.getAppId(), order.getProfileId(), order.getBranchId(), order.getKey()); 47 | if (propertyValue == null) { 48 | propertyValue = new PropertyValue(); 49 | } 50 | BeanUtils.copyProperties(order, propertyValue); 51 | propertyValueDao.save(propertyValue); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/ComputeBranchRulesService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-02 23:03 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import org.antframework.configcenter.biz.util.BranchRules; 12 | import org.antframework.configcenter.facade.info.BranchRuleInfo; 13 | import org.antframework.configcenter.facade.order.ComputeBranchRulesOrder; 14 | import org.antframework.configcenter.facade.result.ComputeBranchRulesResult; 15 | import org.antframework.configcenter.facade.vo.BranchConstants; 16 | import org.bekit.service.annotation.service.Service; 17 | import org.bekit.service.annotation.service.ServiceExecute; 18 | import org.bekit.service.engine.ServiceContext; 19 | 20 | import java.util.List; 21 | import java.util.regex.Pattern; 22 | 23 | /** 24 | * 计算分支规则服务 25 | */ 26 | @Service 27 | public class ComputeBranchRulesService { 28 | @ServiceExecute 29 | public void execute(ServiceContext context) { 30 | ComputeBranchRulesOrder order = context.getOrder(); 31 | ComputeBranchRulesResult result = context.getResult(); 32 | // 计算分支id 33 | String branchId = BranchConstants.DEFAULT_BRANCH_ID; 34 | if (order.getTarget() != null) { 35 | List branchRules = BranchRules.findBranchRules(order.getAppId(), order.getProfileId()); 36 | branchId = branchRules.stream() 37 | .filter(branchRule -> Pattern.matches(branchRule.getRule(), order.getTarget())) 38 | .map(BranchRuleInfo::getBranchId) 39 | .findFirst() 40 | .orElse(BranchConstants.DEFAULT_BRANCH_ID); 41 | } 42 | result.setBranchId(branchId); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/DeleteBranchRuleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 19:51 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.biz.util.Refreshes; 14 | import org.antframework.configcenter.dal.dao.BranchRuleDao; 15 | import org.antframework.configcenter.dal.entity.BranchRule; 16 | import org.antframework.configcenter.facade.order.DeleteBranchRuleOrder; 17 | import org.bekit.service.annotation.service.Service; 18 | import org.bekit.service.annotation.service.ServiceAfter; 19 | import org.bekit.service.annotation.service.ServiceExecute; 20 | import org.bekit.service.engine.ServiceContext; 21 | 22 | /** 23 | * 删除分支规则服务 24 | */ 25 | @Service(enableTx = true) 26 | @AllArgsConstructor 27 | public class DeleteBranchRuleService { 28 | // 分支规则dao 29 | private final BranchRuleDao branchRuleDao; 30 | 31 | @ServiceExecute 32 | public void execute(ServiceContext context) { 33 | DeleteBranchRuleOrder order = context.getOrder(); 34 | // 删除分支规则 35 | BranchRule branchRule = branchRuleDao.findLockByAppIdAndProfileIdAndBranchId(order.getAppId(), order.getProfileId(), order.getBranchId()); 36 | if (branchRule != null) { 37 | branchRuleDao.delete(branchRule); 38 | } 39 | } 40 | 41 | @ServiceAfter 42 | public void after(ServiceContext context) { 43 | DeleteBranchRuleOrder order = context.getOrder(); 44 | // 刷新客户端 45 | Refreshes.refreshClients(order.getAppId(), order.getProfileId()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/DeleteBranchService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-28 22:58 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.biz.util.BranchRules; 14 | import org.antframework.configcenter.biz.util.Branches; 15 | import org.antframework.configcenter.biz.util.PropertyValues; 16 | import org.antframework.configcenter.dal.dao.BranchDao; 17 | import org.antframework.configcenter.dal.entity.Branch; 18 | import org.antframework.configcenter.facade.order.DeleteBranchOrder; 19 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 20 | import org.bekit.service.annotation.service.Service; 21 | import org.bekit.service.annotation.service.ServiceBefore; 22 | import org.bekit.service.annotation.service.ServiceExecute; 23 | import org.bekit.service.engine.ServiceContext; 24 | 25 | /** 26 | * 删除分支服务 27 | */ 28 | @Service(enableTx = true) 29 | @AllArgsConstructor 30 | public class DeleteBranchService { 31 | // 分支dao 32 | private final BranchDao branchDao; 33 | 34 | @ServiceBefore 35 | public void before(ServiceContext context) { 36 | DeleteBranchOrder order = context.getOrder(); 37 | // 删除配置value 38 | PropertyValues.deletePropertyValues(order.getAppId(), order.getProfileId(), order.getBranchId()); 39 | // 删除分支规则 40 | BranchRules.deleteBranchRule(order.getAppId(), order.getProfileId(), order.getBranchId()); 41 | } 42 | 43 | @ServiceExecute 44 | public void execute(ServiceContext context) { 45 | DeleteBranchOrder order = context.getOrder(); 46 | // 删除分支 47 | Branch branch = branchDao.findLockByAppIdAndProfileIdAndBranchId(order.getAppId(), order.getProfileId(), order.getBranchId()); 48 | if (branch != null) { 49 | Branches.revertBranch(order.getAppId(), order.getProfileId(), order.getBranchId(), ReleaseConstant.ORIGIN_VERSION); 50 | branchDao.delete(branch); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/DeleteProfileService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 15:40 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.BizException; 13 | import org.antframework.common.util.facade.CommonResultCode; 14 | import org.antframework.common.util.facade.EmptyResult; 15 | import org.antframework.common.util.facade.Status; 16 | import org.antframework.configcenter.biz.util.Apps; 17 | import org.antframework.configcenter.biz.util.Branches; 18 | import org.antframework.configcenter.dal.dao.ProfileDao; 19 | import org.antframework.configcenter.dal.entity.Profile; 20 | import org.antframework.configcenter.facade.info.AppInfo; 21 | import org.antframework.configcenter.facade.info.BranchInfo; 22 | import org.antframework.configcenter.facade.order.DeleteProfileOrder; 23 | import org.bekit.service.annotation.service.Service; 24 | import org.bekit.service.annotation.service.ServiceExecute; 25 | import org.bekit.service.engine.ServiceContext; 26 | 27 | /** 28 | * 删除环境服务 29 | */ 30 | @Service(enableTx = true) 31 | @AllArgsConstructor 32 | public class DeleteProfileService { 33 | // 环境dao 34 | private final ProfileDao profileDao; 35 | 36 | @ServiceExecute 37 | public void execute(ServiceContext context) { 38 | DeleteProfileOrder order = context.getOrder(); 39 | 40 | Profile profile = profileDao.findLockByProfileId(order.getProfileId()); 41 | if (profile == null) { 42 | return; 43 | } 44 | if (profileDao.existsByParent(order.getProfileId())) { 45 | throw new BizException(Status.FAIL, CommonResultCode.ILLEGAL_STATE.getCode(), String.format("环境[%s]存在子环境,不能删除", order.getProfileId())); 46 | } 47 | // 删除所有应用在该环境下的所有分支 48 | for (AppInfo app : Apps.findAllApps()) { 49 | for (BranchInfo branch : Branches.findBranches(app.getAppId(), order.getProfileId())) { 50 | Branches.deleteBranch(app.getAppId(), order.getProfileId(), branch.getBranchId()); 51 | } 52 | } 53 | // 删除环境 54 | profileDao.delete(profile); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/DeletePropertyKeyService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 20:52 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.dal.dao.PropertyKeyDao; 14 | import org.antframework.configcenter.dal.entity.PropertyKey; 15 | import org.antframework.configcenter.facade.order.DeletePropertyKeyOrder; 16 | import org.bekit.service.annotation.service.Service; 17 | import org.bekit.service.annotation.service.ServiceExecute; 18 | import org.bekit.service.engine.ServiceContext; 19 | 20 | /** 21 | * 删除配置key服务 22 | */ 23 | @Service(enableTx = true) 24 | @AllArgsConstructor 25 | public class DeletePropertyKeyService { 26 | // 配置key dao 27 | private final PropertyKeyDao propertyKeyDao; 28 | 29 | @ServiceExecute 30 | public void execute(ServiceContext context) { 31 | DeletePropertyKeyOrder order = context.getOrder(); 32 | 33 | PropertyKey propertyKey = propertyKeyDao.findLockByAppIdAndKey(order.getAppId(), order.getKey()); 34 | if (propertyKey != null) { 35 | // 删除key 36 | propertyKeyDao.delete(propertyKey); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/DeletePropertyValueService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 22:50 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.dal.dao.PropertyValueDao; 14 | import org.antframework.configcenter.dal.entity.PropertyValue; 15 | import org.antframework.configcenter.facade.order.DeletePropertyValueOrder; 16 | import org.bekit.service.annotation.service.Service; 17 | import org.bekit.service.annotation.service.ServiceExecute; 18 | import org.bekit.service.engine.ServiceContext; 19 | 20 | /** 21 | * 删除配置value服务 22 | */ 23 | @Service(enableTx = true) 24 | @AllArgsConstructor 25 | public class DeletePropertyValueService { 26 | // 配置value dao 27 | private final PropertyValueDao propertyValueDao; 28 | 29 | @ServiceExecute 30 | public void execute(ServiceContext context) { 31 | DeletePropertyValueOrder order = context.getOrder(); 32 | 33 | PropertyValue propertyValue = propertyValueDao.findLockByAppIdAndProfileIdAndBranchIdAndKey(order.getAppId(), order.getProfileId(), order.getBranchId(), order.getKey()); 34 | if (propertyValue != null) { 35 | propertyValueDao.delete(propertyValue); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/FindAppService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 21:44 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.FacadeUtils; 13 | import org.antframework.configcenter.dal.dao.AppDao; 14 | import org.antframework.configcenter.dal.entity.App; 15 | import org.antframework.configcenter.facade.info.AppInfo; 16 | import org.antframework.configcenter.facade.order.FindAppOrder; 17 | import org.antframework.configcenter.facade.result.FindAppResult; 18 | import org.bekit.service.annotation.service.Service; 19 | import org.bekit.service.annotation.service.ServiceExecute; 20 | import org.bekit.service.engine.ServiceContext; 21 | import org.springframework.core.convert.converter.Converter; 22 | 23 | /** 24 | * 查找应用服务 25 | */ 26 | @Service 27 | @AllArgsConstructor 28 | public class FindAppService { 29 | // 转换器 30 | private static final Converter CONVERTER = new FacadeUtils.DefaultConverter<>(AppInfo.class); 31 | 32 | // 应用dao 33 | private final AppDao appDao; 34 | 35 | @ServiceExecute 36 | public void execute(ServiceContext context) { 37 | FindAppOrder order = context.getOrder(); 38 | FindAppResult result = context.getResult(); 39 | 40 | App app = appDao.findByAppId(order.getAppId()); 41 | if (app != null) { 42 | result.setApp(CONVERTER.convert(app)); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/FindInheritedAppPropertyKeysService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 12:05 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import org.antframework.configcenter.biz.util.Apps; 12 | import org.antframework.configcenter.biz.util.PropertyKeys; 13 | import org.antframework.configcenter.facade.info.AppInfo; 14 | import org.antframework.configcenter.facade.info.AppPropertyKey; 15 | import org.antframework.configcenter.facade.info.PropertyKeyInfo; 16 | import org.antframework.configcenter.facade.order.FindInheritedAppPropertyKeysOrder; 17 | import org.antframework.configcenter.facade.result.FindInheritedAppPropertyKeysResult; 18 | import org.antframework.configcenter.facade.vo.Scope; 19 | import org.bekit.service.annotation.service.Service; 20 | import org.bekit.service.annotation.service.ServiceExecute; 21 | import org.bekit.service.engine.ServiceContext; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * 查找继承的应用配置key-service 27 | */ 28 | @Service 29 | public class FindInheritedAppPropertyKeysService { 30 | @ServiceExecute 31 | public void execute(ServiceContext context) { 32 | FindInheritedAppPropertyKeysOrder order = context.getOrder(); 33 | FindInheritedAppPropertyKeysResult result = context.getResult(); 34 | 35 | for (AppInfo app : Apps.findInheritedApps(order.getAppId())) { 36 | List propertyKeys = PropertyKeys.findPropertyKeys(app.getAppId(), Scope.PRIVATE); 37 | result.addInheritedAppPropertyKey(new AppPropertyKey(app, propertyKeys)); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/FindInheritedAppsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-22 23:11 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import org.antframework.common.util.facade.BizException; 12 | import org.antframework.common.util.facade.CommonResultCode; 13 | import org.antframework.common.util.facade.Status; 14 | import org.antframework.configcenter.biz.util.Apps; 15 | import org.antframework.configcenter.facade.info.AppInfo; 16 | import org.antframework.configcenter.facade.order.FindInheritedAppsOrder; 17 | import org.antframework.configcenter.facade.result.FindInheritedAppsResult; 18 | import org.bekit.service.annotation.service.Service; 19 | import org.bekit.service.annotation.service.ServiceExecute; 20 | import org.bekit.service.engine.ServiceContext; 21 | 22 | /** 23 | * 查找应用继承的所有应用服务 24 | */ 25 | @Service 26 | public class FindInheritedAppsService { 27 | @ServiceExecute 28 | public void execute(ServiceContext context) { 29 | FindInheritedAppsOrder order = context.getOrder(); 30 | FindInheritedAppsResult result = context.getResult(); 31 | 32 | String appId = order.getAppId(); 33 | while (appId != null) { 34 | AppInfo app = Apps.findApp(appId); 35 | if (app == null) { 36 | throw new BizException(Status.FAIL, CommonResultCode.INVALID_PARAMETER.getCode(), String.format("应用[%s]不存在", appId)); 37 | } 38 | result.addInheritedApp(app); 39 | 40 | appId = app.getParent(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/FindInheritedProfilesService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 20:24 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import org.antframework.common.util.facade.BizException; 12 | import org.antframework.common.util.facade.CommonResultCode; 13 | import org.antframework.common.util.facade.Status; 14 | import org.antframework.configcenter.biz.util.Profiles; 15 | import org.antframework.configcenter.facade.info.ProfileInfo; 16 | import org.antframework.configcenter.facade.order.FindInheritedProfilesOrder; 17 | import org.antframework.configcenter.facade.result.FindInheritedProfilesResult; 18 | import org.bekit.service.annotation.service.Service; 19 | import org.bekit.service.annotation.service.ServiceExecute; 20 | import org.bekit.service.engine.ServiceContext; 21 | 22 | /** 23 | * 查找环境继承的所有环境服务 24 | */ 25 | @Service 26 | public class FindInheritedProfilesService { 27 | @ServiceExecute 28 | public void execute(ServiceContext context) { 29 | FindInheritedProfilesOrder order = context.getOrder(); 30 | FindInheritedProfilesResult result = context.getResult(); 31 | 32 | String profileId = order.getProfileId(); 33 | while (profileId != null) { 34 | ProfileInfo profile = Profiles.findProfile(profileId); 35 | if (profile == null) { 36 | throw new BizException(Status.FAIL, CommonResultCode.INVALID_PARAMETER.getCode(), String.format("环境[%s]不存在", profileId)); 37 | } 38 | result.addInheritedProfile(profile); 39 | 40 | profileId = profile.getParent(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/FindProfileService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 20:02 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.FacadeUtils; 13 | import org.antframework.configcenter.dal.dao.ProfileDao; 14 | import org.antframework.configcenter.dal.entity.Profile; 15 | import org.antframework.configcenter.facade.info.ProfileInfo; 16 | import org.antframework.configcenter.facade.order.FindProfileOrder; 17 | import org.antframework.configcenter.facade.result.FindProfileResult; 18 | import org.bekit.service.annotation.service.Service; 19 | import org.bekit.service.annotation.service.ServiceExecute; 20 | import org.bekit.service.engine.ServiceContext; 21 | import org.springframework.core.convert.converter.Converter; 22 | 23 | /** 24 | * 查找环境服务 25 | */ 26 | @Service 27 | @AllArgsConstructor 28 | public class FindProfileService { 29 | // 转换器 30 | private static final Converter CONVERTER = new FacadeUtils.DefaultConverter<>(ProfileInfo.class); 31 | 32 | // 环境dao 33 | private final ProfileDao profileDao; 34 | 35 | @ServiceExecute 36 | public void execute(ServiceContext context) { 37 | FindProfileOrder order = context.getOrder(); 38 | FindProfileResult result = context.getResult(); 39 | 40 | Profile profile = profileDao.findByProfileId(order.getProfileId()); 41 | if (profile != null) { 42 | result.setProfile(CONVERTER.convert(profile)); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/ProduceReleaseVersionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 17:23 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.BizException; 13 | import org.antframework.common.util.facade.CommonResultCode; 14 | import org.antframework.common.util.facade.Status; 15 | import org.antframework.configcenter.dal.dao.AppDao; 16 | import org.antframework.configcenter.dal.entity.App; 17 | import org.antframework.configcenter.facade.order.ProduceReleaseVersionOrder; 18 | import org.antframework.configcenter.facade.result.ProduceReleaseVersionResult; 19 | import org.bekit.service.annotation.service.Service; 20 | import org.bekit.service.annotation.service.ServiceExecute; 21 | import org.bekit.service.engine.ServiceContext; 22 | 23 | /** 24 | * 生产发布版本-服务 25 | */ 26 | @Service(enableTx = true) 27 | @AllArgsConstructor 28 | public class ProduceReleaseVersionService { 29 | // 应用dao 30 | private final AppDao appDao; 31 | 32 | @ServiceExecute 33 | public void execute(ServiceContext context) { 34 | ProduceReleaseVersionOrder order = context.getOrder(); 35 | ProduceReleaseVersionResult result = context.getResult(); 36 | 37 | App app = appDao.findLockByAppId(order.getAppId()); 38 | if (app == null) { 39 | throw new BizException(Status.FAIL, CommonResultCode.INVALID_PARAMETER.getCode(), String.format("应用[%s]不存在", order.getAppId())); 40 | } 41 | long version = app.getReleaseVersion() + 1; 42 | app.setReleaseVersion(version); 43 | appDao.save(app); 44 | 45 | result.setReleaseVersion(version); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/service/RevertPropertyValuesService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-12 20:44 创建 8 | */ 9 | package org.antframework.configcenter.biz.service; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.BizException; 13 | import org.antframework.common.util.facade.CommonResultCode; 14 | import org.antframework.common.util.facade.EmptyResult; 15 | import org.antframework.common.util.facade.Status; 16 | import org.antframework.configcenter.biz.util.PropertyValues; 17 | import org.antframework.configcenter.biz.util.Releases; 18 | import org.antframework.configcenter.facade.info.ReleaseInfo; 19 | import org.antframework.configcenter.facade.order.RevertPropertyValuesOrder; 20 | import org.antframework.configcenter.facade.vo.Property; 21 | import org.bekit.service.annotation.service.Service; 22 | import org.bekit.service.annotation.service.ServiceExecute; 23 | import org.bekit.service.engine.ServiceContext; 24 | 25 | /** 26 | * 回滚配置value服务 27 | */ 28 | @Service 29 | @AllArgsConstructor 30 | public class RevertPropertyValuesService { 31 | @ServiceExecute 32 | public void execute(ServiceContext context) { 33 | RevertPropertyValuesOrder order = context.getOrder(); 34 | // 校验入参 35 | ReleaseInfo release = Releases.findRelease(order.getAppId(), order.getProfileId(), order.getReleaseVersion()); 36 | if (release == null) { 37 | throw new BizException(Status.FAIL, CommonResultCode.INVALID_PARAMETER.getCode(), String.format("发布[appId=%s,profileId=%s,version=%d]不存在", order.getAppId(), order.getProfileId(), order.getReleaseVersion())); 38 | } 39 | // 删除现有配置value 40 | PropertyValues.deletePropertyValues(order.getAppId(), order.getProfileId(), order.getBranchId()); 41 | // 使用发布重建配置value 42 | for (Property property : release.getProperties()) { 43 | PropertyValues.addOrModifyPropertyValue( 44 | order.getAppId(), 45 | order.getProfileId(), 46 | order.getBranchId(), 47 | property.getKey(), 48 | property.getValue(), 49 | property.getScope()); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/util/Configs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-20 23:51 创建 8 | */ 9 | package org.antframework.configcenter.biz.util; 10 | 11 | import org.antframework.boot.core.Contexts; 12 | import org.antframework.common.util.facade.FacadeUtils; 13 | import org.antframework.configcenter.facade.api.ConfigService; 14 | import org.antframework.configcenter.facade.info.AppRelease; 15 | import org.antframework.configcenter.facade.order.FindInheritedAppReleasesOrder; 16 | import org.antframework.configcenter.facade.result.FindInheritedAppReleasesResult; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * 配置操作类 22 | */ 23 | public final class Configs { 24 | // 配置服务 25 | private static final ConfigService CONFIG_SERVICE = Contexts.getApplicationContext().getBean(ConfigService.class); 26 | 27 | /** 28 | * 查找继承的应用发布 29 | * 30 | * @param mainAppId 主体应用id 31 | * @param queriedAppId 被查询配置的应用id 32 | * @param profileId 环境id 33 | * @param target 目标 34 | * @return 继承的应用发布 35 | */ 36 | public static List findInheritedAppReleases(String mainAppId, String queriedAppId, String profileId, String target) { 37 | FindInheritedAppReleasesOrder order = new FindInheritedAppReleasesOrder(); 38 | order.setMainAppId(mainAppId); 39 | order.setQueriedAppId(queriedAppId); 40 | order.setProfileId(profileId); 41 | order.setTarget(target); 42 | 43 | FindInheritedAppReleasesResult result = CONFIG_SERVICE.findInheritedAppReleases(order); 44 | FacadeUtils.assertSuccess(result); 45 | return result.getInheritedAppReleases(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/util/Properties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-02-20 21:55 创建 8 | */ 9 | package org.antframework.configcenter.biz.util; 10 | 11 | import org.antframework.configcenter.facade.info.PropertyDifference; 12 | import org.antframework.configcenter.facade.vo.Property; 13 | 14 | import java.util.Map; 15 | import java.util.Objects; 16 | import java.util.Set; 17 | import java.util.function.Function; 18 | import java.util.stream.Collectors; 19 | 20 | /** 21 | * 配置工具类 22 | */ 23 | public final class Properties { 24 | /** 25 | * 比较配置集 26 | * 27 | * @param left 待比较的配置 28 | * @param right 待比较的配置 29 | * @return 配置差异 30 | */ 31 | public static PropertyDifference compare(Set left, Set right) { 32 | Map leftMap = left.stream().collect(Collectors.toMap(Property::getKey, Function.identity())); 33 | Map rightMap = right.stream().collect(Collectors.toMap(Property::getKey, Function.identity())); 34 | 35 | PropertyDifference difference = new PropertyDifference(); 36 | for (Property leftProperty : left) { 37 | Property rightProperty = rightMap.get(leftProperty.getKey()); 38 | if (rightProperty == null) { 39 | difference.addAddedKeys(leftProperty.getKey()); 40 | } else { 41 | if (!Objects.equals(rightProperty.getValue(), leftProperty.getValue())) { 42 | difference.addModifiedValueKey(leftProperty.getKey()); 43 | } 44 | if (rightProperty.getScope() != leftProperty.getScope()) { 45 | difference.addModifiedScopeKey(leftProperty.getKey()); 46 | } 47 | } 48 | } 49 | for (Property rightProperty : right) { 50 | if (!leftMap.containsKey(rightProperty.getKey())) { 51 | difference.addDeletedKeys(rightProperty.getKey()); 52 | } 53 | } 54 | 55 | return difference; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/util/PropertyKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-08-11 13:25 创建 8 | */ 9 | package org.antframework.configcenter.biz.util; 10 | 11 | import org.antframework.boot.core.Contexts; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.common.util.facade.FacadeUtils; 14 | import org.antframework.configcenter.facade.api.PropertyKeyService; 15 | import org.antframework.configcenter.facade.info.PropertyKeyInfo; 16 | import org.antframework.configcenter.facade.order.DeletePropertyKeyOrder; 17 | import org.antframework.configcenter.facade.order.FindPropertyKeysOrder; 18 | import org.antframework.configcenter.facade.result.FindPropertyKeysResult; 19 | import org.antframework.configcenter.facade.vo.Scope; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * 配置key操作类 25 | */ 26 | public final class PropertyKeys { 27 | // 配置key服务 28 | private static final PropertyKeyService PROPERTY_KEY_SERVICE = Contexts.getApplicationContext().getBean(PropertyKeyService.class); 29 | 30 | /** 31 | * 删除配置key 32 | * 33 | * @param appId 应用id 34 | * @param key key 35 | */ 36 | public static void deletePropertyKey(String appId, String key) { 37 | DeletePropertyKeyOrder order = new DeletePropertyKeyOrder(); 38 | order.setAppId(appId); 39 | order.setKey(key); 40 | 41 | EmptyResult result = PROPERTY_KEY_SERVICE.deletePropertyKey(order); 42 | FacadeUtils.assertSuccess(result); 43 | } 44 | 45 | /** 46 | * 查找配置key集 47 | * 48 | * @param appId 应用id 49 | * @param minScope 最小作用域 50 | * @return 应用的配置key 51 | */ 52 | public static List findPropertyKeys(String appId, Scope minScope) { 53 | FindPropertyKeysOrder order = new FindPropertyKeysOrder(); 54 | order.setAppId(appId); 55 | order.setMinScope(minScope); 56 | 57 | FindPropertyKeysResult result = PROPERTY_KEY_SERVICE.findPropertyKeys(order); 58 | FacadeUtils.assertSuccess(result); 59 | return result.getPropertyKeys(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/util/QueryUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-12-21 17:13 创建 8 | */ 9 | package org.antframework.configcenter.biz.util; 10 | 11 | import org.antframework.boot.bekit.CommonQueries; 12 | import org.springframework.data.domain.Sort; 13 | 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | /** 18 | * 查询工具类 19 | */ 20 | public final class QueryUtils { 21 | /** 22 | * 查询排序 23 | */ 24 | public static final Sort QUERY_SORT = Sort.by(new Sort.Order(Sort.Direction.DESC, "id")); 25 | 26 | /** 27 | * 构建通用查询附件 28 | * 29 | * @param daoClass dao类型 30 | * @return 附件 31 | */ 32 | public static Map buildCommonQueryAttachment(Class daoClass) { 33 | Map attachment = new HashMap<>(); 34 | attachment.put(CommonQueries.DAO_CLASS_KEY, daoClass); 35 | attachment.put(CommonQueries.SORT_KEY, QUERY_SORT); 36 | 37 | return attachment; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/util/Refreshes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-08-11 15:29 创建 8 | */ 9 | package org.antframework.configcenter.biz.util; 10 | 11 | import org.antframework.boot.core.Contexts; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.common.util.facade.FacadeUtils; 14 | import org.antframework.configcenter.facade.api.RefreshService; 15 | import org.antframework.configcenter.facade.order.RefreshClientsOrder; 16 | 17 | /** 18 | * 刷新操作类 19 | */ 20 | public final class Refreshes { 21 | // 刷新服务 22 | private static final RefreshService REFRESH_SERVICE = Contexts.getApplicationContext().getBean(RefreshService.class); 23 | 24 | /** 25 | * 刷新客户端 26 | * 27 | * @param rootAppId 根应用id(null表示刷新所有应用) 28 | * @param rootProfileId 根环境id(null表示刷新所有环境) 29 | */ 30 | public static void refreshClients(String rootAppId, String rootProfileId) { 31 | RefreshClientsOrder order = new RefreshClientsOrder(); 32 | order.setRootAppId(rootAppId); 33 | order.setRootProfileId(rootProfileId); 34 | 35 | EmptyResult result = REFRESH_SERVICE.refreshClients(order); 36 | FacadeUtils.assertSuccess(result); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /configcenter-biz/src/main/java/org/antframework/configcenter/biz/util/Releases.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-10 21:04 创建 8 | */ 9 | package org.antframework.configcenter.biz.util; 10 | 11 | import org.antframework.boot.core.Contexts; 12 | import org.antframework.common.util.facade.FacadeUtils; 13 | import org.antframework.configcenter.facade.api.ReleaseService; 14 | import org.antframework.configcenter.facade.info.ReleaseInfo; 15 | import org.antframework.configcenter.facade.order.FindReleaseOrder; 16 | import org.antframework.configcenter.facade.result.FindReleaseResult; 17 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 18 | 19 | import java.util.Date; 20 | import java.util.HashSet; 21 | 22 | /** 23 | * 发布操作类 24 | */ 25 | public final class Releases { 26 | // 发布服务 27 | private static final ReleaseService RELEASE_SERVICE = Contexts.getApplicationContext().getBean(ReleaseService.class); 28 | 29 | /** 30 | * 查找发布 31 | * 32 | * @param appId 应用id 33 | * @param profileId 环境id 34 | * @param version 版本 35 | * @return 发布(null表示无该发布) 36 | */ 37 | public static ReleaseInfo findRelease(String appId, String profileId, long version) { 38 | FindReleaseOrder order = new FindReleaseOrder(); 39 | order.setAppId(appId); 40 | order.setProfileId(profileId); 41 | order.setVersion(version); 42 | 43 | FindReleaseResult result = RELEASE_SERVICE.findRelease(order); 44 | FacadeUtils.assertSuccess(result); 45 | return result.getRelease(); 46 | } 47 | 48 | /** 49 | * 构建原始发布 50 | * 51 | * @param appId 应用id 52 | * @param profileId 环境id 53 | * @return 原始发布 54 | */ 55 | public static ReleaseInfo buildOriginRelease(String appId, String profileId) { 56 | ReleaseInfo release = new ReleaseInfo(); 57 | release.setAppId(appId); 58 | release.setProfileId(profileId); 59 | release.setVersion(ReleaseConstant.ORIGIN_VERSION); 60 | release.setReleaseTime(new Date()); 61 | release.setMemo("原始发布"); 62 | release.setProperties(new HashSet<>()); 63 | release.setParentVersion(null); 64 | 65 | return release; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /configcenter-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.antframework.configcenter 8 | configcenter 9 | 1.7.3 10 | 11 | 12 | configcenter-client 13 | 14 | 15 | 16 | org.antframework.common 17 | ant-common-util 18 | 19 | 20 | org.antframework.manager 21 | manager-client 22 | 23 | 24 | org.apache.httpcomponents 25 | httpclient 26 | 27 | 28 | com.fasterxml.jackson.core 29 | jackson-databind 30 | 31 | 32 | org.slf4j 33 | slf4j-api 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/ConfigListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-13 14:09 创建 8 | */ 9 | package org.antframework.configcenter.client; 10 | 11 | import org.antframework.configcenter.client.core.ChangedProperty; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 配置监听器 17 | */ 18 | @FunctionalInterface 19 | public interface ConfigListener { 20 | /** 21 | * 获取优先级(值越小优先级越高) 22 | */ 23 | default int getOrder() { 24 | return 0; 25 | } 26 | 27 | /** 28 | * 当配置被修改时调用本方法 29 | * 30 | * @param changedProperties 被修改的配置 31 | */ 32 | void onChange(List changedProperties); 33 | } 34 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/core/ChangedProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-11 13:54 创建 8 | */ 9 | package org.antframework.configcenter.client.core; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.tostring.ToString; 14 | import org.antframework.common.util.tostring.format.Mask; 15 | 16 | import java.io.Serializable; 17 | 18 | /** 19 | * 被修改的配置项 20 | */ 21 | @AllArgsConstructor 22 | @Getter 23 | public class ChangedProperty implements Serializable { 24 | // 修改类型 25 | private final ChangeType type; 26 | // key 27 | private final String key; 28 | // 旧值 29 | @Mask(secureMask = true) 30 | private final String oldValue; 31 | // 新值 32 | @Mask(secureMask = true) 33 | private final String newValue; 34 | 35 | @Override 36 | public String toString() { 37 | return ToString.toString(this); 38 | } 39 | 40 | /** 41 | * 修改类型 42 | */ 43 | public enum ChangeType { 44 | // 新增 45 | ADD, 46 | // 更新 47 | UPDATE, 48 | // 删除 49 | REMOVE 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/core/ConfigProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-11 13:47 创建 8 | */ 9 | package org.antframework.configcenter.client.core; 10 | 11 | /** 12 | * 配置集 13 | */ 14 | public interface ConfigProperties { 15 | /** 16 | * 获取配置项value 17 | * 18 | * @param key 配置项key 19 | * @return 配置项value 20 | */ 21 | String getProperty(String key); 22 | 23 | /** 24 | * 获取所有配置项key 25 | */ 26 | String[] getPropertyKeys(); 27 | 28 | /** 29 | * 是否包含指定配置项 30 | */ 31 | boolean contains(String key); 32 | } 33 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/core/ConfigurableConfigProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-11 13:49 创建 8 | */ 9 | package org.antframework.configcenter.client.core; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * 可配置的配置集 16 | */ 17 | public interface ConfigurableConfigProperties extends ConfigProperties { 18 | 19 | /** 20 | * 替换全部配置项 21 | * 22 | * @param newProperties 新配置项 23 | * @return 被修改的配置项 24 | */ 25 | List replaceProperties(Map newProperties); 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/core/DefaultConfigProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-11 13:56 创建 8 | */ 9 | package org.antframework.configcenter.client.core; 10 | 11 | import java.util.*; 12 | 13 | /** 14 | * 配置集默认实现 15 | */ 16 | public class DefaultConfigProperties implements ConfigurableConfigProperties { 17 | // 所有配置项 18 | private volatile Map properties = new HashMap<>(); 19 | 20 | @Override 21 | public String getProperty(String key) { 22 | return properties.get(key); 23 | } 24 | 25 | @Override 26 | public String[] getPropertyKeys() { 27 | Set keys = properties.keySet(); 28 | return keys.toArray(new String[keys.size()]); 29 | } 30 | 31 | @Override 32 | public boolean contains(String key) { 33 | return properties.containsKey(key); 34 | } 35 | 36 | @Override 37 | public synchronized List replaceProperties(Map newProperties) { 38 | List changedProperties = analyseChanges(properties, newProperties); 39 | properties = new HashMap<>(newProperties); 40 | return changedProperties; 41 | } 42 | 43 | // 分析被修改的配置项 44 | private static List analyseChanges(Map oldProperties, Map newProperties) { 45 | List changedProperties = new ArrayList<>(); 46 | // 分析删除和修改的配置项 47 | for (String key : oldProperties.keySet()) { 48 | if (!newProperties.containsKey(key)) { 49 | changedProperties.add(new ChangedProperty(ChangedProperty.ChangeType.REMOVE, key, oldProperties.get(key), null)); 50 | } else if (!Objects.equals(newProperties.get(key), oldProperties.get(key))) { 51 | changedProperties.add(new ChangedProperty(ChangedProperty.ChangeType.UPDATE, key, oldProperties.get(key), newProperties.get(key))); 52 | } 53 | } 54 | // 分析新增的配置项 55 | for (String key : newProperties.keySet()) { 56 | if (!oldProperties.containsKey(key)) { 57 | changedProperties.add(new ChangedProperty(ChangedProperty.ChangeType.ADD, key, null, newProperties.get(key))); 58 | } 59 | } 60 | 61 | return changedProperties; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/support/ConfigListeners.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-04-24 23:36 创建 8 | */ 9 | package org.antframework.configcenter.client.support; 10 | 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.antframework.configcenter.client.ConfigListener; 13 | import org.antframework.configcenter.client.core.ChangedProperty; 14 | 15 | import java.util.ArrayList; 16 | import java.util.Comparator; 17 | import java.util.List; 18 | 19 | /** 20 | * 配置监听器的管理器 21 | */ 22 | @Slf4j 23 | public class ConfigListeners { 24 | // 监听器 25 | private List listeners = new ArrayList<>(); 26 | 27 | /** 28 | * 添加监听器 29 | * 30 | * @param listener 需添加的监听器 31 | */ 32 | public synchronized void addListener(ConfigListener listener) { 33 | if (!listeners.contains(listener)) { 34 | List nextListeners = new ArrayList<>(listeners); 35 | nextListeners.add(listener); 36 | nextListeners.sort(Comparator.comparingInt(ConfigListener::getOrder)); 37 | listeners = nextListeners; 38 | } 39 | } 40 | 41 | /** 42 | * 删除监听器 43 | * 44 | * @param listener 需删除的监听器 45 | */ 46 | public synchronized void removeListener(ConfigListener listener) { 47 | if (listeners.contains(listener)) { 48 | List nextListeners = new ArrayList<>(listeners); 49 | nextListeners.remove(listener); 50 | listeners = nextListeners; 51 | } 52 | } 53 | 54 | // 配置变更后通知监听器 55 | synchronized void onChange(List changedProperties) { 56 | for (ConfigListener listener : listeners) { 57 | try { 58 | listener.onChange(changedProperties); 59 | } catch (Throwable e) { 60 | log.error("configcenter配置变更后通知配置监听器出错", e); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /configcenter-client/src/main/java/org/antframework/configcenter/client/support/TaskExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-08-19 18:26 创建 8 | */ 9 | package org.antframework.configcenter.client.support; 10 | 11 | import lombok.extern.slf4j.Slf4j; 12 | 13 | import java.util.concurrent.LinkedBlockingQueue; 14 | import java.util.concurrent.ThreadPoolExecutor; 15 | import java.util.concurrent.TimeUnit; 16 | 17 | /** 18 | * 任务执行器 19 | */ 20 | @Slf4j 21 | public class TaskExecutor { 22 | // 执行任务的线程池 23 | private final ThreadPoolExecutor threadPool = new ThreadPoolExecutor( 24 | 0, 25 | 1, 26 | 5, 27 | TimeUnit.SECONDS, 28 | new LinkedBlockingQueue<>(), 29 | new ThreadPoolExecutor.DiscardPolicy()); 30 | 31 | /** 32 | * 执行任务 33 | * 34 | * @param task 任务 35 | */ 36 | public void execute(Runnable task) { 37 | threadPool.execute(task); 38 | } 39 | 40 | /** 41 | * 关闭 42 | */ 43 | public void close() { 44 | threadPool.shutdown(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /configcenter-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-common 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.common 21 | ant-common-util 22 | 23 | 24 | org.springframework 25 | spring-context 26 | 27 | 28 | com.fasterxml.jackson.core 29 | jackson-databind 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /configcenter-common/src/main/java/org/antframework/configcenter/common/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-05-02 18:36 创建 8 | */ 9 | package org.antframework.configcenter.common.constant; 10 | 11 | /** 12 | * 缓存静态常量 13 | */ 14 | public final class CacheConstant { 15 | /** 16 | * 应用的缓存名 17 | */ 18 | public static final String APP_CACHE_NAME = "app"; 19 | 20 | /** 21 | * 环境的缓存名 22 | */ 23 | public static final String PROFILE_CACHE_NAME = "profile"; 24 | 25 | /** 26 | * 分支的缓存名 27 | */ 28 | public static final String BRANCH_CACHE_NAME = "branch"; 29 | 30 | /** 31 | * 分支规则集的缓存名 32 | */ 33 | public static final String BRANCH_RULES_CACHE_NAME = "branchRules"; 34 | 35 | /** 36 | * 发布的缓存名 37 | */ 38 | public static final String RELEASE_CACHE_NAME = "release"; 39 | 40 | /** 41 | * 配置key集的缓存名 42 | */ 43 | public static final String PROPERTY_KEYS_CACHE_NAME = "propertyKeys"; 44 | 45 | /** 46 | * 配置value集的缓存名 47 | */ 48 | public static final String PROPERTY_VALUES_CACHE_NAME = "propertyValues"; 49 | } 50 | -------------------------------------------------------------------------------- /configcenter-dal/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-dal 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.configcenter 21 | configcenter-common 22 | ${project.parent.version} 23 | 24 | 25 | org.antframework.configcenter 26 | configcenter-facade 27 | ${project.parent.version} 28 | 29 | 30 | org.antframework.boot 31 | ant-boot-starter-jpa 32 | 33 | 34 | mysql 35 | mysql-connector-java 36 | 37 | 38 | org.postgresql 39 | postgresql 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-cache 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/DalConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-22 15:27 创建 8 | */ 9 | package org.antframework.configcenter.dal; 10 | 11 | import org.springframework.cache.annotation.EnableCaching; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | /** 15 | * dal层配置 16 | */ 17 | @Configuration 18 | @EnableCaching 19 | public class DalConfiguration { 20 | } 21 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/AppDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 15:14 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.common.util.query.QueryParam; 12 | import org.antframework.configcenter.common.constant.CacheConstant; 13 | import org.antframework.configcenter.dal.entity.App; 14 | import org.springframework.cache.annotation.CacheEvict; 15 | import org.springframework.cache.annotation.Cacheable; 16 | import org.springframework.data.domain.Page; 17 | import org.springframework.data.domain.Pageable; 18 | import org.springframework.data.jpa.repository.Lock; 19 | import org.springframework.data.repository.RepositoryDefinition; 20 | 21 | import javax.persistence.LockModeType; 22 | import java.util.Collection; 23 | import java.util.List; 24 | 25 | /** 26 | * 应用dao 27 | */ 28 | @RepositoryDefinition(domainClass = App.class, idClass = Long.class) 29 | public interface AppDao { 30 | @CacheEvict(cacheNames = CacheConstant.APP_CACHE_NAME, key = "#p0.appId") 31 | void save(App app); 32 | 33 | @CacheEvict(cacheNames = CacheConstant.APP_CACHE_NAME, key = "#p0.appId") 34 | void delete(App app); 35 | 36 | @Lock(LockModeType.PESSIMISTIC_WRITE) 37 | App findLockByAppId(String appId); 38 | 39 | @Cacheable(cacheNames = CacheConstant.APP_CACHE_NAME, key = "#p0") 40 | App findByAppId(String appId); 41 | 42 | List findByParent(String parent); 43 | 44 | boolean existsByParent(String parent); 45 | 46 | Page query(Collection queryParams, Pageable pageable); 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/BranchDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-15 23:04 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.configcenter.common.constant.CacheConstant; 12 | import org.antframework.configcenter.dal.entity.Branch; 13 | import org.springframework.cache.annotation.CacheEvict; 14 | import org.springframework.cache.annotation.Cacheable; 15 | import org.springframework.data.jpa.repository.Lock; 16 | import org.springframework.data.repository.RepositoryDefinition; 17 | 18 | import javax.persistence.LockModeType; 19 | import java.util.List; 20 | 21 | /** 22 | * 分支dao 23 | */ 24 | @RepositoryDefinition(domainClass = Branch.class, idClass = Long.class) 25 | public interface BranchDao { 26 | @CacheEvict(cacheNames = CacheConstant.BRANCH_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId + ',' + #p0.branchId") 27 | void save(Branch branch); 28 | 29 | @CacheEvict(cacheNames = CacheConstant.BRANCH_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId + ',' + #p0.branchId") 30 | void delete(Branch branch); 31 | 32 | @Lock(LockModeType.PESSIMISTIC_WRITE) 33 | Branch findLockByAppIdAndProfileIdAndBranchId(String appId, String profileId, String branchId); 34 | 35 | @Lock(LockModeType.PESSIMISTIC_WRITE) 36 | List findLockByAppIdAndProfileId(String appId, String profileId); 37 | 38 | @Cacheable(cacheNames = CacheConstant.BRANCH_CACHE_NAME, key = "#p0 + ',' + #p1 + ',' + #p2") 39 | Branch findByAppIdAndProfileIdAndBranchId(String appId, String profileId, String branchId); 40 | 41 | List findByAppIdAndProfileId(String appId, String profileId); 42 | } 43 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/BranchRuleDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 14:25 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.configcenter.common.constant.CacheConstant; 12 | import org.antframework.configcenter.dal.entity.BranchRule; 13 | import org.springframework.cache.annotation.CacheEvict; 14 | import org.springframework.cache.annotation.Cacheable; 15 | import org.springframework.data.jpa.repository.Lock; 16 | import org.springframework.data.repository.RepositoryDefinition; 17 | 18 | import javax.persistence.LockModeType; 19 | import java.util.List; 20 | 21 | /** 22 | * 分支规则dao 23 | */ 24 | @RepositoryDefinition(domainClass = BranchRule.class, idClass = Long.class) 25 | public interface BranchRuleDao { 26 | @CacheEvict(cacheNames = CacheConstant.BRANCH_RULES_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId") 27 | void save(BranchRule branchRule); 28 | 29 | @CacheEvict(cacheNames = CacheConstant.BRANCH_RULES_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId") 30 | void delete(BranchRule branchRule); 31 | 32 | @Lock(LockModeType.PESSIMISTIC_WRITE) 33 | BranchRule findLockByAppIdAndProfileIdAndBranchId(String appId, String profileId, String branchId); 34 | 35 | @Cacheable(cacheNames = CacheConstant.BRANCH_RULES_CACHE_NAME, key = "#p0 + ',' + #p1") 36 | List findByAppIdAndProfileIdOrderByPriorityAsc(String appId, String profileId); 37 | } 38 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/MergenceDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-31 22:36 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.configcenter.dal.entity.Mergence; 12 | import org.springframework.data.jpa.repository.Lock; 13 | import org.springframework.data.repository.RepositoryDefinition; 14 | 15 | import javax.persistence.LockModeType; 16 | import java.util.List; 17 | 18 | /** 19 | * 合并dao 20 | */ 21 | @RepositoryDefinition(domainClass = Mergence.class, idClass = Long.class) 22 | public interface MergenceDao { 23 | void save(Mergence mergence); 24 | 25 | void delete(Mergence mergence); 26 | 27 | @Lock(LockModeType.PESSIMISTIC_WRITE) 28 | Mergence findLockByAppIdAndProfileIdAndReleaseVersion(String appId, String profileId, Long releaseVersion); 29 | 30 | @Lock(LockModeType.PESSIMISTIC_WRITE) 31 | List findLockByAppIdAndProfileIdAndSourceReleaseVersion(String appId, String profileId, Long sourceReleaseVersion); 32 | 33 | Mergence findByAppIdAndProfileIdAndReleaseVersion(String appId, String profileId, Long releaseVersion); 34 | } 35 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/ProfileDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 15:35 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.common.util.query.QueryParam; 12 | import org.antframework.configcenter.common.constant.CacheConstant; 13 | import org.antframework.configcenter.dal.entity.Profile; 14 | import org.springframework.cache.annotation.CacheEvict; 15 | import org.springframework.cache.annotation.Cacheable; 16 | import org.springframework.data.domain.Page; 17 | import org.springframework.data.domain.Pageable; 18 | import org.springframework.data.jpa.repository.Lock; 19 | import org.springframework.data.repository.RepositoryDefinition; 20 | 21 | import javax.persistence.LockModeType; 22 | import java.util.Collection; 23 | import java.util.List; 24 | 25 | /** 26 | * 环境dao 27 | */ 28 | @RepositoryDefinition(domainClass = Profile.class, idClass = Long.class) 29 | public interface ProfileDao { 30 | @CacheEvict(cacheNames = CacheConstant.PROFILE_CACHE_NAME, key = "#p0.profileId") 31 | void save(Profile profile); 32 | 33 | @CacheEvict(cacheNames = CacheConstant.PROFILE_CACHE_NAME, key = "#p0.profileId") 34 | void delete(Profile profile); 35 | 36 | @Lock(LockModeType.PESSIMISTIC_WRITE) 37 | Profile findLockByProfileId(String profileId); 38 | 39 | @Cacheable(cacheNames = CacheConstant.PROFILE_CACHE_NAME, key = "#p0") 40 | Profile findByProfileId(String profileId); 41 | 42 | List findByParent(String parent); 43 | 44 | boolean existsByParent(String parent); 45 | 46 | Page query(Collection queryParams, Pageable pageable); 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/PropertyKeyDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 20:46 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.configcenter.common.constant.CacheConstant; 12 | import org.antframework.configcenter.dal.entity.PropertyKey; 13 | import org.springframework.cache.annotation.CacheEvict; 14 | import org.springframework.cache.annotation.Cacheable; 15 | import org.springframework.data.jpa.repository.Lock; 16 | import org.springframework.data.repository.RepositoryDefinition; 17 | 18 | import javax.persistence.LockModeType; 19 | import java.util.List; 20 | 21 | /** 22 | * 配置key dao 23 | */ 24 | @RepositoryDefinition(domainClass = PropertyKey.class, idClass = Long.class) 25 | public interface PropertyKeyDao { 26 | @CacheEvict(cacheNames = CacheConstant.PROPERTY_KEYS_CACHE_NAME, key = "#p0.appId") 27 | void save(PropertyKey propertyKey); 28 | 29 | @CacheEvict(cacheNames = CacheConstant.PROPERTY_KEYS_CACHE_NAME, key = "#p0.appId") 30 | void delete(PropertyKey propertyKey); 31 | 32 | @Lock(LockModeType.PESSIMISTIC_WRITE) 33 | PropertyKey findLockByAppIdAndKey(String appId, String key); 34 | 35 | @Cacheable(cacheNames = CacheConstant.PROPERTY_KEYS_CACHE_NAME, key = "#p0") 36 | List findByAppId(String appId); 37 | } 38 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/PropertyValueDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 01:41 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.configcenter.common.constant.CacheConstant; 12 | import org.antframework.configcenter.dal.entity.PropertyValue; 13 | import org.springframework.cache.annotation.CacheEvict; 14 | import org.springframework.cache.annotation.Cacheable; 15 | import org.springframework.data.jpa.repository.Lock; 16 | import org.springframework.data.repository.RepositoryDefinition; 17 | 18 | import javax.persistence.LockModeType; 19 | import java.util.List; 20 | 21 | /** 22 | * 配置value dao 23 | */ 24 | @RepositoryDefinition(domainClass = PropertyValue.class, idClass = Long.class) 25 | public interface PropertyValueDao { 26 | @CacheEvict(cacheNames = CacheConstant.PROPERTY_VALUES_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId + ',' + #p0.branchId") 27 | void save(PropertyValue propertyValue); 28 | 29 | @CacheEvict(cacheNames = CacheConstant.PROPERTY_VALUES_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId + ',' + #p0.branchId") 30 | void delete(PropertyValue propertyValue); 31 | 32 | @Lock(LockModeType.PESSIMISTIC_WRITE) 33 | PropertyValue findLockByAppIdAndProfileIdAndBranchIdAndKey(String appId, String profileId, String branchId, String key); 34 | 35 | @Cacheable(cacheNames = CacheConstant.PROPERTY_VALUES_CACHE_NAME, key = "#p0 + ',' + #p1 + ',' + #p2") 36 | List findByAppIdAndProfileIdAndBranchId(String appId, String profileId, String branchId); 37 | } 38 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/dao/ReleaseDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-06 22:28 创建 8 | */ 9 | package org.antframework.configcenter.dal.dao; 10 | 11 | import org.antframework.common.util.query.QueryParam; 12 | import org.antframework.configcenter.common.constant.CacheConstant; 13 | import org.antframework.configcenter.dal.entity.Release; 14 | import org.springframework.cache.annotation.CacheEvict; 15 | import org.springframework.cache.annotation.Cacheable; 16 | import org.springframework.data.domain.Page; 17 | import org.springframework.data.domain.Pageable; 18 | import org.springframework.data.jpa.repository.Lock; 19 | import org.springframework.data.repository.RepositoryDefinition; 20 | 21 | import javax.persistence.LockModeType; 22 | import java.util.Collection; 23 | 24 | /** 25 | * 发布dao 26 | */ 27 | @RepositoryDefinition(domainClass = Release.class, idClass = Long.class) 28 | public interface ReleaseDao { 29 | @CacheEvict(cacheNames = CacheConstant.RELEASE_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId + ',' + #p0.version") 30 | void save(Release release); 31 | 32 | @CacheEvict(cacheNames = CacheConstant.RELEASE_CACHE_NAME, key = "#p0.appId + ',' + #p0.profileId + ',' + #p0.version") 33 | void delete(Release release); 34 | 35 | @Lock(LockModeType.PESSIMISTIC_WRITE) 36 | Release findLockByAppIdAndProfileIdAndVersion(String appId, String profileId, Long version); 37 | 38 | @Cacheable(cacheNames = CacheConstant.RELEASE_CACHE_NAME, key = "#p0 + ',' + #p1 + ',' + #p2") 39 | Release findByAppIdAndProfileIdAndVersion(String appId, String profileId, Long version); 40 | 41 | boolean existsByAppIdAndProfileIdAndParentVersion(String appId, String profileId, Long parentVersion); 42 | 43 | Page query(Collection queryParams, Pageable pageable); 44 | } 45 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 01:35 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | 15 | import javax.persistence.Column; 16 | import javax.persistence.Entity; 17 | import javax.persistence.Table; 18 | import javax.persistence.UniqueConstraint; 19 | 20 | /** 21 | * 应用 22 | */ 23 | @Entity 24 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_appId", columnNames = "appId")) 25 | @Getter 26 | @Setter 27 | public class App extends AbstractEntity { 28 | // 应用id 29 | @Column(length = 64) 30 | private String appId; 31 | 32 | // 应用名 33 | @Column 34 | private String appName; 35 | 36 | // 发布版本 37 | @Column 38 | private Long releaseVersion; 39 | 40 | // 父应用id(null表示无父应用) 41 | @Column(length = 64) 42 | private String parent; 43 | } 44 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/Branch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-14 21:09 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | 15 | import javax.persistence.Column; 16 | import javax.persistence.Entity; 17 | import javax.persistence.Table; 18 | import javax.persistence.UniqueConstraint; 19 | 20 | /** 21 | * 分支 22 | */ 23 | @Entity 24 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_appId_profileId_branchId", columnNames = {"appId", "profileId", "branchId"})) 25 | @Getter 26 | @Setter 27 | public class Branch extends AbstractEntity { 28 | // 应用id 29 | @Column(length = 64) 30 | private String appId; 31 | 32 | // 环境id 33 | @Column(length = 64) 34 | private String profileId; 35 | 36 | // 分支id 37 | @Column(length = 64) 38 | private String branchId; 39 | 40 | // 发布版本 41 | @Column 42 | private Long releaseVersion; 43 | } 44 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/BranchRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 14:20 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | 15 | import javax.persistence.Column; 16 | import javax.persistence.Entity; 17 | import javax.persistence.Table; 18 | import javax.persistence.UniqueConstraint; 19 | 20 | /** 21 | * 分支规则 22 | */ 23 | @Entity 24 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_appId_profileId_branchId", columnNames = {"appId", "profileId", "branchId"})) 25 | @Getter 26 | @Setter 27 | public class BranchRule extends AbstractEntity { 28 | // 应用id 29 | @Column(length = 64) 30 | private String appId; 31 | 32 | // 环境id 33 | @Column(length = 64) 34 | private String profileId; 35 | 36 | // 分支id 37 | @Column(length = 64) 38 | private String branchId; 39 | 40 | // 规则 41 | @Column 42 | private String rule; 43 | 44 | // 优先级 45 | @Column 46 | private Long priority; 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/Mergence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-15 21:37 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | 15 | import javax.persistence.*; 16 | 17 | /** 18 | * 合并 19 | */ 20 | @Entity 21 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_appId_profileId_releaseVersion", columnNames = {"appId", "profileId", "releaseVersion"}), 22 | indexes = @Index(name = "idx_appId_profileId_sourceReleaseVersion", columnList = "appId,profileId,sourceReleaseVersion")) 23 | @Getter 24 | @Setter 25 | public class Mergence extends AbstractEntity { 26 | // 应用id 27 | @Column(length = 64) 28 | private String appId; 29 | 30 | // 环境id 31 | @Column(length = 64) 32 | private String profileId; 33 | 34 | // 发布版本 35 | @Column 36 | private Long releaseVersion; 37 | 38 | // 源发布版本 39 | @Column 40 | private Long sourceReleaseVersion; 41 | } 42 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/Profile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 01:34 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | 15 | import javax.persistence.Column; 16 | import javax.persistence.Entity; 17 | import javax.persistence.Table; 18 | import javax.persistence.UniqueConstraint; 19 | 20 | /** 21 | * 环境 22 | */ 23 | @Entity 24 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_profileId", columnNames = "profileId")) 25 | @Getter 26 | @Setter 27 | public class Profile extends AbstractEntity { 28 | // 环境id 29 | @Column(length = 64) 30 | private String profileId; 31 | 32 | // 环境名 33 | @Column 34 | private String profileName; 35 | 36 | // 父环境id(null表示无父环境) 37 | @Column(length = 64) 38 | private String parent; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/PropertyKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 01:37 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | import org.antframework.configcenter.facade.vo.Scope; 15 | 16 | import javax.persistence.*; 17 | 18 | /** 19 | * 配置key 20 | */ 21 | @Entity 22 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_appId_key", columnNames = {"appId", "key"})) 23 | @Getter 24 | @Setter 25 | public class PropertyKey extends AbstractEntity { 26 | // 应用id 27 | @Column(length = 64) 28 | private String appId; 29 | 30 | // key 31 | @Column(name = "`key`", length = 128) 32 | private String key; 33 | 34 | // 作用域 35 | @Column(length = 64) 36 | @Enumerated(EnumType.STRING) 37 | private Scope scope; 38 | 39 | // 备注 40 | @Column 41 | private String memo; 42 | } 43 | -------------------------------------------------------------------------------- /configcenter-dal/src/main/java/org/antframework/configcenter/dal/entity/PropertyValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 01:41 创建 8 | */ 9 | package org.antframework.configcenter.dal.entity; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.boot.jpa.AbstractEntity; 14 | import org.antframework.common.util.tostring.format.Mask; 15 | import org.antframework.configcenter.facade.vo.Scope; 16 | 17 | import javax.persistence.*; 18 | 19 | /** 20 | * 配置value 21 | */ 22 | @Entity 23 | @Table(uniqueConstraints = @UniqueConstraint(name = "uk_appId_profileId_branchId_key", columnNames = {"appId", "profileId", "branchId", "key"})) 24 | @Getter 25 | @Setter 26 | public class PropertyValue extends AbstractEntity { 27 | // 应用id 28 | @Column(length = 64) 29 | private String appId; 30 | 31 | // 环境id 32 | @Column(length = 64) 33 | private String profileId; 34 | 35 | // 分支id 36 | @Column(length = 64) 37 | private String branchId; 38 | 39 | // key 40 | @Column(name = "`key`", length = 128) 41 | private String key; 42 | 43 | // value 44 | @Column 45 | @Lob 46 | @Mask(secureMask = true) 47 | private String value; 48 | 49 | // 作用域 50 | @Column(length = 64) 51 | @Enumerated(EnumType.STRING) 52 | private Scope scope; 53 | } 54 | -------------------------------------------------------------------------------- /configcenter-facade/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-facade 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.common 21 | ant-common-util 22 | provided 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/AppService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:07 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.*; 13 | import org.antframework.configcenter.facade.result.*; 14 | 15 | /** 16 | * 应用服务 17 | */ 18 | public interface AppService { 19 | /** 20 | * 添加或修改应用 21 | */ 22 | EmptyResult addOrModifyApp(AddOrModifyAppOrder order); 23 | 24 | /** 25 | * 生产发布版本 26 | */ 27 | ProduceReleaseVersionResult produceReleaseVersion(ProduceReleaseVersionOrder order); 28 | 29 | /** 30 | * 删除应用 31 | */ 32 | EmptyResult deleteApp(DeleteAppOrder order); 33 | 34 | /** 35 | * 查找应用 36 | */ 37 | FindAppResult findApp(FindAppOrder order); 38 | 39 | /** 40 | * 查找应用继承的所有应用 41 | */ 42 | FindInheritedAppsResult findInheritedApps(FindInheritedAppsOrder order); 43 | 44 | /** 45 | * 查找应用树 46 | */ 47 | FindAppTreeResult findAppTree(FindAppTreeOrder order); 48 | 49 | /** 50 | * 查询应用 51 | */ 52 | QueryAppsResult queryApps(QueryAppsOrder order); 53 | } 54 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/BranchRuleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 14:28 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.AddOrModifyBranchRuleOrder; 13 | import org.antframework.configcenter.facade.order.ComputeBranchRulesOrder; 14 | import org.antframework.configcenter.facade.order.DeleteBranchRuleOrder; 15 | import org.antframework.configcenter.facade.order.FindBranchRulesOrder; 16 | import org.antframework.configcenter.facade.result.ComputeBranchRulesResult; 17 | import org.antframework.configcenter.facade.result.FindBranchRulesResult; 18 | 19 | /** 20 | * 分支规则服务 21 | */ 22 | public interface BranchRuleService { 23 | /** 24 | * 新增或修改分支规则 25 | */ 26 | EmptyResult addOrModifyBranchRule(AddOrModifyBranchRuleOrder order); 27 | 28 | /** 29 | * 删除分支规则 30 | */ 31 | EmptyResult deleteBranchRule(DeleteBranchRuleOrder order); 32 | 33 | /** 34 | * 查找分支规则 35 | */ 36 | FindBranchRulesResult findBranchRules(FindBranchRulesOrder order); 37 | 38 | /** 39 | * 计算分支规则 40 | */ 41 | ComputeBranchRulesResult computeBranchRules(ComputeBranchRulesOrder order); 42 | } 43 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/BranchService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-17 21:42 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.*; 13 | import org.antframework.configcenter.facade.result.ComputeBranchMergenceResult; 14 | import org.antframework.configcenter.facade.result.FindBranchResult; 15 | import org.antframework.configcenter.facade.result.FindBranchesResult; 16 | import org.antframework.configcenter.facade.result.MergeBranchResult; 17 | 18 | /** 19 | * 分支服务 20 | */ 21 | public interface BranchService { 22 | /** 23 | * 添加分支 24 | */ 25 | EmptyResult addBranch(AddBranchOrder order); 26 | 27 | /** 28 | * 发布分支 29 | */ 30 | ReleaseBranchResult releaseBranch(ReleaseBranchOrder order); 31 | 32 | /** 33 | * 回滚分支 34 | */ 35 | EmptyResult revertBranch(RevertBranchOrder order); 36 | 37 | /** 38 | * 合并分支 39 | */ 40 | MergeBranchResult mergeBranch(MergeBranchOrder order); 41 | 42 | /** 43 | * 计算分支合并 44 | */ 45 | ComputeBranchMergenceResult computeBranchMergence(ComputeBranchMergenceOrder order); 46 | 47 | /** 48 | * 删除分支 49 | */ 50 | EmptyResult deleteBranch(DeleteBranchOrder order); 51 | 52 | /** 53 | * 查找分支 54 | */ 55 | FindBranchResult findBranch(FindBranchOrder order); 56 | 57 | /** 58 | * 查找应用在环境下的所有分支 59 | */ 60 | FindBranchesResult findBranches(FindBranchesOrder order); 61 | } 62 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/ConfigService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:09 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.configcenter.facade.order.FindConfigOrder; 12 | import org.antframework.configcenter.facade.order.FindInheritedAppReleasesOrder; 13 | import org.antframework.configcenter.facade.result.FindConfigResult; 14 | import org.antframework.configcenter.facade.result.FindInheritedAppReleasesResult; 15 | 16 | /** 17 | * 配置服务 18 | */ 19 | public interface ConfigService { 20 | /** 21 | * 查找应用在指定环境中的配置 22 | */ 23 | FindConfigResult findConfig(FindConfigOrder order); 24 | 25 | /** 26 | * 查找继承的应用发布 27 | */ 28 | FindInheritedAppReleasesResult findInheritedAppReleases(FindInheritedAppReleasesOrder order); 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/ProfileService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:08 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.*; 13 | import org.antframework.configcenter.facade.result.FindInheritedProfilesResult; 14 | import org.antframework.configcenter.facade.result.FindProfileResult; 15 | import org.antframework.configcenter.facade.result.FindProfileTreeResult; 16 | import org.antframework.configcenter.facade.result.QueryProfilesResult; 17 | 18 | /** 19 | * 环境服务 20 | */ 21 | public interface ProfileService { 22 | /** 23 | * 添加或修改环境 24 | */ 25 | EmptyResult addOrModifyProfile(AddOrModifyProfileOrder order); 26 | 27 | /** 28 | * 删除环境 29 | */ 30 | EmptyResult deleteProfile(DeleteProfileOrder order); 31 | 32 | /** 33 | * 查找环境 34 | */ 35 | FindProfileResult findProfile(FindProfileOrder order); 36 | 37 | /** 38 | * 查找环境继承的所有环境 39 | */ 40 | FindInheritedProfilesResult findInheritedProfiles(FindInheritedProfilesOrder order); 41 | 42 | /** 43 | * 查找环境树 44 | */ 45 | FindProfileTreeResult findProfileTree(FindProfileTreeOrder order); 46 | 47 | /** 48 | * 查询环境 49 | */ 50 | QueryProfilesResult queryProfiles(QueryProfilesOrder order); 51 | } 52 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/PropertyKeyService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 13:52 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.AddOrModifyPropertyKeyOrder; 13 | import org.antframework.configcenter.facade.order.DeletePropertyKeyOrder; 14 | import org.antframework.configcenter.facade.order.FindInheritedAppPropertyKeysOrder; 15 | import org.antframework.configcenter.facade.order.FindPropertyKeysOrder; 16 | import org.antframework.configcenter.facade.result.FindInheritedAppPropertyKeysResult; 17 | import org.antframework.configcenter.facade.result.FindPropertyKeysResult; 18 | 19 | /** 20 | * 配置key服务 21 | */ 22 | public interface PropertyKeyService { 23 | /** 24 | * 添加或修改配置key 25 | */ 26 | EmptyResult addOrModifyPropertyKey(AddOrModifyPropertyKeyOrder order); 27 | 28 | /** 29 | * 删除配置key 30 | */ 31 | EmptyResult deletePropertyKey(DeletePropertyKeyOrder order); 32 | 33 | /** 34 | * 查找配置key集 35 | */ 36 | FindPropertyKeysResult findPropertyKeys(FindPropertyKeysOrder order); 37 | 38 | /** 39 | * 查找继承的应用配置key 40 | */ 41 | FindInheritedAppPropertyKeysResult findInheritedAppPropertyKeys(FindInheritedAppPropertyKeysOrder order); 42 | } 43 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/PropertyValueService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:08 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.AddOrModifyPropertyValueOrder; 13 | import org.antframework.configcenter.facade.order.DeletePropertyValueOrder; 14 | import org.antframework.configcenter.facade.order.FindPropertyValuesOrder; 15 | import org.antframework.configcenter.facade.order.RevertPropertyValuesOrder; 16 | import org.antframework.configcenter.facade.result.FindPropertyValuesResult; 17 | 18 | /** 19 | * 配置value服务 20 | */ 21 | public interface PropertyValueService { 22 | /** 23 | * 新增或修改配置value 24 | */ 25 | EmptyResult addOrModifyPropertyValue(AddOrModifyPropertyValueOrder order); 26 | 27 | /** 28 | * 删除配置value 29 | */ 30 | EmptyResult deletePropertyValue(DeletePropertyValueOrder order); 31 | 32 | /** 33 | * 回滚配置value 34 | */ 35 | EmptyResult revertPropertyValues(RevertPropertyValuesOrder order); 36 | 37 | /** 38 | * 查找配置value集 39 | */ 40 | FindPropertyValuesResult findPropertyValues(FindPropertyValuesOrder order); 41 | } 42 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/RefreshService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-16 13:44 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.configcenter.facade.order.RefreshClientsOrder; 13 | 14 | /** 15 | * 刷新服务 16 | */ 17 | public interface RefreshService { 18 | /** 19 | * 刷新客户端 20 | */ 21 | EmptyResult refreshClients(RefreshClientsOrder order); 22 | } 23 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/api/ReleaseService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 20:55 创建 8 | */ 9 | package org.antframework.configcenter.facade.api; 10 | 11 | import org.antframework.configcenter.facade.order.FindReleaseOrder; 12 | import org.antframework.configcenter.facade.order.QueryReleasesOrder; 13 | import org.antframework.configcenter.facade.result.FindReleaseResult; 14 | import org.antframework.configcenter.facade.result.QueryReleasesResult; 15 | 16 | /** 17 | * 发布服务 18 | */ 19 | public interface ReleaseService { 20 | /** 21 | * 查找发布 22 | */ 23 | FindReleaseResult findRelease(FindReleaseOrder order); 24 | 25 | /** 26 | * 查询发布 27 | */ 28 | QueryReleasesResult queryReleases(QueryReleasesOrder order); 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/AppInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 21:47 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | /** 16 | * 应用info 17 | */ 18 | @Getter 19 | @Setter 20 | public class AppInfo extends AbstractInfo { 21 | // 应用id 22 | private String appId; 23 | // 应用名 24 | private String appName; 25 | // 发布版本 26 | private Long releaseVersion; 27 | // 父应用id(null表示无父应用) 28 | private String parent; 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/AppPropertyKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 17:47 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * 应用配置key 19 | */ 20 | @AllArgsConstructor 21 | @Getter 22 | public class AppPropertyKey extends AbstractInfo { 23 | // 应用 24 | private final AppInfo app; 25 | // 所有配置key 26 | private final List propertyKeys; 27 | } 28 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/AppRelease.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 15:35 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * 应用发布 19 | */ 20 | @AllArgsConstructor 21 | @Getter 22 | public class AppRelease extends AbstractInfo { 23 | // 应用 24 | private final AppInfo app; 25 | // 由近及远继承的环境中的发布 26 | private final List inheritedProfileReleases; 27 | } 28 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/AppTree.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-21 22:15 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 应用树 20 | */ 21 | @AllArgsConstructor 22 | @Getter 23 | public class AppTree extends AbstractInfo { 24 | // 根节点 25 | private final AppInfo app; 26 | // 子树 27 | private final List children = new ArrayList<>(); 28 | 29 | public void addChild(AppTree child) { 30 | children.add(child); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/BranchInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-17 22:42 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | /** 16 | * 分支info 17 | */ 18 | @Getter 19 | @Setter 20 | public class BranchInfo extends AbstractInfo { 21 | // 应用id 22 | private String appId; 23 | // 环境id 24 | private String profileId; 25 | // 分支id 26 | private String branchId; 27 | // 发布 28 | private ReleaseInfo release; 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/BranchRuleInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 19:58 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | /** 16 | * 分支规则info 17 | */ 18 | @Getter 19 | @Setter 20 | public class BranchRuleInfo extends AbstractInfo { 21 | // 应用id 22 | private String appId; 23 | // 环境id 24 | private String profileId; 25 | // 分支id 26 | private String branchId; 27 | // 规则 28 | private String rule; 29 | // 优先级 30 | private Long priority; 31 | } 32 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/ProfileInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 20:33 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | /** 16 | * 环境info 17 | */ 18 | @Getter 19 | @Setter 20 | public class ProfileInfo extends AbstractInfo { 21 | // 环境id 22 | private String profileId; 23 | // 环境名 24 | private String profileName; 25 | // 父环境id(null表示无父环境) 26 | private String parent; 27 | } 28 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/ProfileTree.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 21:08 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 环境树 20 | */ 21 | @AllArgsConstructor 22 | @Getter 23 | public class ProfileTree extends AbstractInfo { 24 | // 根节点 25 | private final ProfileInfo profile; 26 | // 子树 27 | private final List children = new ArrayList<>(); 28 | 29 | public void addChild(ProfileTree child) { 30 | children.add(child); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/PropertyChange.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-07 21:31 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractInfo; 13 | import org.antframework.configcenter.facade.vo.Property; 14 | 15 | import java.util.HashSet; 16 | import java.util.Set; 17 | 18 | /** 19 | * 配置变动 20 | */ 21 | @Getter 22 | public class PropertyChange extends AbstractInfo { 23 | // 添加或修改的配置 24 | private final Set addedOrModifiedProperties = new HashSet<>(); 25 | // 删除的配置key 26 | private final Set deletedKeys = new HashSet<>(); 27 | 28 | public void addAddedOrModifiedProperty(Property property) { 29 | addedOrModifiedProperties.add(property); 30 | } 31 | 32 | public void addDeletedKey(String key) { 33 | deletedKeys.add(key); 34 | } 35 | } -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/PropertyDifference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-09 23:23 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractInfo; 13 | 14 | import java.util.HashSet; 15 | import java.util.Set; 16 | 17 | /** 18 | * 配置差异 19 | */ 20 | @Getter 21 | public class PropertyDifference extends AbstractInfo { 22 | // 新增配置的key 23 | private final Set addedKeys = new HashSet<>(); 24 | // 被修改的配置value的key 25 | private final Set modifiedValueKeys = new HashSet<>(); 26 | // 被修改的scope的key 27 | private final Set modifiedScopeKeys = new HashSet<>(); 28 | // 被删除配置的key 29 | private final Set deletedKeys = new HashSet<>(); 30 | 31 | public void addAddedKeys(String key) { 32 | addedKeys.add(key); 33 | } 34 | 35 | public void addModifiedValueKey(String key) { 36 | modifiedValueKeys.add(key); 37 | } 38 | 39 | public void addModifiedScopeKey(String key) { 40 | modifiedScopeKeys.add(key); 41 | } 42 | 43 | public void addDeletedKeys(String key) { 44 | deletedKeys.add(key); 45 | } 46 | } -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/PropertyKeyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-02 13:03 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | import org.antframework.configcenter.facade.vo.Scope; 15 | 16 | /** 17 | * 配置key-info 18 | */ 19 | @Getter 20 | @Setter 21 | public class PropertyKeyInfo extends AbstractInfo { 22 | // 应用id 23 | private String appId; 24 | // key 25 | private String key; 26 | // 作用域 27 | private Scope scope; 28 | // 备注 29 | private String memo; 30 | } 31 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/PropertyValueInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-02 19:37 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | import org.antframework.common.util.tostring.format.Mask; 15 | import org.antframework.configcenter.facade.vo.Scope; 16 | 17 | /** 18 | * 配置value-info 19 | */ 20 | @Getter 21 | @Setter 22 | public class PropertyValueInfo extends AbstractInfo { 23 | // 应用id 24 | private String appId; 25 | // 环境id 26 | private String profileId; 27 | // 分支id 28 | private String branchId; 29 | // key 30 | private String key; 31 | // value 32 | @Mask(secureMask = true) 33 | private String value; 34 | // 作用域 35 | private Scope scope; 36 | } 37 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/info/ReleaseInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 20:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.info; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractInfo; 14 | import org.antframework.configcenter.facade.vo.Property; 15 | 16 | import java.util.Date; 17 | import java.util.Set; 18 | 19 | /** 20 | * 发布info 21 | */ 22 | @Getter 23 | @Setter 24 | public class ReleaseInfo extends AbstractInfo { 25 | // 应用id 26 | private String appId; 27 | // 环境id 28 | private String profileId; 29 | // 版本 30 | private Long version; 31 | // 发布时间 32 | private Date releaseTime; 33 | // 备注 34 | private String memo; 35 | // 配置集 36 | private Set properties; 37 | // 父版本 38 | private Long parentVersion; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/AddBranchOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-17 22:03 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 15 | 16 | import javax.validation.constraints.Min; 17 | import javax.validation.constraints.NotBlank; 18 | import javax.validation.constraints.NotNull; 19 | 20 | /** 21 | * 添加分支order 22 | */ 23 | @Getter 24 | @Setter 25 | public class AddBranchOrder extends AbstractOrder { 26 | // 应用id 27 | @NotBlank 28 | private String appId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 分支id 33 | @NotBlank 34 | private String branchId; 35 | // 发布版本 36 | @Min(ReleaseConstant.ORIGIN_VERSION) 37 | @NotNull 38 | private Long releaseVersion; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/AddOrModifyAppOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:11 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 添加或修改应用order 19 | */ 20 | @Getter 21 | @Setter 22 | public class AddOrModifyAppOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 应用名 27 | private String appName; 28 | // 父应用id(null表示无父应用) 29 | private String parent; 30 | } 31 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/AddOrModifyBranchRuleOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 14:29 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | import javax.validation.constraints.NotNull; 17 | 18 | /** 19 | * 新增或修改分支规则order 20 | */ 21 | @Getter 22 | @Setter 23 | public class AddOrModifyBranchRuleOrder extends AbstractOrder { 24 | // 应用id 25 | @NotBlank 26 | private String appId; 27 | // 环境id 28 | @NotBlank 29 | private String profileId; 30 | // 分支id 31 | @NotBlank 32 | private String branchId; 33 | // 规则 34 | @NotBlank 35 | private String rule; 36 | // 优先级 37 | @NotNull 38 | private Long priority; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/AddOrModifyProfileOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:20 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 添加或修改环境order 19 | */ 20 | @Getter 21 | @Setter 22 | public class AddOrModifyProfileOrder extends AbstractOrder { 23 | // 环境id 24 | @NotBlank 25 | private String profileId; 26 | // 环境名 27 | private String profileName; 28 | // 父环境id(null表示无父环境) 29 | private String parent; 30 | } 31 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/AddOrModifyPropertyKeyOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 13:53 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.Scope; 15 | 16 | import javax.validation.constraints.NotBlank; 17 | import javax.validation.constraints.NotNull; 18 | 19 | /** 20 | * 添加或修改配置key-order 21 | */ 22 | @Getter 23 | @Setter 24 | public class AddOrModifyPropertyKeyOrder extends AbstractOrder { 25 | // 应用id 26 | @NotBlank 27 | private String appId; 28 | // key 29 | @NotBlank 30 | private String key; 31 | // 作用域 32 | @NotNull 33 | private Scope scope; 34 | // 备注 35 | private String memo; 36 | } 37 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/AddOrModifyPropertyValueOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 22:40 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.common.util.tostring.format.Mask; 15 | import org.antframework.configcenter.facade.vo.Scope; 16 | 17 | import javax.validation.constraints.NotBlank; 18 | import javax.validation.constraints.NotNull; 19 | 20 | /** 21 | * 新增或修改配置value-order 22 | */ 23 | @Getter 24 | @Setter 25 | public class AddOrModifyPropertyValueOrder extends AbstractOrder { 26 | // 应用id 27 | @NotBlank 28 | private String appId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 分支id 33 | @NotBlank 34 | private String branchId; 35 | // key 36 | @NotBlank 37 | private String key; 38 | // value 39 | @NotBlank 40 | @Mask(secureMask = true) 41 | private String value; 42 | // 作用域 43 | @NotNull 44 | private Scope scope; 45 | } 46 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/ComputeBranchMergenceOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-05 23:29 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 计算分支合并order 19 | */ 20 | @Getter 21 | @Setter 22 | public class ComputeBranchMergenceOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 分支id 30 | @NotBlank 31 | private String branchId; 32 | // 源分支id 33 | @NotBlank 34 | private String sourceBranchId; 35 | } 36 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/ComputeBranchRulesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-02 22:53 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 计算分支规则order 19 | */ 20 | @Getter 21 | @Setter 22 | public class ComputeBranchRulesOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 被计算的目标 30 | private String target; 31 | } 32 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/DeleteAppOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:17 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 删除应用order 19 | */ 20 | @Getter 21 | @Setter 22 | public class DeleteAppOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/DeleteBranchOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-28 22:56 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 删除分支order 19 | */ 20 | @Getter 21 | @Setter 22 | public class DeleteBranchOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 分支id 30 | @NotBlank 31 | private String branchId; 32 | } 33 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/DeleteBranchRuleOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 19:49 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 删除分支规则order 19 | */ 20 | @Getter 21 | @Setter 22 | public class DeleteBranchRuleOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 分支id 30 | @NotBlank 31 | private String branchId; 32 | } 33 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/DeleteProfileOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:22 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 删除环境order 19 | */ 20 | @Getter 21 | @Setter 22 | public class DeleteProfileOrder extends AbstractOrder { 23 | // 环境id 24 | @NotBlank 25 | private String profileId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/DeletePropertyKeyOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 13:56 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 删除配置key-order 19 | */ 20 | @Getter 21 | @Setter 22 | public class DeletePropertyKeyOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // key 27 | @NotBlank 28 | private String key; 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/DeletePropertyValueOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 22:48 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 删除配置value-order 19 | */ 20 | @Getter 21 | @Setter 22 | public class DeletePropertyValueOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 分支id 30 | @NotBlank 31 | private String branchId; 32 | // key 33 | @NotBlank 34 | private String key; 35 | } 36 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindAppOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 13:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找应用order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindAppOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindAppTreeOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-22 20:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | /** 16 | * 查找应用树order 17 | */ 18 | @Getter 19 | @Setter 20 | public class FindAppTreeOrder extends AbstractOrder { 21 | // 根节点应用id(null表示查找所有应用) 22 | private String rootAppId; 23 | } 24 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindBranchOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-17 22:39 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找分支order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindBranchOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 分支id 30 | @NotBlank 31 | private String branchId; 32 | } 33 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindBranchRulesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 19:57 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找分支规则order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindBranchRulesOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindBranchesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-13 15:29 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找应用在环境下的所有分支order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindBranchesOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindConfigOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 14:03 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找应用在指定环境中的配置order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindConfigOrder extends AbstractOrder { 23 | // 主体应用id 24 | @NotBlank 25 | private String mainAppId; 26 | // 被查询配置的应用id 27 | @NotBlank 28 | private String queriedAppId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 目标 33 | private String target; 34 | } 35 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindInheritedAppPropertyKeysOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 12:02 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找继承的应用配置key-order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindInheritedAppPropertyKeysOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindInheritedAppReleasesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 14:39 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找继承的应用发布-order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindInheritedAppReleasesOrder extends AbstractOrder { 23 | // 主体应用id 24 | @NotBlank 25 | private String mainAppId; 26 | // 被查询配置的应用id 27 | @NotBlank 28 | private String queriedAppId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 目标 33 | private String target; 34 | } 35 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindInheritedAppsOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-22 23:01 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找应用继承的所有应用order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindInheritedAppsOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindInheritedProfilesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 20:16 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找环境继承的所有环境order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindInheritedProfilesOrder extends AbstractOrder { 23 | // 环境id 24 | @NotBlank 25 | private String profileId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindProfileOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 19:58 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 查找环境order 19 | */ 20 | @Getter 21 | @Setter 22 | public class FindProfileOrder extends AbstractOrder { 23 | // 环境id 24 | @NotBlank 25 | private String profileId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindProfileTreeOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 21:14 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | /** 16 | * 查找环境树order 17 | */ 18 | @Getter 19 | @Setter 20 | public class FindProfileTreeOrder extends AbstractOrder { 21 | // 根节点环境id(null表示查找所有环境) 22 | private String rootProfileId; 23 | } 24 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindPropertyKeysOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-15 18:03 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.Scope; 15 | 16 | import javax.validation.constraints.NotBlank; 17 | import javax.validation.constraints.NotNull; 18 | 19 | /** 20 | * 查找配置key集order 21 | */ 22 | @Getter 23 | @Setter 24 | public class FindPropertyKeysOrder extends AbstractOrder { 25 | // 应用id 26 | @NotBlank 27 | private String appId; 28 | // 最小作用域 29 | @NotNull 30 | private Scope minScope; 31 | } 32 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindPropertyValuesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-15 18:19 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.Scope; 15 | 16 | import javax.validation.constraints.NotBlank; 17 | import javax.validation.constraints.NotNull; 18 | 19 | /** 20 | * 查找配置value集order 21 | */ 22 | @Getter 23 | @Setter 24 | public class FindPropertyValuesOrder extends AbstractOrder { 25 | // 应用id 26 | @NotBlank 27 | private String appId; 28 | // 环境id 29 | @NotBlank 30 | private String profileId; 31 | // 分支id 32 | @NotBlank 33 | private String branchId; 34 | // 最小作用域 35 | @NotNull 36 | private Scope minScope; 37 | } 38 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/FindReleaseOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-12 20:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 15 | 16 | import javax.validation.constraints.Min; 17 | import javax.validation.constraints.NotBlank; 18 | import javax.validation.constraints.NotNull; 19 | 20 | /** 21 | * 查找发布order 22 | */ 23 | @Getter 24 | @Setter 25 | public class FindReleaseOrder extends AbstractOrder { 26 | // 应用id 27 | @NotBlank 28 | private String appId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 版本 33 | @Min(ReleaseConstant.ORIGIN_VERSION) 34 | @NotNull 35 | private Long version; 36 | } 37 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/MergeBranchOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-29 22:13 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 合并分支order 19 | */ 20 | @Getter 21 | @Setter 22 | public class MergeBranchOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | // 环境id 27 | @NotBlank 28 | private String profileId; 29 | // 分支id 30 | @NotBlank 31 | private String branchId; 32 | // 源分支id 33 | @NotBlank 34 | private String sourceBranchId; 35 | } 36 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/ProduceReleaseVersionOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 17:16 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | import javax.validation.constraints.NotBlank; 16 | 17 | /** 18 | * 生产发布版本order 19 | */ 20 | @Getter 21 | @Setter 22 | public class ProduceReleaseVersionOrder extends AbstractOrder { 23 | // 应用id 24 | @NotBlank 25 | private String appId; 26 | } 27 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/QueryAppsOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:19 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractQueryOrder; 14 | import org.antframework.common.util.query.annotation.operator.QueryLike; 15 | 16 | /** 17 | * 查询应用order 18 | */ 19 | @Getter 20 | @Setter 21 | public class QueryAppsOrder extends AbstractQueryOrder { 22 | // 应用id 23 | @QueryLike 24 | private String appId; 25 | // 父应用id 26 | @QueryLike 27 | private String parent; 28 | } 29 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/QueryProfilesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:23 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractQueryOrder; 14 | import org.antframework.common.util.query.annotation.operator.QueryLike; 15 | 16 | /** 17 | * 查询环境order 18 | */ 19 | @Getter 20 | @Setter 21 | public class QueryProfilesOrder extends AbstractQueryOrder { 22 | // 环境id 23 | @QueryLike 24 | private String profileId; 25 | // 父环境id 26 | @QueryLike 27 | private String parent; 28 | } 29 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/QueryReleasesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-09 17:50 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractQueryOrder; 14 | import org.antframework.common.util.query.annotation.operator.QueryEQ; 15 | import org.antframework.common.util.query.annotation.operator.QueryLike; 16 | 17 | /** 18 | * 查询发布order 19 | */ 20 | @Getter 21 | @Setter 22 | public class QueryReleasesOrder extends AbstractQueryOrder { 23 | // 应用id 24 | @QueryEQ 25 | private String appId; 26 | // 环境id 27 | @QueryEQ 28 | private String profileId; 29 | // 版本 30 | @QueryEQ 31 | private Long version; 32 | // 备注 33 | @QueryLike 34 | private String memo; 35 | // 父版本 36 | @QueryEQ 37 | private Long parentVersion; 38 | } 39 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/RefreshClientsOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-16 15:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | 15 | /** 16 | * 刷新客户端order 17 | */ 18 | @Getter 19 | @Setter 20 | public class RefreshClientsOrder extends AbstractOrder { 21 | // 根应用id(null表示刷新所有应用) 22 | private String rootAppId; 23 | // 根环境id(null表示刷新所有环境) 24 | private String rootProfileId; 25 | } 26 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/ReleaseBranchOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-29 23:06 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.info.PropertyChange; 15 | 16 | import javax.validation.constraints.NotBlank; 17 | import javax.validation.constraints.NotNull; 18 | 19 | /** 20 | * 发布分支 21 | */ 22 | @Getter 23 | @Setter 24 | public class ReleaseBranchOrder extends AbstractOrder { 25 | // 应用id 26 | @NotBlank 27 | private String appId; 28 | // 环境id 29 | @NotBlank 30 | private String profileId; 31 | // 分支id 32 | @NotBlank 33 | private String branchId; 34 | // 配置变动 35 | @NotNull 36 | private PropertyChange propertyChange; 37 | // 备注 38 | private String memo; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/ReleaseBranchResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 00:42 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.BranchInfo; 15 | 16 | /** 17 | * 发布分支result 18 | */ 19 | @Getter 20 | @Setter 21 | public class ReleaseBranchResult extends AbstractResult { 22 | // 发布后的分支 23 | private BranchInfo branch; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/RevertBranchOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-26 22:50 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 15 | 16 | import javax.validation.constraints.Min; 17 | import javax.validation.constraints.NotBlank; 18 | import javax.validation.constraints.NotNull; 19 | 20 | /** 21 | * 回滚分支order 22 | */ 23 | @Getter 24 | @Setter 25 | public class RevertBranchOrder extends AbstractOrder { 26 | // 应用id 27 | @NotBlank 28 | private String appId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 分支id 33 | @NotBlank 34 | private String branchId; 35 | // 回滚到的目标发布版本(传入ReleaseConstant.ORIGIN_VERSION表示删除所有发布) 36 | @Min(ReleaseConstant.ORIGIN_VERSION) 37 | @NotNull 38 | private Long targetReleaseVersion; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/order/RevertPropertyValuesOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-12 20:39 创建 8 | */ 9 | package org.antframework.configcenter.facade.order; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractOrder; 14 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 15 | 16 | import javax.validation.constraints.Min; 17 | import javax.validation.constraints.NotBlank; 18 | import javax.validation.constraints.NotNull; 19 | 20 | /** 21 | * 回滚配置value-order 22 | */ 23 | @Getter 24 | @Setter 25 | public class RevertPropertyValuesOrder extends AbstractOrder { 26 | // 应用id 27 | @NotBlank 28 | private String appId; 29 | // 环境id 30 | @NotBlank 31 | private String profileId; 32 | // 分支id 33 | @NotBlank 34 | private String branchId; 35 | // 回滚到的目标发布版本 36 | @Min(ReleaseConstant.ORIGIN_VERSION) 37 | @NotNull 38 | private Long releaseVersion; 39 | } 40 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/ComputeBranchMergenceResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-05 23:31 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.PropertyChange; 15 | 16 | /** 17 | * 计算分支合并result 18 | */ 19 | @Getter 20 | @Setter 21 | public class ComputeBranchMergenceResult extends AbstractResult { 22 | // 配置变动 23 | private PropertyChange propertyChange; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/ComputeBranchRulesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-02 23:01 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | 15 | /** 16 | * 计算分支规则result 17 | */ 18 | @Getter 19 | @Setter 20 | public class ComputeBranchRulesResult extends AbstractResult { 21 | // 计算出的分支id 22 | private String branchId; 23 | } 24 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindAppResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 13:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.AppInfo; 15 | 16 | /** 17 | * 查找应用result 18 | */ 19 | @Getter 20 | @Setter 21 | public class FindAppResult extends AbstractResult { 22 | // 应用(null表示不存在该应用) 23 | private AppInfo app; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindAppTreeResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-22 21:52 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.AppTree; 15 | 16 | /** 17 | * 查找应用树result 18 | */ 19 | @Getter 20 | @Setter 21 | public class FindAppTreeResult extends AbstractResult { 22 | // 应用树 23 | private AppTree appTree; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindBranchResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-08-17 22:43 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.BranchInfo; 15 | 16 | /** 17 | * 查找分支result 18 | */ 19 | @Getter 20 | @Setter 21 | public class FindBranchResult extends AbstractResult { 22 | // 分支(null表示不存在该分支) 23 | private BranchInfo branch; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindBranchRulesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-01 19:58 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.BranchRuleInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找分支规则result 20 | */ 21 | @Getter 22 | public class FindBranchRulesResult extends AbstractResult { 23 | // 安优先级排序的分支规则 24 | private List branchRules = new ArrayList<>(); 25 | 26 | public void addBranchRule(BranchRuleInfo branchRule) { 27 | branchRules.add(branchRule); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindBranchesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-13 15:31 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.BranchInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找应用在环境下的所有分支result 20 | */ 21 | @Getter 22 | public class FindBranchesResult extends AbstractResult { 23 | // 应用在环境下的所有分支 24 | private final List branches = new ArrayList<>(); 25 | 26 | public void addBranch(BranchInfo branch) { 27 | branches.add(branch); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindConfigResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 14:04 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.common.util.tostring.format.HideDetail; 15 | 16 | import java.util.Map; 17 | 18 | /** 19 | * 查找应用在指定环境中的配置result 20 | */ 21 | @Getter 22 | @Setter 23 | public class FindConfigResult extends AbstractResult { 24 | // 版本 25 | private Long version; 26 | // 配置 27 | @HideDetail 28 | private Map properties; 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindInheritedAppPropertyKeysResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 12:01 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.AppPropertyKey; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找继承的应用配置key-result 20 | */ 21 | @Getter 22 | public class FindInheritedAppPropertyKeysResult extends AbstractResult { 23 | // 由近及远继承的应用配置key 24 | private final List inheritedAppPropertyKeys = new ArrayList<>(); 25 | 26 | public void addInheritedAppPropertyKey(AppPropertyKey inheritedAppPropertyKey) { 27 | inheritedAppPropertyKeys.add(inheritedAppPropertyKey); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindInheritedAppReleasesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-04 14:44 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.AppRelease; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找继承的应用发布-result 20 | */ 21 | @Getter 22 | public class FindInheritedAppReleasesResult extends AbstractResult { 23 | // 由近及远继承的应用发布 24 | private final List inheritedAppReleases = new ArrayList<>(); 25 | 26 | public void addInheritedAppRelease(AppRelease appRelease) { 27 | inheritedAppReleases.add(appRelease); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindInheritedAppsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-22 23:03 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.AppInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找应用继承的所有应用result 20 | */ 21 | @Getter 22 | public class FindInheritedAppsResult extends AbstractResult { 23 | // 由近及远继承的所用应用(该应用本身在第一位) 24 | private final List inheritedApps = new ArrayList<>(); 25 | 26 | public void addInheritedApp(AppInfo inheritedApp) { 27 | inheritedApps.add(inheritedApp); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindInheritedProfilesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 20:18 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.ProfileInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找环境继承的所有环境result 20 | */ 21 | @Getter 22 | public class FindInheritedProfilesResult extends AbstractResult { 23 | // 由近及远继承的所用环境(该环境本身在第一位) 24 | private final List inheritedProfiles = new ArrayList<>(); 25 | 26 | public void addInheritedProfile(ProfileInfo inheritedProfile) { 27 | inheritedProfiles.add(inheritedProfile); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindProfileResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 19:59 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.ProfileInfo; 15 | 16 | /** 17 | * 查找环境result 18 | */ 19 | @Getter 20 | @Setter 21 | public class FindProfileResult extends AbstractResult { 22 | // 环境(null表示无该环境) 23 | private ProfileInfo profile; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindProfileTreeResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-10-14 21:16 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.ProfileTree; 15 | 16 | /** 17 | * 查找环境树result 18 | */ 19 | @Getter 20 | @Setter 21 | public class FindProfileTreeResult extends AbstractResult { 22 | // 环境树 23 | private ProfileTree profileTree; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindPropertyKeysResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-15 18:04 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.PropertyKeyInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找配置key集result 20 | */ 21 | @Getter 22 | public class FindPropertyKeysResult extends AbstractResult { 23 | // 应用的配置key 24 | private final List propertyKeys = new ArrayList<>(); 25 | 26 | public void addPropertyKey(PropertyKeyInfo propertyKey) { 27 | propertyKeys.add(propertyKey); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindPropertyValuesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-15 18:23 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.configcenter.facade.info.PropertyValueInfo; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 查找配置value集result 20 | */ 21 | @Getter 22 | public class FindPropertyValuesResult extends AbstractResult { 23 | // 配置value 24 | private final List propertyValues = new ArrayList<>(); 25 | 26 | public void addPropertyValue(PropertyValueInfo propertyValue) { 27 | propertyValues.add(propertyValue); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/FindReleaseResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-12 21:02 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.ReleaseInfo; 15 | 16 | /** 17 | * 查找发布result 18 | */ 19 | @Getter 20 | @Setter 21 | public class FindReleaseResult extends AbstractResult { 22 | // 发布(null表示无该发布) 23 | private ReleaseInfo release; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/MergeBranchResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (email:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2021-04-07 22:51 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | import org.antframework.configcenter.facade.info.PropertyChange; 15 | 16 | /** 17 | * 合并分支-result 18 | */ 19 | @Getter 20 | @Setter 21 | public class MergeBranchResult extends AbstractResult { 22 | // 配置变动 23 | private PropertyChange propertyChange; 24 | } 25 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/ProduceReleaseVersionResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-08 17:18 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import org.antframework.common.util.facade.AbstractResult; 14 | 15 | /** 16 | * 生产发布版本result 17 | */ 18 | @Getter 19 | @Setter 20 | public class ProduceReleaseVersionResult extends AbstractResult { 21 | // 发布版本 22 | private long releaseVersion; 23 | } 24 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/QueryAppsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:19 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import org.antframework.common.util.facade.AbstractQueryResult; 12 | import org.antframework.configcenter.facade.info.AppInfo; 13 | 14 | /** 15 | * 查询应用result 16 | */ 17 | public class QueryAppsResult extends AbstractQueryResult { 18 | } 19 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/QueryProfilesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-20 02:24 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import org.antframework.common.util.facade.AbstractQueryResult; 12 | import org.antframework.configcenter.facade.info.ProfileInfo; 13 | 14 | /** 15 | * 查询环境result 16 | */ 17 | public class QueryProfilesResult extends AbstractQueryResult { 18 | } 19 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/result/QueryReleasesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-09 17:55 创建 8 | */ 9 | package org.antframework.configcenter.facade.result; 10 | 11 | import org.antframework.common.util.facade.AbstractQueryResult; 12 | import org.antframework.configcenter.facade.info.ReleaseInfo; 13 | 14 | /** 15 | * 查询发布result 16 | */ 17 | public class QueryReleasesResult extends AbstractQueryResult { 18 | } 19 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/BranchConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-09-02 23:19 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | /** 12 | * 分支静态常量类 13 | */ 14 | public final class BranchConstants { 15 | /** 16 | * 默认的分支id 17 | */ 18 | public static final String DEFAULT_BRANCH_ID = "master"; 19 | } 20 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/ConfigTopic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-03-31 00:18 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.tostring.ToString; 14 | 15 | import java.io.Serializable; 16 | import java.util.Objects; 17 | 18 | /** 19 | * 配置主题 20 | */ 21 | @AllArgsConstructor 22 | @Getter 23 | public final class ConfigTopic implements Serializable { 24 | // 应用id 25 | private final String appId; 26 | // 环境id 27 | private final String profileId; 28 | 29 | @Override 30 | public int hashCode() { 31 | return Objects.hash(appId, profileId); 32 | } 33 | 34 | @Override 35 | public boolean equals(Object obj) { 36 | if (!(obj instanceof ConfigTopic)) { 37 | return false; 38 | } 39 | ConfigTopic other = (ConfigTopic) obj; 40 | return Objects.equals(appId, other.appId) && Objects.equals(profileId, other.profileId); 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return ToString.toString(this); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/Property.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-20 22:18 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.tostring.ToString; 14 | import org.antframework.common.util.tostring.format.Mask; 15 | 16 | import java.io.Serializable; 17 | import java.util.Objects; 18 | 19 | /** 20 | * 配置项 21 | */ 22 | @AllArgsConstructor 23 | @Getter 24 | public final class Property implements Serializable { 25 | // key 26 | private final String key; 27 | // value 28 | @Mask(secureMask = true) 29 | private final String value; 30 | // 作用域 31 | private final Scope scope; 32 | 33 | @Override 34 | public int hashCode() { 35 | return Objects.hash(key, value, scope); 36 | } 37 | 38 | @Override 39 | public boolean equals(Object obj) { 40 | if (!(obj instanceof Property)) { 41 | return false; 42 | } 43 | Property other = (Property) obj; 44 | return Objects.equals(key, other.key) 45 | && Objects.equals(value, other.value) 46 | && scope == other.scope; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return ToString.toString(this); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/RedisConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-03-31 00:57 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | /** 12 | * Redis静态常量类 13 | */ 14 | public final class RedisConstant { 15 | /** 16 | * 刷新客户端的通道 17 | */ 18 | public static final String REFRESH_CLIENTS_CHANNEL = "configcenter:refresh-clients"; 19 | } 20 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/RefreshClientsEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2019-03-31 17:01 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | import org.antframework.common.util.tostring.ToString; 14 | 15 | import java.io.Serializable; 16 | import java.util.Set; 17 | 18 | /** 19 | * 刷新客户端事件 20 | */ 21 | @AllArgsConstructor 22 | @Getter 23 | public final class RefreshClientsEvent implements Serializable { 24 | // 需要刷新的配置主题 25 | private final Set topics; 26 | 27 | @Override 28 | public String toString() { 29 | return ToString.toString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/ReleaseConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-09 18:57 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | /** 12 | * 发布静态常量 13 | */ 14 | public final class ReleaseConstant { 15 | /** 16 | * 原始版本 17 | */ 18 | public static final long ORIGIN_VERSION = 0L; 19 | } 20 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/ResultCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-19 14:42 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | import lombok.AllArgsConstructor; 12 | import lombok.Getter; 13 | 14 | /** 15 | * 结果码 16 | */ 17 | @AllArgsConstructor 18 | @Getter 19 | public enum ResultCode { 20 | 21 | EXISTS_CHILDREN("configcenter-0000", "存在子节点"); 22 | 23 | // 结果码 24 | private final String code; 25 | // 描述 26 | private final String message; 27 | } 28 | -------------------------------------------------------------------------------- /configcenter-facade/src/main/java/org/antframework/configcenter/facade/vo/Scope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-20 16:03 创建 8 | */ 9 | package org.antframework.configcenter.facade.vo; 10 | 11 | /** 12 | * 作用域(依次从小到大) 13 | */ 14 | public enum Scope { 15 | /** 16 | * 私有 17 | */ 18 | PRIVATE, 19 | 20 | /** 21 | * 可继承 22 | */ 23 | PROTECTED, 24 | 25 | /** 26 | * 公开 27 | */ 28 | PUBLIC 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-spring-boot-starter 12 | 13 | 14 | 15 | org.antframework.configcenter 16 | configcenter-client 17 | ${project.parent.version} 18 | 19 | 20 | org.antframework.boot 21 | ant-boot-starter-env 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter 26 | 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter 32 | provided 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-configuration-processor 37 | true 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /configcenter-spring-boot-starter/src/main/java/org/antframework/configcenter/spring/ConfigContexts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-05-02 22:30 创建 8 | */ 9 | package org.antframework.configcenter.spring; 10 | 11 | import org.antframework.configcenter.client.Config; 12 | import org.antframework.configcenter.client.ConfigContext; 13 | import org.antframework.configcenter.spring.boot.ConfigcenterProperties; 14 | 15 | /** 16 | * 配置上下文操作类 17 | */ 18 | public final class ConfigContexts { 19 | // 配置上下文 20 | private static final ConfigContext CONFIG_CONTEXT = new ConfigContext( 21 | ConfigcenterProperties.INSTANCE.getRequiredAppId(), 22 | ConfigcenterProperties.INSTANCE.getRequiredProfileId(), 23 | ConfigcenterProperties.INSTANCE.getTarget(), 24 | ConfigcenterProperties.INSTANCE.getServerUrl(), 25 | ConfigcenterProperties.INSTANCE.computeHome(), 26 | ConfigcenterProperties.INSTANCE.getManagerId(), 27 | ConfigcenterProperties.INSTANCE.getSecretKey()); 28 | 29 | /** 30 | * 获取配置上下文 31 | */ 32 | public static ConfigContext getContext() { 33 | return CONFIG_CONTEXT; 34 | } 35 | 36 | /** 37 | * 获取配置 38 | * 39 | * @param appId 被查询配置的应用id 40 | * @return 配置 41 | */ 42 | public static Config getConfig(String appId) { 43 | return CONFIG_CONTEXT.getConfig(appId); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /configcenter-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "sourceType": "org.antframework.configcenter.spring.boot.ConfigcenterProperties", 5 | "name": "configcenter.auto-refresh-configs.enable", 6 | "description": "选填:是否开启自动刷新configcenter配置(默认为开启)", 7 | "type": "java.lang.Boolean", 8 | "defaultValue": true 9 | }, 10 | { 11 | "sourceType": "org.antframework.configcenter.spring.boot.ConfigcenterProperties", 12 | "name": "configcenter.auto-refresh-configs.period", 13 | "description": "选填:自动刷新configcenter配置的周期(单位:毫秒。默认为5分钟刷新一次)", 14 | "type": "java.lang.Long", 15 | "defaultValue": 300000 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /configcenter-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.context.ApplicationListener=\ 2 | org.antframework.configcenter.spring.boot.EnvironmentInitializer,\ 3 | org.antframework.configcenter.spring.boot.ConfigContextLifeCycle 4 | -------------------------------------------------------------------------------- /configcenter-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-test 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.configcenter 21 | configcenter-assemble 22 | ${project.parent.version} 23 | 24 | 25 | org.antframework.configcenter 26 | configcenter-client 27 | ${project.parent.version} 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter-test 32 | 33 | 34 | junit 35 | junit 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /configcenter-test/src/test/java/org/antframework/configcenter/test/AbstractTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-08-22 15:42 创建 8 | */ 9 | package org.antframework.configcenter.test; 10 | 11 | import org.antframework.boot.lang.Apps; 12 | import org.antframework.common.util.facade.AbstractResult; 13 | import org.antframework.common.util.facade.Status; 14 | import org.antframework.configcenter.Main; 15 | import org.junit.Ignore; 16 | import org.junit.runner.RunWith; 17 | import org.slf4j.Logger; 18 | import org.slf4j.LoggerFactory; 19 | import org.springframework.boot.test.context.SpringBootTest; 20 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 21 | 22 | /** 23 | * 单元测试父类 24 | */ 25 | @Ignore 26 | @RunWith(SpringJUnit4ClassRunner.class) 27 | @SpringBootTest(classes = Main.class) 28 | public class AbstractTest { 29 | protected static final Logger logger = LoggerFactory.getLogger(AbstractTest.class); 30 | 31 | static { 32 | // 设置使用环境 33 | Apps.setProfileIfAbsent("dev"); 34 | } 35 | 36 | protected void checkResult(AbstractResult result, Status status) { 37 | logger.info("执行结果:{}", result); 38 | if (result.getStatus() != status) { 39 | throw new IllegalArgumentException("结果不正确"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /configcenter-test/src/test/java/org/antframework/configcenter/test/facade/api/ConfigServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-03 20:53 创建 8 | */ 9 | package org.antframework.configcenter.test.facade.api; 10 | 11 | import org.antframework.common.util.facade.FacadeUtils; 12 | import org.antframework.configcenter.facade.api.ConfigService; 13 | import org.antframework.configcenter.facade.order.FindConfigOrder; 14 | import org.antframework.configcenter.facade.order.FindInheritedAppReleasesOrder; 15 | import org.antframework.configcenter.facade.result.FindConfigResult; 16 | import org.antframework.configcenter.facade.result.FindInheritedAppReleasesResult; 17 | import org.antframework.configcenter.test.AbstractTest; 18 | import org.junit.Ignore; 19 | import org.junit.Test; 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | 22 | /** 23 | * 配置服务单元测试 24 | */ 25 | @Ignore 26 | public class ConfigServiceTest extends AbstractTest { 27 | @Autowired 28 | private ConfigService configService; 29 | 30 | @Test 31 | public void testFindConfig() { 32 | String[] queriedAppIds = new String[]{"customer", "account"}; 33 | String[] profileIds = new String[]{"offline", "dev"}; 34 | 35 | for (String queriedId : queriedAppIds) { 36 | for (String profileId : profileIds) { 37 | FindConfigOrder order = new FindConfigOrder(); 38 | order.setMainAppId("customer"); 39 | order.setQueriedAppId(queriedId); 40 | order.setProfileId(profileId); 41 | order.setTarget(null); 42 | 43 | FindConfigResult result = configService.findConfig(order); 44 | FacadeUtils.assertSuccess(result); 45 | } 46 | } 47 | } 48 | 49 | @Test 50 | public void testFindInheritedAppReleases() { 51 | String[] profileIds = new String[]{"offline", "dev"}; 52 | for (String profileId : profileIds) { 53 | FindInheritedAppReleasesOrder order = new FindInheritedAppReleasesOrder(); 54 | order.setMainAppId("customer"); 55 | order.setQueriedAppId("customer"); 56 | order.setProfileId(profileId); 57 | order.setTarget(null); 58 | 59 | FindInheritedAppReleasesResult result = configService.findInheritedAppReleases(order); 60 | FacadeUtils.assertSuccess(result); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /configcenter-test/src/test/java/org/antframework/configcenter/test/facade/api/RefreshServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-16 15:12 创建 8 | */ 9 | package org.antframework.configcenter.test.facade.api; 10 | 11 | import org.antframework.common.util.facade.EmptyResult; 12 | import org.antframework.common.util.facade.Status; 13 | import org.antframework.configcenter.facade.api.RefreshService; 14 | import org.antframework.configcenter.facade.order.RefreshClientsOrder; 15 | import org.antframework.configcenter.test.AbstractTest; 16 | import org.junit.Ignore; 17 | import org.junit.Test; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | 20 | /** 21 | * 刷新服务单元测试 22 | */ 23 | @Ignore 24 | public class RefreshServiceTest extends AbstractTest { 25 | @Autowired 26 | private RefreshService refreshService; 27 | 28 | @Test 29 | public void testRefreshClients() { 30 | String[] appIds = new String[]{null, "customer"}; 31 | String[] profileIds = new String[]{null, "dev"}; 32 | 33 | for (String appId : appIds) { 34 | for (String profileId : profileIds) { 35 | RefreshClientsOrder order = new RefreshClientsOrder(); 36 | order.setRootAppId(appId); 37 | order.setRootProfileId(profileId); 38 | 39 | EmptyResult result = refreshService.refreshClients(order); 40 | checkResult(result, Status.SUCCESS); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /configcenter-test/src/test/java/org/antframework/configcenter/test/facade/api/ReleaseServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-12-11 22:55 创建 8 | */ 9 | package org.antframework.configcenter.test.facade.api; 10 | 11 | import org.antframework.common.util.facade.FacadeUtils; 12 | import org.antframework.configcenter.facade.api.ReleaseService; 13 | import org.antframework.configcenter.facade.order.FindReleaseOrder; 14 | import org.antframework.configcenter.facade.order.QueryReleasesOrder; 15 | import org.antframework.configcenter.facade.result.FindReleaseResult; 16 | import org.antframework.configcenter.facade.result.QueryReleasesResult; 17 | import org.antframework.configcenter.facade.vo.ReleaseConstant; 18 | import org.antframework.configcenter.test.AbstractTest; 19 | import org.junit.Ignore; 20 | import org.junit.Test; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | 23 | /** 24 | * 发布服务单元测试 25 | */ 26 | @Ignore 27 | public class ReleaseServiceTest extends AbstractTest { 28 | @Autowired 29 | private ReleaseService releaseService; 30 | 31 | @Test 32 | public void testFindRelease() { 33 | FindReleaseOrder order = new FindReleaseOrder(); 34 | order.setAppId("customer"); 35 | order.setProfileId("dev"); 36 | order.setVersion(ReleaseConstant.ORIGIN_VERSION); 37 | 38 | FindReleaseResult result = releaseService.findRelease(order); 39 | FacadeUtils.assertSuccess(result); 40 | } 41 | 42 | @Test 43 | public void testQueryReleases() { 44 | QueryReleasesOrder order = new QueryReleasesOrder(); 45 | order.setPageNo(1); 46 | order.setPageSize(10); 47 | order.setAppId(null); 48 | order.setProfileId(null); 49 | order.setVersion(null); 50 | order.setMemo(null); 51 | order.setParentVersion(null); 52 | 53 | QueryReleasesResult result = releaseService.queryReleases(order); 54 | FacadeUtils.assertSuccess(result); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /configcenter-web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.configcenter 7 | configcenter 8 | 1.7.3 9 | 10 | 11 | configcenter-web 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | org.antframework.configcenter 21 | configcenter-biz 22 | ${project.parent.version} 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | org.antframework.manager 30 | manager-web 31 | 32 | 33 | org.springframework.session 34 | spring-session-data-redis 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /configcenter-web/src/main/java/org/antframework/configcenter/web/common/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-14 16:41 创建 8 | */ 9 | package org.antframework.configcenter.web.common; 10 | 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.antframework.common.util.facade.BizException; 13 | import org.antframework.common.util.facade.CommonResultCode; 14 | import org.antframework.common.util.facade.EmptyResult; 15 | import org.antframework.common.util.facade.Status; 16 | import org.springframework.web.bind.annotation.ExceptionHandler; 17 | import org.springframework.web.bind.annotation.RestControllerAdvice; 18 | 19 | /** 20 | * web全局异常处理类 21 | */ 22 | @RestControllerAdvice 23 | @Slf4j 24 | public class GlobalExceptionHandler { 25 | // 处理BizException 26 | @ExceptionHandler(BizException.class) 27 | public EmptyResult handleBizException(BizException e) { 28 | EmptyResult result = new EmptyResult(); 29 | result.setStatus(e.getStatus()); 30 | result.setCode(e.getCode()); 31 | result.setMessage(e.getMessage()); 32 | 33 | return result; 34 | } 35 | 36 | // 处理Exception 37 | @ExceptionHandler(Exception.class) 38 | public EmptyResult handleException(Exception e) { 39 | log.error("web层捕获到未知异常:", e); 40 | EmptyResult result = new EmptyResult(); 41 | result.setStatus(Status.PROCESSING); 42 | result.setCode(CommonResultCode.UNKNOWN_ERROR.getCode()); 43 | result.setMessage(e.getMessage()); 44 | 45 | return result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /configcenter-web/src/main/java/org/antframework/configcenter/web/common/PropertyType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2018-11-17 19:25 创建 8 | */ 9 | package org.antframework.configcenter.web.common; 10 | 11 | /** 12 | * 配置类型 13 | */ 14 | public enum PropertyType { 15 | /** 16 | * 无 17 | */ 18 | NONE, 19 | 20 | /** 21 | * 只读 22 | */ 23 | READ, 24 | 25 | /** 26 | * 读写 27 | */ 28 | READ_WRITE 29 | } 30 | -------------------------------------------------------------------------------- /configcenter-web/src/main/java/org/antframework/configcenter/web/controller/manage/RefreshController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 作者:钟勋 (e-mail:zhongxunking@163.com) 3 | */ 4 | 5 | /* 6 | * 修订记录: 7 | * @author 钟勋 2017-09-16 16:34 创建 8 | */ 9 | package org.antframework.configcenter.web.controller.manage; 10 | 11 | import lombok.AllArgsConstructor; 12 | import org.antframework.common.util.facade.EmptyResult; 13 | import org.antframework.configcenter.facade.api.RefreshService; 14 | import org.antframework.configcenter.facade.order.RefreshClientsOrder; 15 | import org.antframework.configcenter.web.common.ManagerApps; 16 | import org.antframework.manager.web.CurrentManagerAssert; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RestController; 19 | 20 | /** 21 | * 刷新controller 22 | */ 23 | @RestController 24 | @RequestMapping("/manage/refresh") 25 | @AllArgsConstructor 26 | public class RefreshController { 27 | // 刷新服务 28 | private final RefreshService refreshService; 29 | 30 | /** 31 | * 刷新客户端 32 | * 33 | * @param rootAppId 根应用id(不传表示刷新所有应用) 34 | * @param rootProfileId 根环境id(不传表示刷新所有环境) 35 | */ 36 | @RequestMapping("/refreshClients") 37 | public EmptyResult refreshClients(String rootAppId, String rootProfileId) { 38 | if (rootAppId == null) { 39 | CurrentManagerAssert.admin(); 40 | } else { 41 | ManagerApps.assertAdminOrHaveApp(rootAppId); 42 | } 43 | RefreshClientsOrder order = new RefreshClientsOrder(); 44 | order.setRootAppId(rootAppId); 45 | order.setRootProfileId(rootProfileId); 46 | 47 | return refreshService.refreshClients(order); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/common/common.js: -------------------------------------------------------------------------------- 1 | // 设置登录页路径 2 | MANAGER_LOGIN_PATH = 'login.html'; 3 | // 时间格式化 4 | Date.prototype.format = function (fmt) { //author: meizz 5 | let o = { 6 | "M+": this.getMonth() + 1, //月份 7 | "d+": this.getDate(), //日 8 | "h+": this.getHours(), //小时 9 | "m+": this.getMinutes(), //分 10 | "s+": this.getSeconds(), //秒 11 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 12 | "S": this.getMilliseconds() //毫秒 13 | }; 14 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 15 | for (let k in o) 16 | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 17 | return fmt; 18 | }; 19 | -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/common/import.js: -------------------------------------------------------------------------------- 1 | CONFIGCENTER_VERSION = '1.7.3'; 2 | document.write(" 10 | 11 | 12 |
13 | 14 |
15 | 20 | 21 | -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/html/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | configcenter 6 | 10 | 11 | 12 |
13 | 14 |
15 | 28 | 29 | -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/lib/icon/demo_fontclass.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IconFont 7 | 8 | 9 | 10 | 11 |
12 |

IconFont 图标

13 |
    14 | 15 |
  • 16 | 17 |
    deployment unit
    18 |
    .configcenter-icon-deploymentunit
    19 |
  • 20 | 21 |
  • 22 | 23 |
    cloud
    24 |
    .configcenter-icon-cloud
    25 |
  • 26 | 27 |
28 | 29 |

font-class引用

30 |
31 | 32 |

font-class是unicode使用方式的一种变种,主要是解决unicode书写不直观,语意不明确的问题。

33 |

与unicode使用方式相比,具有如下特点:

34 |
    35 |
  • 兼容性良好,支持ie8+,及所有现代浏览器。
  • 36 |
  • 相比于unicode语意明确,书写更直观。可以很容易分辨这个icon是什么。
  • 37 |
  • 因为使用class来定义图标,所以当要替换图标时,只需要修改class里面的unicode引用。
  • 38 |
  • 不过因为本质上还是使用的字体,所以多色图标还是不支持的。
  • 39 |
40 |

使用步骤如下:

41 |

第一步:引入项目下面生成的fontclass代码:

42 | 43 | 44 |
<link rel="stylesheet" type="text/css" href="./iconfont.css">
45 |

第二步:挑选相应图标并获取类名,应用于页面:

46 |
<i class="configcenter-iconfont configcenter-icon-xxx"></i>
47 |
48 |

"configcenter-iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。

49 |
50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/lib/icon/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongxunking/configcenter/d966b84995af5c769db1e8b51dd145a88d25cf20/configcenter-web/src/main/resources/static/lib/icon/iconfont.eot -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/lib/icon/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongxunking/configcenter/d966b84995af5c769db1e8b51dd145a88d25cf20/configcenter-web/src/main/resources/static/lib/icon/iconfont.ttf -------------------------------------------------------------------------------- /configcenter-web/src/main/resources/static/lib/icon/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongxunking/configcenter/d966b84995af5c769db1e8b51dd145a88d25cf20/configcenter-web/src/main/resources/static/lib/icon/iconfont.woff -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.antframework.boot 7 | ant-boot-starter-parent 8 | 2.4.4 9 | 10 | 11 | org.antframework.configcenter 12 | configcenter 13 | 1.7.3 14 | pom 15 | 16 | configcenter 17 | 配置中心 18 | 19 | 20 | configcenter-facade 21 | configcenter-common 22 | configcenter-dal 23 | configcenter-biz 24 | configcenter-web 25 | configcenter-assemble 26 | configcenter-client 27 | configcenter-spring-boot-starter 28 | configcenter-test 29 | 30 | 31 | 32 | 33 | 34 | org.antframework.manager 35 | manager-web 36 | 1.4.7 37 | 38 | 39 | org.antframework.manager 40 | manager-client 41 | 1.4.7 42 | 43 | 44 | 45 | 46 | 47 | org.projectlombok 48 | lombok 49 | provided 50 | true 51 | 52 | 53 | --------------------------------------------------------------------------------