1 /* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.internal.ws.wsdl.parser; 27 28 import org.w3c.dom.Element; 29 import org.xml.sax.helpers.XMLFilterImpl; 30 31 /** 32 * Encapsulates schema-language dependent internalization logic. 33 * 34 * {@link com.sun.tools.internal.xjc.reader.internalizer.Internalizer} and {@link DOMForest} are responsible for 35 * doing schema language independent part, and this object is responsible 36 * for schema language dependent part. 37 * 38 * @author 39 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 40 * Vivek Pandey 41 */ 42 public interface InternalizationLogic { 43 /** 44 * Creates a new instance of XMLFilter that can be used to 45 * find references to external schemas. 46 * 47 * <p> 48 * Schemas that are included/imported need to be a part of 49 * {@link DOMForest}, and this filter will be expected to 50 * find such references. 51 * 52 * <p> 53 * Once such a reference is found, the filter is expected to 54 * call the parse method of DOMForest. 55 * 56 * <p> 57 * {@link DOMForest} will register ErrorHandler to the returned 58 * object, so any error should be sent to that error handler. 59 * 60 * @return 61 * This method returns {@link org.xml.sax.helpers.XMLFilterImpl} because 62 * the filter has to be usable for two directions 63 * (wrapping a reader and wrapping a ContentHandler) 64 */ 65 XMLFilterImpl createExternalReferenceFinder( DOMForest parent ); 66 67 /** 68 * Checks if the specified element is a valid target node 69 * to attach a customization. 70 * 71 * @param parent 72 * The owner DOMForest object. Probably useful only 73 * to obtain context information, such as error handler. 74 * @param bindings 75 * <jaxb:bindings> element or a customization element. 76 * @return 77 * true if it's OK, false if not. 78 */ 79 boolean checkIfValidTargetNode( DOMForest parent, Element bindings, Element target ); 80 81 /** 82 * Prepares an element that actually receives customizations. 83 * 84 * <p> 85 * For example, in XML Schema, target nodes can be any schema 86 * element but it is always the <xsd:appinfo> element that 87 * receives customization. 88 * 89 * @param target 90 * The target node designated by the customization. 91 * @return 92 * Always return non-null valid object 93 */ 94 Element refineSchemaTarget( Element target ); 95 96 /** 97 * Prepares a WSDL element that actually receives customizations. 98 * 99 * 100 * @param target 101 * The target node designated by the customization. 102 * @return 103 * Always return non-null valid object 104 */ 105 Element refineWSDLTarget( Element target ); 106 107 }