Skip to content

Commit

Permalink
Use new code style for nacos-cmdb module. (alibaba#3242)
Browse files Browse the repository at this point in the history
  • Loading branch information
KomachiSion authored Jul 3, 2020
1 parent 31670f1 commit b1d1ac1
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 124 deletions.
24 changes: 12 additions & 12 deletions cmdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,51 @@
~ 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">

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>
<artifactId>nacos-all</artifactId>
<groupId>com.alibaba.nacos</groupId>
<version>1.3.1-BETA</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>nacos-cmdb</artifactId>
<packaging>jar</packaging>

<name>nacos-cmdb ${project.version}</name>
<url>http://nacos.io</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nacos-core</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nacos-api</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand All @@ -70,7 +70,7 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down
5 changes: 4 additions & 1 deletion cmdb/src/main/java/com/alibaba/nacos/cmdb/CmdbApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.cmdb;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* CMDB starter.
*
* @author nkorange
* @since 0.7.0
*/
@SpringBootApplication
public class CmdbApp {

public static void main(String[] args) {
SpringApplication.run(CmdbApp.class, args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.cmdb.controllers;

import com.alibaba.nacos.cmdb.memory.CmdbProvider;
Expand All @@ -26,16 +27,25 @@
import javax.servlet.http.HttpServletRequest;

/**
* Operation controller.
*
* @author nkorange
* @since 0.7.0
*/
@RestController
@RequestMapping(UtilsAndCommons.NACOS_CMDB_CONTEXT + "/ops")
public class OperationController {

@Autowired
private CmdbProvider cmdbProvider;


/**
* query label.
*
* @param request http request
* @return query result
* @throws Exception exception
*/
@RequestMapping(value = "/label", method = RequestMethod.GET)
public String queryLabel(HttpServletRequest request) throws Exception {
String entry = WebUtils.required(request, "entry");
Expand Down
23 changes: 0 additions & 23 deletions cmdb/src/main/java/com/alibaba/nacos/cmdb/core/CmdbManager.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,45 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.cmdb.core;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
* Switch and options.
*
* @author nkorange
* @since 0.7.0
*/
@Component
public class SwitchAndOptions {

@Value("${nacos.cmdb.dumpTaskInterval:3600}")
private int dumpTaskInterval;

@Value("${nacos.cmdb.eventTaskInterval:10}")
private int eventTaskInterval;

@Value("${nacos.cmdb.labelTaskInterval:300}")
private int labelTaskInterval;

@Value("${nacos.cmdb.loadDataAtStart:false}")
private boolean loadDataAtStart;

public int getDumpTaskInterval() {
return dumpTaskInterval;
}

public int getEventTaskInterval() {
return eventTaskInterval;
}

public int getLabelTaskInterval() {
return labelTaskInterval;
}

public boolean isLoadDataAtStart() {
return loadDataAtStart;
}
Expand Down
Loading

0 comments on commit b1d1ac1

Please sign in to comment.