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 java.io.Serializable;
19: import java.util.Collection;
20: import java.util.Date;
21:
22: import javax.ejb.Timer;
23:
24: import org.apache.openejb.OpenEJBException;
25:
26: /**
27: * Idempotent EjbTimerServiceImplementation. Used if a Bean does not implement a timeout method.
28: * This differs from OpenEJB 2.x behavior, which did not create a TimerService for a bean which did not have a timeout method.
29: * There's nothing in the spec which says a timeout-less bean cannot call getTimerService. So, we now have NullEjbTimerServiceImpl, which does not do very much...
30: */
31: public class NullEjbTimerServiceImpl implements EjbTimerService {
32:
33: public NullEjbTimerServiceImpl() {
34: }
35:
36: public Timer createTimer(Object primaryKey, Date initialExpiration,
37: long intervalDuration, Serializable info) {
38: throw new IllegalStateException(
39: "TimerService operation not supported for a bean without an ejbTimeout method");
40: }
41:
42: public Timer createTimer(Object primaryKey, Date expiration,
43: Serializable info) {
44: throw new IllegalStateException(
45: "TimerService operation not supported for a bean without an ejbTimeout method");
46: }
47:
48: public Timer createTimer(Object primaryKey, long initialDuration,
49: long intervalDuration, Serializable info) {
50: throw new IllegalStateException(
51: "TimerService operation not supported for a bean without an ejbTimeout method");
52: }
53:
54: public Timer createTimer(Object primaryKey, long duration,
55: Serializable info) {
56: throw new IllegalStateException(
57: "TimerService operation not supported for a bean without an ejbTimeout method");
58: }
59:
60: public Timer getTimer(long id) {
61: throw new IllegalStateException(
62: "TimerService operation not supported for a bean without an ejbTimeout method");
63: }
64:
65: public Collection<Timer> getTimers(Object primaryKey) {
66: throw new IllegalStateException(
67: "TimerService operation not supported for a bean without an ejbTimeout method");
68: }
69:
70: public void start() throws OpenEJBException {
71: }
72:
73: public void stop() {
74: }
75:
76: }
|