This is an automated email from the ASF dual-hosted git repository. iluo pushed a commit to branch makefile in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/makefile by this push: new 0da9873 update README, remove 'dubbo' sub dir from 'helloworld' 0da9873 is described below commit 0da9873919b023b36fdabdd55ddca8b00d093394 Author: Ian Luo <ian....@gmail.com> AuthorDate: Tue Oct 27 15:02:14 2020 +0800 update README, remove 'dubbo' sub dir from 'helloworld' --- README.md | 176 ++++---- helloworld/{dubbo => }/.travis.yml | 0 helloworld/{dubbo => }/go-client/cmd/client.go | 2 +- .../{dubbo/go-server => go-client}/conf/client.yml | 0 .../{dubbo/go-server => go-client}/conf/log.yml | 0 helloworld/{dubbo => }/go-client/pkg/user.go | 0 helloworld/{dubbo => }/go-server/cmd/server.go | 2 +- .../{dubbo/go-client => go-server}/conf/client.yml | 0 .../{dubbo/go-client => go-server}/conf/log.yml | 0 helloworld/{dubbo => }/go-server/conf/server.yml | 0 .../go-server/docker/docker-compose.yml | 0 helloworld/{dubbo => }/go-server/pkg/user.go | 0 .../go-server/tests/integration/main_test.go | 0 .../tests/integration/userprovider_test.go | 0 helloworld/{dubbo => }/java-client/build.sh | 0 helloworld/{dubbo => }/java-client/pom.xml | 460 ++++++++++----------- .../java-client/src/main/assembly/assembly.xml | 84 ++-- .../src/main/java/com/ikurento/user/Consumer.java | 120 +++--- .../src/main/java/com/ikurento/user/User.java | 152 +++---- .../main/java/com/ikurento/user/UserProvider.java | 36 +- .../resources/META-INF/spring/dubbo.consumer.xml | 0 .../src/main/resources/META-INF/spring/service.xml | 54 +-- .../src/main/resources/dubbo.properties | 26 +- .../src/main/resources/log4j.properties | 0 helloworld/{dubbo => }/java-server/build.sh | 0 helloworld/{dubbo => }/java-server/pom.xml | 0 helloworld/{dubbo => }/java-server/script/debug.sh | 0 .../java-server/src/main/assembly/assembly.xml | 86 ++-- .../src/main/java/com/ikurento/user/Provider.java | 0 .../src/main/java/com/ikurento/user/User.java | 172 ++++---- .../main/java/com/ikurento/user/UserProvider.java | 48 +-- .../java/com/ikurento/user/UserProviderImpl.java | 60 +-- .../resources/META-INF/spring/dubbo.provider.xml | 66 +-- .../src/main/resources/dubbo.properties | 28 +- .../src/main/resources/log4j.properties | 40 +- 35 files changed, 806 insertions(+), 806 deletions(-) diff --git a/README.md b/README.md index f9af481..b1a2e02 100644 --- a/README.md +++ b/README.md @@ -1,142 +1,143 @@ -# examples +# Dubbo Golang Examples -Examples of dubbo-go +## What It Contains -## What does this contain - -* helloworld - - A simplest example. It contain 'go-client', 'go-server', 'java-server' of dubbo protocol. - -* direct - - A direct example. This feature make start of dubbo-go get easy. - -* async - - An async example. dubbo-go supports client to call server asynchronously. - -* general - - A general example. It had validated zookeeper registry and different parameter lists of service. +* helloworld: A simplest example. It contain 'go-client', 'go-server', 'java-server' of dubbo protocol. +* direct: A direct example. This feature make start of dubbo-go get easy. +* async: An async example. dubbo-go supports client to call server asynchronously. +* general: A general example. It had validated zookeeper registry and different parameter lists of service. And it has a comprehensive testing with dubbo/jsonrpc/grpc/rest protocol. You can refer to it to create your first complete dubbo-go project. +* generic: A generic example. It show how to use generic feature of dubbo-go. +* configcenter: Some examples of different config center. There are three -- zookeeper, apollo and nacos at present. +* multi_registry: An example of multiple registries. +* registry: Some examples of different registry. There are kubernetes, nacos and etcd at present. **Note**: When use the different registry, you need update config file, but also must import the registry package. see the etcd `README` +* filter: Some examples of different filter. Including custom_filter and tpslimit +* router: Some router examples. Now, a condition router example is existing. +* seata: Transaction system examples by seata. +* shop: Shop sample, make consumer and provider run in a go program. +* tracing: Some tracing examples. We have tracing support of dubbo/grpc/jsonrpc protocol at present. + +## How To Run -* generic +> Take `helloworld` as an example - A generic example. It show how to use generic feature of dubbo-go. +#### 1. Setup Zookeeper Server -* configcenter +A [zookeeper](https://zookeeper.apache.org/releases.html) server is required to run most of the samples in this repository. It can either start without docker environment like this: - Some examples of different config center. There are three -- zookeeper, apollo and nacos at present. +```bash +zkServer start +``` -* multi_registry +or start when docker environment presents: - An example of multiple registries. +```bash +docker run --name zookeeper -p2181:2181 -d zookeeper +``` -* registry +This samples repository provides an even more convenient way to start zookeeper: - Some examples of different registry. There are kubernetes, nacos and etcd at present. +```bash +cd helloworld/go-server +make -f ../../build/Makefile docker-up +``` - **Note**: +Once the following messages outputs, the zookeeper server is ready. - When use different registry, you need update config file, but also must import the registry package. see the etcd `README` +```bash +> Starting dependency services with docker/docker-compose.yml +Creating network "docker_default" with the default driver +Creating docker_zookeeper_1 ... done +``` -* filter +To shutdown it, simple run - Some examples of different filter. Including custom_filter and tpslimit - -* router +```bash +make -f ~/github/apache/dubbo-go-samples/build/Makefile docker-down +``` - Some router examples. Now, a condition router example is existing. +#### 2. Start go-server -* seata +Use the following commands to start `go-server`. - Transaction system examples by seata. +```bash +cd helloworld/go-server +make -f ../../build/Makefile start +``` -* shop +Once the following messages outputs, the server is ready. - Shop sample, make consumer and provider run in a go program. - -* tracing +```bash +> Buiding application binary: dist/darwin_amd64/release/go-server +> Starting application go-server, output is redirected to dist/darwin_amd64/release/go-server.log + > PID: 86428 +``` - Some tracing examples. We have tracing support of dubbo/grpc/jsonrpc protocol at present. +The output of `go-server` can be found from 'dist/darwin_amd64/release/go-server.log'. -## How to build and run +#### 3. Run go-client -> Take `helloworld` as an example -java server +Use the following commands to run `go-client`. ```bash -cd helloworld/dubbo/java-server -sh build.sh -cd ./target -tar -zxvf user-info-server-0.2.0-assembly.tar.gz -cd ./user-info-server-0.2.0 -sh ./bin/server.sh start +cd helloworld/go-client +make -f ../../build/Makefile run ``` -java client +Once the following messages outputs, the `go-client` calls the `go-server` successfully. ```bash -cd helloworld/dubbo/java-client -sh build.sh -cd ./target -tar -zxvf user-info-client-0.2.0-assembly.tar.gz -cd ./user-info-client-0.2.0 -sh ./bin/server.sh start +> Buiding application binary: dist/darwin_amd64/release/go-client +> Running application go-client, output is redirected to dist/darwin_amd64/release/go-client.log +... +2020-10-27T14:51:37.520+0800 DEBUG dubbo/dubbo_invoker.go:144 result.Err: <nil>, result.Rest: &{A001 Alex Stocks 18 2020-10-27 14:51:37.52 +0800 CST} +2020-10-27T14:51:37.520+0800 DEBUG proxy/proxy.go:177 [makeDubboCallProxy] result: &{A001 Alex Stocks 18 2020-10-27 14:51:37.52 +0800 CST}, err: <nil> +response result: &{A001 Alex Stocks 18 2020-10-27 14:51:37.52 +0800 CST} ``` -go server +#### 4. Integration Test -* $ARCH = [linux, mac, windows] and $ENV = [dev, release, test] +dubbo-go-samples is designed to serve the purposes of not only the show cases of how to use apache/dubbo-go but also the integration-test for apache/dubbo-go. To run integration test for `go-server`, run the following commands: ```bash -cd helloworld/dubbo/go-server -sh ./assembly/$ARCH/$ENV.sh -cd ./target/$ARCH/user_info_server-0.3.1-20190517-0930-release -# $SUFFIX is a suffix of config file, -# such as server_zookeeper.yml when $SUFFIX is "zookeeper", -# if $SUFFIX = "", default server.yml -sh ./bin/load.sh start $SUFFIX +cd helloworld/go-server +make -f ../../build/Makefile integration ``` -go client - -* $ARCH = [linux, mac, windows] and $ENV = [dev, release, test] +Once the following messages outputs, the integration tests pass. ```bash -cd helloworld/dubbo/go-client -sh ./assembly/$ARCH/$ENV.sh -cd ./target/$ARCH/user_info_client-0.3.1-20190517-0921-release -# $SUFFIX is a suffix of config file, -# such as client_zookeeper.yml when $SUFFIX = zookeeper", -# if $SUFFIX = "", config file is client.yml -sh ./bin/load_user_info_client.sh start $SUFFIX +> Running integration test for application go-server +... +--- PASS: TestGetUser (0.00s) +PASS +ok github.com/apache/dubbo-samples/golang/helloworld/go-server/tests/integration 3.603s ``` -docker env +#### 5. Clean Up + +To clean up, run the following command: ```bash -docker run -d --name zk zookeeper -docker run -d --network container:zk registry.cn-hangzhou.aliyuncs.com/scottwang/go-server -docker run -d --network container:zk registry.cn-hangzhou.aliyuncs.com/scottwang/go-client +cd helloworld/go-server +make -f ../../build/Makefile clean +make -f ../../build/Makefile docker-down ``` ## How to debug with Goland -### Edit Configurations +#### 1. Edit Configurations ![](.images/edit_configuratios.png) -### Configure `Environment Variable` - -1. Add `APP_LOG_CONF_FILE`. eg: `/home/xx/dubbogo-samples/helloworld/client/conf/log.yml` -2. Add `CONF_CONSUMER_FILE_PATH` eg: `/home/xx/dubbogo-samples/helloworld/client/conf/client.yml` -3. Add `CONF_PROVIDER_FILE_PATH` eg: `/home/xx/dubbogo-samples/helloworld/server/conf/server.yml` +#### 2. Configure `Environment Variable` +* Add `APP_LOG_CONF_FILE`. eg: `/home/xx/dubbogo-samples/helloworld/client/conf/log.yml` +* Add `CONF_CONSUMER_FILE_PATH` eg: `/home/xx/dubbogo-samples/helloworld/client/conf/client.yml` +* Add `CONF_PROVIDER_FILE_PATH` eg: `/home/xx/dubbogo-samples/helloworld/server/conf/server.yml` ![](.images/edit_env.png) -### Apply & Run +Click Apply, then you are all set to run. ## How to contribute @@ -144,4 +145,3 @@ If you want to add some samples, we hope that you can do this: 1. Adding samples in appropriate directory. If you dont' know which directory you should put your samples into, you can get some advices from dubbo-go community. 2. You must run the samples locally and there must be no any error. 3. If your samples have some third party dependency, including another framework, we hope that you can provide some docs, script is better. -4. Please make pr to https://github.com/dubbogo/dubbo-samples instead of https://github.com/apache/dubbo-samples. We will synchronize to apache/dubbo-samples regularly. diff --git a/helloworld/dubbo/.travis.yml b/helloworld/.travis.yml similarity index 100% rename from helloworld/dubbo/.travis.yml rename to helloworld/.travis.yml diff --git a/helloworld/dubbo/go-client/cmd/client.go b/helloworld/go-client/cmd/client.go similarity index 96% rename from helloworld/dubbo/go-client/cmd/client.go rename to helloworld/go-client/cmd/client.go index b72518b..af39db4 100644 --- a/helloworld/dubbo/go-client/cmd/client.go +++ b/helloworld/go-client/cmd/client.go @@ -25,7 +25,7 @@ import ( import ( hessian "github.com/apache/dubbo-go-hessian2" - "github.com/apache/dubbo-samples/golang/helloworld/dubbo/go-client/pkg" + "github.com/apache/dubbo-samples/golang/helloworld/go-client/pkg" "github.com/dubbogo/gost/log" ) diff --git a/helloworld/dubbo/go-server/conf/client.yml b/helloworld/go-client/conf/client.yml similarity index 100% rename from helloworld/dubbo/go-server/conf/client.yml rename to helloworld/go-client/conf/client.yml diff --git a/helloworld/dubbo/go-server/conf/log.yml b/helloworld/go-client/conf/log.yml similarity index 100% rename from helloworld/dubbo/go-server/conf/log.yml rename to helloworld/go-client/conf/log.yml diff --git a/helloworld/dubbo/go-client/pkg/user.go b/helloworld/go-client/pkg/user.go similarity index 100% rename from helloworld/dubbo/go-client/pkg/user.go rename to helloworld/go-client/pkg/user.go diff --git a/helloworld/dubbo/go-server/cmd/server.go b/helloworld/go-server/cmd/server.go similarity index 96% rename from helloworld/dubbo/go-server/cmd/server.go rename to helloworld/go-server/cmd/server.go index 7d77af8..0f1ffed 100644 --- a/helloworld/dubbo/go-server/cmd/server.go +++ b/helloworld/go-server/cmd/server.go @@ -38,7 +38,7 @@ import ( _ "github.com/apache/dubbo-go/registry/protocol" _ "github.com/apache/dubbo-go/registry/zookeeper" - "github.com/apache/dubbo-samples/golang/helloworld/dubbo/go-server/pkg" + "github.com/apache/dubbo-samples/golang/helloworld/go-server/pkg" ) var ( diff --git a/helloworld/dubbo/go-client/conf/client.yml b/helloworld/go-server/conf/client.yml similarity index 100% rename from helloworld/dubbo/go-client/conf/client.yml rename to helloworld/go-server/conf/client.yml diff --git a/helloworld/dubbo/go-client/conf/log.yml b/helloworld/go-server/conf/log.yml similarity index 100% rename from helloworld/dubbo/go-client/conf/log.yml rename to helloworld/go-server/conf/log.yml diff --git a/helloworld/dubbo/go-server/conf/server.yml b/helloworld/go-server/conf/server.yml similarity index 100% rename from helloworld/dubbo/go-server/conf/server.yml rename to helloworld/go-server/conf/server.yml diff --git a/helloworld/dubbo/go-server/docker/docker-compose.yml b/helloworld/go-server/docker/docker-compose.yml similarity index 100% rename from helloworld/dubbo/go-server/docker/docker-compose.yml rename to helloworld/go-server/docker/docker-compose.yml diff --git a/helloworld/dubbo/go-server/pkg/user.go b/helloworld/go-server/pkg/user.go similarity index 100% rename from helloworld/dubbo/go-server/pkg/user.go rename to helloworld/go-server/pkg/user.go diff --git a/helloworld/dubbo/go-server/tests/integration/main_test.go b/helloworld/go-server/tests/integration/main_test.go similarity index 100% rename from helloworld/dubbo/go-server/tests/integration/main_test.go rename to helloworld/go-server/tests/integration/main_test.go diff --git a/helloworld/dubbo/go-server/tests/integration/userprovider_test.go b/helloworld/go-server/tests/integration/userprovider_test.go similarity index 100% rename from helloworld/dubbo/go-server/tests/integration/userprovider_test.go rename to helloworld/go-server/tests/integration/userprovider_test.go diff --git a/helloworld/dubbo/java-client/build.sh b/helloworld/java-client/build.sh similarity index 100% rename from helloworld/dubbo/java-client/build.sh rename to helloworld/java-client/build.sh diff --git a/helloworld/dubbo/java-client/pom.xml b/helloworld/java-client/pom.xml similarity index 96% rename from helloworld/dubbo/java-client/pom.xml rename to helloworld/java-client/pom.xml index 4065414..445b924 100644 --- a/helloworld/dubbo/java-client/pom.xml +++ b/helloworld/java-client/pom.xml @@ -1,230 +1,230 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - 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.ikurento</groupId> - <artifactId>user-info-client</artifactId> - <packaging>jar</packaging> - <version>0.2.0</version> - <description>The demo consumer module of dubbo project</description> - - <properties> - <skip_maven_deploy>false</skip_maven_deploy> - - <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version> - <dubbo-version>2.6.5</dubbo-version> - </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>dubbo-dependencies-bom</artifactId> - <version>${dubbo-version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <dependency> - <groupId>com.qianmi</groupId> - <artifactId>dubbo-rpc-jsonrpc</artifactId> - <version>${dubbo-jsonrpc-version}</version> - </dependency> - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>dubbo</artifactId> - <version>${dubbo-version}</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </dependency> - <dependency> - <groupId>org.apache.curator</groupId> - <artifactId>curator-framework</artifactId> - <version>2.12.0</version> - </dependency> - - <dependency> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - <version>3.20.0-GA</version> - </dependency> - <dependency> - <groupId>org.jboss.netty</groupId> - <artifactId>netty</artifactId> - <version>3.2.5.Final</version> - </dependency> - <dependency> - <groupId>org.apache.mina</groupId> - <artifactId>mina-core</artifactId> - <version>1.1.7</version> - </dependency> - <dependency> - <groupId>org.glassfish.grizzly</groupId> - <artifactId>grizzly-core</artifactId> - <version>2.1.4</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.5.7</version> - </dependency> - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>fastjson</artifactId> - <version>1.2.56</version> - </dependency> - <dependency> - <groupId>com.thoughtworks.xstream</groupId> - <artifactId>xstream</artifactId> - <version>1.4.7</version> - </dependency> - <dependency> - <groupId>org.apache.bsf</groupId> - <artifactId>bsf-api</artifactId> - <version>3.1</version> - </dependency> - <dependency> - <groupId>org.apache.zookeeper</groupId> - <artifactId>zookeeper</artifactId> - <version>3.4.14</version> - </dependency> - <dependency> - <groupId>com.github.sgroschupf</groupId> - <artifactId>zkclient</artifactId> - <version>0.1</version> - </dependency> - <dependency> - <groupId>com.netflix.curator</groupId> - <artifactId>curator-framework</artifactId> - <version>1.1.16</version> - </dependency> - <dependency> - <groupId>com.googlecode.xmemcached</groupId> - <artifactId>xmemcached</artifactId> - <version>1.3.6</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-simple</artifactId> - <version>2.6.1</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http</artifactId> - <version>2.6.1</version> - </dependency> - <dependency> - <groupId>org.apache.thrift</groupId> - <artifactId>libthrift</artifactId> - <version>0.12.0</version> - </dependency> - <dependency> - <groupId>com.caucho</groupId> - <artifactId>hessian</artifactId> - <version>4.0.7</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - </dependency> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty</artifactId> - <version>6.1.26</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.16</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.6.2</version> - </dependency> - <dependency> - <groupId>redis.clients</groupId> - <artifactId>jedis</artifactId> - <version>2.1.0</version> - </dependency> - <dependency> - <groupId>javax.validation</groupId> - <artifactId>validation-api</artifactId> - <version>1.0.0.GA</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-validator</artifactId> - <version>4.2.0.Final</version> - </dependency> - <dependency> - <groupId>javax.cache</groupId> - <artifactId>cache-api</artifactId> - <version>0.4</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>unpack</id> - <phase>package</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>com.alibaba</groupId> - <artifactId>dubbo</artifactId> - <version>${dubbo-version}</version> - <outputDirectory>${project.build.directory}/dubbo</outputDirectory> - <includes>META-INF/assembly/**</includes> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptor>src/main/assembly/assembly.xml</descriptor> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" + 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.ikurento</groupId> + <artifactId>user-info-client</artifactId> + <packaging>jar</packaging> + <version>0.2.0</version> + <description>The demo consumer module of dubbo project</description> + + <properties> + <skip_maven_deploy>false</skip_maven_deploy> + + <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version> + <dubbo-version>2.6.5</dubbo-version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>dubbo-dependencies-bom</artifactId> + <version>${dubbo-version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>com.qianmi</groupId> + <artifactId>dubbo-rpc-jsonrpc</artifactId> + <version>${dubbo-jsonrpc-version}</version> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>dubbo</artifactId> + <version>${dubbo-version}</version> + </dependency> + + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </dependency> + <dependency> + <groupId>org.apache.curator</groupId> + <artifactId>curator-framework</artifactId> + <version>2.12.0</version> + </dependency> + + <dependency> + <groupId>org.javassist</groupId> + <artifactId>javassist</artifactId> + <version>3.20.0-GA</version> + </dependency> + <dependency> + <groupId>org.jboss.netty</groupId> + <artifactId>netty</artifactId> + <version>3.2.5.Final</version> + </dependency> + <dependency> + <groupId>org.apache.mina</groupId> + <artifactId>mina-core</artifactId> + <version>1.1.7</version> + </dependency> + <dependency> + <groupId>org.glassfish.grizzly</groupId> + <artifactId>grizzly-core</artifactId> + <version>2.1.4</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.7</version> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + <version>1.2.56</version> + </dependency> + <dependency> + <groupId>com.thoughtworks.xstream</groupId> + <artifactId>xstream</artifactId> + <version>1.4.7</version> + </dependency> + <dependency> + <groupId>org.apache.bsf</groupId> + <artifactId>bsf-api</artifactId> + <version>3.1</version> + </dependency> + <dependency> + <groupId>org.apache.zookeeper</groupId> + <artifactId>zookeeper</artifactId> + <version>3.4.14</version> + </dependency> + <dependency> + <groupId>com.github.sgroschupf</groupId> + <artifactId>zkclient</artifactId> + <version>0.1</version> + </dependency> + <dependency> + <groupId>com.netflix.curator</groupId> + <artifactId>curator-framework</artifactId> + <version>1.1.16</version> + </dependency> + <dependency> + <groupId>com.googlecode.xmemcached</groupId> + <artifactId>xmemcached</artifactId> + <version>1.3.6</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-simple</artifactId> + <version>2.6.1</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>2.6.1</version> + </dependency> + <dependency> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + <version>0.12.0</version> + </dependency> + <dependency> + <groupId>com.caucho</groupId> + <artifactId>hessian</artifactId> + <version>4.0.7</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + <version>6.1.26</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.16</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.6.2</version> + </dependency> + <dependency> + <groupId>redis.clients</groupId> + <artifactId>jedis</artifactId> + <version>2.1.0</version> + </dependency> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>1.0.0.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + <version>4.2.0.Final</version> + </dependency> + <dependency> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>0.4</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack</id> + <phase>package</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>com.alibaba</groupId> + <artifactId>dubbo</artifactId> + <version>${dubbo-version}</version> + <outputDirectory>${project.build.directory}/dubbo</outputDirectory> + <includes>META-INF/assembly/**</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptor>src/main/assembly/assembly.xml</descriptor> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/helloworld/dubbo/java-client/src/main/assembly/assembly.xml b/helloworld/java-client/src/main/assembly/assembly.xml similarity index 96% rename from helloworld/dubbo/java-client/src/main/assembly/assembly.xml rename to helloworld/java-client/src/main/assembly/assembly.xml index bc00a06..84f5499 100644 --- a/helloworld/dubbo/java-client/src/main/assembly/assembly.xml +++ b/helloworld/java-client/src/main/assembly/assembly.xml @@ -1,43 +1,43 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<assembly> - <id>assembly</id> - <formats> - <format>tar.gz</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <fileSets> - <fileSet> - <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory> - <outputDirectory>bin</outputDirectory> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>src/main/resources</directory> - <includes> - <include>dubbo.properties</include> - <include>log4j.*</include> - </includes> - <outputDirectory>conf</outputDirectory> - <fileMode>0644</fileMode> - </fileSet> - </fileSets> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - </dependencySet> - </dependencySets> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<assembly> + <id>assembly</id> + <formats> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>src/main/resources</directory> + <includes> + <include>dubbo.properties</include> + <include>log4j.*</include> + </includes> + <outputDirectory>conf</outputDirectory> + <fileMode>0644</fileMode> + </fileSet> + </fileSets> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + </dependencySet> + </dependencySets> </assembly> \ No newline at end of file diff --git a/helloworld/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java b/helloworld/java-client/src/main/java/com/ikurento/user/Consumer.java similarity index 97% rename from helloworld/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java rename to helloworld/java-client/src/main/java/com/ikurento/user/Consumer.java index 51e3d67..ecefa6e 100644 --- a/helloworld/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java +++ b/helloworld/java-client/src/main/java/com/ikurento/user/Consumer.java @@ -1,60 +1,60 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ikurento.user; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.springframework.context.support.ClassPathXmlApplicationContext; - - -public class Consumer { - // Define a private variable (Required in Spring) - private UserProvider userProvider; - - // Spring DI (Required in Spring) - public void setUserProvider(UserProvider u) { - this.userProvider = u; - } - - public static void main(String[] args) { - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml","META-INF/spring/service.xml"); - context.start(); - context.getBean(Consumer.class).start(); - } - - // Start the entry function for consumer (Specified in the configuration file) - public void start() { - System.out.println("\n\ntest"); - testGetUser(); - } - - private void testGetUser() { - try { - User user1 = userProvider.GetUser("A003"); - System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + - " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName() - + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString()); - - } catch (Exception e) { - System.out.println("*************exception***********"); - e.printStackTrace(); - } - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ikurento.user; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + + +public class Consumer { + // Define a private variable (Required in Spring) + private UserProvider userProvider; + + // Spring DI (Required in Spring) + public void setUserProvider(UserProvider u) { + this.userProvider = u; + } + + public static void main(String[] args) { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml","META-INF/spring/service.xml"); + context.start(); + context.getBean(Consumer.class).start(); + } + + // Start the entry function for consumer (Specified in the configuration file) + public void start() { + System.out.println("\n\ntest"); + testGetUser(); + } + + private void testGetUser() { + try { + User user1 = userProvider.GetUser("A003"); + System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + + " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName() + + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString()); + + } catch (Exception e) { + System.out.println("*************exception***********"); + e.printStackTrace(); + } + } + +} diff --git a/helloworld/dubbo/java-client/src/main/java/com/ikurento/user/User.java b/helloworld/java-client/src/main/java/com/ikurento/user/User.java similarity index 95% rename from helloworld/dubbo/java-client/src/main/java/com/ikurento/user/User.java rename to helloworld/java-client/src/main/java/com/ikurento/user/User.java index 666e904..1526244 100644 --- a/helloworld/dubbo/java-client/src/main/java/com/ikurento/user/User.java +++ b/helloworld/java-client/src/main/java/com/ikurento/user/User.java @@ -1,76 +1,76 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ikurento.user; - -import java.util.Date; - -public class User { - - private String id; - - private String name; - - private int age; - - private Date time = new Date(); - - - public User() { - } - - - public User(String id, String name, int age) { - this.id = id; - this.name = name; - this.age = age; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public Date getTime() { - return time; - } - - public void setTime(Date time) { - this.time = time; - } - - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ikurento.user; + +import java.util.Date; + +public class User { + + private String id; + + private String name; + + private int age; + + private Date time = new Date(); + + + public User() { + } + + + public User(String id, String name, int age) { + this.id = id; + this.name = name; + this.age = age; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + +} diff --git a/helloworld/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java b/helloworld/java-client/src/main/java/com/ikurento/user/UserProvider.java similarity index 97% rename from helloworld/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java rename to helloworld/java-client/src/main/java/com/ikurento/user/UserProvider.java index 67a836a..f42452d 100644 --- a/helloworld/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java +++ b/helloworld/java-client/src/main/java/com/ikurento/user/UserProvider.java @@ -1,18 +1,18 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ikurento.user; - -public interface UserProvider { - User GetUser(String userId); -} +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ikurento.user; + +public interface UserProvider { + User GetUser(String userId); +} diff --git a/helloworld/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/helloworld/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml similarity index 100% rename from helloworld/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml rename to helloworld/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml diff --git a/helloworld/dubbo/java-client/src/main/resources/META-INF/spring/service.xml b/helloworld/java-client/src/main/resources/META-INF/spring/service.xml similarity index 97% rename from helloworld/dubbo/java-client/src/main/resources/META-INF/spring/service.xml rename to helloworld/java-client/src/main/resources/META-INF/spring/service.xml index 529f63e..e4f5fda 100644 --- a/helloworld/dubbo/java-client/src/main/resources/META-INF/spring/service.xml +++ b/helloworld/java-client/src/main/resources/META-INF/spring/service.xml @@ -1,27 +1,27 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:context="http://www.springframework.org/schema/context" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> - - <bean class="com.ikurento.user.Consumer" init-method="start"> - <!-- 声明这个类 要使用的服务名--> - <property name="userProvider" ref="userProvider" /> - </bean> - -</beans> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> + + <bean class="com.ikurento.user.Consumer" init-method="start"> + <!-- 声明这个类 要使用的服务名--> + <property name="userProvider" ref="userProvider" /> + </bean> + +</beans> diff --git a/helloworld/dubbo/java-client/src/main/resources/dubbo.properties b/helloworld/java-client/src/main/resources/dubbo.properties similarity index 97% rename from helloworld/dubbo/java-client/src/main/resources/dubbo.properties rename to helloworld/java-client/src/main/resources/dubbo.properties index e561efc..701dd46 100644 --- a/helloworld/dubbo/java-client/src/main/resources/dubbo.properties +++ b/helloworld/java-client/src/main/resources/dubbo.properties @@ -1,13 +1,13 @@ -### dubboע���������� ### -dubbo.container = log4j,spring -dubbo.application.name = user-info-client -dubbo.application.owner = AlexStocks -dubbo.application.environment = product -dubbo.registry.address = zookeeper://127.0.0.1:2181 -dubbo.monitor.protocol = zookeeper -dubbo.consumer.timeout = 10000 -dubbo.provider.timeout = 10000 -dubbo.protocol.name = dubbo - -dubbo.log4j.file = logs/client.log -dubbo.log4j.level = WARN +### dubboע���������� ### +dubbo.container = log4j,spring +dubbo.application.name = user-info-client +dubbo.application.owner = AlexStocks +dubbo.application.environment = product +dubbo.registry.address = zookeeper://127.0.0.1:2181 +dubbo.monitor.protocol = zookeeper +dubbo.consumer.timeout = 10000 +dubbo.provider.timeout = 10000 +dubbo.protocol.name = dubbo + +dubbo.log4j.file = logs/client.log +dubbo.log4j.level = WARN diff --git a/helloworld/dubbo/java-client/src/main/resources/log4j.properties b/helloworld/java-client/src/main/resources/log4j.properties similarity index 100% rename from helloworld/dubbo/java-client/src/main/resources/log4j.properties rename to helloworld/java-client/src/main/resources/log4j.properties diff --git a/helloworld/dubbo/java-server/build.sh b/helloworld/java-server/build.sh similarity index 100% rename from helloworld/dubbo/java-server/build.sh rename to helloworld/java-server/build.sh diff --git a/helloworld/dubbo/java-server/pom.xml b/helloworld/java-server/pom.xml similarity index 100% rename from helloworld/dubbo/java-server/pom.xml rename to helloworld/java-server/pom.xml diff --git a/helloworld/dubbo/java-server/script/debug.sh b/helloworld/java-server/script/debug.sh similarity index 100% rename from helloworld/dubbo/java-server/script/debug.sh rename to helloworld/java-server/script/debug.sh diff --git a/helloworld/dubbo/java-server/src/main/assembly/assembly.xml b/helloworld/java-server/src/main/assembly/assembly.xml similarity index 96% rename from helloworld/dubbo/java-server/src/main/assembly/assembly.xml rename to helloworld/java-server/src/main/assembly/assembly.xml index 5b4075c..c0aeffd 100644 --- a/helloworld/dubbo/java-server/src/main/assembly/assembly.xml +++ b/helloworld/java-server/src/main/assembly/assembly.xml @@ -1,44 +1,44 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<assembly> - <id>assembly</id> - <formats> - <format>tar.gz</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <fileSets> - <fileSet> - <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory> - <outputDirectory>bin</outputDirectory> - <fileMode>0755</fileMode> - <directoryMode>0755</directoryMode> - </fileSet> - <fileSet> - <directory>src/main/resources</directory> - <includes> - <include>dubbo.properties</include> - <include>log4j.*</include> - </includes> - <outputDirectory>conf</outputDirectory> - <fileMode>0644</fileMode> - <directoryMode>0755</directoryMode> - </fileSet> - </fileSets> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - </dependencySet> - </dependencySets> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<assembly> + <id>assembly</id> + <formats> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + <fileSet> + <directory>src/main/resources</directory> + <includes> + <include>dubbo.properties</include> + <include>log4j.*</include> + </includes> + <outputDirectory>conf</outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + </fileSets> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + </dependencySet> + </dependencySets> </assembly> \ No newline at end of file diff --git a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java b/helloworld/java-server/src/main/java/com/ikurento/user/Provider.java similarity index 100% rename from helloworld/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java rename to helloworld/java-server/src/main/java/com/ikurento/user/Provider.java diff --git a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/User.java b/helloworld/java-server/src/main/java/com/ikurento/user/User.java similarity index 95% rename from helloworld/dubbo/java-server/src/main/java/com/ikurento/user/User.java rename to helloworld/java-server/src/main/java/com/ikurento/user/User.java index fd2cafb..ac046bd 100644 --- a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/User.java +++ b/helloworld/java-server/src/main/java/com/ikurento/user/User.java @@ -1,86 +1,86 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ikurento.user; - -import java.util.Date; -import java.io.Serializable; - -public class User implements Serializable { - - private String id; - - private String name; - - private int age; - - private Date time = new Date(); - - public User() { - } - - public User(String id, String name, int age) { - this.id = id; - this.name = name; - this.age = age; - } - - public User(String id, String name, int age, Date time) { - this.id = id; - this.name = name; - this.age = age; - this.time = time; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public Date getTime() { - return time; - } - - public void setTime(Date time) { - this.time = time; - } - - - - public String toString() { - return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}"; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ikurento.user; + +import java.util.Date; +import java.io.Serializable; + +public class User implements Serializable { + + private String id; + + private String name; + + private int age; + + private Date time = new Date(); + + public User() { + } + + public User(String id, String name, int age) { + this.id = id; + this.name = name; + this.age = age; + } + + public User(String id, String name, int age, Date time) { + this.id = id; + this.name = name; + this.age = age; + this.time = time; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + + + public String toString() { + return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}"; + } +} diff --git a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java b/helloworld/java-server/src/main/java/com/ikurento/user/UserProvider.java similarity index 97% rename from helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java rename to helloworld/java-server/src/main/java/com/ikurento/user/UserProvider.java index b1eeab8..831588d 100644 --- a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java +++ b/helloworld/java-server/src/main/java/com/ikurento/user/UserProvider.java @@ -1,24 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ikurento.user; - -public interface UserProvider { - - User GetUser(String userId); // the first alpha is Upper case to compatible with golang. - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ikurento.user; + +public interface UserProvider { + + User GetUser(String userId); // the first alpha is Upper case to compatible with golang. + +} diff --git a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/helloworld/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java similarity index 97% rename from helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java rename to helloworld/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java index 0d66c43..10dbbc3 100644 --- a/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java +++ b/helloworld/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java @@ -1,30 +1,30 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ikurento.user; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class UserProviderImpl implements UserProvider { - private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log - - public User GetUser(String userId) { - return new User(userId, "zhangsan", 18); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ikurento.user; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UserProviderImpl implements UserProvider { + private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log + + public User GetUser(String userId) { + return new User(userId, "zhangsan", 18); + } + +} diff --git a/helloworld/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/helloworld/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml similarity index 97% rename from helloworld/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml rename to helloworld/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml index 3fca067..7351324 100644 --- a/helloworld/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml +++ b/helloworld/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml @@ -1,33 +1,33 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> - - <!-- 应用名 --> - <dubbo:application name="user-info-server"/> - <!-- 连接到哪个本地注册中心 --> - <dubbo:registry id="ikurento" address="zookeeper://127.0.0.1:2181" /> - <!-- 用dubbo协议在20880端口暴露服务 --> - <!-- dubbo:protocol host="127.0.0.1" / --> - <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" /> - <!-- 声明需要暴露的服务接口 --> - <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/> - - <bean id="demoService" class="com.ikurento.user.UserProviderImpl" /> - -</beans> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> + + <!-- 应用名 --> + <dubbo:application name="user-info-server"/> + <!-- 连接到哪个本地注册中心 --> + <dubbo:registry id="ikurento" address="zookeeper://127.0.0.1:2181" /> + <!-- 用dubbo协议在20880端口暴露服务 --> + <!-- dubbo:protocol host="127.0.0.1" / --> + <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" /> + <!-- 声明需要暴露的服务接口 --> + <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/> + + <bean id="demoService" class="com.ikurento.user.UserProviderImpl" /> + +</beans> diff --git a/helloworld/dubbo/java-server/src/main/resources/dubbo.properties b/helloworld/java-server/src/main/resources/dubbo.properties similarity index 96% rename from helloworld/dubbo/java-server/src/main/resources/dubbo.properties rename to helloworld/java-server/src/main/resources/dubbo.properties index 2826f31..54f8a16 100644 --- a/helloworld/dubbo/java-server/src/main/resources/dubbo.properties +++ b/helloworld/java-server/src/main/resources/dubbo.properties @@ -1,14 +1,14 @@ -### dubbo注册中心配置 ## -dubbo.container = log4j,spring -dubbo.application.name = user-info-server -dubbo.application.environment = product -dubbo.application.owner = AlexStocks -dubbo.registry.address = 127.0.0.1:2181 -dubbo.registry.protocol = zookeeper -dubbo.consumer.timeout = 10000 -dubbo.provider.timeout = 10000 -dubbo.protocol.name = dubbo -dubbo.protocol.port = 10000 - -dubbo.log4j.file = logs/dubbo.log -dubbo.log4j.level = INFO +### dubbo注册中心配置 ## +dubbo.container = log4j,spring +dubbo.application.name = user-info-server +dubbo.application.environment = product +dubbo.application.owner = AlexStocks +dubbo.registry.address = 127.0.0.1:2181 +dubbo.registry.protocol = zookeeper +dubbo.consumer.timeout = 10000 +dubbo.provider.timeout = 10000 +dubbo.protocol.name = dubbo +dubbo.protocol.port = 10000 + +dubbo.log4j.file = logs/dubbo.log +dubbo.log4j.level = INFO diff --git a/helloworld/dubbo/java-server/src/main/resources/log4j.properties b/helloworld/java-server/src/main/resources/log4j.properties similarity index 97% rename from helloworld/dubbo/java-server/src/main/resources/log4j.properties rename to helloworld/java-server/src/main/resources/log4j.properties index 13c8049..806e33d 100644 --- a/helloworld/dubbo/java-server/src/main/resources/log4j.properties +++ b/helloworld/java-server/src/main/resources/log4j.properties @@ -1,20 +1,20 @@ -## Logger configure file for myproject -log.dir=logs/ -datestamp=yyyy-MM-dd/HH:mm:ss.SSS - -log4j.rootLogger=DEBUG, file, console - -log4j.appender.file=org.apache.log4j.DailyRollingFileAppender -log4j.appender.file.threshold=DEBUG -log4j.appender.file.File=${log.dir}/log4j.log -log4j.appender.file.DatePattern=-yyyyMMddHH -log4j.appender.file.ImmediateFlush=true -log4j.appender.file.Append=true -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.Threshold=DEBUG -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n - +## Logger configure file for myproject +log.dir=logs/ +datestamp=yyyy-MM-dd/HH:mm:ss.SSS + +log4j.rootLogger=DEBUG, file, console + +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender +log4j.appender.file.threshold=DEBUG +log4j.appender.file.File=${log.dir}/log4j.log +log4j.appender.file.DatePattern=-yyyyMMddHH +log4j.appender.file.ImmediateFlush=true +log4j.appender.file.Append=true +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.Threshold=DEBUG +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n +