-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
97 changed files
with
3,006 additions
and
1,446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>elastic-job-api</artifactId> | ||
<groupId>com.dangdang</groupId> | ||
<version>1.0.7-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>elastic-job-api-core</artifactId> | ||
<name>${project.artifactId}</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-framework</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-recipes</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
84 changes: 84 additions & 0 deletions
84
...ob-api/elastic-job-api-core/src/main/java/com/dangdang/ddframe/job/api/JobAPIFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright 1999-2015 dangdang.com. | ||
* <p> | ||
* 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. | ||
* </p> | ||
*/ | ||
|
||
package com.dangdang.ddframe.job.api; | ||
|
||
import com.dangdang.ddframe.job.internal.operate.JobOperateAPIImpl; | ||
import com.dangdang.ddframe.job.internal.reg.RegistryCenterFactory; | ||
import com.dangdang.ddframe.job.internal.settings.JobSettingsAPIImpl; | ||
import com.dangdang.ddframe.job.internal.statistics.JobStatisticsAPIImpl; | ||
import com.dangdang.ddframe.job.internal.statistics.ServerStatisticsAPIImpl; | ||
import com.google.common.base.Optional; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* 作业API工厂. | ||
* | ||
* @author zhangliang | ||
*/ | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public final class JobAPIFactory { | ||
|
||
/** | ||
* 创建作业配置API对象. | ||
* | ||
* @param connectString 注册中心连接字符串 | ||
* @param namespace 注册中心命名空间 | ||
* @param digest 注册中心凭证 | ||
* @return 操作作业API对象 | ||
*/ | ||
public static JobSettingsAPI createJobSettingsAPI(final String connectString, final String namespace, final Optional<String> digest) { | ||
return new JobSettingsAPIImpl(RegistryCenterFactory.createCoordinatorRegistryCenter(connectString, namespace, digest)); | ||
} | ||
|
||
/** | ||
* 创建操作作业API对象. | ||
* | ||
* @param connectString 注册中心连接字符串 | ||
* @param namespace 注册中心命名空间 | ||
* @param digest 注册中心凭证 | ||
* @return 操作作业API对象 | ||
*/ | ||
public static JobOperateAPI createJobOperateAPI(final String connectString, final String namespace, final Optional<String> digest) { | ||
return new JobOperateAPIImpl(RegistryCenterFactory.createCoordinatorRegistryCenter(connectString, namespace, digest)); | ||
} | ||
|
||
/** | ||
* 创建作业状态展示API对象. | ||
* | ||
* @param connectString 注册中心连接字符串 | ||
* @param namespace 注册中心命名空间 | ||
* @param digest 注册中心凭证 | ||
* @return 操作作业API对象 | ||
*/ | ||
public static JobStatisticsAPI createJobStatisticsAPI(final String connectString, final String namespace, final Optional<String> digest) { | ||
return new JobStatisticsAPIImpl(RegistryCenterFactory.createCoordinatorRegistryCenter(connectString, namespace, digest)); | ||
} | ||
|
||
/** | ||
* 创建作业服务器状态展示API对象. | ||
* | ||
* @param connectString 注册中心连接字符串 | ||
* @param namespace 注册中心命名空间 | ||
* @param digest 注册中心凭证 | ||
* @return 操作作业API对象 | ||
*/ | ||
public static ServerStatisticsAPI createServerStatisticsAPI(final String connectString, final String namespace, final Optional<String> digest) { | ||
return new ServerStatisticsAPIImpl(RegistryCenterFactory.createCoordinatorRegistryCenter(connectString, namespace, digest)); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...ob-api/elastic-job-api-core/src/main/java/com/dangdang/ddframe/job/api/JobOperateAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright 1999-2015 dangdang.com. | ||
* <p> | ||
* 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. | ||
* </p> | ||
*/ | ||
|
||
package com.dangdang.ddframe.job.api; | ||
|
||
import com.google.common.base.Optional; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* 操作作业的API. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public interface JobOperateAPI { | ||
|
||
/** | ||
* 作业暂停. | ||
* | ||
* <p>不会导致重新分片.</p> | ||
* | ||
* @param jobName 作业名称 | ||
* @param serverIp 作业服务器IP地址 | ||
*/ | ||
void pause(Optional<String> jobName, Optional<String> serverIp); | ||
|
||
/** | ||
* 作业恢复. | ||
* | ||
* @param jobName 作业名称 | ||
* @param serverIp 作业服务器IP地址 | ||
*/ | ||
void resume(Optional<String> jobName, Optional<String> serverIp); | ||
|
||
/** | ||
* 作业禁用. | ||
* | ||
* <p>会重新分片.</p> | ||
* | ||
* @param jobName 作业名称 | ||
* @param serverIp 作业服务器IP地址 | ||
*/ | ||
void disable(Optional<String> jobName, Optional<String> serverIp); | ||
|
||
/** | ||
* 作业启用. | ||
* | ||
* @param jobName 作业名称 | ||
* @param serverIp 作业服务器IP地址 | ||
*/ | ||
void enable(Optional<String> jobName, Optional<String> serverIp); | ||
|
||
/** | ||
* 作业关闭. | ||
* | ||
* @param jobName 作业名称 | ||
* @param serverIp 作业服务器IP地址 | ||
*/ | ||
void shutdown(Optional<String> jobName, Optional<String> serverIp); | ||
|
||
/** | ||
* 作业删除. | ||
* | ||
* <p>只有停止运行的作业才能删除.</p> | ||
* | ||
* @param jobName 作业名称 | ||
* @param serverIp 作业服务器IP地址 | ||
* @return 因为未停止而导致未能成功删除的作业服务器IP地址列表 | ||
*/ | ||
Collection<String> remove(Optional<String> jobName, Optional<String> serverIp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...api/elastic-job-api-core/src/main/java/com/dangdang/ddframe/job/api/JobStatisticsAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 1999-2015 dangdang.com. | ||
* <p> | ||
* 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. | ||
* </p> | ||
*/ | ||
|
||
package com.dangdang.ddframe.job.api; | ||
|
||
import com.dangdang.ddframe.job.domain.ExecutionInfo; | ||
import com.dangdang.ddframe.job.domain.JobBriefInfo; | ||
import com.dangdang.ddframe.job.domain.ServerInfo; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* 作业状态展示的API. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public interface JobStatisticsAPI { | ||
|
||
/** | ||
* 获取所有作业简明信息. | ||
* | ||
* @return 作业简明信息集合. | ||
*/ | ||
Collection<JobBriefInfo> getAllJobsBriefInfo(); | ||
|
||
/** | ||
* 获取执行作业的服务器. | ||
* | ||
* @param jobName 作业名称 | ||
* @return 作业的服务器集合 | ||
*/ | ||
Collection<ServerInfo> getServers(String jobName); | ||
|
||
/** | ||
* 获取作业运行时信息. | ||
* | ||
* @param jobName 作业名称 | ||
* @return 作业运行时信息集合 | ||
*/ | ||
Collection<ExecutionInfo> getExecutionInfo(String jobName); | ||
} |
46 changes: 46 additions & 0 deletions
46
.../elastic-job-api-core/src/main/java/com/dangdang/ddframe/job/api/ServerStatisticsAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 1999-2015 dangdang.com. | ||
* <p> | ||
* 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. | ||
* </p> | ||
*/ | ||
|
||
package com.dangdang.ddframe.job.api; | ||
|
||
import com.dangdang.ddframe.job.domain.ServerInfo; | ||
import com.dangdang.ddframe.job.domain.ServerBriefInfo; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* 作业服务器状态展示的API. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public interface ServerStatisticsAPI { | ||
|
||
/** | ||
* 获取所有作业服务器简明信息. | ||
* | ||
* @return 作业服务器简明信息集合 | ||
*/ | ||
Collection<ServerBriefInfo> getAllServersBriefInfo(); | ||
|
||
/** | ||
* 获取作业服务器部署的作业. | ||
* | ||
* @param serverIp 作业服务器IP | ||
* @return 作业服务器部署的作业 | ||
*/ | ||
Collection<ServerInfo> getJobs(String serverIp); | ||
} |
Oops, something went wrong.