static public void put(int type, int service, int group, int level, int msg) { put(type, service, group, level, msg, null); }
/** * Called once, when the DTD is started to be parsed. * Create the GraphNode root element. * * @param root root elemement name of the document (as the DOCTYPE * specifies in the XML document) */ public void startDocument(String root) { if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 1, DDLogFlags.STARTDOC, root); config.messageOut.println("Building the schema object graph."); } this.docRoot = root; }
void removeNode(BeanProp prop) { if (this.node != null) { Node parent = prop.getParentNode(); if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_BLD, 1, DDLogFlags.DELETENODE, this.node.getNodeName() + " from " + parent.getNodeName()); } removeSurroundingSpace(parent, node); parent.removeChild(this.node); this.node = null; } }
/** * Attributes definition live in the BeanProp object while attribute * values live in the DOMBinding objects. */ public void createAttribute(String dtdName, String name, int type, String[] values, String defValue) { AttrProp ap = new AttrProp(this.dtdName, dtdName, name, type, values, defValue); this.attributes.add(ap); if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_BLD, 5, DDLogFlags.CREATEATTR, this.beanName + ": " + ap.toString()); } }
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_EVT, 1, DDLogFlags.CREATECHG, (e==null?"no-event":e.getPropertyName()) +
/** * Done with an element */ public void endElement() { if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 1, DDLogFlags.ENDELT); } if (curElementType == Common.ATTLIST) { curAttr.validate(); } else if (curElementType == Common.ELEMENT) { //System.out.println("endElement: curParentGroup="+curParentGroup); } curElementType = Common.NONE; popLevel(); }
/** * Add a type to the entry (the type doesn't have to be unique) */ public void addType(BaseBean bean, String type) { if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_REG, 1, DDLogFlags.ADDTYPE, bean.name() + " " + type); } RegEntry se = this.getRegEntry(bean, true); se.add(type); }
/** */ void register(BeanProp prop, Object value) { BeanProperty bp = new BeanProperty(prop); if (Common.isBean(prop.type)) ((BaseBean)value).setDomBinding(this); this.prop = bp; if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_BLD, 1, DDLogFlags.BINDPROP, "property " + prop.getDtdName() + " bound to B(" + this.hashCode() + ")"); } // // Following is a little trick to deal with attribute that are not // defined in the dtd. When we register this new element, we ask // for all the attributes and add them dynamically, as transient, // to the BeanProp list of attributes. // if (this.node != null) { NamedNodeMap l = this.node.getAttributes(); for (int i=0; i<l.getLength(); i++) { Node n = l.item(i); prop.createTransientAttribute(n.getNodeName()); } } }
/** * When the bean tree is built from an XML document and an attribute * not defined in the DTD is found, the attribute is dynamically added * to the list of defined attribute with the TRANSIENT status. */ public void createTransientAttribute(String dtdName) { // Add the attribute only if we don't know about it AttrProp ap = this.getAttrProp(dtdName, true); if (ap != null) return; ap = new AttrProp(this.dtdName, dtdName, Common.convertName(dtdName), AttrProp.CDATA | AttrProp.IMPLIED | AttrProp.TRANSIENT, null, null); this.attributes.add(ap); if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_BLD, 5, DDLogFlags.CREATEATTR, this.beanName + ": " + ap.toString()); } }
/** * Get the attribute value */ public String getAttributeValue(int index, String name) { String ret = null; AttrProp ap = this.getAttrProp(name); if (!Common.isArray(this.type)) { // Value not set for single type property - return null if ((index > 0) || (this.bindingsSize() == 0)) return null; } DOMBinding b = (DOMBinding)this.bindings.get(index); if (b != null) ret = b.getAttributeValue(this, ap.getDtdName()); if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_BLD, 10, DDLogFlags.GETATTR, this.beanName + "[" + index + "]." + ap.getDtdName() + ": " + ret + " " + ((b==null)?"<no binding>":("B("+b.hashCode()+")"))+ " BP(" + this.hashCode() + ")"); } return ret; }
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_EVT, 1, DDLogFlags.CREATEREM, (e==null?"no-event":e.getPropertyName()) +
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 5, DDLogFlags.STARTGRP);
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 1, DDLogFlags.ENDDOC);
/** * We are done creating the elements of a same group, * set the current link to the parent of the group. * This will allow either to start creating siblings (if element() * is called) or go the next parent level (if this same method * is called again). */ public void endGroupElements(int instance) { if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 5, DDLogFlags.ENDGRP, instanceToString(instance, false)); } if (curElementType == Common.ELEMENT) { curParentGroup.setGroupInstance(instance); //System.out.println("curParentGroup="+curParentGroup+" instance="+instance); curParentGroup = curParentGroup.getParent(); } else if (this.curElementType == Common.ATTLIST) this.curAttr.setEnum(false); }
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_BLD, 5,
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_EVT, 1, DDLogFlags.VETOABLE, (e==null?"no-event":e.getPropertyName()) +
TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 1, DDLogFlags.STARTELT,
String defaultValue) { if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_DTD, 1, DDLogFlags.ELEMENT,