01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.core.timer;
17:
18: import javax.ejb.EJBException;
19: import javax.ejb.Timer;
20: import javax.ejb.TimerService;
21: import java.io.Serializable;
22: import java.util.Collection;
23: import java.util.Date;
24:
25: public class TimerServiceImpl implements TimerService {
26: private final EjbTimerService ejbTimerService;
27: private final Object primaryKey;
28:
29: public TimerServiceImpl(EjbTimerService ejbTimerService,
30: Object primaryKey) {
31: this .ejbTimerService = ejbTimerService;
32: this .primaryKey = primaryKey;
33: }
34:
35: public Timer createTimer(Date initialExpiration,
36: long intervalDuration, Serializable info)
37: throws IllegalArgumentException, IllegalStateException,
38: EJBException {
39: return ejbTimerService.createTimer(primaryKey,
40: initialExpiration, intervalDuration, info);
41: }
42:
43: public Timer createTimer(Date expiration, Serializable info)
44: throws IllegalArgumentException, IllegalStateException,
45: EJBException {
46: return ejbTimerService
47: .createTimer(primaryKey, expiration, info);
48: }
49:
50: public Timer createTimer(long initialDuration,
51: long intervalDuration, Serializable info)
52: throws IllegalArgumentException, IllegalStateException,
53: EJBException {
54: return ejbTimerService.createTimer(primaryKey, initialDuration,
55: intervalDuration, info);
56: }
57:
58: public Timer createTimer(long duration, Serializable info)
59: throws IllegalArgumentException, IllegalStateException,
60: EJBException {
61: return ejbTimerService.createTimer(primaryKey, duration, info);
62: }
63:
64: public Collection getTimers() throws IllegalStateException,
65: EJBException {
66: return ejbTimerService.getTimers(primaryKey);
67: }
68: }
|