|
|
|
|
|
package com.platform.controller;
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
|
import com.base.BaseController;
|
|
|
import com.platform.entities.VolumeDataEntity;
|
|
|
import com.platform.service.IGfsService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* <一句话功能简述>
|
|
|
* <功能详细描述>
|
|
|
* @author chen
|
|
|
* @version [版本号,2016年9月8日]
|
|
|
* @see [相关类/方法]
|
|
|
* @since [产品/模块版本]
|
|
|
*/
|
|
|
@Controller
|
|
|
|
|
|
@RequestMapping("")
|
|
|
public class FolderController extends BaseController {
|
|
|
|
|
|
public static Logger log = Logger.getLogger(FolderController.class);
|
|
|
|
|
|
@Resource(name = "gfsService")
|
|
|
private IGfsService gfsService;
|
|
|
|
|
|
/** 获得目录
|
|
|
* @param path
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@RequestMapping(value="/getAllSubPathByPath", method= RequestMethod.POST)
|
|
|
public Object getAllSubPathByPath(String path) throws Exception {
|
|
|
log.info(path);
|
|
|
Object result = null;
|
|
|
if (null != path && !"".equals(path)) {
|
|
|
log.info(path);
|
|
|
result = gfsService.getFolder(path);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/** 复制
|
|
|
* @param srcpath
|
|
|
* @param dstPath
|
|
|
* @param name
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@RequestMapping("/copyFolder")
|
|
|
public Object copyFolder(String srcpath, String dstPath, String name) throws Exception {
|
|
|
// -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right
|
|
|
int result = 0;
|
|
|
log.info(srcpath);
|
|
|
log.info(dstPath);
|
|
|
String obj = "right";
|
|
|
|
|
|
if (1 != result) {
|
|
|
obj = "err";
|
|
|
}
|
|
|
return obj;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <一句话功能简述> 查询集群中所有的 volume 及其 信息
|
|
|
* <功能详细描述>
|
|
|
* @param volumeName "/home/gfs_ftp_point" "/home/v1_point"
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
* @see [类、类#方法、类#成员]
|
|
|
*/
|
|
|
@RequestMapping(value="/volume/findByName", method= RequestMethod.POST)
|
|
|
public Object getVolumByName(String volumeName) throws Exception{
|
|
|
log.info(volumeName);
|
|
|
VolumeDataEntity result = gfsService.getOneVolume(volumeName);
|
|
|
return result;
|
|
|
}
|
|
|
}
|