Drag, Drop and other Stuff
   Mark D Drake
     Senior Product Manager
     Product: Oracle XML DB
     Oracle HQ, USA

   Oracle 20+ years experience
   Marco Gralike
     Principal Database Consultant
     DBA; Specialized Oracle XML DB
     AMIS Services BV, Holland

   Oracle experience since 1993

   Oracle ACE Director
   OakTable Member
XML DB Repository
   Based on XML Standards:
    XPath V2 , XSLT V1 , XQuery V1 ,
    XQuery Update (11.2.0.3) , XBRL (Extention)
   XML Handling
     Stores, Consumes, Generates, Validates
   XDB Repository
     HTTP(s), FTP & WebDAV
     XDB Repository Events
   No Cost Option, Core database feature
   XDB Repository File / Folder (aka Resources)
   Resource manipulation
     DBMS_XDB, DBMS_XDBRESOURCE
   Default XDB ACL Driven Security
   XDB Protocol Listener
   XDB Respository Events
   XML Schema awareness
   Extending XML Schema functionality
   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
   XML Schema: xdb$resource.xsd
   XMLType Table
   PATH_VIEW, RESOURCE_VIEW
   Non Schema based metadata in LOB
   Info about:
     RESID, DisplayName, Owner, Creator, VersionID,
     ChecktOut, CreationDate, ModifiedDate, SizeOn
     Disk, ContentSize, ContentType, Comments, Char
     acterSet, Etc…
Servlet ?


MIME Type?


Security ?

XML
Schema ?

XDB Event ?


Extention?
Use Case
Database FileServer   2 The MAX

      Copy a FILE
    to the Database
Event
MIME                     Event
             Listener
Check                   Handler

         XML Protocol
        Server (Listener)
Extract
               Move
File Info

     Store in XDB
      Repository
Extract File    XDB File to
 Content          Server


    Batch File to XDB
    “Batch” Directory
Use Case
Database FileServer   2 The MAX

    Copy a PICTURE
    to the Database
Event
MIME                     Event
             Listener
Check                   Handler

         XML Protocol
        Server (Listener)
Extract       Store in
 XML           Table

    Store in XDB
     Repository
EXIF           KML



  Display in GUI,
   Google Map
Methods at Work
Servlet ?


MIME Type?


Security ?

XML
Schema ?

XDB Event ?


Extention?
   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
<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>
<servlet xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
  <servlet-name>APEX</servlet-name>
  <servlet-language>PL/SQL</servlet-language>
  <display-name>APEX</display-name>
  <plsql xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
    <database-username>ANONYMOUS</database-username>
    <default-page>apex</default-page>
    <document-table-name>wwv_flow_file_objects$</doc…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>
    <role-name>anonymousServletRole</role-name>
    <role-link>anonymousServletRole</role-link>
  </security-role-ref>
</servlet>
XML Schema      XML Schema
XML Document
                     in XML ?       Registered ?



Physical XMLType   Shred XML into      Update
 Associated ?         XMLType       XDB$Resource
Methods at Work
   Event Listener
     Java Class, PL/SQL Package, Object Type
      ▪ A Package called: “HANDLE_XDB_EVENTS”
   Event Handlers
     Event handlers processes a single event
      ▪ Package procedures called
        “handlePreCreate”, “handlePostCreate, “handlePreVersi
        onControl”…
   Resource Configuration File
     The glue between Event Listener and Resources
   Render      UnLinkIn      UnCheckOut
   Create      UnLinkFrom    VersionControl
   Delete      Lock          UnLock
   Update      CheckIn       LinkTo
   LinkIn      CheckOut
   Create      handlePreCreate
                handlePostCreate
   Delete      handlePreDelete
                handlePostDelete
Render         handleRender
Lock
                handlePreLock
…               handlePostLock
URL: XDBEvent   XDBEventListener
Methods at Work
   Glue between Event Listener and Resource
   An XML File
     XML Schema - 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
   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>
Holistic Approach
Servlet ?


MIME Type?


Security ?

XML
Schema ?

XDB Event ?


Extension?
Everyone is known with EXIF…
Jeffrey's EXIF Viewer
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
   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)


    http://www.adobe.com   http://www.w3.org/RDF   Wikipedia - EXIF
Oracle® Multimedia User's Guide 11g R2
Oracle Multimedia Metadata XML Schemas
   ENABLE_HIERARCHY_RESMETADATA
   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
Document       MIME type JPG   Event Listener?




                     EXIF        EXIF Extended
Event Handler?
                 XML Schema?     w/ USER XSD ?



 Extract JPG      Extract JPG     Extract JPG
  File info        EXIF info     USER metadata
XDB$Resource     XMLType Table   XMLType Table
Oracle XML DB Repository
• 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
   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…

UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server

  • 1.
    Drag, Drop andother Stuff
  • 2.
    Mark D Drake Senior Product Manager Product: Oracle XML DB Oracle HQ, USA  Oracle 20+ years experience
  • 3.
    Marco Gralike Principal Database Consultant DBA; Specialized Oracle XML DB AMIS Services BV, Holland  Oracle experience since 1993  Oracle ACE Director  OakTable Member
  • 4.
  • 5.
    Based on XML Standards: XPath V2 , XSLT V1 , XQuery V1 , XQuery Update (11.2.0.3) , XBRL (Extention)  XML Handling Stores, Consumes, Generates, Validates  XDB Repository HTTP(s), FTP & WebDAV XDB Repository Events  No Cost Option, Core database feature
  • 6.
    XDB Repository File / Folder (aka Resources)  Resource manipulation DBMS_XDB, DBMS_XDBRESOURCE  Default XDB ACL Driven Security  XDB Protocol Listener  XDB Respository Events  XML Schema awareness  Extending XML Schema functionality
  • 7.
    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
  • 8.
    XML Schema: xdb$resource.xsd  XMLType Table  PATH_VIEW, RESOURCE_VIEW  Non Schema based metadata in LOB  Info about: RESID, DisplayName, Owner, Creator, VersionID, ChecktOut, CreationDate, ModifiedDate, SizeOn Disk, ContentSize, ContentType, Comments, Char acterSet, Etc…
  • 9.
    Servlet ? MIME Type? Security? XML Schema ? XDB Event ? Extention?
  • 10.
  • 11.
    Database FileServer 2 The MAX Copy a FILE to the Database
  • 12.
    Event MIME Event Listener Check Handler XML Protocol Server (Listener)
  • 13.
    Extract Move File Info Store in XDB Repository
  • 14.
    Extract File XDB File to Content Server Batch File to XDB “Batch” Directory
  • 15.
  • 16.
    Database FileServer 2 The MAX Copy a PICTURE to the Database
  • 17.
    Event MIME Event Listener Check Handler XML Protocol Server (Listener)
  • 18.
    Extract Store in XML Table Store in XDB Repository
  • 19.
    EXIF KML Display in GUI, Google Map
  • 20.
  • 21.
    Servlet ? MIME Type? Security? XML Schema ? XDB Event ? Extention?
  • 22.
    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
  • 23.
    <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>
  • 24.
    <servlet xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"> <servlet-name>APEX</servlet-name> <servlet-language>PL/SQL</servlet-language> <display-name>APEX</display-name> <plsql xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"> <database-username>ANONYMOUS</database-username> <default-page>apex</default-page> <document-table-name>wwv_flow_file_objects$</doc…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> <role-name>anonymousServletRole</role-name> <role-link>anonymousServletRole</role-link> </security-role-ref> </servlet>
  • 25.
    XML Schema XML Schema XML Document in XML ? Registered ? Physical XMLType Shred XML into Update Associated ? XMLType XDB$Resource
  • 26.
  • 27.
    Event Listener  Java Class, PL/SQL Package, Object Type ▪ A Package called: “HANDLE_XDB_EVENTS”  Event Handlers  Event handlers processes a single event ▪ Package procedures called “handlePreCreate”, “handlePostCreate, “handlePreVersi onControl”…  Resource Configuration File  The glue between Event Listener and Resources
  • 28.
    Render  UnLinkIn  UnCheckOut  Create  UnLinkFrom  VersionControl  Delete  Lock  UnLock  Update  CheckIn  LinkTo  LinkIn  CheckOut
  • 29.
    Create handlePreCreate handlePostCreate  Delete handlePreDelete handlePostDelete Render handleRender Lock handlePreLock … handlePostLock URL: XDBEvent XDBEventListener
  • 31.
  • 32.
    Glue between Event Listener and Resource  An XML File  XML Schema - 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
  • 33.
    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>
  • 34.
  • 35.
    Servlet ? MIME Type? Security? XML Schema ? XDB Event ? Extension?
  • 36.
    Everyone is knownwith EXIF…
  • 37.
  • 40.
    Camera Make andModel 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
  • 41.
    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) http://www.adobe.com http://www.w3.org/RDF Wikipedia - EXIF
  • 42.
    Oracle® Multimedia User'sGuide 11g R2 Oracle Multimedia Metadata XML Schemas
  • 45.
    ENABLE_HIERARCHY_RESMETADATA
  • 46.
    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
  • 47.
    Document MIME type JPG Event Listener? EXIF EXIF Extended Event Handler? XML Schema? w/ USER XSD ? Extract JPG Extract JPG Extract JPG File info EXIF info USER metadata XDB$Resource XMLType Table XMLType Table
  • 48.
    Oracle XML DBRepository
  • 49.
    • 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
  • 50.
    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…