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