001//
002// NAME
003//      TimerNotifier.java
004//
005// COPYRIGHT
006//      Confidential Property of Kabira Technologies, Inc.
007//      Copyright 2007, 2009 by Kabira Technologies, Inc.
008//      All rights reserved.
009//
010// DESCRIPTION
011//
012// HISTORY
013//     $Revision: 1.1.2.83 $ $Date: 2012/04/03 00:11:05 $
014//
015// WARNINGS
016//      THIS FILE IS GENERATED, DO NOT EDIT
017//
018
019package com.kabira.platform.swtimer;
020
021import java.util.*;
022import com.kabira.platform.annotation.*;
023
024
025/**
026<p>
027       Timer Notifier
028<p>
029       The TimerNotifier provides timer control and a
030                user provided notification operation,
031                timerNotify().
032<p>
033                Multiple timers may be started against a
034                single instance of a TimerNotifier.
035<p>
036                The life cycle of the notifier is controlled
037                by the user.  If a timer fires on a notifier
038                that has been deleted by the user, 
039                the timer will be automatically canceled.
040
041
042*/
043
044@Managed
045public class TimerNotifier
046{
047        private static final String _RuntimeType = "swtimer::TimerNotifier";
048
049/**
050Create a new TimerNotifier
051
052*/
053        public TimerNotifier()
054        {
055                super();
056        }
057
058
059        /**
060        <p>
061       Start a timer that fires once
062@param seconds        The number of seconds before
063                        this timer should fire.
064
065@param object        Object handle to be passed
066                        to the timer notifier
067                        when the timer fires.
068
069@return                TimerId        ID for this timer.
070<p>
071       Starts a timer that will fire once,
072                at least "seconds" seconds from now.
073                The TimerId result and the object
074                parameter will be passed to
075                the timerNotify operation when the
076                timer fires.
077
078
079        */
080
081        public final native String startOneShot(
082                        final int seconds,
083                        final java.lang.Object object);
084
085
086        /**
087        <p>
088       Start a timer that fires multiple times
089@param seconds        The number of seconds before
090                        this timer should fire.
091
092@param object        Object handle to be passed
093                        to the timer notifier
094                        when the timer fires.
095
096@return                TimerId        ID for this timer.
097<p>
098       Starts a timer that will fire every
099                "seconds" seconds, starting
100                "seconds" seconds from now.
101                The TimerId result and the object
102                parameter will be passed to
103                the timerNotify operation when the
104                timer fires.
105
106
107        */
108
109        public final native String startRecurring(
110                        final int seconds,
111                        final java.lang.Object object);
112
113
114        /**
115        <p>
116       Reset the timer expiration time
117@param timerId        The ID of the timer to reset
118@param seconds        The number of seconds to
119                        rest the timer to.
120
121@return                Result
122<p>
123       Resets the expiration time on an
124                existing timer to "seconds" seconds
125                from now.
126<p>
127                Ok is returned if the timer was found
128                and reset.  Otherwise Fail is
129                returned.
130
131
132        */
133
134        public final native com.kabira.platform.swtimer.Result reset(
135                        final String timerId,
136                        final int seconds);
137
138
139        /**
140        <p>
141       Start a timer that fires once
142@param milliseconds                 The number of milliseconds before
143                this timer should fire.
144
145@param object        Object handle to be passed
146                        to the timer notifier
147                        when the timer fires.
148
149@return                TimerId        ID for this timer.
150@throws com.kabira.platform.DataError                 A DataError exception will
151                be thrown if the milliseconds
152                parameter is finer than the
153                configured timer resolution.
154
155<p>
156       Starts a timer that will fire once,
157                at least "milliseconds" milliseconds
158                from now.
159                The TimerId result and the object
160                parameter will be passed to
161                the timerNotify operation when the
162                timer fires.
163
164<p>
165<b>Warnings: </b>       The timer resolution is dependent
166                upon the current setting of the
167                timerResolutionMilliseconds
168
169
170        */
171
172        public final native String highResolutionStartOneShot(
173                        final int milliseconds,
174                        final java.lang.Object object);
175
176
177        /**
178        <p>
179       Start a timer that fires multiple times
180@param milliseconds                         The number of milliseconds
181                        before this timer should fire.
182
183@param object        Object handle to be passed
184                        to the timer notifier
185                        when the timer fires.
186
187@return                TimerId        ID for this timer.
188@throws com.kabira.platform.DataError                 A DataError exception will
189                be thrown if the milliseconds
190                parameter is finer than the
191                configured timer resolution.
192
193<p>
194       Starts a timer that will fire every
195                "milliseconds" milliseconds, starting
196                "milliseconds" milliseconds from now.
197                The TimerId result and the object
198                parameter will be passed to
199                the timerNotify operation when the
200                timer fires.
201
202<p>
203<b>Warnings: </b>       The timer resolution is dependent
204                upon the current setting of the
205                timerResolutionMilliseconds
206                configuration value.
207
208
209        */
210
211        public final native String highResolutionStartRecurring(
212                        final int milliseconds,
213                        final java.lang.Object object);
214
215
216        /**
217        <p>
218       Reset the timer expiration time
219@param timerId        The ID of the timer to reset
220@param milliseconds                         The number of milliseconds to
221                        reset the timer to.
222
223@return                Result
224@throws com.kabira.platform.DataError                 A DataError exception will
225                be thrown if the milliseconds
226                parameter is finer than the
227                configured timer resolution.
228
229<p>
230       Resets the expiration time on an
231                existing timer to "seconds" seconds
232                from now.
233<p>
234                Ok is returned if the timer was found
235                and reset.  Otherwise Fail is
236                returned.
237
238<p>
239<b>Warnings: </b>       The timer resolution is dependent
240                upon the current setting of the
241                timerResolutionMilliseconds
242
243
244        */
245
246        public final native com.kabira.platform.swtimer.Result highResolutionReset(
247                        final String timerId,
248                        final int milliseconds);
249
250
251        /**
252        <p>
253       Cancel the timer
254@param timerId        ID of the timer to cancel.
255<p>
256       Cancels an existing timer.
257<p>
258                This operation returns void
259                because there are inherent race
260                conditions when canceling timers
261                in multi-threaded systems.
262                It is possible for one
263                (or even more in very busy systems)
264                timer notifications to arrive after
265                the cancel has completed.
266<p>
267                The application calling cancel (on
268                one thread/CPU) may be occurring
269                simultaneously with the timer service
270                thread (on another thread/CPU)
271                executing the timer notification.
272                Another possibility is that the
273                timer service has queued one or
274                more notifications that haven't yet
275                been serviced due to CPU starvation.
276
277
278        */
279
280        public final native void cancel(
281                        final String timerId);
282
283
284        /**
285        <p>
286       Called when a timer fires
287@param object        The object handle that was
288                        passed to the timer start
289                        operation.
290
291@param timerId        The ID that was returned from
292                        the timer start operation.
293
294<p>
295       This operation must be implemented
296                by in the callers interface, derived
297                from swtimer::TimerNotifier.
298<p>
299                It is invoked by the timer service
300                when a timer fires.
301
302
303        */
304
305        public native void timerNotify(
306                        final String timerId,
307                        final java.lang.Object object);
308
309
310        /**
311        <p>
312       Called when a timer fires
313@param object        The object handle that was
314                        passed to the timer start
315                        operation.
316
317@param timerId        The ID that was returned from
318                        the timer start operation.
319
320<p>
321       This operation must be implemented
322                by in the callers interface, derived
323                from swtimer::TimerNotifier.
324<p>
325                It is invoked by the timer service
326                when a timer fires.
327
328
329        */
330
331        private native void timerNotify_super(
332                        final String timerId,
333                        final java.lang.Object object);
334
335}