[motify info] Api split
This commit is contained in:
parent
3be712c28e
commit
8719aea7c7
107
api/pom.xml
Normal file
107
api/pom.xml
Normal file
@ -0,0 +1,107 @@
|
||||
<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">
|
||||
<parent>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-all</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nacos-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>nacos-api ${project.version}</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>nacos-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-lgpl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.jcip</groupId>
|
||||
<artifactId>jcip-annotations</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-annotations</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -20,8 +20,8 @@ import java.util.Properties;
|
||||
import com.alibaba.nacos.api.config.ConfigFactory;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.alibaba.nacos.api.naming.NamingFactory;
|
||||
import com.alibaba.nacos.api.naming.NamingService;
|
||||
//import com.alibaba.nacos.api.naming.NamingFactory;
|
||||
//import com.alibaba.nacos.api.naming.NamingService;
|
||||
|
||||
/**
|
||||
* Nacos Factory
|
||||
@ -57,30 +57,30 @@ public class NacosFactory {
|
||||
return ConfigFactory.createConfigService(serverAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Naming
|
||||
*
|
||||
* @param serverAddr
|
||||
* server list
|
||||
* @return Naming
|
||||
* @throws NacosException
|
||||
* Exception
|
||||
*/
|
||||
public static NamingService createNamingService(String serverAddr) throws NacosException {
|
||||
return NamingFactory.createNamingService(serverAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Naming
|
||||
*
|
||||
* @param properties
|
||||
* init param
|
||||
* @return Naming
|
||||
* @throws NacosException
|
||||
* Exception
|
||||
*/
|
||||
public static NamingService createNamingService(Properties properties) throws NacosException {
|
||||
return NamingFactory.createNamingService(properties);
|
||||
}
|
||||
// /**
|
||||
// * Create Naming
|
||||
// *
|
||||
// * @param serverAddr
|
||||
// * server list
|
||||
// * @return Naming
|
||||
// * @throws NacosException
|
||||
// * Exception
|
||||
// */
|
||||
// public static NamingService createNamingService(String serverAddr) throws NacosException {
|
||||
// return NamingFactory.createNamingService(serverAddr);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Create Naming
|
||||
// *
|
||||
// * @param properties
|
||||
// * init param
|
||||
// * @return Naming
|
||||
// * @throws NacosException
|
||||
// * Exception
|
||||
// */
|
||||
// public static NamingService createNamingService(Properties properties) throws NacosException {
|
||||
// return NamingFactory.createNamingService(properties);
|
||||
// }
|
||||
|
||||
}
|
@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.alibaba.nacos.api.config;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.nacos.api.PropertyKeyConst;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.alibaba.nacos.client.config.NacosConfigService;
|
||||
|
||||
/**
|
||||
* Config Factory
|
||||
@ -39,7 +39,14 @@ public class ConfigFactory {
|
||||
* Exception
|
||||
*/
|
||||
public static ConfigService createConfigService(Properties properties) throws NacosException {
|
||||
return new NacosConfigService(properties);
|
||||
try {
|
||||
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
|
||||
Constructor constructor = driverImplClass.getConstructor(Properties.class);
|
||||
ConfigService vendorImpl = (ConfigService) constructor.newInstance(properties);
|
||||
return vendorImpl;
|
||||
} catch (Throwable e) {
|
||||
throw new NacosException(-400, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,7 +61,14 @@ public class ConfigFactory {
|
||||
public static ConfigService createConfigService(String serverAddr) throws NacosException {
|
||||
Properties properties = new Properties();
|
||||
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);
|
||||
return new NacosConfigService(properties);
|
||||
try {
|
||||
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
|
||||
Constructor constructor = driverImplClass.getConstructor(Properties.class);
|
||||
ConfigService vendorImpl = (ConfigService) constructor.newInstance(properties);
|
||||
return vendorImpl;
|
||||
} catch (Throwable e) {
|
||||
throw new NacosException(-400, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* 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.alibaba.nacos.api.naming;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
|
||||
/**
|
||||
* @author dungu.zpf
|
||||
*/
|
||||
public class NamingFactory {
|
||||
|
||||
public static NamingService createNamingService(String serverList) throws NacosException {
|
||||
try {
|
||||
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.naming.NacosNamingService");
|
||||
Constructor constructor = driverImplClass.getConstructor(String.class);
|
||||
NamingService vendorImpl = (NamingService) constructor.newInstance(serverList);
|
||||
return vendorImpl;
|
||||
} catch (Throwable e) {
|
||||
throw new NacosException(-400, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static NamingService createNamingService(Properties properties) throws NacosException {
|
||||
try {
|
||||
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.naming.NacosNamingService");
|
||||
Constructor constructor = driverImplClass.getConstructor(Properties.class);
|
||||
NamingService vendorImpl = (NamingService) constructor.newInstance(properties);
|
||||
return vendorImpl;
|
||||
} catch (Throwable e) {
|
||||
throw new NacosException(-400, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.alibaba.nacos.api.naming.pojo;
|
||||
|
||||
import com.alibaba.nacos.client.naming.utils.StringUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -37,8 +35,8 @@ public abstract class AbstractHealthChecker implements Cloneable {
|
||||
public static class Http extends AbstractHealthChecker {
|
||||
public static final String TYPE = "HTTP";
|
||||
|
||||
private String path = StringUtils.EMPTY;
|
||||
private String headers = StringUtils.EMPTY;
|
||||
private String path = "";
|
||||
private String headers = "";
|
||||
|
||||
private int expectedResponseCode = 200;
|
||||
|
||||
@ -83,14 +81,14 @@ public abstract class AbstractHealthChecker implements Cloneable {
|
||||
|
||||
Http other = (Http) obj;
|
||||
|
||||
if (!StringUtils.equals(type, other.getType())) {
|
||||
if (!equals(type, other.getType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!StringUtils.equals(path, other.getPath())) {
|
||||
if (!equals(path, other.getPath())) {
|
||||
return false;
|
||||
}
|
||||
if (!StringUtils.equals(headers, other.getHeaders())) {
|
||||
if (!equals(headers, other.getHeaders())) {
|
||||
return false;
|
||||
}
|
||||
return expectedResponseCode == other.getExpectedResponseCode();
|
||||
@ -164,16 +162,20 @@ public abstract class AbstractHealthChecker implements Cloneable {
|
||||
|
||||
Mysql other = (Mysql) obj;
|
||||
|
||||
if (!StringUtils.equals(user, other.getUser())) {
|
||||
if (!equals(user, other.getUser())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!StringUtils.equals(pwd, other.getPwd())) {
|
||||
if (!equals(pwd, other.getPwd())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return StringUtils.equals(cmd, other.getCmd());
|
||||
return equals(cmd, other.getCmd());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean equals(String str1, String str2) {
|
||||
return str1 == null ? str2 == null : str1.equals(str2);
|
||||
}
|
||||
}
|
@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.alibaba.nacos.api.naming.pojo;
|
||||
|
||||
import com.alibaba.nacos.client.naming.utils.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -33,7 +31,7 @@ public class Cluster {
|
||||
/**
|
||||
* Name of cluster
|
||||
*/
|
||||
private String name = StringUtils.EMPTY;
|
||||
private String name = "";
|
||||
|
||||
/**
|
||||
* Health check config of this cluster
|
@ -17,7 +17,6 @@ package com.alibaba.nacos.api.naming.pojo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.nacos.client.naming.utils.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -155,7 +154,7 @@ public class Instance {
|
||||
|
||||
Instance host = (Instance) obj;
|
||||
|
||||
return StringUtils.equals(toString(), host.toString());
|
||||
return equals(toString(), host.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -163,4 +162,8 @@ public class Instance {
|
||||
return toString().hashCode();
|
||||
}
|
||||
|
||||
private static boolean equals(String str1, String str2) {
|
||||
return str1 == null ? str2 == null : str1.equals(str2);
|
||||
}
|
||||
|
||||
}
|
1
api/src/main/resources/application.properties
Normal file
1
api/src/main/resources/application.properties
Normal file
@ -0,0 +1 @@
|
||||
version=${project.version}
|
53
api/src/test/java/com/alibaba/nacos/client/AppTest.java
Normal file
53
api/src/test/java/com/alibaba/nacos/client/AppTest.java
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* 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.alibaba.nacos.client;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
@ -64,6 +64,10 @@
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>nacos-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>nacos-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* 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.alibaba.nacos.api.naming;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.nacos.client.naming.NacosNamingService;
|
||||
|
||||
/**
|
||||
* @author dungu.zpf
|
||||
*/
|
||||
public class NamingFactory {
|
||||
|
||||
public static NamingService createNamingService(String serverList) {
|
||||
return new NacosNamingService(serverList);
|
||||
}
|
||||
|
||||
public static NamingService createNamingService(Properties properties) {
|
||||
return new NacosNamingService(properties);
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -961,7 +961,9 @@ class ConfigurationManagement extends React.Component {
|
||||
{!this.inApp ? <Table.Column title={window.aliwareIntl.get('nacos.page.configurationManagement.HOME_Application')} dataIndex={"appName"} /> : <div></div>}
|
||||
<Table.Column title={window.aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.operation')} cell={this.renderCol.bind(this)} />
|
||||
</Table>
|
||||
|
||||
{this.state.dataSource.length > 0 && <div style={{ marginTop: 10, overflow: "hidden" }}>
|
||||
<Pagination style={{ float: "right" }} pageSizeList={[10, 20, 30]} pageSizeSelector={"dropdown"} onPageSizeChange={this.handlePageSizeChange.bind(this)} current={this.state.currentPage} language={window.pageLanguage || 'zh-cn'} total={this.state.total} pageSize={this.state.pageSize} onChange={this.changePage.bind(this)} />
|
||||
</div>}
|
||||
</div>
|
||||
<ShowCodeing ref={"showcode"} />
|
||||
<DeleteDialog ref={"delete"} />
|
||||
|
6
pom.xml
6
pom.xml
@ -407,6 +407,7 @@
|
||||
<module>core</module>
|
||||
<module>naming</module>
|
||||
<module>test</module>
|
||||
<module>api</module>
|
||||
<module>client</module>
|
||||
<module>example</module>
|
||||
<module>common</module>
|
||||
@ -442,6 +443,11 @@
|
||||
<artifactId>nacos-naming</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>nacos-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
|
Loading…
Reference in New Issue
Block a user