001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: package com.sun.tools.internal.ws.processor.config.parser;
026:
027: import java.io.InputStream;
028: import java.util.HashMap;
029: import java.util.List;
030: import java.util.Map;
031: import java.util.Properties;
032:
033: import javax.xml.namespace.QName;
034:
035: import org.xml.sax.InputSource;
036:
037: import com.sun.tools.internal.ws.processor.util.ProcessorEnvironment;
038: import com.sun.tools.internal.ws.processor.config.Configuration;
039: import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory;
040:
041: /**
042: * @author Vivek Pandey
043: *
044: *
045: */
046: public abstract class InputParser {
047: protected LocalizableMessageFactory _messageFactory = new LocalizableMessageFactory(
048: "com.sun.tools.internal.ws.resources.configuration");
049:
050: public InputParser(ProcessorEnvironment env, Properties options) {
051: this ._env = env;
052: this ._options = options;
053: _modelInfoParsers = new HashMap<QName, Object>();
054:
055: // /*
056: // * Load modelinfo parsers from the plugins which want to extend
057: // * this functionality
058: // */
059: // Iterator i = ToolPluginFactory.getInstance().getExtensions(
060: // ToolPluginConstants.WSCOMPILE_PLUGIN,
061: // ToolPluginConstants.WSCOMPILE_MODEL_INFO_EXT_POINT);
062: // while(i != null && i.hasNext()) {
063: // ModelInfoPlugin plugin = (ModelInfoPlugin)i.next();
064: // _modelInfoParsers.put(plugin.getModelInfoName(),
065: // plugin.createModelInfoParser(env));
066: // }
067: }
068:
069: protected Configuration parse(InputStream is) throws Exception {
070: //TODO: Not implemented exception
071: return null;
072: }
073:
074: protected Configuration parse(InputSource is) throws Exception {
075: //TODO: Not implemented exception
076: return null;
077: }
078:
079: protected Configuration parse(List<String> inputSources)
080: throws Exception {
081: //TODO: Not implemented exception
082: return null;
083: }
084:
085: /**
086: * @return Returns the _env.
087: */
088: public ProcessorEnvironment getEnv() {
089: return _env;
090: }
091:
092: /**
093: * @param env The ProcessorEnvironment to set.
094: */
095: public void setEnv(ProcessorEnvironment env) {
096: this ._env = env;
097: }
098:
099: protected void warn(String key) {
100: _env.warn(_messageFactory.getMessage(key));
101: }
102:
103: protected void warn(String key, String arg) {
104: _env.warn(_messageFactory.getMessage(key, arg));
105: }
106:
107: protected void warn(String key, Object[] args) {
108: _env.warn(_messageFactory.getMessage(key, args));
109: }
110:
111: protected void info(String key) {
112: _env.info(_messageFactory.getMessage(key));
113: }
114:
115: protected void info(String key, String arg) {
116: _env.info(_messageFactory.getMessage(key, arg));
117: }
118:
119: protected ProcessorEnvironment _env;
120: protected Properties _options;
121: protected Map<QName, Object> _modelInfoParsers;
122: }
|