Skip to content

Commit

Permalink
[Improve] AppBuildPile class name rename to ApplicationBuildPipelint
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys committed Sep 29, 2024
1 parent a0541f1 commit 5667bf0
Show file tree
Hide file tree
Showing 27 changed files with 185 additions and 183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
import org.apache.streampark.console.core.annotation.Permission;
import org.apache.streampark.console.core.entity.ApplicationLog;
import org.apache.streampark.console.core.entity.FlinkApplication;
import org.apache.streampark.console.core.entity.FlinkApplicationBackUp;
import org.apache.streampark.console.core.entity.FlinkApplicationBackup;
import org.apache.streampark.console.core.enums.AppExistsStateEnum;
import org.apache.streampark.console.core.service.ResourceService;
import org.apache.streampark.console.core.service.application.ApplicationLogService;
import org.apache.streampark.console.core.service.application.FlinkApplicationActionService;
import org.apache.streampark.console.core.service.application.FlinkApplicationBackUpService;
import org.apache.streampark.console.core.service.application.FlinkApplicationBackupService;
import org.apache.streampark.console.core.service.application.FlinkApplicationInfoService;
import org.apache.streampark.console.core.service.application.FlinkApplicationManageService;

Expand Down Expand Up @@ -67,7 +67,7 @@ public class FlinkApplicationController {
private FlinkApplicationInfoService applicationInfoService;

@Autowired
private FlinkApplicationBackUpService backUpService;
private FlinkApplicationBackupService backUpService;

@Autowired
private ApplicationLogService applicationLogService;
Expand Down Expand Up @@ -208,8 +208,8 @@ public RestResponse getMain(FlinkApplication application) {

@PostMapping("backups")
@Permission(app = "#backUp.appId", team = "#backUp.teamId")
public RestResponse backups(FlinkApplicationBackUp backUp, RestRequest request) {
IPage<FlinkApplicationBackUp> backups = backUpService.getPage(backUp, request);
public RestResponse backups(FlinkApplicationBackup backUp, RestRequest request) {
IPage<FlinkApplicationBackup> backups = backUpService.getPage(backUp, request);
return RestResponse.success(backups);
}

Expand Down Expand Up @@ -238,7 +238,7 @@ public RestResponse delete(FlinkApplication app) throws InternalException {

@Permission(app = "#backUp.appId")
@PostMapping("delete/backup")
public RestResponse deleteBackup(FlinkApplicationBackUp backUp) throws InternalException {
public RestResponse deleteBackup(FlinkApplicationBackup backUp) throws InternalException {
Boolean deleted = backUpService.removeById(backUp.getId());
return RestResponse.success(deleted);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@Validated
@RestController
@RequestMapping("flink/conf")
public class ConfigController {
public class FlinkConfigController {

@Autowired
private FlinkApplicationConfigService applicationConfigService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import org.apache.streampark.console.base.domain.RestResponse;
import org.apache.streampark.console.core.annotation.Permission;
import org.apache.streampark.console.core.bean.AppBuildDockerResolvedDetail;
import org.apache.streampark.console.core.entity.AppBuildPipeline;
import org.apache.streampark.console.core.service.application.AppBuildPipeService;
import org.apache.streampark.console.core.entity.ApplicationBuildPipeline;
import org.apache.streampark.console.core.service.application.FlinkApplicationBuildPipelineService;
import org.apache.streampark.flink.packer.pipeline.DockerResolvedSnapshot;
import org.apache.streampark.flink.packer.pipeline.PipelineTypeEnum;

Expand All @@ -42,10 +42,10 @@
@Validated
@RestController
@RequestMapping("flink/pipe")
public class FlinkBuildPipelineController {
public class FlinkPipelineController {

@Autowired
private AppBuildPipeService appBuildPipeService;
private FlinkApplicationBuildPipelineService appBuildPipeService;

@Permission(app = "#appId")
@PostMapping("build")
Expand All @@ -66,8 +66,8 @@ public RestResponse buildApplication(Long appId, boolean forceBuild) throws Exce
@RequiresPermissions("app:view")
public RestResponse getBuildProgressDetail(Long appId) {
Map<String, Object> details = new HashMap<>(0);
Optional<AppBuildPipeline> pipeline = appBuildPipeService.getCurrentBuildPipeline(appId);
details.put("pipeline", pipeline.map(AppBuildPipeline::toView).orElse(null));
Optional<ApplicationBuildPipeline> pipeline = appBuildPipeService.getCurrentBuildPipeline(appId);
details.put("pipeline", pipeline.map(ApplicationBuildPipeline::toView).orElse(null));

if (pipeline.isPresent()
&& PipelineTypeEnum.FLINK_NATIVE_K8S_APPLICATION == pipeline.get().getPipeType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.apache.streampark.console.base.exception.InternalException;
import org.apache.streampark.console.core.annotation.AppChangeEvent;
import org.apache.streampark.console.core.entity.ApplicationLog;
import org.apache.streampark.console.core.entity.FlinkApplicationBackUp;
import org.apache.streampark.console.core.entity.FlinkApplicationBackup;
import org.apache.streampark.console.core.entity.SparkApplication;
import org.apache.streampark.console.core.enums.AppExistsStateEnum;
import org.apache.streampark.console.core.service.ResourceService;
import org.apache.streampark.console.core.service.application.ApplicationLogService;
import org.apache.streampark.console.core.service.application.FlinkApplicationBackUpService;
import org.apache.streampark.console.core.service.application.FlinkApplicationBackupService;
import org.apache.streampark.console.core.service.application.SparkApplicationActionService;
import org.apache.streampark.console.core.service.application.SparkApplicationInfoService;
import org.apache.streampark.console.core.service.application.SparkApplicationManageService;
Expand Down Expand Up @@ -66,7 +66,7 @@ public class SparkApplicationController {
private SparkApplicationInfoService applicationInfoService;

@Autowired
private FlinkApplicationBackUpService backUpService;
private FlinkApplicationBackupService backUpService;

@Autowired
private ApplicationLogService applicationLogService;
Expand Down Expand Up @@ -196,8 +196,8 @@ public RestResponse readConf(SparkApplication app) throws IOException {
}

@PostMapping("backups")
public RestResponse backups(FlinkApplicationBackUp backUp, RestRequest request) {
IPage<FlinkApplicationBackUp> backups = backUpService.getPage(backUp, request);
public RestResponse backups(FlinkApplicationBackup backUp, RestRequest request) {
IPage<FlinkApplicationBackup> backups = backUpService.getPage(backUp, request);
return RestResponse.success(backups);
}

Expand All @@ -222,7 +222,7 @@ public RestResponse delete(SparkApplication app) throws InternalException {
}

@PostMapping("delete/bak")
public RestResponse deleteBak(FlinkApplicationBackUp backUp) throws InternalException {
public RestResponse deleteBak(FlinkApplicationBackup backUp) throws InternalException {
Boolean deleted = backUpService.removeById(backUp.getId());
return RestResponse.success(deleted);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import org.apache.streampark.console.base.domain.RestResponse;
import org.apache.streampark.console.core.annotation.Permission;
import org.apache.streampark.console.core.entity.AppBuildPipeline;
import org.apache.streampark.console.core.service.application.SparkAppBuildPipeService;
import org.apache.streampark.console.core.entity.ApplicationBuildPipeline;
import org.apache.streampark.console.core.service.application.SparkAplicationBuildPipelineService;

import org.apache.shiro.authz.annotation.RequiresPermissions;

Expand All @@ -39,10 +39,10 @@
@Validated
@RestController
@RequestMapping("spark/pipe")
public class SparkBuildPipelineController {
public class SparkPipelineController {

@Autowired
private SparkAppBuildPipeService appBuildPipeService;
private SparkAplicationBuildPipelineService appBuildPipeService;

/**
* Release application building pipeline.
Expand Down Expand Up @@ -74,8 +74,8 @@ public RestResponse buildApplication(Long appId, boolean forceBuild) {
@Permission(app = "#appId")
public RestResponse getBuildProgressDetail(Long appId) {
Map<String, Object> details = new HashMap<>(0);
Optional<AppBuildPipeline> pipeline = appBuildPipeService.getCurrentBuildPipeline(appId);
details.put("pipeline", pipeline.map(AppBuildPipeline::toView).orElse(null));
Optional<ApplicationBuildPipeline> pipeline = appBuildPipeService.getCurrentBuildPipeline(appId);
details.put("pipeline", pipeline.map(ApplicationBuildPipeline::toView).orElse(null));
return RestResponse.success(details);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Slf4j
public class AppBuildPipeline {
public class ApplicationBuildPipeline {

@TableId(type = IdType.INPUT)
private Long appId;
Expand Down Expand Up @@ -100,7 +100,7 @@ public PipelineTypeEnum getPipeType() {
}

@JsonIgnore
public AppBuildPipeline setPipeType(@Nonnull PipelineTypeEnum pipeType) {
public ApplicationBuildPipeline setPipeType(@Nonnull PipelineTypeEnum pipeType) {
this.pipeTypeCode = pipeType.getCode();
return this;
}
Expand All @@ -112,7 +112,7 @@ public PipelineStatusEnum getPipelineStatus() {
}

@JsonIgnore
public AppBuildPipeline setPipeStatus(@Nonnull PipelineStatusEnum pipeStatus) {
public ApplicationBuildPipeline setPipeStatus(@Nonnull PipelineStatusEnum pipeStatus) {
this.pipeStatusCode = pipeStatus.getCode();
return this;
}
Expand All @@ -135,7 +135,7 @@ public Map<Integer, PipelineStepStatusEnum> getStepStatus() {
}

@JsonIgnore
public AppBuildPipeline setStepStatus(@Nonnull Map<Integer, PipelineStepStatusEnum> stepStatus) {
public ApplicationBuildPipeline setStepStatus(@Nonnull Map<Integer, PipelineStepStatusEnum> stepStatus) {
try {
this.stepStatusJson = JacksonUtils.write(stepStatus);
} catch (JsonProcessingException e) {
Expand Down Expand Up @@ -169,7 +169,7 @@ public Map<Integer, Long> getStepStatusTimestamp() {
}

@JsonIgnore
public AppBuildPipeline setStepStatusTimestamp(@Nonnull Map<Integer, Long> stepStatusSt) {
public ApplicationBuildPipeline setStepStatusTimestamp(@Nonnull Map<Integer, Long> stepStatusSt) {
try {
this.stepStatusTimestampJson = JacksonUtils.write(stepStatusSt);
} catch (JsonProcessingException e) {
Expand Down Expand Up @@ -198,7 +198,7 @@ public PipeError getError() {
}

@JsonIgnore
public AppBuildPipeline setError(@Nonnull PipeError error) {
public ApplicationBuildPipeline setError(@Nonnull PipeError error) {
try {
this.errorJson = JacksonUtils.write(error);
} catch (JsonProcessingException e) {
Expand All @@ -208,7 +208,7 @@ public AppBuildPipeline setError(@Nonnull PipeError error) {
}

@JsonIgnore
public <R extends BuildResult> AppBuildPipeline setBuildResult(@Nonnull R result) {
public <R extends BuildResult> ApplicationBuildPipeline setBuildResult(@Nonnull R result) {
try {
this.buildResultJson = JacksonUtils.write(result);
} catch (JsonProcessingException e) {
Expand Down Expand Up @@ -250,13 +250,13 @@ public <R extends BuildResult> R getBuildResult() {
}

/** Initialize from BuildPipeline */
public static AppBuildPipeline initFromPipeline(@Nonnull BuildPipeline pipeline) {
public static ApplicationBuildPipeline initFromPipeline(@Nonnull BuildPipeline pipeline) {
return fromPipeSnapshot(pipeline.snapshot());
}

/** Create object from PipeSnapshot */
public static AppBuildPipeline fromPipeSnapshot(@Nonnull PipelineSnapshot snapshot) {
return new AppBuildPipeline()
public static ApplicationBuildPipeline fromPipeSnapshot(@Nonnull PipelineSnapshot snapshot) {
return new ApplicationBuildPipeline()
.setPipeType(snapshot.pipeType())
.setPipeStatus(snapshot.pipeStatus())
.setTotalStep(snapshot.allSteps())
Expand Down Expand Up @@ -291,7 +291,7 @@ public static class View {
private String errorStack;
private Date updateTime;

public static View of(@Nonnull AppBuildPipeline pipe) {
public static View of(@Nonnull ApplicationBuildPipeline pipe) {
// combine step info
Map<Integer, String> stepDesc = pipe.getPipeType().getSteps();
Map<Integer, PipelineStepStatusEnum> stepStatus = pipe.getStepStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Data
@TableName("t_flink_app_backup")
@Slf4j
public class FlinkApplicationBackUp {
public class FlinkApplicationBackup {

@TableId(type = IdType.AUTO)
private Long id;
Expand All @@ -49,10 +49,10 @@ public class FlinkApplicationBackUp {

private transient String teamId;

public FlinkApplicationBackUp() {
public FlinkApplicationBackup() {
}

public FlinkApplicationBackUp(FlinkApplication application) {
public FlinkApplicationBackup(FlinkApplication application) {
this.appId = application.getId();
this.sqlId = application.getSqlId();
this.configId = application.getConfigId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Data
@TableName("t_spark_app_backup")
@Slf4j
public class SparkApplicationBackUp {
public class SparkApplicationBackup {

@TableId(type = IdType.AUTO)
private Long id;
Expand All @@ -51,10 +51,10 @@ public class SparkApplicationBackUp {

private transient boolean backup;

public SparkApplicationBackUp() {
public SparkApplicationBackup() {
}

public SparkApplicationBackUp(SparkApplication application) {
public SparkApplicationBackup(SparkApplication application) {
this.appId = application.getId();
this.sqlId = application.getSqlId();
this.configId = application.getConfigId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.streampark.console.core.mapper;

import org.apache.streampark.console.core.entity.AppBuildPipeline;
import org.apache.streampark.console.core.entity.ApplicationBuildPipeline;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

public interface ApplicationBuildPipelineMapper extends BaseMapper<AppBuildPipeline> {
public interface ApplicationBuildPipelineMapper extends BaseMapper<ApplicationBuildPipeline> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.streampark.console.core.mapper;

import org.apache.streampark.console.core.entity.FlinkApplicationBackUp;
import org.apache.streampark.console.core.entity.FlinkApplicationBackup;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

public interface FlinkApplicationBackUpMapper extends BaseMapper<FlinkApplicationBackUp> {
public interface FlinkApplicationBackUpMapper extends BaseMapper<FlinkApplicationBackup> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.streampark.console.core.mapper;

import org.apache.streampark.console.core.entity.SparkApplicationBackUp;
import org.apache.streampark.console.core.entity.SparkApplicationBackup;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

public interface SparkApplicationBackUpMapper extends BaseMapper<SparkApplicationBackUp> {
public interface SparkApplicationBackUpMapper extends BaseMapper<SparkApplicationBackup> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.streampark.console.core.service.FlinkClusterService;
import org.apache.streampark.console.core.service.FlinkEnvService;
import org.apache.streampark.console.core.service.FlinkSqlService;
import org.apache.streampark.console.core.service.application.AppBuildPipeService;
import org.apache.streampark.console.core.service.application.FlinkApplicationBuildPipelineService;
import org.apache.streampark.console.core.service.application.FlinkApplicationManageService;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -57,9 +57,9 @@ public class QuickStartRunner implements ApplicationRunner {
private FlinkApplicationManageService applicationManageService;

@Autowired
private AppBuildPipeService appBuildPipeService;
private FlinkApplicationBuildPipelineService appBuildPipeService;

private static Long defaultId = 100000L;
private static final Long defaultId = 100000L;

@Override
public void run(ApplicationArguments args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.InternalException;
import org.apache.streampark.console.core.entity.FlinkApplication;
import org.apache.streampark.console.core.entity.FlinkApplicationBackUp;
import org.apache.streampark.console.core.entity.FlinkApplicationBackup;
import org.apache.streampark.console.core.entity.FlinkSql;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

/** Interface representing a service for application backup operations. */
public interface FlinkApplicationBackUpService extends IService<FlinkApplicationBackUp> {
public interface FlinkApplicationBackupService extends IService<FlinkApplicationBackup> {

/**
* Deletes an object specified by the given ID.
Expand All @@ -47,20 +47,20 @@ public interface FlinkApplicationBackUpService extends IService<FlinkApplication
void backup(FlinkApplication appParam, FlinkSql flinkSqlParam);

/**
* Retrieves a page of {@link FlinkApplicationBackUp} objects based on the provided parameters.
* Retrieves a page of {@link FlinkApplicationBackup} objects based on the provided parameters.
*
* @param bakParam The {@link FlinkApplicationBackUp} object containing the search criteria.
* @param bakParam The {@link FlinkApplicationBackup} object containing the search criteria.
* @param request The {@link RestRequest} object used for pagination and sorting.
* @return An {@link IPage} containing the retrieved {@link FlinkApplicationBackUp} objects.
* @return An {@link IPage} containing the retrieved {@link FlinkApplicationBackup} objects.
*/
IPage<FlinkApplicationBackUp> getPage(FlinkApplicationBackUp bakParam, RestRequest request);
IPage<FlinkApplicationBackup> getPage(FlinkApplicationBackup bakParam, RestRequest request);

/**
* Rolls back the changes made by the specified application backup.
*
* @param bakParam The ApplicationBackUp object representing the backup to roll back.
*/
void rollback(FlinkApplicationBackUp bakParam);
void rollback(FlinkApplicationBackup bakParam);

/**
* Revoke the given application.
Expand Down
Loading

0 comments on commit 5667bf0

Please sign in to comment.