01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: EmbeddingContext.java 3669 2007-02-26 13:51:23Z gbevin $
07: */
08: package com.uwyn.rife.engine;
09:
10: import java.io.ByteArrayInputStream;
11: import java.io.IOException;
12: import java.util.Properties;
13:
14: import com.uwyn.rife.engine.exceptions.EngineException;
15: import com.uwyn.rife.template.Template;
16:
17: class EmbeddingContext {
18: private ElementContext mEmbeddingContext = null;
19: private ElementSupport mEmbeddingElement = null;
20: private Template mTemplate = null;
21: private String mValue = null;
22: private String mDifferentiator = null;
23: private Object mData = null;
24: private boolean mCancelEmbedding = false;
25:
26: EmbeddingContext(ElementContext embeddingContext,
27: ElementSupport embeddingElement, Template template,
28: String value, String differentiator, Object data)
29: throws EngineException {
30: assert embeddingContext != null;
31: assert embeddingElement != null;
32: assert template != null;
33:
34: mEmbeddingContext = embeddingContext;
35: mEmbeddingElement = embeddingElement;
36: mTemplate = template;
37: mValue = value;
38: mDifferentiator = differentiator;
39: mData = data;
40: }
41:
42: ElementContext getElementContext() {
43: return mEmbeddingContext;
44: }
45:
46: ElementSupport getEmbeddingElement() {
47: return mEmbeddingElement;
48: }
49:
50: Template getTemplate() {
51: return mTemplate;
52: }
53:
54: String getDifferentiator() {
55: return mDifferentiator;
56: }
57:
58: String getValue() {
59: return mValue;
60: }
61:
62: Object getData() {
63: return mData;
64: }
65:
66: Properties getEmbedProperties() throws IOException {
67: if (null == mValue) {
68: return null;
69: }
70:
71: Properties properties = new Properties();
72: properties.load(new ByteArrayInputStream(mValue
73: .getBytes("ISO-8859-1")));
74:
75: return properties;
76: }
77:
78: void setCancelEmbedding(boolean cancelEmbedding) {
79: mCancelEmbedding = cancelEmbedding;
80: }
81:
82: boolean getCancelEmbedding() {
83: return mCancelEmbedding;
84: }
85: }
|