001: /*
002: * Fast Infoset ver. 0.1 software ("Software")
003: *
004: * Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
005: *
006: * Software is licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License. You may
008: * obtain a copy of the License at:
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015: * License for the specific language governing permissions and limitations.
016: *
017: * Sun supports and benefits from the global community of open source
018: * developers, and thanks the community for its important contributions and
019: * open standards-based technology, which Sun has adopted into many of its
020: * products.
021: *
022: * Please note that portions of Software may be provided with notices and
023: * open source licenses from such communities and third parties that govern the
024: * use of those portions, and any licenses granted hereunder do not alter any
025: * rights and obligations you may have under such open source licenses,
026: * however, the disclaimer of warranty and limitation of liability provisions
027: * in this License will apply to all Software in this distribution.
028: *
029: * You acknowledge that the Software is not designed, licensed or intended
030: * for use in the design, construction, operation or maintenance of any nuclear
031: * facility.
032: *
033: * Apache License
034: * Version 2.0, January 2004
035: * http://www.apache.org/licenses/
036: *
037: */
038:
039: package org.jvnet.fastinfoset;
040:
041: import java.util.Map;
042:
043: /**
044: * A general interface for parsers of fast infoset documents.
045: *
046: * <p>
047: * This interface contains common methods that are not specific to any
048: * API associated with the parsing of fast infoset documents.
049: *
050: * @author Paul.Sandoz@Sun.Com
051: */
052: public interface FastInfosetParser {
053: /**
054: * The property name to be used for getting and setting the string
055: * interning property of a parser.
056: *
057: */
058: public static final String STRING_INTERNING_PROPERTY = "http://jvnet.org/fastinfoset/parser/properties/string-interning";
059:
060: /**
061: * The property name to be used for getting and setting the buffer size
062: * of a parser.
063: */
064: public static final String BUFFER_SIZE_PROPERTY = "http://jvnet.org/fastinfoset/parser/properties/buffer-size";
065:
066: /**
067: * The property name to be used for getting and setting the
068: * Map containing encoding algorithms.
069: *
070: */
071: public static final String REGISTERED_ENCODING_ALGORITHMS_PROPERTY = "http://jvnet.org/fastinfoset/parser/properties/registered-encoding-algorithms";
072:
073: /**
074: * The property name to be used for getting and setting the
075: * Map containing external vocabularies.
076: *
077: */
078: public static final String EXTERNAL_VOCABULARIES_PROPERTY = "http://jvnet.org/fastinfoset/parser/properties/external-vocabularies";
079:
080: /**
081: * The property name to be used for getting and setting the
082: * flag, which will indicate whether underlying Parser's
083: * input stream should be really closed
084: */
085: public static final String FORCE_STREAM_CLOSE_PROPERTY = "http://jvnet.org/fastinfoset/parser/properties/force-stream-close";
086:
087: /**
088: * Set the string interning property.
089: *
090: * <p>If the string interning property is set to true then
091: * <code>String</code> objects instantiated for [namespace name], [prefix]
092: * and [local name] infoset properties will be interned using the method
093: * {@link String#intern()}.
094: *
095: * @param stringInterning The string interning property.
096: */
097: public void setStringInterning(boolean stringInterning);
098:
099: /**
100: * Return the string interning property.
101: *
102: * @return The string interning property.
103: */
104: public boolean getStringInterning();
105:
106: /**
107: * Set the buffer size.
108: *
109: * <p>The size of the buffer for parsing is set using this
110: * method. Requests for sizes smaller then the current size will be ignored.
111: * Otherwise the buffer will be resized when the next parse is performed.<p>
112: *
113: * @param bufferSize The requested buffer size.
114: */
115: public void setBufferSize(int bufferSize);
116:
117: /**
118: * Get the buffer size.
119: *
120: * @return The buffer size.
121: */
122: public int getBufferSize();
123:
124: /**
125: * Sets the set of registered encoding algorithms.
126: *
127: * @param algorithms The set of registered algorithms.
128: */
129: public void setRegisteredEncodingAlgorithms(Map algorithms);
130:
131: /**
132: * Gets the set of registered encoding algorithms.
133: *
134: * @return The set of registered algorithms.
135: */
136: public Map getRegisteredEncodingAlgorithms();
137:
138: /**
139: * Set the map of referenced external vocabularies.
140: * <p>
141: * The map (but not the keys and values) be cloned.
142: *
143: * @param referencedVocabualries the map of URI to vocabulary.
144: */
145: public void setExternalVocabularies(Map referencedVocabualries);
146:
147: /**
148: * Get the map of referenced external vocabularies.
149: *
150: * @return the map of URI to vocabulary.
151: * @deprecated
152: * The map returned will not be the same instance and contain
153: * the same entries as the map set by {@link #setExternalVocabularies}
154: * method.
155: */
156: public Map getExternalVocabularies();
157:
158: /**
159: * Set the parse fragments property.
160: *
161: * <p>If the parse fragments property is set to true then
162: * fragments of an XML infoset may be parsed.
163: *
164: * @param parseFragments The parse fragments property.
165: */
166: public void setParseFragments(boolean parseFragments);
167:
168: /**
169: * Return the parse fragments property.
170: *
171: * @return The parse fragments property.
172: */
173: public boolean getParseFragments();
174:
175: /**
176: * Set the force stream close property.
177: *
178: * <p>If the force stream property is set to true then
179: * Parser's underlying InputStream will be closed.
180: *
181: * @param needForceStreamClose The force stream close property.
182: */
183: public void setForceStreamClose(boolean needForceStreamClose);
184:
185: /**
186: * Return the force stream close property.
187: *
188: * @return The force stream close property.
189: */
190: public boolean getForceStreamClose();
191:
192: }
|