DBA Data[Home] [Help]

PACKAGE: XDB.DBMS_XDB

Source


1 PACKAGE     dbms_xdb AUTHID CURRENT_USER IS
2 
3 ------------
4 -- CONSTANTS
5 --
6 ------------
7 DELETE_RESOURCE        CONSTANT NUMBER := 1;
8 DELETE_RECURSIVE       CONSTANT NUMBER := 2;
9 DELETE_FORCE           CONSTANT NUMBER := 3;
10 DELETE_RECURSIVE_FORCE CONSTANT NUMBER := 4;
11 
12 DELETE_RES_METADATA_CASCADE   CONSTANT NUMBER := 1;
13 DELETE_RES_METADATA_NOCASCADE CONSTANT NUMBER := 2;
14 
15 -- Constant number for 1st argument of setListenerEndPoint
16 XDB_ENDPOINT_HTTP  CONSTANT NUMBER := 1;
17 XDB_ENDPOINT_HTTP2 CONSTANT NUMBER := 2;
18 XDB_ENDPOINT_HTTPS CONSTANT NUMBER := 2;
19 
20 -- Constant number for 4th argument of setListenerEndPoint
21 XDB_PROTOCOL_TCP   CONSTANT NUMBER := 1;
22 XDB_PROTOCOL_TCPS  CONSTANT NUMBER := 2;
23 
24 DEFAULT_LOCK_TIMEOUT CONSTANT PLS_INTEGER := (60*60);
25 
26 LINK_TYPE_HARD        CONSTANT NUMBER := 1;
27 LINK_TYPE_WEAK        CONSTANT NUMBER := 2;
28 LINK_TYPE_SYMBOLIC    CONSTANT NUMBER := 3;
29 
30 ON_DENY_NEXT_CUSTOM   CONSTANT NUMBER := 1;
31 ON_DENY_BASIC         CONSTANT NUMBER := 2;
32 
33 ---------------------------------------------
34 -- FUNCTION - LockResource
35 --     Gets a webdav-like lock for XDB resource given its path
36 -- PARAMETERS -
37 --  abspath
38 --     Absolute path in the Hierarchy of the resource
39 --  depthzero
40 --     depth zero boolean
41 --  shared
42 --     shared boolean
43 -- RETURNS -
44 --     Returns TRUE if successful
45 ---------------------------------------------
46 FUNCTION LockResource(abspath IN VARCHAR2, depthzero IN BOOLEAN,
47                                            shared IN boolean)
48               RETURN boolean;
49 
50 ---------------------------------------------
51 -- FUNCTION - LockResource
52 --     Gets a webdav-like lock for XDB resource given its path
53 -- PARAMETERS -
54 --  abspath
55 --     Absolute path in the Hierarchy of the resource
56 --  depthzero
57 --     depth zero boolean
58 --  shared
59 --     shared boolean
60 --  token
61 --     generated token
62 --  timeout
63 --     time (in seconds) after which lock expires
64 -- RETURNS -
65 --     Returns TRUE if successful
66 ---------------------------------------------
67 FUNCTION LockResource(abspath IN VARCHAR2, depthzero IN BOOLEAN,
68                       shared IN boolean, token OUT VARCHAR2,
69                       timeout IN PLS_INTEGER := DEFAULT_LOCK_TIMEOUT)
70               RETURN boolean;
71 
72 ---------------------------------------------
73 -- PROCEDURE - RefreshLock
74 --     Refreshes a webdav-like lock for XDB resource given its path
75 -- PARAMETERS -
76 --  abspath
77 --     Absolute path in the Hierarchy of the resource
78 --  token
79 --     token corresponding to the lock to be refreshed
80 --  newTimeout
81 --     new timeout (in seconds) after which lock will expire
82 -- NOTE -
83 --     If the timeout is less than the remaining time to expiry,
84 --     lock will not be refreshed
85 ---------------------------------------------
86 
87 PROCEDURE RefreshLock(abspath IN VARCHAR2, token IN VARCHAR2,
88                      newTimeout IN  PLS_INTEGER := DEFAULT_LOCK_TIMEOUT);
89 
90 ---------------------------------------------
91 -- FUNCTION - LockDiscovery
92 --     Gets Locks element on resource defined by abspath
93 -- PARAMETERS -
94 --  abspath
95 --     Absolute path in the Hierarchy of the resource
96 -- RETURNS -
97 --     the Locks element as XMLType
98 ---------------------------------------------
99 FUNCTION LockDiscovery(abspath IN VARCHAR2)
100                RETURN SYS.XMLType;
101 
102 ---------------------------------------------
103 -- PROCEDURE - GetLockToken
104 --     Gets lock token for current user for XDB resource given its path
105 -- PARAMETERS -
106 --  abspath
107 --     Absolute path in the Hierarchy of the resource
108 --  locktoken (OUT)
109 --     Returns lock token
110 ---------------------------------------------
111 PROCEDURE GetLockToken(abspath IN VARCHAR2, locktoken OUT VARCHAR2);
112 
113 ---------------------------------------------
114 -- FUNCTION - Unlock
115 --     Removes lock for XDB resource given lock token
116 -- PARAMETERS -
117 --  abspath
118 --     Absolute path in the Hierarchy of the resource
119 --  delToken
120 --     Lock token name to be removed
121 -- RETURNS -
122 --     Returns TRUE if successful
123 ---------------------------------------------
124 FUNCTION UnlockResource(abspath IN VARCHAR2, deltoken IN VARCHAR2 := NULL)
125                         RETURN boolean;
126 
127 ---------------------------------------------
128 -- PROCEDURE - AddToLockTokenList
129 --     Adds specified token to the session lock token list
130 -- PARAMETERS -
131 --  token
132 --     token to be added to token list
133 ---------------------------------------------
134 PROCEDURE AddToLockTokenList(token IN VARCHAR2);
135 
136 ---------------------------------------------
137 -- FUNCTION - DeleteFromLockTokenList
138 --     Deletes specified token from the session lock token list
139 -- PARAMETERS -
140 --  token
141 --     token to be deleted from token list
142 -- RETURNS -
143 --     returns TRUE if delete was successful
144 ---------------------------------------------
145 FUNCTION DeleteFromLockTokenList(token IN VARCHAR2)
146                         RETURN boolean;
147 
148 ---------------------------------------------
149 -- FUNCTION - GetLockTokenList
150 --     Gets the session lock token list
151 -- PARAMETERS -
152 --  None
153 -- RETURNS -
154 --  The session lock token list
155 ---------------------------------------------
156 FUNCTION GetLockTokenList RETURN LockTokenListType;
157 
158 ---------------------------------------------
159 -- FUNCTION - ExistsResource(VARCHAR2)
160 --     Given a string, returns true if the resource exists in the hierarchy.
161 -- PARAMETERS -
162 --  abspath
163 --     Absolute path to the resource
164 -- RETURNS -
165 --     Returns TRUE if resource was found in the hierarchy.
166 ---------------------------------------------
167 FUNCTION ExistsResource(abspath IN VARCHAR2) RETURN BOOLEAN;
168 
169 ---------------------------------------------
170 -- FUNCTION - CreateResource(VARCHAR2, VARCHAR2, VARCHAR2, VARCHAR2)
171 --     Given a string, inserts a new resource into the hierarchy with
172 --     the string as the contents.
173 -- PARAMETERS -
174 --  abspath
175 --     Absolute path to the resource
176 --  data
177 --     String buffer containing the resource contents
178 --  schemaurl
179 --     for XML data, schema URL data conforms to (default null)
180 --  elem
181 --     element name (default null)
182 -- RETURNS -
183 --     Returns TRUE if resource was successfully inserted or updated
184 ---------------------------------------------
185 FUNCTION CreateResource(abspath IN VARCHAR2,
186                         data IN VARCHAR2,
187                         schemaurl IN VARCHAR2 := NULL,
188                         elem IN VARCHAR2 := NULL) RETURN BOOLEAN;
189 
190 ---------------------------------------------
191 -- FUNCTION - CreateResource(VARCHAR2, SYS.XMLTYPE, VARCHAR2, VARCHAR2)
192 --     Given an XMLTYPE and a schema URL, inserts a new resource
193 --     into the hierarchy with the XMLTYPE as the contents.
194 -- PARAMETERS -
195 --  abspath
196 --     Absolute path to the resource
197 --  data
198 --     XMLTYPE containing the resource contents
199 --  schemaurl
200 --     schema URL the XmlType conforms to (default null)
201 --  elem
202 --     element name (default null)
203 -- RETURNS -
204 --     Returns TRUE if resource was successfully inserted or updated
205 ---------------------------------------------
206 FUNCTION CreateResource(abspath IN VARCHAR2,
207                         data IN SYS.XMLTYPE,
208                         schemaurl IN VARCHAR2 := NULL,
209                         elem IN VARCHAR2 := NULL) RETURN BOOLEAN;
210 
211 
212 ---------------------------------------------
213 -- FUNCTION - CreateResource(VARCHAR2, REF SYS.XMLTYPE, BOOLEAN, BOOLEAN)
214 --     Given a PREF to an existing XMLType row, inserts a new resource
215 --     whose contents point directly at that row.  That row should
216 --     not already exist inside another resource.
217 -- PARAMETERS -
218 --  abspath
219 --     Absolute path to the resource
220 --  data
221 --     REF to the XMLType row containing the resource contents
222 --  sticky
223 --     If TRUE creates a sticky REF, otherwise non-sticky.
224 --     Default is TRUE (for backwards compatibility).
225 --  calcSize
226 --     If true, calculate the content size of the resource. Default is
227 --     false for performance reasons.
228 -- RETURNS -
229 --     Returns TRUE if resource was successfully inserted or updated
230 ---------------------------------------------
231 FUNCTION CreateResource(abspath IN VARCHAR2,
232                         data IN REF SYS.xmltype,
233                         sticky IN BOOLEAN := TRUE,
234                         calcSize IN BOOLEAN := FALSE) RETURN BOOLEAN;
235 
236 ---------------------------------------------
237 -- FUNCTION - CreateResource(VARCHAR2, CLOB)
238 --     Given a CLOB, inserts a new resource into the hierarchy with
239 --     the CLOB as the contents.
240 -- PARAMETERS -
241 --  abspath
242 --     Absolute path to the resource
243 --  data
244 --     CLOB containing the resource contents
245 -- RETURNS -
246 --     Returns TRUE if resource was successfully inserted or updated
247 ---------------------------------------------
248 FUNCTION CreateResource(abspath IN VARCHAR2,
249                         data IN CLOB) RETURN BOOLEAN;
250 
251 ---------------------------------------------
252 -- FUNCTION - CreateResource(VARCHAR2, BFILE, NUMBER)
253 --     Given a BFILE, inserts a new resource into the hierarchy with
254 --     the contents loaded from the BFILE.
255 -- PARAMETERS -
256 --  abspath
257 --     Absolute path to the resource
258 --  data
259 --     BFILE containing the resource contents
260 --  csid
261 --     character set id of the input bfile
262 -- RETURNS -
263 --     Returns TRUE if resource was successfully inserted or updated
264 ---------------------------------------------
265 FUNCTION CreateResource(abspath IN VARCHAR2,
266                         data IN BFILE,
267                         csid IN NUMBER := 0) RETURN BOOLEAN;
268 
269 ---------------------------------------------
270 -- FUNCTION - CreateResource(VARCHAR2, BLOB, NUMBER)
271 --     Given a BLOB, inserts a new resource into the hierarchy with
272 --     the BLOB as the contents.
273 -- PARAMETERS -
274 --  abspath
275 --     Absolute path to the resource
276 --  data
277 --     BLOB containing the resource contents
278 --  csid
279 --     character set id of the input blob
280 -- RETURNS -
281 --     Returns TRUE if resource was successfully inserted or updated
282 ---------------------------------------------
283 FUNCTION CreateResource(abspath IN VARCHAR2,
284                         data IN BLOB,
285                         csid IN NUMBER := 0) RETURN BOOLEAN;
286 
287 
288 ---------------------------------------------
289 -- FUNCTION - CreateFolder
290 --     Creates a folder in the Repository
291 -- PARAMETERS -
292 --  abspath
293 --     Absolute path iin the Hierarchy were the resource will be stored
294 -- RETURNS -
295 --     Returns TRUE if folder was created succesfully in Repository
296 ---------------------------------------------
297 FUNCTION CreateFolder(abspath IN VARCHAR2) RETURN BOOLEAN;
298 
299 ---------------------------------------------
300 -- FUNCTION - AddResource(VARCHAR2, VARCHAR2)
301 --     Given a string, inserts a new resource into the hierarchy with
302 --     the string as the contents.
303 -- PARAMETERS -
304 --  abspath
305 --     Absolute path to the resource
306 --  data
307 --     String buffer containing the resource contents
308 -- RETURNS -
309 --     Returns 2 if resource already exists
310 --             1 if resource was successfully inserted
311 --             0 otherwise
312 ---------------------------------------------
313 FUNCTION AddResource(abspath IN VARCHAR2,
314                         data IN VARCHAR2) RETURN NUMBER;
315 
316 ---------------------------------------------
317 -- PROCEDURE - DeleteResource
318 --     Deletes a resource from the Hierarchy
319 -- PARAMETERS -
320 --  abspath
321 --     Absolute path in the Hierarchy for resource to be deleted
322 --  delete_option : one of the following
323 --    DELETE_RESOURCE ::
324 --      delete the resource alone. Fails if the resource has children
325 --    DELETE_RECURSIVE ::
326 --      delete the resource with the children, if any.
327 --    DELETE_FORCE ::
328 --      delete the resource even if the object it contains is invalid.
329 --    DELETE_RECURSIVE_FORCE ::
330 --      delete the resource and all children, ignoring any errors raised
331 --      by contained objects being invalid
332 ---------------------------------------------
333 PROCEDURE DeleteResource(abspath IN VARCHAR2,
334                          delete_option IN pls_integer := DELETE_RESOURCE);
335 
336 ---------------------------------------------
337 -- PROCEDURE - Link
338 --     Creates a link from a specified folder to a specified resource.
339 -- PARAMETERS -
340 --  srcpath
341 --     Path name of the resource to which a link is created.
342 --  linkfolder
343 --     Folder in which the new link is placed.
344 --  linkname
345 --     Name of the new link.
346 --  linktype
347 --     Type of link to be created.
348 --     One of the following:
349 --         DBMS_XDB.LINK_TYPE_HARD (default)
350 --         DBMS_XDB.LINK_TYPE_WEAK
351 --         DBMS_XDB.LINK_TYPE_SYMBOLIC
352 ---------------------------------------------
353 PROCEDURE Link(srcpath IN VARCHAR2, linkfolder IN VARCHAR2,
354                linkname IN VARCHAR2,
355                linktype IN PLS_INTEGER := DBMS_XDB.LINK_TYPE_HARD);
356 
357 ---------------------------------------------
358 -- PROCEDURE - Rename
359 --     Renames a XDB resource
360 -- PARAMETERS -
361 --  srcpath
362 --     Absolute path in the Hierarchy of the source resource
363 --  destfolder
364 --     Absolute path in the Hierarchy of the dest folder
365 --  newname
366 --     Name of the child in the destination folder
367 ---------------------------------------------
368 PROCEDURE RenameResource(srcpath IN VARCHAR2, destfolder IN VARCHAR2,
369                          newname IN VARCHAR2);
370 
371 ---------------------------------------------
372 -- FUNCTION - getAclDoc
373 --     gets acl document that protects resource given in path
374 -- PARAMETERS -
375 --  abspath
376 --     Absolute path in the Hierarchy of the resource whose acl doc is required
377 -- RETURNS -
378 --     Returns xmltype for acl document
379 ---------------------------------------------
380 FUNCTION getAclDocument(abspath IN VARCHAR2) RETURN sys.xmltype;
381 
382 ---------------------------------------------
383 -- FUNCTION - getPrivileges
384 --     Gets all system and user privileges granted to the current user
385 --     on the given XDB resource
386 -- PARAMETERS -
387 --  res_path
388 --     Absolute path in the Hierarchy for XDB resource
389 -- RETURNS -
390 --     Returns a XMLType instance of <privilege> element
391 --     which contains the list of all (leaf) privileges
392 --     granted on this resource to the current user.
393 --     It includes all granted system and user privileges.
394 --     Example :
395 --       <privilege xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
396 --                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
397 --                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
398 --                                      http://xmlns.oracle.com/xdb/acl.xsd"
399 --                  xmlns:dav="DAV:"
400 --                  xmlns:emp="http://www.example.com/emp.xsd">
401 --          <read-contents/>
402 --          <read-properties/>
403 --          <resolve/>
404 --          <dav:read-acl/>
405 --          <emp:Hire/>
406 --       </privilege>
407 ---------------------------------------------
408 FUNCTION getPrivileges(res_path IN VARCHAR2) RETURN sys.xmltype;
409 
410 ---------------------------------------------
411 -- FUNCTION - changePrivileges
412 --     change access privileges on given XDB resource
413 -- PARAMETERS -
414 --  res_path
415 --     Absolute path in the Hierarchy for XDB resource
416 --  ace
417 --     an XMLType instance of the <ace> element which specifies
418 --     the <principal>, the operation <grant> and the list of
419 --     privileges.
420 --     If no ACE with the same principal and the same operation
421 --     (grant/deny) already exists in the ACL, the new ACE is added
422 --     at the end of the ACL.
423 --  replace
424 --    This argument determines the result of changePrivileges if
425 --    an ACE with the same principal and same operation (grant/deny)
426 --    already exists in the ACL.
427 --
428 --    If set to TRUE,
429 --       the old ACE is replaced with the new one.
430 --    else
431 --       the privileges of the old and new ACEs are combined into a
432 --       single ACE.
433 --
434 -- RETURNS -
435 --     Returns positive integer if ACL was successfully modified
436 ---------------------------------------------
437 FUNCTION changePrivileges(res_path IN VARCHAR2,
438                           ace      IN xmltype)
439                           RETURN pls_integer;
440 
441 ---------------------------------------------
442 -- FUNCTION - checkPrivileges
443 --     checks access privileges granted on specified XDB resource
444 -- PARAMETERS -
445 --  res_path
446 --     Absolute path in the Hierarchy for XDB resource
447 --  privs
448 --     Requested set of access privileges
449 --     This argument is a XMLType instance of the <privilege> element.
450 -- RETURNS -
451 --     Returns positive integer if all requested privileges granted
452 ---------------------------------------------
453 FUNCTION checkPrivileges(res_path IN VARCHAR2,
454                          privs IN xmltype)
455                          RETURN pls_integer;
456 
457 ---------------------------------------------
458 -- PROCEDURE - setFTPPort
459 --     sets the FTP port to new value
460 -- PARAMETERS -
461 --     new_port
462 --         value that the ftp port will be set to
463 ---------------------------------------------
464 
465 PROCEDURE setFTPPort(new_port IN NUMBER);
466 
467 ---------------------------------------------
468 -- FUNCTION - getFTPPort
469 --     gets the current value of FTP port
470 -- PARAMETERS -
471 --     none
472 -- RETURNS
473 --     ftp_port
474 --         current value of ftp-port
475 ---------------------------------------------
476 
477 FUNCTION getFTPPort RETURN NUMBER;
478 
479 ---------------------------------------------
480 -- PROCEDURE - setHTTPPort
481 --     sets the HTTP port to new value
482 -- PARAMETERS -
483 --     new_port
484 --         value that the http port will be set to
485 ---------------------------------------------
486 
487 PROCEDURE setHTTPPort(new_port IN NUMBER);
488 
489 ---------------------------------------------
490 -- FUNCTION - getHTTPPort
491 --     gets the current value of HTTP port
492 -- PARAMETERS -
493 --     none
494 -- RETURNS
495 --     http_port
496 --         current value of http-port
497 ---------------------------------------------
498 
499 FUNCTION getHTTPPort RETURN NUMBER;
500 
501 ---------------------------------------------
502 -- PROCEDURE setListenerEndPoint(endpoint IN number, host IN varchar2,
503 --                               port IN number, protocol IN number);
504 
505 -- This procedure sets the parameters of a listener end point corresponding
506 -- to the XML DB HTTP server. Both HTTP and HTTP2 end points can be set by
507 -- invoking this procedure.
508 
509 --   (a) endpoint - The end point to be set. Its value can be
510 --       XDB_ENDPOINT_HTTP or XDB_ENDPOINT_HTTP2.
511 --   (b) host - The interface on which the listener end point is to listen.
512 --       Its value can be 'localhost,' null, or a hostname. If its value is
513 --       'localhost,' then the listener end point is permitted to only listen
514 --       on the localhost interface. If its value is null or hostname, then
515 --       the listener end point is permitted to listen on both localhost and
516 --       non-localhost interfaces.
517 --   (c) port - The port on which the listener end point is to listen.
518 --   (d) protocol - The transport protocol that the listener end point is to
519 --       accept. Its value can be XDB_PROTOCOL_TCP or XDB_PROTOCOL_TCPS.
520 ---------------------------------------------
521 
522 PROCEDURE setListenerEndPoint(endpoint IN number, host IN varchar2,
523                               port IN number, protocol IN number);
524 
525 ---------------------------------------------
526 --  PROCEDURE getListenerEndPoint(endpoint IN NUMBER, host OUT VARCHAR2,
527 --                                port OUT NUMBER, protocol OUT NUMBER);
528 
529 -- This procedure retrieves the parameters of a listener end point
530 -- corresponding to the XML DB HTTP server. The parameters of both HTTP
531 -- and HTTP2 end points can be retrieved by invoking this procedure.
532 
533 --  (a) endpoint - The end point whose parameters are to be retrieved. Its
534 --      value can be XDB_ENDPOINT_HTTP or XDB_ENDPOINT_HTTP2.
535 --  (b) host - The interface on which the listener end point listens.
536 --  (c) port - The port on which the listener end point listens.
537 --  (d) protocol - The transport protocol accepted by the listener end point.
538 ---------------------------------------------
539 
540 PROCEDURE getListenerEndPoint(endpoint IN NUMBER, host OUT VARCHAR2,
541                               port OUT NUMBER, protocol OUT NUMBER);
542 
543 ---------------------------------------------
544 -- PROCEDURE setListenerLocalAccess(l_access boolean);
545 -- This procedure restricts all listener end points of the XML DB HTTP server
546 -- to listen only on the localhost interface (when l_access is TRUE) or
547 -- allows all listener end points of the XML DB HTTP server to listen on
548 -- both localhost and non-localhost interfaces (when l_access is FALSE).
549 
550 --  (a) l_access - TRUE or FALSE. See description of procedure above.
551 ---------------------------------------------
552 PROCEDURE setListenerLocalAccess(l_access boolean);
553 
554 ---------------------------------------------
555 -- PROCEDURE - setacl
556 --     sets the ACL on given XDB resource to be the specified in the acl path
557 -- PARAMETERS -
558 --  res_path
559 --     Absolute path in the Hierarchy for XDB resource
560 --  acl_path
561 --     Absolute path in the Hierarchy for XDB acl
562 ---------------------------------------------
563 PROCEDURE setacl(res_path IN VARCHAR2, acl_path IN VARCHAR2);
564 
565 ---------------------------------------------
566 -- FUNCTION - AclCheckPrivileges
567 --     checks access privileges granted by specified ACL document
568 -- PARAMETERS -
569 --  acl_path
570 --     Absolute path in the Hierarchy for ACL document
571 --  owner
572 --     Resource owner name. The pseudo user "XDBOWNER" is replaced
573 --     by this user during ACL privilege resolution
574 --  privs
575 --     Requested set of access privileges
576 --     This argument is a XMLType instance of the <privilege> element.
577 -- RETURNS -
578 --     Returns positive integer if all requested privileges granted
579 ---------------------------------------------
580 FUNCTION AclCheckPrivileges(acl_path IN VARCHAR2,
581                             owner IN VARCHAR2,
582                             privs IN xmltype)
583                             RETURN pls_integer;
584 
585 ---------------------------------------------
586 -- PROCEDURE - refresh
587 --     Refreshes the session configuration with the latest configuration
588 ---------------------------------------------
589 PROCEDURE cfg_refresh;
590 
591 ---------------------------------------------
592 -- FUNCTION - get
593 --     retrieves the xdb configuration
594 -- RETURNS -
595 --     XMLType for xdb configuration
596 ---------------------------------------------
597 FUNCTION cfg_get RETURN sys.xmltype;
598 
599 ---------------------------------------------
600 -- PROCEDURE - update
601 --     Updates the xdb configuration with the input xmltype document
602 -- PARAMETERS -
603 --  xdbconfig
604 ---     XMLType for xdb configuration
605 --------------------------------------------
606 PROCEDURE cfg_update(xdbconfig IN sys.xmltype);
607 
608 ---------------------------------------------
609 -- FUNCTION - GetResOID(abspath VARCHAR2)
610 --     Returns the OID of the resource, given its absolute path
611 --
612 -- PARAMETERS -
613 --  abspath
614 --     Absolute path to the resource
615 -- RETURNS -
616 --     OID of resource if present, NULL otherwise
617 ---------------------------------------------
618 FUNCTION GetResOID(abspath IN VARCHAR2) RETURN RAW;
619 
620 ---------------------------------------------
621 -- FUNCTION - CreateOIDPath(oid RAW)
622 --     Returns the OID-based virtual path to the resource
623 --
624 -- PARAMETERS -
625 --  OID
626 --     OID of the resource
627 -- RETURNS -
628 --     the OID-based virtual path to the resource
629 ---------------------------------------------
630 FUNCTION CreateOIDPath(oid IN RAW) RETURN VARCHAR2;
631 
632 -----------------------------------------------------------
633 -- PROCEDURE - appendResourceMetadata
634 --     Appends the given piece of metadata to the resource
635 --
636 -- PARAMETERS -
637 --  abspath
638 --     Absolute path of the resource
639 --  data
640 --     Metadata (can be schema based or NSB). SB metadata
641 --     will be stored in its own table.
642 -- RETURNS -
643 --     Nothing
644 -----------------------------------------------------------
645 PROCEDURE appendResourceMetadata(abspath IN VARCHAR2,
646                                  data IN SYS.xmltype);
647 
648 -----------------------------------------------------------
649 -- PROCEDURE - appendResourceMetadata
650 --     Appends the given piece of metadata identified by a REF
651 --     to the resource
652 --
653 -- PARAMETERS -
654 --  abspath
655 --     Absolute path of the resource
656 --  data
657 --     REF to the piece of metadata (schema based)
658 -- RETURNS -
659 --     Nothing
660 -----------------------------------------------------------
661 PROCEDURE appendResourceMetadata(abspath IN VARCHAR2,
662                                  data IN REF SYS.xmltype);
663 
664 -----------------------------------------------------------
665 -- PROCEDURE - deleteResourceMetadata
666 --     Deletes metadata from a resource (can only be used for SB metadata)
667 --
668 -- PARAMETERS -
669 --  abspath
670 --     Absolute path of the resource
671 --  metadata
672 --     REF to the piece of metadata (schema based) to be deleted
673 --  delete_option
674 --     Can be one of the following:
675 --     DELETE_RES_METADATA_CASCADE : deletes the corresponding row
676 --     in the metadata table
677 --     DELETE_RES_METADATA_NOCASCADE : does not delete the row in
678 --     the metadata table
679 -- RETURNS -
680 --     Nothing
681 -----------------------------------------------------------
682 PROCEDURE deleteResourceMetadata(abspath IN VARCHAR2,
683                                  metadata IN REF SYS.XMLTYPE,
684                                  delete_option IN pls_integer :=
685                                   DELETE_RES_METADATA_CASCADE);
686 
687 -----------------------------------------------------------
688 -- PROCEDURE - deleteResourceMetadata
689 --     Deletes metadata from a resource (can be used for SB or
690 --     NSB metadata)
691 --
692 -- PARAMETERS -
693 --  abspath
694 --     Absolute path of the resource
695 --  metadatans
696 --     Namespace of the metadata fragment to be removed
697 --  metadataname
698 --     Local name of the metadata fragment to be removed
699 --  delete_option
700 --     This is only applicable for SB metadata.
701 --     Can be one of the following:
702 --     DELETE_RES_METADATA_CASCADE : deletes the corresponding row
703 --     in the metadata table
704 --     DELETE_RES_METADATA_NOCASCADE : does not delete the row in
705 --     the metadata table
706 -- RETURNS -
707 --     Nothing
708 -----------------------------------------------------------
709 procedure deleteResourceMetadata(abspath IN VARCHAR2,
710                                  metadatans IN VARCHAR2,
711                                  metadataname IN VARCHAR2,
712                                  delete_option IN pls_integer :=
713                                  DELETE_RES_METADATA_CASCADE);
714 
715 -----------------------------------------------------------
716 -- PROCEDURE - updateResourceMetadata
717 --     Updates metadata for a resource (can be used to update SB
718 --     metadata only). The new metadata must be SB.
719 --
720 -- PARAMETERS -
721 --  abspath
722 --     Absolute path of the resource
723 --  oldmetadata
724 --     REF to the old piece of metadata
725 --  newmetadata
726 --     REF to the new piece of metadata to replace it with
727 -- RETURNS -
728 --     Nothing
729 -----------------------------------------------------------
730 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
731                                  oldmetadata IN REF SYS.XMLTYPE,
732                                  newmetadata IN REF SYS.XMLTYPE);
733 
734 -----------------------------------------------------------
735 -- PROCEDURE - updateResourceMetadata
736 --     Updates metadata for a resource (can be used to update SB
737 --     metadata only). The new metadata can be either SB or NSB
738 --
739 -- PARAMETERS -
740 --  abspath
741 --     Absolute path of the resource
742 --  oldmetadata
743 --     REF to the old piece of metadata
744 --  newmetadata
745 --     New piece of metadata (can be either SB or NSB)
746 -- RETURNS -
747 --     Nothing
748 -----------------------------------------------------------
749 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
750                                  oldmetadata IN REF SYS.XMLTYPE,
751                                  newmetadata IN XMLTYPE);
752 
753 -----------------------------------------------------------
754 -- PROCEDURE - updateResourceMetadata
755 --     Updates metadata for a resource - can be used for both
756 --     SB or NSB metadata.
757 --
758 -- PARAMETERS -
759 --  abspath
760 --     Absolute path of the resource
761 --  oldns, oldname
762 --     namespace and local name pair identifying old metadata
763 --  newmetadata
764 --     New piece of metadata (can be either SB or NSB)
765 -- RETURNS -
766 --     Nothing
767 -----------------------------------------------------------
768 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
769                                  oldns IN VARCHAR2,
770                                  oldname IN VARCHAR,
771                                  newmetadata IN XMLTYPE);
772 
773 -----------------------------------------------------------
774 -- PROCEDURE - updateResourceMetadata
775 --     Updates metadata for a resource - can be used for both
776 --     SB or NSB metadata. New metadata must be SB.
777 --
778 -- PARAMETERS -
779 --  abspath
780 --     Absolute path of the resource
781 --  oldns, oldname
782 --     namespace and local name pair identifying old metadata
783 --  newmetadata
784 --     REF to new metadata
785 -- RETURNS -
786 --     Nothing
787 -----------------------------------------------------------
788 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
789                                  oldns IN VARCHAR2,
790                                  oldname IN VARCHAR,
791                                  newmetadata IN REF SYS.XMLTYPE);
792 
793 -----------------------------------------------------------
794 -- PROCEDURE - purgeResourceMetadata
795 --     Deletes all user metadata from a resource
796 --     SB metadata is removed in cascade mode i.e. the rows
797 --     are deleted from the corresponding metadata tables
798 --
799 -- PARAMETERS -
800 --  abspath
801 --     Absolute path of the resource
802 -- RETURNS -
803 --     Nothing
804 -----------------------------------------------------------
805 PROCEDURE purgeResourceMetadata(abspath  IN VARCHAR2);
806 
807 ---------------------------------------------
808 -- FUNCTION - getResource
809 --    Given a path in the repository, returns the XDBResource
810 -- PARAMETERS -
811 --    abspath - absolute path in the repository
812 -- RETURNS -
813 --    The XDBResource.
814 ---------------------------------------------
815 FUNCTION getResource(abspath IN VARCHAR2) return dbms_xdbresource.XDBResource;
816 
817 -----------------------------------------------------------
818 -- PROCEDURE - refreshContentSize
819 --     Recompute the content size of the specified resource,
820 --     disregarding the existing content size. Store it in the Size
821 --     element in the resource schema, and set the SizeAccurate flag
822 --     appropriately.
823 --
824 -- PARAMETERS -
825 --  abspath (IN)
826 --     Absolute path of the resource. If the path is a folder, then
827 --     use the recurse flag as below.
828 --  recurse (IN)
829 --     Used only if abspath specifies a folder. If true, refresh the
830 --     size of all resources in the resource tree rooted at the
831 --     specified resource. If false, compute the size of all
832 --     documents/subfolders in this folder only.
833 -- RETURNS -
834 --     Nothing.
835 -----------------------------------------------------------
836 PROCEDURE refreshContentSize ( abspath IN VARCHAR2,
837 			       recurse IN BOOLEAN := FALSE );
838 
839 -----------------------------------------------------------
840 -- PROCEDURE - ProcessLinks
841 --     Process document links in the specified resource,
842 --     looking at the current resource configuration parameters.
843 --
844 -- PARAMETERS -
845 --  abspath (IN)
846 --     Absolute path of the resource. If the path is a folder, then
847 --     use the recurse flag as below.
848 --  recurse (IN)
849 --     Used only if abspath specifies a folder. If true, process
850 --     links of all resources in the resource tree rooted at the
851 --     specified resource. If false, process links of all
852 --     documents in this folder only.
853 -- RETURNS -
854 --     Nothing.
855 -----------------------------------------------------------
856 PROCEDURE ProcessLinks (abspath IN VARCHAR2,
857                         recurse IN BOOLEAN := FALSE );
858 
859 -----------------------------------------------------------
860 -- FUNCTION - isFolder
861 --
862 -- PARAMETERS -
863 --  abspath (IN)
864 --     Absolute path of the resource.
865 -- RETURNS -
866 --     True if the resource is a folder / container.
867 -----------------------------------------------------------
868 FUNCTION isFolder (
869         abspath IN VARCHAR2
870 ) return BOOLEAN;
871 
872 -----------------------------------------------------------
873 -- PROCEDURE - touchResource
874 --  Change the last mod time of the resource to the current time.
875 --
876 -- PARAMETERS -
877 --  abspath (IN)
878 --     Absolute path of the resource.
879 -----------------------------------------------------------
880 PROCEDURE touchResource ( abspath IN VARCHAR2 );
881 
882 -----------------------------------------------------------
883 -- PROCEDURE - changeOwner
884 --  Change the owner of the resource to the given user.
885 --
886 -- PARAMETERS -
887 --  abspath (IN)
888 --     Absolute path of the resource.
889 --  owner (IN)
890 --     Owner
891 --  recurse (IN)
892 --     If true, recursively change owner of all resources in the
893 --     folder tree.
894 -----------------------------------------------------------
895 PROCEDURE changeOwner ( abspath IN VARCHAR2,
896                         owner   IN VARCHAR2,
897                         recurse IN BOOLEAN := FALSE );
898 
899 -----------------------------------------------------------
900 -- XDB Config Update APIs
901 -- PROCEDURE ADDMIMEMAPPING         Add a mime mapping
902 -- PROCEDURE DELETEMIMEMAPPING      Delete a mime mapping
903 -- PROCEDURE ADDXMLEXTENSION        Add an xml extension
904 -- PROCEDURE DELETEXMLEXTENSION     Delete an xml extension
905 -- PROCEDURE ADDSERVLETMAPPING      Add a servlet mapping
906 -- PROCEDURE DELETESERVLETMAPPING   Delete a servlet mapping
907 -- PROCEDURE ADDSCHEMALOCMAPPING    Add a schema location mapping
908 -- PROCEDURE DELETESCHEMALOCMAPPING Delete a schema location mapping
909 -- PROCEDURE ADDSERVLET             Add a servlet
910 -- PROCEDURE DELETESERVLET          Delete a servlet
911 -- PROCEDURE ADDSERVLETSECROLE      Add a security role ref to a servlet
912 -- PROCEDURE DELETESERVLETSECROLE   Delete a security role ref from a servlet
913 -----------------------------------------------------------
914 
915 procedure ADDMIMEMAPPING (
916 	extension IN VARCHAR2,
917 	mimetype  IN VARCHAR2
918 );
919 
920 procedure DELETEMIMEMAPPING (
921 	extension IN VARCHAR2
922 );
923 
924 procedure ADDXMLEXTENSION (
925 	extension IN VARCHAR2
926 );
927 
928 procedure DELETEXMLEXTENSION (
929 	extension IN VARCHAR2
930 );
931 
932 procedure ADDSERVLETMAPPING (
933  	pattern IN VARCHAR2,
934  	name    IN VARCHAR2
935 );
936 
937 procedure DELETESERVLETMAPPING (
938  	name IN VARCHAR2
939 );
940 
941 procedure ADDSERVLET (
942 	name     IN VARCHAR2,
943 	language IN VARCHAR2,
944 	dispname IN VARCHAR2,
945 	icon     IN VARCHAR2 := NULL,
946 	descript IN VARCHAR2 := NULL,
947 	class    IN VARCHAR2 := NULL,
948 	jspfile  IN VARCHAR2 := NULL,
949 	plsql    IN VARCHAR2 := NULL,
950 	schema   IN VARCHAR2 := NULL
951 );
952 
953 procedure DELETESERVLET (
954  	name IN VARCHAR2
955 );
956 
957 procedure ADDSERVLETSECROLE (
958  	servname IN VARCHAR2,
959  	rolename IN VARCHAR2,
960  	rolelink IN VARCHAR2,
961  	descript IN VARCHAR2 := NULL
962 );
963 
964 procedure DELETESERVLETSECROLE (
965 	servname IN VARCHAR2,
966 	rolename IN VARCHAR2
967 );
968 
969 procedure ADDSCHEMALOCMAPPING (
970 	namespace IN VARCHAR2,
971 	element   IN VARCHAR2,
972 	schemaURL IN VARCHAR2
973 );
974 
975 procedure DELETESCHEMALOCMAPPING (
976 	schemaURL IN VARCHAR2
977 );
978 
979 -----------------------------------------------------------
980 -- FUNCTION - hascharcontent
981 --
982 -- PARAMETERS -
983 --  abspath (IN)
984 --     Absolute path of the resource.
985 -- RETURNS -
986 --     True if the resource has character content.
987 -----------------------------------------------------------
988 function HASCHARCONTENT (
989 	abspath IN VARCHAR2
990 ) return BOOLEAN;
991 
992 -----------------------------------------------------------
993 -- FUNCTION - hasxmlcontent
994 --
995 -- PARAMETERS -
996 --  abspath (IN)
997 --     Absolute path of the resource.
998 -- RETURNS -
999 --     True if the resource has xml content.
1000 -----------------------------------------------------------
1001 function HASXMLCONTENT (
1002 	abspath IN VARCHAR2
1003 ) return BOOLEAN;
1004 
1005 -----------------------------------------------------------
1006 -- FUNCTION - hasxmlreference
1007 --
1008 -- PARAMETERS -
1009 --  abspath (IN)
1010 --     Absolute path of the resource.
1011 -- RETURNS -
1012 --     True if the resource has a ref to xml content.
1013 -----------------------------------------------------------
1014 function HASXMLREFERENCE (
1015 	abspath IN VARCHAR2
1016 ) return BOOLEAN;
1017 
1018 -----------------------------------------------------------
1019 -- FUNCTION - hasblobcontent
1020 --
1021 -- PARAMETERS -
1022 --  abspath (IN)
1023 --     Absolute path of the resource.
1024 -- RETURNS -
1025 --     True if the resource has blob content.
1026 -----------------------------------------------------------
1027 function HASBLOBCONTENT (
1028 	abspath IN VARCHAR2
1029 ) return BOOLEAN;
1030 
1031 ---------------------------------------------
1032 -- FUNCTION - getContentClob
1033 --    Returns the contents of the resource as a clob.
1034 -- PARAMETERS -
1035 --    abspath - Absolute path of the resource
1036 -- RETURNS -
1037 --    The contents as CLOB.
1038 ---------------------------------------------
1039 FUNCTION getContentClob(
1040 	abspath IN VARCHAR2
1041 ) return CLOB;
1042 
1043 ---------------------------------------------
1044 -- FUNCTION - getContentBlob
1045 --    Returns the contents of the resource as a blob.
1046 -- PARAMETERS -
1047 --    abspath - Absolute path of the resource.
1048 --    csid - OUT - The character set id of the blob returned.
1049 --    locksrc - if true, lock and return the source lob. If false,
1050 --    return a temp lob copy.
1051 -- RETURNS -
1052 --    The contents as BLOB.
1053 ---------------------------------------------
1054 FUNCTION getContentBlob (
1055 	abspath IN VARCHAR2,
1056 	csid OUT PLS_INTEGER,
1057 	locksrc IN BOOLEAN := FALSE
1058 ) return BLOB;
1059 
1060 ---------------------------------------------
1061 -- FUNCTION - getContentXMLType
1062 --    Returns the contents of the resource as an XMLType.
1063 -- PARAMETERS -
1064 --    abspath - Absolute path of the resource.
1065 -- RETURNS -
1066 --    The contents as XMLType.
1067 ---------------------------------------------
1068 FUNCTION getContentXMLType (
1069 	abspath IN VARCHAR2
1070 ) return SYS.XMLType;
1071 
1072 ---------------------------------------------
1073 -- FUNCTION - getContentVarchar2
1074 --    Returns the contents of the resource as an Varchar2.
1075 -- PARAMETERS -
1076 --    abspath - Absolute path of the resource.
1077 -- RETURNS -
1078 --    The contents as Varchar2.
1079 ---------------------------------------------
1080 FUNCTION getContentVarchar2 (
1081 	abspath IN VARCHAR2
1082 ) return VARCHAR2;
1083 
1084 ---------------------------------------------
1085 -- FUNCTION - getContentXMLRef
1086 --    Returns the contents of the resource as a ref to an xmltype.
1087 -- PARAMETERS -
1088 --    abspath - Absolute path of the resource.
1089 -- RETURNS -
1090 --    The contents as a ref to an xmltype if the resource is ref
1091 --    based, else null.
1092 ---------------------------------------------
1093 FUNCTION getContentXMLRef (
1094 	abspath IN VARCHAR2
1095 ) return ref SYS.XMLType;
1096 
1097 
1098 ---------------------------------------------
1099 -- FUNCTION - getxdb_tablespace
1100 --     Returns the current tablespace of xdb, on the assumption
1101 --     that that is the tablespace of XDB.XDB$RESOURCE.
1102 -- PARAMETERS - None.
1103 --
1104 -- NOTE: Currently used by DBMS_XDBT, which is AUTHID CURRENT_USER
1105 --       package, so this API will not be moved to DBMS_XDB_ADMIN.
1106 --       This API is useful if we envision having XDB's objects
1107 --       span multiple tablespaces. Otherwise, DBA_USERS can be queried.
1108 ---------------------------------------------
1109 FUNCTION getxdb_tablespace RETURN VARCHAR2;
1110 
1111 
1112 ----------------------------------------------------------------------------------
1113 -- PROCEDURE - addHttpExpireMapping
1114 --    Adds to xdb$config a mapping of the URL pattern to an
1115 --     expiration date. This will control the Expire headers
1116 --     for URLs matching the pattern.
1117 -- PARAMETERS -
1118 --     pattern  -- URL pattern (only * accepted as wildcards)
1119 --     expire   -- expiration directive, follows the ExpireDefault
1120 --                 in Apache's mod_expires, i.e.,
1121 --                 base [plus] (num type)*
1122 --                 -- base: now | modification
1123 --                 -- type: year|years|month|months|week|weeks|day|days|
1124 --                          minute|minutess|second|seconds
1125 -- EXAMPLE
1126 --  dbms_xdb.addHttpExpireMapping('/public/test1/*', 'now plus 4 weeks');
1127 --  dbms_xdb.addHttpExpireMapping('/public/test2/*', 'modification plus 1 day 30 seconds');
1128 ----------------------------------------------------------------------------------
1129 procedure addHttpExpireMapping(pattern IN VARCHAR2,
1130                                expire IN VARCHAR2);
1131 
1132 ----------------------------------------------------------------------------------
1133 -- PROCEDURE - deleteHttpExpireMapping
1134 --    Deletes from xdb$config all mappings of the URL pattern to an
1135 --     expiration date.
1136 -- PARAMETERS -
1137 --     pattern  -- URL pattern (only * accepted as wildcards)
1138 ----------------------------------------------------------------------------------
1139 procedure deleteHttpExpireMapping(pattern IN VARCHAR2);
1140 
1141 ----------------------------------------------------------------------------------
1142 -- FUNCTION - getHTTPRequestHeader
1143 --    If called during an HTTP request serviced by XDB, it returns the values
1144 --    of the passed header. It returns NULL in case the header is not present
1145 --    in the request, or for AUTHENTICATION, for security reasons.
1146 --    Expected to be used by routines that implement custom authentication.
1147 ----------------------------------------------------------------------------------
1148 function getHTTPRequestHeader(header_name IN VARCHAR2)
1149   return VARCHAR2;
1150 
1151 end dbms_xdb;