[Home] [Help]
PACKAGE BODY: APPS.IBU_CACHE
Source
1 package body IBU_CACHE as
2 /* $Header: ibuxpkgb.pls 115.10 2004/03/29 22:14:47 lahuang ship $ */
3
4 /* ------------------------------------------------------------------------- */
5 procedure timeout_entries(errbuf out NOCOPY varchar2,
6 errcode out NOCOPY number,
7 timeout in number)
8 as
9 cutofftime date;
10 begin
11 cutofftime := sysdate - timeout/1440;
12 delete from CS_KB_CACHE where timestamp is not null and
13 timestamp < cutofftime;
14 errcode := 0;
15 exception
16 when others then
17 errcode := 2;
18 errbuf := SQLERRM;
19 raise;
20 end timeout_entries;
21
22 /* ------------------------------------------------------------------------- */
23 procedure install_timeout_job(msg out NOCOPY varchar2)
24 as
25 begin
26
27 msg := '';
28
29 /* Create the executable for the job */
30
31 if fnd_program.executable_exists(
32 executable_short_name => 'IBU_TEXT_CACHE_CLEANUP_EXEC',
33 application => 'IBU')
34 then
35 msg := msg || 'Executable IBU_TEXT_CACHE_CLEANUP_EXEC already exists.';
36 else
37 fnd_program.executable(executable => 'IBU_TEXT_CACHE_CLEANUP_EXEC',
38 application => 'IBU',
39 short_name => 'IBU_TEXT_CACHE_CLEANUP_EXEC',
40 description => 'Timeout cache entries for IBU',
41 execution_method => 'PL/SQL Stored Procedure',
42 execution_file_name => 'IBU_CACHE.TIMEOUT_ENTRIES',
43 subroutine_name => null,
44 icon_name => null,
45 language_code => 'US');
46 msg := msg ||'Executable IBU_TEXT_CACHE_CLEANUP_EXEC successfully created.';
47 end if;
48
49 /* Create the program and its parameter(s) for the job */
50
51 if fnd_program.program_exists(program => 'IBU_TEXT_CACHE_CLEANUP_PROG',
52 application => 'IBU')
53 then
54 msg := msg || 'Program IBU_TEXT_CACHE_CLEANUP_PROG already exists.';
55 else
56 fnd_program.register(program => 'Timeout for the cache entries for IBU',
57 application => 'IBU',
58 enabled => 'Y',
59 short_name => 'IBU_TEXT_CACHE_CLEANUP_PROG',
60 description => 'Timeout cache entries for IBU',
61 executable_short_name =>'IBU_TEXT_CACHE_CLEANUP_EXEC',
62 executable_application => 'IBU',
63 execution_options => NULL,
64 priority => NULL,
65 save_output => 'N',
66 print => 'N',
67 cols => NULL,
68 rows => NULL,
69 style => NULL,
70 style_required => 'N',
71 printer => null,
72 request_type => null,
73 request_type_application => null,
74 use_in_srs => 'Y',
75 allow_disabled_values => 'N',
76 run_alone => 'N',
77 output_type => NULL,
78 enable_trace => 'N',
79 restart => 'Y',
80 nls_compliant => 'N',
81 icon_name => NULL,
82 language_code => 'US');
83
84 msg := msg || 'Program IBU_TEXT_CACHE_CLEANUP_PROG successfully created.';
85
86 fnd_program.parameter(program_short_name => 'IBU_TEXT_CACHE_CLEANUP_PROG',
87 application => 'IBU',
88 sequence => 1,
89 parameter => 'TIMEOUT',
90 description => 'Age of entry to expire in minutes.',
91 enabled => 'Y',
92 value_set => '30 Characters Optional',
93 default_type => 'Constant',
94 default_value => '30',
95 required => 'N',
96 enable_security => 'N',
97 range => null,
98 display => 'Y',
99 display_size => 30,
100 description_size => 50,
101 concatenated_description_size => 30,
102 prompt => 'Timeout',
103 token => NULL);
104 end if;
105
106 exception
107 when program_error then
108 /* Load the message generated by fnd_program */
109 /* so that we can print it to the log. */
110 msg := msg || fnd_program.message;
111
112 when others then
113 /* Re-raise the exception and SQL*Plus */
114 /* will print the Oracle error and exit. */
115 raise;
116
117 end install_timeout_job;
118
119 /* ------------------------------------------------------------------------- */
120 procedure uninstall_timeout_job(msg out NOCOPY varchar2)
121 as
122 begin
123
124 msg := '';
125
126 if fnd_program.program_exists(program => 'IBU_TEXT_CACHE_CLEANUP_PROG',
127 application => 'IBU')
128 then
129 fnd_program.delete_program('IBU_TEXT_CACHE_CLEANUP_PROG', 'IBU');
130 msg := msg || 'Program IBU_TEXT_CACHE_CLEANUP_PROG successfully uninstalled.';
131 else
132 msg := msg || 'Program IBU_TEXT_CACHE_CLEANUP_PROG does not exist.';
133 end if;
134
135 if fnd_program.executable_exists('IBU_TEXT_CACHE_CLEANUP_EXEC', 'IBU')
136 then
137 fnd_program.delete_executable('IBU_TEXT_CACHE_CLEANUP_EXEC', 'IBU');
138 msg := msg || 'Executable IBU_TEXT_CACHE_CLEANUP_EXEC successfully uninstalled.';
139 else
140 msg := msg || 'Executable IBU_TEXT_CACHE_CLEANUP_EXEC does not exist.';
141 end if;
142
143 end uninstall_timeout_job;
144
145
146 end IBU_CACHE;