01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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.lenya.transaction;
19:
20: /**
21: * Identity map.
22: *
23: * @version $Id: IdentityMap.java 473861 2006-11-12 03:51:14Z gregor $
24: */
25: public interface IdentityMap {
26:
27: /**
28: * Retrieve an instance from the map. If no instance exists
29: * for the given key, the factory is used to build one.
30: * @param factory The factory that produces the identifable.
31: * @param key The key for the identifiable.
32: * @return An identifiable.
33: */
34: Object get(IdentifiableFactory factory, String key);
35:
36: /**
37: * Returns the unit of work. This maybe <code>null</code> if the identity map is not involved
38: * in a transaction.
39: * @return The unit of work.
40: */
41: UnitOfWork getUnitOfWork();
42:
43: /**
44: * @param unit The unit of work to use.
45: */
46: void setUnitOfWork(UnitOfWork unit);
47:
48: /**
49: * @return All objects in this map.
50: */
51: Object[] getObjects();
52:
53: }
|