2009年7月27日星期一

CMSEntity之二

com.qualcomm.bss.bsg.cms.job.ContentProcessorJob.execute会调用 com.qualcomm.bss.bsg.cms.process.ContentHandler.invokeProcess,我觉得 ContentHandler应该是真正干活的,它来解析map文件并把内容保存到数据库中。但是 ContentHandler.invokeProcess很简单,它调用了 ContentHandler.commonStorageHandling,在这个方法中对ISMPItemVO,ContentItemVO进行了一 番操作,但是也没看出头绪。

TerminalInfoLoadJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.init->com.qualcomm.bss.bsg.cms.job.TerminalInfoLoadJob.execute->com.qualcomm.bss.bsg.cms.job.TerminalInfoLoadJob.loadData

ContentFetcherJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.init->com.qualcomm.bss.bsg.cms.job.ContentFetcherJob.execute->com.qualcomm.bss.bsg.cms.process.ContentAdaptor.invokeProcess
->com.qualcomm.bss.bsg.cms.CDParserImpl.parseCDFile

ContentProcessorJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.init->com.qualcomm.bss.bsg.cms.job.ContentProcessorJob.execute->com.qualcomm.bss.bsg.cms.process.ContentHandler.invokeProcess->
com.qualcomm.bss.bsg.cms.process.ContentHandler.commonStorageHandling

ProductInfoFetchJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.init->com.qualcomm.bss.bsg.cms.job.ProductInfoFetchJob.execute->com.qualcomm.bss.bsg.cms.process.prodAdaptor.processProductFiles

ProductAdaptor里的方法大有可为,很多事情都是在ProductAdaptor里 面做的,看ProductAdaptor类前面的解释,它的功能包括:1,获取product info文件并保存到本地文件夹;2,解析product info文件并保存到数据库;3,获取product content文件并保存到本地文件夹;4,解析product content文件并将数据保存至数据库;5,获取charge info文件并保存到本地文件夹;6,解析charge info文件并将数据保存至数据库;
由此可见,三个map文件都是在ProductAdaptor类里处理的,所以有必要对ProductAdaptor类中的每个方法都细读。

ProductAdaptor.processProductFiles, 这个方法的功能是用ftp获取三个map文件,即product info,product content和charging info。这个方法里用到了类ProductFtpHandler,并对ProductParser类进行了实例化。ProductFtpHandler 是用来获取相应的map文件的,调用它的fetchProductInfoFilesfetchProductContentFilesfetchChargingInfoFiles就能获得相应的文件。每当获得相应的文件后,processProductFiles会调用方法来解析获得的文件,这些方法包括processProductInfoFileprocessProductContentFilesprocessChargingFiles,从名字就很好判断它们的作用。

前面提到processProductFiles实例化了ProductParser,这个类顾名思义,是用来解析product info文件的,但是看这个类的解释,又不仅仅是。ProductParser类只是一个接口,它的实现类是ProductParserImpl, 这个类最前面的注释说:“This class is used to parse product info ,Product content mapping , charging policy info files. Also creates price plan xml files.”,从这段注释可知这个ProductParserImpl不仅仅是解析product info文件,它把三个map文件都解析了,同时生成了price plan文件。前面提到的processProductInfoFileprocessProductContentFilesprocessChargingFiles方法都使用了ProductParser的实例来解析相应的文件。

ProcessProductInfoFile 先是调用了ProductParserImpl.parseProductFile解析product info文件,它的返回值是ProductInfoVO,然后ProcessProductInfoFile再调用 ProductDAO.addProductInfo将ProductInfoVO的信息写入到数据库中。
processProductContentFiles 处理product content文件,它的处理过程和ProcessProductInfoFile差不多,先是调用 ProductParserImpl.parseProductContentFile解析product content文件,返回值是ProductContentVO,在将ProductContentVO的信息保存到数据库之 前,processProductContentFiles还调用了applyProductContent方法,这个方法是“used to apply products to contents”,不知道是什么意思。但是看代码,这里是生成product和content的关系,这些关系都存放在contentProductAssocVO,这是一个很重要的对象,后面的操作要经常使用这个对象。然后ProcessProductInfoFile再调用ProductDAO.applyProductContent将ProductContentVO的信息写入到数据库中。
processChargingFiles的流程和前两个相似,不赘述。

ProductProcessJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.init->com.qualcomm.bss.bsg.cms.job.ProductProcessJob.execute->com.qualcomm.bss.bsg.cms.process.ProductHandler.processPricePlans

ProductHandler类是生从电信的那一套(也就是product,content,item和charging info)转换成BREW识别的一套(item和price handle)的关键。具体的实现与数据库非常相关,目前暂时还没研究。

ReleaseProcessJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.init->com.qualcomm.bss.bsg.cms.job.ReleaseProcessJob.execute->com.qualcomm.bss.bsg.cms.process.ReleaseHandler.invokeProcess

MasterSwitchJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.scheduleMasterSwitch->

FeedBackFileUpLoaderJob:
com.qualcomm.bss.bsg.cms.servicelayer.BSGCMSServlet.scheduleFeedBackUpLoadProcess->com.qualcomm.bss.bsg.cms.job.FeedBackFileUpLoaderJob

没有评论:

发表评论