Skip to content

Commit

Permalink
for javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Apr 6, 2017
1 parent 16f92ef commit 793b763
Show file tree
Hide file tree
Showing 32 changed files with 505 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperElectionService;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.curator.framework.CuratorFramework;

Expand All @@ -33,6 +35,7 @@
*
* @author caohao
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Slf4j
public final class Bootstrap {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@
public enum CloudJobExecutionType {

DAEMON, TRANSIENT

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* 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:https://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.lite.console.domain;

import lombok.AccessLevel;
Expand All @@ -22,6 +39,9 @@ public EventTraceDataSource(final EventTraceDataSourceConfiguration eventTraceDa
this.eventTraceDataSourceConfiguration = eventTraceDataSourceConfiguration;
}

/**
* 初始化.
*/
public void init() {
log.debug("Elastic job: data source init, connection url is: {}.", eventTraceDataSourceConfiguration.getUrl());
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* 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:https://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.lite.console.domain;

import lombok.EqualsAndHashCode;
Expand All @@ -11,12 +28,17 @@
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;

/**
* 事件追踪数据源配置.
*
* @author zhangxinguo
*/
@NoArgsConstructor
@Getter
@Setter
@EqualsAndHashCode(exclude = {"driver", "url", "username", "password", "activated"})
@EqualsAndHashCode(of = "name")
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@NoArgsConstructor
public final class EventTraceDataSourceConfiguration implements Serializable {

private static final long serialVersionUID = -5996257770767863699L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
/*
* 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:https://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.lite.console.domain;

import java.util.LinkedHashSet;
import java.util.Set;
import lombok.Getter;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.LinkedHashSet;
import java.util.Set;

import lombok.Getter;

/**
* 事件追踪数据源配置根对象.
*
* @author zhangxinguo
*/
@Getter
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
/*
* 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:https://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.lite.console.domain;

import lombok.Getter;
import lombok.Setter;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.Getter;
import lombok.Setter;

/**
* 全局配置.
*
* @author zhangxinguo
*/
@Getter
@Setter
@XmlRootElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;

/**
* 注册中心配置.
*
* @author zhangliang
*/
@Getter
@Setter
@EqualsAndHashCode(exclude = {"zkAddressList", "namespace", "digest", "activated"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@

package com.dangdang.ddframe.job.lite.console.domain;

import java.util.LinkedHashSet;
import java.util.Set;
import lombok.Getter;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.LinkedHashSet;
import java.util.Set;

import lombok.Getter;

/**
* 注册中心配置根对象.
*
* @author zhangliang
*/
@Getter
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

package com.dangdang.ddframe.job.lite.console.exception;

/**
* 控制台异常.
*
* @author zhangliang
*/
public final class JobConsoleException extends RuntimeException {

private static final long serialVersionUID = 1393957353478034407L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@

import com.dangdang.ddframe.job.lite.console.domain.GlobalConfiguration;

/**
* 基于XML的全局配置数据访问器.
*
* @author zhangliang
*/
public interface ConfigurationsXmlRepository extends XmlRepository<GlobalConfiguration> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,26 @@

package com.dangdang.ddframe.job.lite.console.repository;

/**
* 基于XML的数据访问器.
*
* @param <E> 数据类型
*
* @author zhangliang
*/
public interface XmlRepository<E> {

/**
* 读取数据.
*
* @return 数据
*/
E load();

/**
* 存储数据.
*
* @param entity 数据
*/
void save(E entity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@

import com.dangdang.ddframe.job.lite.console.exception.JobConsoleException;
import com.dangdang.ddframe.job.lite.console.repository.XmlRepository;
import com.dangdang.ddframe.job.lite.console.util.HomeFolder;
import com.dangdang.ddframe.job.lite.console.util.HomeFolderUtils;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.File;

/**
* 基于XML的数据访问器实现类.
*
* @param <E> 数据类型
* @author zhangliang
*/
public abstract class AbstractXmlRepositoryImpl<E> implements XmlRepository<E> {

private final File file;
Expand All @@ -35,9 +41,9 @@ public abstract class AbstractXmlRepositoryImpl<E> implements XmlRepository<E> {
private JAXBContext jaxbContext;

protected AbstractXmlRepositoryImpl(final String fileName, final Class<E> clazz) {
file = new File(HomeFolder.getFilePathInHomeFolder(fileName));
file = new File(HomeFolderUtils.getFilePathInHomeFolder(fileName));
this.clazz = clazz;
HomeFolder.createHomeFolderIfNotExisted();
HomeFolderUtils.createHomeFolderIfNotExisted();
try {
jaxbContext = JAXBContext.newInstance(clazz);
} catch (final JAXBException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
import com.dangdang.ddframe.job.lite.console.domain.GlobalConfiguration;
import com.dangdang.ddframe.job.lite.console.repository.ConfigurationsXmlRepository;

/**
* 基于XML的全局配置数据访问器实现类.
*
* @author zhangliang
*/
public final class ConfigurationsXmlRepositoryImpl extends AbstractXmlRepositoryImpl<GlobalConfiguration> implements ConfigurationsXmlRepository {

public ConfigurationsXmlRepositoryImpl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,46 @@
import java.util.HashMap;
import java.util.Map;

/**
* 事件追踪历史记录的RESTful API.
*
* @author zhangxinguo
*/
@Path("/event-trace")
public final class EventTraceHistoryRestfulApi {

private EventTraceDataSourceConfiguration eventTraceDataSourceConfiguration = SessionEventTraceDataSourceConfiguration.getEventTraceDataSourceConfiguration();

/**
* 查询作业执行事件.
*
* @param uriInfo 查询条件
* @return 运行痕迹事件结果集
* @throws ParseException 解析异常
*/
@GET
@Path("/execution")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Result<JobExecutionEvent> findJobExecutionEvents(@Context final UriInfo info) throws ParseException {
public Result<JobExecutionEvent> findJobExecutionEvents(@Context final UriInfo uriInfo) throws ParseException {
JobEventRdbSearch jobEventRdbSearch = new JobEventRdbSearch(setUpEventTraceDataSource());
return jobEventRdbSearch.findJobExecutionEvents(buildCondition(info, new String[]{"jobName", "ip", "isSuccess"}));
return jobEventRdbSearch.findJobExecutionEvents(buildCondition(uriInfo, new String[]{"jobName", "ip", "isSuccess"}));
}

/**
* 查询作业状态事件.
*
* @param uriInfo 查询条件
* @return 运行痕迹事件结果集
* @throws ParseException 解析异常
*/
@GET
@Path("/status")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Result<JobStatusTraceEvent> findJobStatusTraceEvents(@Context final UriInfo info) throws ParseException {
public Result<JobStatusTraceEvent> findJobStatusTraceEvents(@Context final UriInfo uriInfo) throws ParseException {
JobEventRdbSearch jobEventRdbSearch = new JobEventRdbSearch(setUpEventTraceDataSource());
return jobEventRdbSearch.findJobStatusTraceEvents(buildCondition(info, new String[]{"jobName", "source", "executionType", "state"}));
return jobEventRdbSearch.findJobStatusTraceEvents(buildCondition(uriInfo, new String[]{"jobName", "source", "executionType", "state"}));
}

private DataSource setUpEventTraceDataSource() {
Expand Down
Loading

0 comments on commit 793b763

Please sign in to comment.