Scrigroup - Documente si articole

Username / Parola inexistente      

Home Documente Upload Resurse Alte limbi doc  

AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml

AspAutocadCDot netExcelFox proHtmlJava
LinuxMathcadPhotoshopPhpSqlVisual studioWindowsXml

Accessing Oracle XML DB Repository Data

xml

+ Font mai mare | - Font mai mic




DOCUMENTE SIMILARE

Trimite pe Messenger
Accessing Oracle XML DB Repository Data


18 Accessing Oracle XML DB Repository Data
This chapter describes how to access data in Oracle XML DB repository using standard protocols such as FTP, HTTP/WebDAV and other Oracle XML DB resource Application Program Interfaces (APIs). It also introduces you to using RESOURCE_VIEW and PATH_VIEW as the SQL mechanism for accessing and manipulating repository data. It includes a table for comparing repository operations through the various resource APIs.
This chapter contains these topics:
* Introducing Oracle XML DB Foldering
* Oracle XML DB Repository
* Oracle XML DB Resources
* Accessing Oracle XML DB Repository Resources
* Navigational or Path Access
* Query-Based Access
* Accessing Repository Data Using Servlets
* Accessing Data Stored in Oracle XML DB Repository Resources
* Managing and Controlling Access to Resources
Introducing Oracle XML DB Foldering
Using the foldering feature in Oracle XML DB you can store content in the database in hierarchical structures, as opposed to traditional relational database structures.
Figure 18-1 is an example of a hierarchical structure that shows a typical tree of folders and files in Oracle XML DB repository. The top of the tree shows '/', the root folder.
Foldering allows applications to access hierarchically indexed content in the database using the FTP, HTTP, and WebDAV protocol standards as if the database content is stored in a file system.
This chapter provides an overview of how to access data in Oracle XML DB repository folders using the standard protocols. There are other APIs available in this release, which allow you to access the repository object hierarchy using Java, SQL, and PL/SQL.
Figure 18-1 A Typical Folder Tree Showing Hierarchical Structures in Oracle XML Repository

igure 18-1 A Typical Folder Tree Showing Hierarchical Structures in Oracle XML Repository

Description of the illustration adxdb004.gif

Note:
The directory /sys is used by Oracle XML DB to maintain system-defined XML schemas, Access Control Lists (ACLs), and so on. In general:
* Do not store any data under the /sys directory.
* Do not modify any content in the /sys directory.


See Also:
* Chapter 20, ' SQL Access Using RESOURCE_VIEW and PATH_VIEW '
* Chapter 21, ' PL/SQL Access and Management of Data Using DBMS_XDB'
* Chapter 22, ' Java Access to Repository Data Using Resource API for Java'
* Chapter 24, ' FTP, HTTP, and WebDAV Access to Repository Data'

Oracle XML DB Repository
Oracle XML DB repository (repository) is the set of database objects, across all XML and database schemas, that are mapped to path names. It is a connected, directed, acyclic graph of resources with a single root node (/). Each resource in the graph has one or more associated path names.
The repository can be thought of as a file system of objects rather than files.

Note:
The repository supports multiple links to a given resource.

Repository Terminology
The following list describes terms used in Oracle XML DB repository:
* Resource: A resource is any object or node in the hierarchy. Resources are identified by URLs. See 'Oracle XML DB Resources'.
* Folder: A folder is a node (or directory) in the hierarchy that can contain a collection of resources. A folder is also a resource.
* Path Name: A hierarchical name composed of a root element (the first /), element separators /, and various subelements (or path elements). A path element may be composed of any character in the database character set except and /, which have special meanings in Oracle XML DB. The forward slash is the default name separator in a path name, and the backward slash is used to escape characters. The Oracle XML DB configuration file, xdbconfig.xml, also contains a list of user-defined characters that may not appear within a path name (<invalid-pathname-chars).
* Resource or Link name: The name of a resource within its parent folder. Resource names must be unique (case-sensitive in this release) within a folder. Resource names are always in the UTF8 character set (NVARCHAR).
* Contents: The body of a resource, what you get when you treat the resource like a file and ask for its contents. Contents is always an XMLType.
* XDBBinary: An XML element defined by the Oracle XML DB schema that contains binary data. XDBBinary elements are stored in the repository when unstructured binary data is uploaded into Oracle XML DB.
* Access Control List (ACL): Restricts access to a resource or resources. Oracle XML DB uses ACLs to restrict access to any Oracle XML DB resource namely any XMLType object that is mapped into the Oracle XML DB file system hierarchy.

