01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting.extend;
17:
18: import javax.servlet.ServletConfig;
19: import javax.servlet.http.HttpServletRequest;
20:
21: import org.directwebremoting.dwrp.PollHandler;
22:
23: /**
24: * We need to keep container specific logic out of {@link PollHandler}, and
25: * other parts of DWR. Each container will need an implementation of this
26: * interface, which will generally just return configurations of generic classes.
27: * @author Joe Walker [joe at getahead dot ltd dot uk]
28: */
29: public interface ContainerAbstraction {
30: /**
31: * We ask ContainerAbstractions to identify if the environment given is
32: * 'theirs'. Are they fit for this environment?
33: * @param servletConfig Access to {@link javax.servlet.ServletContext} etc.
34: * @return true if this implementation should be used
35: */
36: boolean isNativeEnvironment(ServletConfig servletConfig);
37:
38: /**
39: * Create a sleeper that is appropriate for the given servlet container
40: * @param request The Sleeper will probably need to know about the request
41: * @return A method of sending threads to sleep.
42: */
43: Sleeper createSleeper(HttpServletRequest request);
44:
45: /**
46: * The setup process allows the ContainerAbstraction to select a special
47: * ServerLoadMonitor implementation
48: * @return The ServerLoadMonitor implementation to go with this container
49: */
50: Class<? extends ServerLoadMonitor> getServerLoadMonitorImplementation();
51: }
|