1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/NGCCHandler.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,193 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.tools.internal.jxc.gen.config; 1.30 + 1.31 +import org.xml.sax.Attributes; 1.32 +import org.xml.sax.SAXException; 1.33 + 1.34 +/** 1.35 + * <p><b> 1.36 + * Auto-generated, do not edit. 1.37 + * </b></p> 1.38 + * 1.39 + * @version $Id: NGCCHandler.java,v 1.9 2002/09/29 02:55:48 okajima Exp $ 1.40 + * @author Kohsuke Kawaguchi (kk@kohsuke.org) 1.41 + */ 1.42 +public abstract class NGCCHandler implements NGCCEventReceiver { 1.43 + protected NGCCHandler( NGCCEventSource source, NGCCHandler parent, int parentCookie ) { 1.44 + 1.45 + _parent = parent; 1.46 + _source = source; 1.47 + _cookie = parentCookie; 1.48 + } 1.49 + 1.50 + /** 1.51 + * Parent NGCCHandler, if any. 1.52 + * If this is the root handler, this field will be null. 1.53 + */ 1.54 + protected final NGCCHandler _parent; 1.55 + 1.56 + /** 1.57 + * Event source. 1.58 + */ 1.59 + protected final NGCCEventSource _source; 1.60 + 1.61 + /** 1.62 + * This method will be implemented by the generated code 1.63 + * and returns a reference to the current runtime. 1.64 + */ 1.65 + protected abstract NGCCRuntime getRuntime(); 1.66 + 1.67 + /** 1.68 + * Cookie assigned by the parent. 1.69 + * 1.70 + * This value will be passed to the onChildCompleted handler 1.71 + * of the parent. 1.72 + */ 1.73 + protected final int _cookie; 1.74 + 1.75 + // used to copy parameters to (enter|leave)(Element|Attribute) events. 1.76 + //protected String localName,uri,qname; 1.77 + 1.78 + 1.79 + /** 1.80 + * Notifies the completion of a child object. 1.81 + * 1.82 + * @param result 1.83 + * The parsing result of the child state. 1.84 + * @param cookie 1.85 + * The cookie value passed to the child object 1.86 + * when it is created. 1.87 + * @param needAttCheck 1.88 + * This flag is true when the callee needs to call the 1.89 + * processAttribute method to check attribute transitions. 1.90 + * This flag is set to false when this method is triggered by 1.91 + * attribute transition. 1.92 + */ 1.93 + protected abstract void onChildCompleted( Object result, int cookie, boolean needAttCheck ) throws SAXException; 1.94 + 1.95 +// 1.96 +// 1.97 +// spawns a new child object from event handlers. 1.98 +// 1.99 +// 1.100 + public void spawnChildFromEnterElement( NGCCEventReceiver child, 1.101 + String uri, String localname, String qname, Attributes atts) throws SAXException { 1.102 + 1.103 + int id = _source.replace(this,child); 1.104 + _source.sendEnterElement(id,uri,localname,qname,atts); 1.105 + } 1.106 + public void spawnChildFromEnterAttribute( NGCCEventReceiver child, 1.107 + String uri, String localname, String qname) throws SAXException { 1.108 + 1.109 + int id = _source.replace(this,child); 1.110 + _source.sendEnterAttribute(id,uri,localname,qname); 1.111 + } 1.112 + public void spawnChildFromLeaveElement( NGCCEventReceiver child, 1.113 + String uri, String localname, String qname) throws SAXException { 1.114 + 1.115 + int id = _source.replace(this,child); 1.116 + _source.sendLeaveElement(id,uri,localname,qname); 1.117 + } 1.118 + public void spawnChildFromLeaveAttribute( NGCCEventReceiver child, 1.119 + String uri, String localname, String qname) throws SAXException { 1.120 + 1.121 + int id = _source.replace(this,child); 1.122 + _source.sendLeaveAttribute(id,uri,localname,qname); 1.123 + } 1.124 + public void spawnChildFromText( NGCCEventReceiver child, 1.125 + String value) throws SAXException { 1.126 + 1.127 + int id = _source.replace(this,child); 1.128 + _source.sendText(id,value); 1.129 + } 1.130 + 1.131 +// 1.132 +// 1.133 +// reverts to the parent object from the child handler 1.134 +// 1.135 +// 1.136 + public void revertToParentFromEnterElement( Object result, int cookie, 1.137 + String uri,String local,String qname, Attributes atts ) throws SAXException { 1.138 + 1.139 + int id = _source.replace(this,_parent); 1.140 + _parent.onChildCompleted(result,cookie,true); 1.141 + _source.sendEnterElement(id,uri,local,qname,atts); 1.142 + } 1.143 + public void revertToParentFromLeaveElement( Object result, int cookie, 1.144 + String uri,String local,String qname ) throws SAXException { 1.145 + 1.146 + if(uri==NGCCRuntime.IMPOSSIBLE && uri==local && uri==qname && _parent==null ) 1.147 + // all the handlers are properly finalized. 1.148 + // quit now, because we don't have any more NGCCHandler. 1.149 + // see the endDocument handler for detail 1.150 + return; 1.151 + 1.152 + int id = _source.replace(this,_parent); 1.153 + _parent.onChildCompleted(result,cookie,true); 1.154 + _source.sendLeaveElement(id,uri,local,qname); 1.155 + } 1.156 + public void revertToParentFromEnterAttribute( Object result, int cookie, 1.157 + String uri,String local,String qname ) throws SAXException { 1.158 + 1.159 + int id = _source.replace(this,_parent); 1.160 + _parent.onChildCompleted(result,cookie,true); 1.161 + _source.sendEnterAttribute(id,uri,local,qname); 1.162 + } 1.163 + public void revertToParentFromLeaveAttribute( Object result, int cookie, 1.164 + String uri,String local,String qname ) throws SAXException { 1.165 + 1.166 + int id = _source.replace(this,_parent); 1.167 + _parent.onChildCompleted(result,cookie,true); 1.168 + _source.sendLeaveAttribute(id,uri,local,qname); 1.169 + } 1.170 + public void revertToParentFromText( Object result, int cookie, 1.171 + String text ) throws SAXException { 1.172 + 1.173 + int id = _source.replace(this,_parent); 1.174 + _parent.onChildCompleted(result,cookie,true); 1.175 + _source.sendText(id,text); 1.176 + } 1.177 + 1.178 + 1.179 +// 1.180 +// 1.181 +// error handler 1.182 +// 1.183 +// 1.184 + public void unexpectedEnterElement(String qname) throws SAXException { 1.185 + getRuntime().unexpectedX('<'+qname+'>'); 1.186 + } 1.187 + public void unexpectedLeaveElement(String qname) throws SAXException { 1.188 + getRuntime().unexpectedX("</"+qname+'>'); 1.189 + } 1.190 + public void unexpectedEnterAttribute(String qname) throws SAXException { 1.191 + getRuntime().unexpectedX('@'+qname); 1.192 + } 1.193 + public void unexpectedLeaveAttribute(String qname) throws SAXException { 1.194 + getRuntime().unexpectedX("/@"+qname); 1.195 + } 1.196 +}