Wed, 27 Apr 2016 01:27:09 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws/
changeset: 657:d47a47f961ee
tag: jdk8u25-b17
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.tools.internal.jxc.gen.config; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import org.xml.sax.Attributes; |
aoqi@0 | 29 | import org.xml.sax.SAXException; |
aoqi@0 | 30 | |
aoqi@0 | 31 | /** |
aoqi@0 | 32 | * <p><b> |
aoqi@0 | 33 | * Auto-generated, do not edit. |
aoqi@0 | 34 | * </b></p> |
aoqi@0 | 35 | * |
aoqi@0 | 36 | * @version $Id: NGCCHandler.java,v 1.9 2002/09/29 02:55:48 okajima Exp $ |
aoqi@0 | 37 | * @author Kohsuke Kawaguchi (kk@kohsuke.org) |
aoqi@0 | 38 | */ |
aoqi@0 | 39 | public abstract class NGCCHandler implements NGCCEventReceiver { |
aoqi@0 | 40 | protected NGCCHandler( NGCCEventSource source, NGCCHandler parent, int parentCookie ) { |
aoqi@0 | 41 | |
aoqi@0 | 42 | _parent = parent; |
aoqi@0 | 43 | _source = source; |
aoqi@0 | 44 | _cookie = parentCookie; |
aoqi@0 | 45 | } |
aoqi@0 | 46 | |
aoqi@0 | 47 | /** |
aoqi@0 | 48 | * Parent NGCCHandler, if any. |
aoqi@0 | 49 | * If this is the root handler, this field will be null. |
aoqi@0 | 50 | */ |
aoqi@0 | 51 | protected final NGCCHandler _parent; |
aoqi@0 | 52 | |
aoqi@0 | 53 | /** |
aoqi@0 | 54 | * Event source. |
aoqi@0 | 55 | */ |
aoqi@0 | 56 | protected final NGCCEventSource _source; |
aoqi@0 | 57 | |
aoqi@0 | 58 | /** |
aoqi@0 | 59 | * This method will be implemented by the generated code |
aoqi@0 | 60 | * and returns a reference to the current runtime. |
aoqi@0 | 61 | */ |
aoqi@0 | 62 | protected abstract NGCCRuntime getRuntime(); |
aoqi@0 | 63 | |
aoqi@0 | 64 | /** |
aoqi@0 | 65 | * Cookie assigned by the parent. |
aoqi@0 | 66 | * |
aoqi@0 | 67 | * This value will be passed to the onChildCompleted handler |
aoqi@0 | 68 | * of the parent. |
aoqi@0 | 69 | */ |
aoqi@0 | 70 | protected final int _cookie; |
aoqi@0 | 71 | |
aoqi@0 | 72 | // used to copy parameters to (enter|leave)(Element|Attribute) events. |
aoqi@0 | 73 | //protected String localName,uri,qname; |
aoqi@0 | 74 | |
aoqi@0 | 75 | |
aoqi@0 | 76 | /** |
aoqi@0 | 77 | * Notifies the completion of a child object. |
aoqi@0 | 78 | * |
aoqi@0 | 79 | * @param result |
aoqi@0 | 80 | * The parsing result of the child state. |
aoqi@0 | 81 | * @param cookie |
aoqi@0 | 82 | * The cookie value passed to the child object |
aoqi@0 | 83 | * when it is created. |
aoqi@0 | 84 | * @param needAttCheck |
aoqi@0 | 85 | * This flag is true when the callee needs to call the |
aoqi@0 | 86 | * processAttribute method to check attribute transitions. |
aoqi@0 | 87 | * This flag is set to false when this method is triggered by |
aoqi@0 | 88 | * attribute transition. |
aoqi@0 | 89 | */ |
aoqi@0 | 90 | protected abstract void onChildCompleted( Object result, int cookie, boolean needAttCheck ) throws SAXException; |
aoqi@0 | 91 | |
aoqi@0 | 92 | // |
aoqi@0 | 93 | // |
aoqi@0 | 94 | // spawns a new child object from event handlers. |
aoqi@0 | 95 | // |
aoqi@0 | 96 | // |
aoqi@0 | 97 | public void spawnChildFromEnterElement( NGCCEventReceiver child, |
aoqi@0 | 98 | String uri, String localname, String qname, Attributes atts) throws SAXException { |
aoqi@0 | 99 | |
aoqi@0 | 100 | int id = _source.replace(this,child); |
aoqi@0 | 101 | _source.sendEnterElement(id,uri,localname,qname,atts); |
aoqi@0 | 102 | } |
aoqi@0 | 103 | public void spawnChildFromEnterAttribute( NGCCEventReceiver child, |
aoqi@0 | 104 | String uri, String localname, String qname) throws SAXException { |
aoqi@0 | 105 | |
aoqi@0 | 106 | int id = _source.replace(this,child); |
aoqi@0 | 107 | _source.sendEnterAttribute(id,uri,localname,qname); |
aoqi@0 | 108 | } |
aoqi@0 | 109 | public void spawnChildFromLeaveElement( NGCCEventReceiver child, |
aoqi@0 | 110 | String uri, String localname, String qname) throws SAXException { |
aoqi@0 | 111 | |
aoqi@0 | 112 | int id = _source.replace(this,child); |
aoqi@0 | 113 | _source.sendLeaveElement(id,uri,localname,qname); |
aoqi@0 | 114 | } |
aoqi@0 | 115 | public void spawnChildFromLeaveAttribute( NGCCEventReceiver child, |
aoqi@0 | 116 | String uri, String localname, String qname) throws SAXException { |
aoqi@0 | 117 | |
aoqi@0 | 118 | int id = _source.replace(this,child); |
aoqi@0 | 119 | _source.sendLeaveAttribute(id,uri,localname,qname); |
aoqi@0 | 120 | } |
aoqi@0 | 121 | public void spawnChildFromText( NGCCEventReceiver child, |
aoqi@0 | 122 | String value) throws SAXException { |
aoqi@0 | 123 | |
aoqi@0 | 124 | int id = _source.replace(this,child); |
aoqi@0 | 125 | _source.sendText(id,value); |
aoqi@0 | 126 | } |
aoqi@0 | 127 | |
aoqi@0 | 128 | // |
aoqi@0 | 129 | // |
aoqi@0 | 130 | // reverts to the parent object from the child handler |
aoqi@0 | 131 | // |
aoqi@0 | 132 | // |
aoqi@0 | 133 | public void revertToParentFromEnterElement( Object result, int cookie, |
aoqi@0 | 134 | String uri,String local,String qname, Attributes atts ) throws SAXException { |
aoqi@0 | 135 | |
aoqi@0 | 136 | int id = _source.replace(this,_parent); |
aoqi@0 | 137 | _parent.onChildCompleted(result,cookie,true); |
aoqi@0 | 138 | _source.sendEnterElement(id,uri,local,qname,atts); |
aoqi@0 | 139 | } |
aoqi@0 | 140 | public void revertToParentFromLeaveElement( Object result, int cookie, |
aoqi@0 | 141 | String uri,String local,String qname ) throws SAXException { |
aoqi@0 | 142 | |
aoqi@0 | 143 | if(uri==NGCCRuntime.IMPOSSIBLE && uri==local && uri==qname && _parent==null ) |
aoqi@0 | 144 | // all the handlers are properly finalized. |
aoqi@0 | 145 | // quit now, because we don't have any more NGCCHandler. |
aoqi@0 | 146 | // see the endDocument handler for detail |
aoqi@0 | 147 | return; |
aoqi@0 | 148 | |
aoqi@0 | 149 | int id = _source.replace(this,_parent); |
aoqi@0 | 150 | _parent.onChildCompleted(result,cookie,true); |
aoqi@0 | 151 | _source.sendLeaveElement(id,uri,local,qname); |
aoqi@0 | 152 | } |
aoqi@0 | 153 | public void revertToParentFromEnterAttribute( Object result, int cookie, |
aoqi@0 | 154 | String uri,String local,String qname ) throws SAXException { |
aoqi@0 | 155 | |
aoqi@0 | 156 | int id = _source.replace(this,_parent); |
aoqi@0 | 157 | _parent.onChildCompleted(result,cookie,true); |
aoqi@0 | 158 | _source.sendEnterAttribute(id,uri,local,qname); |
aoqi@0 | 159 | } |
aoqi@0 | 160 | public void revertToParentFromLeaveAttribute( Object result, int cookie, |
aoqi@0 | 161 | String uri,String local,String qname ) throws SAXException { |
aoqi@0 | 162 | |
aoqi@0 | 163 | int id = _source.replace(this,_parent); |
aoqi@0 | 164 | _parent.onChildCompleted(result,cookie,true); |
aoqi@0 | 165 | _source.sendLeaveAttribute(id,uri,local,qname); |
aoqi@0 | 166 | } |
aoqi@0 | 167 | public void revertToParentFromText( Object result, int cookie, |
aoqi@0 | 168 | String text ) throws SAXException { |
aoqi@0 | 169 | |
aoqi@0 | 170 | int id = _source.replace(this,_parent); |
aoqi@0 | 171 | _parent.onChildCompleted(result,cookie,true); |
aoqi@0 | 172 | _source.sendText(id,text); |
aoqi@0 | 173 | } |
aoqi@0 | 174 | |
aoqi@0 | 175 | |
aoqi@0 | 176 | // |
aoqi@0 | 177 | // |
aoqi@0 | 178 | // error handler |
aoqi@0 | 179 | // |
aoqi@0 | 180 | // |
aoqi@0 | 181 | public void unexpectedEnterElement(String qname) throws SAXException { |
aoqi@0 | 182 | getRuntime().unexpectedX('<'+qname+'>'); |
aoqi@0 | 183 | } |
aoqi@0 | 184 | public void unexpectedLeaveElement(String qname) throws SAXException { |
aoqi@0 | 185 | getRuntime().unexpectedX("</"+qname+'>'); |
aoqi@0 | 186 | } |
aoqi@0 | 187 | public void unexpectedEnterAttribute(String qname) throws SAXException { |
aoqi@0 | 188 | getRuntime().unexpectedX('@'+qname); |
aoqi@0 | 189 | } |
aoqi@0 | 190 | public void unexpectedLeaveAttribute(String qname) throws SAXException { |
aoqi@0 | 191 | getRuntime().unexpectedX("/@"+qname); |
aoqi@0 | 192 | } |
aoqi@0 | 193 | } |