mirror of https://github.com/longtai-cn/hippo4j
parent
cce1719040
commit
a7e431b461
@ -0,0 +1,33 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.github.dynamic-threadpool</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>open-change-tool</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,18 @@
|
||||
package com.github.dynamic.threadpool.openchange;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Change timed task.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2021/10/31 13:39
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Import(OpenChangeNotifyConfig.class)
|
||||
@Documented
|
||||
public @interface EnableOpenChangeNotify {
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.github.dynamic.threadpool.openchange;
|
||||
|
||||
import com.dtflys.forest.annotation.Get;
|
||||
|
||||
/**
|
||||
* GitHub remote.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2021/10/31 10:45
|
||||
*/
|
||||
public interface GitHubRemote {
|
||||
|
||||
/**
|
||||
* 获取 GitHub 仓库详细信息.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Get("https://api.github.com/repos/acmenlt/dynamic-threadpool")
|
||||
OpenChangeInfo getGitHubItemInfo();
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.github.dynamic.threadpool.openchange;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Open change info.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2021/10/31 10:33
|
||||
*/
|
||||
@Data
|
||||
public class OpenChangeInfo {
|
||||
|
||||
/**
|
||||
* name
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* stars
|
||||
*/
|
||||
private Long stargazers_count;
|
||||
|
||||
/**
|
||||
* forks
|
||||
*/
|
||||
private Long forks_count;
|
||||
|
||||
/**
|
||||
* open issues
|
||||
*/
|
||||
private Long open_issues_count;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private String html_url;
|
||||
|
||||
/**
|
||||
* subscribers
|
||||
*/
|
||||
private Long subscribers_count;
|
||||
|
||||
/**
|
||||
* default branch
|
||||
*/
|
||||
private String default_branch;
|
||||
|
||||
/**
|
||||
* star_add
|
||||
*/
|
||||
private Long star_add;
|
||||
|
||||
/**
|
||||
* fork_add
|
||||
*/
|
||||
|
||||
private Long fork_add;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.github.dynamic.threadpool.openchange;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Bootstrap properties.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2021/6/22 09:14
|
||||
*/
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = OpenChangeNotifyBootstrapProperties.PREFIX)
|
||||
public class OpenChangeNotifyBootstrapProperties {
|
||||
|
||||
public static final String PREFIX = "spring.dynamic.thread-pool";
|
||||
|
||||
/**
|
||||
* notifyInterval
|
||||
*/
|
||||
private Long notifyInterval;
|
||||
|
||||
/**
|
||||
* notifys
|
||||
*/
|
||||
private List<NotifyConfig> notifys;
|
||||
|
||||
@Data
|
||||
public static class NotifyConfig {
|
||||
|
||||
/**
|
||||
* type
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String token;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.github.dynamic.threadpool.openchange;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScan;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 项目变更通知配置.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2021/10/31 10:23
|
||||
*/
|
||||
@EnableScheduling
|
||||
@AllArgsConstructor
|
||||
@ImportAutoConfiguration(OpenChangeNotifyBootstrapProperties.class)
|
||||
@ForestScan(basePackages = "com.github.dynamic.threadpool.openchange")
|
||||
public class OpenChangeNotifyConfig {
|
||||
|
||||
private final GitHubRemote gitHubRemote;
|
||||
|
||||
private final OpenChangeNotifyBootstrapProperties bootstrapProperties;
|
||||
|
||||
@Bean
|
||||
public OpenChangeTimedTask changeTimedTask() {
|
||||
return new OpenChangeTimedTask(gitHubRemote, bootstrapProperties);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue