Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/4.0' into 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gudaoxuri committed Jan 20, 2017
2 parents 4efaae7 + 4755be1 commit 0f87c5f
Show file tree
Hide file tree
Showing 88 changed files with 2,561 additions and 1,005 deletions.
2 changes: 1 addition & 1 deletion components/ez-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ecfront</groupId>
<artifactId>ezf-component-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/ez-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ecfront</groupId>
<artifactId>ezf-component-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/ez-perf-request/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<artifactId>ezf-component-perf-request</artifactId>
<name>EZ Framework Perf request Component</name>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion components/ez-perf-test1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ecfront</groupId>
<artifactId>ezf-component-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/ez-perf-test2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ecfront</groupId>
<artifactId>ezf-component-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description>EZ框架Parent Component POM</description>
<url>https://github.com/gudaoxuri/ez-framework</url>
<packaging>pom</packaging>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>

<scm>
<connection>scm:git:[email protected]:gudaoxuri/ez-framework.git</connection>
Expand All @@ -24,7 +24,7 @@
</scm>

<properties>
<ezf-version>4.0-SNAPSHOT</ezf-version>
<ezf-version>4.0.1-SNAPSHOT</ezf-version>
</properties>

<modules>
Expand Down
50 changes: 0 additions & 50 deletions doc/api/EZ-Auth-AccountService.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,56 +67,6 @@ _无_
[GET] /ez/auth/manage/account/uuid/:uuid/disable/


*响应*

_无_

==== 获取登录账号的信息


*请求*

[GET] /ez/auth/manage/account/bylogin/


*响应*

|===
|列名|类型|说明

|id|String|数据库id,不能更改
|login_id|String|登录id,不能更改
|name|String|姓名
|image|String|头像
|email|String|Email
|current_password|String|当前密码,更新时需要验证
|new_password|String|新密码,如果需要更改密码时填写
|organization_code|String|组织编码,不能更改
|ext_id|String|扩展ID,不能更改
|ext_info|String|扩展信息
|===

==== 更新登录账号的信息


*请求*

[PUT] /ez/auth/manage/account/bylogin/
|===
|列名|类型|说明|是否必填

|id|String|数据库id,不能更改|true
|login_id|String|登录id,不能更改|true
|name|String|姓名|true
|image|String|头像|true
|email|String|Email|true
|current_password|String|当前密码,更新时需要验证|true
|new_password|String|新密码,如果需要更改密码时填写|false
|organization_code|String|组织编码,不能更改|false
|ext_id|String|扩展ID,不能更改|false
|ext_info|String|扩展信息|false
|===

*响应*

_无_
Expand Down
50 changes: 50 additions & 0 deletions doc/api/EZ-Auth-AuthService.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,56 @@ _无_
|extInfo|String|扩展信息
|===

==== 获取登录账号的信息


*请求*

[GET] /ez/auth/account/bylogin/


*响应*

|===
|列名|类型|说明

|id|String|数据库id,不能更改
|login_id|String|登录id,不能更改
|name|String|姓名
|image|String|头像
|email|String|Email
|current_password|String|当前密码,更新时需要验证
|new_password|String|新密码,如果需要更改密码时填写
|organization_code|String|组织编码,不能更改
|ext_id|String|扩展ID,不能更改
|ext_info|String|扩展信息
|===

==== 更新登录账号的信息


*请求*

[PUT] /ez/auth/account/bylogin/
|===
|列名|类型|说明|是否必填

|id|String|数据库id,不能更改|true
|login_id|String|登录id,不能更改|true
|name|String|姓名|true
|image|String|头像|true
|email|String|Email|true
|current_password|String|当前密码,更新时需要验证|true
|new_password|String|新密码,如果需要更改密码时填写|false
|organization_code|String|组织编码,不能更改|false
|ext_id|String|扩展ID,不能更改|false
|ext_info|String|扩展信息|false
|===

*响应*

_无_

==== 获取菜单列表


Expand Down
7 changes: 5 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description>EZ框架Parent POM</description>
<url>https://github.com/gudaoxuri/ez-framework</url>
<packaging>pom</packaging>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>

<scm>
<connection>scm:git:[email protected]:gudaoxuri/ez-framework.git</connection>
Expand All @@ -24,12 +24,15 @@
</scm>

<properties>
<ezf-version>4.0-SNAPSHOT</ezf-version>
<ezf-version>4.0.1-SNAPSHOT</ezf-version>
<ez-common.version>1.2.3</ez-common.version>
</properties>

<modules>
<module>services/core</module>
<module>services/cluster-nats</module>
<module>services/cluster-redis</module>
<module>services/cluster-rabbitmq</module>
<module>services/gateway</module>
<module>services/jdbc</module>
<module>services/email</module>
Expand Down
2 changes: 1 addition & 1 deletion services/auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ecfront</groupId>
<artifactId>ezf-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ object ServiceAdapter extends EZServiceAdapter[JsonNode] {
} else {
""
}
AutoBuildingProcessor.autoBuilding("com.ecfront.ez.framework.service.auth")
Initiator.init()
Resp.success("")
}

override def initPost(): Unit = {
AutoBuildingProcessor.autoBuilding("com.ecfront.ez.framework.service.auth")
Initiator.init()
super.initPost()
}

