KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > connector > MockWorkManager


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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  */

17
18 package org.apache.geronimo.connector;
19
20 import javax.resource.spi.work.ExecutionContext JavaDoc;
21 import javax.resource.spi.work.Work JavaDoc;
22 import javax.resource.spi.work.WorkException JavaDoc;
23 import javax.resource.spi.work.WorkListener JavaDoc;
24 import javax.resource.spi.work.WorkManager JavaDoc;
25
26 /**
27  * Dummy implementation of WorkManager interface for use in
28  * {@link BootstrapContextTest}
29  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
30  */

31 public class MockWorkManager
32         implements WorkManager JavaDoc {
33
34     private String JavaDoc id = null;
35
36     /** Creates a new instance of MockWorkManager */
37     public MockWorkManager(String JavaDoc id) {
38         this.id = id;
39     }
40
41     public void doWork(Work JavaDoc work) throws WorkException JavaDoc {
42     }
43
44     public void doWork(Work JavaDoc work,
45             long startTimeout,
46             ExecutionContext JavaDoc execContext,
47             WorkListener JavaDoc workListener)
48             throws WorkException JavaDoc {
49     }
50
51     public void scheduleWork(Work JavaDoc work) throws WorkException JavaDoc {
52     }
53
54     public void scheduleWork(Work JavaDoc work,
55             long startTimeout,
56             ExecutionContext JavaDoc execContext,
57             WorkListener JavaDoc workListener)
58             throws WorkException JavaDoc {
59     }
60
61     public long startWork(Work JavaDoc work) throws WorkException JavaDoc {
62         return -1;
63     }
64
65     public long startWork(Work JavaDoc work,
66             long startTimeout,
67             ExecutionContext JavaDoc execContext,
68             WorkListener JavaDoc workListener)
69             throws WorkException JavaDoc {
70         return -1;
71     }
72
73     public String JavaDoc getId() {
74         return id;
75     }
76
77     public boolean equals(WorkManager JavaDoc wm) {
78         if (!(wm instanceof MockWorkManager)) {
79             return false;
80         }
81
82         return ((MockWorkManager) wm).getId() != null &&
83                 ((MockWorkManager) wm).getId().equals(getId());
84     }
85
86 }
87
Popular Tags