001: //
002: // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.5-b16-fcs
003: // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
004: // Any modifications to this file will be lost upon recompilation of the source schema.
005: // Generated on: 2005.12.17 at 09:43:27 AM GMT+07:00
006: //
007:
008: package com.mvnforum.jaxb.db.impl.runtime;
009:
010: import javax.xml.bind.ValidationEvent;
011: import javax.xml.namespace.NamespaceContext;
012:
013: import org.xml.sax.Attributes;
014: import org.xml.sax.Locator;
015: import org.xml.sax.SAXException;
016:
017: import com.sun.xml.bind.unmarshaller.Tracer;
018:
019: /**
020: * Methods exposed by the unmarshalling coordinator object
021: * to the generated code.
022: *
023: * This interface will be implemented by the coordinator, which
024: * converts whatever events (e.g., SAX) into unmarshalling events.
025: *
026: * <p>
027: * Errors detected by the AbstractUnmarshallingEventHandlerImpl-derived classes should
028: * be either thrown as {@link UnrepotedException} or reported through
029: * the handleEvent method of this interface.
030: *
031: * @author
032: * <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
033: */
034: public interface UnmarshallingContext extends NamespaceContext {
035: /** Obtains a reference to the current grammar info. */
036: GrammarInfo getGrammarInfo();
037:
038: /**
039: * Pushes the current content handler into the stack
040: * and registers the newly specified content handler so
041: * that it can receive SAX events.
042: *
043: * @param memento
044: * When this newly specified handler will be removed from the stack,
045: * the leaveChild event will be fired to the parent handler
046: * with this memento.
047: */
048: void pushContentHandler(UnmarshallingEventHandler handler,
049: int memento);
050:
051: /**
052: * Pops a content handler from the stack and registers
053: * it as the current content handler.
054: *
055: * <p>
056: * This method will also fire the leaveChild event with the
057: * associated memento.
058: */
059: void popContentHandler() throws SAXException;
060:
061: /**
062: * Gets the current handler.
063: */
064: UnmarshallingEventHandler getCurrentHandler();
065:
066: /**
067: * Returns a list of prefixes newly declared on this element.
068: *
069: * This method has to be called after the {@link #pushAttributes}
070: * method is called.
071: *
072: * @return
073: * A possible zero-length array of prefixes. The default prefix
074: * is represented by the empty string.
075: */
076: String[] getNewlyDeclaredPrefixes();
077:
078: /**
079: * Returns a list of all in-scope prefixes.
080: *
081: * @return
082: * A possible zero-length array of prefixes. The default prefix
083: * is represented by the empty string.
084: */
085: String[] getAllDeclaredPrefixes();
086:
087: /**
088: * Stores a new attribute set.
089: * This method should be called by the generated code
090: * when it "eats" an enterElement event.
091: *
092: * @param collectText
093: * false if the context doesn't need to fire text events
094: * for texts inside this element. True otherwise.
095: */
096: void pushAttributes(Attributes atts, boolean collectText);
097:
098: /**
099: * Discards the previously stored attribute set.
100: * This method should be called by the generated code
101: * when it "eats" a leaveElement event.
102: */
103: void popAttributes();
104:
105: /**
106: * Gets the index of the attribute with the specified name.
107: * This is usually faster when you only need to test with
108: * a simple name.
109: *
110: * @return
111: * -1 if not found.
112: */
113: int getAttribute(String uri, String name);
114:
115: /**
116: * Gets all the unconsumed attributes.
117: * If you need to find attributes based on more complex filter,
118: * you need to use this method.
119: */
120: Attributes getUnconsumedAttributes();
121:
122: /**
123: * Fires an attribute event for the specified attribute,
124: * and marks the attribute as "used".
125: */
126: void consumeAttribute(int idx) throws SAXException;
127:
128: /**
129: * Marks the attribute as "used" and return the value of the attribute.
130: */
131: String eatAttribute(int idx) throws SAXException;
132:
133: /**
134: * Adds a job that will be executed at the last of the unmarshalling.
135: * This method is used to support ID/IDREF feature, but it can be used
136: * for other purposes as well.
137: *
138: * @param job
139: * The run method of this object is called.
140: */
141: void addPatcher(Runnable job);
142:
143: // the patcher can throw JAXBException?
144:
145: /**
146: * Adds the object which is currently being unmarshalled
147: * to the ID table.
148: *
149: * @return
150: * Returns the value passed as the parameter.
151: * This is a hack, but this makes it easier for ID
152: * transducer to do its job.
153: */
154: String addToIdTable(String id);
155:
156: //
157: // throwing an exception is one way. Overwriting the previous one
158: // is another way. The latter allows us to process invalid documents,
159: // while the former makes it impossible to handle them.
160: //
161: // I prefer to be flexible in terms of invalid document handling,
162: // so chose not to throw an exception.
163: //
164: // I believe this is an implementation choice, not the spec issue.
165: // -kk
166:
167: /**
168: * Looks up the ID table and gets associated object.
169: *
170: * @return
171: * If there is no object associated with the given id,
172: * this method returns null.
173: */
174: Object getObjectFromId(String id);
175:
176: // if we don't find ID.
177:
178: /**
179: * Gets the current source location information.
180: */
181: Locator getLocator();
182:
183: /**
184: * Reports an error to the user, and asks if s/he wants
185: * to recover. If the canRecover flag is false, regardless
186: * of the client instruction, an exception will be thrown.
187: *
188: * Only if the flag is true and the user wants to recover from an error,
189: * the method returns normally.
190: *
191: * The thrown exception will be catched by the unmarshaller.
192: */
193: void handleEvent(ValidationEvent event, boolean canRecover)
194: throws SAXException;
195:
196: //
197: //
198: // the copy of the org.relaxng.datatype.ValidationContext interface.
199: //
200: // this interface doesn't derive from that interface so that we don't have
201: // a direct dependency to it, but we provide the same functionality so that
202: // we can adopt this interface into the ValidationContext interface.
203: //
204: // see the ValidationContextAdaptor class.
205: String resolveNamespacePrefix(String prefix);
206:
207: String getBaseUri();
208:
209: boolean isUnparsedEntity(String entityName);
210:
211: boolean isNotation(String notationName);
212:
213: // DBG
214: /**
215: * Gets a tracer object.
216: *
217: * Tracer can be used to trace the unmarshalling behavior.
218: * Note that to debug the unmarshalling process,
219: * you have to configure XJC so that it will emit trace codes
220: * in the unmarshaller.
221: */
222: Tracer getTracer();
223: }
|