DBA Data[Home] [Help]

PACKAGE: SYS.DBMS_JAVA

Source


1 package dbms_java authid current_user as
2 
3   type compiler_option_type is record(option_line varchar2(128));
4 
5   type compiler_option_type_table is table of compiler_option_type;
6 
7   PROCEDURE start_btl;
8 
9   PROCEDURE stop_btl;
10 
11   PROCEDURE terminate_btl;
12 
13   -- compile all methods defined by the class identified by
14   -- classname in the current schema.
15   -- return the number of methods successfully compiled
16   --
17   -- If the class does not exist an ORA-29532 (Uncaught Java
18   -- exception) will occur.
19   FUNCTION compile_class(classname VARCHAR2) return NUMBER;
20 
21 
22   -- compile the method specified by name and Java type signature
23   -- defined by the class identified by classname in the current
24   -- schema.
25   -- return the number of methods successfully compiled
26   --
27   -- If the class does not exist, an ORA-29532 (Uncaught Java
28   -- exception) will occur.
29   FUNCTION compile_method(classname  VARCHAR2,
30                           methodname VARCHAR2,
31                           methodsig  VARCHAR2) return NUMBER;
32 
33 
34   -- uncompile all methods defined by the class identified by
35   -- classname in the current schema.
36   --
37   -- return the number of methods successfully uncompiled.
38   --
39   -- If permanentp, then mark these methods as permanently dynamicaly
40   -- un-compilable, otherwise, they are eligible for future dynamic
41   -- recompilation.
42   --
43   -- If the class does not exist an ORA-29532 (Uncaught Java
44   -- exception) will occur.
45   FUNCTION uncompile_class(classname VARCHAR2,
46                            permanentp NUMBER default 0) return NUMBER;
47 
48 
49   -- uncompile the method specified by the name and Java type
50   -- signature defined by the class identified by classname in the
51   -- current schema.
52   --
53   -- return the number of methods successfully uncompiled.
54   --
55   -- If permanentp, then mark the method as permanently dynamicaly
56   -- un-compilable, otherwise, it is eligible for future dynamic
57   -- recompilation.
58   --
59   -- If the class does not exist an ORA-29532 (Uncaught Java
60   -- exception) will occur.
61   FUNCTION uncompile_method(classname  VARCHAR2,
62                             methodname VARCHAR2,
63                             methodsig  VARCHAR2,
64                             permanentp NUMBER default 0) return NUMBER;
65 
66   --
67   -- Dump the native code (if available) for the specified method to trace.
68   --
69   PROCEDURE dump_native_machine_code(classname  VARCHAR2,
70                                      methodname VARCHAR2,
71                                      methodsig  VARCHAR2);
72 
73   FUNCTION native_compiler_options return compiler_option_type_table pipelined;
74 
75   -- sets a native-compiler option to the specified value for the
76   -- current schema
77   PROCEDURE set_native_compiler_option(optionName VARCHAR2,
78                                        value      VARCHAR2);
79 
80   -- decode, into a user-readable format, a persisted native-compiler
81   -- option.  This function is not intended to be used by users
82   -- directly
83   FUNCTION decode_native_compiler_option(optionName VARCHAR2,
84                                          value      VARCHAR2) RETURN VARCHAR2;
85 
86   -- unsets a native-compiler option given by the tuple
87   --   [optionName, value].
88   --
89   -- if the option given by optionName is not allowed to have
90   -- duplicate values, then the value is ignored.
91   PROCEDURE unset_native_compiler_option(optionName VARCHAR2,
92                                          value      VARCHAR2);
93 
94   FUNCTION init_btl(files_prefix VARCHAR2, type NUMBER,
95                     sample_limit NUMBER, exclude_java NUMBER) return NUMBER;
96   pragma restrict_references(init_btl, wnds, wnps);
97 
98   FUNCTION longname (shortname VARCHAR2) return VARCHAR2;
99   pragma restrict_references(longname, wnds, wnps);
100 
101   FUNCTION shortname (longname VARCHAR2) RETURN VARCHAR2;
102   pragma restrict_references(shortname, wnds, wnps);
103 
104   -- functions and procedures to manipulate the compiler option table
105   -- what refers to a source name, package or class depending
106 
107   -- determine the option value for option optionName applied to
108   -- what
109   FUNCTION get_compiler_option(what VARCHAR2, optionName VARCHAR2)
110     return varchar2 ;
111   pragma restrict_references (get_compiler_option, wnds, wnps);
112 
113   -- set the option value to value for option optionName applied to
114   -- what.  And depending upon the characteristics of optionName
115   -- it may apply to "descendants" of what as well.
116   PROCEDURE set_compiler_option(what VARCHAR2, optionName VARCHAR2, value VARCHAR2);
117 
118   -- reset the option value. That is, undo an action performed by
119   -- set_compiler_option
120   PROCEDURE reset_compiler_option(what VARCHAR2, optionName VARCHAR2);
121 
122   FUNCTION resolver (name VARCHAR2, owner VARCHAR2, type VARCHAR2)
123      RETURN VARCHAR2;
124   pragma restrict_references(resolver, wnds);
125 
126   FUNCTION derivedFrom (name VARCHAR2, owner VARCHAR2, type VARCHAR2)
127      RETURN VARCHAR2;
128   pragma restrict_references(derivedFrom, wnds);
129 
130   FUNCTION fixed_in_instance (name VARCHAR2, owner VARCHAR2, type VARCHAR2)
131      RETURN NUMBER;
132   pragma restrict_references(fixed_in_instance, wnds);
133 
134   PROCEDURE set_fixed_in_instance (name VARCHAR2, owner VARCHAR2,
135                                    type VARCHAR2, value NUMBER);
136 
137   FUNCTION sharedPrivateClassName (name VARCHAR2)
138      RETURN VARCHAR2;
139   pragma restrict_references(sharedPrivateClassName, wnds);
140 
141   -- RUNJAVA interface.  RUNJAVA is a facility for running
142   -- java in the OJVM server resident VM using a command line
143   -- interface that emulates the JDK java shell command.  In
144   -- particular, this interface allows the use of -classpath
145   -- to run classes loaded directly from the file system without
146   -- the intervening step of loading these classes into the database
147   -- via loadjava or the equivalent.  It also supports use of -D
148   -- arguments to set System property values.  There is an
149   -- auxiliary facility for establishing System property values
150   -- used by default (without requiring -D, in a manner intended
151   -- to be analogous to the use of environment variable by the
152   -- JDK in setting certain System properties).
153 
154   -- runjava:  This function takes a java command line as its
155   -- only argument and executes that command in the OJVM.  The
156   -- return value is null on successful completion, otherwise
157   -- an error message.  The format of the command line is the
158   -- same as that taken by the JDK java shell command, ie
159   -- [option switches] name_of_class_to_execute [arg1 arg2 ... argn]
160   -- The option switches -classpath and -D are supported.  Others
161   -- may be supported if they make sense in the OJVM environment.
162   -- This function differs from runjava_in_current_session in
163   -- that it clears any java state remaining from previous use of
164   -- java in the session prior to running the current command.
165   -- This is necessary in particular to guarantee that static
166   -- variable values derived at class initialization time from
167   -- -classpath and -D arguments are reflect the values of those
168   -- switches in the current command line.
169   FUNCTION runjava(cmdline VARCHAR2) RETURN VARCHAR2;
170 
171   -- runjava_in_current_session:  This function is the same as the
172   -- runjava function except that it does not clear java state
173   -- remaining from previous use of java in the session prior to
174   -- executing the current command line.  See the description
175   -- of runjava for other details.
176   FUNCTION runjava_in_current_session(cmdline VARCHAR2) RETURN VARCHAR2;
177 
178   -- endsession:  This function clears any java session state remaining
179   -- from previous execution of java in the current RDBMS session.
180   -- The return value is a message indicating the action taken.
181   FUNCTION endsession RETURN VARCHAR2;
182 
183   -- endsession_and_related_state:  This function clears any java
184   -- session state remaining from previous execution of java in the
185   -- current RDBMS session and all supporting data related to running
186   -- java, such as property settings and output specifications.
187   -- The return value is a message indicating the action taken.
188   FUNCTION endsession_and_related_state RETURN VARCHAR2;
189 
190   -- set_property:  This function provides for establishing
191   -- a value for a System property which will be used thereafter for the
192   -- duration of the current RDBMS session whenever a java session is
193   -- initialized.  The first argument is the name of the property
194   -- and the second is the value to be established for it.  The return value
195   -- from set_property is null unless some error occurred, such as an
196   -- attempt to set a value for a prescribed property, in which case
197   -- an error message is returned.
198   FUNCTION set_property(name VARCHAR2, value VARCHAR2) RETURN VARCHAR2;
199 
200   -- get_property:  This function returns any value previously established
201   -- by set_property, or null if there is no such value.
202   FUNCTION get_property(name VARCHAR2) RETURN VARCHAR2;
203 
204   -- remove_property:  This function removes any value previously established
205   -- by set_property.  The return value is null unless an error occurred,
206   -- in which case an error message is returned.
207   FUNCTION remove_property(name VARCHAR2) RETURN VARCHAR2;
208 
209   -- show_property.  This function prints a message of the form
210   --   name = value for the input name, or for all established property
211   -- bindings if name is null.  The return value is null on successful
212   -- completion, otherwise it is an error message.  The output is
213   -- printed to wherever java output is current directed.
214   FUNCTION show_property(name VARCHAR2) RETURN VARCHAR2;
215 
216   -- Methods for controlling destination of java output
217   PROCEDURE set_output (buffersize NUMBER);
218 
219   -- set_output_to_sql defines a named output specification which
220   -- constitutes a prescription for executing a sql statement whenever
221   -- output to the default System.out and System.err streams occurs.
222   -- The specification is defined for the duration of the current
223   -- session, or until remove_output_to_sql is called with its id.
224   -- The sql actions the specification prescribes will occur whenever
225   -- there is java output unless disable_output_to_sql has been called,
226   -- in which case the actions will not occur again until
227   -- enable_output_to_sql is called.
228   --
229   -- Arguments are
230   --   id       The name of the specification.  Multiple specifications
231   --            may exist in the same session, but each must have a distinct
232   --            id.  The id is used to identify the specification in the
233   --            functions remove, enable, disable and query_output_to_sql.
234   --   stmt     The default sql statement to execute when java output occurs.
235   --   bindings A string containing tokens from the set
236   --            ID, TEXT, LENGTH, LINENO, SEGNO, NL and ERROUT.  This string
237   --            defines how the sql statement stmt will be bound.  The
238   --            position in the bindings string of a token corresponds to
239   --            the bind position in the sql statement.  The meanings of the
240   --            tokens are
241   --            ID  the id of the specification, bound as a VARCHAR2
242   --            TEXT  the text being output, bound as a VARCHAR2
243   --            LENGTH the length of the text, bound as a NUMBER
244   --            LINENO the line number (since the beginning of session output),
245   --                   bound as a NUMBER
246   --            SEGNO the segment number within a line that is being output
250   --               may or may not actually be included in the text, depending
247   --                   in more than one piece, bound as a NUMBER
248   --            NL a boolean indicating whether the text is to be regarded
249   --               as newline terminated, bound as a NUMBER.  The newline
251   --               on the value of the include_newlines argument discussed
252   --               below.
253   --            ERROUT a boolean indicating whether the output came from
254   --               System.out or System.err, bound as a NUMBER.  The value
255   --               is 0 iff the output came from System.out.
256   --   no_newline_stmt   An optional alternate sql statement to execute
257   --                     when the output is not newline terminated.
258   --   no_newline_bindings  A string with the same syntax as for the bindings
259   --                        argument discussed above, describing how the
260   --                        no_newline_stmt is bound.
261   --   newline_only_stmt   An optional alternate sql statement to execute
262   --                       when the output is a single newline.
263   --   newline_only_bindings  A string with the same syntax as for the bindings
264   --                          argument discussed above, describing how the
265   --                          newline_only_stmt is bound.
266   --   maximum_line_segment_length  The maximum number of characters that
267   --                                will be bound in a given execution of
268   --                                the sql statement.  Longer output
269   --                                sequences will be broken up into
270   --                                separate calls with distinct SEGNO
271   --                                values.  A value of 0 means no maximum.
272   --   allow_replace  Controls behavior when a previously defined specification
273   --                  with the same id exists.  A value of 1 means replace the
274   --                  old specification.  0 means return an error message
275   --                  without modifying the old specification.
276   --   from_stdout  Controls whether output from System.out causes execution
277   --                of the sql statement prescribed by the specification.  A
278   --                value of 0 means that if the output came from System.out
279   --                the statement is not executed even if the specification is
280   --                otherwise enabled.
281   --   from_stderr  Controls whether output from System.err causes execution
282   --                of the sql statement prescribed by the specification.  A
283   --                value of 0 means that if the output came from System.err
284   --                the statement is not executed even if the specification is
285   --                otherwise enabled.
286   --   include_newlines  Controls whether newline characters are left in the
287   --                     output when it is bound to text.  A value of 0 means
288   --                     newlines are not included (but the presence of the
289   --                     newline is still indicated by the NL binding and
290   --                     by whether the no_newline_stmt is used).
291   --   eager  Controls whether output not terminated by a newline causes
292   --          execution of the sql statement every time it is received vs
293   --          accumulating such output until a newline is received.  A value
294   --          of 0 means that unterminated output is accumulated.
295   --
296   -- Return value is null on success otherwise an error message.
297   FUNCTION set_output_to_sql (id VARCHAR2,
298                               stmt VARCHAR2,
299                               bindings VARCHAR2,
300                               no_newline_stmt VARCHAR2 default null,
301                               no_newline_bindings VARCHAR2 default null,
302                               newline_only_stmt VARCHAR2 default null,
303                               newline_only_bindings VARCHAR2 default null,
304                               maximum_line_segment_length NUMBER default 0,
305                               allow_replace NUMBER default 1,
306                               from_stdout NUMBER default 1,
307                               from_stderr NUMBER default 1,
308                               include_newlines NUMBER default 0,
309                               eager NUMBER default 0) return VARCHAR2;
310 
311   -- remove_output_to_sql deletes a specification created by
312   -- set_output_to_sql.  If no such specification exists, an error message
313   -- is returned
314   FUNCTION remove_output_to_sql (id VARCHAR2) return VARCHAR2;
315 
316   -- enable_output_to_sql (re)enables a specification created by
317   -- set_output_to_sql and subsequently disabled by disable_output_to_sql.
318   -- If no such specification exists, an error message is returned.  If
319   -- the specification is not currently disabled, there is no change.
320   FUNCTION enable_output_to_sql (id VARCHAR2) return VARCHAR2;
321 
322   -- disable_output_to_sql disables a specification created by
323   -- set_output_to_sql.  The specification may be re-enabled by
324   -- enable_output_to_sql.  While disabled, the sql statement prescribed
325   -- by the specification is not executed.
326   -- If no such specification exists, an error message is returned.  If
327   -- the specification is already disabled, there is no change.
328   FUNCTION disable_output_to_sql (id VARCHAR2) return VARCHAR2;
329 
330   -- query_output_to_sql returns a message describing a specification
331   -- created by set_output_to_sql.
332   -- If no such specification exists, an error message is returned.
333   FUNCTION query_output_to_sql (id VARCHAR2) return VARCHAR2;
334 
335   -- set_output_to_java defines a named output specification which
336   -- constitutes a prescription for executing a java method whenever
337   -- output to the default System.out and System.err streams occurs.
338   -- See the comments for set_output_to_sql for discussion of the
342   -- rest of the session.
339   -- common arguments and the duration of the specifications.  The
340   -- java method prescribed by the specification is executed in a
341   -- separate VM context with separate java session state from the
343   -- Arguments specific to this type of specification are
344   --   class_name  The name of the class defining the method(s)
345   --   class_schema  The schema in which the class is defined.  A null
346   --                 value means the class is defined in the current schema,
347   --                 or PUBLIC.
348   --   method  The name of the method.
349   --   bindings  A string that defines how arguments to the method are bound.
350   --             This is a string of tokens with the same syntax as discussed
351   --             under set_output_to_sql above.  The position of a token in
352   --             the string determines the position of the argument it
353   --             describes.  All arguments must be of type int, except for
354   --             those corresponding to the tokens ID or TEXT, which must be
355   --             of type java.lang.String.
356   --   no_newline_method   An optional alternate method to execute
357   --                       when the output is not newline terminated.
358   --   newline_only_method   An optional alternate method to execute
359   --                         when the output is a single newline.
360   --   initialization_statement  An optional sql statement that is executed
361   --                             once per java session prior to the first
362   --                             time the methods that receive output are
363   --                             executed.  This statement is executed in
364   --                             same java VM context as the output methods
365   --                             will be.  Typically such a statement is
366   --                             used to run a java stored procedure that
367   --                             initializes conditions in the separate VM
368   --                             context so that the methods that receive
369   --                             output can function as intended.  For
370   --                             example such a procedure might open a
371   --                             stream which the output methods write to.
372   --   finalization_statement  An optional sql statement that is executed
373   --                           once when the output specification is
374   --                           about to be removed or the session is ending.
375   --                           Like the initialization_statement this runs
376   --                           in the same java VM context as the methods
377   --                           that receive output.  It runs only if the
378   --                           initialization method has run, or if there is
379   --                           no initialization method.
380   FUNCTION set_output_to_java (id VARCHAR2,
381                                class_name VARCHAR2,
382                                class_schema VARCHAR2,
383                                method VARCHAR2,
384                                bindings VARCHAR2,
385                                no_newline_method VARCHAR2 default null,
386                                no_newline_bindings VARCHAR2 default null,
387                                newline_only_method VARCHAR2 default null,
388                                newline_only_bindings VARCHAR2 default null,
389                                maximum_line_segment_length NUMBER default 0,
390                                allow_replace NUMBER default 1,
391                                from_stdout NUMBER default 1,
392                                from_stderr NUMBER default 1,
393                                include_newlines NUMBER default 0,
394                                eager NUMBER default 0,
395                                initialization_statement VARCHAR2 default null,
396                                finalization_statement VARCHAR2 default null)
397          return VARCHAR2;
398 
399   -- remove_output_to_java deletes a specification created by
400   -- set_output_to_java.  If no such specification exists, an error message
401   -- is returned
402   FUNCTION remove_output_to_java (id VARCHAR2) return VARCHAR2;
403 
404   -- enable_output_to_java (re)enables a specification created by
405   -- set_output_to_java and subsequently disabled by disable_output_to_java.
406   -- If no such specification exists, an error message is returned.  If
407   -- the specification is not currently disabled, there is no change.
408   FUNCTION enable_output_to_java (id VARCHAR2) return VARCHAR2;
409 
410   -- disable_output_to_java disables a specification created by
411   -- set_output_to_java.  The specification may be re-enabled by
412   -- enable_output_to_java.  While disabled, the sql statement prescribed
413   -- by the specification is not executed.
414   -- If no such specification exists, an error message is returned.  If
415   -- the specification is already disabled, there is no change.
416   FUNCTION disable_output_to_java (id VARCHAR2) return VARCHAR2;
417 
418   -- query_output_to_java returns a message describing a specification
419   -- created by set_output_to_java.
420   -- If no such specification exists, an error message is returned.
421   FUNCTION query_output_to_java (id VARCHAR2) return VARCHAR2;
422 
423   -- set_output_to_file defines a named output specification which
424   -- constitutes a prescription to capture any output sent to the
425   -- default System.out and System.err streams and append it to
426   -- a specified file.  This is implemented using a special case
427   -- of set_output_to_java.  Arguments are
428   --   file_path  The path to the file to which to append the output
429   --   allow_replace, from_stdout and from_stderr all analogous to
430   --      those of the same name in set_output_to_java
431   FUNCTION set_output_to_file (id VARCHAR2,
432                                file_path VARCHAR2,
436          return VARCHAR2;
433                                allow_replace NUMBER default 1,
434                                from_stdout NUMBER default 1,
435                                from_stderr NUMBER default 1)
437 
438   -- The following four functions are analogous to their output_to_java
439   -- counterparts
440   FUNCTION remove_output_to_file (id VARCHAR2) return VARCHAR2;
441 
442   FUNCTION enable_output_to_file (id VARCHAR2) return VARCHAR2;
443 
444   FUNCTION disable_output_to_file (id VARCHAR2) return VARCHAR2;
445 
446   FUNCTION query_output_to_file (id VARCHAR2) return VARCHAR2;
447 
448   -- The following two procedures are for internal use in the
449   -- implementation of set_output_to_file
450   PROCEDURE initialize_output_to_file (id VARCHAR2, path VARCHAR2);
451 
452   PROCEDURE finalize_output_to_file (id VARCHAR2);
453 
454   -- The following two procedures and one function control
455   -- whether java output is sent to the .trc file (this is the
456   -- case by default)
457   PROCEDURE enable_output_to_trc;
458 
459   PROCEDURE disable_output_to_trc;
460 
461   FUNCTION query_output_to_trc return VARCHAR2;
462 
463   -- import/export interface --
464   function start_export(short_name in varchar2,
465                         schema in varchar2,
466                         flags in number,
467                         type in number,
468                         properties out number,
469                         raw_chunk_count out number,
470                         total_raw_byte_count out number,
471                         text_chunk_count out number,
472                         total_text_byte_count out number)
473          return number;
474   pragma restrict_references(start_export, wnds);
475 
476   function export_raw_chunk(chunk out raw, length out number)
477            return number;
478   pragma restrict_references(export_raw_chunk, wnds);
479 
480   function export_text_chunk(chunk out varchar2, length out number)
481            return number;
482   pragma restrict_references(export_text_chunk, wnds);
483 
484 
485   function end_export return number;
486   pragma restrict_references(end_export, wnds);
487 
488 
489   function start_import(long_name in varchar2,
490                         flags in number,
491                         type in number,
492                         properties in number,
493                         raw_chunk_count in number,
494                         total_raw_byte_count in number,
495                         text_chunk_count in number)
496          return number;
497   pragma restrict_references(start_import, wnds);
498 
499 
500   function import_raw_chunk(chunk in raw, length in number)
501            return number;
502   pragma restrict_references(import_raw_chunk, wnds);
503 
504 
505   function import_text_chunk(chunk in varchar2, length in number)
506            return number;
507   pragma restrict_references(import_text_chunk, wnds);
508 
509 
510   function end_import return number;
511   pragma restrict_references(end_import, wnds);
512 
513 
514   -- grant or revoke execute via Handle methods.  Needed with system class
515   -- loading since SQL grant/revoke can't manipulate permanently kept objects
516   procedure set_execute_privilege(object_name   varchar2,
517                                   object_schema varchar2,
518                                   object_type   varchar2,
519                                   grantee_name  varchar2,
520                                   grant_if_nonzero number)
521   as language java name
522   'oracle.aurora.rdbms.DbmsJava.setExecutePrivilege(java.lang.String,
523                                                     oracle.sql.CHAR,
524                                                     java.lang.String,
525                                                     oracle.sql.CHAR,
526                                                     boolean)';
527 
528   -- convenience functions to support development environments --
529   -- There procedures allow PL/SQL to get at Java Schem Objects.
530   -- There are a lot of them, but they can be understood from the
531   -- grammar
532   --     export_<what>(name, [schema,] lob)
533   --
534   -- <what> is either source, class or resource
535   -- name a varchar argument that is the name of the java schema object
536   -- schema is an optional argument, if it is present it is a varchar that
537   --   names a schema, if it ommitted the current schema is used
538   -- lob is either a BLOB or CLOB.  The contents of the object are placed
539   --   into it. CLOB's are allowed only for source and resource (i.e. not
540   --   for class). Note that the internal representation of source uses
541   --   UTF8 and that is what is stored into the BLOB
542   --
543   -- If the java schema object does not exist an ORA-29532 (Uncaught Java
544   -- exception) will occur.
545 
546 
547   procedure export_source(name varchar2, schema varchar2, src BLOB)
548   as language java name
549   'oracle.aurora.rdbms.ExportSchemaObjects.exportSource(java.lang.String, java.lang.String, oracle.sql.BLOB)';
550 
551   procedure export_source(name varchar2, src BLOB)
552   as language java name
553   'oracle.aurora.rdbms.ExportSchemaObjects.exportSource(java.lang.String, oracle.sql.BLOB)';
554 
555   procedure export_source(name varchar2, schema varchar2, src CLOB)
556   as language java name
557   'oracle.aurora.rdbms.ExportSchemaObjects.exportSource(java.lang.String, java.lang.String, oracle.sql.CLOB)';
558 
559   procedure export_source(name varchar2, src CLOB)
560   as language java name
561   'oracle.aurora.rdbms.ExportSchemaObjects.exportSource(java.lang.String, oracle.sql.CLOB)';
562 
566 
563   procedure export_class(name varchar2, schema varchar2, clz BLOB)
564   as language java name
565   'oracle.aurora.rdbms.ExportSchemaObjects.exportClass(java.lang.String, java.lang.String, oracle.sql.BLOB)';
567   procedure export_class(name varchar2, clz BLOB)
568   as language java name
569   'oracle.aurora.rdbms.ExportSchemaObjects.exportClass(java.lang.String, oracle.sql.BLOB)';
570 
571   procedure export_resource(name varchar2, schema varchar2, res BLOB)
572   as language java name
573   'oracle.aurora.rdbms.ExportSchemaObjects.exportResource(java.lang.String, java.lang.String, oracle.sql.BLOB)';
574 
575   procedure export_resource(name varchar2, res BLOB)
576   as language java name
577   'oracle.aurora.rdbms.ExportSchemaObjects.exportResource(java.lang.String, oracle.sql.BLOB)';
578 
579   procedure export_resource(name varchar2, schema varchar2, res CLOB)
580   as language java name
581   'oracle.aurora.rdbms.ExportSchemaObjects.exportResource(java.lang.String, java.lang.String, oracle.sql.CLOB)';
582 
583   procedure export_resource(name varchar2, res CLOB)
584   as language java name
585   'oracle.aurora.rdbms.ExportSchemaObjects.exportResource(java.lang.String, oracle.sql.CLOB)';
586 
587   procedure loadjava(options varchar2)
588   as language java name
589   'oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(java.lang.String)';
590 
591   procedure loadjava(options varchar2, resolver varchar2)
592   as language java name
593   'oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(java.lang.String, java.lang.String)';
594 
595   procedure loadjava(options varchar2, resolver varchar2, status OUT number)
596   as language java name
597   'oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(java.lang.String, java.lang.String, int[])';
598 
599   procedure dropjava(options varchar2)
600   as language java name
601   'oracle.aurora.server.tools.loadjava.DropJavaMain.serverMain(java.lang.String)';
602 
603 
604   -- Interface to manage Security Policy Table ----------------
605   --
606   -- Part A: routines populating security table.
607   --
608   -- All routines in this section add a new row. Use routines from
609   -- Part B to reuse existing rows.
610   -- Returned 'key' is set to the key of the created row or to -1 if an
611   --    error occurs.
612 
613   -- PROCEDURE grant_permission: adds a new policy table row
614   -- granting the permission as determined by the parameters.
615   --
616   -- Parameter descriptions:
617   --
618   --  grantee            is the name of a schema or role
619   --  permission_type    is the fully qualified name of a class that extends
620   --                     java.lang.security.Permission
621   --  permission_name    is the name of the Permission
622   --  permission_action  is the action of the Permission
623   --  key                is the key of the newly inserted row
624   --                     that grants the Permission.
625   --                     This value is -1, if an error occurs.
626   procedure grant_permission(
627         grantee varchar2, permission_type varchar2,
628         permission_name varchar2, permission_action varchar2,
629         key OUT number)
630   as language java name
631   'oracle.aurora.rdbms.security.PolicyTableManager.grant(
632        java.lang.String, java.lang.String, java.lang.String,
633        java.lang.String, long[])';
634 
635   -- procedure restrict_permission: adds a new policy table row
636   -- restricting the permission as determined by the parameters.
637   -- similar to grant except create a restricting row.
638   --
639   -- Parameter descriptions:
640   --
641   --  grantee            is the name of a schema or role
642   --  permission_type    is the fully qualified name of a class that extends
643   --                     java.lang.security.Permission
644   --  permission_name    is the name of the Permission
645   --  permission_action  is the action of the Permission
646   --  key                is the key of the newly inserted row
647   --                     that grants the Permission.
648   --                     This value is -1, if an error occurs.
649   procedure restrict_permission(
650         grantee varchar2, permission_type varchar2,
651         permission_name varchar2, permission_action varchar2,
652         key OUT number)
653   as language java name
654   'oracle.aurora.rdbms.security.PolicyTableManager.restrict(
655        java.lang.String, java.lang.String, java.lang.String,
656        java.lang.String, long[])';
657 
658   -- grant_policy_permission: special case for granting PolicyTablePermissions.
659   --
660   -- The name of a PolicyTablePermission allows updates of rows relating to
661   -- a particular type (i.e. class that extends Permission) to
662   -- specify the class you must specify the schema containing the
663   -- class. In the table that is stored as the user number, but this
664   -- procedure lets it be specified via a name.
665   --
666   --  Parameter descriptions:
667   --  grantee           is the name of a schema or role
668   --  permission_schema is the schema of the permission
669   --  permission_type   is the fully qualified name
670   --                    of a class that extends java.lang.security.Permission
671   --  permission_name   is the name of the Permission which can be a glob '*'
672   --  key               is the key of the newly inserted row
673   --                    that grants the Permission.
674   --                    This value is -1, if an error occurs.
675   procedure grant_policy_permission(
676         grantee varchar2,
677         permission_schema varchar2, permission_type varchar2,
678         permission_name varchar2,
679         key OUT number)
680   as language java name
681   'oracle.aurora.rdbms.security.PolicyTableManager.grantPolicyPermission(
685   -- Part B: high-level management.
682        java.lang.String, java.lang.String, java.lang.String,
683        java.lang.String, long[])';
684 
686   --
687   -- The following versions of grant_permission, restrict_permission
688   -- and grant_policy permission do not have the key OUT parameter,
689   -- These routines attempt to reuse existing rows in the policy table
690   -- that is, do not create a new row if a matching row exists.
691 
692   -- grant_permission: create an active row in the policy table granting the Permission
693   -- as specified to grantee.  If a row already exists granting the
694   -- exact Permission specified then the table is unmodifed.
695   -- If a row exists but is disabled then it is enabled.
696   -- Finally if no row exists one is inserted.
697   --
698   -- grantee is the name of a schema
699   -- permission_type is the fully qualified name of a class that
700   --    extends java.lang.security.Permission.  If the class does
701   --    not have a public synonymn then the name should be prefixed
702   --    by <schema>:.  For example 'myschema:scott.MyPermission'.
703   -- permission_name is the name of the permission
704   -- permission_action is the action of the permission
705   procedure grant_permission(
706         grantee varchar2, permission_type varchar2,
707         permission_name varchar2, permission_action varchar2)
708   as language java name
709   'oracle.aurora.rdbms.security.PolicyTableManager.grant(
710        java.lang.String, java.lang.String, java.lang.String,
711        java.lang.String)';
712 
713   -- restrict_permission: similar to the above except the row is
714   -- restricted.
715   procedure restrict_permission(
716         grantee varchar2, permission_type varchar2,
717         permission_name varchar2, permission_action varchar2)
718   as language java name
719   'oracle.aurora.rdbms.security.PolicyTableManager.restrict(
720        java.lang.String, java.lang.String, java.lang.String,
721        java.lang.String)';
722 
723   -- grant_policy_permission: similar to grant_policy_permission with an
724   -- OUT key parameter except avoids creating a new row if a matching row exists.
725   procedure grant_policy_permission(
726         grantee varchar2,
727         permission_schema varchar2, permission_type varchar2,
728         permission_name varchar2)
729   as language java name
730   'oracle.aurora.rdbms.security.PolicyTableManager.grantPolicyPermission(
731        java.lang.String, java.lang.String, java.lang.String,
732        java.lang.String)';
733 
734   -- revoke disables any permissions that might have been granted
735   procedure revoke_permission(
736         grantee varchar2, permission_type varchar2,
737         permission_name varchar2, permission_action varchar2)
738   as language java name
739   'oracle.aurora.rdbms.security.PolicyTableManager.revoke(
740        java.lang.String, java.lang.String, java.lang.String,
741        java.lang.String)';
742 
743   -- Part C: management using keys.
744   -- As a rule, these routines do nothing if key does not identify
745   -- a row.
746 
747   -- enable_permission: enable the existing row with specified key.
748   -- There is no error reported if the key does not identify a row.
749   -- enable_permission checks user permissions for policy table access and
750   -- may throw a SecurityException.
751   procedure enable_permission(key number)
752   as language java name
753   'oracle.aurora.rdbms.security.PolicyTableManager.enable(long)';
754 
755   -- disable_permission: disable the existing row with specified key.
756   -- The row remain in the table as INACTIVE row.
757   -- There is no error reported if the key does not identify a row.
758   -- disable_permission checks user permissions for policy table access and
759   -- may throw a SecurityException.
760   procedure disable_permission(key number)
761   as language java name
762   'oracle.aurora.rdbms.security.PolicyTableManager.disable(long)';
763 
764   -- delete_permission removes an existing row with specified key
765   -- from the policy table.
766   -- To be removed, the row must be disabled first, see procedure 'disable_permission'.
767   -- If the row is still active  or if 'key' matches nothing,
768   -- delete_permission currently issues no errors or assertions and does nothing.
769   procedure delete_permission(key number)
770   as language java name
771   'oracle.aurora.rdbms.security.PolicyTableManager.delete(long)';
772 
773 
774   -- set debugging level
775   procedure set_permission_debug(level number)
776   as language java name
777   'oracle.aurora.rdbms.security.PolicyTableManager.setDebugLevel(int)';
778 
779   -- turn byte code verifier on or off for current session
780   -- 0 is off, 1 is on
781   -- you need JServerPermission("Verifier") to do this operation
782   procedure set_verifier(flag number)
783   as language java name
784   'oracle.aurora.rdbms.Compiler.sessionOptionController(int)';
785 
786   function option_controller(opt number, action number) return number
787   as language java name
788   'oracle.aurora.rdbms.Compiler.optionController(int, int) return boolean';
789 
790   -- turn system class loading on or off for current session
791   -- 0 is off, 1 is on
792   -- you need to be running as SYS to do this operation
793   procedure set_system_class_loading(flag number);
794 
795   -- reset instance duration flag for existence of the system property
796   -- definition table java$jvm$system$property$defs
797   -- if the table is created while the instance is up this procedure
798   -- must be called to allow the table to be used.  The table will be
799   -- used in any case after instance restart if the table exists at
800   -- that time
801   -- you need to be running as SYS to do this operation
802   procedure reset_property_defs_table_flag;
803 
807   -- JMX-related security exceptions will be raised.
804   -- start_jmx_agent: Start an agent activating OJVM JMX server and remote listener.
805   -- The JMX server starts as a collection of daemon threads in the current session.
806   -- The session is expected to run with JMXSERVER role or a superset, otherwise
808   -- Arguments:
809   -- port   the port for the JMX listener,
810   --        the value for the property com.sun.management.jmxremote.port
811   -- ssl    the value for the property com.sun.management.jmxremote.ssl
812   -- auth   the value for the property com.sun.management.jmxremote.authenticate
813   -- Each argument can be null or omitted, with null as default.
814   -- When an argument is null, the corresponding property is not altered,
815   -- holding the value, if any, previously present in the session.
816   -- These three and other JMX-related properties can be configured in a session prior
817   -- to a call to start_jmx_agent by means of dbms_java.set_property.
818   -- Examples:
819   --   start_jmx_agent('9999', 'false', 'false')
820   --      start JMX server and listener on port 9999 with no SSL and no authentication
821   --   start_jmx_agent('9999')
822   --      start JMX server and listener on port 9999 with the other JMX settings
823   --      having the default values or the values set using dbms_java.set_property
824   --      earlier in the same session
825   --   start_jmx_agent
826   --      start JMX server and listener with the JMX settings
827   --      having the default values or the values set using dbms_java.set_property
828   --      earlier in the same session
829   procedure start_jmx_agent(port VARCHAR2 default NULL,
830                             ssl  VARCHAR2 default NULL,
831                             auth VARCHAR2 default NULL);
832 
833   -- Send command chunks to shell
834   procedure send_command (chunk long raw);
835 
836   -- Get reply chunks  from shell
837   function get_reply return long raw;
838 
839   -- add a preference to the database
840   -- user     user schema name
841   -- type     U for user or S for system
842   -- abspath  absolute path of the preference
843   -- key      key for value lookup
844   -- value    value to be stored (string)
845   procedure set_preference(user varchar2,type varchar2, abspath varchar2,
846                            key varchar2, value varchar2);
847 
848   function ncomp_status_msg return VARCHAR2 as language java name
849   'oracle.aurora.rdbms.DbmsJava.ncompEnabledMsg() return java.lang.String';
850 
851   function full_ncomp_enabled return VARCHAR2;
852 
853   function get_ojvm_property(propstring VARCHAR2) return VARCHAR2 as language
854   java name 'java.lang.System.getProperty(java.lang.String)
855   return java.lang.String';
856 
857   function getVersion return VARCHAR2;
858 
859   procedure dbms_feature_ojvm(ojvm_boolean    OUT NUMBER,
860                               aux_count       OUT NUMBER,
861                               ojvm_info       OUT CLOB);
862 
863   procedure dbms_feature_system_ojvm(ojvm_boolean    OUT NUMBER,
864                                      aux_count       OUT NUMBER,
865                                      ojvm_info       OUT CLOB);
866 
867   -- Associate the database user/schema name 'dbuser' with the OS
868   -- account identified by credential pair 'osuser'/'ospass'. This association is
869   -- encrypted and stored in a SYS-owned table. Once the association is
870   -- established, a new Operating System process forked by
871   -- java.lang.Runtime.exec() will be setuid osuser.
872   --
873   -- Parameter descriptions:
874   --
875   --     dbuser is the name of a database user (schema name)
876   --
877   --     osuser, ospass are OS account credentials
878   --
879   -- Examples of use:
880   --
881   --   Bind user/schema  DBUSER to credentials osuser/ospass:
882   --
883   --     dbms_java.set_runtime_exec_credentials('DBUSER', 'osuser', 'ospass');
884   --
885   --   Unbind DBUSER's association with credentials osuser/ospass:
886   --
887   --     dbms_java.set_runtime_exec_credentials('DBUSER', '', '');
888   --
889   --   or
890   --
891   --     dbms_java.set_runtime_exec_credentials('DBUSER', null, null);
892   --
893   --
894   procedure set_runtime_exec_credentials(dbuser varchar2,
895                                          osuser varchar2,
896                                          ospass varchar2);
897   -- Associate all database users with the OS account identified by
898   -- credential pair 'osuser'/'ospass'. This association is
899   -- in effect for any user that does not have credentials set with
900   -- set_runtime_exec_credentials(varchar2, varchar2, varchar2).
901   --
902   -- Parameter descriptions:
903   --
904   --     osuser, ospass are OS account credentials
905   --
906   procedure set_runtime_exec_credentials(osuser varchar2,
907                                          ospass varchar2);
908 
909   function get_jdk_version return VARCHAR2;
910 
911 end dbms_java;