001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.tools.ws.wsdl.parser;
038:
039: import org.w3c.dom.Element;
040: import org.xml.sax.helpers.XMLFilterImpl;
041:
042: /**
043: * Encapsulates schema-language dependent internalization logic.
044: *
045: * {@link com.sun.tools.xjc.reader.internalizer.Internalizer} and {@link DOMForest} are responsible for
046: * doing schema language independent part, and this object is responsible
047: * for schema language dependent part.
048: *
049: * @author
050: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
051: * Vivek Pandey
052: */
053: public interface InternalizationLogic {
054: /**
055: * Creates a new instance of XMLFilter that can be used to
056: * find references to external schemas.
057: *
058: * <p>
059: * Schemas that are included/imported need to be a part of
060: * {@link DOMForest}, and this filter will be expected to
061: * find such references.
062: *
063: * <p>
064: * Once such a reference is found, the filter is expected to
065: * call the parse method of DOMForest.
066: *
067: * <p>
068: * {@link DOMForest} will register ErrorHandler to the returned
069: * object, so any error should be sent to that error handler.
070: *
071: * @return
072: * This method returns {@link org.xml.sax.helpers.XMLFilterImpl} because
073: * the filter has to be usable for two directions
074: * (wrapping a reader and wrapping a ContentHandler)
075: */
076: XMLFilterImpl createExternalReferenceFinder(DOMForest parent);
077:
078: /**
079: * Checks if the specified element is a valid target node
080: * to attach a customization.
081: *
082: * @param parent
083: * The owner DOMForest object. Probably useful only
084: * to obtain context information, such as error handler.
085: * @param bindings
086: * <jaxb:bindings> element or a customization element.
087: * @return
088: * true if it's OK, false if not.
089: */
090: boolean checkIfValidTargetNode(DOMForest parent, Element bindings,
091: Element target);
092:
093: /**
094: * Prepares an element that actually receives customizations.
095: *
096: * <p>
097: * For example, in XML Schema, target nodes can be any schema
098: * element but it is always the <xsd:appinfo> element that
099: * receives customization.
100: *
101: * @param target
102: * The target node designated by the customization.
103: * @return
104: * Always return non-null valid object
105: */
106: Element refineSchemaTarget(Element target);
107:
108: /**
109: * Prepares a WSDL element that actually receives customizations.
110: *
111: *
112: * @param target
113: * The target node designated by the customization.
114: * @return
115: * Always return non-null valid object
116: */
117: Element refineWSDLTarget(Element target);
118:
119: }
|