See Also:
Chapter 23, ' Oracle XML DB Resource Security'

Many terms used by Oracle XML DB have common synonyms used in other contexts, as shown in Table 18-1.
Table 18-1 Synonyms for Oracle XML DB Foldering Terms
Synonym Oracle XML DB Foldering Term Usage
-------- ----- ------ -------- ----- ------ -----------
Collection Folder WebDAV
Directory Folder Operating systems
Privilege Privilege Permission
Right Privilege Various
WebDAV Folder Folder Web Folder
Role Group Access control
Revision Version RCS, CVS
File system Repository Operating systems
Hierarchy Repository Various
File Resource Operating systems
Binding Link WebDAV

Current Repository Folder List
The following is the current list of supplied Oracle XML DB repository files and folders. Note that besides the sys and public folders, you can create your own folders and files wherever you want:
/public
/sys
/sys/acls
/sys/acls/all_all_acl.xml
/sys/acls/all_owner_acl.xml
/sys/acls/bootstrap_acl.xml
/sys/acls/ro_all_acl.xml
/sys/apps
/sys/log
/sys/schemas
/sys/schemas/PUBLIC
/sys/schemas/PUBLIC/www.w3.org
/sys/schemas/PUBLIC/www.w3.org/2001
/sys/schemas/PUBLIC/www.w3.org/2001/xml.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/XDBFolderListing.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/XDBResource.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/XDBSchema.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/XDBStandard.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/acl.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/dav.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/log
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/log/ftplog.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/log/httplog.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/log/xdblog.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/stats.xsd
/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/xdbconfig.xsd
/xdbconfig.xml
Oracle XML DB Resources
Oracle XML DB resources conform to the xdbresource.xsd schema. This XML schema is defined by Oracle XML DB. The elements in a resource include those needed to persistently store WebDAV-defined properties, such as creation date, modification date, WebDAV locks, owner, ACL, language, and character set.

Contents Element in Resource Index
A resource index has a special element called Contents which contains the contents of the resource.

any Element
The XML schema for a resource also defines an any element, with maxoccurs unbounded, which allowed to contain any element outside the Oracle XML DB XML namespace. This way, arbitrary instance-defined properties can be associated with the resource.
Where Exactly Is Repository Data Stored?
Oracle XML DB stores repository data in a set of tables and indexes in the Oracle XML DB database schema. These tables are accessible. If you register an XML schema and request that the tables be generated by Oracle XML DB, then the tables are created in your database schema. This means that you are able to see or modify them. However, other users will not be able to see your tables unless you explicitly grant them permission to do so.
Generated Table Names
The names of the generated tables are assigned by Oracle XML DB and can be obtained by finding the xdb:defaultTable=XXX attribute in your XML schema document (or in the default XML schema document). When you register an XML schema, you can also provide your own table name, and override the default created by Oracle XML DB.

See Also:
'Creating Default Tables During XML Schema Registration' in Chapter 5 XML Schema Storage and Query: The Basics'

Defining Structured Storage for Resources
Applications that need to define structured storage for resources can do so by either:
* Subclassing the Oracle XML DB resource type. Subclassing Oracle XML DB resources requires privileges on the table XDB$RESOURCE.
* Storing data conforming to a visible, registered XML schema.

See Also:
Chapter 5, ' XML Schema Storage and Query: The Basics'

Path-Name Resolution
The data relating a folder to its children is managed by the Oracle XML DB hierarchical index. This provides a fast mechanism for evaluating path names, similar to the directory mechanisms used by operating-system file systems.
Resources that are folders have the Container attribute set to TRUE.
To resolve a resource name in a folder, the current user must have the following privileges:
* resolve privilege on the folder
* read-properties on the resource in that folder
If the user does not have these privileges, then they receive an access denied error. Folder listings and other queries will not return a row when the read-properties privilege is denied on its resource.

