Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nkorange committed Oct 18, 2018
1 parent baa8594 commit 534995a
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 50 deletions.
12 changes: 11 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.1</version>
<version>0.3.0-rc1</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -40,6 +40,16 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
39 changes: 39 additions & 0 deletions common/src/main/java/com/alibaba/nacos/common/util/IoUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
package com.alibaba.nacos.common.util;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;

/**
Expand Down Expand Up @@ -45,5 +48,41 @@ public static byte[] tryDecompress(InputStream raw) throws Exception {
return null;
}

static private BufferedReader toBufferedReader(Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(
reader);
}

public static void writeStringToFile(File file, String data, String encoding)
throws IOException {
OutputStream os = null;
try {
os = new FileOutputStream(file);
os.write(data.getBytes(encoding));
os.flush();
} finally {
if (null != os) {
os.close();
}
}
}

static public List<String> readLines(Reader input) throws IOException {
BufferedReader reader = toBufferedReader(input);
List<String> list = new ArrayList<String>();
String line = null;
for (; ; ) {
line = reader.readLine();
if (null != line) {
if (StringUtils.isNotEmpty(line)) {
list.add(line.trim());
}
} else {
break;
}
}
return list;
}

}

16 changes: 11 additions & 5 deletions config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.1</version>
<version>0.3.0-rc1</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -50,10 +50,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>taglibs</groupId>-->
<!--<artifactId>standard</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
Expand All @@ -65,6 +65,7 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
Expand Down Expand Up @@ -115,6 +116,11 @@
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.1</version>
<version>0.3.0-rc1</version>
</parent>
<artifactId>nacos-console</artifactId>
<!--<packaging>war</packaging>-->
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion naming/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
47 changes: 11 additions & 36 deletions naming/src/main/java/com/alibaba/nacos/naming/web/ApiCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
import com.alibaba.nacos.api.naming.pojo.Service;
import com.alibaba.nacos.common.util.IoUtils;
import com.alibaba.nacos.common.util.Md5Utils;
import com.alibaba.nacos.common.util.SystemUtil;
import com.alibaba.nacos.common.util.SystemUtils;
import com.alibaba.nacos.naming.boot.RunningConfig;
import com.alibaba.nacos.naming.core.*;
import com.alibaba.nacos.naming.exception.NacosException;
import com.alibaba.nacos.naming.healthcheck.*;
import com.alibaba.nacos.naming.healthcheck.AbstractHealthCheckProcessor;
import com.alibaba.nacos.naming.healthcheck.HealthCheckTask;
import com.alibaba.nacos.naming.healthcheck.HealthCheckType;
import com.alibaba.nacos.naming.healthcheck.RsInfo;
import com.alibaba.nacos.naming.misc.*;
import com.alibaba.nacos.naming.push.ClientInfo;
import com.alibaba.nacos.naming.push.DataSource;
Expand All @@ -36,7 +39,6 @@
import com.alibaba.nacos.naming.raft.RaftCore;
import com.alibaba.nacos.naming.raft.RaftPeer;
import com.alibaba.nacos.naming.raft.RaftProxy;
import com.alibaba.nacos.naming.view.ServiceView;
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.Response;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
Expand Down Expand Up @@ -78,7 +80,6 @@ public class ApiCommands {
@Autowired
protected DomainsManager domainsManager;


private DataSource pushDataSource = new DataSource() {

@Override
Expand Down Expand Up @@ -1946,32 +1947,6 @@ public String addCluster4Dom(HttpServletRequest request) throws Exception {
return doAddCluster4Dom(request);
}

/**
* This API returns dom names only. you should use API: dom to retrieve dom details
*/
@RequestMapping("/domList")
public JSONObject domList(HttpServletRequest request) {

JSONObject result = new JSONObject();

int page = Integer.parseInt(BaseServlet.required(request, "startPg"));
int pageSize = Integer.parseInt(BaseServlet.required(request, "pgSize"));

List<Domain> doms = domainsManager.getPagedDom(page, pageSize);
if (CollectionUtils.isEmpty(doms)) {
result.put("domList", Collections.emptyList());
return result;
}

JSONArray domArray = new JSONArray();
for (Domain dom : doms) {
domArray.add(dom.getName());
}

result.put("domList", domArray);

return result;
}

@RequestMapping("/distroStatus")
public JSONObject distroStatus(HttpServletRequest request) {
Expand Down Expand Up @@ -2007,9 +1982,9 @@ public JSONObject metrics(HttpServletRequest request) {
result.put("ipCount", ipCount);
result.put("responsibleDomCount", responsibleDomCount);
result.put("responsibleIPCount", responsibleIPCount);
result.put("cpu", SystemUtil.getCPU());
result.put("load", SystemUtil.getLoad());
result.put("mem", SystemUtil.getMem());
result.put("cpu", SystemUtils.getCPU());
result.put("load", SystemUtils.getLoad());
result.put("mem", SystemUtils.getMem());

return result;
}
Expand Down Expand Up @@ -2037,7 +2012,7 @@ public JSONObject updateClusterConf(HttpServletRequest request) throws IOExcepti
}

Loggers.SRV_LOG.info("[UPDATE-CLUSTER] new ips:" + sb.toString());
IoUtils.writeStringToFile(new File(UtilsAndCommons.getConfFile()), sb.toString(), "utf-8");
IoUtils.writeStringToFile(UtilsAndCommons.getConfFile(), sb.toString(), "utf-8");
return result;
}

Expand All @@ -2048,7 +2023,7 @@ public JSONObject updateClusterConf(HttpServletRequest request) throws IOExcepti
sb.append(ip).append("\r\n");
}
Loggers.SRV_LOG.info("[UPDATE-CLUSTER] new ips:" + sb.toString());
IoUtils.writeStringToFile(new File(UtilsAndCommons.getConfFile()), sb.toString(), "utf-8");
IoUtils.writeStringToFile(UtilsAndCommons.getConfFile(), sb.toString(), "utf-8");
return result;
}

Expand Down Expand Up @@ -2077,7 +2052,7 @@ public JSONObject updateClusterConf(HttpServletRequest request) throws IOExcepti
sb.append(ip).append("\r\n");
}

IoUtils.writeStringToFile(new File(UtilsAndCommons.getConfFile()), sb.toString(), "utf-8");
IoUtils.writeStringToFile(UtilsAndCommons.getConfFile(), sb.toString(), "utf-8");

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<inceptionYear>2018</inceptionYear>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<packaging>pom</packaging>

<name>Alibaba NACOS ${project.version}</name>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.3.0-rc1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down

0 comments on commit 534995a

Please sign in to comment.