01: /*
02: * This file is part of "SnipSnap Radeox Rendering Engine".
03: *
04: * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
05: * All Rights Reserved.
06: *
07: * Please visit http://radeox.org/ for updates and contact.
08: *
09: * --LICENSE NOTICE--
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: * --LICENSE NOTICE--
22: */
23:
24: package org.radeox.engine.context;
25:
26: import java.util.HashMap;
27: import java.util.Map;
28:
29: import org.radeox.api.engine.RenderEngine;
30: import org.radeox.api.engine.context.RenderContext;
31:
32: /**
33: * Base impementation for RenderContext
34: *
35: * @author Stephan J. Schmidt
36: * @version $Id: BaseRenderContext.java 7707 2006-04-12 17:30:19Z
37: * ian@caret.cam.ac.uk $
38: */
39:
40: public class BaseRenderContext implements RenderContext {
41: private boolean cacheable = true;
42:
43: private boolean tempCacheable = false;;
44:
45: private RenderEngine engine;
46:
47: private Map params;
48:
49: private Map values;
50:
51: public BaseRenderContext() {
52: values = new HashMap();
53: }
54:
55: public Object get(String key) {
56: return values.get(key);
57: }
58:
59: public void set(String key, Object value) {
60: values.put(key, value);
61: }
62:
63: public Map getParameters() {
64: return params;
65: }
66:
67: public void setParameters(Map parameters) {
68: this .params = parameters;
69: }
70:
71: public RenderEngine getRenderEngine() {
72: return engine;
73: }
74:
75: public void setRenderEngine(RenderEngine engine) {
76: this .engine = engine;
77: }
78:
79: public void setCacheable(boolean cacheable) {
80: tempCacheable = cacheable;
81: }
82:
83: public void commitCache() {
84: cacheable = cacheable && tempCacheable;
85: tempCacheable = false;
86: }
87:
88: public boolean isCacheable() {
89: return cacheable;
90: }
91: }
|