Note:
Error handling in path name resolution differentiates between invalid resource names and resources that are not folders for compatibility with file systems. Because Oracle XML DB resources are accessible from outside the repository (using SQL), denying read access on a folder that contains a resource will not prevent read access to that resource.

Deleting Resources
Deletion of a link deletes the resource pointed to by the link if and only if that was the last link to the resource and the resource is not versioned. Links in Oracle XML DB repository are analogous to Unix hard links.

See Also:
'Deleting Repository Resources: Examples'

Accessing Oracle XML DB Repository Resources
Oracle XML DB provides two techniques for accessing resources:
* 'Navigational or Path Access'. Navigational/or path access to content in Oracle XML DB is achieved using a hierarchical index of objects or resources. Each resource has one or more unique path names that reflect its location in the hierarchy. You can use navigational access to reference any object in the database without regard to its location in the tablespace.
* 'Query-Based Access'. SQL access to the repository is done using a set of views that expose resource properties and path names and map hierarchical access operators onto the Oracle XML DB schema.
Figure 18-2 illustrates Oracle XML DB data access options. A high level discussion of which data access option to select is described in Chapter 2, ' Getting Started with Oracle XML DB', 'Oracle XML DB Application Design: a. How Structured Is Your Data?'.

See Also:
Table 18-3, 'Accessing Oracle XML DB Repository: API Options '

Figure 18-2 Oracle XML DB Repository Data Access Options

Description of the illustration adxdb027.gif
A Uniform Resource Locator (URL) is used to access an Oracle XML DB resource. A URL includes the host name, protocol information, path name, and resource name of the object.
Navigational or Path Access
Oracle XML DB folders support the same protocol standards used by many operating systems. This allows an Oracle XML DB folder to function just like a native folder or directory in supported operating-system environments. For example, you can:
* Use Windows Explorer to open and access Oracle XML DB folders and resources the same way you access other directories or resources in the Windows NT file system, as shown in Figure 18-3.
* Access repository data using HTTP/WebDAV from an Internet Explorer browser, such as when viewing Web Folders, as shown in Figure 18-4.

Figure 18-3 Oracle XML DB Folders in Windows Explorer

Description of the illustration 4_xfoldr.jpg
Figure 18-4 Accessing Repository Data Using HTTP/WebDAV and Navigational Access From IE Browser: Viewing Web Folders

Description of the illustration 3_f_http.gif
Accessing Oracle XML DB Resources Using Internet Protocols
Oracle Net Services provides one way of accessing database resources. Oracle XML DB support for Internet protocols provides another way of accessing database resources.
Where You Can Use Oracle XML DB Protocol Access
Oracle Net Services is optimized for record-oriented data. Internet protocols are designed for stream-oriented data, such as binary files or XML text documents.
Oracle XML DB protocol access is a valuable alternative to Net Services in the following scenarios:
* Direct database access from file-oriented applications using the database like a file system
* Heterogeneous application server environments that want a uniform data access method (such as XML over HTTP, which is supported by most data servers, including MS SQL Server, Exchange, Notes, many XML databases, stock quote services and news feeds)
* Application server environments that want data as XML text
* Web applications using client-side XSL to format datagrams not needing much application processing
* Web applications using Java servlets running inside the database
* Web access to XML-oriented stored procedures
Protocol Access Calling Sequence
Oracle XML DB protocol access uses the following steps:
1. A connection object is established, and the protocol may decide to read part of the request.
2. The protocol decides if the user is already authenticated and wants to reuse an existing session or if the connection must be re-authenticated (generally the case).
3. An existing session is pulled from the session pool, or a new one is created.
4. If authentication has not been provided and the request is HTTP Get or Head, then the session is run as the ANONYMOUS user. If the session has already been authenticated as the ANONYMOUS user, then there is no cost to reuse the existing session. If authentication has been provided, then the database re-authentication routines are used to authenticate the connection.
5. The request is parsed.
6. If the requested path name maps to a servlet (for HTTP only), then the servlet is invoked using Java Virtual Machine (VM). The servlet code writes out the response to a response stream or asks XMLType instances to do so.
Retrieving Oracle XML DB Resources
When the protocol indicates that a resource is to be retrieved, the path name to the resource is resolved. Resources being fetched are always streamed out as XML, with the exception of resources containing the XDBBinary element, an element defined to be the XML binary data type, which have their contents streamed out in RAW form.
Storing Oracle XML DB Resources
When the protocol indicates that a resource must be stored, Oracle XML DB checks the document file name extension for .xml, .xsl, .xsd, and so on. If the document is XML, then a pre-parse step is done, where enough of the resource is read to determine the XML schemaLocation and namespace of the root element in the document. This location is used to look for a registered schema with that schemaLocation URL. If a registered schema is located with a definition for the root element of the current document, then the default table specified for that element is used to store the contents of that resource.
Using Internet Protocols and XMLType: XMLType Direct Stream Write
Oracle XML DB supports Internet protocols at the XMLType level by using the writeToStream ) Java method on XMLType. This method is natively implemented and writes XMLType data directly to the protocol request stream. This avoids the overhead of converting database data through Java datatypes, creating Java objects, and Java VM execution costs, resulting in significantly higher performance. This is especially the case if the Java code deals with XML element trees only close to the root, without traversing too many of the leaf elements, hence minimizing the number of Java objects created.

