1 PACKAGE dbms_XEvent AUTHID CURRENT_USER IS
2
3 ------------
4 -- CONSTANTS
5 ------------
6
7 --
8 -- Event ID
9 --
10 RENDER_EVENT CONSTANT PLS_INTEGER := 1;
11 PRE_CREATE_EVENT CONSTANT PLS_INTEGER := 2;
12 POST_CREATE_EVENT CONSTANT PLS_INTEGER := 3;
13 PRE_DELETE_EVENT CONSTANT PLS_INTEGER := 4;
14 POST_DELETE_EVENT CONSTANT PLS_INTEGER := 5;
15 PRE_UPDATE_EVENT CONSTANT PLS_INTEGER := 6;
16 POST_UPDATE_EVENT CONSTANT PLS_INTEGER := 7;
17 PRE_LOCK_EVENT CONSTANT PLS_INTEGER := 8;
18 POST_LOCK_EVENT CONSTANT PLS_INTEGER := 9;
19 PRE_UNLOCK_EVENT CONSTANT PLS_INTEGER := 10;
20 POST_UNLOCK_EVENT CONSTANT PLS_INTEGER := 11;
21 PRE_LINKIN_EVENT CONSTANT PLS_INTEGER := 12;
22 POST_LINKIN_EVENT CONSTANT PLS_INTEGER := 13;
23 PRE_LINKTO_EVENT CONSTANT PLS_INTEGER := 14;
24 POST_LINKTO_EVENT CONSTANT PLS_INTEGER := 15;
25 PRE_UNLINKIN_EVENT CONSTANT PLS_INTEGER := 16;
26 POST_UNLINKIN_EVENT CONSTANT PLS_INTEGER := 17;
27 PRE_UNLINKFROM_EVENT CONSTANT PLS_INTEGER := 18;
28 POST_UNLINKFROM_EVENT CONSTANT PLS_INTEGER := 19;
29 PRE_CHECKIN_EVENT CONSTANT PLS_INTEGER := 20;
30 POST_CHECKIN_EVENT CONSTANT PLS_INTEGER := 21;
31 PRE_CHECKOUT_EVENT CONSTANT PLS_INTEGER := 22;
32 POST_CHECKOUT_EVENT CONSTANT PLS_INTEGER := 23;
33 PRE_UNCHECKOUT_EVENT CONSTANT PLS_INTEGER := 24;
34 POST_UNCHECKOUT_EVENT CONSTANT PLS_INTEGER := 25;
35 PRE_VERSIONCONTROL_EVENT CONSTANT PLS_INTEGER := 26;
36 POST_VERSIONCONTROL_EVENT CONSTANT PLS_INTEGER := 27;
37 PRE_OPEN_EVENT CONSTANT PLS_INTEGER := 28;
38 POST_OPEN_EVENT CONSTANT PLS_INTEGER := 29;
39 PRE_INCONSISTENTUPDATE_EVENT CONSTANT PLS_INTEGER := 30;
40 POST_INCONSISTENTUPDATE_EVENT CONSTANT PLS_INTEGER := 31;
41
42 SUBTYPE XDBEventID IS PLS_INTEGER RANGE 1 .. 31;
43
44 --
45 -- NFS related constants
46 --
47 OPEN_ACCESS_READ CONSTANT PLS_INTEGER := 1;
48 OPEN_ACCESS_WRITE CONSTANT PLS_INTEGER := 2;
49 OPEN_ACCESS_READ_WRITE CONSTANT PLS_INTEGER := 3;
50
51 OPEN_DENY_NONE CONSTANT PLS_INTEGER := 0;
52 OPEN_DENY_READ CONSTANT PLS_INTEGER := 1;
53 OPEN_DENY_READ_WRITE CONSTANT PLS_INTEGER := 2;
54
55 --
56 -- Event interface types
57 --
58 SUBTYPE EventType IS RAW(32);
59 SUBTYPE XDBRepositoryEvent is RAW(32);
60
61 TYPE XDBEvent is RECORD (id RAW(32));
62 TYPE XDBHandlerList is RECORD (id RAW(32));
63 TYPE XDBHandler is RECORD (id RAW(32));
64 TYPE XDBPath is RECORD (id RAW(32));
65 TYPE XDBLink is RECORD (id RAW(32));
66 TYPE XDBLock is RECORD (id RAW(32));
67
68 ---------------------------------------------
69 -- XDBEvent Methods
70 ---------------------------------------------
71
72 ---------------------------------------------
73 -- FUNCTION - getCurrentUser
74 -- PARAMETERS -
75 -- ev - XDB Event object
76 -- RETURNS -
77 -- Name of the user executing the operation that triggers the event.
78 ---------------------------------------------
79 FUNCTION getCurrentUser(ev IN XDBEvent) RETURN VARCHAR2;
80
81 ---------------------------------------------
82 -- FUNCTION - getEvent
83 -- PARAMETERS -
84 -- ev - XDB Event object
85 -- RETURNS -
86 -- The ID identifying the triggering event.
87 ---------------------------------------------
88 FUNCTION getEvent(ev IN XDBEvent) RETURN XDBEventID;
89
90 ---------------------------------------------
91 -- FUNCTION - isNull
92 -- PARAMETERS -
93 -- ev - XDB Event object
94 -- RETURNS - TRUE if input argument is null.
95 ---------------------------------------------
96 FUNCTION isNull(ev IN XDBEvent) RETURN BOOLEAN;
97
98 ---------------------------------------------
99 -- XDBRepositoryEvent Methods
100 ---------------------------------------------
101
102 ---------------------------------------------
103 -- FUNCTION - getXDBEvent
104 -- Converts an XDBRepositoryEvent object to an XDBEvent type.
105 -- PARAMETERS -
106 -- ev - XDB Repository Event object
107 -- RETURNS -
108 -- The XDBEvent object
109 ---------------------------------------------
110 FUNCTION getXDBEvent(ev IN XDBRepositoryEvent) RETURN XDBEvent;
111
112 ---------------------------------------------
113 -- FUNCTION - getInterface
114 -- PARAMETERS -
115 -- ev - XDB Repository Event object
116 -- RETURNS -
117 -- The top-level interface used to initiate the operation that
118 -- triggered the event. This could be "HTTP", "FTP" or "SQL".
119 ---------------------------------------------
120 FUNCTION getInterface(ev IN XDBRepositoryEvent) RETURN VARCHAR2;
121
122 ---------------------------------------------
123 -- FUNCTION - getApplicationData
124 -- PARAMETERS -
125 -- ev - XDB Repository Event object
126 -- RETURNS -
127 -- The <applicationData> element extracted from the resource
128 -- configuration that defines the invoking handler.
129 ---------------------------------------------
130 FUNCTION getApplicationData(ev IN XDBRepositoryEvent) RETURN SYS.XMLType;
131
132 ---------------------------------------------
133 -- FUNCTION - getPath
134 -- PARAMETERS -
135 -- ev - XDB Repository Event object
136 -- RETURNS -
137 -- The XDBPath object representing the path of the resource for which
138 -- the event was fired. From this object, functions are provided to get
139 -- the different path segments.
140 ---------------------------------------------
141 FUNCTION getPath(ev IN XDBRepositoryEvent) RETURN XDBPath;
142
143 ---------------------------------------------
144 -- FUNCTION - getResource
145 -- PARAMETERS -
146 -- ev - XDB Repository Event object
147 -- RETURNS -
148 -- The target resource for the operation that fire the current event.
149 -- For a link* or unlink* event, this method returns the resource that
150 -- the link is pointing to.
151 -- For a create event, this method returns the resource that is being created.
152 ---------------------------------------------
153 FUNCTION getResource(ev IN XDBRepositoryEvent)
154 RETURN DBMS_XDBResource.XDBResource;
155
156 ---------------------------------------------
157 -- FUNCTION - getParent
158 -- PARAMETERS -
159 -- ev - XDB Repository Event object
160 -- RETURNS -
161 -- The parent of the target resource.
162 ---------------------------------------------
163 FUNCTION getParent(ev IN XDBRepositoryEvent)
164 RETURN DBMS_XDBResource.XDBResource;
165
166 ---------------------------------------------
167 -- FUNCTION - getHandlerList
168 -- PARAMETERS -
169 -- ev - XDB Repository Event object
170 -- RETURNS -
171 -- The list of handlers that will be executed after the currently
172 -- executing handler.
173 ---------------------------------------------
174 FUNCTION getHandlerList(ev IN XDBRepositoryEvent) RETURN XDBHandlerList;
175
176 ---------------------------------------------
177 -- FUNCTION - getLink
178 -- PARAMETERS -
179 -- ev - XDB Repository Event object
180 -- RETURNS -
181 -- an XDBLink object for the target resource.
182 ---------------------------------------------
183 FUNCTION getLink(ev IN XDBRepositoryEvent) RETURN XDBLink;
184
185 ---------------------------------------------
186 -- FUNCTION - getLock
187 -- PARAMETERS -
188 -- ev - XDB Repository Event object
189 -- RETURNS -
190 -- This method is only valid for the lock and unlock events. It returns
191 -- the lock object corresponding to the current operation.
192 ---------------------------------------------
193 FUNCTION getLock(ev IN XDBRepositoryEvent) RETURN XDBLock;
194
195 ---------------------------------------------
196 -- FUNCTION - getParameter
197 -- PARAMETERS -
198 -- ev - XDB Repository Event object
199 -- RETURNS -
200 -- The value of a request or session-specific parameter. Currently, the
201 -- only parameters supported are "Accept", "Accept-Language", "Accept-Charset"
202 -- and "Accept-Encoding".
203 -- The definition of these parameters can be found in RFC 2616 (HTTP/1.1).
204 ---------------------------------------------
205 FUNCTION getParameter(ev IN XDBRepositoryEvent, key IN VARCHAR2)
206 RETURN VARCHAR2;
207
208 ---------------------------------------------
209 -- FUNCTION - getOldResource
210 -- PARAMETERS -
211 -- ev - XDB Repository Event object
212 -- RETURNS -
213 -- Returns the original XDBResource object before the current operation
214 -- started. This method applies only to Update event. For other events,
215 -- an error is returned.
216 ---------------------------------------------
217 FUNCTION getOldResource(ev IN XDBRepositoryEvent)
218 RETURN DBMS_XDBResource.XDBResource;
219
220 ---------------------------------------------
221 -- FUNCTION - getOutputStream
222 -- PARAMETERS -
223 -- ev - XDB Repository Event object
224 -- RETURNS -
225 -- This is only valid for the Render event. It returns the output BLOB in
226 -- which the handler can write the rendered data.
227 ---------------------------------------------
228 FUNCTION getOutputStream(ev IN XDBRepositoryEvent) RETURN BLOB;
229
230 ---------------------------------------------
231 -- PROCEDURE - setRenderStream
232 -- This is only valid for the Render event. Sets the BLOB from which the
233 -- rendered contents can be read. This should not be called after the
234 -- stream returned by getOutputStream() is written to or after
235 -- setRenderPath() is called; doing so will result in an error.
236 -- PARAMETERS -
237 -- ev - XDB Repository Event object
238 -- istr - input stream to get the rendered contents from
239 ---------------------------------------------
240 PROCEDURE setRenderStream(ev IN XDBRepositoryEvent, istr IN BLOB);
241
242 ---------------------------------------------
243 -- PROCEDURE - setRenderPath
244 -- This is only valid for the Render event. Specifies the path of the
245 -- resource that contains the rendered contents. This should not be called
246 -- after the stream returned by getOutputStream() is written to or
247 -- after setRenderStream() is called; doing so will result in an error.
248 -- PARAMETERS -
249 -- ev - XDB Repository Event object
250 -- path - path of the resource containing the rendered contents
251 ---------------------------------------------
252 PROCEDURE setRenderPath(ev IN XDBRepositoryEvent, path IN VARCHAR2);
253
254 ---------------------------------------------
255 -- FUNCTION - getUpdateByteOffset
256 -- PARAMETERS -
257 -- ev - XDB Repository Event object
258 -- RETURNS -
259 -- This method is only valid for the inconsistent-update event. If the
260 -- current operation is a byte-range write, it returns the byte offset at
261 -- which the range begins
262 ---------------------------------------------
263 FUNCTION getUpdateByteOffset(ev IN XDBRepositoryEvent) RETURN NUMBER;
264
265 ---------------------------------------------
266 -- FUNCTION - getUpdateByteCount
267 -- PARAMETERS -
268 -- ev - XDB Repository Event object
269 -- RETURNS -
270 -- This method is only valid for the inconsistent-update event. If the
271 -- current operation is a byte-range write, it returns the byte count.
272 ---------------------------------------------
273 FUNCTION getUpdateByteCount(ev IN XDBRepositoryEvent) RETURN NUMBER;
274
275 ---------------------------------------------
276 -- FUNCTION - getOpenAccessMode
277 -- PARAMETERS -
278 -- ev - XDB Repository Event object
279 -- RETURNS -
280 -- This method is only valid for the open event. It returns the access mode
281 -- for the open operation, which could be one of:
282 -- OPEN_ACCESS_READ
283 -- OPEN_ACCESS_WRITE
284 -- OPEN_ACCESS_READ_WRITE
285 ---------------------------------------------
286 FUNCTION getOpenAccessMode(ev IN XDBRepositoryEvent) RETURN PLS_INTEGER;
287
288 ---------------------------------------------
289 -- FUNCTION - getOpenDenyMode
290 -- PARAMETERS -
291 -- ev - XDB Repository Event object
292 -- RETURNS -
293 -- This method is only valid for the open event. It returns the deny mode
294 -- for the open operation, which could be one of:
295 -- OPEN_DENY_NONE
296 -- OPEN_DENY_READ
297 -- OPEN_DENY_READ_WRITE
298 ---------------------------------------------
299 FUNCTION getOpenDenyMode(ev IN XDBRepositoryEvent) RETURN PLS_INTEGER;
300
301 ---------------------------------------------
302 -- FUNCTION - isNull
303 -- PARAMETERS -
304 -- repev - XDB Repository event object
305 -- RETURNS - TRUE if input argument is null.
306 ---------------------------------------------
307 FUNCTION isNull(repev IN XDBRepositoryEvent) RETURN BOOLEAN;
308
309 ---------------------------------------------
310 -- XDBHandlerList Methods
311 ---------------------------------------------
312
313 ---------------------------------------------
314 -- FUNCTION - getFirst
315 -- PARAMETERS -
316 -- hl - XDB handler list.
317 -- RETURNS -
318 -- The first handler in the list.
319 ---------------------------------------------
320 FUNCTION getFirst(hl IN XDBHandlerList) RETURN XDBHandler;
321
322 ---------------------------------------------
323 -- FUNCTION - getNext
324 -- PARAMETERS -
325 -- hl - XDB handler list.
326 -- RETURNS -
327 -- Next handler in the list.
328 ---------------------------------------------
329 FUNCTION getNext(hl IN XDBHandlerList) RETURN XDBHandler;
330
331 ---------------------------------------------
332 -- FUNCTION - remove
333 -- Removes the given handler from the list.
334 -- PARAMETERS -
335 -- hl - XDB handler list.
336 -- handler - handler to be removed
337 ---------------------------------------------
338 PROCEDURE remove(hl IN XDBHandlerList, handler IN XDBHandler);
339
340 ---------------------------------------------
341 -- PROCEDURE - clear
342 -- Clears the handler list.
343 -- PARAMETERS -
344 -- hl - XDB handler list.
345 ---------------------------------------------
346 PROCEDURE clear(hl IN XDBHandlerList);
347
348 ---------------------------------------------
349 -- FUNCTION - isNull
350 -- PARAMETERS -
351 -- hl - XDB handler list.
352 -- RETURNS - TRUE if input argument is null.
353 ---------------------------------------------
354 FUNCTION isNull(hl IN XDBHandlerList) RETURN BOOLEAN;
355
356 ---------------------------------------------
357 -- XDBHandler Methods
358 ---------------------------------------------
359
360 ---------------------------------------------
361 -- FUNCTION - getSource
362 -- PARAMETERS -
363 -- handler - an XDBHandler object
364 -- RETURNS -
365 -- The name of the Java class, PL/SQL package or object type implementing
366 -- the handler.
367 ---------------------------------------------
368 FUNCTION getSource (handler IN XDBHandler) RETURN VARCHAR2;
369
370 ---------------------------------------------
371 -- FUNCTION - getSchema
372 -- PARAMETERS -
373 -- handler - an XDBHandler object
374 -- RETURNS -
375 -- the schema of the handler's source
376 ---------------------------------------------
377 FUNCTION getSchema (handler IN XDBHandler) RETURN VARCHAR2;
378
379 ---------------------------------------------
380 -- FUNCTION - getLanguage
381 -- PARAMETERS -
382 -- handler - an XDBHandler object
383 -- RETURNS -
384 -- The implementation language of the handler
385 ---------------------------------------------
386 FUNCTION getLanguage (handler IN XDBHandler) RETURN VARCHAR2;
387
388 ---------------------------------------------
389 -- FUNCTION - isNull
390 -- PARAMETERS -
391 -- handler - the handler
392 -- RETURNS - TRUE if input argument is null.
393 ---------------------------------------------
394 FUNCTION isNull(handler IN XDBHandler) RETURN BOOLEAN;
395
396 ---------------------------------------------
397 -- XDBPath Methods
398 ---------------------------------------------
399
400 ---------------------------------------------
401 -- FUNCTION - getName
402 -- PARAMETERS -
403 -- path - a XDBPath object
404 -- RETURNS -
405 -- the string representation of the path.
406 ---------------------------------------------
407 FUNCTION getName (path IN XDBPath) RETURN VARCHAR2;
408
409 ---------------------------------------------
410 -- FUNCTION - getName
411 -- PARAMETERS -
412 -- path - a XDBPath object
413 -- level - indicates the number of levels up the hierarchy. This value
414 -- must be greater than zero. Level 1 means the immediate parent.
415 -- If level exceeds the height of the tree then a null is returned.
416 -- RETURNS -
417 -- The parent's path.
418 ---------------------------------------------
419 FUNCTION getParentPath (path IN XDBPath, level IN PLS_INTEGER) RETURN XDBPath;
420
421 ---------------------------------------------
422 -- FUNCTION - isNull
423 -- PARAMETERS -
424 -- path - a XDBPath object
425 -- RETURNS - TRUE if input argument is null.
426 ---------------------------------------------
427 FUNCTION isNull(path IN XDBPath) RETURN BOOLEAN;
428
429 ---------------------------------------------
430 -- XDBLink Methods
431 ---------------------------------------------
432
433 ---------------------------------------------
434 -- FUNCTION - getParentName
435 -- PARAMETERS -
436 -- link - an XDBLink object
437 -- RETURNS -
438 -- the link's parent folder's name.
439 ---------------------------------------------
440 FUNCTION getParentName (link IN XDBLink) RETURN VARCHAR2;
441
442 ---------------------------------------------
443 -- FUNCTION - getParentOID
444 -- PARAMETERS -
445 -- link - an XDBLink object
446 -- RETURNS -
447 -- the link's parent folder's OID
448 ---------------------------------------------
449 FUNCTION getParentOID (link IN XDBLink) RETURN RAW;
450
451 ---------------------------------------------
452 -- FUNCTION - getChildOID
453 -- PARAMETERS -
454 -- link - an XDBLink object
455 -- RETURNS -
456 -- the OID of the resource that the link is pointing to.
457 ---------------------------------------------
458 FUNCTION getChildOID (link IN XDBLink) RETURN RAW;
459
460 ---------------------------------------------
461 -- FUNCTION - getLinkName
462 -- PARAMETERS -
463 -- link - an XDBLink object
464 -- RETURNS -
465 -- the name of the link
466 ---------------------------------------------
467 FUNCTION getLinkName (link IN XDBLink) RETURN VARCHAR2;
468
469 ---------------------------------------------
470 -- FUNCTION - isNull
471 -- PARAMETERS -
472 -- link - an XDBLink object
473 -- RETURNS - TRUE if input argument is null.
474 ---------------------------------------------
475 FUNCTION isNull(link IN XDBLink) RETURN BOOLEAN;
476
477 ---------------------------------------------
478 -- XDBLock Methods
479 ---------------------------------------------
480 SCOPE_EXCLUSIVE CONSTANT PLS_INTEGER := 0;
481 SCOPE_SHARED CONSTANT PLS_INTEGER := 1;
482 TYPE_WRITE CONSTANT PLS_INTEGER := 0;
483 TYPE_READ_WRITE CONSTANT PLS_INTEGER := 1;
484
485 ---------------------------------------------
486 -- FUNCTION - getLockMode
487 -- PARAMETERS -
488 -- lk - a XDBLock object
489 -- RETURNS -
490 -- the lock's mode (shared or exlusive).
491 ---------------------------------------------
492 FUNCTION getLockMode (lk in XDBLock) RETURN PLS_INTEGER;
493
494 ---------------------------------------------
495 -- FUNCTION - getLockType
496 -- PARAMETERS -
497 -- lk - a XDBLock object
498 -- RETURNS -
499 -- the lock's type (write or read-write)
500 ---------------------------------------------
501 FUNCTION getLockType (lk in XDBLock) RETURN PLS_INTEGER;
502
503 ---------------------------------------------
504 -- FUNCTION - getDAVToken
505 -- PARAMETERS -
506 -- lk - a XDBLock object
507 -- RETURNS -
508 -- the token id if this is a DAV lock. Otherwise null
509 ---------------------------------------------
510 FUNCTION getDAVToken (lk in XDBLock) RETURN VARCHAR2;
511
512 ---------------------------------------------
513 -- FUNCTION - getDAVOwner
514 -- PARAMETERS -
515 -- lk - a XDBLock object
516 -- RETURNS -
517 -- the DAV:owner if this is a DAV lock. Otherwise null
518 ---------------------------------------------
519 FUNCTION getDAVOwner (lk in XDBLock) RETURN VARCHAR2;
520
521 ---------------------------------------------
522 -- FUNCTION - getNFSNodeId
523 -- PARAMETERS -
524 -- lk - a XDBLock object
525 -- RETURNS -
526 -- the RAC node id if this is an NFSv4 lock. Otherwise null
527 ---------------------------------------------
528 FUNCTION getNFSNodeId (lk in XDBLock) RETURN RAW;
529
530 ---------------------------------------------
531 -- FUNCTION - getDepth
532 -- PARAMETERS -
533 -- lk - a XDBLock object
534 -- RETURNS -
535 -- the depth of the lock (either 0 or INFINITY_DEPTH)
536 ---------------------------------------------
537 FUNCTION getDepth (lk in XDBLock) RETURN PLS_INTEGER;
538
539 ---------------------------------------------
540 -- FUNCTION - getExpiry
541 -- PARAMETERS -
542 -- lk - a XDBLock object
543 -- RETURNS -
544 -- If DAV lock returns the date and time at which the lock will expire;
545 -- otherwise returns null.
546 ---------------------------------------------
547 FUNCTION getExpiry (lk in XDBLock) RETURN TIMESTAMP;
548
549 ---------------------------------------------
550 -- FUNCTION - isNull
551 -- PARAMETERS -
552 -- lk - a XDBLock object
553 -- RETURNS - TRUE if input argument is null.
554 ---------------------------------------------
555 FUNCTION isNull(lk IN XDBLock) RETURN BOOLEAN;
556
557 end dbms_XEvent;