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活动方案:618特价活动(6.18-6.30)全站首月活动月底结束!地区:浙江高防BGPCPU:至强铂金8270主频7 默频3.61 睿频4.0核心:8核(最高支持64核)内存:8G(最高支持128G)DDR4 3200硬盘:40G系统盘+80G数据盘带宽:上行:20Mbps/下行:1000Mbps防御:100G(可加至300G)防火墙:提供自助 天机盾+金盾 管...
妮妮云的来历妮妮云是 789 陈总 张总 三方共同投资建立的网站 本着“良心 便宜 稳定”的初衷 为小白用户避免被坑妮妮云的市场定位妮妮云主要代理市场稳定速度的云服务器产品,避免新手购买云服务器的时候众多商家不知道如何选择,妮妮云就帮你选择好了产品,无需承担购买风险,不用担心出现被跑路 被诈骗的情况。妮妮云的售后保证妮妮云退款 通过于合作商的友好协商,云服务器提供2天内全额退款,超过2天不退款 物...
部落分享过多次G-core(gcorelabs)的产品及评测信息,以VPS主机为主,距离上一次分享商家的独立服务器还在2年多前,本月初商家针对迈阿密机房限定E5-2623v4 CPU的独立服务器推出75折优惠码,活动将在9月30日到期,这里再分享下。G-core(gcorelabs)是一家总部位于卢森堡的国外主机商,主要提供基于KVM架构的VPS主机和独立服务器租用等,数据中心包括俄罗斯、美国、日...
tooogooo为你推荐
多家五星酒店回应网传名媛拼单拼多多商家出钱叫买家好评会被处罚吗firetrap流言终结者 中的银幕神偷 和开保险柜 的流言是 取材与 那几部电影的javbibinobibi的中文意思是?www.kaspersky.com.cn卡巴斯基中国总部设立在?dadi.tv电视机如何从iptv转换成tv?www.cn12365.org全国公民身份证号码查询服务中心(http://www.nciic.com.cn/)这个网站怎么查不了啊?bk乐乐BK乐乐和沈珂什么关系?bk乐乐bk乐乐和CK是什么关系?朴容熙这个女的叫什么?汴京清谈都城汴京,数百万家,尽仰石炭,无一燃薪者的翻译
网站空间购买 域名反查 域名系统 windows虚机 出租服务器 如何申请免费域名 购买域名和空间 美国主机评测 yardvps sugarsync 空间打开慢 免费ftp空间申请 qingyun 大容量存储器 新家坡 umax120 lick 免费网络空间 双11促销 脚本大全 更多