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 aeb1750 remove useless java dirs aeb1750 is described below commit aeb17507b3df74c47a691943bb471a7350680d74 Author: Ian Luo <ian....@gmail.com> AuthorDate: Fri Oct 30 11:44:20 2020 +0800 remove useless java dirs --- configcenter/apollo/java-client/build.sh | 21 -- configcenter/apollo/java-client/pom.xml | 211 ----------------- .../java-client/src/main/assembly/assembly.xml | 43 ---- .../src/main/java/com/ikurento/user/Consumer.java | 61 ----- .../java/com/ikurento/user/EmbeddedZooKeeper.java | 250 --------------------- .../src/main/java/com/ikurento/user/User.java | 76 ------- .../main/java/com/ikurento/user/UserProvider.java | 18 -- .../src/main/java/com/ikurento/user/ZKTools.java | 88 -------- .../src/main/resources/META-INF/app.properties | 1 - .../resources/META-INF/spring/dubbo.consumer.xml | 34 --- .../src/main/resources/META-INF/spring/service.xml | 27 --- .../src/main/resources/log4j.properties | 19 -- configcenter/apollo/java-server/build.sh | 20 -- configcenter/apollo/java-server/pom.xml | 216 ------------------ configcenter/apollo/java-server/script/debug.sh | 23 -- .../java-server/src/main/assembly/assembly.xml | 43 ---- .../java/com/ikurento/user/EmbeddedZooKeeper.java | 250 --------------------- .../src/main/java/com/ikurento/user/Provider.java | 40 ---- .../src/main/java/com/ikurento/user/User.java | 86 ------- .../main/java/com/ikurento/user/UserProvider.java | 24 -- .../src/main/java/com/ikurento/user/ZKTools.java | 89 -------- .../com/ikurento/user/impl/UserProviderImpl.java | 32 --- .../src/main/resources/META-INF/app.properties | 1 - .../resources/META-INF/spring/dubbo.provider.xml | 32 --- .../src/main/resources/log4j.properties | 20 -- 25 files changed, 1725 deletions(-) diff --git a/configcenter/apollo/java-client/build.sh b/configcenter/apollo/java-client/build.sh deleted file mode 100644 index c869acf..0000000 --- a/configcenter/apollo/java-client/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -# rm src/main/resources/META-INF/spring/dubbo.consumer.xml -# cp src/main/resources/META-INF/spring/dubbo-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml -# cp src/main/resources/META-INF/spring/jsonrpc-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml -mvn clean package -Dmaven.test.skip diff --git a/configcenter/apollo/java-client/pom.xml b/configcenter/apollo/java-client/pom.xml deleted file mode 100644 index ce2d151..0000000 --- a/configcenter/apollo/java-client/pom.xml +++ /dev/null @@ -1,211 +0,0 @@ -<?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> - <source.level>1.8</source.level> - <target.level>1.8</target.level> - <dubbo.version>2.7.3</dubbo.version> - <spring.version>4.3.16.RELEASE</spring.version> - <junit.version>4.12</junit.version> - <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version> - <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version> - <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> - <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version> - <image.name>${artifactId}:${dubbo.version}</image.name> - <java-image.name>openjdk:8</java-image.name> - <dubbo.port>20880</dubbo.port> - <zookeeper.port>2181</zookeeper.port> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo</artifactId> - <version>${dubbo.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-dependencies-zookeeper</artifactId> - <version>${dubbo.version}</version> - <type>pom</type> - </dependency> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-configcenter-apollo</artifactId> - <version>${dubbo.version}</version> - <type>pom</type> - </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.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>dubbo-integration-test</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-maven-address-plugin</artifactId> - <version>1.0-SNAPSHOT</version> - <executions> - <execution> - <goals> - <goal>local-address</goal> - </goals> - <configuration> - <localAddress>dubbo-local-address</localAddress> - </configuration> - <phase>initialize</phase> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>com.google.cloud.tools</groupId> - <artifactId>jib-maven-plugin</artifactId> - <version>${jib-maven-plugin.version}</version> - <configuration> - <from> - <image>${java-image.name}</image> - </from> - <to> - <image>${image.name}</image> - </to> - <container> - <mainClass>${main-class}</mainClass> - <ports> - <port>${dubbo.port}</port> - <port>${zookeeper.port}</port> - </ports> - <environment> - <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY> - </environment> - <jvmFlags> - <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag> - </jvmFlags> - </container> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>dockerBuild</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>${docker-maven-plugin.version}</version> - <configuration> - <images> - <image> - <name>${image.name}</name> - <run> - <ports> - <port>${dubbo.port}:${dubbo.port}</port> - <port>${zookeeper.port}:${zookeeper.port}</port> - </ports> - <wait> - <log>dubbo service started</log> - </wait> - </run> - </image> - </images> - </configuration> - <executions> - <execution> - <id>start</id> - <phase>pre-integration-test</phase> - <goals> - <goal>start</goal> - </goals> - </execution> - <execution> - <id>stop</id> - <phase>post-integration-test</phase> - <goals> - <goal>stop</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>${maven-failsafe-plugin.version}</version> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - <configuration> - <systemPropertyVariables> - <zookeeper.address>${dubbo-local-address}</zookeeper.address> - </systemPropertyVariables> - <includes> - <include>**/*IT.java</include> - </includes> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>${maven-compiler-plugin.version}</version> - <configuration> - <source>${source.level}</source> - <target>${target.level}</target> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/configcenter/apollo/java-client/src/main/assembly/assembly.xml b/configcenter/apollo/java-client/src/main/assembly/assembly.xml deleted file mode 100644 index 84f5499..0000000 --- a/configcenter/apollo/java-client/src/main/assembly/assembly.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?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/configcenter/apollo/java-client/src/main/java/com/ikurento/user/Consumer.java b/configcenter/apollo/java-client/src/main/java/com/ikurento/user/Consumer.java deleted file mode 100644 index 7714e03..0000000 --- a/configcenter/apollo/java-client/src/main/java/com/ikurento/user/Consumer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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) throws Exception { - new EmbeddedZooKeeper(2181, false).start(); - 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/configcenter/apollo/java-client/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java b/configcenter/apollo/java-client/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java deleted file mode 100644 index fb99a0d..0000000 --- a/configcenter/apollo/java-client/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright 2014 the original author or authors. - * - * 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; - -import org.apache.zookeeper.server.ServerConfig; -import org.apache.zookeeper.server.ZooKeeperServerMain; -import org.apache.zookeeper.server.quorum.QuorumPeerConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.SmartLifecycle; -import org.springframework.util.ErrorHandler; -import org.springframework.util.SocketUtils; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.Properties; -import java.util.UUID; - -/** - * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java - * <p> - * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper. - * <p> - * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for - * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication} - * - * @author Patrick Peralta - * @author Mark Fisher - * @author David Turanski - */ -public class EmbeddedZooKeeper implements SmartLifecycle { - - /** - * Logger. - */ - private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class); - - /** - * ZooKeeper client port. This will be determined dynamically upon startup. - */ - private final int clientPort; - - /** - * Whether to auto-start. Default is true. - */ - private boolean autoStartup = true; - - /** - * Lifecycle phase. Default is 0. - */ - private int phase = 0; - - /** - * Thread for running the ZooKeeper server. - */ - private volatile Thread zkServerThread; - - /** - * ZooKeeper server. - */ - private volatile ZooKeeperServerMain zkServer; - - /** - * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. - */ - private ErrorHandler errorHandler; - - private boolean daemon = true; - - /** - * Construct an EmbeddedZooKeeper with a random port. - */ - public EmbeddedZooKeeper() { - clientPort = SocketUtils.findAvailableTcpPort(); - } - - /** - * Construct an EmbeddedZooKeeper with the provided port. - * - * @param clientPort port for ZooKeeper server to bind to - */ - public EmbeddedZooKeeper(int clientPort, boolean daemon) { - this.clientPort = clientPort; - this.daemon = daemon; - } - - /** - * Returns the port that clients should use to connect to this embedded server. - * - * @return dynamically determined client port - */ - public int getClientPort() { - return this.clientPort; - } - - /** - * Specify whether to start automatically. Default is true. - * - * @param autoStartup whether to start automatically - */ - public void setAutoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAutoStartup() { - return this.autoStartup; - } - - /** - * Specify the lifecycle phase for the embedded server. - * - * @param phase the lifecycle phase - */ - public void setPhase(int phase) { - this.phase = phase; - } - - /** - * {@inheritDoc} - */ - @Override - public int getPhase() { - return this.phase; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isRunning() { - return (zkServerThread != null); - } - - /** - * Start the ZooKeeper server in a background thread. - * <p> - * Register an error handler via {@link #setErrorHandler} in order to handle - * any exceptions thrown during startup or execution. - */ - @Override - public synchronized void start() { - if (zkServerThread == null) { - zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter"); - zkServerThread.setDaemon(daemon); - zkServerThread.start(); - } - } - - /** - * Shutdown the ZooKeeper server. - */ - @Override - public synchronized void stop() { - if (zkServerThread != null) { - // The shutdown method is protected...thus this hack to invoke it. - // This will log an exception on shutdown; see - // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details. - try { - Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown"); - shutdown.setAccessible(true); - shutdown.invoke(zkServer); - } catch (Exception e) { - throw new RuntimeException(e); - } - - // It is expected that the thread will exit after - // the server is shutdown; this will block until - // the shutdown is complete. - try { - zkServerThread.join(5000); - zkServerThread = null; - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - logger.warn("Interrupted while waiting for embedded ZooKeeper to exit"); - // abandoning zk thread - zkServerThread = null; - } - } - } - - /** - * Stop the server if running and invoke the callback when complete. - */ - @Override - public void stop(Runnable callback) { - stop(); - callback.run(); - } - - /** - * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none - * is provided, only error-level logging will occur. - * - * @param errorHandler the {@link ErrorHandler} to be invoked - */ - public void setErrorHandler(ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Runnable implementation that starts the ZooKeeper server. - */ - private class ServerRunnable implements Runnable { - - @Override - public void run() { - try { - Properties properties = new Properties(); - File file = new File(System.getProperty("java.io.tmpdir") - + File.separator + UUID.randomUUID()); - file.deleteOnExit(); - properties.setProperty("dataDir", file.getAbsolutePath()); - properties.setProperty("clientPort", String.valueOf(clientPort)); - - QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); - quorumPeerConfig.parseProperties(properties); - - zkServer = new ZooKeeperServerMain(); - ServerConfig configuration = new ServerConfig(); - configuration.readFrom(quorumPeerConfig); - - zkServer.runFromConfig(configuration); - } catch (Exception e) { - if (errorHandler != null) { - errorHandler.handleError(e); - } else { - logger.error("Exception running embedded ZooKeeper", e); - } - } - } - } - -} \ No newline at end of file diff --git a/configcenter/apollo/java-client/src/main/java/com/ikurento/user/User.java b/configcenter/apollo/java-client/src/main/java/com/ikurento/user/User.java deleted file mode 100644 index 1526244..0000000 --- a/configcenter/apollo/java-client/src/main/java/com/ikurento/user/User.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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/configcenter/apollo/java-client/src/main/java/com/ikurento/user/UserProvider.java b/configcenter/apollo/java-client/src/main/java/com/ikurento/user/UserProvider.java deleted file mode 100644 index f42452d..0000000 --- a/configcenter/apollo/java-client/src/main/java/com/ikurento/user/UserProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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/configcenter/apollo/java-client/src/main/java/com/ikurento/user/ZKTools.java b/configcenter/apollo/java-client/src/main/java/com/ikurento/user/ZKTools.java deleted file mode 100644 index 65059ec..0000000 --- a/configcenter/apollo/java-client/src/main/java/com/ikurento/user/ZKTools.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.apache.curator.framework.CuratorFramework; -import org.apache.curator.framework.CuratorFrameworkFactory; -import org.apache.curator.retry.ExponentialBackoffRetry; - -public class ZKTools { - private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1"); - private static CuratorFramework client; - - public static void main(String[] args) throws Exception { - generateDubboProperties(); - } - - public static void generateDubboProperties() { - client = CuratorFrameworkFactory.newClient(zookeeperHost + ":2181", 60 * 1000, 60 * 1000, - new ExponentialBackoffRetry(1000, 3)); - client.start(); - - generateDubboPropertiesForGlobal(); - generateDubboPropertiesForConsumer(); - } - - public static void generateDubboPropertiesForGlobal() { - String str = "dubbo.registry.address=zookeeper://" + zookeeperHost + ":2181\n" + -// "dubbo.metadata-report.address=zookeeper://" + zookeeperHost + ":2181\n" + - "dubbo.protocol.port=-1\n" + -// "dubbo.registry.simplified=true\n"+ - ""; - - System.out.println(str); - - try { - String path = "/dubbo/config/dubbo/dubbo.properties"; - if (client.checkExists().forPath(path) == null) { - client.create().creatingParentsIfNeeded().forPath(path); - } - setData(path, str); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void generateDubboPropertiesForConsumer() { - String str = "dubbo.consumer.timeout=6666\n" + - "dubbo.reference.com.ikurento.user.UserProvider.cluster=failback"; - - System.out.println(str); - - try { - String path = "/dubbo/config/user-info-client/dubbo.properties"; - if (client.checkExists().forPath(path) == null) { - client.create().creatingParentsIfNeeded().forPath(path); - } - setData(path, str); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static void createNode(String path) throws Exception { - client.create().forPath(path); - } - - private static void deleteNode(String path) throws Exception { - client.delete().forPath(path); - } - - private static void setData(String path, String data) throws Exception { - client.setData().forPath(path, data.getBytes()); - } -} diff --git a/configcenter/apollo/java-client/src/main/resources/META-INF/app.properties b/configcenter/apollo/java-client/src/main/resources/META-INF/app.properties deleted file mode 100644 index 4a02235..0000000 --- a/configcenter/apollo/java-client/src/main/resources/META-INF/app.properties +++ /dev/null @@ -1 +0,0 @@ -app.id=testApplication_yang \ No newline at end of file diff --git a/configcenter/apollo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/configcenter/apollo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml deleted file mode 100644 index 6918924..0000000 --- a/configcenter/apollo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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-client" /> - <dubbo:config-center protocol="apollo" address="127.0.0.1:8080"/> - - <!-- 用dubbo协议在20880端口暴露服务 --> - <dubbo:protocol id="dubbo" name="dubbo" /> - <dubbo:protocol id="jsonrpc" name="jsonrpc" /> - - <!-- 声明需要使用的服务接口 --> - <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="com.ikurento.user.UserProvider"> - <!--<dubbo:parameter key="heartbeat" value="10000"/ --> - </dubbo:reference> -</beans> diff --git a/configcenter/apollo/java-client/src/main/resources/META-INF/spring/service.xml b/configcenter/apollo/java-client/src/main/resources/META-INF/spring/service.xml deleted file mode 100644 index e4f5fda..0000000 --- a/configcenter/apollo/java-client/src/main/resources/META-INF/spring/service.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?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/configcenter/apollo/java-client/src/main/resources/log4j.properties b/configcenter/apollo/java-client/src/main/resources/log4j.properties deleted file mode 100644 index 06bcb34..0000000 --- a/configcenter/apollo/java-client/src/main/resources/log4j.properties +++ /dev/null @@ -1,19 +0,0 @@ -## 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 diff --git a/configcenter/apollo/java-server/build.sh b/configcenter/apollo/java-server/build.sh deleted file mode 100644 index 7b5755b..0000000 --- a/configcenter/apollo/java-server/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -# mvn dependency:sources -mvn clean package -Dmaven.test.skip -# mvn -X clean compile package -DskipTests=true diff --git a/configcenter/apollo/java-server/pom.xml b/configcenter/apollo/java-server/pom.xml deleted file mode 100644 index 32a14f1..0000000 --- a/configcenter/apollo/java-server/pom.xml +++ /dev/null @@ -1,216 +0,0 @@ -<?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="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>com.ikurento</groupId> - <artifactId>user-info-server</artifactId> - <packaging>jar</packaging> - <version>0.2.0</version> - <description>The demo provider module of dubbo project</description> - <properties> - <source.level>1.8</source.level> - <target.level>1.8</target.level> - <dubbo.version>2.7.3</dubbo.version> - <spring.version>4.3.16.RELEASE</spring.version> - <junit.version>4.12</junit.version> - <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version> - <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version> - <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> - <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version> - <image.name>${artifactId}:${dubbo.version}</image.name> - <java-image.name>openjdk:8</java-image.name> - <dubbo.port>20880</dubbo.port> - <zookeeper.port>2181</zookeeper.port> - <main-class>org.apache.dubbo.samples.configcenter.BasicProvider</main-class> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo</artifactId> - <version>${dubbo.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-dependencies-zookeeper</artifactId> - <version>${dubbo.version}</version> - <type>pom</type> - </dependency> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-configcenter-apollo</artifactId> - <version>${dubbo.version}</version> - <type>pom</type> - </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.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>dubbo-integration-test</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-maven-address-plugin</artifactId> - <version>1.0-SNAPSHOT</version> - <executions> - <execution> - <goals> - <goal>local-address</goal> - </goals> - <configuration> - <localAddress>dubbo-local-address</localAddress> - </configuration> - <phase>initialize</phase> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>com.google.cloud.tools</groupId> - <artifactId>jib-maven-plugin</artifactId> - <version>${jib-maven-plugin.version}</version> - <configuration> - <from> - <image>${java-image.name}</image> - </from> - <to> - <image>${image.name}</image> - </to> - <container> - <mainClass>${main-class}</mainClass> - <ports> - <port>${dubbo.port}</port> - <port>${zookeeper.port}</port> - </ports> - <environment> - <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY> - </environment> - <jvmFlags> - <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag> - </jvmFlags> - </container> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>dockerBuild</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>${docker-maven-plugin.version}</version> - <configuration> - <images> - <image> - <name>${image.name}</name> - <run> - <ports> - <port>${dubbo.port}:${dubbo.port}</port> - <port>${zookeeper.port}:${zookeeper.port}</port> - </ports> - <wait> - <log>dubbo service started</log> - </wait> - </run> - </image> - </images> - </configuration> - <executions> - <execution> - <id>start</id> - <phase>pre-integration-test</phase> - <goals> - <goal>start</goal> - </goals> - </execution> - <execution> - <id>stop</id> - <phase>post-integration-test</phase> - <goals> - <goal>stop</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>${maven-failsafe-plugin.version}</version> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - <configuration> - <systemPropertyVariables> - <zookeeper.address>${dubbo-local-address}</zookeeper.address> - </systemPropertyVariables> - <includes> - <include>**/*IT.java</include> - </includes> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>${maven-compiler-plugin.version}</version> - <configuration> - <source>${source.level}</source> - <target>${target.level}</target> - </configuration> - </plugin> - </plugins> - </build> - -</project> - - diff --git a/configcenter/apollo/java-server/script/debug.sh b/configcenter/apollo/java-server/script/debug.sh deleted file mode 100644 index 851957a..0000000 --- a/configcenter/apollo/java-server/script/debug.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - - -# jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/*:/Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/ com.alibaba.dubbo.container.Main -jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/* -sourcepath /Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/:/Users/alex/tmp/java-server/src/main/java com.alibaba.dubbo.container.Main -# jdb stop at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec:76 -# run - diff --git a/configcenter/apollo/java-server/src/main/assembly/assembly.xml b/configcenter/apollo/java-server/src/main/assembly/assembly.xml deleted file mode 100644 index ce8e7e7..0000000 --- a/configcenter/apollo/java-server/src/main/assembly/assembly.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?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>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/configcenter/apollo/java-server/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java b/configcenter/apollo/java-server/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java deleted file mode 100644 index fb99a0d..0000000 --- a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright 2014 the original author or authors. - * - * 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; - -import org.apache.zookeeper.server.ServerConfig; -import org.apache.zookeeper.server.ZooKeeperServerMain; -import org.apache.zookeeper.server.quorum.QuorumPeerConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.SmartLifecycle; -import org.springframework.util.ErrorHandler; -import org.springframework.util.SocketUtils; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.Properties; -import java.util.UUID; - -/** - * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java - * <p> - * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper. - * <p> - * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for - * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication} - * - * @author Patrick Peralta - * @author Mark Fisher - * @author David Turanski - */ -public class EmbeddedZooKeeper implements SmartLifecycle { - - /** - * Logger. - */ - private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class); - - /** - * ZooKeeper client port. This will be determined dynamically upon startup. - */ - private final int clientPort; - - /** - * Whether to auto-start. Default is true. - */ - private boolean autoStartup = true; - - /** - * Lifecycle phase. Default is 0. - */ - private int phase = 0; - - /** - * Thread for running the ZooKeeper server. - */ - private volatile Thread zkServerThread; - - /** - * ZooKeeper server. - */ - private volatile ZooKeeperServerMain zkServer; - - /** - * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. - */ - private ErrorHandler errorHandler; - - private boolean daemon = true; - - /** - * Construct an EmbeddedZooKeeper with a random port. - */ - public EmbeddedZooKeeper() { - clientPort = SocketUtils.findAvailableTcpPort(); - } - - /** - * Construct an EmbeddedZooKeeper with the provided port. - * - * @param clientPort port for ZooKeeper server to bind to - */ - public EmbeddedZooKeeper(int clientPort, boolean daemon) { - this.clientPort = clientPort; - this.daemon = daemon; - } - - /** - * Returns the port that clients should use to connect to this embedded server. - * - * @return dynamically determined client port - */ - public int getClientPort() { - return this.clientPort; - } - - /** - * Specify whether to start automatically. Default is true. - * - * @param autoStartup whether to start automatically - */ - public void setAutoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAutoStartup() { - return this.autoStartup; - } - - /** - * Specify the lifecycle phase for the embedded server. - * - * @param phase the lifecycle phase - */ - public void setPhase(int phase) { - this.phase = phase; - } - - /** - * {@inheritDoc} - */ - @Override - public int getPhase() { - return this.phase; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isRunning() { - return (zkServerThread != null); - } - - /** - * Start the ZooKeeper server in a background thread. - * <p> - * Register an error handler via {@link #setErrorHandler} in order to handle - * any exceptions thrown during startup or execution. - */ - @Override - public synchronized void start() { - if (zkServerThread == null) { - zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter"); - zkServerThread.setDaemon(daemon); - zkServerThread.start(); - } - } - - /** - * Shutdown the ZooKeeper server. - */ - @Override - public synchronized void stop() { - if (zkServerThread != null) { - // The shutdown method is protected...thus this hack to invoke it. - // This will log an exception on shutdown; see - // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details. - try { - Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown"); - shutdown.setAccessible(true); - shutdown.invoke(zkServer); - } catch (Exception e) { - throw new RuntimeException(e); - } - - // It is expected that the thread will exit after - // the server is shutdown; this will block until - // the shutdown is complete. - try { - zkServerThread.join(5000); - zkServerThread = null; - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - logger.warn("Interrupted while waiting for embedded ZooKeeper to exit"); - // abandoning zk thread - zkServerThread = null; - } - } - } - - /** - * Stop the server if running and invoke the callback when complete. - */ - @Override - public void stop(Runnable callback) { - stop(); - callback.run(); - } - - /** - * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none - * is provided, only error-level logging will occur. - * - * @param errorHandler the {@link ErrorHandler} to be invoked - */ - public void setErrorHandler(ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Runnable implementation that starts the ZooKeeper server. - */ - private class ServerRunnable implements Runnable { - - @Override - public void run() { - try { - Properties properties = new Properties(); - File file = new File(System.getProperty("java.io.tmpdir") - + File.separator + UUID.randomUUID()); - file.deleteOnExit(); - properties.setProperty("dataDir", file.getAbsolutePath()); - properties.setProperty("clientPort", String.valueOf(clientPort)); - - QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); - quorumPeerConfig.parseProperties(properties); - - zkServer = new ZooKeeperServerMain(); - ServerConfig configuration = new ServerConfig(); - configuration.readFrom(quorumPeerConfig); - - zkServer.runFromConfig(configuration); - } catch (Exception e) { - if (errorHandler != null) { - errorHandler.handleError(e); - } else { - logger.error("Exception running embedded ZooKeeper", e); - } - } - } - } - -} \ No newline at end of file diff --git a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/Provider.java b/configcenter/apollo/java-server/src/main/java/com/ikurento/user/Provider.java deleted file mode 100644 index 12845fb..0000000 --- a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/Provider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.springframework.context.support.ClassPathXmlApplicationContext; - -import java.util.concurrent.CountDownLatch; - -public class Provider { - - /** - * To get ipv6 address to work, add - * System.setProperty("java.net.preferIPv6Addresses", "true"); - * before running your application. - */ - public static void main(String[] args) throws Exception { - new EmbeddedZooKeeper(2181, false).start(); - - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.provider.xml"); - context.registerShutdownHook(); - context.start(); - - System.out.println("dubbo service started"); - new CountDownLatch(1).await(); - } -} diff --git a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/User.java b/configcenter/apollo/java-server/src/main/java/com/ikurento/user/User.java deleted file mode 100644 index ac046bd..0000000 --- a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/User.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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/configcenter/apollo/java-server/src/main/java/com/ikurento/user/UserProvider.java b/configcenter/apollo/java-server/src/main/java/com/ikurento/user/UserProvider.java deleted file mode 100644 index 831588d..0000000 --- a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/UserProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/configcenter/apollo/java-server/src/main/java/com/ikurento/user/ZKTools.java b/configcenter/apollo/java-server/src/main/java/com/ikurento/user/ZKTools.java deleted file mode 100644 index 6ed90de..0000000 --- a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/ZKTools.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.apache.curator.framework.CuratorFramework; -import org.apache.curator.framework.CuratorFrameworkFactory; -import org.apache.curator.retry.ExponentialBackoffRetry; - -public class ZKTools { - private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1"); - private static CuratorFramework client; - - public static void main(String[] args) throws Exception { - generateDubboProperties(); - } - - public static void generateDubboProperties() { - client = CuratorFrameworkFactory.newClient(zookeeperHost + ":2181", 60 * 1000, 60 * 1000, - new ExponentialBackoffRetry(1000, 3)); - client.start(); - - generateDubboPropertiesForGlobal(); - generateDubboPropertiesForApp(); - } - - public static void generateDubboPropertiesForGlobal() { - String str = "dubbo.registry.address=zookeeper://" + zookeeperHost + ":2181\n" + -// "dubbo.metadata-report.address=zookeeper://" + zookeeperHost + ":2181\n" + - "dubbo.protocol.port=-1\n" + -// "dubbo.registry.simplified=true\n"+ - ""; - - System.out.println(str); - - try { - String path = "/dubbo/config/dubbo/dubbo.properties"; - if (client.checkExists().forPath(path) == null) { - client.create().creatingParentsIfNeeded().forPath(path); - } - setData(path, str); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void generateDubboPropertiesForApp() { - String str = "dubbo.provider.timeout=6666\n" + - "dubbo.application.qos.port=33333\n" + - "dubbo.service.com.ikurento.user.UserProvider.cluster=failback"; - - System.out.println(str); - - try { - String path = "/dubbo/config/user-info-server/dubbo.properties"; - if (client.checkExists().forPath(path) == null) { - client.create().creatingParentsIfNeeded().forPath(path); - } - setData(path, str); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static void createNode(String path) throws Exception { - client.create().forPath(path); - } - - private static void deleteNode(String path) throws Exception { - client.delete().forPath(path); - } - - private static void setData(String path, String data) throws Exception { - client.setData().forPath(path, data.getBytes()); - } -} diff --git a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/impl/UserProviderImpl.java b/configcenter/apollo/java-server/src/main/java/com/ikurento/user/impl/UserProviderImpl.java deleted file mode 100644 index 0caf910..0000000 --- a/configcenter/apollo/java-server/src/main/java/com/ikurento/user/impl/UserProviderImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.impl; - -import com.ikurento.user.User; -import com.ikurento.user.UserProvider; -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/configcenter/apollo/java-server/src/main/resources/META-INF/app.properties b/configcenter/apollo/java-server/src/main/resources/META-INF/app.properties deleted file mode 100644 index 4a02235..0000000 --- a/configcenter/apollo/java-server/src/main/resources/META-INF/app.properties +++ /dev/null @@ -1 +0,0 @@ -app.id=testApplication_yang \ No newline at end of file diff --git a/configcenter/apollo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/configcenter/apollo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml deleted file mode 100644 index 9e1847e..0000000 --- a/configcenter/apollo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:dubbo="http://dubbo.apache.org/schema/dubbo" - xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd - http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> - - <context:property-placeholder/> - <!-- 应用名 --> - <dubbo:application name="user-info-server"/> - <dubbo:config-center protocol="apollo" address="127.0.0.1:8080"/> - - <bean id="demoService" class="com.ikurento.user.impl.UserProviderImpl"/><!-- 声明需要暴露的服务接口 --> - <dubbo:service id="UserProvider1" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" - ref="demoService"/> - <dubbo:service id="UserProvider2" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" - ref="demoService"/> -</beans> diff --git a/configcenter/apollo/java-server/src/main/resources/log4j.properties b/configcenter/apollo/java-server/src/main/resources/log4j.properties deleted file mode 100644 index 806e33d..0000000 --- a/configcenter/apollo/java-server/src/main/resources/log4j.properties +++ /dev/null @@ -1,20 +0,0 @@ -## 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 -