01: // Copyright 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.services;
16:
17: /**
18: * Used by {@link ApplicationStateManager} to manage a specific kind of ASO persistence. The stategy
19: * is responsible for managing ASO instances within its domain.
20: */
21: public interface ApplicationStatePersistenceStrategy {
22: /**
23: * Gets the ASO from the domain. If the ASO does not already exist, it is created and stored,
24: * then returned.
25: */
26: <T> T get(Class<T> asoClass, ApplicationStateCreator<T> creator);
27:
28: /**
29: * Stores a new ASO, possibly replacing the existing one.
30: *
31: * @param <T>
32: * @param asoClass
33: * @param aso
34: * instance to store, or null to delete existing
35: */
36: <T> void set(Class<T> asoClass, T aso);
37:
38: /** Returns true if the ASO already exists, false if null. */
39: <T> boolean exists(Class<T> asoClass);
40: }
|