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.common.entity;
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.BaseInitializeConceptTagContext;
018: import org.jfolder.common.tagging.ConceptTag;
019: import org.jfolder.common.tagging.ConceptTagCallContext;
020: import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
021: import org.jfolder.common.tagging.ConceptTagMenuBranch;
022: import org.jfolder.common.tagging.ConceptTagPreferences;
023: import org.jfolder.common.tagging.ConceptTagPreferencesHelper;
024: import org.jfolder.common.tagging.ConceptTagProperties;
025: import org.jfolder.common.tagging.ConceptTagSetHolder;
026: import org.jfolder.common.tagging.DetermineClassConceptTagContext;
027: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
028: import org.jfolder.common.tagging.InitializeConceptTagContext;
029: import org.jfolder.common.tagging.RootConceptTagHolder;
030:
031: //other classes
032:
033: public class SystemEntityTagPreferences extends
034: BaseConceptTagPreferences {
035:
036: //private final static String CMT_BASE_NAMESPACE =
037: // "http://www.jfolder.org/dtds/apps/governor/call/";
038: //
039: //private final static String CMT_NAMESPACE_V1 =
040: // CMT_BASE_NAMESPACE + "v1/";
041: //private final static String CMT_NAMESPACE_V1_BASE =
042: // CMT_NAMESPACE_V1 + "base.dtd";
043: //private final static String CMT_NAMESPACE_V1_CORE =
044: // CMT_NAMESPACE_V1 + "core.dtd";
045: //private final static String CMT_NAMESPACE_V1_RETURNABLE =
046: // CMT_NAMESPACE_V1 + "returnable.dtd";
047: //
048: //private final static String CMT_NAME_V1_TEXT = "text";
049: //private final static String CMT_NAME_V1_COMPOUND = "compound";
050: //
051: //private final static String CMT_ATTR_V1_CONSTRAINT = "constraint";
052: //
053: //private final static String CMT_HANDLE_CONJUCTION = "$";
054: //
055: //private final static String ROOT_CONSTRAINT = "root";
056: //
057: //private final static String UNCONSTRAINED_SYMBOL = "@";
058:
059: //
060: private ConceptTagSetHolder ctsh = null;
061: //
062: private boolean validateOnlyMode = false;
063:
064: //
065: private RootConceptTagHolder rcth = null;
066:
067: //
068: public SystemEntityTagPreferences() {
069: //
070: this .ctsh = new ConceptTagSetHolder(getPreferencesHandle());
071: ConceptTagProperties ctProps = ConceptTagProperties
072: .newInstance(new String[0]);
073: this .ctsh
074: .registerConceptTag(
075: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
076: "governor-call",
077: "org.jfolder.engines.call.v1.RootV1GovernorCallTag",
078: ctProps);
079: //
080: this .ctsh
081: .registerConceptTag(
082: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
083: "dms-directory",
084: "org.jfolder.dms.model.v1.DocumentFileSystemDirectoryTag",
085: ctProps);
086: this .ctsh
087: .registerConceptTag(
088: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
089: "dms-directory-updates",
090: "org.jfolder.dms.model.v1.DocumentFileSystemDirectoryUpdatesTag",
091: ctProps);
092: this .ctsh
093: .registerConceptTag(
094: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
095: "dms-file",
096: "org.jfolder.dms.model.v1.DocumentFileSystemFileTag",
097: ctProps);
098: this .ctsh
099: .registerConceptTag(
100: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
101: "dms-file-updates",
102: "org.jfolder.dms.model.v1.DocumentFileSystemFileUpdatesTag",
103: ctProps);
104: this .ctsh
105: .registerConceptTag(
106: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
107: "dms-root",
108: "org.jfolder.dms.model.v1.DocumentFileSystemRootTag",
109: ctProps);
110: this .ctsh
111: .registerConceptTag(
112: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
113: "dms-root-updates",
114: "org.jfolder.dms.model.v1.DocumentFileSystemRootUpdatesTag",
115: ctProps);
116: //
117: this .ctsh
118: .registerConceptTag(
119: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
120: "project-system",
121: "org.jfolder.project.model.v1.ProjectSystemTag",
122: ctProps);
123: this .ctsh
124: .registerConceptTag(
125: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
126: "project-system-updates",
127: "org.jfolder.project.model.v1.ProjectSystemUpdatesTag",
128: ctProps);
129: //
130: this .ctsh
131: .registerConceptTag(
132: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
133: "user-identity",
134: "org.jfolder.security.model.v1.UserIdentityTag",
135: ctProps);
136: //
137: this .ctsh
138: .registerConceptTag(
139: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
140: "security-audit",
141: "org.jfolder.security.audit.v1.SecurityAuditTag",
142: ctProps);
143: //
144: this .ctsh
145: .registerConceptTag(
146: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
147: "system-entity-properties",
148: "org.jfolder.common.entity.properties.v1.SystemEntityPropertiesTag",
149: ctProps);
150: this .ctsh
151: .registerConceptTag(
152: ConceptTagPreferencesHelper.CTP_PREF_NS__SYSTEM_ENTITY__V1_BASE,
153: "system-entity-properties-updates",
154: "org.jfolder.common.entity.properties.v1."
155: + "SystemEntityPropertiesUpdatesTag",
156: ctProps);
157: //
158: this .validateOnlyMode = false;
159: }
160:
161: //
162: public void initialize(ConceptTagCallContext inCtcc) {
163: throw UnexpectedSystemException.notImplemented();
164: }
165:
166: //
167: public void bubba() {
168: throw UnexpectedSystemException.unknownState();
169: }
170:
171: public void setRootHolder(RootConceptTagHolder inRcth) {
172: if (this .rcth != null) {
173: throw new UnexpectedSystemException("Already set");
174: } else {
175: this .rcth = inRcth;
176: }
177: }
178:
179: public RootConceptTagHolder getRootHolder() {
180: return this .rcth;
181: }
182:
183: //
184: public boolean isStaticUsed() {
185: return true;
186: }
187:
188: public String getStaticNamespace() {
189: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
190: }
191:
192: public String getStaticName() {
193: return ConceptTagPreferencesHelper.CTP_PREF_STATIC_LOCAL_NAME__COMMON;
194: }
195:
196: //
197: public boolean isCompoundUsed() {
198: return true;
199: }
200:
201: public String getCompoundNamespace() {
202: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
203: }
204:
205: public String getCompoundName() {
206: return ConceptTagPreferencesHelper.CTP_PREF_COMPOUND_LOCAL_NAME__COMMON;
207: }
208:
209: //
210: public boolean isNonTerminalCharacterDataStripped() {
211: return true;
212: }
213:
214: //
215: public boolean isConstraintUsed() {
216: return true;
217: }
218:
219: public String getConstraintNamespace() {
220: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
221: }
222:
223: public String getConstraintName() {
224: return ConceptTagPreferencesHelper.CTP_PREF_CONSTRAINT_LOCAL_NAME__COMMON;
225: }
226:
227: //
228: public boolean isStyleUsed() {
229: return false;
230: }
231:
232: public String getStyleNamespace() {
233: return null;
234: }
235:
236: public String getStyleName() {
237: return null;
238: }
239:
240: //
241: public boolean isUnconstrainedAllowed() {
242: return false;
243: }
244:
245: public String getUnconstrainedSymbol() {
246: return ConceptTagPreferencesHelper.CTP_PREF_UNCONSTRAINED_SYMBOL_COMMON;
247: }
248:
249: //
250: public String getRootConstraint() {
251: return ConceptTagPreferencesHelper.CTP_PREF_ROOT_CONSTRAINT__COMMON;
252: }
253:
254: public String getRootHandle() {
255: return (getRootConstraint() + getHandleConjunction() + "0");
256: }
257:
258: //
259: public String getHandleConjunction() {
260: return ConceptTagPreferencesHelper.CTP_PREF_HANDLE_CONJUNCTION__COMMON;
261: }
262:
263: //
264: public ConceptTagSetHolder getSetHolder() {
265:
266: ConceptTagSetHolder outValue = null;
267:
268: outValue = this .ctsh;
269:
270: return outValue;
271: }
272:
273: public ConceptTagMenuBranch getMenuBase() {
274: throw UnexpectedSystemException.notImplemented();
275: }
276:
277: //
278: public String getRootClassName() {
279: return ("org.jfolder.engines.call.v1.RootV1GovernorCallTag");
280: }
281:
282: //
283: public InitializeConceptTagContext getInitializeContext() {
284: return new InitializeSystemEntityTagContext(this );
285: }
286:
287: public DetermineClassConceptTagContext getReturnClassContext() {
288: throw UnexpectedSystemException.notImplemented();
289: }
290:
291: public DetermineValueAndClassConceptTagContext getDetermineValueAndClassContext() {
292: throw UnexpectedSystemException.notImplemented();
293: }
294:
295: //
296: public ConceptTag createUnknownConceptTag(String inNs, String inName) {
297:
298: throw new UnexpectedSystemException(
299: "Unknown System Entity Tag - " + "Namespace = ('"
300: + inNs + "'), Name = ('" + inName + "')");
301: }
302:
303: public HashMap getDefaultNamespaceAssignments() {
304: return new HashMap();
305: }
306:
307: public String getAttributeConstraintName() {
308: return ConceptTagPreferencesHelper.CTP_PREF_ATTRIBUTE_LOCAL_NAME__COMMON;
309: }
310:
311: public String getStyleConstraintName() {
312: return ConceptTagPreferencesHelper.CTP_PREF_STYLE_LOCAL_NAME__COMMON;
313: }
314:
315: //
316: public void setValidateOnlyMode(boolean inMode) {
317: this .validateOnlyMode = inMode;
318: }
319:
320: public boolean isValidateOnlyMode() {
321: return this .validateOnlyMode;
322: }
323:
324: //
325: public boolean isAttributeAndStyleForbidden() {
326: return true;
327: }
328:
329: //public boolean isGeneralContentForbidden() {
330: // return true;
331: //}
332: //
333: public void correctForSpecialCharactersAndElements(Document inDoc) {
334: //no corrections needed
335: }
336:
337: //
338: public boolean isFileSystemPresent() {
339: return true;
340: }
341:
342: //
343: public String getPreferencesHandle() {
344: return ConceptTagPreferencesHelper.CTP_PREF_HANDLE__SYSTEM_ENTITY;
345: }
346: }
|