001: /*
002: * $Id: AbstractCompoundRequestCycleProcessor.java,v 1.2 2005/11/25 22:03:33
003: * eelco12 Exp $ $Revision: 458319 $ $Date: 2005-12-19 12:44:19 +0100 (Mon, 19 Dec 2005) $
004: *
005: * ==============================================================================
006: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
007: * use this file except in compliance with the License. You may obtain a copy of
008: * the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015: * License for the specific language governing permissions and limitations under
016: * the License.
017: */
018: package wicket.request.compound;
019:
020: import wicket.IRequestTarget;
021: import wicket.RequestCycle;
022: import wicket.request.IRequestCycleProcessor;
023: import wicket.request.RequestParameters;
024:
025: /**
026: * A request cycle processor implementatation that delegates to pluggable
027: * strategies. This processor is abstract so that it can easily be used as a
028: * factory if wanted.
029: *
030: * @author Eelco Hillenius
031: */
032: public abstract class AbstractCompoundRequestCycleProcessor implements
033: IRequestCycleProcessor {
034: /**
035: * Construct.
036: */
037: public AbstractCompoundRequestCycleProcessor() {
038: }
039:
040: /**
041: * @see wicket.request.IRequestCycleProcessor#resolve(wicket.RequestCycle,
042: * RequestParameters)
043: */
044: public IRequestTarget resolve(RequestCycle requestCycle,
045: RequestParameters requestParameters) {
046: IRequestTargetResolverStrategy strategy = getRequestTargetResolverStrategy();
047: return strategy.resolve(requestCycle, requestParameters);
048: }
049:
050: /**
051: * @see wicket.request.IRequestCycleProcessor#processEvents(wicket.RequestCycle)
052: */
053: public void processEvents(RequestCycle requestCycle) {
054: IEventProcessorStrategy strategy = getEventProcessorStrategy();
055: strategy.processEvents(requestCycle);
056: }
057:
058: /**
059: * @see wicket.request.IRequestCycleProcessor#respond(wicket.RequestCycle)
060: */
061: public void respond(RequestCycle requestCycle) {
062: IResponseStrategy strategy = getResponseStrategy();
063: strategy.respond(requestCycle);
064: }
065:
066: /**
067: * @see wicket.request.IRequestCycleProcessor#respond(java.lang.RuntimeException,
068: * wicket.RequestCycle)
069: */
070: public void respond(RuntimeException e, RequestCycle requestCycle) {
071: IExceptionResponseStrategy strategy = getExceptionResponseStrategy();
072: strategy.respond(requestCycle, e);
073: }
074:
075: /**
076: * Gets the strategy for the resolve method.
077: *
078: * @return the strategy for the resolve method
079: */
080: protected abstract IRequestTargetResolverStrategy getRequestTargetResolverStrategy();
081:
082: /**
083: * Gets the strategy for the event process method.
084: *
085: * @return the strategy for the event process method
086: */
087: protected abstract IEventProcessorStrategy getEventProcessorStrategy();
088:
089: /**
090: * Gets the strategy for the response method.
091: *
092: * @return the strategy for the response method
093: */
094: protected abstract IResponseStrategy getResponseStrategy();
095:
096: /**
097: * Gets the strategy for the exception response method.
098: *
099: * @return the strategy for the exception response method
100: */
101: protected abstract IExceptionResponseStrategy getExceptionResponseStrategy();
102: }
|