提交 e13e56f5 编写于 作者: J johnniang

Build basic controllers and services for backup and recovery

上级 72a2a064
package run.halo.app.controller.admin.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import run.halo.app.service.BackupService;
/**
* Backup controller
*
* @author johnniang
* @date 19-4-26
*/
@RestController
@RequestMapping("/api/admin/backups")
public class BackupController {
private final BackupService backupService;
public BackupController(BackupService backupService) {
this.backupService = backupService;
}
}
package run.halo.app.controller.admin.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import run.halo.app.service.RecoveryService;
/**
* Recovery controller
*
* @author johnniang
* @date 19-4-26
*/
@RestController
@RequestMapping("/api/admin/recoveries")
public class RecoveryController {
private final RecoveryService recoveryService;
public RecoveryController(RecoveryService recoveryService) {
this.recoveryService = recoveryService;
}
}
...@@ -35,15 +35,10 @@ public class CommonController implements ErrorController { ...@@ -35,15 +35,10 @@ public class CommonController implements ErrorController {
private final ThemeService themeService; private final ThemeService themeService;
private final OptionService optionService; public CommonController(ThemeService themeService) {
public CommonController(ThemeService themeService,
OptionService optionService) {
this.themeService = themeService; this.themeService = themeService;
this.optionService = optionService;
} }
/** /**
* Handle error * Handle error
* *
...@@ -109,7 +104,7 @@ public class CommonController implements ErrorController { ...@@ -109,7 +104,7 @@ public class CommonController implements ErrorController {
* @return String * @return String
*/ */
@GetMapping(value = "/404") @GetMapping(value = "/404")
public String contentNotFround() throws FileNotFoundException { public String contentNotFround() {
if (!themeService.isTemplateExist(NOT_FROUND_TEMPLATE)) { if (!themeService.isTemplateExist(NOT_FROUND_TEMPLATE)) {
return "common/error/404"; return "common/error/404";
} }
......
package run.halo.app.event.post; package run.halo.app.event.post;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -12,7 +11,6 @@ import run.halo.app.service.PostService; ...@@ -12,7 +11,6 @@ import run.halo.app.service.PostService;
* @author johnniang * @author johnniang
* @date 19-4-22 * @date 19-4-22
*/ */
@Slf4j
@Component @Component
public class PostVisitEventListener extends AbstractVisitEventListener { public class PostVisitEventListener extends AbstractVisitEventListener {
......
...@@ -2,6 +2,7 @@ package run.halo.app.event.post; ...@@ -2,6 +2,7 @@ package run.halo.app.event.post;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import run.halo.app.service.SheetService; import run.halo.app.service.SheetService;
/** /**
...@@ -10,6 +11,7 @@ import run.halo.app.service.SheetService; ...@@ -10,6 +11,7 @@ import run.halo.app.service.SheetService;
* @author johnniang * @author johnniang
* @date 19-4-24 * @date 19-4-24
*/ */
@Component
public class SheetVisitEventListener extends AbstractVisitEventListener { public class SheetVisitEventListener extends AbstractVisitEventListener {
protected SheetVisitEventListener(SheetService sheetService) { protected SheetVisitEventListener(SheetService sheetService) {
......
package run.halo.app.service;
/**
* Backup service interface.
*
* @author johnniang
* @date 19-4-26
*/
public interface BackupService {
}
package run.halo.app.service;
/**
* Recovery service interface.
*
* @author johnniang
* @date 19-4-26
*/
public interface RecoveryService {
}
package run.halo.app.service.impl;
import org.springframework.stereotype.Service;
import run.halo.app.service.BackupService;
/**
* Backup service implementation.
*
* @author johnniang
* @date 19-4-26
*/
@Service
public class BackupServiceImpl implements BackupService {
}
package run.halo.app.service.impl;
import org.springframework.stereotype.Service;
import run.halo.app.service.RecoveryService;
/**
* Recovery service implementation.
*
* @author johnniang
* @date 19-4-26
*/
@Service
public class RecoveryServiceImpl implements RecoveryService {
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册