BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
-
Upload
marco-gralike -
Category
Documents
-
view
981 -
download
1
description
Transcript of BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
Using your Database as a File Server
Drag, Drop and other Stuff
OverviewXML DB Repository
Anyone?
Ever executed DBMS_XDB…?
dbms_xdb.SetHTTPPort(8080)dbms_xdb.SetFTPPort(2100)
Oracle XML DB
Based on XML Standards:XPath V2 , XSLT V1 , XQuery V1 ,XQuery Update (11.2.0.3) , XBRL (Extention)
XML HandlingStores, Consumes, Generates, Validates
XDB Repository HTTP(s), FTP & WebDAVXDB Repository Events
No Cost Option, Core database feature
XDB Repository - Features
XDB Repository File / Folder (aka Resources)
Resource manipulationDBMS_XDB, DBMS_XDBRESOURCE
Default XDB ACL Driven Security XDB Protocol Listener Respository Events Versioning XML Schema awareness Extending XML Schema functionality
XDB Repository - Resources 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
xdbconfig.xml
Security ?
XMLSchema ?
Servlet ?
MIME Type?
XDB Event ?
Extention?
Event Listener Event Handler File / Folder ?
Batch File ProcessingUse Case
Copy a FILEto the
Database
Database FileServer 2 The MAX
XML Protocol Server
(Listener)
Event ListenerMIME
Check
Event Handle
r
Store in XDB Repository
MoveExtract
File Info
Batch File to XDB “Batch”
Directory
Extract File
Content
XDB File to Server
Picture Metadata Extraction
Use Case
Copy a PICTURE to the Database
Database FileServer 2 The MAX
XML Protocol Server
(Listener)
Event ListenerMIME
Check
Event Handle
r
Store in XDB Repository
Store in
Table
ExtractXML
Display in GUI, Google Map
EXIF KML
XDB Protocol ServerMethods at Work
xdbconfig.xml
Security ?
XMLSchema ?
Servlet ?
MIME Type?
XDB Event ?
Extention?
Event Listener Event Handler File / Folder ?
xdbconfig.xml
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$</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="http://xmlns.oracle.com/xdb/xdbconfig.xsd"> <role-name>anonymousServletRole</role-name> <role-link>anonymousServletRole</role-link> </security-role-ref></servlet>
XDB Repository EventsMethods at Work
XDB Repository Event - Ingredients
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
Repository Event Types
Render Create Delete Update LinkIn
UnLinkInUnLinkFromLockCheckInCheckOut
PRE-…………
POST-………
PreCreate
PostCreate
UnCheckOutVersionControlUnLockLinkTo
Events & Event Handlers
Create
Delete
Render Lock
…
URL: XDBEvent
handlePreCreatehandlePostCreatehandlePreDeletehandlePostDeletehandleRenderhandlePreLockhandlePostLock
XDBEventListener
XDB ResourcesMethods at Work
xdbconfig.xml
Security ?
XMLSchema ?
Servlet ?
MIME Type?
XDB Event ?
Extention?
Event Listener Event Handler File / Folder ?
Resource Configuration File 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
TABLE: XDB.XDB$RESOURCE
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…
Ideas for <pre-conditions>
<pre-condition> <existsNode> <XPath>/Resource[ContentType="image/jpg"]</XPath> </existsNode></pre-condition>
<pre-condition> <existsNode> <XPath>/Resource[Creator="BATCH"]</XPath> </existsNode></pre-condition>
Move all files created by BATCH to…Extract Info from picture if extension
GIF…
Imagination at WorkHolistic Approach
xdbconfig.xml
Security ?
XMLSchema ?
Servlet ?
MIME Type?
XDB Event ?
Extension?
Event Listener Event Handler File / Folder ?
Oracle XML Handling (v.9.2)
XML Document XML Schema in XML ?
XML SchemaRegistered ?
Physical XMLType Associated ?
Shred XML intoXMLType
Update XDB$Resource
Everybody knows EXIF…
Continued…
EXIF Data via Google Map
EXIF Metadata
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
Oracle MultiMedia
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.comhttp://www.w3.org/RDF Wikipedia - EXIF
User Defined XDB Metadata ENABLE_HIERARCHY_RESMETADATA
XML Schema based Metadata
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
Oracle XDB Event - Example
Document Event Listener?MIME type JPG
EXIF XML Schema?Event Handler? EXIF Extended
w/ USER XSD ?
Extract JPG File info
XDB$Resource
Extract JPG EXIF info
XMLType Table
Extract JPG USER metadataXMLType Table
XACE.SOURCEFORGE.NET
Recap…Its about Time to wrap it Up
xdbconfig.xml
Security ?
XMLSchema ?
Servlet ?
MIME Type?
XDB Event ?
Extention?
Event Listener Event Handler File / Folder ?
GENERAL FILE STUFF
1. EVENT LISTENER • Package
2. EVENT HANDLERS • Procedures in “Event Listener”
3. RESOURCE CONFIGURATION FILE • XML File
GENERAL (XML) FILE STUFF
• General File Stuff turns out to be XML then…
4. XML SCHEMA REGISTRATION• dbms_xmlschema.register_schema
5. EXTRA USER DEFINED METADATA NEEDED• dbms_xmlschema.enable_hierarchy_resm
etadata
Conclusions
• 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
Oracle XML DB Sample Code
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…
www.xmldb.nl
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