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:
026: package com.sun.tools.internal.ws.wsdl.parser;
027:
028: import org.w3c.dom.Element;
029:
030: import com.sun.tools.internal.ws.wsdl.document.WSDLConstants;
031: import com.sun.tools.internal.ws.wsdl.document.mime.MIMEConstants;
032: import com.sun.tools.internal.ws.wsdl.framework.Extensible;
033: import com.sun.tools.internal.ws.wsdl.framework.ParserContext;
034:
035: /**
036: * A base class for WSDL extension handlers.
037: *
038: * @author WS Development Team
039: */
040: public abstract class ExtensionHandlerBase extends ExtensionHandler {
041:
042: protected ExtensionHandlerBase() {
043: }
044:
045: public boolean doHandleExtension(ParserContext context,
046: Extensible parent, Element e) {
047: if (parent.getElementName().equals(
048: WSDLConstants.QNAME_DEFINITIONS)) {
049: return handleDefinitionsExtension(context, parent, e);
050: } else if (parent.getElementName().equals(
051: WSDLConstants.QNAME_TYPES)) {
052: return handleTypesExtension(context, parent, e);
053: } else if (parent.getElementName().equals(
054: WSDLConstants.QNAME_PORT_TYPE)) {
055: return handlePortTypeExtension(context, parent, e);
056: } else if (parent.getElementName().equals(
057: WSDLConstants.QNAME_BINDING)) {
058: return handleBindingExtension(context, parent, e);
059: } else if (parent.getElementName().equals(
060: WSDLConstants.QNAME_OPERATION)) {
061: return handleOperationExtension(context, parent, e);
062: } else if (parent.getElementName().equals(
063: WSDLConstants.QNAME_INPUT)) {
064: return handleInputExtension(context, parent, e);
065: } else if (parent.getElementName().equals(
066: WSDLConstants.QNAME_OUTPUT)) {
067: return handleOutputExtension(context, parent, e);
068: } else if (parent.getElementName().equals(
069: WSDLConstants.QNAME_FAULT)) {
070: return handleFaultExtension(context, parent, e);
071: } else if (parent.getElementName().equals(
072: WSDLConstants.QNAME_SERVICE)) {
073: return handleServiceExtension(context, parent, e);
074: } else if (parent.getElementName().equals(
075: WSDLConstants.QNAME_PORT)) {
076: return handlePortExtension(context, parent, e);
077: } else if (parent.getElementName().equals(
078: MIMEConstants.QNAME_PART)) {
079: return handleMIMEPartExtension(context, parent, e);
080: } else {
081: return false;
082: }
083: }
084:
085: /**
086: * @param context
087: * @param parent
088: * @param e
089: * @return true if the PortTypeExtension should be handled
090: */
091: protected abstract boolean handlePortTypeExtension(
092: ParserContext context, Extensible parent, Element e);
093:
094: protected abstract boolean handleDefinitionsExtension(
095: ParserContext context, Extensible parent, Element e);
096:
097: protected abstract boolean handleTypesExtension(
098: ParserContext context, Extensible parent, Element e);
099:
100: protected abstract boolean handleBindingExtension(
101: ParserContext context, Extensible parent, Element e);
102:
103: protected abstract boolean handleOperationExtension(
104: ParserContext context, Extensible parent, Element e);
105:
106: protected abstract boolean handleInputExtension(
107: ParserContext context, Extensible parent, Element e);
108:
109: protected abstract boolean handleOutputExtension(
110: ParserContext context, Extensible parent, Element e);
111:
112: protected abstract boolean handleFaultExtension(
113: ParserContext context, Extensible parent, Element e);
114:
115: protected abstract boolean handleServiceExtension(
116: ParserContext context, Extensible parent, Element e);
117:
118: protected abstract boolean handlePortExtension(
119: ParserContext context, Extensible parent, Element e);
120:
121: protected abstract boolean handleMIMEPartExtension(
122: ParserContext context, Extensible parent, Element e);
123: }
|