Răsfoiți Sursa

portal add db config

lepdou 8 ani în urmă
părinte
comite
186b1b6c7f
29 a modificat fișierele cu 117 adăugiri și 27 ștergeri
  1. 1 9
      apollo-biz/pom.xml
  2. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/App.java
  3. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/AppNamespace.java
  4. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java
  5. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java
  6. 3 1
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Commit.java
  7. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java
  8. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java
  9. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java
  10. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Release.java
  11. 2 0
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ServerConfig.java
  12. 9 0
      apollo-common/pom.xml
  13. 1 1
      apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/BaseEntity.java
  14. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalAppController.java
  15. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalConfigController.java
  16. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalNamespaceController.java
  17. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java
  18. 56 0
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/ServerConfig.java
  19. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java
  20. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java
  21. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceIdentifer.java
  22. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java
  23. 13 0
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/ServerConfigRepository.java
  24. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalAppService.java
  25. 2 2
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalConfigService.java
  26. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalNamespaceService.java
  27. 1 1
      apollo-portal/src/main/resources/portal.properties
  28. 2 2
      apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ConfigServiceTest.java
  29. 1 1
      apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/NamespaceServiceTest.java

+ 1 - 9
apollo-biz/pom.xml

@@ -24,14 +24,6 @@
 			<artifactId>spring-cloud-starter-eureka</artifactId>
 		</dependency>
 		<!-- end of eureka -->
-		<dependency>
-			<groupId>mysql</groupId>
-			<artifactId>mysql-connector-java</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.h2database</groupId>
-			<artifactId>h2</artifactId>
-			<scope>test</scope>
-		</dependency>
+
 	</dependencies>
 </project>

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/App.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/AppNamespace.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 3 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Commit.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import org.hibernate.annotations.SQLDelete;
 import org.hibernate.annotations.Where;
 
@@ -11,7 +13,7 @@ import javax.persistence.Table;
 @Table(name = "commit")
 @SQLDelete(sql = "Update commit set isDeleted = 1 where id = ?")
 @Where(clause = "isDeleted = 0")
