
/**
 * 文件名   :   GfsServiceImpl.java
 * 版权       :   <版权/公司名>
 * 描述       :   <描述>
 * @author  chen
 * 版本       :   <版本>
 * 修改时间：      2016年9月8日
 * 修改内容：      <修改内容>
 */
package com.platform.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.platform.entities.Brick;
import com.platform.entities.FolderNode;
import com.platform.entities.VolumeDataEntity;
import com.platform.http.gfs.CopyData;
import com.platform.glusterfs.GetTreeData;
import com.platform.glusterfs.VolumeInfo;
import com.platform.service.IGfsService;
import com.platform.utils.CacheTreeData;
import com.platform.utils.ThreadVolume;
import com.platform.utils.getTreeDataByPath;

/**
 * <一句话功能简述> gfs功能实现类
 * <功能详细描述>
 * @author    chen
 * @version   [版本号，2016年9月8日]
 * @see       [相关类/方法]
 * @since     [产品/模块版本]
 */
@Service(value = "gfsService")
public class GfsServiceImpl implements IGfsService {
	
	/** gfs目录树形查询  */
	private getTreeDataByPath getFolder = new getTreeDataByPath();

	/** 数据迁移实现  */
	private CopyData copydata = new CopyData();
	
	/**  Volume信息查询  */
	private VolumeInfo volumeInfo = new VolumeInfo();

	@Override
	public FolderNode getFolder(String path) {
		FolderNode result = getFolder.findByPath(path);
		return result;
	}

//	@Override
//	public int copyFolder(List<String> srcFolders, String dstFolder, String name)
//			throws Exception {
//		int status = 0 ;
//		if (null != srcFolders) {
//			
//			for (String string : srcFolders) {
////				status	= copydata.copyFolderFilesAnyway(string, dstFolder, name);
//			}
//		}
//		return status;
//	}

	/* (non-Javadoc)
	 * @see com.platform.service.IGfsService#getAllVolume()
	 */
	@Override
	public List<VolumeDataEntity> getAllVolumes() throws Exception {
		List<VolumeDataEntity> volumeList = CacheTreeData.getVolumeList();
		return volumeList;
	}

	@Override
	public VolumeDataEntity getOneVolume(String volumeName) throws Exception {
		List<VolumeDataEntity> volumeList = CacheTreeData.getVolumeList();
		VolumeDataEntity volume = new VolumeDataEntity();
		for (VolumeDataEntity volumeEntity : volumeList) {
			if (volumeName.equals(volumeEntity.getPath())) {
				volume = volumeEntity;
			}
		}
		return volume;
	}
//
//	@Override
//	public int moveData(String volumeName, String srcPath, String dstPath)
//			throws Exception {
//		
//        int result = 0;
//				result = copydata.copyFolder(srcPath, dstPath, "app");
//		return result;
//	}

	@Override
	public int deleteData(String volumeName, String srcPath) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

}