See Also:
Chapter 24, ' FTP, HTTP, and WebDAV Access to Repository Data'

Configuring Default Namespace to Schema Location Mappings
In general, XML DB identifies schema-based XMLType instances by pre-parsing the input XML document. If the appropriate xsi:schemaLocation or xsi:noNamespaceSchemaLocation attribute is found, the specified schema location URL is used to lookup the registered schema. If the appropriate xsi: attribute is not found, the XML document is considered to be non-schema-based. XML DB provides a mechanism to configure default schema location mappings. If the appropriate xsi: attribute is not specified in the XML document, the default schema location mappings will be used. The XDB Configuration Schema has an element 'schemaLocation-mappings' that can be used to specify the mapping between (namespace, element) pairs and its default schema location. If the 'element' value is empty, the mapping applies to all global elements in the specified namespace. If the 'namespace' value is empty, it corresponds to the null namespace.
The definition of the 'schemaLocation-mappings' element in the XDB configuration file <xdbconfig> is as follows:
<element name='schemaLocation-mappings'
type='xdbc:schemaLocation-mapping-type' minOccurs='0'/>
<complexType name='schemaLocation-mapping-type'><sequence>
<element name='schemaLocation-mapping'
minOccurs='0' maxOccurs='unbounded'>
<complexType><sequence>
<element name='namespace' type='string'/>
<element name='element' type='string'/>
<element name='schemaURL' type='string'/>
</sequence></complexType>
</element></sequence>
</complexType>
The schema location used depends on mappings in the XDB configuration file for the namespace used and the root document element. For example, assume that the document does not have the appropriate xsi: attribute to indicate the schema location. Consider a document root element R in namespace N. The algorithm for identifying the default schema location is as follows:
1. If the XDB configuration file has a mapping for N and R, the corresponding schema location is used.
2. If the configuration file has a mapping for N, but not R, the schema location for N is used.
3. If the document root R does not have any namespace, the schema location for R is used.
For example, if your XDB configuration file includes the following mapping:
<schemaLocation-mappings>
<schemaLocation-mapping>
<namespace>https://www.oracle.com/example</namespace>
<element>root</element>
<schemaURL>https://www.oracle.com/example/sch.xsd</schemaURL>
</schemaLocation-mapping>
<schemaLocation-mapping>
<namespace>https://www.oracle.com/example2</namespace>
<element></element>
<schemaURL>https://www.oracle.com/example2/sch.xsd</schemaURL>
</schemaLocation-mapping>
<schemaLocation-mapping>
<namespace></namespace>
<element>specialRoot</element>
<schemaURL>https://www.oracle.com/example3/sch.xsd</schemaURL>
</schemaLocation-mapping>
</schemaLocation-mappings>
The following schema locations are used:
* Namespace = https://www.oracle.com/exampleRoot Element = rootSchema URL = https://www.oracle.com/example/sch.xsd
This mapping is used when the instance document specifies:
<root xmlns='https://www.oracle.com/example'>
* Namespace = https://www.oracle.com/example2Root Element = null (any global element in the namespace) Schema URL = https://www.oracle.com/example2/sch.xsd
This mapping is used when the instance document specifies:
<root xmlns='https://www.oracle.example2'>
* Namespace = null (i.e null namespace) Root Element = specialRootSchema URL = https://www.oracle.com/example3/sch.xsd
This mapping is used when the instance document specifies:
<specialRoot>

