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/)

稳爱云(26元),香港云服务器 1核 1G 10M带宽

稳爱云(www.wenaiyun.com)是创建于2021年的国人IDC商家,主要目前要出售香港VPS、香港独立服务器、美国高防VPS、美国CERA VPS 等目前在售VPS线路有三网CN2、CN2 GIA,该公司旗下产品均采用KVM虚拟化架构。机房采用业内口碑最好香港沙田机房,稳定,好用,数据安全。线路采用三网(电信,联通,移动)回程电信cn2、cn2 gia优质网络,延迟低,速度快。自行封装的...

Hostiger 16G大内存特价VPS:伊斯坦布尔机房,1核50G SSD硬盘200Mbps带宽不限流量$59/年

国外主机测评昨天接到Hostigger(现Hostiger)商家邮件推送,称其又推出了一款特价大内存VPS,机房位于土耳其的亚欧交界城市伊斯坦布尔,核50G SSD硬盘200Mbps带宽不限月流量只要$59/年。 最近一次分享的促销信息还是5月底,当时商家推出的是同机房同配置的大内存VPS,价格是$59.99/年,不过内存只有10G,虽然同样是大内存,但想必这次商家给出16G,价格却是$59/年,...

LOCVPS洛杉矶CN2线路KVM上线,洛杉矶/香港云地/香港邦联7折

LOCVPS发来了新的洛杉矶CN2线路主机上线通知,基于KVM架构,目前可与香港云地、香港邦联机房XEN架构主机一起适用7折优惠码,优惠后最低美国洛杉矶CN2线路KVM架构2GB内存套餐月付38.5元起。LOCPVS是一家成立较早的国人VPS服务商,目前提供洛杉矶MC、洛杉矶C3、和香港邦联、香港沙田电信、香港大埔、日本东京、日本大阪、新加坡、德国和荷兰等机房VPS主机,基于KVM或者XEN架构。...

tooogooo为你推荐
网罗设计计算机网络设计主要干什么.cn域名cn域名和com域名有什么不同?哪个更好?好在哪里?Baby被问婚变绯闻黄晓明婚礼上说baby碰他哪里最兴奋百度商城百度商城知道在哪个地方,怎么找不到啊罗伦佐娜手上鸡皮肤怎么办,维洛娜毛周角化修复液百花百游百花百游的五滴自游进程javmoo.comjavbus上不去.怎么办125xx.comwww.free.com 是官方网站吗?se95se.com现在400se就是进不去呢?进WWW怎么400se总cOM打开一半,?求解ip查询器查看自己IP的指令
cn域名注册 二级域名查询 欧洲欧洲vps Vultr sugarsync evssl证书 空间服务商 java虚拟主机 华为网络硬盘 中国智能物流骨干网 免空 北京双线机房 泉州移动 免费智能解析 中国电信测速器 工信部icp备案查询 创速 镇江高防服务器 htaccess 海外加速 更多