majorto

tooogooo  时间:2021-02-05  阅读:()
CopyrightIBMCorporation2009TrademarksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage1of7J2MEPersonalInformationManagement(PIM)-AnOverviewProvidingtheabilitytoaccessthenativepersonaldataonmobiledevicesSomaGhoshDecember07,2009ThePersonalInformationManagement(PIM)API,asdefinedbyJSR75,providesawaytoaccessthenativepersonaldataonthemobiledevices,beittheContacts,TasksorAppointments.
Inthisarticle,wewillhaveacloselookattheAPI,discussthedevelopment,securityanddeploymentconsiderationsofaPIMMIDletandcomparePIMwithanotherJ2MEAPI,theRecordManagementStore(RMS).
PersonalInformationManagement(PIM)inmobileenvironmentAsnewdevicesmaketothemarket,theavailabilityofAddressBook,CalendarandTasklistonmobiledevicesisabarenecessity.
TheJ2MEapplicationsalsofeeltheneedtohaveaccesstothesedata.
TheoptionalpackageJSR75PersonalInformationManagement(PIM)packageprovidesthiscapability.
Itnotonlyallowstheaccesstonativepersonalinformationwhichcomprisescontacts,appointmentsandtasks,alsotoinformationbasedonSIMcardsattachedtodevices,LocalandRemotePersonalInformationdatabases.
ThePIMpackagehascapabilitytoexportandimportofdatafromvCardandvCalendar,theInternetstandardformatsforAddressBookandCalendarrespectively.
Italsohasthesecurityfeaturestopreventunauthorizedclassesfromretrievingpersonalinformation.
Theotheroptionalpackage,JSR75FileConnectionprovidesawaytoaccessthenativefilesystemwhichisoutofscopeforourdiscussion.
TheJ2MEPIMpackageTheJavaPIMpackageisrepresentedbythejavax.
microedition.
pimpackage.
Thesignificantinterfacesdefinedbythispackageare:developerWorksibm.
com/developerWorks/J2MEPersonalInformationManagement(PIM)-AnOverviewPage2of71.
Contact–ThisInterfacerepresentsasinglecontactontheAddressBook.
2.
ContactList–ThisInterfacerepresentsAddressBookwhichisalistofContacts.
3.
Event–ThisInterfacerepresentsasingleCalendarEvent.
4.
EventList–ThisInterfacerepresentsalistofCalendarevents.
5.
ToDo–ThisInterfacerepresentsasingleTaskintheTaskList.
6.
ToDoList–ThisInterfacerepresentstheTasklist.
Themajorclassdefinedbythispackageis:PIM–ThePIMclassdefinesmethodsthatcancreateanindexofallexistingLists,openandeditthoselistsaswellasimportandexportfromInternetstandardformatsforContactandCalendar,thevCardandvCalendar.
ContactandContactListAContactrepresentsasingleentryintheAddressBook.
ThemajorfieldsinaContactareName,Address,Email,Birthday,PhotoandTelephone.
Inordertoensureportabilityacrossplatforms,itisadvisabletousethemethodisSupportedField()providedbySuperInterfacePIMList.
Listing1,belowshowshowaContactcanbeaddedtoAddressBook:Listing1.
AddContacttoAddressBookContactListaddressBook=null;try{addressBook=(ContactList)PIM.
getInstance().
openPIMList(PIM.
CONTACT_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){//ExitApplication}ContactsingleContact=addressBook.
createContact();String[]name=newString[addressBook.
stringArraySize(Contact.
NAME)];if(addressBook.
isSupportedField(Contact.
NAME_FORMATTED)singleContact.
addString(Contact.
NAME_FORMATTED,PIMItem.
ATTR_NONE,"Mrs.
JaneDoe");ThecreateContact()methodcreatesatemporaryemptyContact.
Acommit()callmakestheContactdatapersistent.
Itisadvisabletoclosethelistsbyinvokingtheclose()methodafternecessaryoperationshavebeenperformed.
try{singleContact.
commit();}catch(PIMExceptione){//Exceptionoccured}try{//OthercleanuptasksaddressBook.
close();}catch(PIMExceptione){}ibm.
com/developerWorks/developerWorksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage3of7EventandEventListAnEventrepresentsasingleentryintheEventdatabase,forexample;calendaronthemobiledevice.
ThecriticalfieldsareLocation,Summary,Startdate,EndDateandAlarmnotification.
Listing2showshowanEventcanbeaddedtotheEventdatabase.
Listing2.
AddanEventEventListeventList=null;try{eventList=(EventList)PIM.
getInstance().
openPIMList(PIM.
EVENT_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){return;}EventsingleEvent=eventList.
createEvent();if(eventList.
isSupportedField(Event.
SUMMARY))singleEvent.
addString(Event.
SUMMARY,PIMItem.
ATTR_NONE,"JavaTraining");if(eventList.
isSupportedField(Event.
START))singleEvent.
addDate(Event.
START,PIMItem.
ATTR_NONE,aDate.
getTime());if(eventList.
isSupportedField(Event.
END))singleEvent.
addDate(Event.
END,PIMItem.
ATTR_NONE,aDate.
getTime());try{singleEvent.
commit();}catch(PIMExceptione){//Anerroroccured}try{eventList.
close();}catch(PIMExceptione){}ToDoandToDoListTheToDointerfacerepresentsasingletaskontheTaskdatabaseonthemobiledevice.
TheimportantfieldsareNoteorSummary,Priority,CompletionDate,DueDateandwhethercompleted.
Listing3showshowaToDocanbepersistentlyaddedtothedatabase.
Listing3.
AddaTaskToDoListtasks=null;try{tasks=(ToDoList)PIM.
getInstance().
openPIMList(PIM.
TODO_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){//Anerroroccurredreturn;}ToDosingleTask=tasks.
createToDo();if(tasks.
isSupportedField(Event.
SUMMARY))singleTask.
addString(ToDo.
SUMMARY,PIMItem.
ATTR_NONE,"ShoppingforHalloween");if(tasks.
isSupportedField(Event.
DUE))singleTask.
addDate(ToDo.
DUE,PIMItem.
ATTR_NONE,newDate().
getTime());try{singleTask.
commit();}catch(PIMExceptione){//Anerroroccured}try{tasks.
close();}catch(PIMExceptione){developerWorksibm.
com/developerWorks/J2MEPersonalInformationManagement(PIM)-AnOverviewPage4of7}HowPIMdiffersfromRMSBeforegoingfurtheronthisdiscussion,letusreviewtheconceptofRecordManagementStore(RMS),anotherkeyfunctionalitybyJ2ME.
RMSallowsJ2MEapplicationstopersistentlystoredatalocally.
ThecomponentsofRMSareasfollows:Records–UnliketheDatabasesystemswhereeachrecordhasoneormorefields,aRecordinRMSisanindividualdatafield.
Itdoesnothaveapre-defineddatatypeorsizeandcancontainanydata.
RecordStore–ARecordStoreisacollectionofRecordsandisaccessiblefromJ2MEapplicationsbyname.
ThisishowPIMdiffersfromRMSwhilebothareresponsibleforstoringpersistentdataonthedevice.
1.
PIMstoresandretrievesdatatoandfromdefinedentitiesliketheAddressBook,CalendarandTaskList.
RMS,ontheotherhand,storesdatatoandretrievesdatafromageneraldatabase.
AsingleentityinPIMisaContact,CalendarentryoraTaskwhileinRMS,it'sabytearray.
2.
PIMisnotrestrictedtothelocaldevice.
ItcanaccessdatafromanattachedSIMoranotherremotedevice.
RMSonlyaccessesdatatoandfromlocaldevice.
3.
PIMcanexportandimportfromexternalsourceslikevCalendarorvContact.
RMSdoesnothaveanyExportorImportcapabilities.
4.
TheinterpretationofdatainPIMismoreflexiblecomparedtoRMS.
Say,aContact,definedinastandardformat,canalwaysbeinterpretedbyanotherJ2MEapplicationwithease.
ArecordinRMSisabytearrayandotherJ2MEapplicationswillneedtohaveinformationonhowtointerpret.
Anexample–AddacontactInthissection,wewilldiscussamethodmentionedasaddContact()onhowtoaddacontacttotheAddressBook.
ThismethodasinCode-4canbeinvokedinaseparatethreadwhenausercommandissubmittedontheform.
ThismethodaccessesdataenteredthroughUITextfields.
Listing4.
addContact()method//Importimportjavax.
microedition.
lcdui.
*;importjavax.
microedition.
midlet.
*;importjavax.
microedition.
pim.
*;//TextinputTextFieldnameField;TextFieldphoneField;…publicvoidaddContact(){ibm.
com/developerWorks/developerWorksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage5of7ContactListcontacts=null;try{contacts=(ContactList)PIM.
getInstance().
openPIMList(PIM.
CONTACT_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){//Anerroroccurrede.
printStackTrace();}Contactcontact=contacts.
createContact();String[]name=newString[contacts.
stringArraySize(Contact.
NAME)];if(contacts.
isSupportedArrayElement(Contact.
NAME,Contact.
NAME_GIVEN))name[Contact.
NAME_GIVEN]=nameField.
getString();if(contacts.
isSupportedField(Contact.
TEL))contact.
addString(Contact.
TEL,Contact.
ATTR_HOME,phoneField.
toString());try{contact.
commit();}catch(Exceptione){}}RuntimeandsecurityconsiderationsThePIMMIDletshouldberuninaconfigurationthatsupportsPIMi.
e.
JSR75.
WeselectedthebelowsettingsonSun'sWirelessToolkit2.
5byclickingSettingsandthenAPISelection.
ThesameappliestoselectionofmobiledevicesforPIMMIDlettorun.
developerWorksibm.
com/developerWorks/J2MEPersonalInformationManagement(PIM)-AnOverviewPage6of7Figure1.
PIMMIDletRuntimeAPISelectionTheMIDletwillrequireadditionalpermissionswhileattemptingtoreadandwritetheContacts,CalendarorTaskLists.
ThiscanbeaccomplishedbyclickingSettingsandselectingPermissionsfromtheWirelesstoolkit.
AlltheReadandWritepermissionsforContactList,EventListandTodoListhavebeenprovided.
ibm.
com/developerWorks/developerWorksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage7of7Figure2.
PIMMIDletSecurityconsiderationsConclusionInthisarticlewediscussedaboutanotherimportantfunctionalityinJ2MEcalledPersonalInformationManagement(PIM)thatallowsaccesstothenativedataonthemobiledeviceintheformofContact,TaskandEvent.
ItalsodrawsacomparisonwithRMS,anotherfunctionalitythatdealswithdevicedata.
Withtheinherentexportandimportcapabilities,itisnowpossibletosyncupJ2MEapplicationswithvCardandvCalendar,theinternetstandardformatforContactandCalendarrespectively.
Weconcludedwiththesecurityanddeploymentrequirementsatruntime.
CopyrightIBMCorporation2009(www.
ibm.
com/legal/copytrade.
shtml)Trademarks(www.
ibm.
com/developerworks/ibm/trademarks/)

金山云:618年中促销,企业云服务器2核4G仅401.28元/年,827.64元/3年

金山云618年中促销活动正在进行中!金山云针对企业级新用户优惠力度比普通个人用户优惠力度要大,所以我们也是推荐企业新用户身份购买金山云企业级云服务器,尽量购买3年配置的,而不是限时秒杀活动中1年的机型。企业级用户购买金山云服务器推荐企业专区:云服务器N3 2核4G云服务器,1-5M带宽,827.64元/3年,性价比高,性能稳定!点击进入:金山云618年中促销活动目前,金山云基础型E1云服务器2核4...

青果网络618:洛杉矶CN2 GIA/东京CN2套餐年付199元起,国内高防独服套餐66折

青果网络怎么样?青果网络隶属于泉州市青果网络科技有限公司,青果网络商家成立于2015年4月1日,拥有工信部颁发的全网IDC/ISP/IP-VPN资质,是国内为数不多具有IDC/ISP双资质的综合型云计算服务商。青果网络是APNIC和CNNIC地址分配联盟成员,泉州市互联网协会会员单位,信誉非常有保障。目前,青果网络商家正式开启了618云特惠活动,针对国内外机房都有相应的优惠。点击进入:青果网络官方...

阿里云年中活动最后一周 - ECS共享型N4 2G1M年付59元

以前我们在参与到云服务商促销活动的时候周期基本是一周时间,而如今我们会看到无论是云服务商还是电商活动基本上周期都要有超过一个月,所以我们有一些网友习惯在活动结束之前看看商家是不是有最后的促销活动吸引力的,比如有看到阿里云年中活动最后一周,如果我们有需要云服务器的可以看看。在前面的文章中(阿里云新人福利选择共享性N4云服务器年79.86元且送2月数据库),(LAOZUO.ORG)有提到阿里云今年的云...

tooogooo为你推荐
permissiondeniedpermission denied是什么意思啊?22zizi.com福利彩双色球22号开奖号www.522av.com在白虎网站bhwz.com看电影要安装什么播放器?51sese.comwww.51xuanh.com这是什么网站是骗人的吗?www.5any.comwww.qbo5.com 这个网站要安装播放器杨丽晓博客杨丽晓是怎么 出道的www.toutoulu.com外链方案到底应该怎么弄呢www.cn12365.orgwww.12365china.net是可靠的网站吗?还是骗子拿出来忽悠人的4399宠物连连看2.54399游戏里的宠物连连看3.1版本,电脑网页有,为什么手机里没有呢?我想下这个版本在手机上,因为www.seowhy.com如何快速做外链
查询域名 重庆vps租用 域名主机基地 唯品秀 韩国电信 国外私服 地址大全 美国十次啦服务器 jsp空间 美国网站服务器 新睿云 smtp服务器地址 秒杀品 徐州电信 免备案jsp空间 蓝队云 websitepanel alexa世界排名 cpu使用率过高怎么办 服务器机柜 更多