01: /*
02: * Copyright 2004-2006 the original author or authors.
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:
17: package org.compass.core.marshall;
18:
19: import java.util.Map;
20:
21: import org.compass.core.ResourceFactory;
22: import org.compass.core.converter.ConverterLookup;
23: import org.compass.core.engine.SearchEngine;
24: import org.compass.core.engine.naming.PropertyNamingStrategy;
25: import org.compass.core.engine.naming.PropertyPath;
26: import org.compass.core.mapping.CompassMapping;
27: import org.compass.core.spi.InternalCompassSession;
28: import org.compass.core.spi.ResourceKey;
29:
30: /**
31: * @author kimchy
32: */
33: public interface MarshallingContext {
34:
35: ResourceFactory getResourceFactory();
36:
37: SearchEngine getSearchEngine();
38:
39: CompassMapping getCompassMapping();
40:
41: ConverterLookup getConverterLookup();
42:
43: InternalCompassSession getSession();
44:
45: MarshallingStrategy getMarshallingStrategy();
46:
47: PropertyNamingStrategy getPropertyNamingStrategy();
48:
49: void setAttribute(Object key, Object value);
50:
51: Object getAttribute(Object key);
52:
53: Object removeAttribute(Object key);
54:
55: boolean hasAttribute(Object key);
56:
57: Map<Object, Object> removeAttributes();
58:
59: void restoreAttributes(Map<Object, Object> attributes);
60:
61: /**
62: * Sets an unmarshalled cache of objects already loaded during
63: * unmarshalling. Allows for handling cyclic references.
64: */
65: void setUnmarshalled(ResourceKey key, Object obj);
66:
67: /**
68: * Gets an unmarshalled cache of objects already loaded during
69: * unmarshalling. Allows for handling cyclic references.
70: */
71: Object getUnmarshalled(ResourceKey key);
72:
73: void setMarshalled(Object key, Object value);
74:
75: Object getMarshalled(Object key);
76:
77: void clearContext();
78:
79: /**
80: * Means that when creating a property, a special null value should be saved
81: * to mark it as null
82: */
83: boolean handleNulls();
84:
85: /**
86: * Sets on the path to use null values
87: */
88: void setHandleNulls(PropertyPath path);
89:
90: /**
91: * Removes the fact that a null value should be used.
92: */
93: void removeHandleNulls(PropertyPath path);
94: }
|