Note:
This functionality is available only on the server side-when the XML is parsed on the server. If the XML is parsed on the client side, the appropriate xsi: attribute is still required.

Configuring XML File Extensions
XML DB repository treats certain files as XML documents based on their file extensions. When such files are inserted into the repository, XML DB pre-parses them to identify the schema location (or uses the default mapping if present) and inserts the document into the appropriate default table. By default, the following extensions are considered as XML file extensions: xml, xsd, xsl, xlt. In addition, XML DB provides a mechanism for applications to specify other file extensions as XML file extensions. The 'xml-extensions' element is defined in the XDB Configuration schema as follows:
<element name='xml-extensions'
type='xdbc:xml-extension-type' minOccurs='0'/>

<complexType name='xml-extension-type'><sequence>
<element name='extension' type='xdbc:exttype'
minOccurs='0' maxOccurs='unbounded'>
</element></sequence>
</complexType>
For example, the following fragment from the XDB configuration file xdbconfig.xml specifies that files with extensions vsd, vml and svgl should be treated as XML files:
<xml-extensions>
<extension>vsd</extension>
<extension>vml</extension>
<extension>svgl</extension>
</xml-extensions>
Query-Based Access
Oracle XML DB provides two repository views to enable SQL access to repository data:
* PATH_VIEW
* RESOURCE_VIEW
Table 18-2 summarizes the differences between PATH_VIEW and RESOURCE_VIEW.
Table 18-2 Differences Between PATH_VIEW and RESOURCE_VIEW
PATH_VIEW RESOURCE_VIEW
Contains link properties No link properties
Contains resource properties and path name Contains resource properties and path name
Has one row for each unique path in the repository Has one row for each resource in the repository


Note:
Each resource can have multiple paths.

The single path in the RESOURCE_VIEW is arbitrarily chosen from among the many possible paths that refer to a resource. Oracle XML DB provides operators like UNDER_PATH that enable applications to search for resources contained (recursively) within a particular folder, get the resource depth, and so on. Each row in the views is of XMLType.
DML on the Oracle XML DB repository views can be used to insert, rename, delete, and update resource properties and contents. Programmatic APIs must be used for other operations, such as creating links to existing resources.

See Also:
* Chapter 20, ' SQL Access Using RESOURCE_VIEW and PATH_VIEW ' for details on SQL repository access
* Chapter 23, ' Oracle XML DB Resource Security'
* Oracle XML API Reference

Accessing Repository Data Using Servlets
Oracle XML DB implements Java Servlet API, version 2.2, with the following exceptions:
* All servlets must be distributable. They must expect to run in different VMs.
* WAR and web.xml files are not supported. Oracle XML DB supports a subset of the XML configurations in this file. An XSL style sheet can be applied to the web.xml to generate servlet definitions. An external tool must be used to create database roles for those defined in the web.xml file.
* JSP (Java Server Pages) support can be installed as a servlet and configured manually.
* HTTPSession and related classes are not supported.
* Only one servlet context (that is, one Web application) is supported.

See Also:
Chapter 25, ' Writing Oracle XML DB Applications in Java'

Accessing Data Stored in Oracle XML DB Repository Resources
The three main ways you can access data stored in Oracle XML DB repository resources are through:
* Oracle XML DB resource APIs for Java
* A combination of Oracle XML DB resource views API and Oracle XML DB resource API for PL/SQL
* Internet protocols (HTTP/WebDAV and FTP) and Oracle XML DB protocol server
Table 18-3 lists common Oracle XML DB repository operations and describes how these operations can be accomplished using each of the three methods. The table shows functionality common to three methods. Note that not all the methods are equally suited to a particular set of tasks.

