Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server


Published on

alternative, rewritten version for the BGOUG conference

  • Be the first to comment

  • Be the first to like this

BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server

  1. 1. Drag, Drop and other Stuff
  2. 2. XML DB Repository
  3. 3.  Ever executed DBMS_XDB…? dbms_xdb.SetHTTPPort(8080) dbms_xdb.SetFTPPort(2100)
  4. 4.  Based on XML Standards: XPath V2 , XSLT V1 , XQuery V1 , XQuery Update ( , XBRL (Extention) XML Handling Stores, Consumes, Generates, Validates XDB Repository HTTP(s), FTP & WebDAV XDB Repository Events No Cost Option, Core database feature
  5. 5.  XDB Repository File / Folder (aka Resources) Resource manipulation DBMS_XDB, DBMS_XDBRESOURCE Default XDB ACL Driven Security XDB Protocol Listener Respository Events Versioning XML Schema awareness Extending XML Schema functionality
  6. 6.  XDB$RESOURCE  XDBResource.xsd  XMLType Table (Schema based XML Table) Access to XDB Repository  WebDAV, FTP, HTTP(s)  SQL, PL/SQL, NDWS  PATH_VIEW, RESOURCE_VIEW Select, Update, Delete  UNDER_PATH, EQUALS_PATH
  7. 7. Servlet ?MIME Type?Security ?XMLSchema ?XDB Event ?Extention?
  8. 8. Use Case
  9. 9. Database FileServer 2 The MAX Copy a FILE to the Database
  10. 10. EventMIME Event ListenerCheck Handler XML Protocol Server (Listener)
  11. 11. Extract MoveFile Info Store in XDB Repository
  12. 12. Extract File XDB File to Content Server Batch File to XDB “Batch” Directory
  13. 13. Use Case
  14. 14. Database FileServer 2 The MAX Copy a PICTURE to the Database
  15. 15. EventMIME Event ListenerCheck Handler XML Protocol Server (Listener)
  16. 16. Extract Store in XML Table Store in XDB Repository
  17. 17. EXIF KML Display in GUI, Google Map
  18. 18. Methods at Work
  19. 19. Servlet ?MIME Type?Security ?XMLSchema ?XDB Event ?Extention?
  20. 20.  XML Schema - xdbconfig.xsd Notepad, XMLSpy, PL/SQL Secured via WebDAV ACL (xdbadmin) Packages (among others):  DBMS_XDB ▪ Caching, Session, Locking, Security behavior ▪ Enable HTTP/FTP, MIME, Encoding, Virtual Paths ▪ SERVLETS: NDWS, APEX, XDBUrifactory  DBMS_EPG ▪ Creation off Database Access Descriptors
  21. 21. <xdbconfig> <sysconfig> <acl-max-age>15</acl-max-age> <acl-cache-size>32</acl-cache-size> <invalid-pathname-chars/> <case-sensitive>true</case-sensitive> <call-timeout>6000</call-timeout> <max-link-queue>65536</max-link-queue> <max-session-use>100</max-session-use> <persistent-sessions>false</persistent-sessions> <default-lock-timeout>3600</default-lock-timeout> <xdbcore-log-level>0</xdbcore-log-level> <resource-view-cache-size>1048576</resource…size> <xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound> <xdbcore-loadableunit-size>16</xdbcore-……………size> <acl-evaluation-method>ace-order</acl-ev……method> </sysconfig></xdbconfig>
  22. 22. <servlet xmlns=""> <servlet-name>APEX</servlet-name> <servlet-language>PL/SQL</servlet-language> <display-name>APEX</display-name> <plsql xmlns=""> <database-username>ANONYMOUS</database-username> <default-page>apex</default-page> <document-table-name>wwv_flow_file_objects$</document-…- name> <document-path>docs</document-path> <document-procedure> wwv_flow_file_mgr.process_download </document-procedure> <nls-language>american_america.al32utf8</nls-language> <request-validation-function> wwv_flow_epg_include_modules.authorize </request-validation-function> </plsql> <security-role-ref xmlns=""> <role-name>anonymousServletRole</role-name> <role-link>anonymousServletRole</role-link> </security-role-ref></servlet>
  23. 23. Methods at Work
  24. 24.  Event Listener  Java Class, PL/SQL Package, Object Type ▪ E.g. a package called: “HANDLE_XDB_EVENTS” Event Handlers  Event handlers processes a single event ▪ Package procedures called “handlePreCreate”, “handlePostCreate, “handlePreVersionControl”… Resource Configuration File  The glue between Event Listener and Resources
  25. 25.  Render  UnLinkIn  UnCheckOut Create  UnLinkFrom  VersionControl Delete  Lock  UnLock Update  CheckIn  LinkTo LinkIn  CheckOut
  26. 26.  Create handlePreCreate handlePostCreate Delete handlePreDelete handlePostDeleteRender handleRenderLock handlePreLock… handlePostLockURL: XDBEvent XDBEventListener
  27. 27. Methods at Work
  28. 28. Servlet ?MIME Type?Security ?XMLSchema ?XDB Event ?Extention?
  29. 29.  Glue between Event Listener and Resource An XML File  XML Schema restricted: XDBResConfig.xsd Contains (among others):  Events and Source (Event Listener)  Path to “itself” (/public/myResFile.xml)  Pre-conditions (XPATH on XDB$RESOURCE) Is assigned to a Resource (File/Folder)  DBMS_RESCONFIG.AppendResConfig
  30. 30.  XML Schema: xdb$resource.xsd XMLType Table PATH_VIEW, RESOURCE_VIEW LOB Column (with file content) Non Schema based metadata in LOB Info about: RESID, DisplayName, Owner, Creator, VersionID, ChecktOut, CreationDate, ModifiedDate, SizeOnDisk, ContentSize, ContentType, Comments, CharacterSet, Etc…
  31. 31.  Move all files created by BATCH to… Extract Info from picture if extension GIF…<pre-condition> <existsNode> <XPath>/Resource[Creator="BATCH"]</XPath> </existsNode></pre-condition><pre-condition> <existsNode> <XPath>/Resource[ContentType="image/jpg"]</XPath> </existsNode></pre-condition>
  32. 32. Holistic Approach
  33. 33. Servlet ?MIME Type?Security ?XMLSchema ?XDB Event ?Extension?
  34. 34. XML Schema XML SchemaXML Document in XML ? Registered ?Physical XMLType Shred XML into Update Associated ? XMLType XDB$Resource
  35. 35. Everybody knows EXIF…
  36. 36. Jeffreys EXIF Viewer
  37. 37.  Camera Make and Model Aperture, Shutter Speed, Focal Length ISO Speed, Date Taken, Description Geo-coding, Copyright Information EXIF XML Schema is pre-registered with XML DB by Oracle MultiMedia Type ordsys.ordimage extracts EXIF metadata document from a JPG image
  38. 38.  The following embedded image metadata formats are supported by Oracle Multimedia:  EXIF (JPEG/TIFF - JEIDA)  IPTC-IIM (JPEG/TIFF – Adobe)  XMP (GIF/JPEG/TIFF – Adobe/RDF) Wikipedia - EXIF
  40. 40.  Metadata defined using an XML Schema Metadata stored in a separate table Table includes hidden column RESID  Enables join with RESOURCE_VIEW, PATH_VIEW Applications query and update metadata directly  Improved Indexing Metadata deleted when resource is deleted
  41. 41. Document MIME type JPG Event Listener? EXIF EXIF ExtendedEvent Handler? XML Schema? w/ USER XSD ? Extract JPG Extract JPG Extract JPG File info EXIF info USER metadataXDB$Resource XMLType Table XMLType Table
  42. 42. Its about Time to wrap it Up
  43. 43. Servlet ?MIME Type?Security ?XMLSchema ?XDB Event ?Extention?
  44. 44. 1. EVENT LISTENER • Package2. EVENT HANDLERS • Procedures in “Event Listener”3. RESOURCE CONFIGURATION FILE • XML File
  45. 45. • General File Stuff turns out to be XML then…4. XML SCHEMA REGISTRATION • dbms_xmlschema.register_schema5. EXTRA USER DEFINED METADATA NEEDED • dbms_xmlschema.enable_hierarchy_resm etadata
  46. 46. • XML DB - Beyond the Database, Fileserver Realm• Imagination is your limit, e.g.: - Extending “file” server with Text Search - Extending “file” server with ETL functionality• Extra options: database / fileserver interfacing• Based on standards• No cost option / all database versions
  47. 47.  URL: OTN XMLDB Sample Code  XFILES Version 5  Introduction to Oracle XML DB Repository Events  Oracle XML DB-based Mashup with Google Earth  Oracle XML DB Repository Features  XDB Utilities and more…
  48. 48.  Blog posts about:  Setting up logging in the XDB Repository  Package template HANDLE_XDB_EVENTS  Concepts & Howto’s for XDB Repository  Automatically shred content out of Windows Office (docx) into table columns  References to XLSX examples of Marc Bleron and Anton Scheffers