




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
開發(fā)文件列表功能一、目錄21.技術(shù)原理2.效果圖預(yù)覽3.實(shí)現(xiàn)步驟4.功能驗(yàn)證測(cè)試二、技術(shù)原理3(1)視圖層:展示所有文件信息(2)控制層:接收視圖層的消息,向服務(wù)層發(fā)送文件列表參數(shù),并將服務(wù)層返回的結(jié)果發(fā)送到視圖層(3)服務(wù)層:獲取當(dāng)前賬號(hào)的云存儲(chǔ)對(duì)象,將獲取到的云存儲(chǔ)對(duì)象轉(zhuǎn)換為本地模擬文件系統(tǒng)4三、效果預(yù)覽圖5在cn/edu/sict/cloud/storage/sh/bean文件夾下創(chuàng)建FileBean.javapublic
classFileBean{private
boolean
isdirectory;//是否是目錄private
boolean
haschild;//是否有子文件夾privateStringname;//文件名稱privateStringpath;//文件路徑privateStringlength;//文件大小privateStringlastmodified;//最后修改時(shí)間privateStringfilepath;//如果是文件,存放文件的臨時(shí)路徑public
booleanisHaschild(){return
haschild;}public
voidsetHaschild(boolean
haschild){this.haschild=haschild;}public
booleanisIsdirectory(){return
isdirectory;}public
voidsetIsdirectory(boolean
isdirectory){this.isdirectory=isdirectory;}publicStringgetFilepath(){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;}四、步驟實(shí)現(xiàn)6在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);if(!flag){fb.setLength(obj.getSizeInBytes());}fb.setLastmodified(DateUtil.cstToHMS(obj.getLastModified()));list.add(fb);}return
list;}四、步驟實(shí)現(xiàn)7在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]+"/";}}else{path+=strPath[i]+"/";}}}Mapmap=newHashMap();map.put("rootPath",rootPath);map.put("path",path);return
map;}四、步驟實(shí)現(xiàn)8在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;}}四、步驟實(shí)現(xiàn)9在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;}四、步驟實(shí)現(xiàn)10在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;}四、步驟實(shí)現(xiàn)11在main.jsp的table標(biāo)簽中添加如下代碼<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}"><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>四、步驟實(shí)現(xiàn)12在main.jsp的table標(biāo)簽中添加如下代碼</c:if></span><divclass="edit-name"style="display:none;"><inputclass="box"type="text"value="${}"><aclass="sure
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國(guó)熱水器進(jìn)出水接口數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 石油化工管道安裝安全規(guī)范教育
- 農(nóng)村瓦工合同范本
- 搬遷物品合同范本
- 供應(yīng)鏈合作居間協(xié)議
- 2024年廈門市集美區(qū)蔡林學(xué)校數(shù)學(xué)教師招聘考試真題
- 會(huì)議費(fèi)用預(yù)算審核協(xié)議
- 影樓入股合同范本
- 2024年南平武夷山國(guó)家公園管理局招聘考試真題
- 獸藥原料銷售合同范本
- 安徽省歷年中考語(yǔ)文現(xiàn)代文閱讀之非連續(xù)性文本閱讀6篇(截至2024年)
- GB/T 23694-2024風(fēng)險(xiǎn)管理術(shù)語(yǔ)
- 2025年北京青年政治學(xué)院高職單招高職單招英語(yǔ)2016-2024年參考題庫(kù)含答案解析
- 《典型的光器件AWG》課件
- 出血熱知識(shí)培訓(xùn)課件
- 廣東省汕頭市潮南區(qū)2024-2025學(xué)年高一上學(xué)期期末教學(xué)質(zhì)量監(jiān)測(cè)英語(yǔ)試卷(無答案)
- 2024年度工業(yè)自動(dòng)化設(shè)備維護(hù)保養(yǎng)及上門維修合同3篇
- 2025年公司總經(jīng)理年終總結(jié)工作報(bào)告
- 安徽省“江淮十校”2024屆高考化學(xué)一模試卷含解析
- 圖書外借服務(wù)計(jì)劃
- 軟考系統(tǒng)集成項(xiàng)目管理工程師教程完整版
評(píng)論
0/150
提交評(píng)論