Skip to content

Commit

Permalink
init tangyuan-base.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaop authored and gaop committed Jul 27, 2017
1 parent 8136e52 commit 140e861
Show file tree
Hide file tree
Showing 195 changed files with 22,477 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

/target
/.project
/.settings
/.classpath
/bin
6 changes: 6 additions & 0 deletions tangyuan-base/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

/target
/.project
/.settings
/.classpath
/bin
674 changes: 674 additions & 0 deletions tangyuan-base/LICENSE

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions tangyuan-base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Home

------

### 1. 项目介绍

#### 什么是TangYuan

TangYuan是一款以服务为核心,基于组件化和插件化的企业级的分布式开发框架。

#### Tangyuan的特点

> 1.服务
服务是TangYuan的核心,TangYuan框架中支持多种类型的服务,包括SQL服务、MONGO服务、JAVA服务和MQ服务;同时提供统一的方式对各种类型、各种分布的服务进行访问,对于分布式系统的开发,提供了极大的便利;

> 2.组件化
TangYuan默认提供的10种基础功能支持均以组件化的方式存在,开发者可根据项目的情况,选择相应的功能组件,装配即可。

> 3.插件化
插件化是针对服务管理和组织而言,多个独立或者相关的服务汇聚在一个插件中,通过配置文件,注册到服务容器中,以统一的访问方式,供其他系统访问。

#### Tangyuan的优势

> 1.多样化的组件
Tangyuan默认提供10种基础功能组件,包括sql、java、mongo、mq、aop、rpc、cache、timer、validate和web,为开发者提供完备的基础功能支持;

> 2.可定制型
根据项目的特点,只需要增加相应的组件即可。如比需要使用缓存功能,则只需要配置一下缓存组件,就可实现相应的功能支持。

> 3.开发效率高
基于Tangyuan框架进行系统开发,无论从代码量还是开发时间都能比市面上常见的开源框架较少20%-50%左右。尤其是涉及到数据库的开发,效率则能进一步提高。

> 4.完善的生态环境
除了后端系统直接的支持,对于不同终端,如H5端、安卓、IOS端均有相应的支持。

> 5.可扩展性
由于组件化的设计模式,框架可以很方便的提供基础功能的扩展。比如增加Hbase的支持,则只需要开发一套Hbase组件,整合进Tangyuan如何即可。


### 2. TangYuan组件

![架构图](images/01.png)

#### 组件说明

> SQL组件
提供SQL服务的基础功能支持,详见<http://www.xson.org/project/sql/1.2.0/>

> JAVA组件
提供JAVA服务的基础功能支持,详见<http://www.xson.org/project/java/1.2.0/>

> MONGO组件
提供MONGO服务的基础功能支持,详见<http://www.xson.org/project/mongo/1.2.0/>

> MQ组件
提供消息服务的基础功能支持,详见<http://www.xson.org/project/mq/1.2.0/>

> WEB组件
提供控制层的基础功能支持,详见<http://www.xson.org/project/web/1.2.0/>

> AOP组件
提供AOP的基础功能支持,详见<http://www.xson.org/project/aop/1.2.0/>

> RPC组件
提供RPC的基础功能支持,详见<http://www.xson.org/project/rpc/1.2.0/>

> CACHE组件
提供缓存的基础功能支持,详见<http://www.xson.org/project/cache/1.2.0/>

> VALIDATE组件
提供数据验证的基础功能支持,详见<http://www.xson.org/project/validate/1.2.0/>

> TIMER组件
提供定时程序的基础功能支持,详见<http://www.xson.org/project/timer/1.2.0/>


### 3. 版本和引用

当前最新版本:1.2.0

### 4. 源码

<https://github.com/xsonorg/tangyuan2>
196 changes: 196 additions & 0 deletions tangyuan-base/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.xson</groupId>
<artifactId>tangyuan-base</artifactId>
<version>1.2.0</version>
<packaging>jar</packaging>

<name>tangyuan-base</name>
<url>http://xson.org/tangyuan</url>
<description>tangyuan is a service-oriented, component-based and plug-in enterprise-level distributed development framework.</description>

<properties>
<java.version>1.7</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<developers>
<developer>
<id>david</id>
<name>david</name>
<email>xson_org@126.com</email>
</developer>
</developers>

<scm>
<url>https://github.com/xsonorg/tangyuan2.git</url>
<connection>scm:git:https://github.com/xsonorg/tangyuan2.git</connection>
</scm>

<licenses>
<license>
<name>GNU General Public License v3.0</name>
<url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
</license>
</licenses>

<dependencies>

<dependency>
<groupId>org.xson</groupId>
<artifactId>logging</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.xson</groupId>
<artifactId>common-object</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.41</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>

<!-- <dependency> <groupId>org.xson</groupId> <artifactId>zongzi-api</artifactId>
<version>1.2.0</version> </dependency> -->

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerVersion>${java.version}</compilerVersion>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>private</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>haorizi.releases.http</id>
<name>Nexus Release Repository</name>
<url>http://192.168.0.251:8888/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>haorizi.snapshots.http</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.0.251:8888/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>public</id>
<distributionManagement>
<snapshotRepository>
<id>oss</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>oss</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<show>public</show>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
55 changes: 55 additions & 0 deletions tangyuan-base/src/main/java/org/xson/tangyuan/ComponentVo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.xson.tangyuan;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class ComponentVo {

private TangYuanComponent component;
private int startupOrder;
private int closeOrder;
private String type;

public ComponentVo(TangYuanComponent component, String type, int startupOrder, int closeOrder) {
this.component = component;
this.type = type;
this.startupOrder = startupOrder;
this.closeOrder = closeOrder;
}

public TangYuanComponent getComponent() {
return component;
}

public int getStartupOrder() {
return startupOrder;
}

public int getCloseOrder() {
return closeOrder;
}

public String getType() {
return type;
}

public static List<ComponentVo> sort(List<ComponentVo> componentList, boolean startup) {
if (startup) {
Collections.sort(componentList, new Comparator<ComponentVo>() {
@Override
public int compare(ComponentVo o1, ComponentVo o2) {
return o1.getStartupOrder() - o2.getStartupOrder();
}
});
} else {
Collections.sort(componentList, new Comparator<ComponentVo>() {
@Override
public int compare(ComponentVo o1, ComponentVo o2) {
return o1.getCloseOrder() - o2.getCloseOrder();
}
});
}
return componentList;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.xson.tangyuan;

import java.util.Map;

public interface TangYuanComponent {

void config(Map<String, String> properties);

void start(String resource) throws Throwable;

void stop(boolean wait);

}
Loading

0 comments on commit 140e861

Please sign in to comment.