DBA Data[Home] [Help]

PACKAGE: XDB.DBMS_XDB_REPOS

Source


1 PACKAGE     dbms_xdb_repos 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 
16 DEFAULT_LOCK_TIMEOUT CONSTANT PLS_INTEGER := (60*60);
17 
18 LINK_TYPE_HARD        CONSTANT NUMBER := 1;
19 LINK_TYPE_WEAK        CONSTANT NUMBER := 2;
20 LINK_TYPE_SYMBOLIC    CONSTANT NUMBER := 3;
21 
22 
23 ---------------------------------------------
24 -- FUNCTION - LockResource
25 --     Gets a webdav-like lock for XDB resource given its path
26 -- PARAMETERS -
27 --  abspath
28 --     Absolute path in the Hierarchy of the resource
29 --  depthzero
30 --     depth zero boolean
31 --  shared
32 --     shared boolean
33 -- RETURNS -
34 --     Returns TRUE if successful
35 ---------------------------------------------
36 FUNCTION LockResource(abspath IN VARCHAR2, depthzero IN BOOLEAN,
37                                            shared IN boolean)
38               RETURN boolean;
39 
40 ---------------------------------------------
41 -- FUNCTION - LockResource
42 --     Gets a webdav-like lock for XDB resource given its path
43 -- PARAMETERS -
44 --  abspath
45 --     Absolute path in the Hierarchy of the resource
46 --  depthzero
47 --     depth zero boolean
48 --  shared
49 --     shared boolean
50 --  token
51 --     generated token
52 --  timeout
53 --     time (in seconds) after which lock expires
54 -- RETURNS -
55 --     Returns TRUE if successful
56 ---------------------------------------------
57 FUNCTION LockResource(abspath IN VARCHAR2, depthzero IN BOOLEAN,
58                       shared IN boolean, token OUT VARCHAR2,
59                       timeout IN PLS_INTEGER := DEFAULT_LOCK_TIMEOUT)
60               RETURN boolean;
61 
62 ---------------------------------------------
63 -- PROCEDURE - RefreshLock
64 --     Refreshes a webdav-like lock for XDB resource given its path
65 -- PARAMETERS -
66 --  abspath
67 --     Absolute path in the Hierarchy of the resource
68 --  token
69 --     token corresponding to the lock to be refreshed
70 --  newTimeout
71 --     new timeout (in seconds) after which lock will expire
72 -- NOTE -
73 --     If the timeout is less than the remaining time to expiry,
74 --     lock will not be refreshed
75 ---------------------------------------------
76 
77 PROCEDURE RefreshLock(abspath IN VARCHAR2, token IN VARCHAR2,
78                      newTimeout IN  PLS_INTEGER := DEFAULT_LOCK_TIMEOUT);
79 
80 ---------------------------------------------
81 -- FUNCTION - LockDiscovery
82 --     Gets Locks element on resource defined by abspath
83 -- PARAMETERS -
84 --  abspath
85 --     Absolute path in the Hierarchy of the resource
86 -- RETURNS -
87 --     the Locks element as XMLType
88 ---------------------------------------------
89 FUNCTION LockDiscovery(abspath IN VARCHAR2)
90                RETURN SYS.XMLType;
91 
92 ---------------------------------------------
93 -- PROCEDURE - GetLockToken
94 --     Gets lock token for current user for XDB resource given its path
95 -- PARAMETERS -
96 --  abspath
97 --     Absolute path in the Hierarchy of the resource
98 --  locktoken (OUT)
99 --     Returns lock token
100 ---------------------------------------------
101 PROCEDURE GetLockToken(abspath IN VARCHAR2, locktoken OUT VARCHAR2);
102 
103 ---------------------------------------------
104 -- FUNCTION - Unlock
105 --     Removes lock for XDB resource given lock token
106 -- PARAMETERS -
107 --  abspath
108 --     Absolute path in the Hierarchy of the resource
109 --  delToken
110 --     Lock token name to be removed
111 -- RETURNS -
112 --     Returns TRUE if successful
113 ---------------------------------------------
114 FUNCTION UnlockResource(abspath IN VARCHAR2, deltoken IN VARCHAR2 := NULL)
115                         RETURN boolean;
116 
117 ---------------------------------------------
118 -- PROCEDURE - AddToLockTokenList
119 --     Adds specified token to the session lock token list
120 -- PARAMETERS -
121 --  token
122 --     token to be added to token list
123 ---------------------------------------------
124 PROCEDURE AddToLockTokenList(token IN VARCHAR2);
125 
126 ---------------------------------------------
127 -- FUNCTION - DeleteFromLockTokenList
128 --     Deletes specified token from the session lock token list
129 -- PARAMETERS -
130 --  token
131 --     token to be deleted from token list
132 -- RETURNS -
133 --     returns TRUE if delete was successful
134 ---------------------------------------------
135 FUNCTION DeleteFromLockTokenList(token IN VARCHAR2)
136                         RETURN boolean;
137 
138 ---------------------------------------------
139 -- FUNCTION - GetLockTokenList
140 --     Gets the session lock token list
141 -- PARAMETERS -
142 --  None
143 -- RETURNS -
144 --  The session lock token list
145 ---------------------------------------------
146 FUNCTION GetLockTokenList RETURN LockTokenListType;
147 
148 ---------------------------------------------
149 -- FUNCTION - ExistsResource(VARCHAR2)
150 --     Given a string, returns true if the resource exists in the hierarchy.
151 -- PARAMETERS -
152 --  abspath
153 --     Absolute path to the resource
154 -- RETURNS -
155 --     Returns TRUE if resource was found in the hierarchy.
156 ---------------------------------------------
157 FUNCTION ExistsResource(abspath IN VARCHAR2) RETURN BOOLEAN;
158 
159 ---------------------------------------------
160 -- FUNCTION - CreateResource(VARCHAR2, VARCHAR2, VARCHAR2, VARCHAR2)
161 --     Given a string, inserts a new resource into the hierarchy with
162 --     the string as the contents.
163 -- PARAMETERS -
164 --  abspath
165 --     Absolute path to the resource
166 --  data
167 --     String buffer containing the resource contents
168 --  schemaurl
169 --     for XML data, schema URL data conforms to (default null)
170 --  elem
171 --     element name (default null)
172 -- RETURNS -
173 --     Returns TRUE if resource was successfully inserted or updated
174 ---------------------------------------------
175 FUNCTION CreateResource(abspath IN VARCHAR2,
176                         data IN VARCHAR2,
177                         schemaurl IN VARCHAR2 := NULL,
178                         elem IN VARCHAR2 := NULL) RETURN BOOLEAN;
179 
180 ---------------------------------------------
181 -- FUNCTION - CreateResource(VARCHAR2, SYS.XMLTYPE, VARCHAR2, VARCHAR2)
182 --     Given an XMLTYPE and a schema URL, inserts a new resource
183 --     into the hierarchy with the XMLTYPE as the contents.
184 -- PARAMETERS -
185 --  abspath
186 --     Absolute path to the resource
187 --  data
188 --     XMLTYPE containing the resource contents
189 --  schemaurl
190 --     schema URL the XmlType conforms to (default null)
191 --  elem
192 --     element name (default null)
193 -- RETURNS -
194 --     Returns TRUE if resource was successfully inserted or updated
195 ---------------------------------------------
196 FUNCTION CreateResource(abspath IN VARCHAR2,
197                         data IN SYS.XMLTYPE,
198                         schemaurl IN VARCHAR2 := NULL,
199                         elem IN VARCHAR2 := NULL) RETURN BOOLEAN;
200 
201 
202 ---------------------------------------------
203 -- FUNCTION - CreateResource(VARCHAR2, REF SYS.XMLTYPE, BOOLEAN, BOOLEAN)
204 --     Given a PREF to an existing XMLType row, inserts a new resource
205 --     whose contents point directly at that row.  That row should
206 --     not already exist inside another resource.
207 -- PARAMETERS -
208 --  abspath
209 --     Absolute path to the resource
210 --  data
211 --     REF to the XMLType row containing the resource contents
212 --  sticky
213 --     If TRUE creates a sticky REF, otherwise non-sticky.
214 --     Default is TRUE (for backwards compatibility).
215 --  calcSize
216 --     If true, calculate the content size of the resource. Default is
217 --     false for performance reasons.
218 -- RETURNS -
219 --     Returns TRUE if resource was successfully inserted or updated
220 ---------------------------------------------
221 FUNCTION CreateResource(abspath IN VARCHAR2,
222                         data IN REF SYS.xmltype,
223                         sticky IN BOOLEAN := TRUE,
224                         calcSize IN BOOLEAN := FALSE) RETURN BOOLEAN;
225 
226 ---------------------------------------------
227 -- FUNCTION - CreateResource(VARCHAR2, CLOB)
228 --     Given a CLOB, inserts a new resource into the hierarchy with
229 --     the CLOB as the contents.
230 -- PARAMETERS -
231 --  abspath
232 --     Absolute path to the resource
233 --  data
234 --     CLOB containing the resource contents
235 -- RETURNS -
236 --     Returns TRUE if resource was successfully inserted or updated
237 ---------------------------------------------
238 FUNCTION CreateResource(abspath IN VARCHAR2,
239                         data IN CLOB) RETURN BOOLEAN;
240 
241 ---------------------------------------------
242 -- FUNCTION - CreateResource(VARCHAR2, BFILE, NUMBER)
243 --     Given a BFILE, inserts a new resource into the hierarchy with
244 --     the contents loaded from the BFILE.
245 -- PARAMETERS -
246 --  abspath
247 --     Absolute path to the resource
248 --  data
249 --     BFILE containing the resource contents
250 --  csid
251 --     character set id of the input bfile
252 -- RETURNS -
253 --     Returns TRUE if resource was successfully inserted or updated
254 ---------------------------------------------
255 FUNCTION CreateResource(abspath IN VARCHAR2,
256                         data IN BFILE,
257                         csid IN NUMBER := 0) RETURN BOOLEAN;
258 
259 ---------------------------------------------
260 -- FUNCTION - CreateResource(VARCHAR2, BLOB, NUMBER)
261 --     Given a BLOB, inserts a new resource into the hierarchy with
262 --     the BLOB as the contents.
263 -- PARAMETERS -
264 --  abspath
265 --     Absolute path to the resource
266 --  data
267 --     BLOB containing the resource contents
268 --  csid
269 --     character set id of the input blob
270 -- RETURNS -
271 --     Returns TRUE if resource was successfully inserted or updated
272 ---------------------------------------------
273 FUNCTION CreateResource(abspath IN VARCHAR2,
274                         data IN BLOB,
275                         csid IN NUMBER := 0) RETURN BOOLEAN;
276 
277 
278 ---------------------------------------------
279 -- FUNCTION - CreateFolder
280 --     Creates a folder in the Repository
281 -- PARAMETERS -
282 --  abspath
283 --     Absolute path iin the Hierarchy were the resource will be stored
284 -- RETURNS -
285 --     Returns TRUE if folder was created succesfully in Repository
286 ---------------------------------------------
287 FUNCTION CreateFolder(abspath IN VARCHAR2) RETURN BOOLEAN;
288 
289 ---------------------------------------------
290 -- FUNCTION - AddResource(VARCHAR2, VARCHAR2)
291 --     Given a string, inserts a new resource into the hierarchy with
292 --     the string as the contents.
293 -- PARAMETERS -
294 --  abspath
295 --     Absolute path to the resource
296 --  data
297 --     String buffer containing the resource contents
298 -- RETURNS -
299 --     Returns 2 if resource already exists
300 --             1 if resource was successfully inserted
301 --             0 otherwise
302 ---------------------------------------------
303 FUNCTION AddResource(abspath IN VARCHAR2,
304                         data IN VARCHAR2) RETURN NUMBER;
305 
306 ---------------------------------------------
307 -- PROCEDURE - DeleteResource
308 --     Deletes a resource from the Hierarchy
309 -- PARAMETERS -
310 --  abspath
311 --     Absolute path in the Hierarchy for resource to be deleted
312 --  delete_option : one of the following
313 --    DELETE_RESOURCE ::
314 --      delete the resource alone. Fails if the resource has children
315 --    DELETE_RECURSIVE ::
316 --      delete the resource with the children, if any.
317 --    DELETE_FORCE ::
318 --      delete the resource even if the object it contains is invalid.
319 --    DELETE_RECURSIVE_FORCE ::
320 --      delete the resource and all children, ignoring any errors raised
321 --      by contained objects being invalid
322 ---------------------------------------------
323 PROCEDURE DeleteResource(abspath IN VARCHAR2,
324                          delete_option IN pls_integer := DELETE_RESOURCE);
325 
326 ---------------------------------------------
327 -- PROCEDURE - Link
328 --     Creates a link from a specified folder to a specified resource.
329 -- PARAMETERS -
330 --  srcpath
331 --     Path name of the resource to which a link is created.
332 --  linkfolder
333 --     Folder in which the new link is placed.
334 --  linkname
335 --     Name of the new link.
336 --  linktype
337 --     Type of link to be created.
338 --     One of the following:
339 --         DBMS_XDB.LINK_TYPE_HARD (default)
340 --         DBMS_XDB.LINK_TYPE_WEAK
341 --         DBMS_XDB.LINK_TYPE_SYMBOLIC
342 ---------------------------------------------
343 PROCEDURE Link(srcpath IN VARCHAR2, linkfolder IN VARCHAR2,
344                linkname IN VARCHAR2,
345                linktype IN PLS_INTEGER := DBMS_XDB.LINK_TYPE_HARD);
346 
347 ---------------------------------------------
348 -- PROCEDURE - Rename
349 --     Renames a XDB resource
350 -- PARAMETERS -
351 --  srcpath
352 --     Absolute path in the Hierarchy of the source resource
353 --  destfolder
354 --     Absolute path in the Hierarchy of the dest folder
355 --  newname
356 --     Name of the child in the destination folder
357 ---------------------------------------------
358 PROCEDURE RenameResource(srcpath IN VARCHAR2, destfolder IN VARCHAR2,
359                          newname IN VARCHAR2);
360 
361 ---------------------------------------------
362 -- FUNCTION - getAclDoc
363 --     gets acl document that protects resource given in path
364 -- PARAMETERS -
365 --  abspath
366 --     Absolute path in the Hierarchy of the resource whose acl doc is required
367 -- RETURNS -
368 --     Returns xmltype for acl document
369 ---------------------------------------------
370 FUNCTION getAclDocument(abspath IN VARCHAR2) RETURN sys.xmltype;
371 
372 ---------------------------------------------
373 -- FUNCTION - getPrivileges
374 --     Gets all system and user privileges granted to the current user
375 --     on the given XDB resource
376 -- PARAMETERS -
377 --  res_path
378 --     Absolute path in the Hierarchy for XDB resource
379 -- RETURNS -
380 --     Returns a XMLType instance of <privilege> element
381 --     which contains the list of all (leaf) privileges
382 --     granted on this resource to the current user.
383 --     It includes all granted system and user privileges.
384 --     Example :
385 --       <privilege xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
386 --                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
387 --                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
388 --                                      http://xmlns.oracle.com/xdb/acl.xsd"
389 --                  xmlns:dav="DAV:"
390 --                  xmlns:emp="http://www.example.com/emp.xsd">
391 --          <read-contents/>
392 --          <read-properties/>
393 --          <resolve/>
394 --          <dav:read-acl/>
395 --          <emp:Hire/>
396 --       </privilege>
397 ---------------------------------------------
398 FUNCTION getPrivileges(res_path IN VARCHAR2) RETURN sys.xmltype;
399 
400 ---------------------------------------------
401 -- FUNCTION - changePrivileges
402 --     change access privileges on given XDB resource
403 -- PARAMETERS -
404 --  res_path
405 --     Absolute path in the Hierarchy for XDB resource
406 --  ace
407 --     an XMLType instance of the <ace> element which specifies
408 --     the <principal>, the operation <grant> and the list of
409 --     privileges.
410 --     If no ACE with the same principal and the same operation
411 --     (grant/deny) already exists in the ACL, the new ACE is added
412 --     at the end of the ACL.
413 --  replace
414 --    This argument determines the result of changePrivileges if
415 --    an ACE with the same principal and same operation (grant/deny)
416 --    already exists in the ACL.
417 --
418 --    If set to TRUE,
419 --       the old ACE is replaced with the new one.
420 --    else
421 --       the privileges of the old and new ACEs are combined into a
422 --       single ACE.
423 --
424 -- RETURNS -
425 --     Returns positive integer if ACL was successfully modified
426 ---------------------------------------------
427 FUNCTION changePrivileges(res_path IN VARCHAR2,
428                           ace      IN xmltype)
429                           RETURN pls_integer;
430 
431 ---------------------------------------------
432 -- FUNCTION - checkPrivileges
433 --     checks access privileges granted on specified XDB resource
434 -- PARAMETERS -
435 --  res_path
436 --     Absolute path in the Hierarchy for XDB resource
437 --  privs
438 --     Requested set of access privileges
439 --     This argument is a XMLType instance of the <privilege> element.
440 -- RETURNS -
441 --     Returns positive integer if all requested privileges granted
442 ---------------------------------------------
443 FUNCTION checkPrivileges(res_path IN VARCHAR2,
444                          privs IN xmltype)
445                          RETURN pls_integer;
446 
447 
448 ---------------------------------------------
449 -- PROCEDURE - setacl
450 --     sets the ACL on given XDB resource to be the specified in the acl path
451 -- PARAMETERS -
452 --  res_path
453 --     Absolute path in the Hierarchy for XDB resource
454 --  acl_path
455 --     Absolute path in the Hierarchy for XDB acl
456 ---------------------------------------------
457 PROCEDURE setacl(res_path IN VARCHAR2, acl_path IN VARCHAR2);
458 
459 ---------------------------------------------
460 -- FUNCTION - AclCheckPrivileges
461 --     checks access privileges granted by specified ACL document
462 -- PARAMETERS -
463 --  acl_path
464 --     Absolute path in the Hierarchy for ACL document
465 --  owner
466 --     Resource owner name. The pseudo user "XDBOWNER" is replaced
467 --     by this user during ACL privilege resolution
468 --  privs
469 --     Requested set of access privileges
470 --     This argument is a XMLType instance of the <privilege> element.
471 -- RETURNS -
472 --     Returns positive integer if all requested privileges granted
473 ---------------------------------------------
474 FUNCTION AclCheckPrivileges(acl_path IN VARCHAR2,
475                             owner IN VARCHAR2,
476                             privs IN xmltype)
477                             RETURN pls_integer;
478 
479 ---------------------------------------------
480 -- FUNCTION - GetResOID(abspath VARCHAR2)
481 --     Returns the OID of the resource, given its absolute path
482 --
483 -- PARAMETERS -
484 --  abspath
485 --     Absolute path to the resource
486 -- RETURNS -
487 --     OID of resource if present, NULL otherwise
488 ---------------------------------------------
489 FUNCTION GetResOID(abspath IN VARCHAR2) RETURN RAW;
490 
491 ---------------------------------------------
492 -- FUNCTION - CreateOIDPath(oid RAW)
493 --     Returns the OID-based virtual path to the resource
494 --
495 -- PARAMETERS -
496 --  OID
497 --     OID of the resource
498 -- RETURNS -
499 --     the OID-based virtual path to the resource
500 ---------------------------------------------
501 FUNCTION CreateOIDPath(oid IN RAW) RETURN VARCHAR2;
502 
503 -----------------------------------------------------------
504 -- PROCEDURE - appendResourceMetadata
505 --     Appends the given piece of metadata to the resource
506 --
507 -- PARAMETERS -
508 --  abspath
509 --     Absolute path of the resource
510 --  data
511 --     Metadata (can be schema based or NSB). SB metadata
512 --     will be stored in its own table.
513 -- RETURNS -
514 --     Nothing
515 -----------------------------------------------------------
516 PROCEDURE appendResourceMetadata(abspath IN VARCHAR2,
517                                  data IN SYS.xmltype);
518 
519 -----------------------------------------------------------
520 -- PROCEDURE - appendResourceMetadata
521 --     Appends the given piece of metadata identified by a REF
522 --     to the resource
523 --
524 -- PARAMETERS -
525 --  abspath
526 --     Absolute path of the resource
527 --  data
528 --     REF to the piece of metadata (schema based)
529 -- RETURNS -
530 --     Nothing
531 -----------------------------------------------------------
532 PROCEDURE appendResourceMetadata(abspath IN VARCHAR2,
533                                  data IN REF SYS.xmltype);
534 
535 -----------------------------------------------------------
536 -- PROCEDURE - deleteResourceMetadata
537 --     Deletes metadata from a resource (can only be used for SB metadata)
538 --
539 -- PARAMETERS -
540 --  abspath
541 --     Absolute path of the resource
542 --  metadata
543 --     REF to the piece of metadata (schema based) to be deleted
544 --  delete_option
545 --     Can be one of the following:
546 --     DELETE_RES_METADATA_CASCADE : deletes the corresponding row
547 --     in the metadata table
548 --     DELETE_RES_METADATA_NOCASCADE : does not delete the row in
549 --     the metadata table
550 -- RETURNS -
551 --     Nothing
552 -----------------------------------------------------------
553 PROCEDURE deleteResourceMetadata(abspath IN VARCHAR2,
554                                  metadata IN REF SYS.XMLTYPE,
555                                  delete_option IN pls_integer :=
556                                   DELETE_RES_METADATA_CASCADE);
557 
558 -----------------------------------------------------------
559 -- PROCEDURE - deleteResourceMetadata
560 --     Deletes metadata from a resource (can be used for SB or
561 --     NSB metadata)
562 --
563 -- PARAMETERS -
564 --  abspath
565 --     Absolute path of the resource
566 --  metadatans
567 --     Namespace of the metadata fragment to be removed
568 --  metadataname
569 --     Local name of the metadata fragment to be removed
570 --  delete_option
571 --     This is only applicable for SB metadata.
572 --     Can be one of the following:
573 --     DELETE_RES_METADATA_CASCADE : deletes the corresponding row
574 --     in the metadata table
575 --     DELETE_RES_METADATA_NOCASCADE : does not delete the row in
576 --     the metadata table
577 -- RETURNS -
578 --     Nothing
579 -----------------------------------------------------------
580 procedure deleteResourceMetadata(abspath IN VARCHAR2,
581                                  metadatans IN VARCHAR2,
582                                  metadataname IN VARCHAR2,
583                                  delete_option IN pls_integer :=
584                                  DELETE_RES_METADATA_CASCADE);
585 
586 -----------------------------------------------------------
587 -- PROCEDURE - updateResourceMetadata
588 --     Updates metadata for a resource (can be used to update SB
589 --     metadata only). The new metadata must be SB.
590 --
591 -- PARAMETERS -
592 --  abspath
593 --     Absolute path of the resource
594 --  oldmetadata
595 --     REF to the old piece of metadata
596 --  newmetadata
597 --     REF to the new piece of metadata to replace it with
598 -- RETURNS -
599 --     Nothing
600 -----------------------------------------------------------
601 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
602                                  oldmetadata IN REF SYS.XMLTYPE,
603                                  newmetadata IN REF SYS.XMLTYPE);
604 
605 -----------------------------------------------------------
606 -- PROCEDURE - updateResourceMetadata
607 --     Updates metadata for a resource (can be used to update SB
608 --     metadata only). The new metadata can be either SB or NSB
609 --
610 -- PARAMETERS -
611 --  abspath
612 --     Absolute path of the resource
613 --  oldmetadata
614 --     REF to the old piece of metadata
615 --  newmetadata
616 --     New piece of metadata (can be either SB or NSB)
617 -- RETURNS -
618 --     Nothing
619 -----------------------------------------------------------
620 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
621                                  oldmetadata IN REF SYS.XMLTYPE,
622                                  newmetadata IN XMLTYPE);
623 
624 -----------------------------------------------------------
625 -- PROCEDURE - updateResourceMetadata
626 --     Updates metadata for a resource - can be used for both
627 --     SB or NSB metadata.
628 --
629 -- PARAMETERS -
630 --  abspath
631 --     Absolute path of the resource
632 --  oldns, oldname
633 --     namespace and local name pair identifying old metadata
634 --  newmetadata
635 --     New piece of metadata (can be either SB or NSB)
636 -- RETURNS -
637 --     Nothing
638 -----------------------------------------------------------
639 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
640                                  oldns IN VARCHAR2,
641                                  oldname IN VARCHAR,
642                                  newmetadata IN XMLTYPE);
643 
644 -----------------------------------------------------------
645 -- PROCEDURE - updateResourceMetadata
646 --     Updates metadata for a resource - can be used for both
647 --     SB or NSB metadata. New metadata must be SB.
648 --
649 -- PARAMETERS -
650 --  abspath
651 --     Absolute path of the resource
652 --  oldns, oldname
653 --     namespace and local name pair identifying old metadata
654 --  newmetadata
655 --     REF to new metadata
656 -- RETURNS -
657 --     Nothing
658 -----------------------------------------------------------
659 PROCEDURE updateResourceMetadata(abspath  IN VARCHAR2,
660                                  oldns IN VARCHAR2,
661                                  oldname IN VARCHAR,
662                                  newmetadata IN REF SYS.XMLTYPE);
663 
664 -----------------------------------------------------------
665 -- PROCEDURE - purgeResourceMetadata
666 --     Deletes all user metadata from a resource
667 --     SB metadata is removed in cascade mode i.e. the rows
668 --     are deleted from the corresponding metadata tables
669 --
670 -- PARAMETERS -
671 --  abspath
672 --     Absolute path of the resource
673 -- RETURNS -
674 --     Nothing
675 -----------------------------------------------------------
676 PROCEDURE purgeResourceMetadata(abspath  IN VARCHAR2);
677 
678 ---------------------------------------------
679 -- FUNCTION - getResource
680 --    Given a path in the repository, returns the XDBResource
681 -- PARAMETERS -
682 --    abspath - absolute path in the repository
683 -- RETURNS -
684 --    The XDBResource.
685 ---------------------------------------------
686 FUNCTION getResource(abspath IN VARCHAR2) return dbms_xdbresource.XDBResource;
687 
688 -----------------------------------------------------------
689 -- PROCEDURE - refreshContentSize
690 --     Recompute the content size of the specified resource,
691 --     disregarding the existing content size. Store it in the Size
692 --     element in the resource schema, and set the SizeAccurate flag
693 --     appropriately.
694 --
695 -- PARAMETERS -
696 --  abspath (IN)
697 --     Absolute path of the resource. If the path is a folder, then
698 --     use the recurse flag as below.
699 --  recurse (IN)
700 --     Used only if abspath specifies a folder. If true, refresh the
701 --     size of all resources in the resource tree rooted at the
702 --     specified resource. If false, compute the size of all
703 --     documents/subfolders in this folder only.
704 -- RETURNS -
705 --     Nothing.
706 -----------------------------------------------------------
707 PROCEDURE refreshContentSize ( abspath IN VARCHAR2,
708 			       recurse IN BOOLEAN := FALSE );
709 
710 -----------------------------------------------------------
711 -- PROCEDURE - ProcessLinks
712 --     Process document links in the specified resource,
713 --     looking at the current resource configuration parameters.
714 --
715 -- PARAMETERS -
716 --  abspath (IN)
717 --     Absolute path of the resource. If the path is a folder, then
718 --     use the recurse flag as below.
719 --  recurse (IN)
720 --     Used only if abspath specifies a folder. If true, process
721 --     links of all resources in the resource tree rooted at the
722 --     specified resource. If false, process links of all
723 --     documents in this folder only.
724 -- RETURNS -
725 --     Nothing.
726 -----------------------------------------------------------
727 PROCEDURE ProcessLinks (abspath IN VARCHAR2,
728                         recurse IN BOOLEAN := FALSE );
729 
730 -----------------------------------------------------------
731 -- FUNCTION - isFolder
732 --
733 -- PARAMETERS -
734 --  abspath (IN)
735 --     Absolute path of the resource.
736 -- RETURNS -
737 --     True if the resource is a folder / container.
738 -----------------------------------------------------------
739 FUNCTION isFolder (
740         abspath IN VARCHAR2
741 ) return BOOLEAN;
742 
743 -----------------------------------------------------------
744 -- PROCEDURE - touchResource
745 --  Change the last mod time of the resource to the current time.
746 --
747 -- PARAMETERS -
748 --  abspath (IN)
749 --     Absolute path of the resource.
750 -----------------------------------------------------------
751 PROCEDURE touchResource ( abspath IN VARCHAR2 );
752 
753 -----------------------------------------------------------
754 -- PROCEDURE - changeOwner
755 --  Change the owner of the resource to the given user.
756 --
757 -- PARAMETERS -
758 --  abspath (IN)
759 --     Absolute path of the resource.
760 --  owner (IN)
761 --     Owner
762 --  recurse (IN)
763 --     If true, recursively change owner of all resources in the
764 --     folder tree.
765 -----------------------------------------------------------
766 PROCEDURE changeOwner ( abspath IN VARCHAR2,
767                         owner   IN VARCHAR2,
768                         recurse IN BOOLEAN := FALSE );
769 
770 -----------------------------------------------------------
771 -- FUNCTION - hascharcontent
772 --
773 -- PARAMETERS -
774 --  abspath (IN)
775 --     Absolute path of the resource.
776 -- RETURNS -
777 --     True if the resource has character content.
778 -----------------------------------------------------------
779 function HASCHARCONTENT (
780 	abspath IN VARCHAR2
781 ) return BOOLEAN;
782 
783 -----------------------------------------------------------
784 -- FUNCTION - hasxmlcontent
785 --
786 -- PARAMETERS -
787 --  abspath (IN)
788 --     Absolute path of the resource.
789 -- RETURNS -
790 --     True if the resource has xml content.
791 -----------------------------------------------------------
792 function HASXMLCONTENT (
793 	abspath IN VARCHAR2
794 ) return BOOLEAN;
795 
796 -----------------------------------------------------------
797 -- FUNCTION - hasxmlreference
798 --
799 -- PARAMETERS -
800 --  abspath (IN)
801 --     Absolute path of the resource.
802 -- RETURNS -
803 --     True if the resource has a ref to xml content.
804 -----------------------------------------------------------
805 function HASXMLREFERENCE (
806 	abspath IN VARCHAR2
807 ) return BOOLEAN;
808 
809 -----------------------------------------------------------
810 -- FUNCTION - hasblobcontent
811 --
812 -- PARAMETERS -
813 --  abspath (IN)
814 --     Absolute path of the resource.
815 -- RETURNS -
816 --     True if the resource has blob content.
817 -----------------------------------------------------------
818 function HASBLOBCONTENT (
819 	abspath IN VARCHAR2
820 ) return BOOLEAN;
821 
822 ---------------------------------------------
823 -- FUNCTION - getContentClob
824 --    Returns the contents of the resource as a clob.
825 -- PARAMETERS -
826 --    abspath - Absolute path of the resource
827 -- RETURNS -
828 --    The contents as CLOB.
829 ---------------------------------------------
830 FUNCTION getContentClob(
831 	abspath IN VARCHAR2
832 ) return CLOB;
833 
834 ---------------------------------------------
835 -- FUNCTION - getContentBlob
836 --    Returns the contents of the resource as a blob.
837 -- PARAMETERS -
838 --    abspath - Absolute path of the resource.
839 --    csid - OUT - The character set id of the blob returned.
840 --    locksrc - if true, lock and return the source lob. If false,
841 --    return a temp lob copy.
842 -- RETURNS -
843 --    The contents as BLOB.
844 ---------------------------------------------
845 FUNCTION getContentBlob (
846 	abspath IN VARCHAR2,
847 	csid OUT PLS_INTEGER,
848 	locksrc IN BOOLEAN := FALSE
849 ) return BLOB;
850 
851 ---------------------------------------------
852 -- FUNCTION - getContentXMLType
853 --    Returns the contents of the resource as an XMLType.
854 -- PARAMETERS -
855 --    abspath - Absolute path of the resource.
856 -- RETURNS -
857 --    The contents as XMLType.
858 ---------------------------------------------
859 FUNCTION getContentXMLType (
860 	abspath IN VARCHAR2
861 ) return SYS.XMLType;
862 
863 ---------------------------------------------
864 -- FUNCTION - getContentVarchar2
865 --    Returns the contents of the resource as an Varchar2.
866 -- PARAMETERS -
867 --    abspath - Absolute path of the resource.
868 -- RETURNS -
869 --    The contents as Varchar2.
870 ---------------------------------------------
871 FUNCTION getContentVarchar2 (
872 	abspath IN VARCHAR2
873 ) return VARCHAR2;
874 
875 ---------------------------------------------
876 -- FUNCTION - getContentXMLRef
877 --    Returns the contents of the resource as a ref to an xmltype.
878 -- PARAMETERS -
879 --    abspath - Absolute path of the resource.
880 -- RETURNS -
881 --    The contents as a ref to an xmltype if the resource is ref
882 --    based, else null.
883 ---------------------------------------------
884 FUNCTION getContentXMLRef (
885 	abspath IN VARCHAR2
886 ) return ref SYS.XMLType;
887 
888 
889 ---------------------------------------------
890 
891 ---------------------------------------------
892 -- FUNCTION - getxdb_tablespace
893 --     Returns the current tablespace of xdb, on the assumption
894 --     that that is the tablespace of XDB.XDB$RESOURCE.
895 -- PARAMETERS - None.
896 --
897 -- NOTE: Currently used by DBMS_XDBT, which is AUTHID CURRENT_USER
898 --       package, so this API will not be moved to DBMS_XDB_ADMIN.
899 --       This API is useful if we envision having XDB's objects
900 --       span multiple tablespaces. Otherwise, DBA_USERS can be queried.
901 ---------------------------------------------
902 FUNCTION getxdb_tablespace RETURN VARCHAR2;
903 
904 end dbms_xdb_repos;