forked from alibaba/COLA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fulan.zjf
authored and
Frank Zhang
committed
Jan 7, 2018
0 parents
commit 5409f89
Showing
134 changed files
with
4,620 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
bin/ | ||
doc/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## crm-framework-archetype | ||
该文件夹下面是Archetype的源码, | ||
创建新的应用请使用下面的命令: | ||
|
||
``` | ||
mvn archetype:generate -DgroupId=com.alibaba.crm -DartifactId=demo -Dversion=1.0-SNAPSHOT -Dpackage=com.alibaba.crm.demo -DarchetypeArtifactId=crm-framework-archetype -DarchetypeGroupId=com.alibaba.crm -DarchetypeVersion=1.0-SNAPSHOT | ||
``` | ||
只需要将demo替换成你自己的Artifact名字就可以了 | ||
|
||
## crm-framework | ||
该文件夹下面是framework的源码,可以拉下来直接启动Spring容器,或者PandoraBoot跑通HSF和Diamond的。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.alibaba.sofa</groupId> | ||
<artifactId>all</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>all</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<mockito-all.version>1.10.19</mockito-all.version> | ||
<mybatis-starter.version>1.1.1</mybatis-starter.version> | ||
<spring-version>4.3.5.RELEASE</spring-version> | ||
<spring-boot.version>1.4.3.RELEASE</spring-boot.version> | ||
<spring-test.version>4.3.2.RELEASE</spring-test.version> | ||
<junit.version>4.12</junit.version> | ||
<logback.version>1.2.3.5-struct</logback.version> | ||
<slf4j.version>1.7.22</slf4j.version> | ||
<sofa.framework.version>1.0.0-SNAPSHOT</sofa.framework.version> | ||
<toolkit.common.lang.version>1.0</toolkit.common.lang.version> | ||
<jakarta.commons.beanutils.version>1.8.3</jakarta.commons.beanutils.version> | ||
</properties> | ||
|
||
<modules> | ||
<module>sofa-test</module> | ||
<module>sofa-common</module> | ||
<module>sofa-core</module> | ||
</modules> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!--项目依赖 --> | ||
<dependency> | ||
<groupId>com.alibaba.sofa</groupId> | ||
<artifactId>crm-test</artifactId> | ||
<version>${sofa.framework.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba.sofa</groupId> | ||
<artifactId>crm-common</artifactId> | ||
<version>${sofa.framework.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba.sofa</groupId> | ||
<artifactId>crm-core</artifactId> | ||
<version>${sofa.framework.version}</version> | ||
</dependency> | ||
<!--项目依赖 End --> | ||
<!-- Mybatis --> | ||
<dependency> | ||
<groupId>org.mybatis</groupId> | ||
<artifactId>mybatis</artifactId> | ||
<version>3.4.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mybatis</groupId> | ||
<artifactId>mybatis-spring</artifactId> | ||
<version>1.3.1</version> | ||
</dependency> | ||
<!-- Mybatis End --> | ||
<!-- Spring框架 --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-core</artifactId> | ||
<version>${spring-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>${spring-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-aop</artifactId> | ||
<version>${spring-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>${spring-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context-support</artifactId> | ||
<version>${spring-version}</version> | ||
</dependency> | ||
<!-- Spring框架 End --> | ||
<!-- 日志依赖 --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.9</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-core</artifactId> | ||
<version>${logback.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>${logback.version}</version> | ||
</dependency> | ||
<!-- 日志依赖 End --> | ||
<!-- 测试依赖 --> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>${mockito-all.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<version>${spring-test.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- 测试依赖 End --> | ||
<!-- Commons依赖 --> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.4</version> | ||
</dependency> | ||
<!-- Commons依赖End --> | ||
<!--Validation API--> | ||
<dependency> | ||
<groupId>javax.validation</groupId> | ||
<artifactId>validation-api</artifactId> | ||
<version>2.0.0.Final</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate.validator</groupId> | ||
<artifactId>hibernate-validator</artifactId> | ||
<version>6.0.7.Final</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.el</groupId> | ||
<artifactId>javax.el-api</artifactId> | ||
<version>3.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.web</groupId> | ||
<artifactId>javax.el</artifactId> | ||
<version>2.2.6</version> | ||
</dependency> | ||
<!--Validation API End --> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>3.0.1</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.alibaba.crm</groupId> | ||
<artifactId>all</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>crm-common</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>crm-common</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
39 changes: 39 additions & 0 deletions
39
sofa-framework/sofa-common/src/main/java/com/alibaba/sofa/dto/ClientObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.alibaba.sofa.dto; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* This is the object communicate with Client. | ||
* The clients could be view layer or other HSF Consumers | ||
* @author fulan.zjf 2017-10-27 PM 12:19:15 | ||
*/ | ||
public abstract class ClientObject implements Serializable{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* This is for extended values | ||
*/ | ||
protected Map<String, Object> extValues = new HashMap<String, Object>(); | ||
|
||
public Object getExtField(String key){ | ||
if(extValues != null){ | ||
return extValues.get(key); | ||
} | ||
return null; | ||
} | ||
|
||
public void putExtField(String fieldName, Object value){ | ||
this.extValues.put(fieldName, value); | ||
} | ||
|
||
public Map<String, Object> getExtValues() { | ||
return extValues; | ||
} | ||
|
||
public void setExtValues(Map<String, Object> extValues) { | ||
this.extValues = extValues; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
sofa-framework/sofa-common/src/main/java/com/alibaba/sofa/dto/Command.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.alibaba.sofa.dto; | ||
|
||
/** | ||
* Command stands for a request from Client. | ||
* According CommandExecutor will help to handle the business logic. This is a classic Command Pattern | ||
* | ||
* @author fulan.zjf 2017年10月27日 下午12:28:24 | ||
*/ | ||
public abstract class Command extends DTO{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* command的操作人 | ||
*/ | ||
private String operater; | ||
|
||
public String getOperater() { | ||
return operater; | ||
} | ||
|
||
public void setOperater(String operater) { | ||
this.operater = operater; | ||
} | ||
|
||
|
||
|
||
} |
16 changes: 16 additions & 0 deletions
16
sofa-framework/sofa-common/src/main/java/com/alibaba/sofa/dto/DTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.alibaba.sofa.dto; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Data Transfer object, including Command, Query and Response, | ||
* | ||
* Command and Query is CQRS concept. | ||
* | ||
* @author fulan.zjf 2017年10月21日 下午8:53:55 | ||
*/ | ||
public class DTO implements Serializable{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
sofa-framework/sofa-common/src/main/java/com/alibaba/sofa/dto/MultiResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.alibaba.sofa.dto; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* Response with batch record to return, | ||
* usually use in page query or conditional query | ||
* <p/> | ||
* Created by Danny.Lee on 2017/11/1. | ||
*/ | ||
public class MultiResponse<T> extends Response { | ||
|
||
private int total; | ||
|
||
private Collection<T> data; | ||
|
||
public static <T> MultiResponse<T> of(Collection<T> data, int total) { | ||
MultiResponse<T> multiResponse = new MultiResponse<>(); | ||
multiResponse.setSuccess(true); | ||
multiResponse.setData(data); | ||
multiResponse.setTotal(total); | ||
return multiResponse; | ||
} | ||
|
||
public static <T> MultiResponse<T> ofWithoutTotal(Collection<T> data) { | ||
return of(data,0); | ||
} | ||
|
||
|
||
public int getTotal() { | ||
return total; | ||
} | ||
|
||
|
||
public void setTotal(int total) { | ||
this.total = total; | ||
} | ||
|
||
|
||
public Collection<T> getData() { | ||
return data; | ||
} | ||
|
||
|
||
public void setData(Collection<T> data) { | ||
this.data = data; | ||
} | ||
|
||
public static MultiResponse buildFailure(String errCode, String errMessage) { | ||
MultiResponse response = new MultiResponse(); | ||
response.setSuccess(false); | ||
response.setErrCode(errCode); | ||
response.setErrMessage(errMessage); | ||
return response; | ||
} | ||
|
||
public static MultiResponse buildSuccess(){ | ||
MultiResponse response = new MultiResponse(); | ||
response.setSuccess(true); | ||
return response; | ||
} | ||
|
||
} |
Oops, something went wrong.