01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.internal.services;
16:
17: import org.apache.tapestry.internal.events.UpdateListener;
18:
19: /**
20: * Manages a set of {@link org.apache.tapestry.internal.events.UpdateListener}s. Periodically (say, every
21: * request during development, or every minute or so during production), request processing is
22: * locked down so that only a single thread is active, and the active thread invokes
23: * {@link #fireUpdateEvent()}. Various services that are dependent on external resource files (such
24: * as classes or template files) can check to see if any file they've used has changed. If so, the
25: * service can invalidate its internal cache, or notify other services (typically via
26: * {@link org.apache.tapestry.internal.events.InvalidationListener} that they should do the same.
27: *
28: *
29: * @see org.apache.tapestry.internal.util.URLChangeTracker
30: */
31: public interface UpdateListenerHub {
32: void addUpdateListener(UpdateListener listener);
33:
34: /**
35: * Invoked periodically to allow services to check if underlying state has changed. For example,
36: * a template file may have changed. Listeners will typically notify applicable listeners of
37: * their own (they usually implement
38: * {@link org.apache.tapestry.internal.event.InvalidationEventHub}) when such a change occurs.
39: */
40: void fireUpdateEvent();
41: }
|