001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: package com.sun.midp.main;
028:
029: /**
030: * This interface is to be implemnted by an event processing target
031: * for MIDlet events on MIDlet controller (i.e. AMS) side.
032: *
033: * EventListener for these events must find appropriate
034: * instance of this I/F implementor and call its methods.
035: *
036: * TBD: although Consumer I/F is intended to be instance specific,
037: * the implementor of this one shall be assosiated with a MIDletProxyList,
038: * which is a single static object that exists only in AMS isolate ...
039: *
040: * However, I/F implementor shall NOT assume
041: * that it is a static singleton object ...
042: *
043: * TBD: method and parameter lists of the I/F is preliminary
044: * and is a subject for changes.
045: *
046: * TBD: it makes sence replace some handlerXXXEvent method parameters
047: * (isolateId, displayId) by MIdletProxy object that is able to provide
048: * all needed information to process event.
049: *
050: */
051: public interface MIDletControllerEventConsumer {
052:
053: /*
054: * MIDlet Startup Events:
055: *
056: * MIDLET_START_ERROR
057: * MIDLET_CREATED_NOTIFICATION
058: */
059: /**
060: * Processes MIDLET_START_ERROR event
061: *
062: * @param midletSuiteId ID of the MIDlet suite
063: * @param midletClassName Class name of the MIDlet
064: * @param midletExternalAppId ID of given by an external application
065: * manager
066: * @param errorCode start error code
067: * @param errorDetails start error details
068: */
069: public void handleMIDletStartErrorEvent(int midletSuiteId,
070: String midletClassName, int midletExternalAppId,
071: int errorCode, String errorDetails);
072:
073: /**
074: * Processes MIDLET_CREATED_NOTIFICATION event,
075: * parameters - to create MIDletProxy object instance
076: *
077: * @param midletSuiteId ID of the MIDlet suite
078: * @param midletClassName Class name of the MIDlet
079: * @param midletIsolateId isolate ID of the sending MIDlet
080: * @param midletExternalAppId ID of given by an external application
081: * manager
082: * @param midletDisplayName name to show the user
083: */
084: public void handleMIDletCreateNotifyEvent(int midletSuiteId,
085: String midletClassName, int midletIsolateId,
086: int midletExternalAppId, String midletDisplayName);
087:
088: /*
089: * MIDlet State Management (Lifecycle) Events:
090: *
091: * MIDLET_ACTIVE_NOTIFICATION
092: * MIDLET_PAUSE_NOTIFICATION
093: * MIDLET_DESTROY_NOTIFICATION
094: *
095: * MIDLET_DESTROY_REQUEST
096: *
097: * ACTIVATE_ALL - produced by native code
098: * PAUSE_ALL -produced by native code
099: * SHUTDOWN/DESTROY_ALL - produced by native code
100: *
101: * FATAL_ERROR_NOTIFICATION - produced by native code
102: *
103: */
104: /**
105: * Processes MIDLET_ACTIVE_NOTIFICATION event
106: *
107: * TBD: param midletProxy proxy with information about MIDlet
108: *
109: * @param midletSuiteId ID of the MIDlet suite
110: * @param midletClassName Class name of the MIDlet
111: */
112: public void handleMIDletActiveNotifyEvent(
113: // MIDletProxy midletProxy);
114: int midletSuiteId, String midletClassName);
115:
116: /**
117: * Processes MIDLET_PAUSED_NOTIFICATION event
118: *
119: * TBD: param midletProxy proxy with information about MIDlet
120: *
121: * @param midletSuiteId ID of the MIDlet suite
122: * @param midletClassName Class name of the MIDlet
123: */
124: public void handleMIDletPauseNotifyEvent(
125: // MIDletProxy midletProxy);
126: int midletSuiteId, String midletClassName);
127:
128: /**
129: * Processes MIDLET_DESTROYED_NOTIFICATION event
130: *
131: * TBD: param midletProxy proxy with information about MIDlet
132: *
133: * @param midletSuiteId ID of the MIDlet suite
134: * @param midletClassName Class name of the MIDlet
135: */
136: public void handleMIDletDestroyNotifyEvent(
137: // MIDletProxy midletProxy);
138: int midletSuiteId, String midletClassName);
139:
140: /**
141: * Processes a MIDLET_RESUME_REQUEST event.
142: *
143: * TBD: param midletProxy proxy with information about MIDlet
144: *
145: * @param midletSuiteId ID of the MIDlet suite
146: * @param midletClassName Class name of the MIDlet
147: */
148: public void handleMIDletResumeRequestEvent(
149: // MIDletProxy midletProxy);
150: int midletSuiteId, String midletClassName);
151:
152: /**
153: * Processes MIDLET_RS_PAUSED_NOTIFICATION event
154: *
155: * TBD: param midletProxy proxy with information about MIDlet
156: *
157: * @param midletSuiteId ID of the MIDlet suite
158: * @param midletClassName Class name of the MIDlet
159: */
160: public void handleMIDletRsPauseNotifyEvent(int midletSuiteId,
161: String midletClassName);
162:
163: /**
164: * Processes MIDLET_DESTROY_REQUEST event
165: *
166: * TBD: param midletProxy proxy with information about MIDlet
167: *
168: * @param midletIsolateId isolate ID of the sending Display
169: * @param midletDisplayId ID of the sending Display
170: */
171: public void handleMIDletDestroyRequestEvent(
172: // MIDletProxy midletProxy);
173: int midletIsolateId, int midletDisplayId);
174:
175: /**
176: * Processes ACTIVATE_ALL_EVENT
177: */
178: public void handleActivateAllEvent();
179:
180: /**
181: * Processes PAUSE_ALL_EVENT
182: */
183: public void handlePauseAllEvent();
184:
185: /**
186: * Processes SHUTDOWN_ALL_EVENT
187: */
188: public void handleDestroyAllEvent();
189:
190: /**
191: * Processes FATAL_ERROR_NOTIFICATION event
192: *
193: * @param midletIsolateId isolate ID of the sending isolate
194: * @param midletDisplayId ID of the sending Display
195: */
196: public void handleFatalErrorNotifyEvent(int midletIsolateId,
197: int midletDisplayId);
198:
199: /*
200: * Foreground MIDlet Management Events:
201: *
202: * SELECT_FOREGROUND - produced by native code
203: * FOREGROUND_TRANSFER
204: * SET_FOREGROUND_BY_NAME_REQUEST
205: *
206: */
207: /**
208: * Processes SELECT_FOREGROUND event
209: */
210: public void handleMIDletForegroundSelectEvent(int onlyFromLaunched);
211:
212: /**
213: * Processes FOREGROUND_TRANSFER event
214: *
215: * @param originMIDletSuiteId ID of MIDlet from which
216: * to take forefround ownership away,
217: * @param originMIDletClassName Name of MIDlet from which
218: * to take forefround ownership away
219: * @param targetMIDletSuiteId ID of MIDlet
220: * to give forefround ownership to,
221: * @param targetMIDletClassName Name of MIDlet
222: * to give forefround ownership to
223: */
224: public void handleMIDletForegroundTransferEvent(
225: int originMIDletSuiteId, String originMIDletClassName,
226: int targetMIDletSuiteId, String targetMIDletClassName);
227:
228: /**
229: * Processes SET_FOREGROUND_BY_NAME_REQUEST
230: *
231: * @param suiteId MIDlet's suite ID
232: * @param className MIDlet's class name
233: */
234: public void handleSetForegroundByNameRequestEvent(int suiteId,
235: String className);
236:
237: /*
238: * Foreground Display Management Events:
239: *
240: * FOREGROUND_REQUEST
241: * BACKGROUND_REQUEST
242: *
243: */
244: /**
245: * Processes DISPLAY_CREATED_NOTIFICATION event,
246: * parameters - set the display id of a MIDletProxy object instance
247: *
248: * @param midletIsolateId isolate ID of the sending Display
249: * @param midletDisplayId ID of the sending Display
250: * @param midletClassName Class name of the MIDlet
251: */
252: public void handleDisplayCreateNotifyEvent(int midletIsolateId,
253: int midletDisplayId, String midletClassName);
254:
255: /**
256: * Processes FOREGROUND_REQUEST event
257: *
258: * TBD: param midletProxy proxy with information about MIDlet
259: *
260: * @param midletIsolateId isolate ID of the sending Display
261: * @param midletDisplayId ID of the sending Display
262: * @param isAlert true if the current displayable is an Alert
263: */
264: public void handleDisplayForegroundRequestEvent(
265: // MIDletProxy midletProxy);
266: int midletIsolateId, int midletDisplayId, boolean isAlert);
267:
268: /**
269: * Processes BACKGROUND_REQUEST event
270: *
271: * TBD: param midletProxy proxy with information about MIDlet
272: *
273: * @param midletIsolateId isolate ID of the sending Display
274: * @param midletDisplayId ID of the sending Display
275: */
276: public void handleDisplayBackgroundRequestEvent(
277: // MIDletProxy midletProxy);
278: int midletIsolateId, int midletDisplayId);
279:
280: /*
281: * Display Preemption Management Events:
282: *
283: * PREEMPT
284: *
285: */
286: /**
287: * Processes PREEMPT_EVENT(true),
288: * parameters - to create MIDletProxy object instance
289: *
290: * @param midletIsolateId isolate ID of the sending Display
291: * @param midletDisplayId ID of the sending Display
292: */
293: public void handleDisplayPreemptStartEvent(int midletIsolateId,
294: int midletDisplayId);
295:
296: /**
297: * Processes PREEMPT_EVENT(false),
298: *
299: * @param midletIsolateId isolate ID of the sending Display
300: * @param midletDisplayId ID of the sending Display
301: */
302: public void handleDisplayPreemptStopEvent(int midletIsolateId,
303: int midletDisplayId);
304: }
|