




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
云存储文件列表功能目录技术原理实现步骤功能描述功能测试2技术原理3(1)视图层:展示所有文件信息(2)控制层:接收视图层的消息,向服务层发送文件列表参数,并将服务层返回的结果发送到视图层(3)服务层:获取当前账号的云存储对象,将获取到的云存储对象转换为本地模拟文件系统功能描述4实现步骤5在cn/edu/sict/cloud/storage/sh/bean文件夹下创建FileBean.javapublic
classFileBean{private
boolean
isdirectory;//是否是目录private
boolean
haschild;//是否有子文件夹privateStringname;//文件名称privateStringpath;//文件路径privateStringlength;//文件大小privateStringlastmodified;//最后修改时间privateStringfilepath;//如果是文件,存放文件的临时路径public
booleanisHaschild(){return
haschild;}public
voidsetHaschild(boolean
haschild){this.haschild=haschild;}public
booleanisIsdirectory(){return
isdirectory;}public
voidsetIsdirectory(boolean
isdirectory){this.isdirectory=isdirectory;}实现步骤6在cn/edu/sict/cloud/storage/sh/bean文件夹下创建FileBean.javapublicStringgetFilepath(){return
filepath;}public
voidsetFilepath(Stringfilepath){this.filepath=filepath;}publicStringgetLength(){return
length;}public
voidsetLength(long
length){this.length=UtilTools.convertFileSize(length);}publicStringgetLastmodified(){return
lastmodified;}public
voidsetLastmodified(Stringlastmodified){this.lastmodified=lastmodified;}publicStringgetName(){return
name;}public
voidsetName(Stringname){=name;}publicStringgetPath(){return
path;}public
voidsetPath(Stringpath){this.path=path;}}实现步骤7在cn/edu/sict/cloud/storage/sh/文件夹下swiftDFS.java添加如下代码publicListgetFile(Stringrpath){Mapmappath=this.getSplitPath(rpath);StringrootPath=mappath.get("rootPath").toString();Stringpath=mappath.get("path").toString();List<?extendsSwiftObject>objs=this.list(rootPath,path);Listlist=newArrayList();for(SwiftObjectobj:objs){FileBeanfb=newFileBean();StringfilePath=obj.getName();fb.setPath(filePath);fb.setName(this.getName(filePath));boolean
flag=this.isDirectory(filePath);fb.setIsdirectory(flag);实现步骤8在cn/edu/sict/cloud/storage/sh/文件夹下swiftDFS.java添加如下代码if(!flag){ fb.setLength(obj.getSizeInBytes());}fb.setLastmodified(DateUtil.cstToHMS(obj.getLastModified()));list.add(fb);} return
list;}实现步骤9在cn/edu/sict/cloud/storage/sh/文件夹下swiftDFS.java添加如下代码privateMap<String,String>getSplitPath(Stringpath){String[]strPath=path.split("/");StringrootPath="";path="";for(int
i=0;i<strPath.length;i++){if(i==0){rootPath=strPath[0];}else{if(i==strPath.length-1){if(strPath[i].contains(".")){path+=strPath[i];}else{path+=strPath[i]+"/";}实现步骤10在cn/edu/sict/cloud/storage/sh/文件夹下swiftDFS.java添加如下代码}else{path+=strPath[i]+"/";}}}Mapmap=newHashMap();map.put("rootPath",rootPath);map.put("path",path);return
map;}实现步骤11在cn/edu/sict/cloud/storage/util文件夹下新建ComparatorFile.javapublic
classComparatorFileimplementsComparator<FileBean>{publicComparatorFile(){}public
intcompare(FileBeanf1,FileBeanf2){boolean
f1dir=f1.isIsdirectory();boolean
f2dir=f2.isIsdirectory();if(f1dir&&f2dir){return0;}else
if(!f1dir&&f2dir){return1;}else
if(f1dir&&!f2dir){return-1;}else
if(!f1dir&&!f2dir){return0;}return0;}}实现步骤12在cn/edu/sict/cloud/storage/service/SwiftStorageService.java添加如下代码publicListgetAllStoredList(Stringusername,Stringpath){SwiftDFSswiftdfs=newSwiftDFS();Stringup=null;up=username+"/"+path;Listlist=swiftdfs.getFile(up);ComparatorFilecomparator=newComparatorFile();
if(!list.isEmpty()){
synchronized(list){Collections.sort(list,comparator);
}
}return
list;}实现步骤13在cn/edu/sict/cloud/storage/Web/StorageController.java添加如下代码@RequestMapping("/home")publicModelAndViewhome(HttpServletRequestrequest,HttpServletResponseresponse,Stringpath){ModelAndViewview=newModelAndView();Useruser=getSessionUser(request);path=UtilTools.converStr(path);Listlist=storage.getAllStoredList(user.getUsername(),path);view.addObject("path",path);view.addObject("search","false");view.addObject("list",list);view.setViewName("/main");view.addObject("type",0);return
view;}实现步骤14在main.jsp的table标签中添加如下代码<tbodyid="tab"><c:forEachvar="fb"items="${list}"><tr><tdstyle="top:-6px;position:relative;left:13px;"><labelclass="checkboxtable-checkboxposition"for="checkbox1"><spanclass="iconsmain-icons">
<spanclass="first-iconfui-checkbox-unchecked"></span>
<spanclass="second-iconfui-checkbox-checked"></span></span>
<inputtype="checkbox"name='check'class="main-tabinput"onclick="show()"></label></td><td><spanstyle="display:block"><c:iftest="${fb.isdirectory==true}">实现步骤15在main.jsp的table标签中添加如下代码<imgsrc="assets/images/0.png"class="objimg"><a
href="home.action?path=${fb.path}"><inputname="objimg"type="text"style="display:none"value="${}"></c:if>${}<c:iftest="${fb.isdirectory==true}"></a>实现步骤16在main.jsp的table标签中添加如下代码</c:if></span><divclass="edit-name"style="display:none;"><inputclass="box"type="text"value="${}"><aclass="sure"
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年锌银蓄电池项目规划申请报告
- 2025年月子中心项目申请报告
- 2025湖南怀化市红花园投资开发有限公司招聘10人考前自测高频考点模拟试题带答案详解
- 工程建设质量长期承诺书(5篇)
- 2025年城东区面向社会公开招聘公共服务岗位聘用人员模拟试卷及答案详解(夺冠)
- 2025江苏徐州市新沂市招聘医务人员17人考前自测高频考点模拟试题有答案详解
- 难忘的志愿者服务活动发言稿7篇
- 山东省部分学校2024-2025学年高二下学期5月校际联考地理试题(解析版)
- 辽宁省重点中学协作校2024-2025学年高一下学期期末考试地理试题 (解析版)
- 2025广西蒙山县城南新区国有资产委托经营招募模拟试卷及参考答案详解1套
- 跨境电子商务实务PPT完整全套教学课件
- 广告词写作 高教版中职语文职业模块工科类
- 工程制图习题集第四版答案高等教育出版社
- 设计思维方法与表达(高职艺术设计)PPT完整全套教学课件
- 萍乡社区工作者考试真题及答案2022
- (苏教版)四年级数学上册口算训练册
- 膝关节周围骨折术后康复
- GB/T 8713-1988液压和气动缸筒用精密内径无缝钢管
- 导视系统设计课件
- 普通高中化学新教材《化学反应原理》培训讲座(2020年人教版)课件
- 风力发电原理优质课件
评论
0/150
提交评论