override def destroy(parameter: JsonNode): Resp[String] = {
Resp.success("")
Expand Down
35 changes: 23 additions & 12 deletions services/auth/src/test/resources/ez.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@
"ez": {
"app": "test",
"module": "EZ-Auth",
"cluster":{
"userName":"user",
"password":"password",
"host":"127.0.0.1",
"port":5672,
"virtualHost":"ez",
"defaultTopicExchangeName":"ex_topic",
"defaultRPCExchangeName":"ex_rpc",
"defaultQueueExchangeName":"ex_queue"
},
"cache": {
"address": "127.0.0.1:6379"
"cluster": {
"use": {
"rpc": "nats",
"mq": "rabbitmq",
"dist": "redis",
"cache": "redis"
},
"nats": {
"address":"127.0.0.1:4222"
},
"redis": {
"address":"127.0.0.1:6379"
},
"rabbitmq": {
"userName": "user",
"password": "wz_pass_2016",
"host": "127.0.0.1",
"port": 5672,
"virtualHost": "ez",
"defaultTopicExchangeName": "ex_topic",
"defaultRPCExchangeName": "ex_rpc",
"defaultQueueExchangeName": "ex_queue"
}
},
"rpc": {
"package": "com.ecfront.ez.framework.service.auth.test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AuthSpec extends GatewayStartupSpec {
def basicTest(): Unit = {
val resources = EZ_Resource.find("").body
assert(
resources.size == 9
resources.size == 1
&& resources.head.method == "*"
&& resources.head.uri == "/ez/auth/manage/*"
&& resources.head.code == "*" + BaseModel.SPLIT + "/ez/auth/manage/*"
Expand Down
42 changes: 42 additions & 0 deletions services/cluster-nats/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.ecfront</groupId>
<artifactId>ezf-parent</artifactId>
<version>4.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>ezf-cluster-nats</artifactId>
<name>EZ Framework cluster-nats</name>
<description>EZ框架nats集群模块</description>
<packaging>jar</packaging>
<version>${ezf-version}</version>

<properties>
<jnats.version>0.7.3</jnats.version>
</properties>

<dependencies>
<dependency>
<groupId>com.ecfront</groupId>
<artifactId>ezf-core</artifactId>
<version>${ezf-version}</version>
</dependency>
<dependency>
<groupId>com.ecfront</groupId>
<artifactId>ezf-test</artifactId>
<version>${ezf-version}</version>
</dependency>
<dependency>
<groupId>io.nats</groupId>
<artifactId>jnats</artifactId>
<version>${jnats.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.ecfront.ez.framework.cluster.nats

import com.ecfront.ez.framework.core.cluster._

import scala.beans.BeanProperty

object NatsCluster extends Cluster {

override val rpc: ClusterRPC = NatsClusterRPC

override val mq: ClusterMQ = NatsClusterMQ

override val dist: ClusterDist = null

override val cache: ClusterCache = null

override val manage: ClusterManage = NatsClusterManage
}

class MessageWrap {
@BeanProperty var message: String = _
@BeanProperty var args: Map[String, String] = _
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.ecfront.ez.framework.cluster.nats

import com.ecfront.common.JsonHelper
import com.ecfront.ez.framework.core.EZ
import com.ecfront.ez.framework.core.cluster.ClusterMQ
import io.nats.client.{Message, MessageHandler}

object NatsClusterMQ extends ClusterMQ {

override def publish(topic: String, message: String, args: Map[String, String]): Unit = {
val msgWrap = new MessageWrap
msgWrap.message = message
msgWrap.args = args
NatsClusterManage.getConnection.publish(topic, JsonHelper.toJsonString(msgWrap).getBytes("UTF-8"))
}

override def subscribe(topic: String)(receivedFun: (String, Map[String, String]) => Unit): Unit = {
NatsClusterManage.getConnection.subscribe(topic, new MessageHandler {
override def onMessage(msg: Message) = {
EZ.execute.execute(new Runnable {
override def run(): Unit = {
val replyMsg = JsonHelper.toObject[MessageWrap](new String(msg.getData, "UTF-8"))
receivedFun(replyMsg.message, replyMsg.args)
}
})
}
})
}

override def request(address: String, message: String, args: Map[String, String]): Unit = {
val msgWrap = new MessageWrap
msgWrap.message = message
msgWrap.args = args
NatsClusterManage.getConnection.request(address, JsonHelper.toJsonString(msgWrap).getBytes("UTF-8"))
}

override def response(address: String)(receivedFun: (String, Map[String, String]) => Unit): Unit = {
NatsClusterManage.getConnection.subscribe(address, address, new MessageHandler {
override def onMessage(msg: Message) = {
EZ.execute.execute(new Runnable {
override def run(): Unit = {
val replyMsg = JsonHelper.toObject[MessageWrap](new String(msg.getData, "UTF-8"))
receivedFun(replyMsg.message, replyMsg.args)
NatsClusterManage.getConnection.publish(msg.getReplyTo, "".getBytes("UTF-8"))
}
})
}
})
}

}
Loading

0 comments on commit 0f87c5f

Please sign in to comment.