DBA Data[Home] [Help]

PACKAGE: APPS.FND_OAM_DSCRAM_UNITS_PKG

Source


1 PACKAGE FND_OAM_DSCRAM_UNITS_PKG as
2 /* $Header: AFOAMDSUNITS.pls 120.3 2005/11/01 17:14 ilawler noship $ */
3 
4    -------------
5    -- Constants
6    -------------
7 
8    ----------------
9    -- Public Types
10    ----------------
11 
12    --define types for the work list used by the INTERNAL_EXECUTE_WORK_LIST
13    --method, allows creation of a sorted work queue.
14    TYPE work_item_type IS RECORD
15       (
16        priority         NUMBER          := NULL,
17        weight           NUMBER          := NULL,
18        item_type        VARCHAR2(30)    := NULL,
19        item_id          NUMBER          := NULL,
20        item_msg         VARCHAR2(2048)  := NULL
21        );
22 
23    -- the work queue is a single flat list of work items ordered by unit priority ascending (NULLs at end)
24    -- then work item priority ascending and finally weight descending (NULLs at start).  This is flattened
25    --from a 2D or 3D array to optimize for traversal over insert since concurrent units are less common.
26    TYPE ordered_work_queue_type IS TABLE OF work_item_type;
27 
28    ---------------------------------
29    -- Public Procedures/Functions --
30    ---------------------------------
31 
32    -- Accessor function to obtain parts of the unit state
33    -- Invariants:
34    --   State must have been initialized by a prior call to execute_unit in the session.
35    -- Parameters:
36    --   None
37    -- Returns:
38    --   The numerical ID of the unit to which this session is assigned.
39    -- Exceptions:
40    --   If a prior call to execute_unit wasn't executed, a NO_DATA_FOUND exception is thrown.
41    FUNCTION GET_UNIT_ID
42       RETURN NUMBER;
43 
44    -- Accessor function to obtain parts of the bundle state
45    -- Invariants:
46    --   State must have been initialized by a prior call to execute_bundle in the session.
47    -- Parameters:
48    --   None
49    -- Returns:
50    --   The number of concurrent workers allowed for this unit.
51    -- Exceptions:
52    --   If a prior call to execute_bundle wasn't executed, a NO_DATA_FOUND exception is thrown.
53    FUNCTION GET_WORKERS_ALLOWED
54       RETURN NUMBER;
55 
56    -- Accessor function to obtain parts of the unit state
57    -- Invariants:
58    --   State must have been initialized by a prior call to execute_unit in the session.
59    -- Parameters:
60    --   None
61    -- Returns:
62    --   The execution batch size.
63    -- Exceptions:
64    --   If a prior call to execute_unit wasn't executed, a NO_DATA_FOUND exception is thrown.
65    FUNCTION GET_BATCH_SIZE
66       RETURN NUMBER;
67 
68    -- Accessor function to obtain parts of the unit state
69    -- Invariants:
70    --   State must have been initialized by a prior call to execute_unit in the session.
71    -- Parameters:
72    --   None
73    -- Returns:
74    --   The object_owner associated with the currently executing unit.
75    -- Exceptions:
76    --   If a prior call to execute_unit wasn't executed, a NO_DATA_FOUND exception is thrown.
77    FUNCTION GET_UNIT_OBJECT_OWNER
78       RETURN VARCHAR2;
79 
80    -- Accessor function to obtain parts of the unit state
81    -- Invariants:
82    --   State must have been initialized by a prior call to execute_unit in the session.
83    -- Parameters:
84    --   None
85    -- Returns:
86    --   The object_name associated with the currently executing unit.
87    -- Exceptions:
88    --   If a prior call to execute_unit wasn't executed, a NO_DATA_FOUND exception is thrown.
89    FUNCTION GET_UNIT_OBJECT_NAME
90       RETURN VARCHAR2;
91 
92    --"Constructor" for new work_item_type objects
93    FUNCTION CREATE_WORK_ITEM(p_priority         IN NUMBER,
94                              p_weight           IN NUMBER,
95                              p_item_type        IN VARCHAR2,
96                              p_item_id          IN NUMBER)
97       RETURN work_item_type;
98 
99    -- This API is used to get the next available unit for the supplied task_id.
100    -- Instead of blindly returning the next row in the dscram_units table, we need
101    -- to take phase into consideration on re-query to keep from violating dependencies.
102    -- Invariants:
103    --   None, unit execution will fail if the task hasn't been initialized.
104    -- Parameters:
105    --   p_requery:        Boolean indicating whether the unit SELECT statement should be re-executed
106    --                     or the API should fetch the next row from the last query.
107    --   x_unit_id:        DSCRAM_UNITS.UNIT_ID of unit found
108    --   x_return_status:  FND_API-like return status
109    --   x_return_msg:     Message explaining non-success return statuses
110    -- Return Statuses:
111    --   G_RET_STS_EMPTY       If the fetch hits the end of the rowset
112    --   G_RET_STS_FULL        If the query could have returned a unit but all processing were busy or
113    --                         the remaining units are in a subsequent phase.
114    --   G_RET_STS_STOPPED     If a unit is found in status STOPPING/STOPPED, assume this worker should
115    --                         also be stopping(helps cover corner cases).
116    --   G_RET_STS_SUCCESS     Success
117    --   G_RET_STS_ERROR       Expected, possible error found. See return_msg.
118    --   G_RET_STS_ERROR_UNEXP Unexpected Error found.  See return_msg.
119    PROCEDURE FETCH_NEXT_UNIT(p_requery          IN              BOOLEAN,
120                              x_unit_id          OUT NOCOPY      NUMBER,
121                              x_return_status    OUT NOCOPY      VARCHAR2,
122                              x_return_msg       OUT NOCOPY      VARCHAR2);
123 
124    -- Static API used to validate a unit, consumed by the internal_execute as a continue check.  Only
125    -- considers state of parent unit, child unit statuses are not populated so we don't check them.
126    -- Invariants:
127    --   Internal Assign should have already occured to set up the unit state.
128    -- Parameters:
129    --   p_force_query     Force a query of the entities, typically done after we've seen an error.
130    --   p_recurse         Whether to check parent entities (task, bundle, run)
131    --   x_return_status:  FND_API-like return status
132    --   x_return_msg:     Message explaining non-success return statuses
133    FUNCTION VALIDATE_CONTINUED_EXECUTION(p_force_query          IN BOOLEAN,
134                                          p_recurse              IN BOOLEAN,
135                                          x_return_status        OUT NOCOPY VARCHAR2,
136                                          x_return_msg           OUT NOCOPY VARCHAR2)
137       RETURN BOOLEAN;
138 
139    -- This API is used after a call to fetch_next_unit to execute a unit_id.
140    -- Invariants:
141    --   None
142    -- Parameters:
143    --   p_unit_id:        DSCRAM_UNITS.UNIT_ID of unit found
144    --   x_return_status:  FND_API-like return status
145    --   x_return_msg:     Message explaining non-success return statuses
146    -- Return Statuses:
147    --   G_RET_STS_FULL        Occurs when a unit fetch had worker spots open but by the time we did
148    --                         an assign there were none left, covers contention.
149    --   G_RET_STS_STOPPED     If a unit's execution detects a STOPPING/STOPPED state, push it up the
150    --                         execution stack.
151    --   G_RET_STS_SUCCESS     Success
152    --   G_RET_STS_ERROR       Expected, possible error found. See return_msg.
153    --   G_RET_STS_ERROR_UNEXP Unexpected Error found.  See return_msg.
154    PROCEDURE EXECUTE_UNIT(p_unit_id             IN NUMBER,
155                           x_return_status       OUT NOCOPY VARCHAR2,
156                           x_return_msg          OUT NOCOPY VARCHAR2);
157 
158 END FND_OAM_DSCRAM_UNITS_PKG;