001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.console.config;
009:
010: //base classes
011: import java.util.HashMap;
012: import org.w3c.dom.Document;
013:
014: //project specific classes
015: import org.jfolder.common.UnexpectedSystemException;
016: import org.jfolder.common.tagging.BaseConceptTagPreferences;
017: import org.jfolder.common.tagging.ConceptTag;
018: import org.jfolder.common.tagging.ConceptTagCallContext;
019: import org.jfolder.common.tagging.ConceptTagMenuBranch;
020: import org.jfolder.common.tagging.ConceptTagPreferences;
021: import org.jfolder.common.tagging.ConceptTagPreferencesHelper;
022: import org.jfolder.common.tagging.ConceptTagProperties;
023: import org.jfolder.common.tagging.ConceptTagSetContext;
024: import org.jfolder.common.tagging.ConceptTagSetHolder;
025: import org.jfolder.common.tagging.DetermineClassConceptTagContext;
026: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
027: import org.jfolder.common.tagging.InitializeConceptTagContext;
028: import org.jfolder.common.tagging.RootConceptTagHolder;
029:
030: //other classes
031:
032: public class ConsoleConfigTagPreferences extends
033: BaseConceptTagPreferences {
034:
035: //private final static String CMT_BASE_NAMESPACE =
036: // "http://www.jfolder.org/dtds/apps/console/config/";
037: //
038: //private final static String CMT_NAMESPACE_V1 =
039: // CMT_BASE_NAMESPACE + "v1/";
040: //private final static String CMT_NAMESPACE_V1_BASE =
041: // CMT_NAMESPACE_V1 + "base.dtd";
042: //private final static String CMT_NAMESPACE_V1_CORE =
043: // CMT_NAMESPACE_V1 + "core.dtd";
044: //private final static String CMT_NAMESPACE_V1_RETURNABLE =
045: // CMT_NAMESPACE_V1 + "returnable.dtd";
046: //
047: //private final static String CMT_NAME_V1_TEXT = "text";
048: //private final static String CMT_NAME_V1_COMPOUND = "compound";
049: //
050: //private final static String CMT_ATTR_V1_CONSTRAINT = "constraint";
051: //
052: //private final static String CMT_HANDLE_CONJUCTION = "$";
053: //
054: //private final static String ROOT_CONSTRAINT = "root";
055: //
056: //private final static String UNCONSTRAINED_SYMBOL = "@";
057:
058: //
059: private ConceptTagSetHolder ctsh = null;
060: //
061: private boolean validateOnlyMode = false;
062:
063: //
064: private RootConceptTagHolder rcth = null;
065:
066: //protected ConsoleConfigTagPreferences(ConceptTagSetContext inCtsc) {
067: public ConsoleConfigTagPreferences() {
068: //
069: this .ctsh = new ConceptTagSetHolder(getPreferencesHandle());
070: ConceptTagProperties ctProps = ConceptTagProperties
071: .newInstance(new String[0]);
072: this .ctsh
073: .registerConceptTag(
074: ConceptTagPreferencesHelper.CTP_PREF_NS__CONSOLE_CONFIG__V1_BASE,
075: ConceptTagPreferencesHelper.CTP_PREF_ROOT_LOCAL_NAME__COMMON,
076: "org.jfolder.console.config.v1.RootV1ConsoleConfigTag",
077: ctProps);
078: //
079: this .validateOnlyMode = false;
080: }
081:
082: //
083: public void initialize(ConceptTagCallContext inCtcc) {
084: throw UnexpectedSystemException.notImplemented();
085: }
086:
087: //
088: public void bubba() {
089: throw UnexpectedSystemException.unknownState();
090: }
091:
092: //
093: public void setRootHolder(RootConceptTagHolder inRcth) {
094: if (this .rcth != null) {
095: throw new UnexpectedSystemException("Already set");
096: } else {
097: this .rcth = inRcth;
098: }
099: }
100:
101: public RootConceptTagHolder getRootHolder() {
102: return this .rcth;
103: }
104:
105: //
106: public boolean isStaticUsed() {
107: return true;
108: }
109:
110: public String getStaticNamespace() {
111: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
112: }
113:
114: public String getStaticName() {
115: return ConceptTagPreferencesHelper.CTP_PREF_STATIC_LOCAL_NAME__COMMON;
116: }
117:
118: //
119: public boolean isCompoundUsed() {
120: return true;
121: }
122:
123: public String getCompoundNamespace() {
124: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
125: }
126:
127: public String getCompoundName() {
128: return ConceptTagPreferencesHelper.CTP_PREF_COMPOUND_LOCAL_NAME__COMMON;
129: }
130:
131: //
132: public boolean isNonTerminalCharacterDataStripped() {
133: return true;
134: }
135:
136: //
137: public boolean isConstraintUsed() {
138: return true;
139: }
140:
141: public String getConstraintNamespace() {
142: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
143: }
144:
145: public String getConstraintName() {
146: return ConceptTagPreferencesHelper.CTP_PREF_CONSTRAINT_LOCAL_NAME__COMMON;
147: }
148:
149: //
150: public boolean isStyleUsed() {
151: return false;
152: }
153:
154: public String getStyleNamespace() {
155: return null;
156: }
157:
158: public String getStyleName() {
159: return null;
160: }
161:
162: //
163: public boolean isUnconstrainedAllowed() {
164: return false;
165: }
166:
167: public String getUnconstrainedSymbol() {
168: return ConceptTagPreferencesHelper.CTP_PREF_UNCONSTRAINED_SYMBOL_COMMON;
169: }
170:
171: //
172: public String getRootConstraint() {
173: return ConceptTagPreferencesHelper.CTP_PREF_ROOT_CONSTRAINT__COMMON;
174: }
175:
176: public String getRootHandle() {
177: return (getRootConstraint() + getHandleConjunction() + "0");
178: }
179:
180: //
181: public String getHandleConjunction() {
182: return ConceptTagPreferencesHelper.CTP_PREF_HANDLE_CONJUNCTION__COMMON;
183: }
184:
185: //
186: public ConceptTagSetHolder getSetHolder() {
187:
188: ConceptTagSetHolder outValue = null;
189:
190: outValue = this .ctsh;
191:
192: return outValue;
193: }
194:
195: public ConceptTagMenuBranch getMenuBase() {
196: throw UnexpectedSystemException.notImplemented();
197: }
198:
199: //
200: public String getRootClassName() {
201: return ("org.jfolder.console.config.v1.RootV1ConsoleConfigTag");
202: }
203:
204: //
205: public InitializeConceptTagContext getInitializeContext() {
206: return new InitializeConsoleConfigTagContext(this );
207: }
208:
209: public DetermineClassConceptTagContext getReturnClassContext() {
210: throw UnexpectedSystemException.notImplemented();
211: }
212:
213: public DetermineValueAndClassConceptTagContext getDetermineValueAndClassContext() {
214: throw UnexpectedSystemException.notImplemented();
215: }
216:
217: //
218: public ConceptTag createUnknownConceptTag(String inNs, String inName) {
219:
220: throw new UnexpectedSystemException("Unknown Script Tag - "
221: + "Namespace = ('" + inNs + "'), Name = ('" + inName
222: + "')");
223: }
224:
225: public HashMap getDefaultNamespaceAssignments() {
226: return new HashMap();
227: }
228:
229: public String getAttributeConstraintName() {
230: return ConceptTagPreferencesHelper.CTP_PREF_ATTRIBUTE_LOCAL_NAME__COMMON;
231: }
232:
233: public String getStyleConstraintName() {
234: return ConceptTagPreferencesHelper.CTP_PREF_STYLE_LOCAL_NAME__COMMON;
235: }
236:
237: //
238: public void setValidateOnlyMode(boolean inMode) {
239: this .validateOnlyMode = inMode;
240: }
241:
242: public boolean isValidateOnlyMode() {
243: return this .validateOnlyMode;
244: }
245:
246: //
247: public boolean isAttributeAndStyleForbidden() {
248: return true;
249: }
250:
251: //public boolean isGeneralContentForbidden() {
252: // return true;
253: //}
254: //
255: public void correctForSpecialCharactersAndElements(Document inDoc) {
256: //no corrections needed
257: }
258:
259: //
260: public boolean isFileSystemPresent() {
261: return false;
262: }
263:
264: public String getPreferencesHandle() {
265: return ConceptTagPreferencesHelper.CTP_PREF_HANDLE__CONSOLE_CONFIG;
266: }
267: }
|