See Also:
* Chapter 20, ' SQL Access Using RESOURCE_VIEW and PATH_VIEW '
* Chapter 21, ' PL/SQL Access and Management of Data Using DBMS_XDB'
* Chapter 22, ' Java Access to Repository Data Using Resource API for Java'
* Chapter 24, ' FTP, HTTP, and WebDAV Access to Repository Data'
* Oracle XML API Reference

Table 18-3 Accessing Oracle XML DB Repository: API Options
Data Access Operation
Query-Based Access: RESOURCE_VIEW APIPath-Based Access: Resource API for PL/SQL
Path-Based Access: Protocols
Creating a resource
INSERT INTO PATH_VIEW VALUES (path, res, linkprop);
See also DBMS_XDB.CreateResource.
HTTP PUT;
FTP PUT
Updating contents of a resource using path name
UPDATE RESOURCE_VIEW SET resource = updateXML res, '/Resource/Contents', lob) WHERE EQUALS_PATH(res, :path) > 0;
HTTP PUT;
FTP PUT
Updating properties of a resource by path name
UPDATE RESOURCE_VIEW SET resource = updateXML res, '/Resource/propname', newval, '/Resource/propname2', newval2, ) WHERE EQUALS_PATH(res, :path) > 0;
WebDAV PROPPATCH;
FTP N/A
Updating the ACL of a resource
UPDATE RESOURCE_VIEW SET resource = updateXML res, '/ Resource/ACL', XMLType) WHERE EQUALS_PATH(res, :path) > 0;
N/A
Unlinking a resource, deleting it if it is the last link
DELETE FROM RESOURCE_VIEW WHERE EQUALS_PATH(res, :path) > 0;
HTTP DELETE;
FTP DELETE
Forcibly removing all links to a resource
DELETE FROM PATH_VIEW WHERE extractValue res,'display_name') = 'My resource';
N/A
Moving a resource or folder
UPDATE PATH_VIEW SET path = newpath WHERE EQUALS_PATH(res, :path) > 0
WebDAV MOVE;
FTP RENAME
Copying a resource or folder
INSERT INTO PATH_VIEW SELECT ::newpath, res, link FROM PATH_VIEW WHERE EQUALS_PATH(res,:oldpath)>0;
WebDAV COPY;
FTP N/A
Creating a link to an existing resource
Call dbms_xdb.Link srcpath IN VARCHAR2, linkfolder IN VARCHAR2, linkname IN VARCHAR2);
N/A
Getting binary or text representation of resource contents by path name
SELECT p.res.extract '/Resource/Contents') FROM RESOURCE_VIEW p WHERE EQUALS_PATH(res, :path) > 0 SELECT XDBUriType(:path).getBlob() FROM dual;
HTTP GET;
FTP GET
Getting XMLType representation of resource contents by path name
SELECT extract(res, '/Resource/Contents/*') FROM RESOURCE_VIEW p WHERE EQUALS_PATH(Res, :path) > 0;
N/A
Getting resource properties by path name
SELECT extractValue res, '/Resource/XXX') FROM RESOURCE_VIEW WHERE EQUALS_PATH(res,:path) > 0;
WebDAVPROPFIND (depth = 0);
FTP N/A
Listing a directory
SELECT * FROM PATH_VIEW WHERE UNDER_PATH(res, :path, 1) > 0;
WebDAVPROPFIND (depth = 0);
FTP N/A
Creating a folder
Call dbms_xdb.createFolder VARCHAR2);
WebDAV MKCOL;
FTP MKDIR
Unlinking a folder
DELETE FROM PATH_VIEW WHERE EQUALS_PATH(res, :path) > 0;
HTTP DELETE;
FTP RMDIR
Forcibly deleting a folder and all links to it
Call dbms_xdb.deleteFolder VARCHAR2);
N/A
Getting a resource with a row lock
SELECT FROM RESOURCE_VIEW FOR UPDATE ;
N/A
Putting a WebDAV lock on the resource
DBMS_XDB.LockResource path,true,true);
WebDAV LOCK;
FTP: QUOTE LOCK
Removing a WebDAV lock
DBMS_XDB.GetLockToken :path,deltoken); DBMS_XDB.UnlockToken(path,deltoken);
WebDAV UNLOCK;
QUOTE UNLOCK
Committing changes
COMMIT;
Automatically commits at the end of each request
Rollback changes
ROLLBACK;
N/A

