ThumbnailDesign.docx
《ThumbnailDesign.docx》由会员分享,可在线阅读,更多相关《ThumbnailDesign.docx(26页珍藏版)》请在冰豆网上搜索。
ThumbnailDesign
EngineeringSpec
Task14294
Thumbnail
DMS:
1.2
WebExConfidentialInformation
ThisdocumentcontainsconfidentialinformationbelongingtoWebExCommunications,Inc.("WebEx").YoucannotaccessthisdocumentunlessyouareaWebExemployeeandhavebeenexpresslyauthorizedbyyoursupervisortohavesuchaccess.Youcannotdisclose,copy,display,orotherwisecommunicatethecontentsofthisdocumentexcepttootherWebExemployeeswhohavebeenauthorizedtoaccessthedocument
RevisionHistory
Name
Date
Release
ChangeHistory
SivaLiu
12/14/2009
DMS1.2
InitialVersion
SivaLiu
1/4/2010
TableofContents
1Introduction4
1.1Background4
1.2Purpose4
1.3Reference4
2FeatureIntroduction4
2.1Whichfileformatsneedtosupport?
4
2.2Whatsizeofathumbnailoftheneedtosupport?
4
2.3Howtotestinggetthumbnaildatatime?
4
2.4Whichcommandneedstochange?
5
3Design5
3.1Overalldesign5
3.2Workflow6
3.3Detaildesign7
3.3.1Interfacedefine7
3.3.2Mainclassdiagram8
3.3.3Sequencediagram9
3.3.4Relatedfile12
3.4DB14
3.5JCR14
4Dependencies15
5Implementation15
6Issues15
7Test15
7.1Testdata15
7.2Testrecommendation15
8Influencingtask15
9Security16
9.1Authenticationandauthorization16
9.2Authenticationandauthorizationtable16
9.3InformationConfidentiality,PrivacyandIntegrity16
9.4Programmingsecurity17
9.3.1Checklist17
9.5Inputvalidationtable19
9.6Logging/Errorhandling/Audittrail19
9.3.1Checklist19
9.3.2Environmentdependency/configuration20
9.3.3Checklist20
10Q&A20
Introduction
1.1Background
Before1.2,wehavealreadyhadthumbnailfeatureworkedinfiletabinspace,itsupports.jpg,.jpeg,.jpe,.pngand.giffileextensionanddoesnotsupport.bmpfiletype.Thebigissueofthepreviousthumbnailislowperformance.WhenrequestcomesfromclienttoDMSserverandappendwithparameter_wand_h,serverwillreadwholeimageandcalculateandgeneratethethumbnailimage,ifOriginalimageisverylarge,thespeedisveryslow.
1.2Purpose
●Itprovidesanotherapproachtoimproveperformance.
●Support.bmpfiles
Performancerequirements:
Getthumbnaildatatime<0.3s(thumbnailnodeexist)
1.3Reference
Release
TaskNumber
Memo
Spec
Mockup
RelatedSpec
DMS1.2
14294
13116
WBX0263203
N/A
FeatureIntroduction
1.4Whichfileformatsneedtosupport?
●"jpg","jpeg","bmp","png","gif","jpe"
1.5Whatsizeofathumbnailoftheneedtosupport?
WesupportallsizesThumbnail.Ifthumbnailsizeis50*50or128*128havethehighestperformance.
CurrentUsedSizeasfollow:
application
Thumbnailsize(width,height)
Athena|connect
128,128(Profile)
Athena|Artemis
50,50
ConnectList
32,32
ConnectDetailList
48,48
Connect
16,16
1.6Howtotestinggetthumbnaildatatime?
ReferenceFileSize
(usetxtfile)
Getthisfile’sresponsetime
ImageFileSize
Correspondingthumbnail
Getthisthumbnail’sresponsetime
getthumbnaildatatime
1K
A16
<500k|<1M|<5M|>5M
16*16
B16
B16-A16
1.5K
A32
<500k|<1M|<5M|>5M
32*32
B32
B32-A32
1.8K
A48
<500k|<1M|<5M|>5M
48*48
B48
B48-A48
2K
A50
<500k|<1M|<5M|>5M
50*50
B50
B50-A50
4.5K
A128
<500k|<1M|<5M|>5M
28*128
B128
B128-A128
1.7Whichcommandneedstochange?
Webdavcommand:
Get:
Wereturn_w*_hsizethumbnail.
Imagefilesize
parameter
resultsize
256*128
w=35.5,h=32
Errorcode412
256*128
w=32,h=35.5
Errorcode412
256*128
w=35.5,h=34.5
Errorcode412
256*128
w=-1,h=32
256*128
256*128
w=32,h=-1
256*128
256*128
w=-1,h=-1
256*128
256*128
w=32,h=32
32*16
256*128
w=50,h=32
50*25
256*128
w=32,h=50
32*16
Iftheimage’scontentformatiserror.IwillreturnErrorcode204
Put:
Addparameter“_thumbsizes”.
_thumbsizes:
Splitthumbnailsizewithcomma
Suchas:
_thumbsizes=50,128(generatethumb50andthumb128resourcenode.)
_thumbsizes
Thumbnailnode
SaveContentnode
ResponseStatus
50,128
thumb50,thumb128
Yes
201
-1,23,50
Yes
201
-1.50.23
thumb50
Yes
201
50;128
Yes
201
Design
Addedlogictousepink,updatedlogictousegreen
1.8Overalldesign
FrameworkDiagram
Getthumbnailnewlogic
●Whenweuploadfilesorfirstgetthethumbnail,wesavethefixed-sizethumbnails(50*50or128*128)
●Whenwesecondgetthethumbnail,ifweneededthethumbnailsizelessthansavedthumbnail,thenwegetthethumbnailbaseonsavedthumbnail.Otherwisewegetthethumbnailbaseonoriginalfile.
FileNode’sdatastructure
Addednodeusepink
ThumbnailNode:
NodeTypeis{
Properties:
jcr:
mimeType
jcr:
data
jcr:
lastModified
wbxc:
filesize
3.2Workflow
Put:
Get:
_wand_hvaliditylogic:
If_w==_hand_wis128or50,thenreturntrue,otherwisereturnfalse.
Needloadthumb50logic:
1.If_w>_hthenmaxsizeequalto_w,otherwisemaxsizeequalto_h.
If_w!
=_hthenIsSquareisfalseotherIsSquareistrue.
2.Ifmaxsize<50,thenreturntrue,ifmaxsizeis50andIsSquareisfalse,thenreturntrue,otherwisereturnfalse.
Needloadthumb128logic:
1.If_w>_hthenmaxsizeequalto_w,otherwisemaxsizeequalto_h.
If_w!
=_hthenIsSquareisfalseotherIsSquareistrue.
2.Ifmaxsize<128,thenreturntrue,ifmaxsizeis128andIsSquareisfalse,thenreturntrue,otherwisereturnfalse.
3.3Detaildesign
1.3.1Interfacedefine
AddedInterface:
InterfaceThumbnailManager
/**
*saveThumbnailFiles
*/
ListsaveThumbnailFiles(Stringthumbsizes,
InputStreaminputStream,Stringsrcfile)throwsException;
/**
*getThumbnail
*/
InputStreamgetThumbnail(intwidth,intheight,UUIDparentId,
Stringsrcfile)throwsException;
/**
*getAddBundlelist
*/
ListgetAddBundlelist(ListthumbVOlist,
UUIDparentId)throwsException;
UpdateInterface
InterfaceDavResource
Addnewmethod.
/**
*addMemberForThumb
*/
publicvoidaddMemberForThumb(DavResourceresource,InputContext
inputContext,Stringthumbsize)throwsDavException;
/**
*spoolForThumbnail
*/
publicvoidspoolForThumbnail(OutputContextoutputContext,intwidth,
intheight)throwsIOException;
InterfaceDavNodeManager
Addnewmethod.
/**
*save
*/
publicbooleansave(Principalprincipal,DavNodedavNode,String
thumbsizes)throwsException;
/**
*getThumbnail
*/
publicInputStreamgetThumbnail(UUIDuuid,Stringpath,intwidth,
intheight)throwsException;
1.3.2Mainclassdiagram
Mainclass:
Thumbnailmanagercla
1.3.3Sequencediagram
Putcommand
Sequencediagram
Getcommand
Sequencediagram
Case1:
customerthumbsizeis128*128or50*50,thumbsize’snodeexistinDB.
Case2:
customerthumbsizeis128*128or50*50,thumbsize’snodenotexistinDB.
Case3:
customerthumbsizeis64*64,weneedsavethumb128node.
_getImagInputStreamBySizeincludesavefileandsavethumbnodelogic.
Case4:
customerthumbsizeis32*32,weneedsavethumb50node.
SamewithCase3
Case5:
customerthumbsizeis150*75,wedonotneedsavethumb50/thumb128node.
1.3.4Relatedfile
AddedFile:
Changedfile:
WBXCDataStore
MethodName
Add/Update
Type
Comments
createTempThumbFile
(BufferedImagebi,StringrootPath)
Add
public
BaseonbufferedImagecreatetempthumbnailfile
DavResourceImpl
MethodName
Add/Update
Type
Comments
addMemberForThumb
(DavResourcemember,InputContextinputContext,
Stringthumbsize)
Add
public
Savecontentandthumbnailfile
spoolForThumbnail
(OutputContextoutputContext,intwidth,intheight)
Add
public
Getthumbnailcontent
SimpleWebdavServlet
MethodName
Add/Update
Type
Comments
spoolThumbnail
update
private
spoolthumbnail
doPost
update
protected
Ifhavethumbnailsize,weaddsavethumbnaillogic
AbstractWebdavServlet
MethodName
Add/Update
Type
Comments
doPut
update
protected
Ifhavethumbnailsize,weaddsavethumbnaillogic
DavNodeManagerImpl
MethodName
Add/Update
Type
Comments
save
Add
public
SavecontentandthumbnailfileandDB
(ifcontentexist,weneedremovethumbnailnode)
getThumbnail
(UUIDparentID,Stringpath,intwidth,intheight)
Add
public
Getthumbnailcontent
Note:
Ifdeleteresourcedata,wewilldeletethumbnode.–Task14289WangChaodoesit.
3.4DB
Table:
WBXC_CORE_WRK_BUNDLE
NODE_PARENTID
NODE_ID
NODE_TYPE
NODE_NAME
85da345f-ac2d-4f1c-858a019f3a02aac2
70c1fb20-ac2d-4f1c-858a019f3a02aac2
{
content
67e4fb20-ac2d-4f1c-45d3019f3a02aac2
{
thumb50
67c1fb20-ac2d-4f1c-45d3019f3a02aac2
{
thumb128
3.5JCR
Thumb50andthumb128nodewillnotbeindexedandbesearchout.
Thumb50andthumb128NodeTypeis{
Dbpatchtoaddthenodedefinitionin:
'jcr:
thumb50':
InsertintoWBXC_CORE_REP_NODE_DEF
(NODE_TYPE_NAME,NODE_DEF_NUMBER,NODE_DEF_NAME,DEFAULT_PRIMARY_TYPE,AUTO_CREATED,
MANDATORY,ON_PARENT_VERSION,PROTECTED,SAME_NAME_SIBS)
Values
('nt:
file',1,'jcr:
thumb50','',0,0,1,0,0);
InsertintoWBXC_CORE_REP_REQUIRED_TYPE
(NODE_TYPE_NAME,NODE_DEF_NUMBER,REQUIRED_PRIMARY_TYPE)
Values
('nt:
file',1,'nt:
base');
'jcr:
thumb128'
InsertintoWBXC_CORE_REP_NODE_DEF
(NODE_TYPE_NAME,NODE_DEF