(cid:1) Oracle® Internet File System Developer’s Guide Release 1.1 September2000 PartNo. A75172-04 OracleInternetFileSystemDeveloper’sGuide,Release1.1 PartNo. A75172-04 Release1.1 Copyright©2000,OracleCorporation.Allrightsreserved. PrimaryAuthor: DenniseBrown Contributors: MatthewBrandabur,DennisDawson,FrancineHyman,VasantKumar,DaveLong,LarryMatter, SylviaPerez,JoshSacks,AlisonStokes,EdYu Theprogramsarenotintendedforuseinanynuclear,aviation,masstransit,medical,orotherinherently dangerousapplications.Itshallbelicensee'sresponsibilitytotakeallappropriatefail-safe,backup, redundancyandothermeasurestoensurethesafeuseofsuchapplicationsiftheProgramsareusedforsuch purposes,andOracledisclaimsliabilityforanydamagescausedbysuchuseofthePrograms. ThisProgramcontainsproprietaryinformationofOracleCorporation;itisprovidedunderalicenseagreement containingrestrictionsonuseanddisclosureandisalsoprotectedbycopyright,patentandotherintellectual propertylaw.Reverseengineeringofthesoftwareisprohibited. Theinformationcontainedinthisdocumentissubjecttochangewithoutnotice.Ifyoufindanyproblemsinthe documentation,pleasereportthemtousinwriting.OracleCorporationdoesnotwarrantthatthisdocumentiserror free.Nopartofthisdocumentmaybereproducedortransmittedinanyformorbyanymeans,electronicor mechanical,foranypurpose,withouttheexpresswrittenpermissionofOracleCorporation IfthisProgramisdeliveredtoaU.S.GovernmentAgencyoftheDepartmentofDefense,thenitisdeliveredwith RestrictedRightsandthefollowinglegendisapplicable: RestrictedRightsLegend ProgramsdeliveredsubjecttotheDODFARSupplementare"commercialcomputer software"anduse,duplicationanddisclosureoftheProgramsshallbesubjecttothelicensingrestrictionssetforth intheapplicableOraclelicenseagreement.Otherwise,ProgramsdeliveredsubjecttotheFederalAcquisition Regulationsare"restrictedcomputersoftware"anduse,duplicationanddisclosureoftheProgramsshallbesubject totherestrictionsinFAR52.227-14,RightsinData--General,includingAlternateIII(June1987).Oracle Corporation,500OracleParkway,RedwoodCity,CA94065. Oracleisaregisteredtrademark,andinterMedia,Gist,JDeveloper,OracleApplications,OracleParallelServer, OracleReports,OracleWorkflow,andOracle8aretrademarksorregisteredtrademarksofOracleCorporation.All othercompanyorproductnamesmentionedareusedforidentificationpurposesonlyandmaybetrademarksof theirrespectiveowners. Contents Send Us Your Comments................................................................................................................... ix Preface............................................................................................................................................................ xi 1 Getting Started IntroducingtheOracleInternetFileSystem................................................................................. 1-2 OracleiFSAdvantagesforDevelopers...................................................................................... 1-2 OracleiFSSystem............................................................................................................................... 1-3 TheOracleiFSRepository........................................................................................................... 1-3 TheOracleiFSClientSoftware................................................................................................... 1-3 TheOracleiFSProtocolServers.................................................................................................. 1-3 AnExtensibleDocumentHierarchy.......................................................................................... 1-3 AJava-basedAPI.......................................................................................................................... 1-3 ApplicationDevelopmentTools...................................................................................................... 1-4 CustomizationinOracleiFS............................................................................................................. 1-5 NoCustomization........................................................................................................................ 1-5 BasicCustomization..................................................................................................................... 1-5 AdvancedCustomization............................................................................................................ 1-5 OverviewofApplicationTasks........................................................................................................ 1-6 TaskReference..................................................................................................................................... 1-7 iii 2 API Overview IntroducingtheOracleiFSJavaAPI............................................................................................... 2-2 TheOracleiFSAPIPackages...................................................................................................... 2-2 TheLibraryObjectClass.................................................................................................................... 2-3 TheLibraryObjectDefinitionClass............................................................................................. 2-3 Theoracle.ifs.beansClassHierarchy.............................................................................................. 2-4 ThePublicObjectClass...................................................................................................................... 2-6 CharacteristicsofPublicObjects................................................................................................. 2-7 PublicObjectAttributes............................................................................................................... 2-8 DoYouNeedtoCreateaCustomOracleiFSDocument?...................................................... 2-9 User-relatedClasses................................................................................................................... 2-10 DocumentandFolderClasses........................................................................................................ 2-11 TheDocumentClass................................................................................................................... 2-12 TheDocumentDefinitionClass................................................................................................. 2-12 TheContentObjectClass............................................................................................................ 2-13 TheFolderClass.......................................................................................................................... 2-13 SecurityClasses................................................................................................................................. 2-14 TheAccessControlListClass..................................................................................................... 2-14 TheAccessControlEntryClass.................................................................................................. 2-14 SessionClasses.................................................................................................................................. 2-15 TheLibraryServiceClass........................................................................................................... 2-15 TheLibrarySessionClass........................................................................................................... 2-16 TieClasses.......................................................................................................................................... 2-16 ServerClasses.................................................................................................................................... 2-18 3 Working with Documents HowDocumentsAreStoredintheRepository............................................................................ 3-2 DocumentsandFolders............................................................................................................... 3-2 ConnectingtotheRepository........................................................................................................... 3-3 Step1:CreateanInstanceofLibraryService............................................................................. 3-3 Step2:ObtainanInstanceofLibrarySession............................................................................ 3-3 CreatingaNewDocument................................................................................................................ 3-5 WhyCreateaDefinitionFirst?................................................................................................... 3-5 CreatingPublicObjects................................................................................................................. 3-5 CreateaDocumentDefinitionObject........................................................................................ 3-6 iv CreateaNewDocument............................................................................................................. 3-6 PuttingaDocumentinaFolder....................................................................................................... 3-7 WorkingwithAttributes................................................................................................................... 3-7 GettingAttributes......................................................................................................................... 3-8 SettingAttributes.......................................................................................................................... 3-9 DefiningExplicitGettersandSetters....................................................................................... 3-11 SearchingforaDocument............................................................................................................... 3-12 SampleCode:HelloWorld............................................................................................................. 3-14 4 Creating Custom Classes OverviewofCreatingCustomClasses........................................................................................... 4-2 CreatingaTypeDefinitionFile....................................................................................................... 4-2 HowDoTypeDefinitionsWork?............................................................................................... 4-2 TheTypeDefinitionFile:DescriptionSection.......................................................................... 4-3 TheTypeDefinitionFile:AttributesSection............................................................................ 4-5 SampleCode:CreateaTypeDefinition.................................................................................... 4-6 UsingCompoundAttributes............................................................................................................ 4-7 SampleCode:EmbeddedAttributeTypeDefinition.............................................................. 4-7 SampleCode:ClassDomainDefinition..................................................................................... 4-9 LoadaCustomTypeDefinition................................................................................................. 4-9 CreatinganInstanceClassBean...................................................................................................... 4-9 SampleCode:CreateanInstanceClassBean......................................................................... 4-10 DeployanInstanceClassBean................................................................................................. 4-12 CreatingDocumentInstances....................................................................................................... 4-13 SampleCode:CreateDocumentInstances............................................................................. 4-14 UploadDocumentInstanceFiles............................................................................................. 4-14 LimitationsonXMLTypeDefinitionFiles............................................................................. 4-15 5 Using Parsers WhatIsaParser?................................................................................................................................. 5-2 StandardOracleiFSParsersvs.CustomParsers..................................................................... 5-2 UsingtheStandardParsers............................................................................................................... 5-3 ParsingOptions............................................................................................................................ 5-3 UsingtheClassSelectionParser....................................................................................................... 5-4 CreateaClassDefinition............................................................................................................. 5-4 v RegistertheExtensionwiththeClassSelectionParser............................................................. 5-5 RegistertheClass.......................................................................................................................... 5-5 HowDoesXMLParsingWork?........................................................................................................ 5-6 UsingaCustomParser....................................................................................................................... 5-7 OverviewofaParserApplication.................................................................................................... 5-7 WritingaParserApplication............................................................................................................ 5-8 WritetheParserClass.................................................................................................................. 5-8 OverviewofaCustomParser......................................................................................................... 5-10 SampleCode:ACustomParser..................................................................................................... 5-10 DeploytheParser........................................................................................................................ 5-15 RegistertheParser...................................................................................................................... 5-16 InvoketheParser........................................................................................................................ 5-17 WriteaParserCallback............................................................................................................... 5-18 6 Using Renderers WhatIsaRenderer?............................................................................................................................ 6-2 TheOracleiFSFrameworkforRendering................................................................................ 6-2 ARendererDoesNotCreateaRepositoryObject................................................................... 6-2 WhatObjectsCanBeRendered?................................................................................................ 6-3 UsingServer-SideClasseswithRenderers............................................................................... 6-3 UsingPolicyPropertyBundlestoRegisterRenderers.............................................................. 6-3 UsingStandardRenderers................................................................................................................ 6-5 InvokingRenderers...................................................................................................................... 6-5 IntroductiontoCustomRenderers.................................................................................................. 6-8 HowCustomRenderersWork................................................................................................... 6-9 OverviewofaRendererApplication.............................................................................................. 6-9 WritetheRendererClass............................................................................................................. 6-9 DeploytheRenderer.................................................................................................................. 6-14 RegistertheRenderer................................................................................................................. 6-15 InvoketheRenderer................................................................................................................... 6-17 OutputfromtheCustomRenderer.......................................................................................... 6-23 7 Using JSPs UsingJavaServerPagestoDisplayDocuments........................................................................... 7-2 PreparingtoUseJSPs................................................................................................................... 7-2 vi ImplementinganApplicationUsingaJSP.................................................................................... 7-3 Login/LogoutFiles...................................................................................................................... 7-3 ApplicationFiles........................................................................................................................... 7-4 RegisteringaJSP........................................................................................................................... 7-5 WebSiteSecurityUsingHTTPAuthentication....................................................................... 7-6 ImplementingHTTPAuthentication......................................................................................... 7-7 RunningtheSampleInsuranceFormApplication...................................................................... 7-8 CreatetheInsuranceFormApplication.................................................................................... 7-8 RuntheInsuranceFormApplication........................................................................................ 7-9 SampleFilesfortheInsuranceFormApplication..................................................................... 7-10 SampleCode:index.html.......................................................................................................... 7-11 SampleCode:CreateInsuranceForm.xml............................................................................... 7-11 SampleCode:claim1.xml,claim2.xml..................................................................................... 7-12 SampleCode:login.jsp.............................................................................................................. 7-12 SampleCode:InsuranceLogin.java.......................................................................................... 7-14 SampleCode:logout.jsp............................................................................................................ 7-18 RegisteringaJavaServerPageUsingOracleiFSManager.................................................. 7-19 RegisteringaJavaServerPageUsingXML............................................................................ 7-20 SampleCode:InsuranceForm.jsp............................................................................................. 7-20 SampleCode:InsuranceBean.java........................................................................................... 7-22 8 Using Agents WhatIsanAgent?............................................................................................................................... 8-2 WhatTriggersanAgent’sAction?............................................................................................. 8-2 HowDoAgentsWork?...................................................................................................................... 8-3 TheSalaryFileLogAgentatWork.............................................................................................. 8-3 ClassesandMethodsforanEventAgent...................................................................................... 8-4 WritinganEventAgent..................................................................................................................... 8-5 StartwithTemplateCode............................................................................................................ 8-6 DeclaretheClass........................................................................................................................... 8-6 CreatetheConstructor................................................................................................................. 8-7 Writetherun()Method................................................................................................................ 8-7 HandleaStopRequest............................................................................................................... 8-11 HandleaSuspendRequest....................................................................................................... 8-12 HandleaResumeRequest......................................................................................................... 8-13 vii HandleOracleiFSEvents.......................................................................................................... 8-13 RegisteringanAgentwithServerManager................................................................................. 8-15 AgentDefinitionFile.................................................................................................................. 8-16 TestingtheAgent........................................................................................................................ 8-17 EventAgent(CompleteCodeExample)....................................................................................... 8-17 SampleCode:EventAgent........................................................................................................ 8-17 9 Using Overrides WhatIsanOverride?.......................................................................................................................... 9-2 HowPre-OverridesWork........................................................................................................... 9-2 UsingPre-Overrides.................................................................................................................... 9-2 BeforeYouBeginWorkingwithOverrides................................................................................... 9-3 ReviewofAttributes.................................................................................................................... 9-4 OverrideMethods............................................................................................................................... 9-5 WritinganOverride............................................................................................................................ 9-6 DeclaretheServer-sideClass...................................................................................................... 9-6 CreatetheConstructor................................................................................................................. 9-7 ImplementtheOverrideMethod............................................................................................... 9-8 SampleCode:APreInsertOverride................................................................................................ 9-9 10 Sending E-mail Programmatically WhatIsSendingE-mailProgrammatically?................................................................................ 10-2 OracleiFSInfrastructureforProgrammaticE-mail............................................................... 10-3 ProgrammaticE-mailScenario................................................................................................. 10-3 WritinganApplicationtoSendE-mailProgrammatically....................................................... 10-4 OptionforSendingShortMessages......................................................................................... 10-4 CreateanIfsMessageObject...................................................................................................... 10-5 ConstructtheMessageHeader................................................................................................. 10-6 ConstructtheMessageBody..................................................................................................... 10-7 SendtheMessage...................................................................................................................... 10-10 SampleCode:SendingE-MailProgrammatically.................................................................... 10-10 A Error Messages Index viii Send Us Your Comments Developer’sGuide,Release1.1 PartNo. A75172-04 OracleCorporationwelcomesyourcommentsandsuggestionsonthequalityandusefulnessofthis publication.Yourinputisanimportantpartoftheinformationusedforrevision. (cid:1) Didyoufindanyerrors? (cid:1) Istheinformationclearlypresented? (cid:1) Doyouneedmoreinformation?Ifso,where? (cid:1) Aretheexamplescorrect?Doyouneedmoreexamples? (cid:1) Whatfeaturesdidyoulikemostaboutthismanual? Ifyoufindanyerrorsorhaveanyothersuggestionsforimprovement,pleaseindicatethechapter, section,andpagenumber(ifavailable).Youcansendcommentstousinthefollowingways: (cid:1) E-mail:[email protected] (cid:1) FAX-650.605.7104. Attn:DocumentationManagerforProductName (cid:1) Postalservice: OracleCorporation ProductName,Attn:DocumentationManager 500OracleParkway,Mailstop5op4 RedwoodShores,CA 94065 USA Ifyouwouldlikeareply,pleasegiveyourname,address,andtelephonenumberbelow. Ifyouhaveproblemswiththesoftware,pleasecontactyourlocalOracleWorldWideSupportCenter. ix x