01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.common.entity;
09:
10: //base classes
11: import java.io.ByteArrayInputStream;
12: import java.io.ByteArrayOutputStream;
13: import java.io.IOException;
14: import java.io.InputStream;
15: import java.io.OutputStreamWriter;
16: import org.w3c.dom.Node;
17:
18: //project specific classes
19: import org.jfolder.common.UnexpectedSystemException;
20: import org.jfolder.common.tagging.ConceptTagCharacteristic;
21: import org.jfolder.common.tagging.ConceptTagHelper;
22: import org.jfolder.common.tagging.ConceptTagPreferences;
23: import org.jfolder.common.tagging.RootConceptTagHolder;
24:
25: //other classes
26:
27: public final class SystemEntityTagHelper extends ConceptTagHelper {
28:
29: private SystemEntityTagHelper() {
30: }
31:
32: public static RootConceptTagHolder getRootHolder(InputStream inIs) {
33: return ConceptTagHelper.getRootHolder(inIs,
34: new SystemEntityTagPreferences());
35: }
36:
37: public static RootConceptTagHolder getRootHolder(Node inNode) {
38: return ConceptTagHelper.getRootHolder(inNode,
39: new SystemEntityTagPreferences());
40: }
41:
42: public static RootConceptTagHolder getRootHolder(String inContent) {
43:
44: try {
45: RootConceptTagHolder outValue = null;
46:
47: ByteArrayOutputStream baos = new ByteArrayOutputStream();
48: OutputStreamWriter osw = new OutputStreamWriter(baos);
49:
50: osw.write(inContent, 0, inContent.length());
51: osw.flush();
52: baos.flush();
53:
54: byte content[] = baos.toByteArray();
55:
56: osw.close();
57: baos.close();
58:
59: ByteArrayInputStream bais = new ByteArrayInputStream(
60: content);
61: outValue = getRootHolder(bais);
62: bais.close();
63:
64: return outValue;
65: } catch (IOException ioe) {
66: throw new UnexpectedSystemException(ioe);
67: }
68: }
69:
70: public static RootConceptTagHolder getGovernorCall() {
71:
72: RootConceptTagHolder outValue = null;
73:
74: outValue = getGovernorCall(new SystemEntityTagPreferences());
75:
76: return outValue;
77: }
78:
79: protected final static RootConceptTagHolder getGovernorCall(
80: ConceptTagPreferences inCtp) {
81:
82: return getBaseRootHolder(inCtp,
83: "org.jfolder.engines.call.v1.RootV1GovernorCallTag",
84: true);
85: }
86: }
|