DBA Data[Home] [Help]

PACKAGE: SYSTEM.AD_INVOKER

Source


1 package ad_invoker as
2 /* $Header: adinvsps.pls 120.0 2005/05/25 11:47:21 appldev noship $ */
3 
4 --
5 -- Procedures and Functions
6 --
7 procedure get_rewrite_pkgs
8            (is_incremental in varchar2);
9 
10 --
11 -- Loads the AD_INVOKER_TASKS table with the list of packages,
12 --   procedures, and functions in the first APPS schema that need to
13 --   be re-written for Invoker's Rights
14 --
15 -- is_incremental can be either
16 --   'TRUE'  - only process PL/SQL objects that have changed since last run
17 --   'FALSE' - process all applicable PL/SQL objects
18 --
19 -- If for some reason the row for 'Invoker Maintenance', 'Last Run'
20 --   is missing from AD_TIMESTAMPS, get_rewrite_pkgs() will fail in
21 --   incremental mode.  This can be fixed by running the whole
22 --   Invoker's Rights processing logic in non-incremental mode
23 --   (via adadmin "Compile APPS Schema(s)")
24 --
25 
26 procedure add_phase_boundary
27            (num_workers in integer);
28 
29 --
30 -- Loads the AD_INVOKER_TASKS table with a phase boundary,
31 --   which consists of one row per worker with the boundary_flag set
32 --
33 
34 procedure get_grant_pkgs
35            (is_incremental in varchar2);
36 
37 --
38 -- Loads the AD_INVOKER_TASKS table with the list of packages,
39 --   procedures, functions, and Java objects in the first APPS schema
40 --   in a cross product with all of the other APPS schemas.
41 -- Will have to verify the grants/synonyms for each combination of
42 --   first and (2-N)th APPS schemas
43 --
44 -- is_incremental can be either
45 --   'TRUE'  - only process objects that have changed since last run
46 --   'FALSE' - process all applicable objects
47 --
48 -- If for some reason the row for 'Invoker Maintenance', 'Last Run'
49 --   is missing from AD_TIMESTAMPS, get_grant_pkgs() will fail in
50 --   incremental mode.  This can be fixed by running the whole
51 --   Invoker's Rights processing logic in non-incremental mode
52 --   (via adadmin "Compile APPS Schema(s)")
53 --
54 
55 procedure invoker_maint_serial
56            (is_incremental in varchar2);
57 
58 --
59 -- Runs the whole Invoker's Rights maintenance logic in serial
60 --
61 -- Does not log errors to a table: just fails if encounters errors
62 --
63 -- The parallel version is strongly recommended over this version
64 --  (just use this from AutoPatch in serial mode)
65 --
66 
67 procedure invoker_mrc_grants
68            (apps_schema in varchar2,
69             mrc_schema  in varchar2);
70 
71 --
72 -- Runs the Invoker's Rights grants logic for MRC/MLS schemas
73 --
74 -- This replaces the non-invoker MRC logic that copies packages, procedures,
75 --   functions, and package bodies
76 --
77 
78 procedure calculate_grant_types
79            (worker_num in integer);
80 
81 --
82 -- Sets the authid_flag and invoker_flag for the PL/SQL objects
83 --  that this worker will process.
84 --
85 -- Have to do this in the worker because the grant logic is different
86 --  depending on whether a given package is Invoker's Rights or
87 --  Definer's Rights, and any package that is re-written will change from
88 --  Definer's Rights to Invoker's Rights.
89 --
90 
91 procedure assign_tasks
92            (num_workers in integer);
93 
94 --
95 -- Distribute the tasks evenly among the workers within each phase
96 -- Start each phase with worker 1.  Don't update any tasks in the
97 -- phase boundary rows.
98 --
99 
100 procedure apps_ddl_check;
101 
102 --
103 -- Doesn't do anything if no packages to process
104 -- If are packages to process:
105 --   Compiles any invalid APPS*DDL packages in the database
106 --   Checks for APPS_DDL and APPS_ARRAY_DDL packages in all APPS schemas
107 --
108 
109 procedure update_done
110            (what_row in rowid);
111 
112 --
113 -- Sets AD_INVOKER_TASKS.DONE_FLAG to 'Y' for this particular row.
114 -- Commits the changes using an autonomous transaction
115 --
116 
117 procedure rewrite_pkgs
118            (worker_num in integer);
119 
120 --
121 -- Re-writes the packages assigned to this worker to use
122 --   Invoker's Rights.
123 --
124 
125 procedure rewrite_a_package
126            (owner        in varchar2,
127             name         in varchar2,
128             type         in varchar2,
129             new_owner    in varchar2,
130             log_to_table in varchar2);
131 
132 --
133 -- Rewrites a specific package to use Invoker's Rights.
134 --
135 -- if log_to_table is 'TRUE', writes errors to ad_parallel_compile_errors
136 --
137 
138 procedure rewrite_plsql_array
139            (the_array in out nocopy dbms_sql.varchar2s,
140             lb        in     number,
141             ub        in     number,
142             type      in     varchar2);
143 --
144 -- Rewrites the PL/SQL object creation text stored in the array
145 --  to use Invoker's Rights.
146 --
147 -- DOES NOT CREATE THE OBJECT
148 --
149 -- Got most of the logic from rewrite_a_package
150 --
151 
152 procedure grant_pkgs
153            (worker_num in integer);
154 
155 --
156 -- Creates/verifies the correct grants for all packages assigned
157 --   to this worker
158 --
159 
160 procedure grant_a_package
161            (owner        in varchar2,
162             name         in varchar2,
163             type         in varchar2,
164             new_owner    in varchar2,
165             authid_flag  in varchar2,
166             invoker_flag in varchar2,
167             log_to_table in varchar2);
168 
169 --
170 -- Creates/verifies the correct grants for a specific package
171 --
172 -- if log_to_table is 'TRUE', writes errors to ad_parallel_compile_errors
173 --
174 
175 procedure grant_a_java_object
176            (owner        in varchar2,
177             name         in varchar2,
178             type         in varchar2,
179             new_owner    in varchar2,
180             log_to_table in varchar2);
181 
182 
183 --
184 -- Creates/verifies the correct grants for a specific Java object
185 --
186 -- if log_to_table is 'TRUE', writes errors to ad_parallel_compile_errors
187 --
188 
189 procedure update_timestamp
190            (in_type      in varchar2,
191             in_attribute in varchar2);
192 
193 procedure update_timestamp
194            (in_type      in varchar2,
195             in_attribute in varchar2,
196             in_timestamp in date);
197 
198 --
199 -- Updates/Inserts the row in AD_TIMESTAMPS for the specified
200 --  type and attribute
201 --
202 
203 procedure verify_token_location
204            (input_string   in  varchar2,
205             input_token    in  varchar2,
206             token_found    out nocopy varchar2,
207             token_location out nocopy number);
208 
209 --
210 -- Makes sure a given token does exist as a word in the input string
211 --   A word is delimited by white space on either side
212 --   (unless at the beginning or end of the string, in which case it is
213 --    only delimited by white space on one side)
214 --
215 -- token_found returns either 'TRUE' or 'FALSE'
216 --
217 -- token_location is the index of the token in the string (if found)
218 --   It's the same value that would be returned by the INSTR function
219 --
220 -- If the given token exists in multiple places in the string as a word,
221 --   we just return the first occurrence
222 --
223 
224 procedure classify_plsql_object
225            (owner        in  varchar2,
226             name         in  varchar2,
227             type         in  varchar2,
228             has_authid   out nocopy varchar2,
229             invoker_flag out nocopy varchar2);
230 
231 --
232 -- Parses the source text for the given PL/SQL object
233 --
234 -- Sets has_authid to 'TRUE' if the object contains the AUTHID keyword
235 --   sets has_authid to 'FALSE' otherwise
236 --
237 -- Sets invoker_flag to 'I' (Invoker's Rights; AUTHID CURRENT_USER)
238 --  or 'D' (Definer's Rights; AUTHID DEFINER) if has_authid is 'TRUE'.
239 -- Sets invoker_flag to 'S' for Definer's Rights packages containing
240 --  the /*nosync*/ comment (exactly as written, and delimited by whitespace)
241 --  The /*nosync*/ comment must appear before the IS/AS keyword.
242 --
243 -- For wrapped package specs (procedures, functions), assumes definer's
244 --  rights, as we really have no way to parse them.  Not clear why anyone
245 --  would want to wrap these objects, though...
246 --
247 
248 procedure classify_plsql_array
249            (the_array    in  dbms_sql.varchar2s,
250             lb           in  number,
251             ub           in  number,
252             type         in  varchar2,
253             has_authid   out nocopy varchar2,
254             invoker_flag out nocopy varchar2);
255 
256 --
257 -- Parses the PL/SQL source text stored in the varchar2s array
258 --
259 -- Sets has_authid to 'TRUE' if the object contains the AUTHID keyword
260 --   sets has_authid to 'FALSE' otherwise
261 --
262 -- Sets invoker_flag to 'I' (Invoker's Rights; AUTHID CURRENT_USER)
263 --  or 'D' (Definer's Rights; AUTHID DEFINER) if has_authid is 'TRUE'
264 -- Sets invoker_flag to 'S' for Definer's Rights packages containing
265 --  the /*nosync*/ comment (exactly as written, and delimited by whitespace)
266 --  The /*nosync*/ comment must appear before the IS/AS keyword.
267 --
268 -- For wrapped package specs (procedures, functions), assumes definer's
269 --  rights, as we really have no way to parse them.  Not clear why anyone
270 --  would want to wrap these objects, though...
271 --
272 
273 end ad_invoker;