-public class Commit extends BaseEntity{
+public class Commit extends BaseEntity {
 
   @Column(name = "ChangeSets", nullable = false)
   private String changeSets;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Release.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import org.hibernate.annotations.SQLDelete;
 import org.hibernate.annotations.Where;
 

+ 2 - 0
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ServerConfig.java

@@ -1,5 +1,7 @@
 package com.ctrip.framework.apollo.biz.entity;
 
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
 import org.hibernate.annotations.SQLDelete;
 import org.hibernate.annotations.Where;
 

+ 9 - 0
apollo-common/pom.xml

@@ -38,6 +38,15 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-data-jpa</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.h2database</groupId>
+			<artifactId>h2</artifactId>
+			<scope>test</scope>
+		</dependency>
 		<dependency>
 			<groupId>org.springframework.data</groupId>
 			<artifactId>spring-data-commons</artifactId>

+ 1 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/BaseEntity.java → apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/BaseEntity.java

@@ -1,4 +1,4 @@
-package com.ctrip.framework.apollo.biz.entity;
+package com.ctrip.framework.apollo.common.entity;
 
 import java.util.Date;
 

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalAppController.java

@@ -17,7 +17,7 @@ import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.core.exception.BadRequestException;
 import com.ctrip.framework.apollo.core.utils.StringUtils;
 import com.ctrip.framework.apollo.portal.PortalSettings;
-import com.ctrip.framework.apollo.portal.entity.EnvClusterInfo;
+import com.ctrip.framework.apollo.portal.entity.vo.EnvClusterInfo;
 import com.ctrip.framework.apollo.portal.service.PortalAppService;
 
 import java.util.List;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalConfigController.java

@@ -6,7 +6,7 @@ import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.core.dto.ReleaseDTO;
 import com.ctrip.framework.apollo.core.exception.BadRequestException;
 import com.ctrip.framework.apollo.core.utils.StringUtils;
-import com.ctrip.framework.apollo.portal.entity.ItemDiffs;
+import com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs;
 import com.ctrip.framework.apollo.portal.entity.form.NamespaceSyncModel;
 import com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel;
 import com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PortalNamespaceController.java

@@ -5,7 +5,7 @@ import com.ctrip.framework.apollo.core.dto.NamespaceDTO;
 import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.core.exception.BadRequestException;
 import com.ctrip.framework.apollo.core.utils.StringUtils;
-import com.ctrip.framework.apollo.portal.entity.NamespaceVO;
+import com.ctrip.framework.apollo.portal.entity.vo.NamespaceVO;
 import com.ctrip.framework.apollo.portal.service.PortalNamespaceService;
 
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java

@@ -1,7 +1,7 @@
 package com.ctrip.framework.apollo.portal.entity.form;
 
 import com.ctrip.framework.apollo.core.dto.ItemDTO;
-import com.ctrip.framework.apollo.portal.entity.NamespaceIdentifer;
+import com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer;
 
 import org.springframework.util.CollectionUtils;
 

+ 56 - 0
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/ServerConfig.java

@@ -0,0 +1,56 @@
+package com.ctrip.framework.apollo.portal.entity.po;
+
+import com.ctrip.framework.apollo.common.entity.BaseEntity;
+
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.Where;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+/**
+ * @author Jason Song(song_s@ctrip.com)
+ */
+@Entity
+@Table(name = "ServerConfig")
+@SQLDelete(sql = "Update ServerConfig set isDeleted = 1 where id = ?")
+@Where(clause = "isDeleted = 0")
+public class ServerConfig extends BaseEntity {
+  @Column(name = "Key", nullable = false)
+  private String key;
+
+  @Column(name = "Value", nullable = false)
+  private String value;
+
+  @Column(name = "Comment", nullable = false)
+  private String comment;
+
+  public String getKey() {
+    return key;
+  }
+
+  public void setKey(String key) {
+    this.key = key;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  public String getComment() {
+    return comment;
+  }
+
+  public void setComment(String comment) {
+    this.comment = comment;
+  }
+
+  public String toString() {
+    return toStringHelper().add("key", key).add("value", value).add("comment", comment).toString();
+  }
+}

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/EnvClusterInfo.java → apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java

@@ -1,4 +1,4 @@
-package com.ctrip.framework.apollo.portal.entity;
+package com.ctrip.framework.apollo.portal.entity.vo;
 
 import com.ctrip.framework.apollo.core.dto.ClusterDTO;
 import com.ctrip.framework.apollo.core.enums.Env;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/ItemDiffs.java → apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java

@@ -1,4 +1,4 @@
-package com.ctrip.framework.apollo.portal.entity;
+package com.ctrip.framework.apollo.portal.entity.vo;
 
 import com.ctrip.framework.apollo.core.dto.ItemChangeSets;
 

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/NamespaceIdentifer.java → apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceIdentifer.java

@@ -1,4 +1,4 @@
-package com.ctrip.framework.apollo.portal.entity;
+package com.ctrip.framework.apollo.portal.entity.vo;
 
 import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.core.utils.StringUtils;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/NamespaceVO.java → apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java

@@ -1,4 +1,4 @@
-package com.ctrip.framework.apollo.portal.entity;
+package com.ctrip.framework.apollo.portal.entity.vo;
 import com.ctrip.framework.apollo.core.dto.ItemDTO;
 import com.ctrip.framework.apollo.core.dto.NamespaceDTO;
 

+ 13 - 0
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/ServerConfigRepository.java

@@ -0,0 +1,13 @@
+package com.ctrip.framework.apollo.portal.repository;
+
+
+import com.ctrip.framework.apollo.portal.entity.po.ServerConfig;
+
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+/**
+ * @author Jason Song(song_s@ctrip.com)
+ */
+public interface ServerConfigRepository extends PagingAndSortingRepository<ServerConfig, Long> {
+  ServerConfig findByKey(String key);
+}

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalAppService.java

@@ -17,7 +17,7 @@ import com.ctrip.framework.apollo.core.exception.BadRequestException;
 import com.ctrip.framework.apollo.core.exception.ServiceException;
 import com.ctrip.framework.apollo.portal.PortalSettings;
 import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
-import com.ctrip.framework.apollo.portal.entity.EnvClusterInfo;
+import com.ctrip.framework.apollo.portal.entity.vo.EnvClusterInfo;
 
 @Service
 public class PortalAppService {

+ 2 - 2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalConfigService.java

@@ -18,8 +18,8 @@ import com.ctrip.framework.apollo.core.exception.BadRequestException;
 import com.ctrip.framework.apollo.core.exception.NotFoundException;
 import com.ctrip.framework.apollo.core.exception.ServiceException;
 import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
-import com.ctrip.framework.apollo.portal.entity.ItemDiffs;
-import com.ctrip.framework.apollo.portal.entity.NamespaceIdentifer;
+import com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs;
+import com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer;
 import com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel;
 import com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel;
 import com.ctrip.framework.apollo.portal.service.txtresolver.ConfigTextResolver;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/PortalNamespaceService.java

@@ -11,7 +11,7 @@ import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.core.utils.StringUtils;
 import com.ctrip.framework.apollo.portal.PortalSettings;
 import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
-import com.ctrip.framework.apollo.portal.entity.NamespaceVO;
+import com.ctrip.framework.apollo.portal.entity.vo.NamespaceVO;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

+ 1 - 1
apollo-portal/src/main/resources/portal.properties

@@ -1,5 +1,5 @@
 spring.application.name= apollo-portal
-apollo.portal.env= fat,uat,pro
+apollo.portal.env= fat,uat
 ctrip.appid= 100003173
 server.port= 8070
 logging.file= /opt/logs/100003173/apollo-portal.log

+ 2 - 2
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ConfigServiceTest.java

@@ -6,8 +6,8 @@ import com.ctrip.framework.apollo.core.dto.ItemDTO;
 import com.ctrip.framework.apollo.core.dto.NamespaceDTO;
 import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
-import com.ctrip.framework.apollo.portal.entity.ItemDiffs;
-import com.ctrip.framework.apollo.portal.entity.NamespaceIdentifer;
+import com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs;
+import com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer;
 import com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel;
 import com.ctrip.framework.apollo.portal.service.PortalConfigService;
 import com.ctrip.framework.apollo.portal.service.txtresolver.PropertyResolver;

+ 1 - 1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/NamespaceServiceTest.java

@@ -5,7 +5,7 @@ import com.ctrip.framework.apollo.core.dto.NamespaceDTO;
 import com.ctrip.framework.apollo.core.dto.ReleaseDTO;
 import com.ctrip.framework.apollo.core.enums.Env;
 import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
-import com.ctrip.framework.apollo.portal.entity.NamespaceVO;
+import com.ctrip.framework.apollo.portal.entity.vo.NamespaceVO;
 import com.ctrip.framework.apollo.portal.service.PortalNamespaceService;
 import com.ctrip.framework.apollo.portal.service.txtresolver.PropertyResolver;