Managing and Controlling Access to Resources
You can set access control privileges on Oracle XML DB folders and resources.

See Also:
* Chapter 23, ' Oracle XML DB Resource Security' for more detail on using access control on Oracle XML DB folders
* Chapter 26, ' Managing Oracle XML DB Using Oracle Enterprise Manager'
* Oracle XML API Reference the chapters on DBMS_XDB

Setting and Accessing Custom Namespace Properties
Oracle XML DB resources declare a fixed set of metadata properties such as the Owner and CreationDate. You can specify values for these metadata attributes while creating or updating resources.
You can also store proprietary (custom) tags as extra metadata with resources, that is metadata properties that are not defined by the Resource XML schema. To do so, you must store the extra metadata as a CLOB in the ResExtra element.
Note that the default schema has a top-level any element (declared with maxOccurs= 'unbounded'). This allows any valid XML data as part of the resource document and gets stored in the RESEXTRA CLOB column as shown in Example 18-1.
Example 18-1 Storing Extra Metadata
<Resource xmlns='https://xmlns.oracle.com/xdb/XDBResource.xsd'
<Owner>SCOTT</Owner>
< other system defined metadata -->
<!-- User Metadata (appearing within different namespace) -->
<ResExtra>
<myCustomAttrs xmlns='https://www.example.com/customattr'>
<attr1>value1</attr1>
<attr2>value2</attr2>
</myCustomAttrs>
</ResExtra
<!-- contents of the resource>
<Contents>

</Contents>
</Resource>
You cannot extend the resource schema itself. However, you can set and access custom properties belonging to other namespaces (other than XDBResource.xsd) using DOM operations on the <RESOURCE> document. The following example shows some basic operations.
Example 18-2 Custom Properties on a Resource Document
-- Utility function to append a (direct) child to given document
create or replace function appendChild(doc xmltype, child xmltype)
return xmltype as
d dbms_xmldom.DOMDocument;
c dbms_xmldom.DOMDocument;
dn dbms_xmldom.DOMNode;
cn dbms_xmldom.DOMNode;
begin
d := dbms_xmldom.newDOMDocument(doc);
dn := dbms_xmldom.makeNode(d);
dn := dbms_xmldom.getFirstChild(dn);

c := dbms_xmldom.newDOMDocument(child);
cn := dbms_xmldom.makeNode(c);
cn := dbms_xmldom.getFirstChild(cn);
dn := dbms_xmldom.appendChild(dn, cn);

return doc;
end;/


-- create a NSB resource
declare
ret boolean;
begin
ret := dbms_xdb.createresource('/public/foo1.txt', 'abc def');
end;/

commit;

-- update resource to set custom property <RANDOM> in foo namespace
-- Note : the custom properties should belong to a namespace other than
-- the XDBResource.xsd namespace
--
update resource_view
set res =
appendChild res, xmltype('<FOO:RANDOM xmlns:foo='foo'>3456</FOO:RANDOM>'))
where any_path = '/public/foo1.txt';
commit;

-- select resource
select e.res.getclobval()
from resource_view e
where e.any_path = '/public/foo1.txt';

-- select custom property
select e.res.extract('/r:Resource/foo:random',
'xmlns:r='https://xmlns.oracle.com/xdb/XDBResource.xsd'
xmlns:foo='foo'').getstringval()
from resource_view e
where any_path = '/public/foo1.txt';

-- select custom property value
select e.res.extract('/r:Resource/foo:random/text()',
'xmlns:r='https://xmlns.oracle.com/xdb/XDBResource.xsd'
xmlns:foo='foo'').getstringval()
from resource_view e
where any_path = '/public/foo1.txt';









Politica de confidentialitate



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 1188
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2021 . All rights reserved

Distribuie URL

Adauga cod HTML in site