diff --git a/jaxws/.hgignore b/jaxws/.hgignore index 05a4793cff1..655f5df9053 100644 --- a/jaxws/.hgignore +++ b/jaxws/.hgignore @@ -1,5 +1,6 @@ ^build/ ^dist/ ^drop/ +^drop_included/ ^webrev/ ^nbproject/private/ diff --git a/jaxws/build-defs.xml b/jaxws/build-defs.xml index de2b567dc75..77300153fcb 100644 --- a/jaxws/build-defs.xml +++ b/jaxws/build-defs.xml @@ -81,34 +81,15 @@ - + - - - - - - - - - - - - - - - - - - - - - + + @@ -118,25 +99,20 @@ + depends="init, -use-drop"> - - - - - - + - + diff --git a/jaxws/build-drop-template.xml b/jaxws/build-drop-template.xml index 1fe858cef23..528b8a98d6e 100644 --- a/jaxws/build-drop-template.xml +++ b/jaxws/build-drop-template.xml @@ -34,7 +34,7 @@ + value="${drop.expanded.dir}/bundles/${@DROP@.bundle.name}"/> @@ -43,10 +43,13 @@ - - - - + + + + + + + @@ -72,7 +75,6 @@ - @@ -106,6 +108,16 @@ + + + + + + Checksum on file ${@DROP@.bundle.copy} is + ${@DROP@.bundle.md5.checksum.is}, not ${@DROP@.bundle.md5.checksum} + diff --git a/jaxws/build.properties b/jaxws/build.properties index 880b11c8a55..9e5f63306c9 100644 --- a/jaxws/build.properties +++ b/jaxws/build.properties @@ -25,7 +25,7 @@ # Base locations where bundles are located slashjava=/java -devtools=${slashjava}/devtools +drops.dir=${slashjava}/devtools/share/jdk7-drops # This is the JDK used to build and run the bootstrap version of javac. # The bootstrap javac is used to compile both boostrap versions of the @@ -64,16 +64,15 @@ dist.lib.dir=${dist.dir}/lib dist.classes.jar=${dist.lib.dir}/classes.jar dist.src.zip=${dist.lib.dir}/src.zip -# Where all drop sources live -drop.dir=./drop +# Where all drop sources get placed when downloaded and unzipped +drop.expanded.dir=${output.dir}/drop + +# Location if the sources were included already +drop.included.dir=./drop_included # Where patches to drop bundle sources live patches.dir=patches -# Original source area -orig.dir=src -orig.src.dir=${orig.dir}/share/classes - # Sanity information sanity.info= Sanity Settings:${line.separator}\ ant.home=${ant.home}${line.separator}\ @@ -98,6 +97,7 @@ sanity.info= Sanity Settings:${line.separator}\ build.dir=${build.dir}${line.separator}\ dist.dir=${dist.dir}${line.separator}\ drop.dir=${drop.dir}${line.separator}\ + drops.dir=${drops.dir}${line.separator}\ ${line.separator} #------------------------------------------------------------ diff --git a/jaxws/build.xml b/jaxws/build.xml index f000420aa90..b14eb6b8bd8 100644 --- a/jaxws/build.xml +++ b/jaxws/build.xml @@ -49,6 +49,13 @@ + + + + + @@ -131,6 +138,16 @@ description="Populate all source file directories"> + + + + + + + + @@ -142,7 +159,7 @@ - + diff --git a/jaxws/jaxws.properties b/jaxws/jaxws.properties index 3dfffb135e9..1c77d79d21c 100644 --- a/jaxws/jaxws.properties +++ b/jaxws/jaxws.properties @@ -23,15 +23,17 @@ # have any questions. # -drops.master.copy.base=${devtools}/share/jdk7-drops +drops.master.copy.base=${drops.dir} drops.master.url.base=http://kenai.com/projects/jdk7-drops/downloads/download jaxws_src.bundle.name=jdk7-jaxws-2009_09_28.zip +jaxws_src.bundle.md5.checksum=f5010ebf636db9f465a61a7a74944543 jaxws_src.master.bundle.dir=${drops.master.copy.base} #jaxws_src.bundle.url.base=https://jaxws.dev.java.net/files/documents/913/142147 jaxws_src.master.bundle.url.base=${drops.master.url.base} jaf_src.bundle.name=jdk7-jaf-2009_08_28.zip +jaf_src.bundle.md5.checksum=eb8cb7a4a7f14e211fbe2354878a2472 jaf_src.master.bundle.dir=${drops.master.copy.base} jaf_src.master.bundle.url.base=${drops.master.url.base} diff --git a/jaxws/make/Makefile b/jaxws/make/Makefile index 74bd74b10fd..071a434a358 100644 --- a/jaxws/make/Makefile +++ b/jaxws/make/Makefile @@ -86,15 +86,22 @@ else endif endif -# Where is /java/devtools in case we need it -ifdef ALT_JDK_DEVTOOLS_DIR - _DEVTOOLS = $(ALT_JDK_DEVTOOLS_DIR) +# Do we have the drops already downloaded? +# Check ALT_DROPS_DIR for a full path first, +# before trying to use the devtools path, +# either via ALT_JDK_DEVTOOLS_DIR or /java/devtools. +ifdef ALT_DROPS_DIR + DROPS_DIR = $(ALT_DROPS_DIR) else - _DEVTOOLS = $(_SLASHJAVA)/devtools + ifdef ALT_JDK_DEVTOOLS_DIR + DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk7-drops + else + DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk7-drops + endif endif -# Add in path to devtools -ANT_OPTIONS += -Ddevtools=$(_DEVTOOLS) +# Add in path to drops already downloaded +ANT_OPTIONS += -Ddrops.dir=$(DROPS_DIR) ifdef ALT_OUTPUTDIR OUTPUTDIR = $(ALT_OUTPUTDIR) @@ -130,7 +137,7 @@ endif default: all # All ant targets of interest -ANT_TARGETS = all source build dist clobber clean sanity +ANT_TARGETS = all source drop_included build dist clobber clean sanity # Create a make target for each $(ANT_TARGETS): diff --git a/jaxws/src/share/classes/META-INF/mailcap.default b/jaxws/src/share/classes/META-INF/mailcap.default deleted file mode 100644 index 542de7deb93..00000000000 --- a/jaxws/src/share/classes/META-INF/mailcap.default +++ /dev/null @@ -1,7 +0,0 @@ -# -# This is a very simple 'mailcap' file -# -image/gif;; x-java-view=com.sun.activation.viewers.ImageViewer -image/jpeg;; x-java-view=com.sun.activation.viewers.ImageViewer -text/*;; x-java-view=com.sun.activation.viewers.TextViewer -text/*;; x-java-edit=com.sun.activation.viewers.TextEditor diff --git a/jaxws/src/share/classes/META-INF/mimetypes.default b/jaxws/src/share/classes/META-INF/mimetypes.default deleted file mode 100644 index 0c22eb2efb8..00000000000 --- a/jaxws/src/share/classes/META-INF/mimetypes.default +++ /dev/null @@ -1,24 +0,0 @@ -# -# A simple, old format, mime.types file -# -text/html html htm HTML HTM -text/plain txt text TXT TEXT -image/gif gif GIF -image/ief ief -image/jpeg jpeg jpg jpe JPG -image/tiff tiff tif -image/x-xwindowdump xwd -application/postscript ai eps ps -application/rtf rtf -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -audio/basic au -audio/midi midi mid -audio/x-aifc aifc -audio/x-aiff aif aiff -audio/x-mpeg mpeg mpg -audio/x-wav wav -video/mpeg mpeg mpg mpe -video/quicktime qt mov -video/x-msvideo avi diff --git a/jaxws/src/share/classes/com/sun/activation/registries/LogSupport.java b/jaxws/src/share/classes/com/sun/activation/registries/LogSupport.java deleted file mode 100644 index dfc4f07c78a..00000000000 --- a/jaxws/src/share/classes/com/sun/activation/registries/LogSupport.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.activation.registries; - -import java.io.*; -import java.util.logging.*; - -/** - * Logging related methods. - */ -public class LogSupport { - private static boolean debug = false; - private static Logger logger; - private static final Level level = Level.FINE; - - static { - try { - debug = Boolean.getBoolean("javax.activation.debug"); - } catch (Throwable t) { - // ignore any errors - } - logger = Logger.getLogger("javax.activation"); - } - - /** - * Constructor. - */ - private LogSupport() { - // private constructor, can't create instances - } - - public static void log(String msg) { - if (debug) - System.out.println(msg); - logger.log(level, msg); - } - - public static void log(String msg, Throwable t) { - if (debug) - System.out.println(msg + "; Exception: " + t); - logger.log(level, msg, t); - } - - public static boolean isLoggable() { - return debug || logger.isLoggable(level); - } -} diff --git a/jaxws/src/share/classes/com/sun/activation/registries/MailcapFile.java b/jaxws/src/share/classes/com/sun/activation/registries/MailcapFile.java deleted file mode 100644 index 5fd26866922..00000000000 --- a/jaxws/src/share/classes/com/sun/activation/registries/MailcapFile.java +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.activation.registries; - -import java.io.*; -import java.util.*; - -public class MailcapFile { - - /** - * A Map indexed by MIME type (string) that references - * a Map of commands for each type. The comand Map - * is indexed by the command name and references a List of - * class names (strings) for each command. - */ - private Map type_hash = new HashMap(); - - /** - * Another Map like above, but for fallback entries. - */ - private Map fallback_hash = new HashMap(); - - /** - * A Map indexed by MIME type (string) that references - * a List of native commands (string) corresponding to the type. - */ - private Map native_commands = new HashMap(); - - private static boolean addReverse = false; - - static { - try { - addReverse = Boolean.getBoolean("javax.activation.addreverse"); - } catch (Throwable t) { - // ignore any errors - } - } - - /** - * The constructor that takes a filename as an argument. - * - * @param new_fname The file name of the mailcap file. - */ - public MailcapFile(String new_fname) throws IOException { - if (LogSupport.isLoggable()) - LogSupport.log("new MailcapFile: file " + new_fname); - FileReader reader = null; - try { - reader = new FileReader(new_fname); - parse(new BufferedReader(reader)); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ex) { } - } - } - } - - /** - * The constructor that takes an input stream as an argument. - * - * @param is the input stream - */ - public MailcapFile(InputStream is) throws IOException { - if (LogSupport.isLoggable()) - LogSupport.log("new MailcapFile: InputStream"); - parse(new BufferedReader(new InputStreamReader(is, "iso-8859-1"))); - } - - /** - * Mailcap file default constructor. - */ - public MailcapFile() { - if (LogSupport.isLoggable()) - LogSupport.log("new MailcapFile: default"); - } - - /** - * Get the Map of MailcapEntries based on the MIME type. - * - *

- * Semantics: First check for the literal mime type, - * if that fails looks for wildcard /\* and return that. Return the - * list of all that hit. - */ - public Map getMailcapList(String mime_type) { - Map search_result = null; - Map wildcard_result = null; - - // first try the literal - search_result = (Map)type_hash.get(mime_type); - - // ok, now try the wildcard - int separator = mime_type.indexOf('/'); - String subtype = mime_type.substring(separator + 1); - if (!subtype.equals("*")) { - String type = mime_type.substring(0, separator + 1) + "*"; - wildcard_result = (Map)type_hash.get(type); - - if (wildcard_result != null) { // damn, we have to merge!!! - if (search_result != null) - search_result = - mergeResults(search_result, wildcard_result); - else - search_result = wildcard_result; - } - } - return search_result; - } - - /** - * Get the Map of fallback MailcapEntries based on the MIME type. - * - *

- * Semantics: First check for the literal mime type, - * if that fails looks for wildcard /\* and return that. Return the - * list of all that hit. - */ - public Map getMailcapFallbackList(String mime_type) { - Map search_result = null; - Map wildcard_result = null; - - // first try the literal - search_result = (Map)fallback_hash.get(mime_type); - - // ok, now try the wildcard - int separator = mime_type.indexOf('/'); - String subtype = mime_type.substring(separator + 1); - if (!subtype.equals("*")) { - String type = mime_type.substring(0, separator + 1) + "*"; - wildcard_result = (Map)fallback_hash.get(type); - - if (wildcard_result != null) { // damn, we have to merge!!! - if (search_result != null) - search_result = - mergeResults(search_result, wildcard_result); - else - search_result = wildcard_result; - } - } - return search_result; - } - - /** - * Return all the MIME types known to this mailcap file. - */ - public String[] getMimeTypes() { - Set types = new HashSet(type_hash.keySet()); - types.addAll(fallback_hash.keySet()); - types.addAll(native_commands.keySet()); - String[] mts = new String[types.size()]; - mts = (String[])types.toArray(mts); - return mts; - } - - /** - * Return all the native comands for the given MIME type. - */ - public String[] getNativeCommands(String mime_type) { - String[] cmds = null; - List v = - (List)native_commands.get(mime_type.toLowerCase(Locale.ENGLISH)); - if (v != null) { - cmds = new String[v.size()]; - cmds = (String[])v.toArray(cmds); - } - return cmds; - } - - /** - * Merge the first hash into the second. - * This merge will only effect the hashtable that is - * returned, we don't want to touch the one passed in since - * its integrity must be maintained. - */ - private Map mergeResults(Map first, Map second) { - Iterator verb_enum = second.keySet().iterator(); - Map clonedHash = new HashMap(first); - - // iterate through the verbs in the second map - while (verb_enum.hasNext()) { - String verb = (String)verb_enum.next(); - List cmdVector = (List)clonedHash.get(verb); - if (cmdVector == null) { - clonedHash.put(verb, second.get(verb)); - } else { - // merge the two - List oldV = (List)second.get(verb); - cmdVector = new ArrayList(cmdVector); - cmdVector.addAll(oldV); - clonedHash.put(verb, cmdVector); - } - } - return clonedHash; - } - - /** - * appendToMailcap: Append to this Mailcap DB, use the mailcap - * format: - * Comment == "# comment string - * Entry == "mimetype; javabeanclass - * - * Example: - * # this is a comment - * image/gif jaf.viewers.ImageViewer - */ - public void appendToMailcap(String mail_cap) { - if (LogSupport.isLoggable()) - LogSupport.log("appendToMailcap: " + mail_cap); - try { - parse(new StringReader(mail_cap)); - } catch (IOException ex) { - // can't happen - } - } - - /** - * parse file into a hash table of MC Type Entry Obj - */ - private void parse(Reader reader) throws IOException { - BufferedReader buf_reader = new BufferedReader(reader); - String line = null; - String continued = null; - - while ((line = buf_reader.readLine()) != null) { - // LogSupport.log("parsing line: " + line); - - line = line.trim(); - - try { - if (line.charAt(0) == '#') - continue; - if (line.charAt(line.length() - 1) == '\\') { - if (continued != null) - continued += line.substring(0, line.length() - 1); - else - continued = line.substring(0, line.length() - 1); - } else if (continued != null) { - // handle the two strings - continued = continued + line; - // LogSupport.log("parse: " + continued); - try { - parseLine(continued); - } catch (MailcapParseException e) { - //e.printStackTrace(); - } - continued = null; - } - else { - // LogSupport.log("parse: " + line); - try { - parseLine(line); - // LogSupport.log("hash.size = " + type_hash.size()); - } catch (MailcapParseException e) { - //e.printStackTrace(); - } - } - } catch (StringIndexOutOfBoundsException e) {} - } - } - - /** - * A routine to parse individual entries in a Mailcap file. - * - * Note that this routine does not handle line continuations. - * They should have been handled prior to calling this routine. - */ - protected void parseLine(String mailcapEntry) - throws MailcapParseException, IOException { - MailcapTokenizer tokenizer = new MailcapTokenizer(mailcapEntry); - tokenizer.setIsAutoquoting(false); - - if (LogSupport.isLoggable()) - LogSupport.log("parse: " + mailcapEntry); - // parse the primary type - int currentToken = tokenizer.nextToken(); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, currentToken, - tokenizer.getCurrentTokenValue()); - } - String primaryType = - tokenizer.getCurrentTokenValue().toLowerCase(Locale.ENGLISH); - String subType = "*"; - - // parse the '/' between primary and sub - // if it's not present that's ok, we just don't have a subtype - currentToken = tokenizer.nextToken(); - if ((currentToken != MailcapTokenizer.SLASH_TOKEN) && - (currentToken != MailcapTokenizer.SEMICOLON_TOKEN)) { - reportParseError(MailcapTokenizer.SLASH_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, currentToken, - tokenizer.getCurrentTokenValue()); - } - - // only need to look for a sub type if we got a '/' - if (currentToken == MailcapTokenizer.SLASH_TOKEN) { - // parse the sub type - currentToken = tokenizer.nextToken(); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - subType = - tokenizer.getCurrentTokenValue().toLowerCase(Locale.ENGLISH); - - // get the next token to simplify the next step - currentToken = tokenizer.nextToken(); - } - - String mimeType = primaryType + "/" + subType; - - if (LogSupport.isLoggable()) - LogSupport.log(" Type: " + mimeType); - - // now setup the commands hashtable - Map commands = new LinkedHashMap(); // keep commands in order found - - // parse the ';' that separates the type from the parameters - if (currentToken != MailcapTokenizer.SEMICOLON_TOKEN) { - reportParseError(MailcapTokenizer.SEMICOLON_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - // eat it - - // parse the required view command - tokenizer.setIsAutoquoting(true); - currentToken = tokenizer.nextToken(); - tokenizer.setIsAutoquoting(false); - if ((currentToken != MailcapTokenizer.STRING_TOKEN) && - (currentToken != MailcapTokenizer.SEMICOLON_TOKEN)) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, currentToken, - tokenizer.getCurrentTokenValue()); - } - - if (currentToken == MailcapTokenizer.STRING_TOKEN) { - // have a native comand, save the entire mailcap entry - //String nativeCommand = tokenizer.getCurrentTokenValue(); - List v = (List)native_commands.get(mimeType); - if (v == null) { - v = new ArrayList(); - v.add(mailcapEntry); - native_commands.put(mimeType, v); - } else { - // XXX - check for duplicates? - v.add(mailcapEntry); - } - } - - // only have to get the next token if the current one isn't a ';' - if (currentToken != MailcapTokenizer.SEMICOLON_TOKEN) { - currentToken = tokenizer.nextToken(); - } - - // look for a ';' which will indicate whether - // a parameter list is present or not - if (currentToken == MailcapTokenizer.SEMICOLON_TOKEN) { - boolean isFallback = false; - do { - // eat the ';' - - // parse the parameter name - currentToken = tokenizer.nextToken(); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - String paramName = tokenizer.getCurrentTokenValue(). - toLowerCase(Locale.ENGLISH); - - // parse the '=' which separates the name from the value - currentToken = tokenizer.nextToken(); - if ((currentToken != MailcapTokenizer.EQUALS_TOKEN) && - (currentToken != MailcapTokenizer.SEMICOLON_TOKEN) && - (currentToken != MailcapTokenizer.EOI_TOKEN)) { - reportParseError(MailcapTokenizer.EQUALS_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, - MailcapTokenizer.EOI_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - - // we only have a useful command if it is named - if (currentToken == MailcapTokenizer.EQUALS_TOKEN) { - // eat it - - // parse the parameter value (which is autoquoted) - tokenizer.setIsAutoquoting(true); - currentToken = tokenizer.nextToken(); - tokenizer.setIsAutoquoting(false); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - String paramValue = - tokenizer.getCurrentTokenValue(); - - // add the class to the list iff it is one we care about - if (paramName.startsWith("x-java-")) { - String commandName = paramName.substring(7); - // 7 == "x-java-".length - - if (commandName.equals("fallback-entry") && - paramValue.equalsIgnoreCase("true")) { - isFallback = true; - } else { - - // setup the class entry list - if (LogSupport.isLoggable()) - LogSupport.log(" Command: " + commandName + - ", Class: " + paramValue); - List classes = (List)commands.get(commandName); - if (classes == null) { - classes = new ArrayList(); - commands.put(commandName, classes); - } - if (addReverse) - classes.add(0, paramValue); - else - classes.add(paramValue); - } - } - - // set up the next iteration - currentToken = tokenizer.nextToken(); - } - } while (currentToken == MailcapTokenizer.SEMICOLON_TOKEN); - - Map masterHash = isFallback ? fallback_hash : type_hash; - Map curcommands = - (Map)masterHash.get(mimeType); - if (curcommands == null) { - masterHash.put(mimeType, commands); - } else { - if (LogSupport.isLoggable()) - LogSupport.log("Merging commands for type " + mimeType); - // have to merge current and new commands - // first, merge list of classes for commands already known - Iterator cn = curcommands.keySet().iterator(); - while (cn.hasNext()) { - String cmdName = (String)cn.next(); - List ccv = (List)curcommands.get(cmdName); - List cv = (List)commands.get(cmdName); - if (cv == null) - continue; - // add everything in cv to ccv, if it's not already there - Iterator cvn = cv.iterator(); - while (cvn.hasNext()) { - String clazz = (String)cvn.next(); - if (!ccv.contains(clazz)) - if (addReverse) - ccv.add(0, clazz); - else - ccv.add(clazz); - } - } - // now, add commands not previously known - cn = commands.keySet().iterator(); - while (cn.hasNext()) { - String cmdName = (String)cn.next(); - if (curcommands.containsKey(cmdName)) - continue; - List cv = (List)commands.get(cmdName); - curcommands.put(cmdName, cv); - } - } - } else if (currentToken != MailcapTokenizer.EOI_TOKEN) { - reportParseError(MailcapTokenizer.EOI_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - } - - protected static void reportParseError(int expectedToken, int actualToken, - String actualTokenValue) throws MailcapParseException { - throw new MailcapParseException("Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + " token."); - } - - protected static void reportParseError(int expectedToken, - int otherExpectedToken, int actualToken, String actualTokenValue) - throws MailcapParseException { - throw new MailcapParseException("Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + " or a " + - MailcapTokenizer.nameForToken(otherExpectedToken) + " token."); - } - - protected static void reportParseError(int expectedToken, - int otherExpectedToken, int anotherExpectedToken, int actualToken, - String actualTokenValue) throws MailcapParseException { - if (LogSupport.isLoggable()) - LogSupport.log("PARSE ERROR: " + "Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + ", a " + - MailcapTokenizer.nameForToken(otherExpectedToken) + ", or a " + - MailcapTokenizer.nameForToken(anotherExpectedToken) + " token."); - throw new MailcapParseException("Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + ", a " + - MailcapTokenizer.nameForToken(otherExpectedToken) + ", or a " + - MailcapTokenizer.nameForToken(anotherExpectedToken) + " token."); - } - - /** for debugging - public static void main(String[] args) throws Exception { - Map masterHash = new HashMap(); - for (int i = 0; i < args.length; ++i) { - System.out.println("Entry " + i + ": " + args[i]); - parseLine(args[i], masterHash); - } - - Enumeration types = masterHash.keys(); - while (types.hasMoreElements()) { - String key = (String)types.nextElement(); - System.out.println("MIME Type: " + key); - - Map commandHash = (Map)masterHash.get(key); - Enumeration commands = commandHash.keys(); - while (commands.hasMoreElements()) { - String command = (String)commands.nextElement(); - System.out.println(" Command: " + command); - - Vector classes = (Vector)commandHash.get(command); - for (int i = 0; i < classes.size(); ++i) { - System.out.println(" Class: " + - (String)classes.elementAt(i)); - } - } - - System.out.println(""); - } - } - */ -} diff --git a/jaxws/src/share/classes/com/sun/activation/registries/MailcapParseException.java b/jaxws/src/share/classes/com/sun/activation/registries/MailcapParseException.java deleted file mode 100644 index 7e05f323886..00000000000 --- a/jaxws/src/share/classes/com/sun/activation/registries/MailcapParseException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 1997 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.activation.registries; - -/** - * A class to encapsulate Mailcap parsing related exceptions - */ -public class MailcapParseException extends Exception { - - public MailcapParseException() { - super(); - } - - public MailcapParseException(String inInfo) { - super(inInfo); - } -} diff --git a/jaxws/src/share/classes/com/sun/activation/registries/MailcapTokenizer.java b/jaxws/src/share/classes/com/sun/activation/registries/MailcapTokenizer.java deleted file mode 100644 index 0da89391c1c..00000000000 --- a/jaxws/src/share/classes/com/sun/activation/registries/MailcapTokenizer.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.activation.registries; - -/** - * A tokenizer for strings in the form of "foo/bar; prop1=val1; ... ". - * Useful for parsing MIME content types. - */ -public class MailcapTokenizer { - - public static final int UNKNOWN_TOKEN = 0; - public static final int START_TOKEN = 1; - public static final int STRING_TOKEN = 2; - public static final int EOI_TOKEN = 5; - public static final int SLASH_TOKEN = '/'; - public static final int SEMICOLON_TOKEN = ';'; - public static final int EQUALS_TOKEN = '='; - - /** - * Constructor - * - * @parameter inputString the string to tokenize - */ - public MailcapTokenizer(String inputString) { - data = inputString; - dataIndex = 0; - dataLength = inputString.length(); - - currentToken = START_TOKEN; - currentTokenValue = ""; - - isAutoquoting = false; - autoquoteChar = ';'; - } - - /** - * Set whether auto-quoting is on or off. - * - * Auto-quoting means that all characters after the first - * non-whitespace, non-control character up to the auto-quote - * terminator character or EOI (minus any whitespace immediatley - * preceeding it) is considered a token. - * - * This is required for handling command strings in a mailcap entry. - */ - public void setIsAutoquoting(boolean value) { - isAutoquoting = value; - } - - /** - * Retrieve current token. - * - * @returns The current token value - */ - public int getCurrentToken() { - return currentToken; - } - - /* - * Get a String that describes the given token. - */ - public static String nameForToken(int token) { - String name = "really unknown"; - - switch(token) { - case UNKNOWN_TOKEN: - name = "unknown"; - break; - case START_TOKEN: - name = "start"; - break; - case STRING_TOKEN: - name = "string"; - break; - case EOI_TOKEN: - name = "EOI"; - break; - case SLASH_TOKEN: - name = "'/'"; - break; - case SEMICOLON_TOKEN: - name = "';'"; - break; - case EQUALS_TOKEN: - name = "'='"; - break; - } - - return name; - } - - /* - * Retrieve current token value. - * - * @returns A String containing the current token value - */ - public String getCurrentTokenValue() { - return currentTokenValue; - } - /* - * Process the next token. - * - * @returns the next token - */ - public int nextToken() { - if (dataIndex < dataLength) { - // skip white space - while ((dataIndex < dataLength) && - (isWhiteSpaceChar(data.charAt(dataIndex)))) { - ++dataIndex; - } - - if (dataIndex < dataLength) { - // examine the current character and see what kind of token we have - char c = data.charAt(dataIndex); - if (isAutoquoting) { - if (c == ';' || c == '=') { - currentToken = c; - currentTokenValue = new Character(c).toString(); - ++dataIndex; - } else { - processAutoquoteToken(); - } - } else { - if (isStringTokenChar(c)) { - processStringToken(); - } else if ((c == '/') || (c == ';') || (c == '=')) { - currentToken = c; - currentTokenValue = new Character(c).toString(); - ++dataIndex; - } else { - currentToken = UNKNOWN_TOKEN; - currentTokenValue = new Character(c).toString(); - ++dataIndex; - } - } - } else { - currentToken = EOI_TOKEN; - currentTokenValue = null; - } - } else { - currentToken = EOI_TOKEN; - currentTokenValue = null; - } - - return currentToken; - } - - private void processStringToken() { - // capture the initial index - int initialIndex = dataIndex; - - // skip to 1st non string token character - while ((dataIndex < dataLength) && - isStringTokenChar(data.charAt(dataIndex))) { - ++dataIndex; - } - - currentToken = STRING_TOKEN; - currentTokenValue = data.substring(initialIndex, dataIndex); - } - - private void processAutoquoteToken() { - // capture the initial index - int initialIndex = dataIndex; - - // now skip to the 1st non-escaped autoquote termination character - // XXX - doesn't actually consider escaping - boolean foundTerminator = false; - while ((dataIndex < dataLength) && !foundTerminator) { - char c = data.charAt(dataIndex); - if (c != autoquoteChar) { - ++dataIndex; - } else { - foundTerminator = true; - } - } - - currentToken = STRING_TOKEN; - currentTokenValue = - fixEscapeSequences(data.substring(initialIndex, dataIndex)); - } - - private static boolean isSpecialChar(char c) { - boolean lAnswer = false; - - switch(c) { - case '(': - case ')': - case '<': - case '>': - case '@': - case ',': - case ';': - case ':': - case '\\': - case '"': - case '/': - case '[': - case ']': - case '?': - case '=': - lAnswer = true; - break; - } - - return lAnswer; - } - - private static boolean isControlChar(char c) { - return Character.isISOControl(c); - } - - private static boolean isWhiteSpaceChar(char c) { - return Character.isWhitespace(c); - } - - private static boolean isStringTokenChar(char c) { - return !isSpecialChar(c) && !isControlChar(c) && !isWhiteSpaceChar(c); - } - - private static String fixEscapeSequences(String inputString) { - int inputLength = inputString.length(); - StringBuffer buffer = new StringBuffer(); - buffer.ensureCapacity(inputLength); - - for (int i = 0; i < inputLength; ++i) { - char currentChar = inputString.charAt(i); - if (currentChar != '\\') { - buffer.append(currentChar); - } else { - if (i < inputLength - 1) { - char nextChar = inputString.charAt(i + 1); - buffer.append(nextChar); - - // force a skip over the next character too - ++i; - } else { - buffer.append(currentChar); - } - } - } - - return buffer.toString(); - } - - private String data; - private int dataIndex; - private int dataLength; - private int currentToken; - private String currentTokenValue; - private boolean isAutoquoting; - private char autoquoteChar; - - /* - public static void main(String[] args) { - for (int i = 0; i < args.length; ++i) { - MailcapTokenizer tokenizer = new MailcapTokenizer(args[i]); - - System.out.println("Original: |" + args[i] + "|"); - - int currentToken = tokenizer.nextToken(); - while (currentToken != EOI_TOKEN) { - switch(currentToken) { - case UNKNOWN_TOKEN: - System.out.println(" Unknown Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case START_TOKEN: - System.out.println(" Start Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case STRING_TOKEN: - System.out.println(" String Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case EOI_TOKEN: - System.out.println(" EOI Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case SLASH_TOKEN: - System.out.println(" Slash Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case SEMICOLON_TOKEN: - System.out.println(" Semicolon Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case EQUALS_TOKEN: - System.out.println(" Equals Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - default: - System.out.println(" Really Unknown Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - } - - currentToken = tokenizer.nextToken(); - } - - System.out.println(""); - } - } - */ -} diff --git a/jaxws/src/share/classes/com/sun/activation/registries/MimeTypeEntry.java b/jaxws/src/share/classes/com/sun/activation/registries/MimeTypeEntry.java deleted file mode 100644 index 4ce1182ae9a..00000000000 --- a/jaxws/src/share/classes/com/sun/activation/registries/MimeTypeEntry.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 1997-1998 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.activation.registries; - -import java.lang.*; - -public class MimeTypeEntry { - private String type; - private String extension; - - public MimeTypeEntry(String mime_type, String file_ext) { - type = mime_type; - extension = file_ext; - } - - public String getMIMEType() { - return type; - } - - public String getFileExtension() { - return extension; - } - - public String toString() { - return "MIMETypeEntry: " + type + ", " + extension; - } -} diff --git a/jaxws/src/share/classes/com/sun/activation/registries/MimeTypeFile.java b/jaxws/src/share/classes/com/sun/activation/registries/MimeTypeFile.java deleted file mode 100644 index 96416dc0696..00000000000 --- a/jaxws/src/share/classes/com/sun/activation/registries/MimeTypeFile.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.activation.registries; - -import java.io.*; -import java.util.*; - -public class MimeTypeFile { - private String fname = null; - private Hashtable type_hash = new Hashtable(); - - /** - * The construtor that takes a filename as an argument. - * - * @param new_fname The file name of the mime types file. - */ - public MimeTypeFile(String new_fname) throws IOException { - File mime_file = null; - FileReader fr = null; - - fname = new_fname; // remember the file name - - mime_file = new File(fname); // get a file object - - fr = new FileReader(mime_file); - - try { - parse(new BufferedReader(fr)); - } finally { - try { - fr.close(); // close it - } catch (IOException e) { - // ignore it - } - } - } - - public MimeTypeFile(InputStream is) throws IOException { - parse(new BufferedReader(new InputStreamReader(is, "iso-8859-1"))); - } - - /** - * Creates an empty DB. - */ - public MimeTypeFile() { - } - - /** - * get the MimeTypeEntry based on the file extension - */ - public MimeTypeEntry getMimeTypeEntry(String file_ext) { - return (MimeTypeEntry)type_hash.get((Object)file_ext); - } - - /** - * Get the MIME type string corresponding to the file extension. - */ - public String getMIMETypeString(String file_ext) { - MimeTypeEntry entry = this.getMimeTypeEntry(file_ext); - - if (entry != null) - return entry.getMIMEType(); - else - return null; - } - - /** - * Appends string of entries to the types registry, must be valid - * .mime.types format. - * A mime.types entry is one of two forms: - * - * type/subtype ext1 ext2 ... - * or - * type=type/subtype desc="description of type" exts=ext1,ext2,... - * - * Example: - * # this is a test - * audio/basic au - * text/plain txt text - * type=application/postscript exts=ps,eps - */ - public void appendToRegistry(String mime_types) { - try { - parse(new BufferedReader(new StringReader(mime_types))); - } catch (IOException ex) { - // can't happen - } - } - - /** - * Parse a stream of mime.types entries. - */ - private void parse(BufferedReader buf_reader) throws IOException { - String line = null, prev = null; - - while ((line = buf_reader.readLine()) != null) { - if (prev == null) - prev = line; - else - prev += line; - int end = prev.length(); - if (prev.length() > 0 && prev.charAt(end - 1) == '\\') { - prev = prev.substring(0, end - 1); - continue; - } - this.parseEntry(prev); - prev = null; - } - if (prev != null) - this.parseEntry(prev); - } - - /** - * Parse single mime.types entry. - */ - private void parseEntry(String line) { - String mime_type = null; - String file_ext = null; - line = line.trim(); - - if (line.length() == 0) // empty line... - return; // BAIL! - - // check to see if this is a comment line? - if (line.charAt(0) == '#') - return; // then we are done! - - // is it a new format line or old format? - if (line.indexOf('=') > 0) { - // new format - LineTokenizer lt = new LineTokenizer(line); - while (lt.hasMoreTokens()) { - String name = lt.nextToken(); - String value = null; - if (lt.hasMoreTokens() && lt.nextToken().equals("=") && - lt.hasMoreTokens()) - value = lt.nextToken(); - if (value == null) { - if (LogSupport.isLoggable()) - LogSupport.log("Bad .mime.types entry: " + line); - return; - } - if (name.equals("type")) - mime_type = value; - else if (name.equals("exts")) { - StringTokenizer st = new StringTokenizer(value, ","); - while (st.hasMoreTokens()) { - file_ext = st.nextToken(); - MimeTypeEntry entry = - new MimeTypeEntry(mime_type, file_ext); - type_hash.put(file_ext, entry); - if (LogSupport.isLoggable()) - LogSupport.log("Added: " + entry.toString()); - } - } - } - } else { - // old format - // count the tokens - StringTokenizer strtok = new StringTokenizer(line); - int num_tok = strtok.countTokens(); - - if (num_tok == 0) // empty line - return; - - mime_type = strtok.nextToken(); // get the MIME type - - while (strtok.hasMoreTokens()) { - MimeTypeEntry entry = null; - - file_ext = strtok.nextToken(); - entry = new MimeTypeEntry(mime_type, file_ext); - type_hash.put(file_ext, entry); - if (LogSupport.isLoggable()) - LogSupport.log("Added: " + entry.toString()); - } - } - } - - // for debugging - /* - public static void main(String[] argv) throws Exception { - MimeTypeFile mf = new MimeTypeFile(argv[0]); - System.out.println("ext " + argv[1] + " type " + - mf.getMIMETypeString(argv[1])); - System.exit(0); - } - */ -} - -class LineTokenizer { - private int currentPosition; - private int maxPosition; - private String str; - private Vector stack = new Vector(); - private static final String singles = "="; // single character tokens - - /** - * Constructs a tokenizer for the specified string. - *

- * - * @param str a string to be parsed. - */ - public LineTokenizer(String str) { - currentPosition = 0; - this.str = str; - maxPosition = str.length(); - } - - /** - * Skips white space. - */ - private void skipWhiteSpace() { - while ((currentPosition < maxPosition) && - Character.isWhitespace(str.charAt(currentPosition))) { - currentPosition++; - } - } - - /** - * Tests if there are more tokens available from this tokenizer's string. - * - * @return true if there are more tokens available from this - * tokenizer's string; false otherwise. - */ - public boolean hasMoreTokens() { - if (stack.size() > 0) - return true; - skipWhiteSpace(); - return (currentPosition < maxPosition); - } - - /** - * Returns the next token from this tokenizer. - * - * @return the next token from this tokenizer. - * @exception NoSuchElementException if there are no more tokens in this - * tokenizer's string. - */ - public String nextToken() { - int size = stack.size(); - if (size > 0) { - String t = (String)stack.elementAt(size - 1); - stack.removeElementAt(size - 1); - return t; - } - skipWhiteSpace(); - - if (currentPosition >= maxPosition) { - throw new NoSuchElementException(); - } - - int start = currentPosition; - char c = str.charAt(start); - if (c == '"') { - currentPosition++; - boolean filter = false; - while (currentPosition < maxPosition) { - c = str.charAt(currentPosition++); - if (c == '\\') { - currentPosition++; - filter = true; - } else if (c == '"') { - String s; - - if (filter) { - StringBuffer sb = new StringBuffer(); - for (int i = start + 1; i < currentPosition - 1; i++) { - c = str.charAt(i); - if (c != '\\') - sb.append(c); - } - s = sb.toString(); - } else - s = str.substring(start + 1, currentPosition - 1); - return s; - } - } - } else if (singles.indexOf(c) >= 0) { - currentPosition++; - } else { - while ((currentPosition < maxPosition) && - singles.indexOf(str.charAt(currentPosition)) < 0 && - !Character.isWhitespace(str.charAt(currentPosition))) { - currentPosition++; - } - } - return str.substring(start, currentPosition); - } - - public void pushToken(String token) { - stack.addElement(token); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/ClassType.java b/jaxws/src/share/classes/com/sun/codemodel/internal/ClassType.java deleted file mode 100644 index 845fbdb0292..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/ClassType.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; -/** - * This helps enable whether the JDefinedClass is a Class or Interface or - * AnnotationTypeDeclaration or Enum - * - * @author - * Bhakti Mehta (bhakti.mehta@sun.com) - */ -public final class ClassType { - - /** - * The keyword used to declare this type. - */ - final String declarationToken; - - private ClassType(String token) { - this.declarationToken = token; - } - - public static final ClassType CLASS = new ClassType("class"); - public static final ClassType INTERFACE = new ClassType("interface"); - public static final ClassType ANNOTATION_TYPE_DECL = new ClassType("@interface"); - public static final ClassType ENUM = new ClassType("enum"); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/CodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/CodeWriter.java deleted file mode 100644 index 602e8ecb725..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/CodeWriter.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.CharsetEncoder; - -import com.sun.codemodel.internal.util.EncoderFactory; -import com.sun.codemodel.internal.util.UnicodeEscapeWriter; - -/** - * Receives generated code and writes to the appropriate storage. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public abstract class CodeWriter { - - /** - * Called by CodeModel to store the specified file. - * The callee must allocate a storage to store the specified file. - * - *

- * The returned stream will be closed before the next file is - * stored. So the callee can assume that only one OutputStream - * is active at any given time. - * - * @param pkg - * The package of the file to be written. - * @param fileName - * File name without the path. Something like - * "Foo.java" or "Bar.properties" - */ - public abstract OutputStream openBinary( JPackage pkg, String fileName ) throws IOException; - - /** - * Called by CodeModel to store the specified file. - * The callee must allocate a storage to store the specified file. - * - *

- * The returned stream will be closed before the next file is - * stored. So the callee can assume that only one OutputStream - * is active at any given time. - * - * @param pkg - * The package of the file to be written. - * @param fileName - * File name without the path. Something like - * "Foo.java" or "Bar.properties" - */ - public Writer openSource( JPackage pkg, String fileName ) throws IOException { - final OutputStreamWriter bw = new OutputStreamWriter(openBinary(pkg,fileName)); - - // create writer - try { - return new UnicodeEscapeWriter(bw) { - // can't change this signature to Encoder because - // we can't have Encoder in method signature - private final CharsetEncoder encoder = EncoderFactory.createEncoder(bw.getEncoding()); - protected boolean requireEscaping(int ch) { - // control characters - if( ch<0x20 && " \t\r\n".indexOf(ch)==-1 ) return true; - // check ASCII chars, for better performance - if( ch<0x80 ) return false; - - return !encoder.canEncode((char)ch); - } - }; - } catch( Throwable t ) { - return new UnicodeEscapeWriter(bw); - } - } - - /** - * Called by CodeModel at the end of the process. - */ - public abstract void close() throws IOException; -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotatable.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotatable.java deleted file mode 100644 index 4a6f908a595..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotatable.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.lang.annotation.Annotation; - -/** - * Annotatable program elements. - * - * @author Kohsuke Kawaguchi - */ -public interface JAnnotatable { - /** - * Adds an annotation to this program element. - * @param clazz - * The annotation class to annotate the program element with - */ - JAnnotationUse annotate(JClass clazz); - - /** - * Adds an annotation to this program element. - * - * @param clazz - * The annotation class to annotate the program element with - */ - JAnnotationUse annotate(Class clazz); - - /** - * Adds an annotation to this program element - * and returns a type-safe writer to fill in the values of such annotations. - */ - W annotate2(Class clazz); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java deleted file mode 100644 index 01b766f0cc6..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents an arrays as annotation members - * - *

- * This class implements {@link JAnnotatable} to allow - * new annotations to be added as a member of the array. - * - * @author - * Bhakti Mehta (bhakti.mehta@sun.com) - */ -public final class JAnnotationArrayMember extends JAnnotationValue implements JAnnotatable { - private final List values = new ArrayList(); - private final JCodeModel owner; - - JAnnotationArrayMember(JCodeModel owner) { - this.owner = owner; - } - - /** - * Adds an array member to this annotation - * - * @param value Adds a string value to the array member - * @return The JAnnotationArrayMember. More elements can be added by calling - * the same method multiple times - */ - public JAnnotationArrayMember param(String value) { - JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value)); - values.add(annotationValue); - return this; - } - - public JAnnotationArrayMember param(boolean value) { - JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value)); - values.add(annotationValue); - return this; - } - - /** - * Adds an array member to this annotation - * - * @param value Adds an int value to the array member - * @return The JAnnotationArrayMember. More elements can be added by calling - * the same method multiple times - */ - public JAnnotationArrayMember param(int value) { - JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value)); - values.add(annotationValue); - return this; - } - - /** - * Adds an array member to this annotation - * - * @param value Adds a float value to the array member - * @return The JAnnotationArrayMember. More elements can be added by calling - * the same method multiple times - */ - public JAnnotationArrayMember param(float value) { - JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value)); - values.add(annotationValue); - return this; - } - - public JAnnotationArrayMember param(Class value){ - JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value.getName())); - values.add(annotationValue); - return this; - } - - public JAnnotationArrayMember param(JType type){ - JClass clazz = type.boxify(); - JAnnotationValue annotationValue = new JAnnotationStringValue ( clazz.dotclass() ); - values.add(annotationValue); - return this; - } - - /** - * Adds a new annotation to the array. - */ - public JAnnotationUse annotate(Class clazz){ - return annotate(owner.ref(clazz)); - } - - /** - * Adds a new annotation to the array. - */ - public JAnnotationUse annotate(JClass clazz){ - JAnnotationUse a = new JAnnotationUse(clazz); - values.add(a); - return a; - } - - public W annotate2(Class clazz) { - return TypedAnnotationWriter.create(clazz,this); - } - - /** - * Adds an annotation member to this annotation array - * This can be used for e.g @XmlCollection(values= @XmlCollectionItem(type=Foo.class)) - * @param value - * Adds a annotation to the array member - * @return - * The JAnnotationArrayMember. More elements can be added by calling - * the same method multiple times - * - * @deprecated - * use {@link #annotate} - */ - public JAnnotationArrayMember param (JAnnotationUse value ){ - values.add(value); - return this; - } - - public void generate(JFormatter f) { - f.p('{').nl().i(); - - boolean first = true; - for (JAnnotationValue aValue : values) { - if (!first) - f.p(',').nl(); - f.g(aValue); - first = false; - } - f.nl().o().p('}'); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationStringValue.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationStringValue.java deleted file mode 100644 index 07cd44f73c0..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationStringValue.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - - - -/** - * Captures the value of the annotation. - * - * @author - * Bhakti Mehta (bhakti.mehta@sun.com) - */ -final class JAnnotationStringValue extends JAnnotationValue { - - /** - * The value of the Annotation member - */ - private final JExpression value; - - JAnnotationStringValue(JExpression value) { - this.value = value; - } - - public void generate(JFormatter f) { - f.g(value); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationUse.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationUse.java deleted file mode 100644 index e5275c57529..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationUse.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - - -import java.lang.annotation.Annotation; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Represents an annotation on a program element. - * - * TODO - * How to add enums to the annotations - * @author - * Bhakti Mehta (bhakti.mehta@sun.com) - */ -public final class JAnnotationUse extends JAnnotationValue { - - /** - * The {@link Annotation} class - */ - private final JClass clazz; - - /** - * Map of member values. - */ - private Map memberValues; - - JAnnotationUse(JClass clazz){ - this.clazz = clazz; - } - - private JCodeModel owner() { - return clazz.owner(); - } - - private void addValue(String name, JAnnotationValue annotationValue) { - // Use ordered map to keep the code generation the same on any JVM. - // Lazily created. - if(memberValues==null) - memberValues = new LinkedHashMap(); - memberValues.put(name,annotationValue); - } - - /** - * Adds a member value pair to this annotation - * - * @param name - * The simple name for this annotation - * - * @param value - * The boolean value for this annotation - * @return - * The JAnnotationUse. More member value pairs can - * be added to it using the same or the overloaded methods. - * - */ - public JAnnotationUse param(String name, boolean value){ - addValue(name, new JAnnotationStringValue(JExpr.lit(value))); - return this; - } - - /** - * Adds a member value pair to this annotation - * @param name - * The simple name for this annotation - * - * @param value - * The int member value for this annotation - * @return - * The JAnnotationUse. More member value pairs can - * be added to it using the same or the overloaded methods. - * - */ - public JAnnotationUse param(String name, int value){ - addValue(name, new JAnnotationStringValue(JExpr.lit(value))); - return this; - } - - /** - * Adds a member value pair to this annotation - * @param name - * The simple name for this annotation - * - * @param value - * The String member value for this annotation - * @return - * The JAnnotationUse. More member value pairs can - * be added to it using the same or the overloaded methods. - * - */ - public JAnnotationUse param(String name, String value){ - //Escape string values with quotes so that they can - //be generated accordingly - addValue(name, new JAnnotationStringValue(JExpr.lit(value))); - return this; - } - - /** - * Adds a member value pair to this annotation - * For adding class values as param - * @see #param(String, Class) - * @param name - * The simple name for this annotation - * - * @param value - * The annotation class which is member value for this annotation - * @return - * The JAnnotationUse. More member value pairs can - * be added to it using the same or the overloaded methods. - * - */ - public JAnnotationUse annotationParam(String name, Class value) { - JAnnotationUse annotationUse = new JAnnotationUse(owner().ref(value)); - addValue(name, annotationUse); - return annotationUse; - } - - /** - * Adds a member value pair to this annotation - * @param name - * The simple name for this annotation - * - * @param value - * The enum class which is member value for this annotation - * @return - * The JAnnotationUse. More member value pairs can - * be added to it using the same or the overloaded methods. - * - */ - public JAnnotationUse param(String name, final Enum value) { - addValue(name, new JAnnotationValue() { - public void generate(JFormatter f) { - f.t(owner().ref(value.getDeclaringClass())).p('.').p(value.name()); - } - }); - return this; - } - - /** - * Adds a member value pair to this annotation - * @param name - * The simple name for this annotation - * - * @param value - * The JEnumConstant which is member value for this annotation - * @return - * The JAnnotationUse. More member value pairs can - * be added to it using the same or the overloaded methods. - * - */ - public JAnnotationUse param(String name, JEnumConstant value){ - addValue(name, new JAnnotationStringValue(value)); - return this; - } - - /** - * Adds a member value pair to this annotation - * This can be used for e.g to specify - *

-      *        @XmlCollectionItem(type=Integer.class);
-      * 
-      * For adding a value of Class
-      * @link
-      * #annotationParam(java.lang.String, java.lang.Class)
-      * @param name
-      *        The simple name for this annotation param
-      *
-      * @param value
-      *        The class type of the param
-      * @return
-      *         The JAnnotationUse. More member value pairs can
-      *         be added to it using the same or the overloaded methods.
-      *
-      *
-      *
-      */
-     public JAnnotationUse param(String name, Class value){
-         return param(name,clazz.owner().ref(value));
-    }
-
-    /**
-     * Adds a member value pair to this annotation based on the
-     * type represented by the given JType
-     *
-     * @param name The simple name for this annotation param
-     * @param type the JType representing the actual type
-     * @return The JAnnotationUse. More member value pairs can
-     *         be added to it using the same or the overloaded methods.
-     */
-    public JAnnotationUse param(String name, JType type){
-        JClass clazz = type.boxify();
-        addValue(name, new JAnnotationStringValue ( clazz.dotclass() ));
-        return this;
-    }
-
-    /**
-     * Adds a member value pair which is of type array to this annotation
-     * @param name
-     *        The simple name for this annotation
-     *
-     * @return
-     *         The JAnnotationArrayMember. For adding array values
-     *         @see JAnnotationArrayMember
-     *
-     */
-    public JAnnotationArrayMember paramArray(String name){
-        JAnnotationArrayMember arrayMember = new JAnnotationArrayMember(owner());
-        addValue(name, arrayMember);
-        return arrayMember;
-    }
-
-
-//    /**
-//     * This can be used to add annotations inside annotations
-//     * for e.g  @XmlCollection(values= @XmlCollectionItem(type=Foo.class))
-//     * @param className
-//     *         The classname of the annotation to be included
-//     * @return
-//     *         The JAnnotationUse that can be used as a member within this JAnnotationUse
-//     * @deprecated
-//     *      use {@link JAnnotationArrayMember#annotate}
-//     */
-//    public JAnnotationUse annotate(String className) {
-//        JAnnotationUse annotationUse = new JAnnotationUse(owner().ref(className));
-//        return annotationUse;
-//    }
-
-    /**
-     * This can be used to add annotations inside annotations
-     * for e.g  @XmlCollection(values= @XmlCollectionItem(type=Foo.class))
-     * @param clazz
-     *         The annotation class to be included
-     * @return
-     *     The JAnnotationUse that can be used as a member within this JAnnotationUse
-     * @deprecated
-     *      use {@link JAnnotationArrayMember#annotate}
-     */
-    public JAnnotationUse annotate(Class  clazz) {
-         JAnnotationUse annotationUse = new JAnnotationUse(owner().ref(clazz));
-         return annotationUse;
-    }
-
-    public void generate(JFormatter f) {
-        f.p('@').g(clazz);
-        if(memberValues!=null) {
-            f.p('(');
-            boolean first = true;
-
-            if(isOptimizable()) {
-                // short form
-                f.g(memberValues.get("value"));
-            } else {
-                for (Map.Entry mapEntry : memberValues.entrySet()) {
-                    if (!first) f.p(',');
-                    f.p(mapEntry.getKey()).p('=').g(mapEntry.getValue());
-                    first = false;
-                }
-            }
-            f.p(')');
-        }
-    }
-
-    private boolean isOptimizable() {
-        return memberValues.size()==1 && memberValues.containsKey("value");
-    }
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationValue.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationValue.java
deleted file mode 100644
index a66be614977..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationValue.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.codemodel.internal;
-
-/**
- * Things that can be values of an annotation element.
- *
- * @author
- *     Bhakti Mehta (bhakti.mehta@sun.com)
- */
-public abstract class JAnnotationValue implements JGenerable {
-}
diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationWriter.java
deleted file mode 100644
index 4a53ea25f50..00000000000
--- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnnotationWriter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.codemodel.internal;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Base interface for typed annotation writer.
- *
- * 

- * Annotation compiler can generate a strongly typed annotation - * writer to assist applications to write uses of annotations. - * Such typed annotation writer interfaces all derive from - * this common interface. - * - *

- * The type parameter 'A' represents the - * @author Kohsuke Kawaguchi - */ -public interface JAnnotationWriter { - /** - * Gets the underlying annotation use object to which we are writing. - */ - JAnnotationUse getAnnotationUse(); - - /** - * The type of the annotation that this writer is writing. - */ - Class getAnnotationType(); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnonymousClass.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAnonymousClass.java deleted file mode 100644 index 440d4001d6c..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAnonymousClass.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * Anonymous class quick hack. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -class JAnonymousClass extends JDefinedClass { - - /** - * Base interface/class from which this anonymous class is built. - */ - private final JClass base; - - JAnonymousClass( JClass _base) { - super(_base.owner(), 0, null); - this.base = _base; - } - - public String fullName() { - return base.fullName(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JArray.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JArray.java deleted file mode 100644 index d10da44d93f..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JArray.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; - - -/** - * array creation and initialization. - */ -public final class JArray extends JExpressionImpl { - - private final JType type; - private final JExpression size; - private List exprs = null; - - /** - * Add an element to the array initializer - */ - public JArray add(JExpression e) { - if (exprs == null) - exprs = new ArrayList(); - exprs.add(e); - return this; - } - - JArray(JType type, JExpression size) { - this.type = type; - this.size = size; - } - - public void generate(JFormatter f) { - - // generally we produce new T[x], but when T is an array type (T=T'[]) - // then new T'[][x] is wrong. It has to be new T'[x][]. - int arrayCount = 0; - JType t = type; - - while( t.isArray() ) { - t = t.elementType(); - arrayCount++; - } - - f.p("new").g(t).p('['); - if (size != null) - f.g(size); - f.p(']'); - - for( int i=0; i _implements() { - return Collections.emptyList().iterator(); - } - - public boolean isInterface() { - return false; - } - - public boolean isAbstract() { - return false; - } - - public JType elementType() { - return componentType; - } - - public boolean isArray() { - return true; - } - - - // - // Equality is based on value - // - - public boolean equals(Object obj) { - if(!(obj instanceof JArrayClass)) return false; - - if( componentType.equals( ((JArrayClass)obj).componentType ) ) - return true; - - return false; - } - - public int hashCode() { - return componentType.hashCode(); - } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - if( componentType.isPrimitive() ) - return this; - - JClass c = ((JClass)componentType).substituteParams(variables,bindings); - if(c==componentType) - return this; - - return new JArrayClass(owner(),c); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JArrayCompRef.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JArrayCompRef.java deleted file mode 100644 index 6a433c0d4fb..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JArrayCompRef.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -/** - * array component reference. - */ -final class JArrayCompRef extends JExpressionImpl implements JAssignmentTarget { - /** - * JArray expression upon which this component will be accessed. - */ - private final JExpression array; - - /** - * Integer expression representing index of the component - */ - private final JExpression index; - - /** - * JArray component reference constructor given an array expression - * and index. - * - * @param array - * JExpression for the array upon which - * the component will be accessed, - * - * @param index - * JExpression for index of component to access - */ - JArrayCompRef(JExpression array, JExpression index) { - if ((array == null) || (index == null)) { - throw new NullPointerException(); - } - this.array = array; - this.index = index; - } - - public void generate(JFormatter f) { - f.g(array).p('[').g(index).p(']'); - } - - public JExpression assign(JExpression rhs) { - return JExpr.assign(this,rhs); - } - public JExpression assignPlus(JExpression rhs) { - return JExpr.assignPlus(this,rhs); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAssignment.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAssignment.java deleted file mode 100644 index 91bfa57a68e..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAssignment.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Assignment statements, which are also expressions. - */ -public class JAssignment extends JExpressionImpl implements JStatement { - - JAssignmentTarget lhs; - JExpression rhs; - String op = ""; - - JAssignment(JAssignmentTarget lhs, JExpression rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - JAssignment(JAssignmentTarget lhs, JExpression rhs, String op) { - this.lhs = lhs; - this.rhs = rhs; - this.op = op; - } - - public void generate(JFormatter f) { - f.g(lhs).p(op + '=').g(rhs); - } - - public void state(JFormatter f) { - f.g(this).p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAssignmentTarget.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAssignmentTarget.java deleted file mode 100644 index f352498fd3d..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAssignmentTarget.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Marker interface for code components that can be placed to - * the left of '=' in an assignment. - * - * A left hand value can always be a right hand value, so - * this interface derives from {@link JExpression}. - */ -public interface JAssignmentTarget extends JGenerable, JExpression { - JExpression assign(JExpression rhs); - JExpression assignPlus(JExpression rhs); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JAtom.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JAtom.java deleted file mode 100644 index e4f9560f406..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JAtom.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * JAtoms: Simple code components that merely generate themselves. - */ -final class JAtom extends JExpressionImpl { - - private final String what; - - JAtom(String what) { - this.what = what; - } - - public void generate(JFormatter f) { - f.p(what); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JBlock.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JBlock.java deleted file mode 100644 index a017b883bc9..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JBlock.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.Collections; - -/** - * A block of Java code, which may contain statements and local declarations. - * - *

- * {@link JBlock} contains a large number of factory methods that creates new - * statements/declarations. Those newly created statements/declarations are - * inserted into the {@link #pos() "current position"}. The position advances - * one every time you add a new instruction. - */ -public final class JBlock implements JGenerable, JStatement { - - /** - * Declarations and statements contained in this block. - * Either {@link JStatement} or {@link JDeclaration}. - */ - private final List content = new ArrayList(); - - /** - * Whether or not this block must be braced and indented - */ - private boolean bracesRequired = true; - private boolean indentRequired = true; - - /** - * Current position. - */ - private int pos; - - public JBlock() { - this(true,true); - } - - public JBlock(boolean bracesRequired, boolean indentRequired) { - this.bracesRequired = bracesRequired; - this.indentRequired = indentRequired; - } - - /** - * Returns a read-only view of {@link JStatement}s and {@link JDeclaration} - * in this block. - */ - public List getContents() { - return Collections.unmodifiableList(content); - } - - private T insert( T statementOrDeclaration ) { - content.add(pos,statementOrDeclaration); - pos++; - return statementOrDeclaration; - } - - /** - * Gets the current position to which new statements will be inserted. - * - * For example if the value is 0, newly created instructions will be - * inserted at the very beginning of the block. - * - * @see #pos(int) - */ - public int pos() { - return pos; - } - - /** - * Sets the current position. - * - * @return - * the old value of the current position. - * @throws IllegalArgumentException - * if the new position value is illegal. - * - * @see #pos() - */ - public int pos(int newPos) { - int r = pos; - if(newPos>content.size() || newPos<0) - throw new IllegalArgumentException(); - pos = newPos; - - return r; - } - - /** - * Returns true if this block is empty and does not contain - * any statement. - */ - public boolean isEmpty() { - return content.isEmpty(); - } - - - /** - * Adds a local variable declaration to this block - * - * @param type - * JType of the variable - * - * @param name - * Name of the variable - * - * @return Newly generated JVar - */ - public JVar decl(JType type, String name) { - return decl(JMod.NONE, type, name, null); - } - - /** - * Adds a local variable declaration to this block - * - * @param type - * JType of the variable - * - * @param name - * Name of the variable - * - * @param init - * Initialization expression for this variable. May be null. - * - * @return Newly generated JVar - */ - public JVar decl(JType type, String name, JExpression init) { - return decl(JMod.NONE, type, name, init); - } - - /** - * Adds a local variable declaration to this block - * - * @param mods - * Modifiers for the variable - * - * @param type - * JType of the variable - * - * @param name - * Name of the variable - * - * @param init - * Initialization expression for this variable. May be null. - * - * @return Newly generated JVar - */ - public JVar decl(int mods, JType type, String name, JExpression init) { - JVar v = new JVar(JMods.forVar(mods), type, name, init); - insert(v); - bracesRequired = true; - indentRequired = true; - return v; - } - - /** - * Creates an assignment statement and adds it to this block. - * - * @param lhs - * Assignable variable or field for left hand side of expression - * - * @param exp - * Right hand side expression - */ - public JBlock assign(JAssignmentTarget lhs, JExpression exp) { - insert(new JAssignment(lhs, exp)); - return this; - } - - public JBlock assignPlus(JAssignmentTarget lhs, JExpression exp) { - insert(new JAssignment(lhs, exp, "+")); - return this; - } - - /** - * Creates an invocation statement and adds it to this block. - * - * @param expr - * JExpression evaluating to the class or object upon which - * the named method will be invoked - * - * @param method - * Name of method to invoke - * - * @return Newly generated JInvocation - */ - public JInvocation invoke(JExpression expr, String method) { - JInvocation i = new JInvocation(expr, method); - insert(i); - return i; - } - - /** - * Creates an invocation statement and adds it to this block. - * - * @param expr - * JExpression evaluating to the class or object upon which - * the method will be invoked - * - * @param method - * JMethod to invoke - * - * @return Newly generated JInvocation - */ - public JInvocation invoke(JExpression expr, JMethod method) { - return insert(new JInvocation(expr, method)); - } - - /** - * Creates a static invocation statement. - */ - public JInvocation staticInvoke(JClass type, String method) { - return insert(new JInvocation(type, method)); - } - - /** - * Creates an invocation statement and adds it to this block. - * - * @param method - * Name of method to invoke - * - * @return Newly generated JInvocation - */ - public JInvocation invoke(String method) { - return insert(new JInvocation((JExpression)null, method)); - } - - /** - * Creates an invocation statement and adds it to this block. - * - * @param method - * JMethod to invoke - * - * @return Newly generated JInvocation - */ - public JInvocation invoke(JMethod method) { - return insert(new JInvocation((JExpression)null, method)); - } - - /** - * Adds a statement to this block - * - * @param s - * JStatement to be added - * - * @return This block - */ - public JBlock add(JStatement s) { // ## Needed? - insert(s); - return this; - } - - /** - * Create an If statement and add it to this block - * - * @param expr - * JExpression to be tested to determine branching - * - * @return Newly generated conditional statement - */ - public JConditional _if(JExpression expr) { - return insert(new JConditional(expr)); - } - - /** - * Create a For statement and add it to this block - * - * @return Newly generated For statement - */ - public JForLoop _for() { - return insert(new JForLoop()); - } - - /** - * Create a While statement and add it to this block - * - * @return Newly generated While statement - */ - public JWhileLoop _while(JExpression test) { - return insert(new JWhileLoop(test)); - } - - /** - * Create a switch/case statement and add it to this block - */ - public JSwitch _switch(JExpression test) { - return insert(new JSwitch(test)); - } - - /** - * Create a Do statement and add it to this block - * - * @return Newly generated Do statement - */ - public JDoLoop _do(JExpression test) { - return insert(new JDoLoop(test)); - } - - /** - * Create a Try statement and add it to this block - * - * @return Newly generated Try statement - */ - public JTryBlock _try() { - return insert(new JTryBlock()); - } - - /** - * Create a return statement and add it to this block - */ - public void _return() { - insert(new JReturn(null)); - } - - /** - * Create a return statement and add it to this block - */ - public void _return(JExpression exp) { - insert(new JReturn(exp)); - } - - /** - * Create a throw statement and add it to this block - */ - public void _throw(JExpression exp) { - insert(new JThrow(exp)); - } - - /** - * Create a break statement and add it to this block - */ - public void _break() { - _break(null); - } - - public void _break(JLabel label) { - insert(new JBreak(label)); - } - - /** - * Create a label, which can be referenced from - * continue and break statements. - */ - public JLabel label(String name) { - JLabel l = new JLabel(name); - insert(l); - return l; - } - - /** - * Create a continue statement and add it to this block - */ - public void _continue(JLabel label) { - insert(new JContinue(label)); - } - - public void _continue() { - _continue(null); - } - - /** - * Create a sub-block and add it to this block - */ - public JBlock block() { - JBlock b = new JBlock(); - b.bracesRequired = false; - b.indentRequired = false; - return insert(b); - } - - /** - * Creates a "literal" statement directly. - * - *

- * Specified string is printed as-is. - * This is useful as a short-cut. - * - *

- * For example, you can invoke this method as: - * directStatement("a=b+c;"). - */ - public JStatement directStatement(final String source) { - JStatement s = new JStatement() { - public void state(JFormatter f) { - f.p(source).nl(); - } - }; - add(s); - return s; - } - - public void generate(JFormatter f) { - if (bracesRequired) - f.p('{').nl(); - if (indentRequired) - f.i(); - generateBody(f); - if (indentRequired) - f.o(); - if (bracesRequired) - f.p('}'); - } - - void generateBody(JFormatter f) { - for (Object o : content) { - if (o instanceof JDeclaration) - f.d((JDeclaration) o); - else - f.s((JStatement) o); - } - } - - /** - * Creates an enhanced For statement based on j2se 1.5 JLS - * and add it to this block - * - * @return Newly generated enhanced For statement per j2se 1.5 - * specification - */ - public JForEach forEach(JType varType, String name, JExpression collection) { - return insert(new JForEach( varType, name, collection)); - - } - public void state(JFormatter f) { - f.g(this); - if (bracesRequired) - f.nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JBreak.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JBreak.java deleted file mode 100644 index e4df8bfd412..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JBreak.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * JBreak statement - */ -final class JBreak implements JStatement { - - private final JLabel label; - - /** - * JBreak constructor - * - * @param _label - * break label or null. - */ - JBreak( JLabel _label ) { - this.label = _label; - } - - public void state(JFormatter f) { - if( label==null ) - f.p("break;").nl(); - else - f.p("break").p(label.label).p(';').nl(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JCase.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JCase.java deleted file mode 100644 index 27a4c3210e5..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JCase.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * Case statement - */ -public final class JCase implements JStatement { - - /** - * label part of the case statement - */ - private JExpression label; - - /** - * JBlock of statements which makes up body of this While statement - */ - private JBlock body = null; - - /** - * is this a regular case statement or a default case statement? - */ - private boolean isDefaultCase = false; - - /** - * Construct a case statement - */ - JCase(JExpression label) { - this(label, false); - } - - /** - * Construct a case statement. If isDefaultCase is true, then - * label should be null since default cases don't have a label. - */ - JCase(JExpression label, boolean isDefaultCase) { - this.label = label; - this.isDefaultCase = isDefaultCase; - } - - public JExpression label() { - return label; - } - - public JBlock body() { - if (body == null) body=new JBlock( false, true ); - return body; - } - - public void state(JFormatter f) { - f.i(); - if( !isDefaultCase ) { - f.p("case ").g(label).p(':').nl(); - } else { - f.p("default:").nl(); - } - if (body != null) - f.s(body); - f.o(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JCast.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JCast.java deleted file mode 100644 index b427526e120..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JCast.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - - -/** - * A cast operation. - */ -final class JCast extends JExpressionImpl { - /** - * JType to which the expression is to be cast. - */ - private final JType type; - - /** - * JExpression to be cast. - */ - private final JExpression object; - - /** - * JCast constructor - * - * @param type - * JType to which the expression is cast - * - * @param object - * JExpression for the object upon which - * the cast is applied - */ - JCast(JType type, JExpression object) { - this.type = type; - this.object = object; - } - - public void generate(JFormatter f) { - f.p("((").g(type).p(')').g(object).p(')'); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JCatchBlock.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JCatchBlock.java deleted file mode 100644 index a7c31207d49..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JCatchBlock.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Catch block for a try/catch/finally statement - */ - -public class JCatchBlock implements JGenerable { - - JClass exception; - private JVar var = null; - private JBlock body = new JBlock(); - - JCatchBlock(JClass exception) { - this.exception = exception; - } - - public JVar param(String name) { - if (var != null) throw new IllegalStateException(); - var = new JVar(JMods.forVar(JMod.NONE), exception, name, null); - return var; - } - - public JBlock body() { - return body; - } - - public void generate(JFormatter f) { - if (var == null) - var = new JVar(JMods.forVar(JMod.NONE), - exception, "_x", null); - f.p("catch (").b(var).p(')').g(body); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JClass.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JClass.java deleted file mode 100644 index bbfd4aa685c..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JClass.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -/** - * Represents a Java reference type, such as a class, an interface, - * an enum, an array type, a parameterized type. - * - *

- * To be exact, this object represents an "use" of a reference type, - * not necessarily a declaration of it, which is modeled as {@link JDefinedClass}. - */ -public abstract class JClass extends JType -{ - protected JClass( JCodeModel _owner ) { - this._owner = _owner; - } - - /** - * Gets the name of this class. - * - * @return - * name of this class, without any qualification. - * For example, this method returns "String" for - * java.lang.String. - */ - abstract public String name(); - - /** - * Gets the package to which this class belongs. - * TODO: shall we move move this down? - */ - abstract public JPackage _package(); - - /** - * Returns the class in which this class is nested, or null if - * this is a top-level class. - */ - public JClass outer() { - return null; - } - - private final JCodeModel _owner; - /** Gets the JCodeModel object to which this object belongs. */ - public final JCodeModel owner() { return _owner; } - - /** - * Gets the super class of this class. - * - * @return - * Returns the JClass representing the superclass of the - * entity (class or interface) represented by this {@link JClass}. - * Even if no super class is given explicitly or this {@link JClass} - * is not a class, this method still returns - * {@link JClass} for {@link Object}. - * If this JClass represents {@link Object}, return null. - */ - abstract public JClass _extends(); - - /** - * Iterates all super interfaces directly implemented by - * this class/interface. - * - * @return - * A non-null valid iterator that iterates all - * {@link JClass} objects that represents those interfaces - * implemented by this object. - */ - abstract public Iterator _implements(); - - /** - * Iterates all the type parameters of this class/interface. - * - *

- * For example, if this {@link JClass} represents - * Set<T>, this method returns an array - * that contains single {@link JTypeVar} for 'T'. - */ - public JTypeVar[] typeParams() { - return EMPTY_ARRAY; - } - - /** - * Sometimes useful reusable empty array. - */ - protected static final JTypeVar[] EMPTY_ARRAY = new JTypeVar[0]; - - /** - * Checks if this object represents an interface. - */ - abstract public boolean isInterface(); - - /** - * Checks if this class is an abstract class. - */ - abstract public boolean isAbstract(); - - /** - * If this class represents one of the wrapper classes - * defined in the java.lang package, return the corresponding - * primitive type. Otherwise null. - */ - public JPrimitiveType getPrimitiveType() { return null; } - - /** - * @deprecated calling this method from {@link JClass} - * would be meaningless, since it's always guaranteed to - * return this. - */ - public JClass boxify() { return this; } - - public JType unboxify() { - JPrimitiveType pt = getPrimitiveType(); - return pt==null ? (JType)this : pt; - } - - public JClass erasure() { - return this; - } - - /** - * Checks the relationship between two classes. - *

- * This method works in the same way as {@link Class#isAssignableFrom(Class)} - * works. For example, baseClass.isAssignableFrom(derivedClass)==true. - */ - public final boolean isAssignableFrom( JClass derived ) { - // to avoid the confusion, always use "this" explicitly in this method. - - // null can be assigned to any type. - if( derived instanceof JNullType ) return true; - - if( this==derived ) return true; - - // the only class that is assignable from an interface is - // java.lang.Object - if( this==_package().owner().ref(Object.class) ) return true; - - JClass b = derived._extends(); - if( b!=null && this.isAssignableFrom(b) ) - return true; - - if( this.isInterface() ) { - Iterator itfs = derived._implements(); - while( itfs.hasNext() ) - if( this.isAssignableFrom((JClass)itfs.next()) ) - return true; - } - - return false; - } - - /** - * Gets the parameterization of the given base type. - * - *

- * For example, given the following - *


-     * interface Foo<T> extends List<List<T>> {}
-     * interface Bar extends Foo<String> {}
-     * 
- * This method works like this: - *

-     * getBaseClass( Bar, List ) = List<List<String>
-     * getBaseClass( Bar, Foo  ) = Foo<String>
-     * getBaseClass( Foo<? extends Number>, Collection ) = Collection<List<? extends Number>>
-     * getBaseClass( ArrayList<? extends BigInteger>, List ) = List<? extends BigInteger>
-     * 
- * - * @param baseType - * The class whose parameterization we are interested in. - * @return - * The use of {@code baseType} in {@code this} type. - * or null if the type is not assignable to the base type. - */ - public final JClass getBaseClass( JClass baseType ) { - - if( this.erasure().equals(baseType) ) - return this; - - JClass b = _extends(); - if( b!=null ) { - JClass bc = b.getBaseClass(baseType); - if(bc!=null) - return bc; - } - - Iterator itfs = _implements(); - while( itfs.hasNext() ) { - JClass bc = itfs.next().getBaseClass(baseType); - if(bc!=null) - return bc; - } - - return null; - } - - public final JClass getBaseClass( Class baseType ) { - return getBaseClass(owner().ref(baseType)); - } - - - private JClass arrayClass; - public JClass array() { - if(arrayClass==null) - arrayClass = new JArrayClass(owner(),this); - return arrayClass; - } - - /** - * "Narrows" a generic class to a concrete class by specifying - * a type argument. - * - *

- * .narrow(X) builds Set<X> from Set. - */ - public JClass narrow( Class clazz ) { - return narrow(owner().ref(clazz)); - } - - public JClass narrow( Class... clazz ) { - JClass[] r = new JClass[clazz.length]; - for( int i=0; i - * .narrow(X) builds Set<X> from Set. - */ - public JClass narrow( JClass clazz ) { - return new JNarrowedClass(this,clazz); - } - - public JClass narrow( JClass... clazz ) { - return new JNarrowedClass(this,Arrays.asList(clazz.clone())); - } - - public JClass narrow( List clazz ) { - return new JNarrowedClass(this,new ArrayList(clazz)); - } - - /** - * If this class is parameterized, return the type parameter of the given index. - */ - public List getTypeParameters() { - return Collections.emptyList(); - } - - /** - * Returns true if this class is a parameterized class. - */ - public final boolean isParameterized() { - return erasure()!=this; - } - - /** - * Create "? extends T" from T. - * - * @return never null - */ - public final JClass wildcard() { - return new JTypeWildcard(this); - } - - /** - * Substitutes the type variables with their actual arguments. - * - *

- * For example, when this class is Map<String,Map<V>>, - * (where V then doing - * substituteParams( V, Integer ) returns a {@link JClass} - * for Map<String,Map<Integer>>. - * - *

- * This method needs to work recursively. - */ - protected abstract JClass substituteParams( JTypeVar[] variables, List bindings ); - - public String toString() { - return this.getClass().getName() + '(' + name() + ')'; - } - - - public final JExpression dotclass() { - return JExpr.dotclass(this); - } - - /** Generates a static method invocation. */ - public final JInvocation staticInvoke(JMethod method) { - return new JInvocation(this,method); - } - - /** Generates a static method invocation. */ - public final JInvocation staticInvoke(String method) { - return new JInvocation(this,method); - } - - /** Static field reference. */ - public final JFieldRef staticRef(String field) { - return new JFieldRef(this, field); - } - - /** Static field reference. */ - public final JFieldRef staticRef(JVar field) { - return new JFieldRef(this, field); - } - - public void generate(JFormatter f) { - f.t(this); - } - - /** - * Prints the class name in javadoc @link format. - */ - void printLink(JFormatter f) { - f.p("{@link ").g(this).p('}'); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JClassAlreadyExistsException.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JClassAlreadyExistsException.java deleted file mode 100644 index 850cfe837bf..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JClassAlreadyExistsException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * Indicates that the class is already created. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class JClassAlreadyExistsException extends Exception { - private final JDefinedClass existing; - - public JClassAlreadyExistsException( JDefinedClass _existing ) { - this.existing = _existing; - } - - /** - * Gets a reference to the existing {@link JDefinedClass}. - * - * @return - * This method always return non-null valid object. - */ - public JDefinedClass getExistingClass() { - return existing; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JClassContainer.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JClassContainer.java deleted file mode 100644 index a4be9ba327c..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JClassContainer.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.Iterator; - -/** - * The common aspect of a package and a class. - */ -public interface JClassContainer { - - /** - * Returns true if the container is a class. - */ - boolean isClass(); - /** - * Returns true if the container is a package. - */ - boolean isPackage(); - - /** - * Add a new class to this package/class. - * - * @param mods - * Modifiers for this class declaration - * - * @param name - * Name of class to be added to this package - * - * @return Newly generated class - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - JDefinedClass _class(int mods, String name) throws JClassAlreadyExistsException; - - /** - * Add a new public class to this class/package. - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - public JDefinedClass _class(String name) throws JClassAlreadyExistsException; - - /** - * Add an interface to this class/package. - * - * @param mods - * Modifiers for this interface declaration - * - * @param name - * Name of interface to be added to this package - * - * @return Newly generated interface - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - public JDefinedClass _interface(int mods, String name) throws JClassAlreadyExistsException; - - /** - * Adds a public interface to this package. - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - public JDefinedClass _interface(String name) throws JClassAlreadyExistsException; - - /** - * Create a new class or a new interface. - * - * @deprecated - * use {@link #_class(int, String, ClassType)} - */ - public JDefinedClass _class(int mods, String name, boolean isInterface ) - throws JClassAlreadyExistsException; - - /** - * Creates a new class/enum/interface/annotation. - */ - public JDefinedClass _class(int mods, String name, ClassType kind ) - throws JClassAlreadyExistsException; - - - /** - * Returns an iterator that walks the nested classes defined in this - * class. - */ - public Iterator classes(); - - /** - * Parent JClassContainer. - * - * If this is a package, this method returns a parent package, - * or null if this package is the root package. - * - * If this is an outer-most class, this method returns a package - * to which it belongs. - * - * If this is an inner class, this method returns the outer - * class. - */ - public JClassContainer parentContainer(); - - /** - * Gets the nearest package parent. - * - *

- * If this.isPackage(), then return this. - */ - public JPackage getPackage(); - - /** - * Get the root code model object. - */ - public JCodeModel owner(); - - /** - * Add an annotationType Declaration to this package - * @param name - * Name of the annotation Type declaration to be added to this package - * @return - * newly created Annotation Type Declaration - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException; - - /** - * Add a public enum to this package - * @param name - * Name of the enum to be added to this package - * @return - * newly created Enum - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _enum (String name) throws JClassAlreadyExistsException; - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JCodeModel.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JCodeModel.java deleted file mode 100644 index 1f674412186..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JCodeModel.java +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.sun.codemodel.internal.writer.FileCodeWriter; -import com.sun.codemodel.internal.writer.ProgressCodeWriter; - - -/** - * Root of the code DOM. - * - *

- * Here's your typical CodeModel application. - * - *

- * JCodeModel cm = new JCodeModel();
- *
- * // generate source code by populating the 'cm' tree.
- * cm._class(...);
- * ...
- *
- * // write them out
- * cm.build(new File("."));
- * 
- * - *

- * Every CodeModel node is always owned by one {@link JCodeModel} object - * at any given time (which can be often accesesd by the owner() method.) - * - * As such, when you generate Java code, most of the operation works - * in a top-down fashion. For example, you create a class from {@link JCodeModel}, - * which gives you a {@link JDefinedClass}. Then you invoke a method on it - * to generate a new method, which gives you {@link JMethod}, and so on. - * - * There are a few exceptions to this, most notably building {@link JExpression}s, - * but generally you work with CodeModel in a top-down fashion. - * - * Because of this design, most of the CodeModel classes aren't directly instanciable. - * - * - *

Where to go from here?

- *

- * Most of the time you'd want to populate new type definitions in a {@link JCodeModel}. - * See {@link #_class(String, ClassType)}. - */ -public final class JCodeModel { - - /** The packages that this JCodeWriter contains. */ - private HashMap packages = new HashMap(); - - /** All JReferencedClasses are pooled here. */ - private final HashMap refClasses = new HashMap(); - - - /** Obtains a reference to the special "null" type. */ - public final JNullType NULL = new JNullType(this); - // primitive types - public final JPrimitiveType VOID = new JPrimitiveType(this,"void", Void.class); - public final JPrimitiveType BOOLEAN = new JPrimitiveType(this,"boolean",Boolean.class); - public final JPrimitiveType BYTE = new JPrimitiveType(this,"byte", Byte.class); - public final JPrimitiveType SHORT = new JPrimitiveType(this,"short", Short.class); - public final JPrimitiveType CHAR = new JPrimitiveType(this,"char", Character.class); - public final JPrimitiveType INT = new JPrimitiveType(this,"int", Integer.class); - public final JPrimitiveType FLOAT = new JPrimitiveType(this,"float", Float.class); - public final JPrimitiveType LONG = new JPrimitiveType(this,"long", Long.class); - public final JPrimitiveType DOUBLE = new JPrimitiveType(this,"double", Double.class); - - /** - * If the flag is true, we will consider two classes "Foo" and "foo" - * as a collision. - */ - protected static final boolean isCaseSensitiveFileSystem = getFileSystemCaseSensitivity(); - - private static boolean getFileSystemCaseSensitivity() { - try { - // let the system property override, in case the user really - // wants to override. - if( System.getProperty("com.sun.codemodel.internal.FileSystemCaseSensitive")!=null ) - return true; - } catch( Exception e ) {} - - // on Unix, it's case sensitive. - return (File.separatorChar == '/'); - } - - - public JCodeModel() {} - - /** - * Add a package to the list of packages to be generated - * - * @param name - * Name of the package. Use "" to indicate the root package. - * - * @return Newly generated package - */ - public JPackage _package(String name) { - JPackage p = packages.get(name); - if (p == null) { - p = new JPackage(name, this); - packages.put(name, p); - } - return p; - } - - public final JPackage rootPackage() { - return _package(""); - } - - /** - * Returns an iterator that walks the packages defined using this code - * writer. - */ - public Iterator packages() { - return packages.values().iterator(); - } - - /** - * Creates a new generated class. - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - public JDefinedClass _class(String fullyqualifiedName) throws JClassAlreadyExistsException { - return _class(fullyqualifiedName,ClassType.CLASS); - } - - /** - * Creates a dummy, unknown {@link JClass} that represents a given name. - * - *

- * This method is useful when the code generation needs to include the user-specified - * class that may or may not exist, and only thing known about it is a class name. - */ - public JClass directClass(String name) { - return new JDirectClass(this,name); - } - - /** - * Creates a new generated class. - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - public JDefinedClass _class(String fullyqualifiedName,ClassType t) throws JClassAlreadyExistsException { - int idx = fullyqualifiedName.lastIndexOf('.'); - if( idx<0 ) return rootPackage()._class(fullyqualifiedName); - else - return _package(fullyqualifiedName.substring(0,idx)) - ._class( JMod.PUBLIC, fullyqualifiedName.substring(idx+1), t ); - } - - /** - * Gets a reference to the already created generated class. - * - * @return null - * If the class is not yet created. - * @see JPackage#_getClass(String) - */ - public JDefinedClass _getClass(String fullyQualifiedName) { - int idx = fullyQualifiedName.lastIndexOf('.'); - if( idx<0 ) return rootPackage()._getClass(fullyQualifiedName); - else - return _package(fullyQualifiedName.substring(0,idx)) - ._getClass( fullyQualifiedName.substring(idx+1) ); - } - - /** - * Creates a new anonymous class. - * - * @deprecated - * The naming convention doesn't match the rest of the CodeModel. - * Use {@link #anonymousClass(JClass)} instead. - */ - public JDefinedClass newAnonymousClass(JClass baseType) { - return new JAnonymousClass(baseType); - } - - /** - * Creates a new anonymous class. - */ - public JDefinedClass anonymousClass(JClass baseType) { - return new JAnonymousClass(baseType); - } - - public JDefinedClass anonymousClass(Class baseType) { - return anonymousClass(ref(baseType)); - } - - /** - * Generates Java source code. - * A convenience method for build(destDir,destDir,System.out). - * - * @param destDir - * source files are generated into this directory. - * @param status - * if non-null, progress indication will be sent to this stream. - */ - public void build( File destDir, PrintStream status ) throws IOException { - build(destDir,destDir,status); - } - - /** - * Generates Java source code. - * A convenience method that calls {@link #build(CodeWriter,CodeWriter)}. - * - * @param srcDir - * Java source files are generated into this directory. - * @param resourceDir - * Other resource files are generated into this directory. - * @param status - * if non-null, progress indication will be sent to this stream. - */ - public void build( File srcDir, File resourceDir, PrintStream status ) throws IOException { - CodeWriter src = new FileCodeWriter(srcDir); - CodeWriter res = new FileCodeWriter(resourceDir); - if(status!=null) { - src = new ProgressCodeWriter(src, status ); - res = new ProgressCodeWriter(res, status ); - } - build(src,res); - } - - /** - * A convenience method for build(destDir,System.out). - */ - public void build( File destDir ) throws IOException { - build(destDir,System.out); - } - - /** - * A convenience method for build(srcDir,resourceDir,System.out). - */ - public void build( File srcDir, File resourceDir ) throws IOException { - build(srcDir,resourceDir,System.out); - } - - /** - * A convenience method for build(out,out). - */ - public void build( CodeWriter out ) throws IOException { - build(out,out); - } - - /** - * Generates Java source code. - */ - public void build( CodeWriter source, CodeWriter resource ) throws IOException { - JPackage[] pkgs = packages.values().toArray(new JPackage[packages.size()]); - // avoid concurrent modification exception - for( JPackage pkg : pkgs ) - pkg.build(source,resource); - source.close(); - resource.close(); - } - - /** - * Returns the number of files to be generated if - * {@link #build} is invoked now. - */ - public int countArtifacts() { - int r = 0; - JPackage[] pkgs = packages.values().toArray(new JPackage[packages.size()]); - // avoid concurrent modification exception - for( JPackage pkg : pkgs ) - r += pkg.countArtifacts(); - return r; - } - - - /** - * Obtains a reference to an existing class from its Class object. - * - *

- * The parameter may not be primitive. - * - * @see #_ref(Class) for the version that handles more cases. - */ - public JClass ref(Class clazz) { - JReferencedClass jrc = (JReferencedClass)refClasses.get(clazz); - if (jrc == null) { - if (clazz.isPrimitive()) - throw new IllegalArgumentException(clazz+" is a primitive"); - if (clazz.isArray()) { - return new JArrayClass(this, _ref(clazz.getComponentType())); - } else { - jrc = new JReferencedClass(clazz); - refClasses.put(clazz, jrc); - } - } - return jrc; - } - - public JType _ref(Class c) { - if(c.isPrimitive()) - return JType.parse(this,c.getName()); - else - return ref(c); - } - - /** - * Obtains a reference to an existing class from its fully-qualified - * class name. - * - *

- * First, this method attempts to load the class of the given name. - * If that fails, we assume that the class is derived straight from - * {@link Object}, and return a {@link JClass}. - */ - public JClass ref(String fullyQualifiedClassName) { - try { - // try the context class loader first - return ref(Thread.currentThread().getContextClassLoader().loadClass(fullyQualifiedClassName)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return ref(Class.forName(fullyQualifiedClassName)); - } catch (ClassNotFoundException e1) { - // fall through - } - - // assume it's not visible to us. - return new JDirectClass(this,fullyQualifiedClassName); - } - - /** - * Cached for {@link #wildcard()}. - */ - private JClass wildcard; - - /** - * Gets a {@link JClass} representation for "?", - * which is equivalent to "? extends Object". - */ - public JClass wildcard() { - if(wildcard==null) - wildcard = ref(Object.class).wildcard(); - return wildcard; - } - - /** - * Obtains a type object from a type name. - * - *

- * This method handles primitive types, arrays, and existing {@link Class}es. - * - * @exception ClassNotFoundException - * If the specified type is not found. - */ - public JType parseType(String name) throws ClassNotFoundException { - // array - if(name.endsWith("[]")) - return parseType(name.substring(0,name.length()-2)).array(); - - // try primitive type - try { - return JType.parse(this,name); - } catch (IllegalArgumentException e) { - ; - } - - // existing class - return new TypeNameParser(name).parseTypeName(); - } - - private final class TypeNameParser { - private final String s; - private int idx; - - public TypeNameParser(String s) { - this.s = s; - } - - /** - * Parses a type name token T (which can be potentially of the form Tr&ly;T1,T2,...>, - * or "? extends/super T".) - * - * @return the index of the character next to T. - */ - JClass parseTypeName() throws ClassNotFoundException { - int start = idx; - - if(s.charAt(idx)=='?') { - // wildcard - idx++; - ws(); - String head = s.substring(idx); - if(head.startsWith("extends")) { - idx+=7; - ws(); - return parseTypeName().wildcard(); - } else - if(head.startsWith("super")) { - throw new UnsupportedOperationException("? super T not implemented"); - } else { - // not supported - throw new IllegalArgumentException("only extends/super can follow ?, but found "+s.substring(idx)); - } - } - - while(idx' - * - * @return the index of the character next to '>' - */ - private JClass parseArguments(JClass rawType) throws ClassNotFoundException { - if(s.charAt(idx)!='<') - throw new IllegalArgumentException(); - idx++; - - List args = new ArrayList(); - - while(true) { - args.add(parseTypeName()); - if(idx==s.length()) - throw new IllegalArgumentException("Missing '>' in "+s); - char ch = s.charAt(idx); - if(ch=='>') - return rawType.narrow(args.toArray(new JClass[args.size()])); - - if(ch!=',') - throw new IllegalArgumentException(s); - idx++; - } - - } - } - - /** - * References to existing classes. - * - *

- * JReferencedClass is kept in a pool so that they are shared. - * There is one pool for each JCodeModel object. - * - *

- * It is impossible to cache JReferencedClass globally only because - * there is the _package() method, which obtains the owner JPackage - * object, which is scoped to JCodeModel. - */ - private class JReferencedClass extends JClass implements JDeclaration { - private final Class _class; - - JReferencedClass(Class _clazz) { - super(JCodeModel.this); - this._class = _clazz; - assert !_class.isArray(); - } - - public String name() { - return _class.getSimpleName().replace('$','.'); - } - - public String fullName() { - return _class.getName().replace('$','.'); - } - - public String binaryName() { - return _class.getName(); - } - - public JClass outer() { - Class p = _class.getDeclaringClass(); - if(p==null) return null; - return ref(p); - } - - public JPackage _package() { - String name = fullName(); - - // this type is array - if (name.indexOf('[') != -1) - return JCodeModel.this._package(""); - - // other normal case - int idx = name.lastIndexOf('.'); - if (idx < 0) - return JCodeModel.this._package(""); - else - return JCodeModel.this._package(name.substring(0, idx)); - } - - public JClass _extends() { - Class sp = _class.getSuperclass(); - if (sp == null) { - if(isInterface()) - return owner().ref(Object.class); - return null; - } else - return ref(sp); - } - - public Iterator _implements() { - final Class[] interfaces = _class.getInterfaces(); - return new Iterator() { - private int idx = 0; - public boolean hasNext() { - return idx < interfaces.length; - } - public JClass next() { - return JCodeModel.this.ref(interfaces[idx++]); - } - public void remove() { - throw new UnsupportedOperationException(); - } - }; - } - - public boolean isInterface() { - return _class.isInterface(); - } - - public boolean isAbstract() { - return Modifier.isAbstract(_class.getModifiers()); - } - - public JPrimitiveType getPrimitiveType() { - Class v = boxToPrimitive.get(_class); - if(v!=null) - return JType.parse(JCodeModel.this,v.getName()); - else - return null; - } - - public boolean isArray() { - return false; - } - - public void declare(JFormatter f) { - } - - public JTypeVar[] typeParams() { - // TODO: does JDK 1.5 reflection provides these information? - return super.typeParams(); - } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - // TODO: does JDK 1.5 reflection provides these information? - return this; - } - } - - /** - * Conversion from primitive type {@link Class} (such as {@link Integer#TYPE} - * to its boxed type (such as Integer.class) - */ - public static final Map primitiveToBox; - /** - * The reverse look up for {@link #primitiveToBox} - */ - public static final Map boxToPrimitive; - - static { - Map m1 = new HashMap(); - Map m2 = new HashMap(); - - m1.put(Boolean.class,Boolean.TYPE); - m1.put(Byte.class,Byte.TYPE); - m1.put(Character.class,Character.TYPE); - m1.put(Double.class,Double.TYPE); - m1.put(Float.class,Float.TYPE); - m1.put(Integer.class,Integer.TYPE); - m1.put(Long.class,Long.TYPE); - m1.put(Short.class,Short.TYPE); - m1.put(Void.class,Void.TYPE); - - for (Map.Entry e : m1.entrySet()) - m2.put(e.getValue(),e.getKey()); - - boxToPrimitive = Collections.unmodifiableMap(m1); - primitiveToBox = Collections.unmodifiableMap(m2); - - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JCommentPart.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JCommentPart.java deleted file mode 100644 index 5ae165ac66c..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JCommentPart.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -/** - * A part is a part of a javadoc comment, and it is a list of values. - * - *

- * A part can contain a free-form text. This text is modeled as a collection of 'values' - * in this class. A value can be a {@link JType} (which will be prinited with a @link tag), - * anything that can be turned into a {@link String} via the {@link Object#toString()} method, - * or a {@link Collection}/array of those objects. - * - *

- * Values can be added through the various append methods one by one or in a bulk. - * - * @author Kohsuke Kawaguchi - */ -public class JCommentPart extends ArrayList { - /** - * Appends a new value. - * - * If the value is {@link JType} it will be printed as a @link tag. - * Otherwise it will be converted to String via {@link Object#toString()}. - */ - public JCommentPart append(Object o) { - add(o); - return this; - } - - public boolean add(Object o) { - flattenAppend(o); - return true; - } - - private void flattenAppend(Object value) { - if(value==null) return; - if(value instanceof Object[]) { - for( Object o : (Object[])value) - flattenAppend(o); - } else - if(value instanceof Collection) { - for( Object o : (Collection)value) - flattenAppend(o); - } else - super.add(value); - } - - /** - * Writes this part into the formatter by using the specified indentation. - */ - protected void format( JFormatter f, String indent ) { - if(!f.isPrinting()) { - // quickly pass the types to JFormatter, as that's all we care. - // we don't need to worry about the exact formatting of text. - for( Object o : this ) - if(o instanceof JClass) - f.g((JClass)o); - return; - } - - if(!isEmpty()) - f.p(indent); - - Iterator itr = iterator(); - while(itr.hasNext()) { - Object o = itr.next(); - - if(o instanceof String) { - int idx; - String s = (String)o; - while( (idx=s.indexOf('\n'))!=-1 ) { - String line = s.substring(0,idx); - if(line.length()>0) - f.p(escape(line)); - s = s.substring(idx+1); - f.nl().p(indent); - } - if(s.length()!=0) - f.p(escape(s)); - } else - if(o instanceof JClass) { - // TODO: this doesn't print the parameterized type properly - ((JClass)o).printLink(f); - } else - if(o instanceof JType) { - f.g((JType)o); - } else - throw new IllegalStateException(); - } - - if(!isEmpty()) - f.nl(); - } - - /** - * Escapes the appearance of the comment terminator. - */ - private String escape(String s) { - while(true) { - int idx = s.indexOf("*/"); - if(idx <0) return s; - - s = s.substring(0,idx+1)+""+s.substring(idx+1); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JConditional.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JConditional.java deleted file mode 100644 index 9e01118b907..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JConditional.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -/** - * If statement, with optional else clause - */ - -public class JConditional implements JStatement { - - /** - * JExpression to test to determine branching - */ - private JExpression test = null; - - /** - * JBlock of statements for "then" clause - */ - private JBlock _then = new JBlock(); - - /** - * JBlock of statements for optional "else" clause - */ - private JBlock _else = null; - - /** - * Constructor - * - * @param test - * JExpression which will determine branching - */ - JConditional(JExpression test) { - this.test = test; - } - - /** - * Return the block to be excuted by the "then" branch - * - * @return Then block - */ - public JBlock _then() { - return _then; - } - - /** - * Create a block to be executed by "else" branch - * - * @return Newly generated else block - */ - public JBlock _else() { - if (_else == null) _else = new JBlock(); - return _else; - } - - /** - * Creates ... else if(...) ... code. - */ - public JConditional _elseif(JExpression boolExp) { - return _else()._if(boolExp); - } - - public void state(JFormatter f) { - if(test==JExpr.TRUE) { - _then.generateBody(f); - return; - } - if(test==JExpr.FALSE) { - _else.generateBody(f); - return; - } - - if (JOp.hasTopOp(test)) { - f.p("if ").g(test); - } else { - f.p("if (").g(test).p(')'); - } - f.g(_then); - if (_else != null) - f.p("else").g(_else); - f.nl(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JContinue.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JContinue.java deleted file mode 100644 index fe89d7d7038..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JContinue.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * JContinue statement - */ -class JContinue implements JStatement { - - private final JLabel label; - - /** - * JContinue constructor. - * - * @param _label - * a valid label or null. - */ - JContinue(JLabel _label) { - this.label = _label; - } - - public void state(JFormatter f) { - if( label==null ) - f.p("continue;").nl(); - else - f.p("continue").p(label.label).p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JDeclaration.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JDeclaration.java deleted file mode 100644 index 50eaa1ef9fa..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JDeclaration.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Common interface for code components that can generate declarations - * of themselves. - */ - -public interface JDeclaration { - - public void declare(JFormatter f); - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JDefinedClass.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JDefinedClass.java deleted file mode 100644 index 81e1cf8d491..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JDefinedClass.java +++ /dev/null @@ -1,876 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -/** - * A generated Java class/interface/enum/.... - * - *

- * This class models a declaration, and since a declaration can be always - * used as a reference, it inherits {@link JClass}. - * - *

Where to go from here?

- *

- * You'd want to generate fields and methods on a class. - * See {@link #method(int, JType, String)} and {@link #field(int, JType, String)}. - */ -public class JDefinedClass - extends JClass - implements JDeclaration, JClassContainer, JGenerifiable, JAnnotatable { - - /** Name of this class. Null if anonymous. */ - private String name = null; - - - /** Modifiers for the class declaration */ - private JMods mods; - - /** Name of the super class of this class. */ - private JClass superClass; - - /** List of interfaces that this class implements */ - private final Set interfaces = new TreeSet(); - - /** Fields keyed by their names. */ - /*package*/ final Map fields = new LinkedHashMap(); - - /** Static initializer, if this class has one */ - private JBlock init = null; - - /** class javadoc */ - private JDocComment jdoc = null; - - /** Set of constructors for this class, if any */ - private final List constructors = new ArrayList(); - - /** Set of methods that are members of this class */ - private final List methods = new ArrayList(); - - /** - * Nested classes as a map from name to JDefinedClass. - * The name is all capitalized in a case sensitive file system - * ({@link JCodeModel#isCaseSensitiveFileSystem}) to avoid conflicts. - * - * Lazily created to save footprint. - * - * @see #getClasses() - */ - private Map classes; - - - /** - * Flag that controls whether this class should be really generated or not. - * - * Sometimes it is useful to generate code that refers to class X, - * without actually generating the code of X. - * This flag is used to surpress X.java file in the output. - */ - private boolean hideFile = false; - - /** - * Client-app spcific metadata associated with this user-created class. - */ - public Object metadata; - - /** - * String that will be put directly inside the generated code. - * Can be null. - */ - private String directBlock; - - /** - * If this is a package-member class, this is {@link JPackage}. - * If this is a nested class, this is {@link JDefinedClass}. - * If this is an anonymous class, this constructor shouldn't be used. - */ - private JClassContainer outer = null; - - - /** Default value is class or interface - * or annotationTypeDeclaration - * or enum - * - */ - private final ClassType classType; - - /** List containing the enum value declarations - * - */ -// private List enumValues = new ArrayList(); - - /** - * Set of enum constants that are keyed by names. - * In Java, enum constant order is actually significant, - * because of order ID they get. So let's preserve the order. - */ - private final Map enumConstantsByName = new LinkedHashMap(); - - /** - * Annotations on this variable. Lazily created. - */ - private List annotations = null; - - - /** - * Helper class to implement {@link JGenerifiable}. - */ - private final JGenerifiableImpl generifiable = new JGenerifiableImpl() { - protected JCodeModel owner() { - return JDefinedClass.this.owner(); - } - }; - - JDefinedClass(JClassContainer parent, int mods, String name, ClassType classTypeval) { - this(mods, name, parent, parent.owner(), classTypeval); - } - - /** - * Constructor for creating anonymous inner class. - */ - JDefinedClass( - JCodeModel owner, - int mods, - String name) { - this(mods, name, null, owner); - } - - private JDefinedClass( - int mods, - String name, - JClassContainer parent, - JCodeModel owner) { - this (mods,name,parent,owner,ClassType.CLASS); - } - - /** - * JClass constructor - * - * @param mods - * Modifiers for this class declaration - * - * @param name - * Name of this class - */ - private JDefinedClass( - int mods, - String name, - JClassContainer parent, - JCodeModel owner, - ClassType classTypeVal) { - super(owner); - - if(name!=null) { - if (name.trim().length() == 0) - throw new IllegalArgumentException("JClass name empty"); - - if (!Character.isJavaIdentifierStart(name.charAt(0))) { - String msg = - "JClass name " - + name - + " contains illegal character" - + " for beginning of identifier: " - + name.charAt(0); - throw new IllegalArgumentException(msg); - } - for (int i = 1; i < name.length(); i++) { - if (!Character.isJavaIdentifierPart(name.charAt(i))) { - String msg = - "JClass name " - + name - + " contains illegal character " - + name.charAt(i); - throw new IllegalArgumentException(msg); - } - } - } - - this.classType = classTypeVal; - if (isInterface()) - this.mods = JMods.forInterface(mods); - else - this.mods = JMods.forClass(mods); - - this.name = name; - - this.outer = parent; - } - - /** - * Returns true if this is an anonymous class. - */ - public final boolean isAnonymous() { - return name == null; - } - - /** - * This class extends the specifed class. - * - * @param superClass - * Superclass for this class - * - * @return This class - */ - public JDefinedClass _extends(JClass superClass) { - if (this.classType==ClassType.INTERFACE) - throw new IllegalArgumentException("unable to set the super class for an interface"); - if (superClass == null) - throw new NullPointerException(); - - for( JClass o=superClass.outer(); o!=null; o=o.outer() ){ - if(this==o){ - throw new IllegalArgumentException("Illegal class inheritance loop." + - " Outer class " + this.name + " may not subclass from inner class: " + o.name()); - } - } - - this.superClass = superClass; - return this; - } - - public JDefinedClass _extends(Class superClass) { - return _extends(owner().ref(superClass)); - } - - /** - * Returns the class extended by this class. - */ - public JClass _extends() { - if(superClass==null) - superClass = owner().ref(Object.class); - return superClass; - } - - /** - * This class implements the specifed interface. - * - * @param iface - * Interface that this class implements - * - * @return This class - */ - public JDefinedClass _implements(JClass iface) { - interfaces.add(iface); - return this; - } - - public JDefinedClass _implements(Class iface) { - return _implements(owner().ref(iface)); - } - - /** - * Returns an iterator that walks the nested classes defined in this - * class. - */ - public Iterator _implements() { - return interfaces.iterator(); - } - - /** - * JClass name accessor. - * - *

- * For example, for java.util.List, this method - * returns "List"" - * - * @return Name of this class - */ - public String name() { - return name; - } - - /** - * If the named enum already exists, the reference to it is returned. - * Otherwise this method generates a new enum reference with the given - * name and returns it. - * - * @param name - * The name of the constant. - * @return - * The generated type-safe enum constant. - */ - public JEnumConstant enumConstant(String name){ - JEnumConstant ec = enumConstantsByName.get(name); - if (null == ec) { - ec = new JEnumConstant(this, name); - enumConstantsByName.put(name, ec); - } - return ec; - } - - /** - * Gets the fully qualified name of this class. - */ - public String fullName() { - if (outer instanceof JDefinedClass) - return ((JDefinedClass) outer).fullName() + '.' + name(); - - JPackage p = _package(); - if (p.isUnnamed()) - return name(); - else - return p.name() + '.' + name(); - } - - public String binaryName() { - if (outer instanceof JDefinedClass) - return ((JDefinedClass) outer).binaryName() + '$' + name(); - else - return fullName(); - } - - public boolean isInterface() { - return this.classType==ClassType.INTERFACE; - } - - public boolean isAbstract() { - return mods.isAbstract(); - } - - /** - * Adds a field to the list of field members of this JDefinedClass. - * - * @param mods - * Modifiers for this field - * - * @param type - * JType of this field - * - * @param name - * Name of this field - * - * @return Newly generated field - */ - public JFieldVar field(int mods, JType type, String name) { - return field(mods, type, name, null); - } - - public JFieldVar field(int mods, Class type, String name) { - return field(mods, owner()._ref(type), name); - } - - /** - * Adds a field to the list of field members of this JDefinedClass. - * - * @param mods - * Modifiers for this field. - * @param type - * JType of this field. - * @param name - * Name of this field. - * @param init - * Initial value of this field. - * - * @return Newly generated field - */ - public JFieldVar field( - int mods, - JType type, - String name, - JExpression init) { - JFieldVar f = new JFieldVar(this,JMods.forField(mods), type, name, init); - - if(fields.put(name, f)!=null) - throw new IllegalArgumentException("trying to create the same field twice: "+name); - - return f; - } - - /** This method indicates if the interface - * is an annotationTypeDeclaration - * - */ - public boolean isAnnotationTypeDeclaration() { - return this.classType==ClassType.ANNOTATION_TYPE_DECL; - - - } - - /** - * Add an annotationType Declaration to this package - * @param name - * Name of the annotation Type declaration to be added to this package - * @return - * newly created Annotation Type Declaration - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException { - return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL); - } - - /** - * Add a public enum to this package - * @param name - * Name of the enum to be added to this package - * @return - * newly created Enum - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _enum (String name) throws JClassAlreadyExistsException { - return _class (JMod.PUBLIC,name,ClassType.ENUM); - } - - /** - * Add a public enum to this package - * @param name - * Name of the enum to be added to this package - * @param mods - * Modifiers for this enum declaration - * @return - * newly created Enum - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _enum (int mods,String name) throws JClassAlreadyExistsException { - return _class (mods,name,ClassType.ENUM); - } - - - - - - public ClassType getClassType(){ - return this.classType; - } - - public JFieldVar field( - int mods, - Class type, - String name, - JExpression init) { - return field(mods, owner()._ref(type), name, init); - } - - /** - * Returns all the fields declred in this class. - * The returned {@link Map} is a read-only live view. - * - * @return always non-null. - */ - public Map fields() { - return Collections.unmodifiableMap(fields); - } - - /** - * Removes a {@link JFieldVar} from this class. - * - * @throws IllegalArgumentException - * if the given field is not a field on this class. - */ - public void removeField(JFieldVar field) { - if(fields.remove(field.name())!=field) - throw new IllegalArgumentException(); - } - - /** - * Creates, if necessary, and returns the static initializer - * for this class. - * - * @return JBlock containing initialization statements for this class - */ - public JBlock init() { - if (init == null) - init = new JBlock(); - return init; - } - - /** - * Adds a constructor to this class. - * - * @param mods - * Modifiers for this constructor - */ - public JMethod constructor(int mods) { - JMethod c = new JMethod(mods, this); - constructors.add(c); - return c; - } - - /** - * Returns an iterator that walks the constructors defined in this class. - */ - public Iterator constructors() { - return constructors.iterator(); - } - - /** - * Looks for a method that has the specified method signature - * and return it. - * - * @return - * null if not found. - */ - public JMethod getConstructor(JType[] argTypes) { - for (JMethod m : constructors) { - if (m.hasSignature(argTypes)) - return m; - } - return null; - } - - /** - * Add a method to the list of method members of this JDefinedClass instance. - * - * @param mods - * Modifiers for this method - * - * @param type - * Return type for this method - * - * @param name - * Name of the method - * - * @return Newly generated JMethod - */ - public JMethod method(int mods, JType type, String name) { - // XXX problems caught in M constructor - JMethod m = new JMethod(this, mods, type, name); - methods.add(m); - return m; - } - - public JMethod method(int mods, Class type, String name) { - return method(mods, owner()._ref(type), name); - } - - /** - * Returns the set of methods defined in this class. - */ - public Collection methods() { - return methods; - } - - /** - * Looks for a method that has the specified method signature - * and return it. - * - * @return - * null if not found. - */ - public JMethod getMethod(String name, JType[] argTypes) { - for (JMethod m : methods) { - if (!m.name().equals(name)) - continue; - - if (m.hasSignature(argTypes)) - return m; - } - return null; - } - - public boolean isClass() { - return true; - } - public boolean isPackage() { - return false; - } - public JPackage getPackage() { return parentContainer().getPackage(); } - - /** - * Add a new nested class to this class. - * - * @param mods - * Modifiers for this class declaration - * - * @param name - * Name of class to be added to this package - * - * @return Newly generated class - */ - public JDefinedClass _class(int mods, String name) - throws JClassAlreadyExistsException { - return _class(mods, name, ClassType.CLASS); - } - - /** - * {@inheritDoc} - * - * @deprecated - */ - public JDefinedClass _class(int mods, String name, boolean isInterface) throws JClassAlreadyExistsException { - return _class(mods,name,isInterface?ClassType.INTERFACE:ClassType.CLASS); - } - - public JDefinedClass _class(int mods, String name, ClassType classTypeVal) - throws JClassAlreadyExistsException { - - String NAME; - if (JCodeModel.isCaseSensitiveFileSystem) - NAME = name.toUpperCase(); - else - NAME = name; - - if (getClasses().containsKey(NAME)) - throw new JClassAlreadyExistsException(getClasses().get(NAME)); - else { - // XXX problems caught in the NC constructor - JDefinedClass c = new JDefinedClass(this, mods, name, classTypeVal); - getClasses().put(NAME,c); - return c; - } - } - - /** - * Add a new public nested class to this class. - */ - public JDefinedClass _class(String name) - throws JClassAlreadyExistsException { - return _class(JMod.PUBLIC, name); - } - - /** - * Add an interface to this package. - * - * @param mods - * Modifiers for this interface declaration - * - * @param name - * Name of interface to be added to this package - * - * @return Newly generated interface - */ - public JDefinedClass _interface(int mods, String name) - throws JClassAlreadyExistsException { - return _class(mods, name, ClassType.INTERFACE); - } - - /** - * Adds a public interface to this package. - */ - public JDefinedClass _interface(String name) - throws JClassAlreadyExistsException { - return _interface(JMod.PUBLIC, name); - } - - /** - * Creates, if necessary, and returns the class javadoc for this - * JDefinedClass - * - * @return JDocComment containing javadocs for this class - */ - public JDocComment javadoc() { - if (jdoc == null) - jdoc = new JDocComment(owner()); - return jdoc; - } - - /** - * Mark this file as hidden, so that this file won't be - * generated. - * - *

- * This feature could be used to generate code that refers - * to class X, without actually generating X.java. - */ - public void hide() { - hideFile = true; - } - - public boolean isHidden() { - return hideFile; - } - - /** - * Returns an iterator that walks the nested classes defined in this - * class. - */ - public final Iterator classes() { - if(classes==null) - return Collections.emptyList().iterator(); - else - return classes.values().iterator(); - } - - private Map getClasses() { - if(classes==null) - classes = new TreeMap(); - return classes; - } - - - /** - * Returns all the nested classes defined in this class. - */ - public final JClass[] listClasses() { - if(classes==null) - return new JClass[0]; - else - return classes.values().toArray(new JClass[classes.values().size()]); - } - - @Override - public JClass outer() { - if (outer.isClass()) - return (JClass) outer; - else - return null; - } - - public void declare(JFormatter f) { - if (jdoc != null) - f.nl().g(jdoc); - - if (annotations != null){ - for (JAnnotationUse annotation : annotations) - f.g(annotation).nl(); - } - - f.g(mods).p(classType.declarationToken).id(name).d(generifiable); - - if (superClass != null && superClass != owner().ref(Object.class)) - f.nl().i().p("extends").g(superClass).nl().o(); - - if (!interfaces.isEmpty()) { - if (superClass == null) - f.nl(); - f.i().p(classType==ClassType.INTERFACE ? "extends" : "implements"); - f.g(interfaces); - f.nl().o(); - } - declareBody(f); - } - - /** - * prints the body of a class. - */ - protected void declareBody(JFormatter f) { - f.p('{').nl().nl().i(); - boolean first = true; - - if (!enumConstantsByName.isEmpty()) { - for (JEnumConstant c : enumConstantsByName.values()) { - if (!first) f.p(',').nl(); - f.d(c); - first = false; - } - f.p(';').nl(); - } - - for( JFieldVar field : fields.values() ) - f.d(field); - if (init != null) - f.nl().p("static").s(init); - for (JMethod m : constructors) { - f.nl().d(m); - } - for (JMethod m : methods) { - f.nl().d(m); - } - if(classes!=null) - for (JDefinedClass dc : classes.values()) - f.nl().d(dc); - - - if (directBlock != null) - f.p(directBlock); - f.nl().o().p('}').nl(); - } - - /** - * Places the given string directly inside the generated class. - * - * This method can be used to add methods/fields that are not - * generated by CodeModel. - * This method should be used only as the last resort. - */ - public void direct(String string) { - if (directBlock == null) - directBlock = string; - else - directBlock += string; - } - - public final JPackage _package() { - JClassContainer p = outer; - while (!(p instanceof JPackage)) - p = p.parentContainer(); - return (JPackage) p; - } - - public final JClassContainer parentContainer() { - return outer; - } - - public JTypeVar generify(String name) { - return generifiable.generify(name); - } - public JTypeVar generify(String name, Class bound) { - return generifiable.generify(name, bound); - } - public JTypeVar generify(String name, JClass bound) { - return generifiable.generify(name, bound); - } - @Override - public JTypeVar[] typeParams() { - return generifiable.typeParams(); - } - - protected JClass substituteParams( - JTypeVar[] variables, - List bindings) { - return this; - } - - /** Adding ability to annotate a class - * @param clazz - * The annotation class to annotate the class with - */ - public JAnnotationUse annotate(Class clazz){ - return annotate(owner().ref(clazz)); - } - - /** Adding ability to annotate a class - * @param clazz - * The annotation class to annotate the class with - */ - public JAnnotationUse annotate(JClass clazz){ - if(annotations==null) - annotations = new ArrayList(); - JAnnotationUse a = new JAnnotationUse(clazz); - annotations.add(a); - return a; - } - - public W annotate2(Class clazz) { - return TypedAnnotationWriter.create(clazz,this); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JDirectClass.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JDirectClass.java deleted file mode 100644 index f262d892ea9..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JDirectClass.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.Iterator; -import java.util.List; -import java.util.Collections; - -/** - * A special {@link JClass} that represents an unknown class (except its name.) - * - * @author Kohsuke Kawaguchi - * @see JCodeModel#directClass(String) - */ -final class JDirectClass extends JClass { - - private final String fullName; - - public JDirectClass(JCodeModel _owner,String fullName) { - super(_owner); - this.fullName = fullName; - } - - public String name() { - int i = fullName.lastIndexOf('.'); - if(i>=0) return fullName.substring(i+1); - return fullName; - } - - public String fullName() { - return fullName; - } - - public JPackage _package() { - int i = fullName.lastIndexOf('.'); - if(i>=0) return owner()._package(fullName.substring(0,i)); - else return owner().rootPackage(); - } - - public JClass _extends() { - return owner().ref(Object.class); - } - - public Iterator _implements() { - return Collections.emptyList().iterator(); - } - - public boolean isInterface() { - return false; - } - - public boolean isAbstract() { - return false; - } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - return this; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JDoLoop.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JDoLoop.java deleted file mode 100644 index e76b065c7b4..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JDoLoop.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Do loops - */ - -public class JDoLoop implements JStatement { - - /** - * Test part of Do statement for determining exit state - */ - private JExpression test; - - /** - * JBlock of statements which makes up body of this Do statement - */ - private JBlock body = null; - - /** - * Construct a Do statment - */ - JDoLoop(JExpression test) { - this.test = test; - } - - public JBlock body() { - if (body == null) body = new JBlock(); - return body; - } - - public void state(JFormatter f) { - f.p("do"); - if (body != null) - f.g(body); - else - f.p("{ }"); - - if (JOp.hasTopOp(test)) { - f.p("while ").g(test); - } else { - f.p("while (").g(test).p(')'); - } - f.p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JDocComment.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JDocComment.java deleted file mode 100644 index aadb5b18678..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JDocComment.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.HashMap; -import java.util.Map; - -/** - * JavaDoc comment. - * - *

- * A javadoc comment consists of multiple parts. There's the main part (that comes the first in - * in the comment section), then the parameter parts (@param), the return part (@return), - * and the throws parts (@throws). - * - * TODO: it would be nice if we have JComment class and we can derive this class from there. - */ -public class JDocComment extends JCommentPart implements JGenerable { - - - /** list of @param tags */ - private final Map atParams = new HashMap(); - - /** list of xdoclets */ - private final Map> atXdoclets = new HashMap>(); - - /** list of @throws tags */ - private final Map atThrows = new HashMap(); - - /** - * The @return tag part. - */ - private JCommentPart atReturn = null; - - /** The @deprecated tag */ - private JCommentPart atDeprecated = null; - - private final JCodeModel owner; - - - public JDocComment(JCodeModel owner) { - this.owner = owner; - } - - public JDocComment append(Object o) { - add(o); - return this; - } - - /** - * Append a text to a @param tag to the javadoc - */ - public JCommentPart addParam( String param ) { - JCommentPart p = atParams.get(param); - if(p==null) - atParams.put(param,p=new JCommentPart()); - return p; - } - - /** - * Append a text to an @param tag. - */ - public JCommentPart addParam( JVar param ) { - return addParam( param.name() ); - } - - - /** - * add an @throws tag to the javadoc - */ - public JCommentPart addThrows( Class exception ) { - return addThrows( owner.ref(exception) ); - } - - /** - * add an @throws tag to the javadoc - */ - public JCommentPart addThrows( JClass exception ) { - JCommentPart p = atThrows.get(exception); - if(p==null) - atThrows.put(exception,p=new JCommentPart()); - return p; - } - - /** - * Appends a text to @return tag. - */ - public JCommentPart addReturn() { - if(atReturn==null) - atReturn = new JCommentPart(); - return atReturn; - } - - /** - * add an @deprecated tag to the javadoc, with the associated message. - */ - public JCommentPart addDeprecated() { - if(atDeprecated==null) - atDeprecated = new JCommentPart(); - return atDeprecated; - } - - /** - * add an xdoclet. - */ - public Map addXdoclet(String name) { - Map p = atXdoclets.get(name); - if(p==null) - atXdoclets.put(name,p=new HashMap()); - return p; - } - - /** - * add an xdoclet. - */ - public Map addXdoclet(String name, Map attributes) { - Map p = atXdoclets.get(name); - if(p==null) - atXdoclets.put(name,p=new HashMap()); - p.putAll(attributes); - return p; - } - - /** - * add an xdoclet. - */ - public Map addXdoclet(String name, String attribute, String value) { - Map p = atXdoclets.get(name); - if(p==null) - atXdoclets.put(name,p=new HashMap()); - p.put(attribute, value); - return p; - } - - public void generate(JFormatter f) { - // I realized that we can't use StringTokenizer because - // this will recognize multiple \n as one token. - - f.p("/**").nl(); - - format(f," * "); - - f.p(" * ").nl(); - for (Map.Entry e : atParams.entrySet()) { - f.p(" * @param ").p(e.getKey()).nl(); - e.getValue().format(f,INDENT); - } - if( atReturn != null ) { - f.p(" * @return").nl(); - atReturn.format(f,INDENT); - } - for (Map.Entry e : atThrows.entrySet()) { - f.p(" * @throws ").t(e.getKey()).nl(); - e.getValue().format(f,INDENT); - } - if( atDeprecated != null ) { - f.p(" * @deprecated").nl(); - atDeprecated.format(f,INDENT); - } - for (Map.Entry> e : atXdoclets.entrySet()) { - f.p(" * @").p(e.getKey()); - if (e.getValue() != null) { - for (Map.Entry a : e.getValue().entrySet()) { - f.p(" ").p(a.getKey()).p("= \"").p(a.getValue()).p("\""); - } - } - f.nl(); - } - f.p(" */").nl(); - } - - private static final String INDENT = " * "; -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JEnumConstant.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JEnumConstant.java deleted file mode 100644 index 1f69c2fe948..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JEnumConstant.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; -import java.lang.annotation.Annotation; - -/** - * Enum Constant. - * - * When used as an {@link JExpression}, this object represents a reference to the enum constant. - * - * @author - * Bhakti Mehta (Bhakti.Mehta@sun.com) - */ -public final class JEnumConstant extends JExpressionImpl implements JDeclaration, JAnnotatable { - - /** - * The constant. - */ - private final String name; - /** - * The enum class. - */ - private final JDefinedClass type; - /** - * javadoc comments, if any. - */ - private JDocComment jdoc = null; - - /** - * Annotations on this variable. Lazily created. - */ - private List annotations = null; - - - /** - * List of the constructor argument expressions. - * Lazily constructed. - */ - private List args = null; - - JEnumConstant(JDefinedClass type,String name) { - this.name = name; - this.type = type; - } - - /** - * Add an expression to this constructor's argument list - * - * @param arg - * Argument to add to argument list - */ - public JEnumConstant arg(JExpression arg) { - if(arg==null) throw new IllegalArgumentException(); - if(args==null) - args = new ArrayList(); - args.add(arg); - return this; - } - - /** - * Returns the name of this constant. - * - * @return never null. - */ - public String getName() { - return this.type.fullName().concat(".").concat(this.name); - } - - /** - * Creates, if necessary, and returns the enum constant javadoc. - * - * @return JDocComment containing javadocs for this constant. - */ - public JDocComment javadoc() { - if (jdoc == null) - jdoc = new JDocComment(type.owner()); - return jdoc; - } - - /** - * Adds an annotation to this variable. - * @param clazz - * The annotation class to annotate the field with - */ - public JAnnotationUse annotate(JClass clazz){ - if(annotations==null) - annotations = new ArrayList(); - JAnnotationUse a = new JAnnotationUse(clazz); - annotations.add(a); - return a; - } - - /** - * Adds an annotation to this variable. - * - * @param clazz - * The annotation class to annotate the field with - */ - public JAnnotationUse annotate(Class clazz){ - return annotate(type.owner().ref(clazz)); - } - - public W annotate2(Class clazz) { - return TypedAnnotationWriter.create(clazz,this); - } - - public void declare(JFormatter f) { - if( jdoc != null ) - f.nl().g( jdoc ); - if (annotations != null) { - for( int i=0; itrue - */ - public static final JExpression TRUE = new JAtom("true"); - - /** - * Boolean constant that represents false - */ - public static final JExpression FALSE = new JAtom("false"); - - public static JExpression lit(boolean b) { - return b?TRUE:FALSE; - } - - public static JExpression lit(int n) { - return new JAtom(Integer.toString(n)); - } - - public static JExpression lit(long n) { - return new JAtom(Long.toString(n) + "L"); - } - - public static JExpression lit(float f) { - return new JAtom(Float.toString(f) + "F"); - } - - public static JExpression lit(double d) { - return new JAtom(Double.toString(d) + "D"); - } - - static final String charEscape = "\b\t\n\f\r\"\'\\"; - static final String charMacro = "btnfr\"'\\"; - - /** - * Escapes the given string, then surrounds it by the specified - * quotation mark. - */ - public static String quotify(char quote, String s) { - int n = s.length(); - StringBuilder sb = new StringBuilder(n + 2); - sb.append(quote); - for (int i = 0; i < n; i++) { - char c = s.charAt(i); - int j = charEscape.indexOf(c); - if(j>=0) { - if((quote=='"' && c=='\'') || (quote=='\'' && c=='"')) { - sb.append(c); - } else { - sb.append('\\'); - sb.append(charMacro.charAt(j)); - } - } else { - // technically Unicode escape shouldn't be done here, - // for it's a lexical level handling. - // - // However, various tools are so broken around this area, - // so just to be on the safe side, it's better to do - // the escaping here (regardless of the actual file encoding) - // - // see bug - if( c<0x20 || 0x7E - * This method can be used as a short-cut to create a JExpression. - * For example, instead of _a.gt(_b), you can write - * it as: JExpr.direct("a>b"). - * - *

- * Be warned that there is a danger in using this method, - * as it obfuscates the object model. - */ - public static JExpression direct( final String source ) { - return new JExpressionImpl(){ - public void generate( JFormatter f ) { - f.p('(').p(source).p(')'); - } - }; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JExpression.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JExpression.java deleted file mode 100644 index 70f4844b01d..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JExpression.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * A Java expression. - * - *

- * Unlike most of CodeModel, JExpressions are built bottom-up ( - * meaning you start from leaves and then gradually build compliated expressions - * by combining them.) - * - *

- * {@link JExpression} defines a series of composer methods, - * which returns a complicated expression (by often taking other {@link JExpression}s - * as parameters. - * For example, you can build "5+2" by - * JExpr.lit(5).add(JExpr.lit(2)) - */ -public interface JExpression extends JGenerable { - /** - * Returns "-[this]" from "[this]". - */ - JExpression minus(); - - /** - * Returns "![this]" from "[this]". - */ - JExpression not(); - /** - * Returns "~[this]" from "[this]". - */ - JExpression complement(); - - /** - * Returns "[this]++" from "[this]". - */ - JExpression incr(); - - /** - * Returns "[this]--" from "[this]". - */ - JExpression decr(); - - /** - * Returns "[this]+[right]" - */ - JExpression plus(JExpression right); - - /** - * Returns "[this]-[right]" - */ - JExpression minus(JExpression right); - - /** - * Returns "[this]*[right]" - */ - JExpression mul(JExpression right); - - /** - * Returns "[this]/[right]" - */ - JExpression div(JExpression right); - - /** - * Returns "[this]%[right]" - */ - JExpression mod(JExpression right); - - /** - * Returns "[this]<<[right]" - */ - JExpression shl(JExpression right); - - /** - * Returns "[this]>>[right]" - */ - JExpression shr(JExpression right); - - /** - * Returns "[this]>>>[right]" - */ - JExpression shrz(JExpression right); - - /** Bit-wise AND '&'. */ - JExpression band(JExpression right); - - /** Bit-wise OR '|'. */ - JExpression bor(JExpression right); - - /** Logical AND '&&'. */ - JExpression cand(JExpression right); - - /** Logical OR '||'. */ - JExpression cor(JExpression right); - - JExpression xor(JExpression right); - JExpression lt(JExpression right); - JExpression lte(JExpression right); - JExpression gt(JExpression right); - JExpression gte(JExpression right); - JExpression eq(JExpression right); - JExpression ne(JExpression right); - - /** - * Returns "[this] instanceof [right]" - */ - JExpression _instanceof(JType right); - - /** - * Returns "[this].[method]". - * - * Arguments shall be added to the returned {@link JInvocation} object. - */ - JInvocation invoke(JMethod method); - - /** - * Returns "[this].[method]". - * - * Arguments shall be added to the returned {@link JInvocation} object. - */ - JInvocation invoke(String method); - JFieldRef ref(JVar field); - JFieldRef ref(String field); - JArrayCompRef component(JExpression index); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JExpressionImpl.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JExpressionImpl.java deleted file mode 100644 index 9eb188e55fe..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JExpressionImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * Provides default implementations for {@link JExpression}. - */ -public abstract class JExpressionImpl implements JExpression -{ - // - // - // from JOp - // - // - public final JExpression minus() { - return JOp.minus(this); - } - - /** - * Logical not '!x'. - */ - public final JExpression not() { - return JOp.not(this); - } - - public final JExpression complement() { - return JOp.complement(this); - } - - public final JExpression incr() { - return JOp.incr(this); - } - - public final JExpression decr() { - return JOp.decr(this); - } - - public final JExpression plus(JExpression right) { - return JOp.plus(this, right); - } - - public final JExpression minus(JExpression right) { - return JOp.minus(this, right); - } - - public final JExpression mul(JExpression right) { - return JOp.mul(this, right); - } - - public final JExpression div(JExpression right) { - return JOp.div(this, right); - } - - public final JExpression mod(JExpression right) { - return JOp.mod(this, right); - } - - public final JExpression shl(JExpression right) { - return JOp.shl(this, right); - } - - public final JExpression shr(JExpression right) { - return JOp.shr(this, right); - } - - public final JExpression shrz(JExpression right) { - return JOp.shrz(this, right); - } - - public final JExpression band(JExpression right) { - return JOp.band(this, right); - } - - public final JExpression bor(JExpression right) { - return JOp.bor(this, right); - } - - public final JExpression cand(JExpression right) { - return JOp.cand(this, right); - } - - public final JExpression cor(JExpression right) { - return JOp.cor(this, right); - } - - public final JExpression xor(JExpression right) { - return JOp.xor(this, right); - } - - public final JExpression lt(JExpression right) { - return JOp.lt(this, right); - } - - public final JExpression lte(JExpression right) { - return JOp.lte(this, right); - } - - public final JExpression gt(JExpression right) { - return JOp.gt(this, right); - } - - public final JExpression gte(JExpression right) { - return JOp.gte(this, right); - } - - public final JExpression eq(JExpression right) { - return JOp.eq(this, right); - } - - public final JExpression ne(JExpression right) { - return JOp.ne(this, right); - } - - public final JExpression _instanceof(JType right) { - return JOp._instanceof(this, right); - } - - // - // - // from JExpr - // - // - public final JInvocation invoke(JMethod method) { - return JExpr.invoke(this, method); - } - - public final JInvocation invoke(String method) { - return JExpr.invoke(this, method); - } - - public final JFieldRef ref(JVar field) { - return JExpr.ref(this, field); - } - - public final JFieldRef ref(String field) { - return JExpr.ref(this, field); - } - - public final JArrayCompRef component(JExpression index) { - return JExpr.component(this, index); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JFieldRef.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JFieldRef.java deleted file mode 100644 index fae0e827596..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JFieldRef.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Field Reference - */ - -public class JFieldRef extends JExpressionImpl implements JAssignmentTarget { - /** - * Object expression upon which this field will be accessed, or - * null for the implicit 'this'. - */ - private JGenerable object; - - /** - * Name of the field to be accessed. Either this or {@link #var} is set. - */ - private String name; - - /** - * Variable to be accessed. - */ - private JVar var; - - /** - * Indicates if an explicit this should be generated - */ - private boolean explicitThis; - - /** - * Field reference constructor given an object expression and field name - * - * @param object - * JExpression for the object upon which - * the named field will be accessed, - * - * @param name - * Name of field to access - */ - JFieldRef(JExpression object, String name) { - this(object, name, false); - } - - JFieldRef(JExpression object, JVar v) { - this(object, v, false); - } - - /** - * Static field reference. - */ - JFieldRef(JType type, String name) { - this(type, name, false); - } - - JFieldRef(JType type, JVar v) { - this(type, v, false); - } - - JFieldRef(JGenerable object, String name, boolean explicitThis) { - this.explicitThis = explicitThis; - this.object = object; - if (name.indexOf('.') >= 0) - throw new IllegalArgumentException("Field name contains '.': " + name); - this.name = name; - } - - JFieldRef(JGenerable object, JVar var, boolean explicitThis) { - this.explicitThis = explicitThis; - this.object = object; - this.var = var; - } - - public void generate(JFormatter f) { - String name = this.name; - if(name==null) name=var.name(); - - if (object != null) { - f.g(object).p('.').p(name); - } else { - if (explicitThis) { - f.p("this.").p(name); - } else { - f.id(name); - } - } - } - - public JExpression assign(JExpression rhs) { - return JExpr.assign(this, rhs); - } - public JExpression assignPlus(JExpression rhs) { - return JExpr.assignPlus(this, rhs); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JFieldVar.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JFieldVar.java deleted file mode 100644 index 65023c4c1de..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JFieldVar.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - - - -/** - * A field that can have a {@link JDocComment} associated with it - */ -public class JFieldVar extends JVar { - - /** - * javadoc comments for this JFieldVar - */ - private JDocComment jdoc = null; - - private final JDefinedClass owner; - - - /** - * JFieldVar constructor - * - * @param type - * Datatype of this variable - * - * @param name - * Name of this variable - * - * @param init - * Value to initialize this variable to - */ - JFieldVar(JDefinedClass owner, JMods mods, JType type, String name, JExpression init) { - super( mods, type, name, init ); - this.owner = owner; - } - - @Override - public void name(String name) { - // make sure that the new name is available - if(owner.fields.containsKey(name)) - throw new IllegalArgumentException("name "+name+" is already in use"); - String oldName = name(); - super.name(name); - owner.fields.remove(oldName); - owner.fields.put(name,this); - } - - /** - * Creates, if necessary, and returns the class javadoc for this - * JDefinedClass - * - * @return JDocComment containing javadocs for this class - */ - public JDocComment javadoc() { - if( jdoc == null ) - jdoc = new JDocComment(owner.owner()); - return jdoc; - } - - public void declare(JFormatter f) { - if( jdoc != null ) - f.g( jdoc ); - super.declare( f ); - } - - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JForEach.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JForEach.java deleted file mode 100644 index 80176f36846..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JForEach.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * ForEach Statement - * This will generate the code for statement based on the new - * j2se 1.5 j.l.s. - * - * @author Bhakti - */ -public final class JForEach implements JStatement { - - private final JType type; - private final String var; - private JBlock body = null; // lazily created - private final JExpression collection; - private final JVar loopVar; - - public JForEach(JType vartype, String variable, JExpression collection) { - - this.type = vartype; - this.var = variable; - this.collection = collection; - loopVar = new JVar(JMods.forVar(JMod.NONE), type, var, collection); - } - - - /** - * Returns a reference to the loop variable. - */ - public JVar var() { - return loopVar; - } - - public JBlock body() { - if (body == null) - body = new JBlock(); - return body; - } - - public void state(JFormatter f) { - f.p("for ("); - f.g(type).id(var).p(": ").g(collection); - f.p(')'); - if (body != null) - f.g(body).nl(); - else - f.p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JForLoop.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JForLoop.java deleted file mode 100644 index 16748537a85..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JForLoop.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; - - -/** - * For statement - */ - -public class JForLoop implements JStatement { - - private List inits = new ArrayList(); - private JExpression test = null; - private List updates = new ArrayList(); - private JBlock body = null; - - public JVar init(int mods, JType type, String var, JExpression e) { - JVar v = new JVar(JMods.forVar(mods), type, var, e); - inits.add(v); - return v; - } - - public JVar init(JType type, String var, JExpression e) { - return init(JMod.NONE, type, var, e); - } - - public void init(JVar v, JExpression e) { - inits.add(JExpr.assign(v, e)); - } - - public void test(JExpression e) { - this.test = e; - } - - public void update(JExpression e) { - updates.add(e); - } - - public JBlock body() { - if (body == null) body = new JBlock(); - return body; - } - - public void state(JFormatter f) { - f.p("for ("); - boolean first = true; - for (Object o : inits) { - if (!first) f.p(','); - if (o instanceof JVar) - f.b((JVar) o); - else - f.g((JExpression) o); - first = false; - } - f.p(';').g(test).p(';').g(updates).p(')'); - if (body != null) - f.g(body).nl(); - else - f.p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JFormatter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JFormatter.java deleted file mode 100644 index a7a9983deee..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JFormatter.java +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.io.PrintWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - - -/** - * This is a utility class for managing indentation and other basic - * formatting for PrintWriter. - */ -public final class JFormatter { - /** all classes and ids encountered during the collection mode **/ - /** map from short type name to ReferenceList (list of JClass and ids sharing that name) **/ - private HashMap collectedReferences; - - /** set of imported types (including package java types, eventhough we won't generate imports for them) */ - private HashSet importedClasses; - - private static enum Mode { - /** - * Collect all the type names and identifiers. - * In this mode we don't actually generate anything. - */ - COLLECTING, - /** - * Print the actual source code. - */ - PRINTING - } - - /** - * The current running mode. - * Set to PRINTING so that a casual client can use a formatter just like before. - */ - private Mode mode = Mode.PRINTING; - - /** - * Current number of indentation strings to print - */ - private int indentLevel; - - /** - * String to be used for each indentation. - * Defaults to four spaces. - */ - private final String indentSpace; - - /** - * Stream associated with this JFormatter - */ - private final PrintWriter pw; - - /** - * Creates a JFormatter. - * - * @param s - * PrintWriter to JFormatter to use. - * - * @param space - * Incremental indentation string, similar to tab value. - */ - public JFormatter(PrintWriter s, String space) { - pw = s; - indentSpace = space; - collectedReferences = new HashMap(); - //ids = new HashSet(); - importedClasses = new HashSet(); - } - - /** - * Creates a formatter with default incremental indentations of - * four spaces. - */ - public JFormatter(PrintWriter s) { - this(s, " "); - } - - /** - * Creates a formatter with default incremental indentations of - * four spaces. - */ - public JFormatter(Writer w) { - this(new PrintWriter(w)); - } - - /** - * Closes this formatter. - */ - public void close() { - pw.close(); - } - - /** - * Returns true if we are in the printing mode, - * where we actually produce text. - * - * The other mode is the "collecting mode' - */ - public boolean isPrinting() { - return mode == Mode.PRINTING; - } - - /** - * Decrement the indentation level. - */ - public JFormatter o() { - indentLevel--; - return this; - } - - /** - * Increment the indentation level. - */ - public JFormatter i() { - indentLevel++; - return this; - } - - private boolean needSpace(char c1, char c2) { - if ((c1 == ']') && (c2 == '{')) return true; - if (c1 == ';') return true; - if (c1 == CLOSE_TYPE_ARGS) { - // e.g., "public Foo test;" - if(c2=='(') // but not "new Foo()" - return false; - return true; - } - if ((c1 == ')') && (c2 == '{')) return true; - if ((c1 == ',') || (c1 == '=')) return true; - if (c2 == '=') return true; - if (Character.isDigit(c1)) { - if ((c2 == '(') || (c2 == ')') || (c2 == ';') || (c2 == ',')) - return false; - return true; - } - if (Character.isJavaIdentifierPart(c1)) { - switch (c2) { - case '{': - case '}': - case '+': - case '>': - case '@': - return true; - default: - return Character.isJavaIdentifierStart(c2); - } - } - if (Character.isJavaIdentifierStart(c2)) { - switch (c1) { - case ']': - case ')': - case '}': - case '+': - return true; - default: - return false; - } - } - if (Character.isDigit(c2)) { - if (c1 == '(') return false; - return true; - } - return false; - } - - private char lastChar = 0; - private boolean atBeginningOfLine = true; - - private void spaceIfNeeded(char c) { - if (atBeginningOfLine) { - for (int i = 0; i < indentLevel; i++) - pw.print(indentSpace); - atBeginningOfLine = false; - } else if ((lastChar != 0) && needSpace(lastChar, c)) - pw.print(' '); - } - - /** - * Print a char into the stream - * - * @param c the char - */ - public JFormatter p(char c) { - if(mode==Mode.PRINTING) { - if(c==CLOSE_TYPE_ARGS) { - pw.print('>'); - } else { - spaceIfNeeded(c); - pw.print(c); - } - lastChar = c; - } - return this; - } - - /** - * Print a String into the stream - * - * @param s the String - */ - public JFormatter p(String s) { - if(mode==Mode.PRINTING) { - spaceIfNeeded(s.charAt(0)); - pw.print(s); - lastChar = s.charAt(s.length() - 1); - } - return this; - } - - public JFormatter t(JType type) { - if(type.isReference()) { - return t((JClass)type); - } else { - return g(type); - } - } - - /** - * Print a type name. - * - *

- * In the collecting mode we use this information to - * decide what types to import and what not to. - */ - public JFormatter t(JClass type) { - switch(mode) { - case PRINTING: - // many of the JTypes in this list are either primitive or belong to package java - // so we don't need a FQCN - if(importedClasses.contains(type)) { - p(type.name()); // FQCN imported or not necessary, so generate short name - } else { - if(type.outer()!=null) - t(type.outer()).p('.').p(type.name()); - else - p(type.fullName()); // collision was detected, so generate FQCN - } - break; - case COLLECTING: - final String shortName = type.name(); - if(collectedReferences.containsKey(shortName)) { - collectedReferences.get(shortName).add(type); - } else { - ReferenceList tl = new ReferenceList(); - tl.add(type); - collectedReferences.put(shortName, tl); - } - break; - } - return this; - } - - /** - * Print an identifier - */ - public JFormatter id(String id) { - switch(mode) { - case PRINTING: - p(id); - break; - case COLLECTING: - // see if there is a type name that collides with this id - if(collectedReferences.containsKey(id)) { - if( !collectedReferences.get(id).getClasses().isEmpty() ) { - for( JClass type : collectedReferences.get(id).getClasses() ) { - if (type.outer()!=null) { - collectedReferences.get(id).setId(false); - return this; - } - } - } - collectedReferences.get(id).setId(true); - } else { - // not a type, but we need to create a place holder to - // see if there might be a collision with a type - ReferenceList tl = new ReferenceList(); - tl.setId(true); - collectedReferences.put(id, tl); - } - break; - } - return this; - } - - /** - * Print a new line into the stream - */ - public JFormatter nl() { - if(mode==Mode.PRINTING) { - pw.println(); - lastChar = 0; - atBeginningOfLine = true; - } - return this; - } - - /** - * Cause the JGenerable object to generate source for iteself - * - * @param g the JGenerable object - */ - public JFormatter g(JGenerable g) { - g.generate(this); - return this; - } - - /** - * Produces {@link JGenerable}s separated by ',' - */ - public JFormatter g(Collection list) { - boolean first = true; - if(!list.isEmpty()) { - for (JGenerable item : list) { - if (!first) - p(','); - g(item); - first = false; - } - } - return this; - } - - /** - * Cause the JDeclaration to generate source for itself - * - * @param d the JDeclaration object - */ - public JFormatter d(JDeclaration d) { - d.declare(this); - return this; - } - - /** - * Cause the JStatement to generate source for itself - * - * @param s the JStatement object - */ - public JFormatter s(JStatement s) { - s.state(this); - return this; - } - - /** - * Cause the JVar to generate source for itself - * - * @param v the JVar object - */ - public JFormatter b(JVar v) { - v.bind(this); - return this; - } - - /** - * Generates the whole source code out of the specified class. - */ - void write(JDefinedClass c) { - // first collect all the types and identifiers - mode = Mode.COLLECTING; - d(c); - - javaLang = c.owner()._package("java.lang"); - - // collate type names and identifiers to determine which types can be imported - for( ReferenceList tl : collectedReferences.values() ) { - if(!tl.collisions(c) && !tl.isId()) { - assert tl.getClasses().size() == 1; - - // add to list of collected types - importedClasses.add(tl.getClasses().get(0)); - } - } - - // the class itself that we will be generating is always accessible - importedClasses.add(c); - - // then print the declaration - mode = Mode.PRINTING; - - assert c.parentContainer().isPackage() : "this method is only for a pacakge-level class"; - JPackage pkg = (JPackage) c.parentContainer(); - if (!pkg.isUnnamed()) { - nl().d(pkg); - nl(); - } - - // generate import statements - JClass[] imports = importedClasses.toArray(new JClass[importedClasses.size()]); - Arrays.sort(imports); - for (JClass clazz : imports) { - // suppress import statements for primitive types, built-in types, - // types in the root package, and types in - // the same package as the current type - if(!supressImport(clazz, c)) { - p("import").p(clazz.fullName()).p(';').nl(); - } - } - nl(); - - d(c); - } - - /** - * determine if an import statement should be supressed - * - * @param clazz JType that may or may not have an import - * @param c JType that is the current class being processed - * @return true if an import statement should be suppressed, false otherwise - */ - private boolean supressImport(JClass clazz, JClass c) { - if(clazz._package().isUnnamed()) - return true; - - final String packageName = clazz._package().name(); - if(packageName.equals("java.lang")) - return true; // no need to explicitly import java.lang classes - - if (clazz._package() == c._package()){ - // inner classes require an import stmt. - // All other pkg local classes do not need an - // import stmt for ref. - if(clazz.outer()==null) { - return true; // no need to explicitly import a class into itself - } - } - return false; - } - - private JPackage javaLang; - - - - /** - * Special character token we use to differenciate '>' as an operator and - * '>' as the end of the type arguments. The former uses '>' and it requires - * a preceding whitespace. The latter uses this, and it does not have a preceding - * whitespace. - */ - /*package*/ static final char CLOSE_TYPE_ARGS = '\uFFFF'; - - /** - * Used during the optimization of class imports. - * - * List of {@link JClass}es whose short name is the same. - * - * @author Ryan.Shoemaker@Sun.COM - */ - final class ReferenceList { - private final ArrayList classes = new ArrayList(); - - /** true if this name is used as an identifier (like a variable name.) **/ - private boolean id; - - /** - * Returns true if the symbol represented by the short name - * is "importable". - */ - public boolean collisions(JDefinedClass enclosingClass) { - // special case where a generated type collides with a type in package java - - // more than one type with the same name - if(classes.size() > 1) - return true; - - // an id and (at least one) type with the same name - if(id && classes.size() != 0) - return true; - - for(JClass c : classes) { - if(c._package()==javaLang) { - // make sure that there's no other class with this name within the same package - Iterator itr = enclosingClass._package().classes(); - while(itr.hasNext()) { - // even if this is the only "String" class we use, - // if the class called "String" is in the same package, - // we still need to import it. - JDefinedClass n = (JDefinedClass)itr.next(); - if(n.name().equals(c.name())) - return true; //collision - } - } - if(c.outer()!=null) - return true; // avoid importing inner class to work around 6431987. Also see jaxb issue 166 - } - - return false; - } - - public void add(JClass clazz) { - if(!classes.contains(clazz)) - classes.add(clazz); - } - - public List getClasses() { - return classes; - } - - public void setId(boolean value) { - id = value; - } - - /** - * Return true iff this is strictly an id, meaning that there - * are no collisions with type names. - */ - public boolean isId() { - return id && classes.size() == 0; - } - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerable.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerable.java deleted file mode 100644 index 95071a0247a..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Common interface for code components that can generate - * uses of themselves. - */ - -interface JGenerable { - - public void generate(JFormatter f); - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerifiable.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerifiable.java deleted file mode 100644 index e8c5cf2298a..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerifiable.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * Declarations that can have type variables. - * - * Something that can be made into a generic. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public interface JGenerifiable { - /** - * Adds a new type variable to this declaration. - */ - JTypeVar generify( String name ); - - /** - * Adds a new type variable to this declaration with a bound. - */ - JTypeVar generify( String name, Class bound ); - - /** - * Adds a new type variable to this declaration with a bound. - */ - JTypeVar generify( String name, JClass bound ); - - /** - * Iterates all the type parameters of this class/interface. - */ - JTypeVar[] typeParams(); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerifiableImpl.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerifiableImpl.java deleted file mode 100644 index 8fabe705bd6..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JGenerifiableImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; - -/** - * Implementation of {@link JGenerifiable}. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -abstract class JGenerifiableImpl implements JGenerifiable, JDeclaration { - - /** Lazily created list of {@link JTypeVar}s. */ - private List typeVariables = null; - - protected abstract JCodeModel owner(); - - public void declare( JFormatter f ) { - if(typeVariables!=null) { - f.p('<'); - for (int i = 0; i < typeVariables.size(); i++) { - if(i!=0) f.p(','); - f.d(typeVariables.get(i)); - } - f.p('>'); - } - } - - - public JTypeVar generify(String name) { - JTypeVar v = new JTypeVar(owner(),name); - if(typeVariables==null) - typeVariables = new ArrayList(3); - typeVariables.add(v); - return v; - } - - public JTypeVar generify(String name, Class bound) { - return generify(name,owner().ref(bound)); - } - - public JTypeVar generify(String name, JClass bound) { - return generify(name).bound(bound); - } - - public JTypeVar[] typeParams() { - if(typeVariables==null) - return JTypeVar.EMPTY_ARRAY; - else - return typeVariables.toArray(new JTypeVar[typeVariables.size()]); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JInvocation.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JInvocation.java deleted file mode 100644 index a941cf26926..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JInvocation.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; - - -/** - * JMethod invocation - */ -public final class JInvocation extends JExpressionImpl implements JStatement { - - /** - * Object expression upon which this method will be invoked, or null if - * this is a constructor invocation - */ - private JGenerable object; - - /** - * Name of the method to be invoked. - * Either this field is set, or {@link #method}, or {@link #type} (in which case it's a - * constructor invocation.) - * This allows {@link JMethod#name(String) the name of the method to be changed later}. - */ - private String name; - - private JMethod method; - - private boolean isConstructor = false; - - /** - * List of argument expressions for this method invocation - */ - private List args = new ArrayList(); - - /** - * If isConstructor==true, this field keeps the type to be created. - */ - private JType type = null; - - /** - * Invokes a method on an object. - * - * @param object - * JExpression for the object upon which - * the named method will be invoked, - * or null if none - * - * @param name - * Name of method to invoke - */ - JInvocation(JExpression object, String name) { - this( (JGenerable)object, name ); - } - - JInvocation(JExpression object, JMethod method) { - this( (JGenerable)object, method ); - } - - /** - * Invokes a static method on a class. - */ - JInvocation(JClass type, String name) { - this( (JGenerable)type, name ); - } - - JInvocation(JClass type, JMethod method) { - this( (JGenerable)type, method ); - } - - private JInvocation(JGenerable object, String name) { - this.object = object; - if (name.indexOf('.') >= 0) - throw new IllegalArgumentException("method name contains '.': " + name); - this.name = name; - } - - private JInvocation(JGenerable object, JMethod method) { - this.object = object; - this.method =method; - } - - /** - * Invokes a constructor of an object (i.e., creates - * a new object.) - * - * @param c - * Type of the object to be created. If this type is - * an array type, added arguments are treated as array - * initializer. Thus you can create an expression like - * new int[]{1,2,3,4,5}. - */ - JInvocation(JType c) { - this.isConstructor = true; - this.type = c; - } - - /** - * Add an expression to this invocation's argument list - * - * @param arg - * Argument to add to argument list - */ - public JInvocation arg(JExpression arg) { - if(arg==null) throw new IllegalArgumentException(); - args.add(arg); - return this; - } - - /** - * Adds a literal argument. - * - * Short for {@code arg(JExpr.lit(v))} - */ - public JInvocation arg(String v) { - return arg(JExpr.lit(v)); - } - - - public void generate(JFormatter f) { - if (isConstructor && type.isArray()) { - // [RESULT] new T[]{arg1,arg2,arg3,...}; - f.p("new").g(type).p('{'); - } else { - if (isConstructor) - f.p("new").g(type).p('('); - else { - String name = this.name; - if(name==null) name=this.method.name(); - - if (object != null) - f.g(object).p('.').p(name).p('('); - else - f.id(name).p('('); - } - } - - f.g(args); - - if (isConstructor && type.isArray()) - f.p('}'); - else - f.p(')'); - - if( type instanceof JDefinedClass && ((JDefinedClass)type).isAnonymous() ) { - ((JAnonymousClass)type).declareBody(f); - } - } - - public void state(JFormatter f) { - f.g(this).p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JJavaName.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JJavaName.java deleted file mode 100644 index c117214694f..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JJavaName.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.HashSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Utility methods that convert arbitrary strings into Java identifiers. - */ -public class JJavaName { - - - /** - * Checks if a given string is usable as a Java identifier. - */ - public static boolean isJavaIdentifier(String s) { - if(s.length()==0) return false; - if( reservedKeywords.contains(s) ) return false; - - if(!Character.isJavaIdentifierStart(s.charAt(0))) return false; - - for (int i = 1; i < s.length(); i++) - if (!Character.isJavaIdentifierPart(s.charAt(i))) - return false; - - return true; - } - - /** - * Checks if the given string is a valid fully qualified name. - */ - public static boolean isFullyQualifiedClassName(String s) { - return isJavaPackageName(s); - } - - /** - * Checks if the given string is a valid Java package name. - */ - public static boolean isJavaPackageName(String s) { - while(s.length()!=0) { - int idx = s.indexOf('.'); - if(idx==-1) idx=s.length(); - if( !isJavaIdentifier(s.substring(0,idx)) ) - return false; - - s = s.substring(idx); - if(s.length()!=0) s = s.substring(1); // remove '.' - } - return true; - } - - /** - * Experimental API: converts an English word into a plural form. - * - * @param word - * a word, such as "child", "apple". Must not be null. - * It accepts word concatanation forms - * that are common in programming languages, such as "my_child", "MyChild", - * "myChild", "MY-CHILD", "CODE003-child", etc, and mostly tries to do the right thing. - * ("my_children","MyChildren","myChildren", and "MY-CHILDREN", "CODE003-children" respectively) - *

- * Although this method only works for English words, it handles non-English - * words gracefully (by just returning it as-is.) For example, 日本語 - * will be returned as-is without modified, not "日本語s" - *

- * This method doesn't handle suffixes very well. For example, passing - * "person56" will return "person56s", not "people56". - * - * @return - * always non-null. - */ - public static String getPluralForm(String word) { - // remember the casing of the word - boolean allUpper = true; - - // check if the word looks like an English word. - // if we see non-ASCII characters, abort - for(int i=0; i=0x80) - return word; - - // note that this isn't the same as allUpper &= Character.isUpperCase(ch); - allUpper &= !Character.isLowerCase(ch); - } - - for (Entry e : TABLE) { - String r = e.apply(word); - if(r!=null) { - if(allUpper) r=r.toUpperCase(); - return r; - } - } - - // failed - return word; - } - - - /** All reserved keywords of Java. */ - private static HashSet reservedKeywords = new HashSet(); - - static { - // see http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html - String[] words = new String[]{ - "abstract", - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", - "continue", - "default", - "do", - "double", - "else", - "extends", - "final", - "finally", - "float", - "for", - "goto", - "if", - "implements", - "import", - "instanceof", - "int", - "interface", - "long", - "native", - "new", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "strictfp", - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "try", - "void", - "volatile", - "while", - - // technically these are not reserved words but they cannot be used as identifiers. - "true", - "false", - "null", - - // and I believe assert is also a new keyword - "assert", - - // and 5.0 keywords - "enum" - }; - for (String w : words) - reservedKeywords.add(w); - } - - - private static class Entry { - private final Pattern pattern; - private final String replacement; - - public Entry(String pattern, String replacement) { - this.pattern = Pattern.compile(pattern,Pattern.CASE_INSENSITIVE); - this.replacement = replacement; - } - - String apply(String word) { - Matcher m = pattern.matcher(word); - if(m.matches()) { - StringBuffer buf = new StringBuffer(); - m.appendReplacement(buf,replacement); - return buf.toString(); - } else { - return null; - } - } - } - - private static final Entry[] TABLE; - - static { - String[] source = { - "(.*)child","$1children", - "(.+)fe","$1ves", - "(.*)mouse","$1mise", - "(.+)f","$1ves", - "(.+)ch","$1ches", - "(.+)sh","$1shes", - "(.*)tooth","$1teeth", - "(.+)um","$1a", - "(.+)an","$1en", - "(.+)ato","$1atoes", - "(.*)basis","$1bases", - "(.*)axis","$1axes", - "(.+)is","$1ises", - "(.+)ss","$1sses", - "(.+)us","$1uses", - "(.+)s","$1s", - "(.*)foot","$1feet", - "(.+)ix","$1ixes", - "(.+)ex","$1ices", - "(.+)nx","$1nxes", - "(.+)x","$1xes", - "(.+)y","$1ies", - "(.+)","$1s", - }; - - TABLE = new Entry[source.length/2]; - - for( int i=0; i params = new ArrayList(); - - /** - * Set of exceptions that this method may throw. - * A set instance lazily created. - */ - private Set _throws; - - /** - * JBlock of statements that makes up the body this method - */ - private JBlock body = null; - - private JDefinedClass outer; - - /** - * javadoc comments for this JMethod - */ - private JDocComment jdoc = null; - - /** - * Variable parameter for this method's varargs declaration - * introduced in J2SE 1.5 - */ - private JVar varParam = null; - - /** - * Annotations on this variable. Lazily created. - */ - private List annotations = null; - - - private boolean isConstructor() { - return type == null; - } - - /** To set the default value for the - * annotation member - */ - private JExpression defaultValue = null; - - - /** - * JMethod constructor - * - * @param mods - * Modifiers for this method's declaration - * - * @param type - * Return type for the method - * - * @param name - * Name of this method - */ - JMethod(JDefinedClass outer, int mods, JType type, String name) { - this.mods = JMods.forMethod(mods); - this.type = type; - this.name = name; - this.outer = outer; - } - - /** - * Constructor constructor - * - * @param mods - * Modifiers for this constructor's declaration - * - * @param _class - * JClass containing this constructor - */ - JMethod(int mods, JDefinedClass _class) { - this.mods = JMods.forMethod(mods); - this.type = null; - this.name = _class.name(); - this.outer = _class; - } - - private Set getThrows() { - if(_throws==null) - _throws = new TreeSet(ClassNameComparator.theInstance); - return _throws; - } - - /** - * Add an exception to the list of exceptions that this - * method may throw. - * - * @param exception - * Name of an exception that this method may throw - */ - public JMethod _throws(JClass exception) { - getThrows().add(exception); - return this; - } - - public JMethod _throws(Class exception) { - return _throws(outer.owner().ref(exception)); - } - - /** - * Add the specified variable to the list of parameters - * for this method signature. - * - * @param type - * JType of the parameter being added - * - * @param name - * Name of the parameter being added - * - * @return New parameter variable - */ - public JVar param(int mods, JType type, String name) { - JVar v = new JVar(JMods.forVar(mods), type, name, null); - params.add(v); - return v; - } - - public JVar param(JType type, String name) { - return param(JMod.NONE, type, name); - } - - public JVar param(int mods, Class type, String name) { - return param(mods, outer.owner()._ref(type), name); - } - - public JVar param(Class type, String name) { - return param(outer.owner()._ref(type), name); - } - - /** - * @see #varParam(JType, String) - */ - public JVar varParam(Class type, String name) { - return varParam(outer.owner()._ref(type),name); - } - - /** - * Add the specified variable argument to the list of parameters - * for this method signature. - * - * @param type - * Type of the parameter being added. - * - * @param name - * Name of the parameter being added - * - * @return the variable parameter - * - * @throws IllegalStateException - * If this method is called twice. - * varargs in J2SE 1.5 can appear only once in the - * method signature. - */ - public JVar varParam(JType type, String name) { - if (!hasVarArgs()) { - - varParam = - new JVar( - JMods.forVar(JMod.NONE), - type.array(), - name, - null); - return varParam; - } else { - throw new IllegalStateException( - "Cannot have two varargs in a method,\n" - + "Check if varParam method of JMethod is" - + " invoked more than once"); - - } - - } - - /** - * Adds an annotation to this variable. - * @param clazz - * The annotation class to annotate the field with - */ - public JAnnotationUse annotate(JClass clazz){ - if(annotations==null) - annotations = new ArrayList(); - JAnnotationUse a = new JAnnotationUse(clazz); - annotations.add(a); - return a; - } - - /** - * Adds an annotation to this variable. - * - * @param clazz - * The annotation class to annotate the field with - */ - public JAnnotationUse annotate(Class clazz){ - return annotate(owner().ref(clazz)); - } - - public W annotate2(Class clazz) { - return TypedAnnotationWriter.create(clazz,this); - } - - /** - * Check if there are any varargs declared - * for this method signature. - */ - public boolean hasVarArgs() { - return this.varParam!=null; - } - - public String name() { - return name; - } - - /** - * Changes the name of the method. - */ - public void name(String n) { - this.name = n; - } - - /** - * Returns the return type. - */ - public JType type() { - return type; - } - - /** - * Overrides the return type. - */ - public void type(JType t) { - this.type = t; - } - - /** - * Returns all the parameter types in an array. - * @return - * If there's no parameter, an empty array will be returned. - */ - public JType[] listParamTypes() { - JType[] r = new JType[params.size()]; - for (int i = 0; i < r.length; i++) - r[i] = params.get(i).type(); - return r; - } - - /** - * Returns the varags parameter type. - * @return - * If there's no vararg parameter type, null will be returned. - */ - public JType listVarParamType() { - if (varParam != null) - return varParam.type(); - else - return null; - } - - /** - * Returns all the parameters in an array. - * @return - * If there's no parameter, an empty array will be returned. - */ - public JVar[] listParams() { - return params.toArray(new JVar[params.size()]); - } - - /** - * Returns the variable parameter - * @return - * If there's no parameter, null will be returned. - */ - public JVar listVarParam() { - return varParam; - } - - /** - * Returns true if the method has the specified signature. - */ - public boolean hasSignature(JType[] argTypes) { - JVar[] p = listParams(); - if (p.length != argTypes.length) - return false; - - for (int i = 0; i < p.length; i++) - if (!p[i].type().equals(argTypes[i])) - return false; - - return true; - } - - /** - * Get the block that makes up body of this method - * - * @return Body of method - */ - public JBlock body() { - if (body == null) - body = new JBlock(); - return body; - } - - /** - * Specify the default value for this annotation member - * @param value - * Default value for the annotation member - * - */ - public void declareDefaultValue(JExpression value){ - this.defaultValue = value; - } - - /** - * Creates, if necessary, and returns the class javadoc for this - * JDefinedClass - * - * @return JDocComment containing javadocs for this class - */ - public JDocComment javadoc() { - if (jdoc == null) - jdoc = new JDocComment(owner()); - return jdoc; - } - - public void declare(JFormatter f) { - if (jdoc != null) - f.g(jdoc); - - if (annotations != null){ - for (JAnnotationUse a : annotations) - f.g(a).nl(); - } - - f.g(mods); - - // declare the generics parameters - super.declare(f); - - if (!isConstructor()) - f.g(type); - f.id(name).p('(').i(); - // when parameters are printed in new lines, we want them to be indented. - // there's a good chance no newlines happen, too, but just in case it does. - boolean first = true; - for (JVar var : params) { - if (!first) - f.p(','); - if(var.isAnnotated()) - f.nl(); - f.b(var); - first = false; - } - if (hasVarArgs()) { - if (!first) - f.p(','); - f.g(varParam.type().elementType()); - f.p("... "); - f.id(varParam.name()); - } - - f.o().p(')'); - if (_throws!=null && !_throws.isEmpty()) { - f.nl().i().p("throws").g(_throws).nl().o(); - } - - if (defaultValue != null) { - f.p("default "); - f.g(defaultValue); - } - if (body != null) { - f.s(body); - } else if ( - !outer.isInterface() && !outer.isAnnotationTypeDeclaration() && !mods.isAbstract() && !mods.isNative()) { - // Print an empty body for non-native, non-abstract methods - f.s(new JBlock()); - } else { - f.p(';').nl(); - } - } - - /** - * @return - * the current modifiers of this method. - * Always return non-null valid object. - */ - public JMods mods() { - return mods; - } - - /** - * @deprecated use {@link #mods()} - */ - public JMods getMods() { - return mods; - } - - protected JCodeModel owner() { - return outer.owner(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JMod.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JMod.java deleted file mode 100644 index 64e0c93e04c..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JMod.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Modifier constants. - */ -public final class JMod { - public final static int NONE = 0x000; - public final static int PUBLIC = 0x001; - public final static int PROTECTED = 0x002; - public final static int PRIVATE = 0x004; - public final static int FINAL = 0x008; - public final static int STATIC = 0x010; - public final static int ABSTRACT = 0x020; - public final static int NATIVE = 0x040; - public final static int SYNCHRONIZED = 0x080; - public final static int TRANSIENT = 0x100; - public final static int VOLATILE = 0x200; -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JMods.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JMods.java deleted file mode 100644 index f4596b18455..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JMods.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.io.PrintWriter; -import java.io.StringWriter; - - -/** - * Modifier groups. - */ -public class JMods implements JGenerable { - -// -// mask -// - private static int VAR - = JMod.FINAL; - - private static int FIELD - = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED - | JMod.STATIC | JMod.FINAL - | JMod.TRANSIENT | JMod.VOLATILE); - - private static int METHOD - = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED | JMod.FINAL - | JMod.ABSTRACT | JMod.STATIC | JMod.NATIVE | JMod.SYNCHRONIZED); - - private static int CLASS - = (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED - | JMod.STATIC | JMod.FINAL | JMod.ABSTRACT ); - - private static int INTERFACE = JMod.PUBLIC; - - /** bit-packed representation of modifiers. */ - private int mods; - - private JMods(int mods) { - this.mods = mods; - } - - /** - * Gets the bit-packed representaion of modifiers. - */ - public int getValue() { - return mods; - } - - private static void check(int mods, int legal, String what) { - if ((mods & ~legal) != 0) - throw new IllegalArgumentException("Illegal modifiers for " - + what + ": " - + new JMods(mods).toString()); - /* ## check for illegal combinations too */ - } - - static JMods forVar(int mods) { - check(mods, VAR, "variable"); - return new JMods(mods); - } - - static JMods forField(int mods) { - check(mods, FIELD, "field"); - return new JMods(mods); - } - - static JMods forMethod(int mods) { - check(mods, METHOD, "method"); - return new JMods(mods); - } - - static JMods forClass(int mods) { - check(mods, CLASS, "class"); - return new JMods(mods); - } - - static JMods forInterface(int mods) { - check(mods, INTERFACE, "class"); - return new JMods(mods); - } - - public boolean isAbstract() { - return (mods & JMod.ABSTRACT) != 0; - } - - public boolean isNative() { - return (mods & JMod.NATIVE) != 0; - } - - public boolean isSynchronized() { - return (mods & JMod.SYNCHRONIZED) != 0; - } - - public void setSynchronized(boolean newValue) { - setFlag( JMod.SYNCHRONIZED, newValue ); - } - - // TODO: more - - private void setFlag( int bit, boolean newValue ) { - mods = (mods & ~bit) | (newValue?bit:0); - } - - public void generate(JFormatter f) { - if ((mods & JMod.PUBLIC) != 0) f.p("public"); - if ((mods & JMod.PROTECTED) != 0) f.p("protected"); - if ((mods & JMod.PRIVATE) != 0) f.p("private"); - if ((mods & JMod.FINAL) != 0) f.p("final"); - if ((mods & JMod.STATIC) != 0) f.p("static"); - if ((mods & JMod.ABSTRACT) != 0) f.p("abstract"); - if ((mods & JMod.NATIVE) != 0) f.p("native"); - if ((mods & JMod.SYNCHRONIZED) != 0) f.p("synchronized"); - if ((mods & JMod.TRANSIENT) != 0) f.p("transient"); - if ((mods & JMod.VOLATILE) != 0) f.p("volatile"); - } - - public String toString() { - StringWriter s = new StringWriter(); - JFormatter f = new JFormatter(new PrintWriter(s)); - this.generate(f); - return s.toString(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JNarrowedClass.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JNarrowedClass.java deleted file mode 100644 index 3320e7dd967..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JNarrowedClass.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.Iterator; -import java.util.List; -import java.util.Collections; -import java.util.ArrayList; - -/** - * Represents X<Y>. - * - * TODO: consider separating the decl and the use. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -class JNarrowedClass extends JClass { - /** - * A generic class with type parameters. - */ - final JClass basis; - /** - * Arguments to those parameters. - */ - private final List args; - - JNarrowedClass(JClass basis, JClass arg) { - this(basis,Collections.singletonList(arg)); - } - - JNarrowedClass(JClass basis, List args) { - super(basis.owner()); - this.basis = basis; - assert !(basis instanceof JNarrowedClass); - this.args = args; - } - - public JClass narrow( JClass clazz ) { - List newArgs = new ArrayList(args); - newArgs.add(clazz); - return new JNarrowedClass(basis,newArgs); - } - - public JClass narrow( JClass... clazz ) { - List newArgs = new ArrayList(args); - for (JClass c : clazz) - newArgs.add(c); - return new JNarrowedClass(basis,newArgs); - } - - public String name() { - StringBuffer buf = new StringBuffer(); - buf.append(basis.name()); - buf.append('<'); - boolean first = true; - for (JClass c : args) { - if(first) - first = false; - else - buf.append(','); - buf.append(c.name()); - } - buf.append('>'); - return buf.toString(); - } - - public String fullName() { - StringBuilder buf = new StringBuilder(); - buf.append(basis.fullName()); - buf.append('<'); - boolean first = true; - for (JClass c : args) { - if(first) - first = false; - else - buf.append(','); - buf.append(c.fullName()); - } - buf.append('>'); - return buf.toString(); - } - - public String binaryName() { - StringBuilder buf = new StringBuilder(); - buf.append(basis.binaryName()); - buf.append('<'); - boolean first = true; - for (JClass c : args) { - if(first) - first = false; - else - buf.append(','); - buf.append(c.binaryName()); - } - buf.append('>'); - return buf.toString(); - } - - public void generate(JFormatter f) { - f.t(basis).p('<').g(args).p(JFormatter.CLOSE_TYPE_ARGS); - } - - @Override - void printLink(JFormatter f) { - basis.printLink(f); - f.p("{@code <}"); - boolean first = true; - for( JClass c : args ) { - if(first) - first = false; - else - f.p(','); - c.printLink(f); - } - f.p("{@code >}"); - } - - public JPackage _package() { - return basis._package(); - } - - public JClass _extends() { - JClass base = basis._extends(); - if(base==null) return base; - return base.substituteParams(basis.typeParams(),args); - } - - public Iterator _implements() { - return new Iterator() { - private final Iterator core = basis._implements(); - public void remove() { - core.remove(); - } - public JClass next() { - return core.next().substituteParams(basis.typeParams(),args); - } - public boolean hasNext() { - return core.hasNext(); - } - }; - } - - public JClass erasure() { - return basis; - } - - public boolean isInterface() { - return basis.isInterface(); - } - - public boolean isAbstract() { - return basis.isAbstract(); - } - - public boolean isArray() { - return false; - } - - - // - // Equality is based on value - // - - public boolean equals(Object obj) { - if(!(obj instanceof JNarrowedClass)) return false; - return fullName().equals(((JClass)obj).fullName()); - } - - public int hashCode() { - return fullName().hashCode(); - } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - JClass b = basis.substituteParams(variables,bindings); - boolean different = b!=basis; - - List clazz = new ArrayList(args.size()); - for( int i=0; i getTypeParameters() { - return args; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JNullType.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JNullType.java deleted file mode 100644 index 93ff0491064..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JNullType.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -/** - * Special class object that represents the type of "null". - * - *

- * Use this class with care. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class JNullType extends JClass { - - JNullType(JCodeModel _owner) { - super(_owner); - } - - public String name() { return "null"; } - public String fullName() { return "null"; } - - public JPackage _package() { return owner()._package(""); } - - public JClass _extends() { return null; } - - public Iterator _implements() { - return Collections.emptyList().iterator(); - } - - public boolean isInterface() { return false; } - public boolean isAbstract() { return false; } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - return this; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JOp.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JOp.java deleted file mode 100644 index 23f75d5e4bd..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JOp.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * JClass for generating expressions containing operators - */ - -abstract public class JOp { - - private JOp() { - } - - - /** - * Determine whether the top level of an expression involves an - * operator. - */ - static boolean hasTopOp(JExpression e) { - return (e instanceof UnaryOp) || (e instanceof BinaryOp); - } - - /* -- Unary operators -- */ - - static private class UnaryOp extends JExpressionImpl { - - protected String op; - protected JExpression e; - protected boolean opFirst = true; - - UnaryOp(String op, JExpression e) { - this.op = op; - this.e = e; - } - - UnaryOp(JExpression e, String op) { - this.op = op; - this.e = e; - opFirst = false; - } - - public void generate(JFormatter f) { - if (opFirst) - f.p('(').p(op).g(e).p(')'); - else - f.p('(').g(e).p(op).p(')'); - } - - } - - public static JExpression minus(JExpression e) { - return new UnaryOp("-", e); - } - - /** - * Logical not '!x'. - */ - public static JExpression not(JExpression e) { - if (e == JExpr.TRUE) return JExpr.FALSE; - if (e == JExpr.FALSE) return JExpr.TRUE; - return new UnaryOp("!", e); - } - - public static JExpression complement(JExpression e) { - return new UnaryOp("~", e); - } - - static private class TightUnaryOp extends UnaryOp { - - TightUnaryOp(JExpression e, String op) { - super(e, op); - } - - public void generate(JFormatter f) { - if (opFirst) - f.p(op).g(e); - else - f.g(e).p(op); - } - - } - - public static JExpression incr(JExpression e) { - return new TightUnaryOp(e, "++"); - } - - public static JExpression decr(JExpression e) { - return new TightUnaryOp(e, "--"); - } - - - /* -- Binary operators -- */ - - static private class BinaryOp extends JExpressionImpl { - - String op; - JExpression left; - JGenerable right; - - BinaryOp(String op, JExpression left, JGenerable right) { - this.left = left; - this.op = op; - this.right = right; - } - - public void generate(JFormatter f) { - f.p('(').g(left).p(op).g(right).p(')'); - } - - } - - public static JExpression plus(JExpression left, JExpression right) { - return new BinaryOp("+", left, right); - } - - public static JExpression minus(JExpression left, JExpression right) { - return new BinaryOp("-", left, right); - } - - public static JExpression mul(JExpression left, JExpression right) { - return new BinaryOp("*", left, right); - } - - public static JExpression div(JExpression left, JExpression right) { - return new BinaryOp("/", left, right); - } - - public static JExpression mod(JExpression left, JExpression right) { - return new BinaryOp("%", left, right); - } - - public static JExpression shl(JExpression left, JExpression right) { - return new BinaryOp("<<", left, right); - } - - public static JExpression shr(JExpression left, JExpression right) { - return new BinaryOp(">>", left, right); - } - - public static JExpression shrz(JExpression left, JExpression right) { - return new BinaryOp(">>>", left, right); - } - - public static JExpression band(JExpression left, JExpression right) { - return new BinaryOp("&", left, right); - } - - public static JExpression bor(JExpression left, JExpression right) { - return new BinaryOp("|", left, right); - } - - public static JExpression cand(JExpression left, JExpression right) { - if (left == JExpr.TRUE) return right; - if (right == JExpr.TRUE) return left; - if (left == JExpr.FALSE) return left; // JExpr.FALSE - if (right == JExpr.FALSE) return right; // JExpr.FALSE - return new BinaryOp("&&", left, right); - } - - public static JExpression cor(JExpression left, JExpression right) { - if (left == JExpr.TRUE) return left; // JExpr.TRUE - if (right == JExpr.TRUE) return right; // JExpr.FALSE - if (left == JExpr.FALSE) return right; - if (right == JExpr.FALSE) return left; - return new BinaryOp("||", left, right); - } - - public static JExpression xor(JExpression left, JExpression right) { - return new BinaryOp("^", left, right); - } - - public static JExpression lt(JExpression left, JExpression right) { - return new BinaryOp("<", left, right); - } - - public static JExpression lte(JExpression left, JExpression right) { - return new BinaryOp("<=", left, right); - } - - public static JExpression gt(JExpression left, JExpression right) { - return new BinaryOp(">", left, right); - } - - public static JExpression gte(JExpression left, JExpression right) { - return new BinaryOp(">=", left, right); - } - - public static JExpression eq(JExpression left, JExpression right) { - return new BinaryOp("==", left, right); - } - - public static JExpression ne(JExpression left, JExpression right) { - return new BinaryOp("!=", left, right); - } - - public static JExpression _instanceof(JExpression left, JType right) { - return new BinaryOp("instanceof", left, right); - } - - /* -- Ternary operators -- */ - - static private class TernaryOp extends JExpressionImpl { - - String op1; - String op2; - JExpression e1; - JExpression e2; - JExpression e3; - - TernaryOp(String op1, String op2, - JExpression e1, JExpression e2, JExpression e3) { - this.e1 = e1; - this.op1 = op1; - this.e2 = e2; - this.op2 = op2; - this.e3 = e3; - } - - public void generate(JFormatter f) { - f.p('(').g(e1).p(op1).g(e2).p(op2).g(e3).p(')'); - } - - } - - public static JExpression cond(JExpression cond, - JExpression ifTrue, JExpression ifFalse) { - return new TernaryOp("?", ":", cond, ifTrue, ifFalse); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JPackage.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JPackage.java deleted file mode 100644 index 73c54832858..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JPackage.java +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.io.BufferedOutputStream; -import java.io.BufferedWriter; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.io.Writer; -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - - -/** - * A Java package. - */ -public final class JPackage implements JDeclaration, JGenerable, JClassContainer, JAnnotatable, Comparable { - - /** - * Name of the package. - * May be the empty string for the root package. - */ - private String name; - - private final JCodeModel owner; - - /** - * List of classes contained within this package keyed by their name. - */ - private final Map classes = new TreeMap(); - - /** - * List of resources files inside this package. - */ - private final Set resources = new HashSet(); - - /** - * All {@link JClass}s in this package keyed the upper case class name. - * - * This field is non-null only on Windows, to detect - * "Foo" and "foo" as a collision. - */ - private final Map upperCaseClassMap; - - /** - * Lazily created list of package annotations. - */ - private List annotations = null; - - /** - * package javadoc. - */ - private JDocComment jdoc = null; - - /** - * JPackage constructor - * - * @param name - * Name of package - * - * @param cw The code writer being used to create this package - * - * @throws IllegalArgumentException - * If each part of the package name is not a valid identifier - */ - JPackage(String name, JCodeModel cw) { - this.owner = cw; - if (name.equals(".")) { - String msg = "Package name . is not allowed"; - throw new IllegalArgumentException(msg); - } - - if(JCodeModel.isCaseSensitiveFileSystem) - upperCaseClassMap = null; - else - upperCaseClassMap = new HashMap(); - - this.name = name; - } - - - public JClassContainer parentContainer() { - return parent(); - } - - /** - * Gets the parent package, or null if this class is the root package. - */ - public JPackage parent() { - if(name.length()==0) return null; - - int idx = name.lastIndexOf('.'); - return owner._package(name.substring(0,idx)); - } - - public boolean isClass() { return false; } - public boolean isPackage() { return true; } - public JPackage getPackage() { return this; } - - /** - * Add a class to this package. - * - * @param mods - * Modifiers for this class declaration - * - * @param name - * Name of class to be added to this package - * - * @return Newly generated class - * - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - */ - public JDefinedClass _class(int mods, String name) throws JClassAlreadyExistsException { - return _class(mods,name,ClassType.CLASS); - } - - /** - * {@inheritDoc} - * @deprecated - */ - public JDefinedClass _class( int mods, String name, boolean isInterface ) throws JClassAlreadyExistsException { - return _class(mods,name, isInterface?ClassType.INTERFACE:ClassType.CLASS ); - } - - public JDefinedClass _class( int mods, String name, ClassType classTypeVal ) throws JClassAlreadyExistsException { - if(classes.containsKey(name)) - throw new JClassAlreadyExistsException(classes.get(name)); - else { - // XXX problems caught in the NC constructor - JDefinedClass c = new JDefinedClass(this, mods, name, classTypeVal); - - if( upperCaseClassMap!=null ) { - JDefinedClass dc = upperCaseClassMap.get(name.toUpperCase()); - if(dc!=null) - throw new JClassAlreadyExistsException(dc); - upperCaseClassMap.put(name.toUpperCase(),c); - } - classes.put(name,c); - return c; - } - } - - /** - * Adds a public class to this package. - */ - public JDefinedClass _class(String name) throws JClassAlreadyExistsException { - return _class( JMod.PUBLIC, name ); - } - - /** - * Gets a reference to the already created {@link JDefinedClass}. - * - * @return null - * If the class is not yet created. - */ - public JDefinedClass _getClass(String name) { - if(classes.containsKey(name)) - return classes.get(name); - else - return null; - } - - /** - * Order is based on the lexicological order of the package name. - */ - public int compareTo(JPackage that) { - return this.name.compareTo(that.name); - } - - /** - * Add an interface to this package. - * - * @param mods - * Modifiers for this interface declaration - * - * @param name - * Name of interface to be added to this package - * - * @return Newly generated interface - */ - public JDefinedClass _interface(int mods, String name) throws JClassAlreadyExistsException { - return _class(mods,name,ClassType.INTERFACE); - } - - /** - * Adds a public interface to this package. - */ - public JDefinedClass _interface(String name) throws JClassAlreadyExistsException { - return _interface(JMod.PUBLIC, name); - } - - /** - * Add an annotationType Declaration to this package - * @param name - * Name of the annotation Type declaration to be added to this package - * @return - * newly created Annotation Type Declaration - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException { - return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL); - } - - /** - * Add a public enum to this package - * @param name - * Name of the enum to be added to this package - * @return - * newly created Enum - * @exception JClassAlreadyExistsException - * When the specified class/interface was already created. - - */ - public JDefinedClass _enum (String name) throws JClassAlreadyExistsException { - return _class (JMod.PUBLIC,name,ClassType.ENUM); - } - /** - * Adds a new resource file to this package. - */ - public JResourceFile addResourceFile(JResourceFile rsrc) { - resources.add(rsrc); - return rsrc; - } - - /** - * Checks if a resource of the given name exists. - */ - public boolean hasResourceFile(String name) { - for (JResourceFile r : resources) - if (r.name().equals(name)) - return true; - return false; - } - - /** - * Iterates all resource files in this package. - */ - public Iterator propertyFiles() { - return resources.iterator(); - } - - /** - * Creates, if necessary, and returns the package javadoc for this - * JDefinedClass. - * - * @return JDocComment containing javadocs for this class - */ - public JDocComment javadoc() { - if (jdoc == null) - jdoc = new JDocComment(owner()); - return jdoc; - } - - /** - * Removes a class from this package. - */ - public void remove(JClass c) { - if (c._package() != this) - throw new IllegalArgumentException( - "the specified class is not a member of this package," + " or it is a referenced class"); - - // note that c may not be a member of classes. - // this happens when someone is trying to remove a non generated class - classes.remove(c.name()); - if (upperCaseClassMap != null) - upperCaseClassMap.remove(c.name().toUpperCase()); - } - - /** - * Reference a class within this package. - */ - public JClass ref(String name) throws ClassNotFoundException { - if (name.indexOf('.') >= 0) - throw new IllegalArgumentException("JClass name contains '.': " + name); - - String n = ""; - if (!isUnnamed()) - n = this.name + '.'; - n += name; - - return owner.ref(Class.forName(n)); - } - - /** - * Gets a reference to a sub package of this package. - */ - public JPackage subPackage( String pkg ) { - if(isUnnamed()) return owner()._package(pkg); - else return owner()._package(name+'.'+pkg); - } - - /** - * Returns an iterator that walks the top-level classes defined in this - * package. - */ - public Iterator classes() { - return classes.values().iterator(); - } - - /** - * Checks if a given name is already defined as a class/interface - */ - public boolean isDefined(String classLocalName) { - Iterator itr = classes(); - while (itr.hasNext()) { - if (((JClass)itr.next()).name().equals(classLocalName)) - return true; - } - - return false; - } - - /** - * Checks if this package is the root, unnamed package. - */ - public final boolean isUnnamed() { return name.length() == 0; } - - /** - * Get the name of this package - * - * @return - * The name of this package, or the empty string if this is the - * null package. For example, this method returns strings like - * "java.lang" - */ - public String name() { - return name; - } - - /** - * Return the code model root object being used to create this package. - */ - public final JCodeModel owner() { return owner; } - - - public JAnnotationUse annotate(JClass clazz) { - if(isUnnamed()) - throw new IllegalArgumentException("the root package cannot be annotated"); - if(annotations==null) - annotations = new ArrayList(); - JAnnotationUse a = new JAnnotationUse(clazz); - annotations.add(a); - return a; - } - - public JAnnotationUse annotate(Class clazz) { - return annotate(owner.ref(clazz)); - } - - public W annotate2(Class clazz) { - return TypedAnnotationWriter.create(clazz,this); - } - - - /** - * Convert the package name to directory path equivalent - */ - File toPath(File dir) { - if (name == null) return dir; - return new File(dir, name.replace('.', File.separatorChar)); - } - - public void declare(JFormatter f ) { - if (name.length() != 0) - f.p("package").p(name).p(';').nl(); - } - - public void generate(JFormatter f) { - f.p(name); - } - - - void build( CodeWriter src, CodeWriter res ) throws IOException { - - // write classes - for (JDefinedClass c : classes.values()) { - if (c.isHidden()) - continue; // don't generate this file - - JFormatter f = createJavaSourceFileWriter(src, c.name()); - f.write(c); - f.close(); - } - - // write package annotations - if(annotations!=null || jdoc!=null) { - JFormatter f = createJavaSourceFileWriter(src,"package-info"); - - if (jdoc != null) - f.g(jdoc); - - // TODO: think about importing - if (annotations != null){ - for (JAnnotationUse a : annotations) - f.g(a).nl(); - } - f.d(this); - - f.close(); - } - - // write resources - for (JResourceFile rsrc : resources) { - CodeWriter cw = rsrc.isResource() ? res : src; - OutputStream os = new BufferedOutputStream(cw.openBinary(this, rsrc.name())); - rsrc.build(os); - os.close(); - } - } - - /*package*/ int countArtifacts() { - int r = 0; - for (JDefinedClass c : classes.values()) { - if (c.isHidden()) - continue; // don't generate this file - r++; - } - - if(annotations!=null || jdoc!=null) { - r++; - } - - r+= resources.size(); - - return r; - } - - private JFormatter createJavaSourceFileWriter(CodeWriter src, String className) throws IOException { - Writer bw = new BufferedWriter(src.openSource(this,className+".java")); - return new JFormatter(new PrintWriter(bw)); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JPrimitiveType.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JPrimitiveType.java deleted file mode 100644 index f1c9283d8ff..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JPrimitiveType.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Java built-in primitive types. - * - * Instances of this class can be obtained as constants of {@link JCodeModel}, - * such as {@link JCodeModel#BOOLEAN}. - */ -public final class JPrimitiveType extends JType { - - private final String typeName; - private final JCodeModel owner; - /** - * Corresponding wrapper class. - * For example, this would be "java.lang.Short" for short. - */ - private final JClass wrapperClass; - - JPrimitiveType(JCodeModel owner, String typeName, Class wrapper ) { - this.owner = owner; - this.typeName = typeName; - this.wrapperClass = owner.ref(wrapper); - } - - public JCodeModel owner() { return owner; } - - public String fullName() { - return typeName; - } - - public String name() { - return fullName(); - } - - public boolean isPrimitive() { - return true; - } - - private JClass arrayClass; - public JClass array() { - if(arrayClass==null) - arrayClass = new JArrayClass(owner,this); - return arrayClass; - } - - /** - * Obtains the wrapper class for this primitive type. - * For example, this method returns a reference to java.lang.Integer - * if this object represents int. - */ - public JClass boxify() { - return wrapperClass; - } - - /** - * @deprecated calling this method from {@link JPrimitiveType} - * would be meaningless, since it's always guaranteed to - * return this. - */ - public JType unboxify() { - return this; - } - - /** - * @deprecated - * Use {@link #boxify()}. - */ - public JClass getWrapperClass() { - return boxify(); - } - - /** - * Wraps an expression of this type to the corresponding wrapper class. - * For example, if this class represents "float", this method will return - * the expression new Float(x) for the paramter x. - * - * REVISIT: it's not clear how this method works for VOID. - */ - public JExpression wrap( JExpression exp ) { - return JExpr._new(boxify()).arg(exp); - } - - /** - * Do the opposite of the wrap method. - * - * REVISIT: it's not clear how this method works for VOID. - */ - public JExpression unwrap( JExpression exp ) { - // it just so happens that the unwrap method is always - // things like "intValue" or "booleanValue". - return exp.invoke(typeName+"Value"); - } - - public void generate(JFormatter f) { - f.p(typeName); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JResourceFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JResourceFile.java deleted file mode 100644 index c88d370edc6..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JResourceFile.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.io.IOException; -import java.io.OutputStream; - -/** - * Represents a resource file in the application-specific file format. - */ -public abstract class JResourceFile { - - private final String name; - - protected JResourceFile( String name ) { - this.name = name; - } - - /** - * Gets the name of this property file - */ - public String name() { - return name; - } - - /** - * Returns true if this file should be generated into the directory - * that the resource files go into. - * - *

- * Returns false if this file should be generated into the directory - * where other source files go. - */ - protected boolean isResource() { - return true; - } - - /** - * called by JPackage to produce the file image. - */ - protected abstract void build( OutputStream os ) throws IOException; -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JReturn.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JReturn.java deleted file mode 100644 index a690732cefc..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JReturn.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * A return statement - */ -class JReturn implements JStatement { - - /** - * JExpression to return; may be null. - */ - private JExpression expr; - - /** - * JReturn constructor - * - * @param expr - * JExpression which evaluates to return value - */ - JReturn(JExpression expr) { - this.expr = expr; - } - - public void state(JFormatter f) { - f.p("return "); - if (expr != null) f.g(expr); - f.p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JStatement.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JStatement.java deleted file mode 100644 index 8df7b37c4cd..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JStatement.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * Common interface for code components that can generate - * uses of themselves as statements. - */ - -public interface JStatement { - - public void state(JFormatter f); - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JStringLiteral.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JStringLiteral.java deleted file mode 100644 index afe70124d4c..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JStringLiteral.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -/** - * String literal. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class JStringLiteral extends JExpressionImpl { - - public final String str; - - - JStringLiteral(String what) { - this.str = what; - - } - - - public void generate(JFormatter f) { - f.p(JExpr.quotify('"', str)); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JSwitch.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JSwitch.java deleted file mode 100644 index 44af487e089..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JSwitch.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * Switch statement - */ -public final class JSwitch implements JStatement { - - /** - * Test part of switch statement. - */ - private JExpression test; - - /** - * vector of JCases. - */ - private List cases = new ArrayList(); - - /** - * a single default case - */ - private JCase defaultCase = null; - - /** - * Construct a While statment - */ - JSwitch(JExpression test) { - this.test = test; - } - - public JExpression test() { return test; } - - public Iterator cases() { return cases.iterator(); } - - public JCase _case( JExpression label ) { - JCase c = new JCase( label ); - cases.add(c); - return c; - } - - public JCase _default() { - // what if (default != null) ??? - - // default cases statements don't have a label - defaultCase = new JCase(null, true); - return defaultCase; - } - - public void state(JFormatter f) { - if (JOp.hasTopOp(test)) { - f.p("switch ").g(test).p(" {").nl(); - } else { - f.p("switch (").g(test).p(')').p(" {").nl(); - } - for( JCase c : cases ) - f.s(c); - if( defaultCase != null ) - f.s( defaultCase ); - f.p('}').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JThrow.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JThrow.java deleted file mode 100644 index 050cf8a87d2..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JThrow.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * JThrow statement - */ - -class JThrow implements JStatement { - - /** - * JExpression to throw - */ - private JExpression expr; - - /** - * JThrow constructor - * - * @param expr - * JExpression which evaluates to JThrow value - */ - JThrow(JExpression expr) { - this.expr = expr; - } - - public void state(JFormatter f) { - f.p("throw"); - f.g(expr); - f.p(';').nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JTryBlock.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JTryBlock.java deleted file mode 100644 index 1739e1308b1..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JTryBlock.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.util.ArrayList; -import java.util.List; - - -/** - * Try statement with Catch and/or Finally clause - */ - -public class JTryBlock implements JStatement { - - private JBlock body = new JBlock(); - private List catches = new ArrayList(); - private JBlock _finally = null; - - JTryBlock() { - } - - public JBlock body() { - return body; - } - - public JCatchBlock _catch(JClass exception) { - JCatchBlock cb = new JCatchBlock(exception); - catches.add(cb); - return cb; - } - - public JBlock _finally() { - if (_finally == null) _finally = new JBlock(); - return _finally; - } - - public void state(JFormatter f) { - f.p("try").g(body); - for (JCatchBlock cb : catches) - f.g(cb); - if (_finally != null) - f.p("finally").g(_finally); - f.nl(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JType.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JType.java deleted file mode 100644 index b208d49bb12..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JType.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - - -/** - * A representation of a type in codeModel. - * - * A type is always either primitive ({@link JPrimitiveType}) or - * a reference type ({@link JClass}). - */ -public abstract class JType implements JGenerable, Comparable { - - /** - * Obtains a reference to the primitive type object from a type name. - */ - public static JPrimitiveType parse(JCodeModel codeModel, String typeName) { - if (typeName.equals("void")) - return codeModel.VOID; - else if (typeName.equals("boolean")) - return codeModel.BOOLEAN; - else if (typeName.equals("byte")) - return codeModel.BYTE; - else if (typeName.equals("short")) - return codeModel.SHORT; - else if (typeName.equals("char")) - return codeModel.CHAR; - else if (typeName.equals("int")) - return codeModel.INT; - else if (typeName.equals("float")) - return codeModel.FLOAT; - else if (typeName.equals("long")) - return codeModel.LONG; - else if (typeName.equals("double")) - return codeModel.DOUBLE; - else - throw new IllegalArgumentException("Not a primitive type: " + typeName); - } - - /** Gets the owner code model object. */ - public abstract JCodeModel owner(); - - /** - * Gets the full name of the type. - * - * See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details. - * - * @return - * Strings like "int", "java.lang.String", - * "java.io.File[]". Never null. - */ - public abstract String fullName(); - - /** - * Gets the binary name of the type. - * - * See http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#44909 - * - * @return - * Name like "Foo$Bar", "int", "java.lang.String", "java.io.File[]". Never null. - */ - public String binaryName() { - return fullName(); - } - - /** - * Gets the name of this type. - * - * @return - * Names like "int", "void", "BigInteger". - */ - public abstract String name(); - - /** - * Create an array type of this type. - * - * This method is undefined for primitive void type, which - * doesn't have any corresponding array representation. - * - * @return A {@link JClass} representing the array type - * whose element type is this type - */ - public abstract JClass array(); - - /** Tell whether or not this is an array type. */ - public boolean isArray() { - return false; - } - - /** Tell whether or not this is a built-in primitive type, such as int or void. */ - public boolean isPrimitive() { - return false; - } - - /** - * If this class is a primitive type, return the boxed class. Otherwise return this. - * - *

- * For example, for "int", this method returns "java.lang.Integer". - */ - public abstract JClass boxify(); - - /** - * If this class is a wrapper type for a primitive, return the primitive type. - * Otherwise return this. - * - *

- * For example, for "java.lang.Integer", this method returns "int". - */ - public abstract JType unboxify(); - - /** - * Returns the erasure of this type. - */ - public JType erasure() { - return this; - } - - /** - * Returns true if this is a referenced type. - */ - public final boolean isReference() { - return !isPrimitive(); - } - - /** - * If this is an array, returns the component type of the array. - * (T of T[]) - */ - public JType elementType() { - throw new IllegalArgumentException("Not an array type"); - } - - public String toString() { - return this.getClass().getName() - + '(' + fullName() + ')'; - } - - /** - * Compare two JTypes by FQCN, giving sorting precedence to types - * that belong to packages java and javax over all others. - * - * This method is used to sort generated import statments in a - * conventional way for readability. - */ - public int compareTo(Object o) { - final String rhs = ((JType)o).fullName(); - boolean p = fullName().startsWith("java"); - boolean q = rhs.startsWith("java"); - - if( p && !q ) { - return -1; - } else if( !p && q ) { - return 1; - } else { - return fullName().compareTo(rhs); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JTypeVar.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JTypeVar.java deleted file mode 100644 index de745686080..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JTypeVar.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal; - -import java.util.Iterator; -import java.util.List; - -/** - * Type variable used to declare generics. - * - * @see JGenerifiable - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class JTypeVar extends JClass implements JDeclaration { - - private final String name; - - private JClass bound; - - JTypeVar(JCodeModel owner, String _name) { - super(owner); - this.name = _name; - } - - public String name() { - return name; - } - - public String fullName() { - return name; - } - - public JPackage _package() { - return null; - } - - /** - * Adds a bound to this variable. - * - * @return this - */ - public JTypeVar bound( JClass c ) { - if(bound!=null) - throw new IllegalArgumentException("type variable has an existing class bound "+bound); - bound = c; - return this; - } - - /** - * Returns the class bound of this variable. - * - *

- * If no bound is given, this method returns {@link Object}. - */ - public JClass _extends() { - if(bound!=null) - return bound; - else - return owner().ref(Object.class); - } - - /** - * Returns the interface bounds of this variable. - */ - public Iterator _implements() { - return bound._implements(); - } - - public boolean isInterface() { - return false; - } - - public boolean isAbstract() { - return false; - } - - /** - * Prints out the declaration of the variable. - */ - public void declare(JFormatter f) { - f.id(name); - if(bound!=null) - f.p("extends").g(bound); - } - - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - for(int i=0;i - * Instances of this class can be obtained from {@link JClass#wildcard()} - * - * TODO: extend this to cover "? super Integer". - * - *

- * Our modeling of types are starting to look really ugly. - * ideally it should have been done somewhat like APT, - * but it's too late now. - * - * @author Kohsuke Kawaguchi - */ -final class JTypeWildcard extends JClass { - - private final JClass bound; - - JTypeWildcard(JClass bound) { - super(bound.owner()); - this.bound = bound; - } - - public String name() { - return "? extends "+bound.name(); - } - - public String fullName() { - return "? extends "+bound.fullName(); - } - - public JPackage _package() { - return null; - } - - /** - * Returns the class bound of this variable. - * - *

- * If no bound is given, this method returns {@link Object}. - */ - public JClass _extends() { - if(bound!=null) - return bound; - else - return owner().ref(Object.class); - } - - /** - * Returns the interface bounds of this variable. - */ - public Iterator _implements() { - return bound._implements(); - } - - public boolean isInterface() { - return false; - } - - public boolean isAbstract() { - return false; - } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - JClass nb = bound.substituteParams(variables,bindings); - if(nb==bound) - return this; - else - return new JTypeWildcard(nb); - } - - public void generate(JFormatter f) { - if(bound._extends()==null) - f.p("?"); // instead of "? extends Object" - else - f.p("? extends").g(bound); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/JVar.java b/jaxws/src/share/classes/com/sun/codemodel/internal/JVar.java deleted file mode 100644 index 15b0c4f212e..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/JVar.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal; - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.List; - - -/** - * Variables and fields. - */ - -public class JVar extends JExpressionImpl implements JDeclaration, JAssignmentTarget, JAnnotatable { - - /** - * Modifiers. - */ - private JMods mods; - - /** - * JType of the variable - */ - private JType type; - - /** - * Name of the variable - */ - private String name; - - /** - * Initialization of the variable in its declaration - */ - private JExpression init; - - /** - * Annotations on this variable. Lazily created. - */ - private List annotations = null; - - - - /** - * JVar constructor - * - * @param type - * Datatype of this variable - * - * @param name - * Name of this variable - * - * @param init - * Value to initialize this variable to - */ - JVar(JMods mods, JType type, String name, JExpression init) { - this.mods = mods; - this.type = type; - this.name = name; - this.init = init; - } - - - /** - * Initialize this variable - * - * @param init - * JExpression to be used to initialize this field - */ - public JVar init(JExpression init) { - this.init = init; - return this; - } - - /** - * Get the name of this variable - * - * @return Name of the variable - */ - public String name() { - return name; - } - - /** - * Changes the name of this variable. - */ - public void name(String name) { - if(!JJavaName.isJavaIdentifier(name)) - throw new IllegalArgumentException(); - this.name = name; - } - - /** - * Return the type of this variable. - * @return - * always non-null. - */ - public JType type() { - return type; - } - - /** - * @return - * the current modifiers of this method. - * Always return non-null valid object. - */ - public JMods mods() { - return mods; - } - - /** - * Sets the type of this variable. - * - * @param newType - * must not be null. - * - * @return - * the old type value. always non-null. - */ - public JType type(JType newType) { - JType r = type; - if(newType==null) - throw new IllegalArgumentException(); - type = newType; - return r; - } - - - /** - * Adds an annotation to this variable. - * @param clazz - * The annotation class to annotate the field with - */ - public JAnnotationUse annotate(JClass clazz){ - if(annotations==null) - annotations = new ArrayList(); - JAnnotationUse a = new JAnnotationUse(clazz); - annotations.add(a); - return a; - } - - /** - * Adds an annotation to this variable. - * - * @param clazz - * The annotation class to annotate the field with - */ - public JAnnotationUse annotate(Class clazz){ - return annotate(type.owner().ref(clazz)); - } - - public W annotate2(Class clazz) { - return TypedAnnotationWriter.create(clazz,this); - } - - protected boolean isAnnotated() { - return annotations!=null; - } - - public void bind(JFormatter f) { - if (annotations != null){ - for( int i=0; i> - implements InvocationHandler, JAnnotationWriter { - /** - * This is what we are writing to. - */ - private final JAnnotationUse use; - - /** - * The annotation that we are writing. - */ - private final Class annotation; - - /** - * The type of the writer. - */ - private final Class writerType; - - /** - * Keeps track of writers for array members. - * Lazily created. - */ - private Map arrays; - - public TypedAnnotationWriter(Class annotation, Class writer, JAnnotationUse use) { - this.annotation = annotation; - this.writerType = writer; - this.use = use; - } - - public JAnnotationUse getAnnotationUse() { - return use; - } - - public Class getAnnotationType() { - return annotation; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - - if(method.getDeclaringClass()==JAnnotationWriter.class) { - try { - return method.invoke(this,args); - } catch (InvocationTargetException e) { - throw e.getTargetException(); - } - } - - String name = method.getName(); - Object arg=null; - if(args!=null && args.length>0) - arg = args[0]; - - // check how it's defined on the annotation - Method m = annotation.getDeclaredMethod(name); - Class rt = m.getReturnType(); - - // array value - if(rt.isArray()) { - return addArrayValue(proxy,name,rt.getComponentType(),method.getReturnType(),arg); - } - - // sub annotation - if(Annotation.class.isAssignableFrom(rt)) { - Class r = (Class)rt; - return new TypedAnnotationWriter( - r,method.getReturnType(),use.annotationParam(name,r)).createProxy(); - } - - // scalar value - - if(arg instanceof JType) { - JType targ = (JType) arg; - checkType(Class.class,rt); - if(m.getDefaultValue()!=null) { - // check the default - if(targ.equals(targ.owner().ref((Class)m.getDefaultValue()))) - return proxy; // defaulted - } - use.param(name,targ); - return proxy; - } - - // other Java built-in types - checkType(arg.getClass(),rt); - if(m.getDefaultValue()!=null && m.getDefaultValue().equals(arg)) - // defaulted. no need to write out. - return proxy; - - if(arg instanceof String) { - use.param(name,(String)arg); - return proxy; - } - if(arg instanceof Boolean) { - use.param(name,(Boolean)arg); - return proxy; - } - if(arg instanceof Integer) { - use.param(name,(Integer)arg); - return proxy; - } - if(arg instanceof Class) { - use.param(name,(Class)arg); - return proxy; - } - if(arg instanceof Enum) { - use.param(name,(Enum)arg); - return proxy; - } - - throw new IllegalArgumentException("Unable to handle this method call "+method.toString()); - } - - private Object addArrayValue(Object proxy,String name, Class itemType, Class expectedReturnType, Object arg) { - if(arrays==null) - arrays = new HashMap(); - JAnnotationArrayMember m = arrays.get(name); - if(m==null) { - m = use.paramArray(name); - arrays.put(name,m); - } - - // sub annotation - if(Annotation.class.isAssignableFrom(itemType)) { - Class r = (Class)itemType; - if(!JAnnotationWriter.class.isAssignableFrom(expectedReturnType)) - throw new IllegalArgumentException("Unexpected return type "+expectedReturnType); - return new TypedAnnotationWriter(r,expectedReturnType,m.annotate(r)).createProxy(); - } - - // primitive - if(arg instanceof JType) { - checkType(Class.class,itemType); - m.param((JType)arg); - return proxy; - } - checkType(arg.getClass(),itemType); - if(arg instanceof String) { - m.param((String)arg); - return proxy; - } - if(arg instanceof Boolean) { - m.param((Boolean)arg); - return proxy; - } - if(arg instanceof Integer) { - m.param((Integer)arg); - return proxy; - } - if(arg instanceof Class) { - m.param((Class)arg); - return proxy; - } - // TODO: enum constant. how should we handle it? - - throw new IllegalArgumentException("Unable to handle this method call "); - } - - - /** - * Check if the type of the argument matches our expectation. - * If not, report an error. - */ - private void checkType(Class actual, Class expected) { - if(expected==actual || expected.isAssignableFrom(actual)) - return; // no problem - - if( expected==JCodeModel.boxToPrimitive.get(actual) ) - return; // no problem - - throw new IllegalArgumentException("Expected "+expected+" but found "+actual); - } - - /** - * Creates a proxy and returns it. - */ - private W createProxy() { - return (W)Proxy.newProxyInstance( - writerType.getClassLoader(),new Class[]{writerType},this); - } - - /** - * Creates a new typed annotation writer. - */ - static > W create(Class w, JAnnotatable annotatable) { - Class a = findAnnotationType(w); - return (W)new TypedAnnotationWriter(a,w,annotatable.annotate(a)).createProxy(); - } - - private static Class findAnnotationType(Class clazz) { - for( Type t : clazz.getGenericInterfaces()) { - if(t instanceof ParameterizedType) { - ParameterizedType p = (ParameterizedType) t; - if(p.getRawType()==JAnnotationWriter.class) - return (Class)p.getActualTypeArguments()[0]; - } - if(t instanceof Class) { - // recurisve search - Class r = findAnnotationType((Class)t); - if(r!=null) return r; - } - } - return null; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JBinaryFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JBinaryFile.java deleted file mode 100644 index 61a22e8ffa7..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JBinaryFile.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.fmt; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import com.sun.codemodel.internal.JResourceFile; - -/** - * Allows the application to use OutputStream to define data - * that will be stored into a file. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class JBinaryFile extends JResourceFile { - - private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - public JBinaryFile( String name ) { - super(name); - } - - /** - * - * @return - * Data written to the returned output stream will be written - * to the file. - */ - public OutputStream getDataStore() { - return baos; - } - - public void build(OutputStream os) throws IOException { - os.write( baos.toByteArray() ); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JPropertyFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JPropertyFile.java deleted file mode 100644 index 81e29f04f02..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JPropertyFile.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.fmt; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -import com.sun.codemodel.internal.JResourceFile; - -/** - * A property file. - */ -public class JPropertyFile extends JResourceFile -{ - public JPropertyFile( String name ) { - super(name); - } - - private final Properties data = new Properties(); - - /** - * Adds key/value pair into the property file. - * If you call this method twice with the same key, - * the old one is overriden by the new one. - */ - public void add( String key, String value ) { - data.put(key,value); - } - - // TODO: method to iterate values in data? - // TODO: should we rather expose Properties object directly via - // public Properties body() { return data; } ? - - public void build( OutputStream out ) throws IOException { - data.store(out,null); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JSerializedObject.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JSerializedObject.java deleted file mode 100644 index 12452641a09..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JSerializedObject.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal.fmt; - -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.OutputStream; - -import com.sun.codemodel.internal.JResourceFile; - - -/** - * A simple class that takes an object and serializes it into a file - * in the parent package with the given name. - */ -public class JSerializedObject extends JResourceFile { - - private final Object obj; - - /** - * @exception IOException - * If the serialization fails, this exception is thrown - */ - public JSerializedObject( String name, Object obj ) throws IOException { - super(name); - this.obj = obj; - } - - /** - * called by JPackage to serialize the object - */ - protected void build( OutputStream os ) throws IOException { - // serialize the obj into a ByteArrayOutputStream - ObjectOutputStream oos = new ObjectOutputStream(os); - oos.writeObject(obj); - oos.close(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticFile.java deleted file mode 100644 index 450aac31a43..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticFile.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.fmt; - -import java.io.DataInputStream; -import java.io.IOException; -import java.io.OutputStream; - -import com.sun.codemodel.internal.JResourceFile; - -/** - * Allows an application to copy a resource file to the output. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class JStaticFile extends JResourceFile { - - private final ClassLoader classLoader; - private final String resourceName; - private final boolean isResource; - - public JStaticFile(String _resourceName) { - this(_resourceName,!_resourceName.endsWith(".java")); - } - - public JStaticFile(String _resourceName,boolean isResource) { - this( JStaticFile.class.getClassLoader(), _resourceName, isResource ); - } - - /** - * @param isResource - * false if this is a Java source file. True if this is other resource files. - */ - public JStaticFile(ClassLoader _classLoader, String _resourceName, boolean isResource) { - super(_resourceName.substring(_resourceName.lastIndexOf('/')+1)); - this.classLoader = _classLoader; - this.resourceName = _resourceName; - this.isResource = isResource; - } - - protected boolean isResource() { - return isResource; - } - - protected void build(OutputStream os) throws IOException { - DataInputStream dis = new DataInputStream(classLoader.getResourceAsStream(resourceName)); - - byte[] buf = new byte[256]; - int sz; - while( (sz=dis.read(buf))>0 ) - os.write(buf,0,sz); - - dis.close(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticJavaFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticJavaFile.java deleted file mode 100644 index 00d88e876ef..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JStaticJavaFile.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.fmt; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.net.URL; -import java.text.ParseException; -import java.util.Iterator; -import java.util.List; - -import com.sun.codemodel.internal.JClass; -import com.sun.codemodel.internal.JPackage; -import com.sun.codemodel.internal.JResourceFile; -import com.sun.codemodel.internal.JTypeVar; - -/** - * Statically generated Java soruce file. - * - *

- * This {@link JResourceFile} implementation will generate a Java source - * file by copying the source code from a resource. - *

- * While copying a resource, we look for a package declaration and - * replace it with the target package name. This allows the static Java - * source code to have an arbitrary package declaration. - *

- * You can also use the getJClass method to obtain a {@link JClass} - * object that represents the static file. This allows the client code - * to refer to the class from other CodeModel generated code. - *

- * Note that because we don't parse the static Java source code, - * the returned {@link JClass} object doesn't respond to methods like - * "isInterface" or "_extends", - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class JStaticJavaFile extends JResourceFile { - - private final JPackage pkg; - private final String className; - private final URL source; - private final JStaticClass clazz; - private final LineFilter filter; - - public JStaticJavaFile(JPackage _pkg, String className, String _resourceName) { - this( _pkg, className, - JStaticJavaFile.class.getClassLoader().getResource(_resourceName), null ); - } - - public JStaticJavaFile(JPackage _pkg, String _className, URL _source, LineFilter _filter ) { - super(_className+".java"); - if(_source==null) throw new NullPointerException(); - this.pkg = _pkg; - this.clazz = new JStaticClass(); - this.className = _className; - this.source = _source; - this.filter = _filter; - } - - /** - * Returns a class object that represents a statically generated code. - */ - public final JClass getJClass() { - return clazz; - } - - protected boolean isResource() { - return false; - } - - protected void build(OutputStream os) throws IOException { - InputStream is = source.openStream(); - - BufferedReader r = new BufferedReader(new InputStreamReader(is)); - PrintWriter w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os))); - LineFilter filter = createLineFilter(); - int lineNumber=1; - - try { - String line; - while((line=r.readLine())!=null) { - line = filter.process(line); - if(line!=null) - w.println(line); - lineNumber++; - } - } catch( ParseException e ) { - throw new IOException("unable to process "+source+" line:"+lineNumber+"\n"+e.getMessage()); - } - - w.close(); - r.close(); - } - - /** - * Creates a {@link LineFilter}. - *

- * A derived class can override this method to process - * the contents of the source file. - */ - private LineFilter createLineFilter() { - // this filter replaces the package declaration. - LineFilter f = new LineFilter() { - public String process(String line) { - if(!line.startsWith("package ")) return line; - - // replace package decl - if( pkg.isUnnamed() ) - return null; - else - return "package "+pkg.name()+";"; - } - }; - if( filter!=null ) - return new ChainFilter(filter,f); - else - return f; - } - - /** - * Filter that alters the Java source code. - *

- * By implementing this interface, derived classes - * can modify the Java source file before it's written out. - */ - public interface LineFilter { - /** - * @param line - * a non-null valid String that corresponds to one line. - * No '\n' included. - * @return - * null to strip the line off. Otherwise the returned - * String will be written out. Do not add '\n' at the end - * of this string. - * - * @exception ParseException - * when for some reason there's an error in the line. - */ - String process(String line) throws ParseException; - } - - /** - * A {@link LineFilter} that combines two {@link LineFilter}s. - */ - public final static class ChainFilter implements LineFilter { - private final LineFilter first,second; - public ChainFilter( LineFilter first, LineFilter second ) { - this.first=first; - this.second=second; - } - public String process(String line) throws ParseException { - line = first.process(line); - if(line==null) return null; - return second.process(line); - } - } - - - private class JStaticClass extends JClass { - - private final JTypeVar[] typeParams; - - JStaticClass() { - super(pkg.owner()); - // TODO: allow those to be specified - typeParams = new JTypeVar[0]; - } - - public String name() { - return className; - } - - public String fullName() { - if(pkg.isUnnamed()) - return className; - else - return pkg.name()+'.'+className; - } - - public JPackage _package() { - return pkg; - } - - public JClass _extends() { - throw new UnsupportedOperationException(); - } - - public Iterator _implements() { - throw new UnsupportedOperationException(); - } - - public boolean isInterface() { - throw new UnsupportedOperationException(); - } - - public boolean isAbstract() { - throw new UnsupportedOperationException(); - } - - public JTypeVar[] typeParams() { - return typeParams; - } - - protected JClass substituteParams(JTypeVar[] variables, List bindings) { - return this; - } - }; -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JTextFile.java b/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JTextFile.java deleted file mode 100644 index dbc44daee95..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/fmt/JTextFile.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.fmt; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; - -import com.sun.codemodel.internal.JResourceFile; - - -/** - * Simple text file. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class JTextFile extends JResourceFile -{ - public JTextFile( String name ) { - super(name); - } - - private String contents = null; - - public void setContents( String _contents ) { - this.contents = _contents; - } - - public void build( OutputStream out ) throws IOException { - Writer w = new OutputStreamWriter(out); - w.write(contents); - w.close(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/package-info.java b/jaxws/src/share/classes/com/sun/codemodel/internal/package-info.java deleted file mode 100644 index 6e2fa832598..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/package-info.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/** - *

Library for generating Java source code

. - * - *

- * CodeModel is a library that allows you to generate Java source - * code in a type-safe fashion. - * - *

- * With CodeModel, you build the java source code by first building AST, - * then writing it out as text files that is Java source files. - * The AST looks like this: - * - * {@DotDiagram - digraph G { - cls1 [label="JDefinedClass"]; - cls2 [label="JDefinedClass"]; - JCodeModel -> cls1 [label="generated class"]; - JCodeModel -> cls2 [label="generated class"]; - - m1 [label="JMethod"]; - m2 [label="JMethod"]; - - cls1 -> m1; - cls1 -> m2; - cls1 -> JField; - - m1 -> JVar [label="method parameter"]; - m1 -> JBlock [label="code"]; - } - * } - * - *

- * You bulid this tree mostly from top-down. So, you first create - * a new {@link JDefinedClass} from {@link JCodeModel}, then you - * create a {@link JMethod} from {@link JDefinedClass}, and so on. - * - *

- * This design brings the following beneefits: - * - *

    - *
  • source code can be written in random order - *
  • generated source code nicely imports other classes - *
  • generated source code is lexically always correct - * (no unbalanced parenthesis, etc.) - *
  • code generation becomes relatively type-safe - *
- * - * The price you pay for that is - * increased memory footprint and the generation speed. - * See
performance section for - * more discussions about the performance and possible improvements. - * - * - *

Using CodeModel

- *

- * {@link com.sun.codemodel.internal.JCodeModel} is the entry point to - * the library. See its javadoc for more details about how to use - * CodeModel. - * - * - * - *

Performance

- *

- * Generally speaking, CodeModel is expected to be used in - * an environment where the resource constraint is not severe. - * Therefore, we haven't spent much effort in trying to make - * this library lean and mean. - * - *

- * That said, we did some benchmark and performance analysis. - * In case anyone is interested in making this library - * better performance wise, here's the findings. - * - *

- * {@link List}s {@link Map}s, and other collections take up - * a lot of space. Allocating those things lazily is generally - * a good idea. - * - *

- * Compared to template-based code generator, the writing operation - * is slow, as it needs to traverse each AST node. Consider - * pre-encoding tokens (like 'public') to the target encoding, - * and consider exploting the subtree equivalence. - * - * @ArchitectureDocument - */ -package com.sun.codemodel.internal; - -import java.util.List; -import java.util.Map; diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/ClassNameComparator.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/ClassNameComparator.java deleted file mode 100644 index 46b4270ff89..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/ClassNameComparator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.util; - -import java.util.Comparator; -import com.sun.codemodel.internal.JClass; - -/** - * Comparator object that sorts {@link JClass}es in the order - * of their names. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class ClassNameComparator implements Comparator { - private ClassNameComparator() {} - - public int compare(JClass l, JClass r) { - return l.fullName().compareTo(r.fullName()); - } - - public static final Comparator theInstance = new ClassNameComparator(); -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/EncoderFactory.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/EncoderFactory.java deleted file mode 100644 index 05555c623e7..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/EncoderFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * @(#)$Id: EncoderFactory.java,v 1.3 2005/09/10 19:07:33 kohsuke Exp $ - */ -package com.sun.codemodel.internal.util; - -import java.lang.reflect.Constructor; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; - -/** - * Creates {@link CharsetEncoder} from a charset name. - * - * Fixes a MS1252 handling bug in JDK1.4.2. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class EncoderFactory { - public static CharsetEncoder createEncoder( String encodin ) { - Charset cs = Charset.forName(System.getProperty("file.encoding")); - CharsetEncoder encoder = cs.newEncoder(); - - if( cs.getClass().getName().equals("sun.nio.cs.MS1252") ) { - try { - // at least JDK1.4.2_01 has a bug in MS1252 encoder. - // specifically, it returns true for any character. - // return a correct encoder to workaround this problem - - // statically binding to MS1252Encoder will cause a Link error - // (at least in IBM JDK1.4.1) - Class ms1252encoder = Class.forName("com.sun.codemodel.internal.util.MS1252Encoder"); - Constructor c = ms1252encoder.getConstructor(new Class[]{ - Charset.class - }); - return (CharsetEncoder)c.newInstance(new Object[]{cs}); - } catch( Throwable t ) { - // if something funny happens, ignore it and fall back to - // a broken MS1252 encoder. It's probably still better - // than choking here. - return encoder; - } - } - - return encoder; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java deleted file mode 100644 index 6db471edcf5..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.util; - -import java.io.FilterWriter; -import java.io.IOException; -import java.io.Writer; - -/** - * {@link Writer} that escapes characters that are unsafe - * as Javadoc comments. - * - * Such characters include '<' and '&'. - * - *

- * Note that this class doesn't escape other Unicode characters - * that are typically unsafe. For example, 愛 (A kanji - * that means "love") can be considered as unsafe because - * javac with English Windows cannot accept this character in the - * source code. - * - *

- * If the application needs to escape such characters as well, then - * they are on their own. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class JavadocEscapeWriter extends FilterWriter { - - public JavadocEscapeWriter( Writer next ) { - super(next); - } - - public void write(int ch) throws IOException { - if(ch=='<') - out.write("<"); - else - if(ch=='&') - out.write("&"); - else - out.write(ch); - } - - public void write(char[] buf, int off, int len) throws IOException { - for( int i=0; i - * See - * http://www.microsoft.com/globaldev/reference/sbcs/1252.htm - * for the normative definition. - * - * This code depends on Sun internal package, so we have to make sure - * it won't be executed on other JDKs. - */ -public final class MS1252Encoder extends SingleByteEncoder { - - public MS1252Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008A\u009A\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u008E\u009E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u0000" + - "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" + - "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" + - "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 461, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 698, 920, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - }; - - public boolean canEncode(char c) { - char test = index2.charAt( index1[(c&0xFF00)>>8] + (c&0xFF) ); - return test!=0; - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/SingleByteEncoder.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/SingleByteEncoder.java deleted file mode 100644 index 71d4dfd82aa..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/SingleByteEncoder.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * @(#)SingleByteEncoder.java 1.14 03/01/23 - */ - -package com.sun.codemodel.internal.util; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CoderResult; - -import sun.nio.cs.Surrogate; - - -abstract class SingleByteEncoder - extends CharsetEncoder -{ - - private final short index1[]; - private final String index2; - private final int mask1; - private final int mask2; - private final int shift; - - private final Surrogate.Parser sgp = new Surrogate.Parser(); - - protected SingleByteEncoder(Charset cs, - short[] index1, String index2, - int mask1, int mask2, int shift) - { - super(cs, 1.0f, 1.0f); - this.index1 = index1; - this.index2 = index2; - this.mask1 = mask1; - this.mask2 = mask2; - this.shift = shift; - } - - public boolean canEncode(char c) { - char testEncode; - testEncode = index2.charAt(index1[(c & mask1) >> shift] - + (c & mask2)); - if (testEncode == '\u0000') - return false; - else - return true; - } - - private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) { - char[] sa = src.array(); - int sp = src.arrayOffset() + src.position(); - int sl = src.arrayOffset() + src.limit(); - sp = (sp <= sl ? sp : sl); - byte[] da = dst.array(); - int dp = dst.arrayOffset() + dst.position(); - int dl = dst.arrayOffset() + dst.limit(); - dp = (dp <= dl ? dp : dl); - - try { - while (sp < sl) { - char c = sa[sp]; - if (Surrogate.is(c)) { - if (sgp.parse(c, sa, sp, sl) < 0) - return sgp.error(); - return sgp.unmappableResult(); - } - if (c >= '\uFFFE') - return CoderResult.unmappableForLength(1); - if (dl - dp < 1) - return CoderResult.OVERFLOW; - - char e = index2.charAt(index1[(c & mask1) >> shift] - + (c & mask2)); - - // If output byte is zero because input char is zero - // then character is mappable, o.w. fail - if (e == '\u0000' && c != '\u0000') - return CoderResult.unmappableForLength(1); - - sp++; - da[dp++] = (byte)e; - } - return CoderResult.UNDERFLOW; - } finally { - src.position(sp - src.arrayOffset()); - dst.position(dp - dst.arrayOffset()); - } - } - - private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) { - int mark = src.position(); - try { - while (src.hasRemaining()) { - char c = src.get(); - if (Surrogate.is(c)) { - if (sgp.parse(c, src) < 0) - return sgp.error(); - return sgp.unmappableResult(); - } - if (c >= '\uFFFE') - return CoderResult.unmappableForLength(1); - if (!dst.hasRemaining()) - return CoderResult.OVERFLOW; - - char e = index2.charAt(index1[(c & mask1) >> shift] - + (c & mask2)); - - // If output byte is zero because input char is zero - // then character is mappable, o.w. fail - if (e == '\u0000' && c != '\u0000') - return CoderResult.unmappableForLength(1); - - mark++; - dst.put((byte)e); - } - return CoderResult.UNDERFLOW; - } finally { - src.position(mark); - } - } - - protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) { - if (true && src.hasArray() && dst.hasArray()) - return encodeArrayLoop(src, dst); - else - return encodeBufferLoop(src, dst); - } - - public byte encode(char inputChar) { - return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] + - (inputChar & mask2)); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/Surrogate.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/Surrogate.java deleted file mode 100644 index ca97bc1d6fa..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/Surrogate.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal.util; - -import java.nio.CharBuffer; -import java.nio.charset.CoderResult; - - -/** - * Utility class for dealing with surrogates. - * - * @author Mark Reinhold - * @version 1.11, 03/01/23 - */ - -class Surrogate { - - private Surrogate() { } - - // UTF-16 surrogate-character ranges - // - public static final char MIN_HIGH = '\uD800'; - public static final char MAX_HIGH = '\uDBFF'; - public static final char MIN_LOW = '\uDC00'; - public static final char MAX_LOW = '\uDFFF'; - public static final char MIN = MIN_HIGH; - public static final char MAX = MAX_LOW; - - // Range of UCS-4 values that need surrogates in UTF-16 - // - public static final int UCS4_MIN = 0x10000; - public static final int UCS4_MAX = (1 << 20) + UCS4_MIN - 1; - - /** - * Tells whether or not the given UTF-16 value is a high surrogate. - */ - public static boolean isHigh(int c) { - return (MIN_HIGH <= c) && (c <= MAX_HIGH); - } - - /** - * Tells whether or not the given UTF-16 value is a low surrogate. - */ - public static boolean isLow(int c) { - return (MIN_LOW <= c) && (c <= MAX_LOW); - } - - /** - * Tells whether or not the given UTF-16 value is a surrogate character, - */ - public static boolean is(int c) { - return (MIN <= c) && (c <= MAX); - } - - /** - * Tells whether or not the given UCS-4 character must be represented as a - * surrogate pair in UTF-16. - */ - public static boolean neededFor(int uc) { - return (uc >= UCS4_MIN) && (uc <= UCS4_MAX); - } - - /** - * Returns the high UTF-16 surrogate for the given UCS-4 character. - */ - public static char high(int uc) { - return (char)(0xd800 | (((uc - UCS4_MIN) >> 10) & 0x3ff)); - } - - /** - * Returns the low UTF-16 surrogate for the given UCS-4 character. - */ - public static char low(int uc) { - return (char)(0xdc00 | ((uc - UCS4_MIN) & 0x3ff)); - } - - /** - * Converts the given surrogate pair into a 32-bit UCS-4 character. - */ - public static int toUCS4(char c, char d) { - return (((c & 0x3ff) << 10) | (d & 0x3ff)) + 0x10000; - } - - /** - * Surrogate parsing support. Charset implementations may use instances of - * this class to handle the details of parsing UTF-16 surrogate pairs. - */ - public static class Parser { - - public Parser() { } - - private int character; // UCS-4 - private CoderResult error = CoderResult.UNDERFLOW; - private boolean isPair; - - /** - * Returns the UCS-4 character previously parsed. - */ - public int character() { - return character; - } - - /** - * Tells whether or not the previously-parsed UCS-4 character was - * originally represented by a surrogate pair. - */ - public boolean isPair() { - return isPair; - } - - /** - * Returns the number of UTF-16 characters consumed by the previous - * parse. - */ - public int increment() { - return isPair ? 2 : 1; - } - - /** - * If the previous parse operation detected an error, return the object - * describing that error. - */ - public CoderResult error() { - return error; - } - - /** - * Returns an unmappable-input result object, with the appropriate - * input length, for the previously-parsed character. - */ - public CoderResult unmappableResult() { - return CoderResult.unmappableForLength(isPair ? 2 : 1); - } - - /** - * Parses a UCS-4 character from the given source buffer, handling - * surrogates. - * - * @param c The first character - * @param in The source buffer, from which one more character - * will be consumed if c is a high surrogate - * - * @return Either a parsed UCS-4 character, in which case the isPair() - * and increment() methods will return meaningful values, or - * -1, in which case error() will return a descriptive result - * object - */ - public int parse(char c, CharBuffer in) { - if (isHigh(c)) { - if (!in.hasRemaining()) { - error = CoderResult.UNDERFLOW; - return -1; - } - char d = in.get(); - if (isLow(d)) { - character = toUCS4(c, d); - isPair = true; - error = null; - return character; - } - error = CoderResult.malformedForLength(1); - return -1; - } - if (isLow(c)) { - error = CoderResult.malformedForLength(1); - return -1; - } - character = c; - isPair = false; - error = null; - return character; - } - - /** - * Parses a UCS-4 character from the given source buffer, handling - * surrogates. - * - * @param c The first character - * @param ia The input array, from which one more character - * will be consumed if c is a high surrogate - * @param ip The input index - * @param il The input limit - * - * @return Either a parsed UCS-4 character, in which case the isPair() - * and increment() methods will return meaningful values, or - * -1, in which case error() will return a descriptive result - * object - */ - public int parse(char c, char[] ia, int ip, int il) { - if (isHigh(c)) { - if (il - ip < 2) { - error = CoderResult.UNDERFLOW; - return -1; - } - char d = ia[ip + 1]; - if (isLow(d)) { - character = toUCS4(c, d); - isPair = true; - error = null; - return character; - } - error = CoderResult.malformedForLength(1); - return -1; - } - if (isLow(c)) { - error = CoderResult.malformedForLength(1); - return -1; - } - character = c; - isPair = false; - error = null; - return character; - } - - } - - /** - * Surrogate generation support. Charset implementations may use instances - * of this class to handle the details of generating UTF-16 surrogate - * pairs. - */ - public static class Generator { - - public Generator() { } - - private CoderResult error = CoderResult.OVERFLOW; - - /** - * If the previous generation operation detected an error, return the - * object describing that error. - */ - public CoderResult error() { - return error; - } - - /** - * Generates one or two UTF-16 characters to represent the given UCS-4 - * character. - * - * @param uc The UCS-4 character - * @param len The number of input bytes from which the UCS-4 value - * was constructed (used when creating result objects) - * @param dst The destination buffer, to which one or two UTF-16 - * characters will be written - * - * @return Either a positive count of the number of UTF-16 characters - * written to the destination buffer, or -1, in which case - * error() will return a descriptive result object - */ - public int generate(int uc, int len, CharBuffer dst) { - if (uc <= 0xffff) { - if (is(uc)) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (dst.remaining() < 1) { - error = CoderResult.OVERFLOW; - return -1; - } - dst.put((char)uc); - error = null; - return 1; - } - if (uc < UCS4_MIN) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (uc <= UCS4_MAX) { - if (dst.remaining() < 2) { - error = CoderResult.OVERFLOW; - return -1; - } - dst.put(high(uc)); - dst.put(low(uc)); - error = null; - return 2; - } - error = CoderResult.unmappableForLength(len); - return -1; - } - - /** - * Generates one or two UTF-16 characters to represent the given UCS-4 - * character. - * - * @param uc The UCS-4 character - * @param len The number of input bytes from which the UCS-4 value - * was constructed (used when creating result objects) - * @param da The destination array, to which one or two UTF-16 - * characters will be written - * @param dp The destination position - * @param dl The destination limit - * - * @return Either a positive count of the number of UTF-16 characters - * written to the destination buffer, or -1, in which case - * error() will return a descriptive result object - */ - public int generate(int uc, int len, char[] da, int dp, int dl) { - if (uc <= 0xffff) { - if (is(uc)) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (dl - dp < 1) { - error = CoderResult.OVERFLOW; - return -1; - } - da[dp] = (char)uc; - error = null; - return 1; - } - if (uc < UCS4_MIN) { - error = CoderResult.malformedForLength(len); - return -1; - } - if (uc <= UCS4_MAX) { - if (dl - dp < 2) { - error = CoderResult.OVERFLOW; - return -1; - } - da[dp] = high(uc); - da[dp + 1] = low(uc); - error = null; - return 2; - } - error = CoderResult.unmappableForLength(len); - return -1; - } - - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/util/UnicodeEscapeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/util/UnicodeEscapeWriter.java deleted file mode 100644 index ad09f15817a..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/util/UnicodeEscapeWriter.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.util; - -import java.io.FilterWriter; -import java.io.IOException; -import java.io.Writer; - -/** - * {@link Writer} that escapes non US-ASCII characters into - * Java Unicode escape \\uXXXX. - * - * This process is necessary if the method names or field names - * contain non US-ASCII characters. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class UnicodeEscapeWriter extends FilterWriter { - - public UnicodeEscapeWriter( Writer next ) { - super(next); - } - - public final void write(int ch) throws IOException { - if(!requireEscaping(ch)) out.write(ch); - else { - // need to escape - out.write("\\u"); - String s = Integer.toHexString(ch); - for( int i=s.length(); i<4; i++ ) - out.write('0'); - out.write(s); - } - } - - /** - * Can be overrided. Return true if the character - * needs to be escaped. - */ - protected boolean requireEscaping(int ch) { - if(ch>=128) return true; - - // control characters - if( ch<0x20 && " \t\r\n".indexOf(ch)==-1 ) return true; - - return false; - } - - public final void write(char[] buf, int off, int len) throws IOException { - for( int i=0; i readonlyFiles = new HashSet(); - - public FileCodeWriter( File target ) throws IOException { - this(target,false); - } - - public FileCodeWriter( File target, boolean readOnly ) throws IOException { - this.target = target; - this.readOnly = readOnly; - if(!target.exists() || !target.isDirectory()) - throw new IOException(target + ": non-existent directory"); - } - - - public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { - return new FileOutputStream(getFile(pkg,fileName)); - } - - protected File getFile(JPackage pkg, String fileName ) throws IOException { - File dir; - if(pkg.isUnnamed()) - dir = target; - else - dir = new File(target, toDirName(pkg)); - - if(!dir.exists()) dir.mkdirs(); - - File fn = new File(dir,fileName); - - if (fn.exists()) { - if (!fn.delete()) - throw new IOException(fn + ": Can't delete previous version"); - } - - - if(readOnly) readonlyFiles.add(fn); - return fn; - } - - public void close() throws IOException { - // mark files as read-onnly if necessary - for (File f : readonlyFiles) - f.setReadOnly(); - } - - /** Converts a package name to the directory name. */ - private static String toDirName( JPackage pkg ) { - return pkg.name().replace('.',File.separatorChar); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/FilterCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/FilterCodeWriter.java deleted file mode 100644 index 198642abdcd..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/FilterCodeWriter.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.codemodel.internal.writer; - -import java.io.OutputStream; -import java.io.IOException; -import java.io.Writer; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.JPackage; - -/** - * {@link CodeWriter} that delegates to another {@link CodeWriter}. - * - * @author Kohsuke Kawaguchi - */ -public class FilterCodeWriter extends CodeWriter { - protected CodeWriter core; - - public FilterCodeWriter(CodeWriter core) { - this.core = core; - } - - public OutputStream openBinary( JPackage pkg, String fileName ) throws IOException { - return core.openBinary(pkg, fileName); - } - - public Writer openSource( JPackage pkg, String fileName ) throws IOException { - return core.openSource(pkg, fileName); - } - - public void close() throws IOException { - core.close(); - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ProgressCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ProgressCodeWriter.java deleted file mode 100644 index 1bf8f845c75..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ProgressCodeWriter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.writer; - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.Writer; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.JPackage; - -/** - * Filter CodeWriter that writes a progress message to the specified - * PrintStream. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class ProgressCodeWriter extends FilterCodeWriter { - public ProgressCodeWriter( CodeWriter output, PrintStream progress ) { - super(output); - this.progress = progress; - if(progress==null) - throw new IllegalArgumentException(); - } - - private final PrintStream progress; - - public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { - report(pkg, fileName); - return super.openBinary(pkg,fileName); - } - - public Writer openSource(JPackage pkg, String fileName) throws IOException { - report(pkg, fileName); - return super.openSource(pkg,fileName); - } - - private void report(JPackage pkg, String fileName) { - if(pkg.isUnnamed()) progress.println(fileName); - else - progress.println( - pkg.name().replace('.',File.separatorChar) - +File.separatorChar+fileName); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/PrologCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/PrologCodeWriter.java deleted file mode 100644 index cbb5b203ba5..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/PrologCodeWriter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.writer; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.JPackage; - -/** - * Writes all the source files under the specified file folder and - * inserts a file prolog comment in each java source file. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class PrologCodeWriter extends FilterCodeWriter { - - /** prolog comment */ - private final String prolog; - - /** - * @param core - * This CodeWriter will be used to actually create a storage for files. - * PrologCodeWriter simply decorates this underlying CodeWriter by - * adding prolog comments. - * @param prolog - * Strings that will be added as comments. - * This string may contain newlines to produce multi-line comments. - * '//' will be inserted at the beginning of each line to make it - * a valid Java comment, so the caller can just pass strings like - * "abc\ndef" - */ - public PrologCodeWriter( CodeWriter core, String prolog ) { - super(core); - this.prolog = prolog; - } - - - public Writer openSource(JPackage pkg, String fileName) throws IOException { - Writer w = super.openSource(pkg,fileName); - - PrintWriter out = new PrintWriter(w); - - // write prolog if this is a java source file - if( prolog != null ) { - out.println( "//" ); - - String s = prolog; - int idx; - while( (idx=s.indexOf('\n'))!=-1 ) { - out.println("// "+ s.substring(0,idx) ); - s = s.substring(idx+1); - } - out.println("//"); - out.println(); - } - out.flush(); // we can't close the stream for that would close the undelying stream. - - return w; - } -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/SingleStreamCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/SingleStreamCodeWriter.java deleted file mode 100644 index 10740dfa422..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/SingleStreamCodeWriter.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.writer; - -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.JPackage; - -/** - * Output all source files into a single stream with a little - * formatting header in front of each file. - * - * This is primarily for human consumption of the generated source - * code, such as to debug/test CodeModel or to quickly inspect the result. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class SingleStreamCodeWriter extends CodeWriter { - - private final PrintStream out; - - /** - * @param os - * This stream will be closed at the end of the code generation. - */ - public SingleStreamCodeWriter( OutputStream os ) { - out = new PrintStream(os); - } - - public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { - String pkgName = pkg.name(); - if(pkgName.length()!=0) pkgName += '.'; - - out.println( - "-----------------------------------" + pkgName+fileName + - "-----------------------------------"); - - return new FilterOutputStream(out) { - public void close() { - // don't let this stream close - } - }; - } - - public void close() throws IOException { - out.close(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java b/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java deleted file mode 100644 index 0d345993bf5..00000000000 --- a/jaxws/src/share/classes/com/sun/codemodel/internal/writer/ZipCodeWriter.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.codemodel.internal.writer; - -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.JPackage; - -/** - * Writes all the files into a zip file. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class ZipCodeWriter extends CodeWriter { - /** - * @param target - * Zip file will be written to this stream. - */ - public ZipCodeWriter( OutputStream target ) { - zip = new ZipOutputStream(target); - // nullify the close method. - filter = new FilterOutputStream(zip){ - public void close() {} - }; - } - - private final ZipOutputStream zip; - - private final OutputStream filter; - - public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { - String name = fileName; - if(!pkg.isUnnamed()) name = toDirName(pkg)+name; - - zip.putNextEntry(new ZipEntry(name)); - return filter; - } - - /** Converts a package name to the directory name. */ - private static String toDirName( JPackage pkg ) { - return pkg.name().replace('.','/')+'/'; - } - - public void close() throws IOException { - zip.close(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Builder.java b/jaxws/src/share/classes/com/sun/istack/internal/Builder.java deleted file mode 100644 index a5b1a5af5f3..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/Builder.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -/** - * - * @author Martin Grebac - */ -public interface Builder { - T build(); -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/ByteArrayDataSource.java b/jaxws/src/share/classes/com/sun/istack/internal/ByteArrayDataSource.java deleted file mode 100644 index b11eb1bb3c3..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/ByteArrayDataSource.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import javax.activation.DataSource; -import java.io.InputStream; -import java.io.ByteArrayInputStream; -import java.io.OutputStream; - -/** - * {@link DataSource} backed by a byte buffer. - * - * @author Kohsuke Kawaguchi - */ -public final class ByteArrayDataSource implements DataSource { - - private final String contentType; - private final byte[] buf; - private final int len; - - public ByteArrayDataSource(byte[] buf, String contentType) { - this(buf,buf.length,contentType); - } - public ByteArrayDataSource(byte[] buf, int length, String contentType) { - this.buf = buf; - this.len = length; - this.contentType = contentType; - } - - public String getContentType() { - if(contentType==null) - return "application/octet-stream"; - return contentType; - } - - public InputStream getInputStream() { - return new ByteArrayInputStream(buf,0,len); - } - - public String getName() { - return null; - } - - public OutputStream getOutputStream() { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/FinalArrayList.java b/jaxws/src/share/classes/com/sun/istack/internal/FinalArrayList.java deleted file mode 100644 index 6cc67b466e4..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/FinalArrayList.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * {@link ArrayList} with the final keyword. - * - *

- * This gives HotSpot a better hint that all methods can be inlined. - * - * @author Kohsuke Kawaguchi - */ -public final class FinalArrayList extends ArrayList { - public FinalArrayList(int initialCapacity) { - super(initialCapacity); - } - - public FinalArrayList() { - } - - public FinalArrayList(Collection ts) { - super(ts); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/FragmentContentHandler.java b/jaxws/src/share/classes/com/sun/istack/internal/FragmentContentHandler.java deleted file mode 100644 index c9b77721c9a..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/FragmentContentHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import org.xml.sax.helpers.XMLFilterImpl; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.ContentHandler; - -/** - * {@link XMLFilterImpl} that masks start/end document SAX events. - * @author Kohsuke Kawaguchi - */ -public class FragmentContentHandler extends XMLFilterImpl { - public FragmentContentHandler() { - } - - public FragmentContentHandler(XMLReader parent) { - super(parent); - } - - public FragmentContentHandler(ContentHandler handler) { - super(); - setContentHandler(handler); - } - - public void startDocument() throws SAXException { - // noop - } - - public void endDocument() throws SAXException { - // noop - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Interned.java b/jaxws/src/share/classes/com/sun/istack/internal/Interned.java deleted file mode 100644 index 26e6bff8648..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/Interned.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.annotation.ElementType; - -/** - * Designates that a field, return value, argument, or a variable is supposed - * to be an {@link String#intern() interned} string. - * - *

- * In many places in the istack, we assume Strings to be interned for - * the performance reason. Similarly, In many other places, we don't - * make such an assumption for the performance reason (because intern - * isn't free.) - * - *

- * Therefore, distinguishing which part is supposed to be interned and - * which part is supposed to be not is important. This annotation - * allows us to capture that in the code. - * - * @author Kohsuke Kawaguchi - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE}) -public @interface Interned { -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/NotNull.java b/jaxws/src/share/classes/com/sun/istack/internal/NotNull.java deleted file mode 100644 index f31eb46f248..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/NotNull.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.annotation.ElementType; - -/** - * Designates that a field, return value, argument, or a variable is guaranteed to be non-null. - * - * @author Kohsuke Kawaguchi - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE}) -public @interface NotNull { -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Nullable.java b/jaxws/src/share/classes/com/sun/istack/internal/Nullable.java deleted file mode 100644 index 269d2498193..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/Nullable.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.annotation.ElementType; - -/** - * Designates that a field, return value, argument, or a variable may be null. - * - * @author Kohsuke Kawaguchi - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE}) -public @interface Nullable { -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/Pool.java b/jaxws/src/share/classes/com/sun/istack/internal/Pool.java deleted file mode 100644 index 589f79a0c69..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/Pool.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import java.util.concurrent.ConcurrentLinkedQueue; -import java.lang.ref.WeakReference; - -/** - * Pool of reusable objects that are indistinguishable from each other, - * such as JAXB marshallers. - * - * @author Kohsuke Kawaguchi - */ -public interface Pool { - - /** - * Gets a new object from the pool. - * - *

- * If no object is available in the pool, this method creates a new one. - */ - @NotNull T take(); - - /** - * Returns an object back to the pool. - */ - void recycle(@NotNull T t); - - /** - * Default implementation that uses {@link ConcurrentLinkedQueue} - * as the data store. - * - *

Note for Implementors

- *

- * Don't rely on the fact that this class extends from {@link ConcurrentLinkedQueue}. - */ - public abstract class Impl implements Pool { - - private volatile WeakReference> queue; - - /** - * Gets a new object from the pool. - * - *

- * If no object is available in the pool, this method creates a new one. - * - * @return - * always non-null. - */ - public final @NotNull T take() { - T t = getQueue().poll(); - if(t==null) { - return create(); - } - return t; - } - - /** - * Returns an object back to the pool. - */ - public final void recycle(T t) { - getQueue().offer(t); - } - - private ConcurrentLinkedQueue getQueue() { - WeakReference> q = queue; - if (q != null) { - ConcurrentLinkedQueue d = q.get(); - if (d != null) { - return d; - } - } - // overwrite the queue - ConcurrentLinkedQueue d = new ConcurrentLinkedQueue(); - queue = new WeakReference>(d); - - return d; - } - - /** - * Creates a new instance of object. - * - *

- * This method is used when someone wants to - * {@link #take() take} an object from an empty pool. - * - *

- * Also note that multiple threads may call this method - * concurrently. - */ - protected abstract @NotNull T create(); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/SAXException2.java b/jaxws/src/share/classes/com/sun/istack/internal/SAXException2.java deleted file mode 100644 index 558d8ce57c5..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/SAXException2.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import org.xml.sax.SAXException; - -/** - * {@link SAXException} that handles exception chaining correctly. - * - * @author Kohsuke Kawaguchi - * @since 2.0 FCS - */ -public class SAXException2 extends SAXException { - public SAXException2(String message) { - super(message); - } - - public SAXException2(Exception e) { - super(e); - } - - public SAXException2(String message, Exception e) { - super(message, e); - } - - public Throwable getCause() { - return getException(); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/SAXParseException2.java b/jaxws/src/share/classes/com/sun/istack/internal/SAXParseException2.java deleted file mode 100644 index 0c6095f0a5a..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/SAXParseException2.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import org.xml.sax.SAXParseException; -import org.xml.sax.Locator; - -/** - * {@link SAXParseException} that handles exception chaining correctly. - * - * @author Kohsuke Kawaguchi - * @since 2.0 FCS - */ -public class SAXParseException2 extends SAXParseException { - public SAXParseException2(String message, Locator locator) { - super(message, locator); - } - - public SAXParseException2(String message, Locator locator, Exception e) { - super(message, locator, e); - } - - public SAXParseException2(String message, String publicId, String systemId, int lineNumber, int columnNumber) { - super(message, publicId, systemId, lineNumber, columnNumber); - } - - public SAXParseException2(String message, String publicId, String systemId, int lineNumber, int columnNumber, Exception e) { - super(message, publicId, systemId, lineNumber, columnNumber, e); - } - - public Throwable getCause() { - return getException(); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamException2.java b/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamException2.java deleted file mode 100644 index c88f6aea2c4..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamException2.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.Location; - -/** - * {@link XMLStreamException} that properly handles exception chaining. - * - * @author Kohsuke Kawaguchi - */ -public class XMLStreamException2 extends XMLStreamException { - public XMLStreamException2(String msg) { - super(msg); - } - - public XMLStreamException2(Throwable th) { - super(th); - } - - public XMLStreamException2(String msg, Throwable th) { - super(msg, th); - } - - public XMLStreamException2(String msg, Location location) { - super(msg, location); - } - - public XMLStreamException2(String msg, Location location, Throwable th) { - super(msg, location, th); - } - - /** - * {@link XMLStreamException} doesn't return the correct cause. - */ - public Throwable getCause() { - return getNestedException(); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java b/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java deleted file mode 100644 index ae960953b6b..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal; - -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.Locator; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.AttributesImpl; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.namespace.QName; - -/** - * This is a simple utility class that adapts StAX events from an - * {@link XMLStreamReader} to SAX events on a - * {@link ContentHandler}, bridging between the two - * parser technologies. - * - * @author Ryan.Shoemaker@Sun.COM - * @version 1.0 - */ -public class XMLStreamReaderToContentHandler { - - // StAX event source - private final XMLStreamReader staxStreamReader; - - // SAX event sink - private final ContentHandler saxHandler; - - // if true, when the conversion is completed, leave the cursor to the last - // event that was fired (such as end element) - private final boolean eagerQuit; - - /** - * If true, not start/endDocument event. - */ - private final boolean fragment; - - // array of the even length of the form { prefix0, uri0, prefix1, uri1, ... } - private final String[] inscopeNamespaces; - - /** - * @see #XMLStreamReaderToContentHandler(XMLStreamReader, ContentHandler, boolean, boolean, String[]) - */ - public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, boolean eagerQuit, boolean fragment) { - this(staxCore, saxCore, eagerQuit, fragment, new String[0]); - } - - /** - * Construct a new StAX to SAX adapter that will convert a StAX event - * stream into a SAX event stream. - * - * @param staxCore - * StAX event source - * @param saxCore - * SAXevent sink - * @param eagerQuit - * @param fragment - * @param inscopeNamespaces - * array of the even length of the form { prefix0, uri0, prefix1, uri1, ... } - */ - public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, - boolean eagerQuit, boolean fragment, String[] inscopeNamespaces) { - this.staxStreamReader = staxCore; - this.saxHandler = saxCore; - this.eagerQuit = eagerQuit; - this.fragment = fragment; - this.inscopeNamespaces = inscopeNamespaces; - assert inscopeNamespaces.length%2 == 0; - } - - - /* - * @see StAXReaderToContentHandler#bridge() - */ - public void bridge() throws XMLStreamException { - - try { - // remembers the nest level of elements to know when we are done. - int depth=0; - - // if the parser is at the start tag, proceed to the first element - int event = staxStreamReader.getEventType(); - if(event == XMLStreamConstants.START_DOCUMENT) { - // nextTag doesn't correctly handle DTDs - while( !staxStreamReader.isStartElement() ) - event = staxStreamReader.next(); - } - - - if( event!=XMLStreamConstants.START_ELEMENT) - throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event); - - handleStartDocument(); - - for(int i=0; i < inscopeNamespaces.length; i+=2) { - saxHandler.startPrefixMapping(inscopeNamespaces[i], inscopeNamespaces[i+1]); - } - - OUTER: - do { - // These are all of the events listed in the javadoc for - // XMLEvent. - // The spec only really describes 11 of them. - switch (event) { - case XMLStreamConstants.START_ELEMENT : - depth++; - handleStartElement(); - break; - case XMLStreamConstants.END_ELEMENT : - handleEndElement(); - depth--; - if(depth==0 && eagerQuit) - break OUTER; - break; - case XMLStreamConstants.CHARACTERS : - handleCharacters(); - break; - case XMLStreamConstants.ENTITY_REFERENCE : - handleEntityReference(); - break; - case XMLStreamConstants.PROCESSING_INSTRUCTION : - handlePI(); - break; - case XMLStreamConstants.COMMENT : - handleComment(); - break; - case XMLStreamConstants.DTD : - handleDTD(); - break; - case XMLStreamConstants.ATTRIBUTE : - handleAttribute(); - break; - case XMLStreamConstants.NAMESPACE : - handleNamespace(); - break; - case XMLStreamConstants.CDATA : - handleCDATA(); - break; - case XMLStreamConstants.ENTITY_DECLARATION : - handleEntityDecl(); - break; - case XMLStreamConstants.NOTATION_DECLARATION : - handleNotationDecl(); - break; - case XMLStreamConstants.SPACE : - handleSpace(); - break; - default : - throw new InternalError("processing event: " + event); - } - - event=staxStreamReader.next(); - } while (depth!=0); - - for(int i=0; i < inscopeNamespaces.length; i+=2) { - saxHandler.endPrefixMapping(inscopeNamespaces[i]); - } - - handleEndDocument(); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleEndDocument() throws SAXException { - if(fragment) - return; - - saxHandler.endDocument(); - } - - private void handleStartDocument() throws SAXException { - if(fragment) - return; - - saxHandler.setDocumentLocator(new Locator() { - public int getColumnNumber() { - return staxStreamReader.getLocation().getColumnNumber(); - } - public int getLineNumber() { - return staxStreamReader.getLocation().getLineNumber(); - } - public String getPublicId() { - return staxStreamReader.getLocation().getPublicId(); - } - public String getSystemId() { - return staxStreamReader.getLocation().getSystemId(); - } - }); - saxHandler.startDocument(); - } - - private void handlePI() throws XMLStreamException { - try { - saxHandler.processingInstruction( - staxStreamReader.getPITarget(), - staxStreamReader.getPIData()); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleCharacters() throws XMLStreamException { - try { - saxHandler.characters( - staxStreamReader.getTextCharacters(), - staxStreamReader.getTextStart(), - staxStreamReader.getTextLength() ); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleEndElement() throws XMLStreamException { - QName qName = staxStreamReader.getName(); - - try { - String pfix = qName.getPrefix(); - String rawname = (pfix == null || pfix.length() == 0) - ? qName.getLocalPart() - : pfix + ':' + qName.getLocalPart(); - // fire endElement - saxHandler.endElement( - qName.getNamespaceURI(), - qName.getLocalPart(), - rawname); - - // end namespace bindings - int nsCount = staxStreamReader.getNamespaceCount(); - for (int i = nsCount - 1; i >= 0; i--) { - String prefix = staxStreamReader.getNamespacePrefix(i); - if (prefix == null) { // true for default namespace - prefix = ""; - } - saxHandler.endPrefixMapping(prefix); - } - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleStartElement() throws XMLStreamException { - - try { - // start namespace bindings - int nsCount = staxStreamReader.getNamespaceCount(); - for (int i = 0; i < nsCount; i++) { - saxHandler.startPrefixMapping( - fixNull(staxStreamReader.getNamespacePrefix(i)), - fixNull(staxStreamReader.getNamespaceURI(i))); - } - - // fire startElement - QName qName = staxStreamReader.getName(); - String prefix = qName.getPrefix(); - String rawname; - if(prefix==null || prefix.length()==0) - rawname = qName.getLocalPart(); - else - rawname = prefix + ':' + qName.getLocalPart(); - Attributes attrs = getAttributes(); - saxHandler.startElement( - qName.getNamespaceURI(), - qName.getLocalPart(), - rawname, - attrs); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private static String fixNull(String s) { - if(s==null) return ""; - else return s; - } - - /** - * Get the attributes associated with the given START_ELEMENT or ATTRIBUTE - * StAXevent. - * - * @return the StAX attributes converted to an org.xml.sax.Attributes - */ - private Attributes getAttributes() { - AttributesImpl attrs = new AttributesImpl(); - - int eventType = staxStreamReader.getEventType(); - if (eventType != XMLStreamConstants.ATTRIBUTE - && eventType != XMLStreamConstants.START_ELEMENT) { - throw new InternalError( - "getAttributes() attempting to process: " + eventType); - } - - // in SAX, namespace declarations are not part of attributes by default. - // (there's a property to control that, but as far as we are concerned - // we don't use it.) So don't add xmlns:* to attributes. - - // gather non-namespace attrs - for (int i = 0; i < staxStreamReader.getAttributeCount(); i++) { - String uri = staxStreamReader.getAttributeNamespace(i); - if(uri==null) uri=""; - String localName = staxStreamReader.getAttributeLocalName(i); - String prefix = staxStreamReader.getAttributePrefix(i); - String qName; - if(prefix==null || prefix.length()==0) - qName = localName; - else - qName = prefix + ':' + localName; - String type = staxStreamReader.getAttributeType(i); - String value = staxStreamReader.getAttributeValue(i); - - attrs.addAttribute(uri, localName, qName, type, value); - } - - return attrs; - } - - private void handleNamespace() { - // no-op ??? - // namespace events don't normally occur outside of a startElement - // or endElement - } - - private void handleAttribute() { - // no-op ??? - // attribute events don't normally occur outside of a startElement - // or endElement - } - - private void handleDTD() { - // no-op ??? - // it seems like we need to pass this info along, but how? - } - - private void handleComment() { - // no-op ??? - } - - private void handleEntityReference() { - // no-op ??? - } - - private void handleSpace() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } - - private void handleNotationDecl() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } - - private void handleEntityDecl() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } - - private void handleCDATA() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizable.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizable.java deleted file mode 100644 index 82dbde89c17..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizable.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.istack.internal.localization; - -/** - * Localizable message. - * - * @author WS Development Team - */ -public interface Localizable { - /** - * Gets the key in the resource bundle. - * - * @return - * if this method returns {@link #NOT_LOCALIZABLE}, - * that means the message is not localizable, and - * the first item of {@link #getArguments()} array - * holds a String. - */ - public String getKey(); - - /** - * Returns the arguments for message formatting. - * - * @return - * can be an array of length 0 but never be null. - */ - public Object[] getArguments(); - public String getResourceBundleName(); - - - /** - * Special constant that represents a message that - * is not localizable. - * - *

- * Use of "new" is to create an unique instance. - */ - public static final String NOT_LOCALIZABLE = new String("\u0000"); -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java deleted file mode 100644 index 4438e131c1e..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.istack.internal.localization; - -/** - * @author WS Development Team - */ -public final class LocalizableMessage implements Localizable { - - private final String _bundlename; - private final String _key; - private final Object[] _args; - - public LocalizableMessage(String bundlename, String key, Object... args) { - _bundlename = bundlename; - _key = key; - if(args==null) - args = new Object[0]; - _args = args; - } - - public String getKey() { - return _key; - } - - public Object[] getArguments() { - return _args; - } - - public String getResourceBundleName() { - return _bundlename; - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java deleted file mode 100644 index 066d8b1df36..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.istack.internal.localization; - -/** - * @author WS Development Team - */ -public class LocalizableMessageFactory { - - private final String _bundlename; - - public LocalizableMessageFactory(String bundlename) { - _bundlename = bundlename; - } - - public Localizable getMessage(String key, Object... args) { - return new LocalizableMessage(_bundlename, key, args); - } - -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizer.java b/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizer.java deleted file mode 100644 index 7aa7064d40c..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/localization/Localizer.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.istack.internal.localization; - -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localizes the {@link Localizable} into a message - * by using a configured {@link Locale}. - * - * @author WS Development Team - */ -public class Localizer { - - private final Locale _locale; - private final HashMap _resourceBundles; - - public Localizer() { - this(Locale.getDefault()); - } - - public Localizer(Locale l) { - _locale = l; - _resourceBundles = new HashMap(); - } - - public Locale getLocale() { - return _locale; - } - - public String localize(Localizable l) { - String key = l.getKey(); - if (key == Localizable.NOT_LOCALIZABLE) { - // this message is not localizable - return (String) l.getArguments()[0]; - } - String bundlename = l.getResourceBundleName(); - - try { - ResourceBundle bundle = - (ResourceBundle) _resourceBundles.get(bundlename); - - if (bundle == null) { - try { - bundle = ResourceBundle.getBundle(bundlename, _locale); - } catch (MissingResourceException e) { - // work around a bug in the com.sun.enterprise.deployment.WebBundleArchivist: - // all files with an extension different from .class (hence all the .properties files) - // get copied to the top level directory instead of being in the package where they - // are defined - // so, since we can't find the bundle under its proper name, we look for it under - // the top-level package - - int i = bundlename.lastIndexOf('.'); - if (i != -1) { - String alternateBundleName = - bundlename.substring(i + 1); - try { - bundle = - ResourceBundle.getBundle( - alternateBundleName, - _locale); - } catch (MissingResourceException e2) { - // give up - return getDefaultMessage(l); - } - } - } - - _resourceBundles.put(bundlename, bundle); - } - - if (bundle == null) { - return getDefaultMessage(l); - } - - if (key == null) - key = "undefined"; - - String msg; - try { - msg = bundle.getString(key); - } catch (MissingResourceException e) { - // notice that this may throw a MissingResourceException of its own (caught below) - msg = bundle.getString("undefined"); - } - - // localize all arguments to the given localizable object - Object[] args = l.getArguments(); - for (int i = 0; i < args.length; ++i) { - if (args[i] instanceof Localizable) - args[i] = localize((Localizable) args[i]); - } - - String message = MessageFormat.format(msg, args); - return message; - - } catch (MissingResourceException e) { - return getDefaultMessage(l); - } - - } - - private String getDefaultMessage(Localizable l) { - String key = l.getKey(); - Object[] args = l.getArguments(); - StringBuilder sb = new StringBuilder(); - sb.append("[failed to localize] "); - sb.append(key); - if (args != null) { - sb.append('('); - for (int i = 0; i < args.length; ++i) { - if (i != 0) - sb.append(", "); - sb.append(String.valueOf(args[i])); - } - sb.append(')'); - } - return sb.toString(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/package-info.java b/jaxws/src/share/classes/com/sun/istack/internal/package-info.java deleted file mode 100644 index 60a915df58d..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/package-info.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -/** - * istack-commons runtime utilities. - */ -package com.sun.istack.internal; diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/APTTypeVisitor.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/APTTypeVisitor.java deleted file mode 100644 index 2678f1437b3..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/tools/APTTypeVisitor.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal.tools; - -import com.sun.mirror.type.TypeMirror; -import com.sun.mirror.type.ArrayType; -import com.sun.mirror.type.ClassType; -import com.sun.mirror.type.InterfaceType; -import com.sun.mirror.type.TypeVariable; -import com.sun.mirror.type.VoidType; -import com.sun.mirror.type.WildcardType; -import com.sun.mirror.type.PrimitiveType; - -/** - * Visitor that works on APT {@link TypeMirror} and computes a value. - * - *

- * This visitor takes a parameter 'P' so that visitor code can be made stateless. - * - * @author Kohsuke Kawaguchi - */ -public abstract class APTTypeVisitor { - public final T apply(TypeMirror type, P param) { - if( type instanceof ArrayType) - return onArrayType((ArrayType)type,param); - if( type instanceof PrimitiveType) - return onPrimitiveType((PrimitiveType)type,param); - if (type instanceof ClassType ) - return onClassType((ClassType)type,param); - if (type instanceof InterfaceType ) - return onInterfaceType((InterfaceType)type,param); - if (type instanceof TypeVariable ) - return onTypeVariable((TypeVariable)type,param); - if (type instanceof VoidType ) - return onVoidType((VoidType)type,param); - if(type instanceof WildcardType) - return onWildcard((WildcardType) type,param); - assert false; - throw new IllegalArgumentException(); - } - - protected abstract T onPrimitiveType(PrimitiveType type, P param); - protected abstract T onArrayType(ArrayType type, P param); - protected abstract T onClassType(ClassType type, P param); - protected abstract T onInterfaceType(InterfaceType type, P param); - protected abstract T onTypeVariable(TypeVariable type, P param); - protected abstract T onVoidType(VoidType type, P param); - protected abstract T onWildcard(WildcardType type, P param); - -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/MaskingClassLoader.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/MaskingClassLoader.java deleted file mode 100644 index 8159a7e677b..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/tools/MaskingClassLoader.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal.tools; - -import java.util.Collection; - -/** - * {@link ClassLoader} that masks a specified set of classes - * from its parent class loader. - * - *

- * This code is used to create an isolated environment. - * - * @author Kohsuke Kawaguchi - */ -public class MaskingClassLoader extends ClassLoader { - - private final String[] masks; - - public MaskingClassLoader(String... masks) { - this.masks = masks; - } - - public MaskingClassLoader(Collection masks) { - this(masks.toArray(new String[masks.size()])); - } - - public MaskingClassLoader(ClassLoader parent, String... masks) { - super(parent); - this.masks = masks; - } - - public MaskingClassLoader(ClassLoader parent, Collection masks) { - this(parent, masks.toArray(new String[masks.size()])); - } - - @Override - protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - for (String mask : masks) { - if(name.startsWith(mask)) - throw new ClassNotFoundException(); - } - - return super.loadClass(name, resolve); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/ParallelWorldClassLoader.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/ParallelWorldClassLoader.java deleted file mode 100644 index 013a0aa12ad..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/tools/ParallelWorldClassLoader.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal.tools; - -import java.io.InputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.net.URL; -import java.net.MalformedURLException; -import java.util.Enumeration; - -/** - * Load classes/resources from a side folder, so that - * classes of the same package can live in a single jar file. - * - *

- * For example, with the following jar file: - *

- *  /
- *  +- foo
- *     +- X.class
- *  +- bar
- *     +- X.class
- * 
- *

- * {@link ParallelWorldClassLoader}("foo/") would load X.class from - * /foo/X.class (note that X is defined in the root package, not - * foo.X. - * - *

- * This can be combined with {@link MaskingClassLoader} to mask classes which are loaded by the parent - * class loader so that the child class loader - * classes living in different folders are loaded - * before the parent class loader loads classes living the jar file publicly - * visible - * For example, with the following jar file: - *

- *  /
- *  +- foo
- *     +- X.class
- *  +- bar
- *     +-foo
- *        +- X.class
- * 
- *

- * {@link ParallelWorldClassLoader}(MaskingClassLoader.class.getClassLoader()) would load foo.X.class from - * /bar/foo.X.class not the foo.X.class in the publicly visible place in the jar file, thus - * masking the parent classLoader from loading the class from foo.X.class - * (note that X is defined in the package foo, not - * bar.foo.X. - * - * @author Kohsuke Kawaguchi - */ -public class ParallelWorldClassLoader extends ClassLoader { - - /** - * Strings like "prefix/", "abc/", or "" to indicate - * classes should be loaded normally. - */ - private final String prefix; - - public ParallelWorldClassLoader(ClassLoader parent,String prefix) { - super(parent); - this.prefix = prefix; - } - - protected Class findClass(String name) throws ClassNotFoundException { - StringBuffer sb = new StringBuffer(name.length()+prefix.length()+6); - sb.append(prefix).append(name.replace('.','/')).append(".class"); - - InputStream is = getParent().getResourceAsStream(sb.toString()); - if (is==null) - throw new ClassNotFoundException(name); - - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buf = new byte[1024]; - int len; - while((len=is.read(buf))>=0) - baos.write(buf,0,len); - - buf = baos.toByteArray(); - int packIndex = name.lastIndexOf('.'); - if (packIndex != -1) { - String pkgname = name.substring(0, packIndex); - // Check if package already loaded. - Package pkg = getPackage(pkgname); - if (pkg == null) { - definePackage(pkgname, null, null, null, null, null, null, null); - } - } - return defineClass(name,buf,0,buf.length); - } catch (IOException e) { - throw new ClassNotFoundException(name,e); - } - } - - protected URL findResource(String name) { - return getParent().getResource(prefix+name); - } - - protected Enumeration findResources(String name) throws IOException { - return getParent().getResources( prefix+name); - } - - /** - * Given the URL inside jar, returns the URL to the jar itself. - */ - public static URL toJarUrl(URL res) throws ClassNotFoundException, MalformedURLException { - String url = res.toExternalForm(); - if(!url.startsWith("jar:")) - throw new ClassNotFoundException("Loaded outside a jar "+url); - url = url.substring(4); // cut off jar: - url = url.substring(0,url.lastIndexOf('!')); // cut off everything after '!' - return new URL(url); - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/tools/package-info.java b/jaxws/src/share/classes/com/sun/istack/internal/tools/package-info.java deleted file mode 100644 index 3ce8c80627f..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/tools/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -/** - * istack-commons tool time utilities. - * - *

- * This includes code that relies on APT, javac, etc. - */ -package com.sun.istack.internal.tools; diff --git a/jaxws/src/share/classes/com/sun/istack/internal/ws/AnnotationProcessorFactoryImpl.java b/jaxws/src/share/classes/com/sun/istack/internal/ws/AnnotationProcessorFactoryImpl.java deleted file mode 100644 index 7f1e7eaf561..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/ws/AnnotationProcessorFactoryImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.istack.internal.ws; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import com.sun.mirror.apt.*; -import com.sun.mirror.declaration.*; - - -import com.sun.tools.internal.ws.processor.modeler.annotation.AnnotationProcessorContext; -import com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP; - -/* - * The JAX-WS {@com.sun.mirror.apt.AnnotationProcessorFactory AnnotationProcessorFactory} - * class used by the APT - * framework. - */ -public class AnnotationProcessorFactoryImpl implements AnnotationProcessorFactory { - - private static WebServiceAP wsAP; - /* - * Processor doesn't examine any options. - */ - static final Collection supportedOptions = Collections.unmodifiableSet(new HashSet()); - - - /* - * Supports javax.jws.*, javax.jws.soap.* and javax.xml.ws.* annotations. - */ - static Collection supportedAnnotations; - static { - Collection types = new HashSet(); - types.add("javax.jws.HandlerChain"); - types.add("javax.jws.Oneway"); - types.add("javax.jws.WebMethod"); - types.add("javax.jws.WebParam"); - types.add("javax.jws.WebResult"); - types.add("javax.jws.WebService"); - types.add("javax.jws.soap.InitParam"); - types.add("javax.jws.soap.SOAPBinding"); - types.add("javax.jws.soap.SOAPMessageHandler"); - types.add("javax.jws.soap.SOAPMessageHandlers"); - types.add("javax.xml.ws.BindingType"); - types.add("javax.xml.ws.RequestWrapper"); - types.add("javax.xml.ws.ResponseWrapper"); - types.add("javax.xml.ws.ServiceMode"); - types.add("javax.xml.ws.WebEndpoint"); - types.add("javax.xml.ws.WebFault"); - types.add("javax.xml.ws.WebServiceClient"); - types.add("javax.xml.ws.WebServiceProvider"); - types.add("javax.xml.ws.WebServiceRef"); - supportedAnnotations = Collections.unmodifiableCollection(types); - } - - public AnnotationProcessorFactoryImpl() { - } - - - public Collection supportedOptions() { - return supportedOptions; - } - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - /* - * Return an instance of the {@link com.sun.istack.internal.ws.WSAP WSAP} AnnotationProcesor. - */ - public AnnotationProcessor getProcessorFor(Set atds, - AnnotationProcessorEnvironment apEnv) { - - if (wsAP == null) { - AnnotationProcessorContext context = new AnnotationProcessorContext(); - wsAP = new WebServiceAP(null, context, null, null); - - } - wsAP.init(apEnv); - return wsAP; - } -} diff --git a/jaxws/src/share/classes/com/sun/istack/internal/ws/package-info.java b/jaxws/src/share/classes/com/sun/istack/internal/ws/package-info.java deleted file mode 100644 index 31850e07dd2..00000000000 --- a/jaxws/src/share/classes/com/sun/istack/internal/ws/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/** - * - *

This document describes the {@link com.sun.mirror.apt.AnnotationProcessor AnnotationProcessor} - * included with JAX-WS 2.0.1. - * - *

The {@link com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl AnnoatationnProcessorFactoryImpl} class - * tells the APT - * framework that there exists an {@com.sun.mirror.apt.AnnotationProcessor AnnotationProcessor} - * ({@link com.sun.istak.ws.WSAP WSAP}) for for processing javax.jws.*, javax.jws.soap.*, - * and javax.xml.ws.* annotations. - * - * @ArchitectureDocument -*/ -package com.sun.istack.internal.ws; diff --git a/jaxws/src/share/classes/com/sun/tools/etc/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory b/jaxws/src/share/classes/com/sun/tools/etc/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory deleted file mode 100644 index 8399fe552be..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/etc/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl diff --git a/jaxws/src/share/classes/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.xjc.Plugin b/jaxws/src/share/classes/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.xjc.Plugin deleted file mode 100644 index 6b19c805ad8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.xjc.Plugin +++ /dev/null @@ -1,4 +0,0 @@ -com.sun.tools.internal.xjc.addon.locator.SourceLocationAddOn -com.sun.tools.internal.xjc.addon.sync.SynchronizedMethodAddOn -com.sun.tools.internal.xjc.addon.at_generated.PluginImpl -com.sun.tools.internal.xjc.addon.episode.PluginImpl diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/ConfigReader.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/ConfigReader.java deleted file mode 100644 index 768c4617717..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/ConfigReader.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; -import javax.xml.validation.ValidatorHandler; - -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.tools.internal.jxc.gen.config.Config; -import com.sun.tools.internal.jxc.gen.config.Schema; -import com.sun.tools.internal.xjc.SchemaCache; -import com.sun.tools.internal.xjc.api.Reference; -import com.sun.tools.internal.xjc.util.ForkContentHandler; - -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; - - -/** - * This reads the config files passed by the user to apt - * and obtains a list of classes that need to be included - * for a particular config from the set of classes passed - * by the user to apt. - * - * @author Bhakti Mehta (bhakti.mehta@sun.com) - */ -public final class ConfigReader { - - /** - * The set of classes to be passed to XJC - * - */ - private final Set classesToBeIncluded = new HashSet();; - - - /** - * The SchemaOutputResolver used to generate the schemas - */ - private final SchemaOutputResolver schemaOutputResolver; - - private final AnnotationProcessorEnvironment env; - - /** - * - * @param classes - * The set of classes passed to the AnnotationProcessor - * @param xmlFile - * The configuration file. - * @throws SAXException - * If this is thrown, the error has already been reported. - * @throws IOException - * If any IO errors occur. - */ - public ConfigReader( AnnotationProcessorEnvironment env, Collection classes, File xmlFile, ErrorHandler errorHandler)throws SAXException,IOException{ - this.env = env; - Config config = parseAndGetConfig(xmlFile,errorHandler); - checkAllClasses(config,classes); - String path = xmlFile.getAbsolutePath(); - String xmlPath = path.substring(0,path.lastIndexOf(File.separatorChar)); - schemaOutputResolver = createSchemaOutputResolver(config,xmlPath); - - } - - - /** - * This creates creates a regular expression - * for the user pattern , matches the input classes - * passed by the user and returns the final - * list of classes that need to be included for a config file - * after applying those patterns - * - */ - public Collection getClassesToBeIncluded() { - return classesToBeIncluded; - } - - private void checkAllClasses(Config config ,Collection rootClasses){ - - List includeRegexList = config.getClasses().getIncludes(); - List excludeRegexList = config.getClasses().getExcludes(); - - OUTER: - for (TypeDeclaration typeDecl : rootClasses) { - - String qualifiedName = typeDecl.getQualifiedName(); - - for (Pattern pattern : excludeRegexList) { - boolean match = checkPatternMatch(qualifiedName, pattern); - if (match) - continue OUTER; // excluded - } - - for (Pattern pattern : includeRegexList) { - boolean match = checkPatternMatch(qualifiedName, pattern); - if (match) { - classesToBeIncluded.add(new Reference(typeDecl,env)); - break; - } - } - } - } - - /** - * This returns the SchemaOutputResolver to generate the schemas - */ - public SchemaOutputResolver getSchemaOutputResolver(){ - return schemaOutputResolver; - } - - private SchemaOutputResolver createSchemaOutputResolver(Config config, String xmlpath) { - File baseDir = new File(xmlpath, config.getBaseDir().getPath()); - SchemaOutputResolverImpl schemaOutputResolver = new SchemaOutputResolverImpl (baseDir); - - for( Schema schema : (List)config.getSchema() ) { - String namespace = schema.getNamespace(); - File location = schema.getLocation(); - schemaOutputResolver.addSchemaInfo(namespace,location); - } - return schemaOutputResolver; - } - - /** - * This will check if the qualified name matches the pattern - * - * @param qualifiedName - * The qualified name of the TypeDeclaration - * @param pattern - * The pattern obtained from the users input - * - */ - private boolean checkPatternMatch(String qualifiedName, Pattern pattern) { - Matcher matcher = pattern.matcher(qualifiedName); - return matcher.matches(); - } - - - - /** - * Lazily parsed schema for the binding file. - */ - private static SchemaCache configSchema = new SchemaCache(Config.class.getResource("config.xsd")); - - - /** - * Parses an xml config file and returns a Config object. - * - * @param xmlFile - * The xml config file which is passed by the user to apt - * @return - * A non null Config object - */ - private Config parseAndGetConfig (File xmlFile, ErrorHandler errorHandler) throws SAXException, IOException { - XMLReader reader; - try { - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - reader = factory.newSAXParser().getXMLReader(); - } catch (ParserConfigurationException e) { - // in practice this will never happen - throw new Error(e); - } - NGCCRuntimeEx runtime = new NGCCRuntimeEx(errorHandler); - - // set up validator - ValidatorHandler validator = configSchema.newValidator(); - validator.setErrorHandler(errorHandler); - - // the validator will receive events first, then the parser. - reader.setContentHandler(new ForkContentHandler(validator,runtime)); - - reader.setErrorHandler(errorHandler); - Config config = new Config(runtime); - runtime.setRootHandler(config); - reader.parse(new InputSource(xmlFile.toURL().toExternalForm())); - runtime.reset(); - - return config; - } - /** - * Controls where the JAXB RI puts the generates - * schema files. - * @author - * Bhakti Mehta (bhakti.mehta@sun.com) - */ - private static final class SchemaOutputResolverImpl extends SchemaOutputResolver{ - - /** - * Directory to which we put the rest of the files. - * Never be null. - */ - private final File baseDir; - - /** - * Namespace URI to the location of the schema. - * This captures what the user specifies. - */ - private final Map schemas = new HashMap(); - - - /** - * Decides where the schema file (of the given namespace URI) - * will be written, and return it as a {@link Result} object. - * - */ - public Result createOutput( String namespaceUri, String suggestedFileName ) { - - // the user's preference takes a precedence - if(schemas.containsKey(namespaceUri)) { - File loc = schemas.get(namespaceUri); - if(loc==null) return null; // specifically not to generate a schema - - // create directories if necessary. we've already checked that the baseDir - // exists, so this should be no surprise to users. - loc.getParentFile().mkdirs(); - - return new StreamResult(loc); // generate into a file the user specified. - } - - // if the user didn't say anything about this namespace, - // generate it into the default directory with a default name. - - File schemaFile = new File (baseDir, suggestedFileName); - // The systemId for the result will be schemaFile - return new StreamResult(schemaFile); - } - - - public SchemaOutputResolverImpl(File baseDir) { - assert baseDir!=null; - this.baseDir = baseDir; - } - - public void addSchemaInfo(String namespaceUri, File location) { - if (namespaceUri == null ) - //generate elements in no namespace - namespaceUri = ""; - schemas.put(namespaceUri, location); - - } - - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties b/jaxws/src/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties deleted file mode 100644 index 768b98d76a7..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -UNEXPECTED_NGCC_TOKEN = \ - Unexpected {0} appears at line {1} column {2} - -BASEDIR_DOESNT_EXIST = \ - Non-existent directory: {0} - -VERSION = \ - schemagen version "JAXB 2.1.10 in JDK 6" \n\ - JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build JAXB 2.1.10 in JDK 6) - -USAGE = \ -Usage: schemagen [-options ...] \n\ -Options: \n\ -\ \ \ \ -d : specify where to place processor and javac generated class files\n\ -\ \ \ \ -cp : specify where to find user specified files\n\ -\ \ \ \ -classpath : specify where to find user specified files\n\ -\ \ \ \ -episode : generate episode file for separate compilation\n\ -\ \ \ \ -version : display version information\n\ -\ \ \ \ -help : display this usage message diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/Messages.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/Messages.java deleted file mode 100644 index 4db5be20b06..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/Messages.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources. - * - * @author Kohsuke Kawaguchi - */ -enum Messages { - // Accessor - UNEXPECTED_NGCC_TOKEN, // 3 args - BASEDIR_DOESNT_EXIST, // 1 arg - USAGE, //0 args - VERSION, // 0 args - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getPackage().getName() +".MessageBundle"); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/NGCCRuntimeEx.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/NGCCRuntimeEx.java deleted file mode 100644 index 699f47828cd..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/NGCCRuntimeEx.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.jxc; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -import com.sun.tools.internal.jxc.gen.config.NGCCRuntime; - -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - - -/** - * Controls the validating and converting of values obtained - * from the config file. - * - * @author - * Bhakti Mehta (bhakti.mehta@sun.com) - */ -public final class NGCCRuntimeEx extends NGCCRuntime { - /** - * All the errors shall be sent to this object. - */ - private final ErrorHandler errorHandler; - - public NGCCRuntimeEx(ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * This will check if the baseDir provided by the user - * in the config file exists. If not it throws an error - * @param baseDir - * The baseDir attribute passed by the user in the xml config file as a path - * @return - * The file representation of the path name - */ - public File getBaseDir(String baseDir) throws SAXException { - File dir = new File(baseDir); - if (dir.exists()) { - return dir; - } else { - SAXParseException e = new SAXParseException( - Messages.BASEDIR_DOESNT_EXIST.format(dir.getAbsolutePath()), - getLocator()); - errorHandler.error(e); - throw e; // we can't recover from this error - } - } - - /** - * This takes the include list provided by the user in the config file - * It converts the user values to {@link Pattern} - * @param includeContent - * The include list specified by the user - * @return - * A list of regular expression patterns {@link Pattern} - */ - public List getIncludePatterns(List includeContent ) { - List includeRegexList = new ArrayList(); - for (int i = 0 ; i < includeContent.size(); i ++){ - String includes = (String)includeContent.get(i); - String regex = convertToRegex(includes); - Pattern pattern = Pattern.compile(regex); - includeRegexList.add(pattern); - } - return includeRegexList; - } - - - /** - * This takes the exclude list provided by the user in the config file - * It converts the user values to {@link Pattern} - * @param excludeContent - * The exclude list specified by the user - * @return - * A list of regular expression patterns {@link Pattern} - */ - public List getExcludePatterns(List excludeContent ) { - List excludeRegexList = new ArrayList(); - for (int i = 0 ; i < excludeContent.size(); i ++){ - String excludes = (String)excludeContent.get(i); - String regex = convertToRegex(excludes); - Pattern pattern = Pattern.compile(regex); - excludeRegexList.add(pattern); - } - return excludeRegexList; - } - - - /** - * This will tokenize the pattern and convert it into a regular expression - * @param pattern - */ - private String convertToRegex(String pattern) { - StringBuilder regex = new StringBuilder(); - char nc = ' '; - if (pattern.length() >0 ) { - - for ( int i = 0 ; i < pattern.length(); i ++ ) { - char c = pattern.charAt(i); - int j = i; - nc = ' '; - if ((j+1) != pattern.length()) { - nc = pattern.charAt(j+1); - } - //escape single '.' - if ((c=='.') && ( nc !='.')){ - regex.append('\\'); - regex.append('.'); - //do not allow patterns like a..b - } else if ((c=='.') && ( nc =='.')){ - continue; - // "**" gets replaced by ".*" - } else if ((c=='*') && (nc == '*')) { - regex.append(".*"); - break; - //'*' replaced by anything but '.' i.e [^\\.]+ - } else if (c=='*') { - regex.append("[^\\.]+"); - continue; - //'?' replaced by anything but '.' i.e [^\\.] - } else if (c=='?') { - regex.append("[^\\.]"); - //else leave the chars as they occur in the pattern - } else - regex.append(c); - } - - } - - return regex.toString(); - } - - protected void unexpectedX(String token) throws SAXException { - errorHandler.error( - new SAXParseException(Messages.UNEXPECTED_NGCC_TOKEN.format( - token, getLocator().getLineNumber(), getLocator().getColumnNumber()), - getLocator())); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java deleted file mode 100644 index de476e3c586..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBContext; - -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.tools.internal.jxc.apt.Options; -import com.sun.tools.internal.xjc.BadCommandLineException; -import com.sun.tools.internal.xjc.api.util.APTClassLoader; -import com.sun.tools.internal.xjc.api.util.ToolsJarNotFoundException; -import com.sun.xml.internal.bind.util.Which; - -/** - * CLI entry-point to the schema generator. - * - * @author Bhakti Mehta - */ -public class SchemaGenerator { - /** - * Runs the schema generator. - */ - public static void main(String[] args) throws Exception { - System.exit(run(args)); - } - - public static int run(String[] args) throws Exception { - try { - ClassLoader cl = SchemaGenerator.class.getClassLoader(); - if(cl==null) cl = ClassLoader.getSystemClassLoader(); - ClassLoader classLoader = new APTClassLoader(cl,packagePrefixes); - return run(args, classLoader); - } catch( ToolsJarNotFoundException e) { - System.err.println(e.getMessage()); - return -1; - } - } - - /** - * List of package prefixes we want to load in the same package - */ - private static final String[] packagePrefixes = { - "com.sun.tools.internal.jxc.", - "com.sun.tools.internal.xjc.", - "com.sun.istack.internal.tools.", - "com.sun.tools.apt.", - "com.sun.tools.javac.", - "com.sun.tools.javadoc.", - "com.sun.mirror." - }; - - /** - * Runs the schema generator. - * - * @param classLoader - * the schema generator will run in this classLoader. - * It needs to be able to load APT and JAXB RI classes. Note that - * JAXB RI classes refer to APT classes. Must not be null. - * - * @return - * exit code. 0 if success. - * - */ - public static int run(String[] args, ClassLoader classLoader) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - final Options options = new Options(); - if (args.length ==0) { - usage(); - return -1; - } - for (String arg : args) { - if (arg.equals("-help")) { - usage(); - return -1; - } - - if (arg.equals("-version")) { - System.out.println(Messages.VERSION.format()); - return -1; - } - } - - try { - options.parseArguments(args); - } catch (BadCommandLineException e) { - // there was an error in the command line. - // print usage and abort. - System.out.println(e.getMessage()); - System.out.println(); - usage(); - return -1; - } - - Class schemagenRunner = classLoader.loadClass(Runner.class.getName()); - Method mainMethod = schemagenRunner.getDeclaredMethod("main",String[].class,File.class); - - List aptargs = new ArrayList(); - - if(hasClass(options.arguments)) - aptargs.add("-XclassesAsDecls"); - - // make jaxb-api.jar visible to classpath - File jaxbApi = findJaxbApiJar(); - if(jaxbApi!=null) { - if(options.classpath!=null) { - options.classpath = options.classpath+File.pathSeparatorChar+jaxbApi; - } else { - options.classpath = jaxbApi.getPath(); - } - } - - aptargs.add("-cp"); - aptargs.add(options.classpath); - - if(options.targetDir!=null) { - aptargs.add("-d"); - aptargs.add(options.targetDir.getPath()); - } - - aptargs.addAll(options.arguments); - - String[] argsarray = aptargs.toArray(new String[aptargs.size()]); - return (Integer)mainMethod.invoke(null,new Object[]{argsarray,options.episodeFile}); - } - - /** - * Computes the file system path of jaxb-api.jar so that - * APT will see them in the -cp option. - * - *

- * In Java, you can't do this reliably (for that matter there's no guarantee - * that such a jar file exists, such as in Glassfish), so we do the best we can. - * - * @return - * null if failed to locate it. - */ - private static File findJaxbApiJar() { - String url = Which.which(JAXBContext.class); - if(url==null) return null; // impossible, but hey, let's be defensive - - if(!url.startsWith("jar:") || url.lastIndexOf('!')==-1) - // no jar file - return null; - - String jarFileUrl = url.substring(4,url.lastIndexOf('!')); - if(!jarFileUrl.startsWith("file:")) - return null; // not from file system - - try { - File f = new File(new URL(jarFileUrl).getFile()); - if(f.exists() && f.getName().endsWith(".jar")) - return f; - else - return null; - } catch (MalformedURLException e) { - return null; // impossible - } - } - - /** - * Returns true if the list of arguments have an argument - * that looks like a class name. - */ - private static boolean hasClass(List args) { - for (String arg : args) { - if(!arg.endsWith(".java")) - return true; - } - return false; - } - - private static void usage( ) { - System.out.println(Messages.USAGE.format()); - } - - public static final class Runner { - public static int main(String[] args, File episode) throws Exception { - ClassLoader cl = Runner.class.getClassLoader(); - Class apt = cl.loadClass("com.sun.tools.apt.Main"); - Method processMethod = apt.getMethod("process",AnnotationProcessorFactory.class, String[].class); - - com.sun.tools.internal.jxc.apt.SchemaGenerator r = new com.sun.tools.internal.jxc.apt.SchemaGenerator(); - if(episode!=null) - r.setEpisodeFile(episode); - return (Integer) processMethod.invoke(null, r, args); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/SchemaGeneratorFacade.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/SchemaGeneratorFacade.java deleted file mode 100644 index 05b997beaec..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/SchemaGeneratorFacade.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * CLI entry point to schemagen that checks for JDK 5.0 - * @author Kohsuke Kawaguchi - */ -public class SchemaGeneratorFacade { - - public static void main(String[] args) throws Throwable { - try { - ClassLoader cl = SchemaGeneratorFacade.class.getClassLoader(); - if(cl==null) cl = ClassLoader.getSystemClassLoader(); - - Class driver = cl.loadClass("com.sun.tools.internal.jxc.SchemaGenerator"); - Method mainMethod = driver.getDeclaredMethod("main", new Class[]{String[].class}); - try { - mainMethod.invoke(null,new Object[]{args}); - } catch (IllegalAccessException e) { - throw e; - } catch (InvocationTargetException e) { - if(e.getTargetException()!=null) - throw e.getTargetException(); - } - } catch (UnsupportedClassVersionError e) { - System.err.println("schemagen requires JDK 5.0 or later. Please download it from http://java.sun.com/j2se/1.5/"); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/AnnotationParser.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/AnnotationParser.java deleted file mode 100644 index d1c352923ee..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/AnnotationParser.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.namespace.QName; - -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; -import com.sun.tools.internal.jxc.ConfigReader; -import com.sun.tools.internal.xjc.ErrorReceiver; -import com.sun.tools.internal.xjc.api.J2SJAXBModel; -import com.sun.tools.internal.xjc.api.Reference; -import com.sun.tools.internal.xjc.api.XJC; - -import org.xml.sax.SAXException; - - - -/** - * This class behaves as a JAXB Annotation Processor, - * It reads the user specified typeDeclarations - * and the config files - * It also reads config files - * - * @author Bhakti Mehta (bhakti.mehta@sun.com) - */ -final class AnnotationParser implements AnnotationProcessor { - - /** - * This is the environment available to the annotationProcessor - */ - private final AnnotationProcessorEnvironment env; - - private ErrorReceiver errorListener; - - public AnnotationProcessorEnvironment getEnv() { - return env; - } - - - AnnotationParser(Set atds, AnnotationProcessorEnvironment env) { - this.env = env; - errorListener = new ErrorReceiverImpl(env.getMessager(),env.getOptions().containsKey(Const.DEBUG_OPTION)); - } - - public void process() { - for( Map.Entry me : env.getOptions().entrySet() ) { - String key = me.getKey(); - if (key.startsWith(Const.CONFIG_FILE_OPTION+'=')) { - // somehow the values are passed as a part of the key in APT. - // this is ugly - String value = key.substring(Const.CONFIG_FILE_OPTION.length()+1); - - // For multiple config files we are following the format - // -Aconfig=foo.config:bar.config where : is the pathSeparatorChar - StringTokenizer st = new StringTokenizer(value,File.pathSeparator); - if(!st.hasMoreTokens()) { - errorListener.error(null,Messages.OPERAND_MISSING.format(Const.CONFIG_FILE_OPTION)); - continue; - } - - while (st.hasMoreTokens()) { - File configFile = new File(st.nextToken()); - if(!configFile.exists()) { - errorListener.error(null,Messages.NON_EXISTENT_FILE.format()); - continue; - } - - try { - ConfigReader configReader = new ConfigReader(env,env.getTypeDeclarations(),configFile,errorListener); - - Collection classesToBeIncluded = configReader.getClassesToBeIncluded(); - J2SJAXBModel model = XJC.createJavaCompiler().bind( - classesToBeIncluded,Collections.emptyMap(),null,env); - - SchemaOutputResolver schemaOutputResolver = configReader.getSchemaOutputResolver(); - - model.generateSchema(schemaOutputResolver,errorListener); - } catch (IOException e) { - errorListener.error(e.getMessage(),e); - } catch (SAXException e) { - // the error should have already been reported - } - } - } - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/AnnotationProcessorFactoryImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/AnnotationProcessorFactoryImpl.java deleted file mode 100644 index eec7c077144..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/AnnotationProcessorFactoryImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Set; - -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; - -/** - * {@link AnnotationProcessorFactory} for JAXB. - * - *

- * This is the entry point for the APT driver. - */ -public class AnnotationProcessorFactoryImpl implements AnnotationProcessorFactory { - public Collection supportedOptions() { - return Arrays.asList(Const.CONFIG_FILE_OPTION); - } - - public Collection supportedAnnotationTypes() { - return Arrays.asList("javax.xml.bind.annotation.*"); - } - - public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { - return new AnnotationParser(atds,env); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Const.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Const.java deleted file mode 100644 index a40b1599ec4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Const.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import java.io.File; - -/** - * Defines constants used in the APT driver. - * - * @author Kohsuke Kawaguchi - */ -public abstract class Const { - private Const() {} - - /** - * Name of the APT command-line option to take user-specified config files. - * - *

- * It can take multiple file names separately by {@link File#pathSeparator}. - */ - public static final String CONFIG_FILE_OPTION = "-Ajaxb.config"; - - public static final String DEBUG_OPTION = "-Ajaxb.debug"; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/ErrorReceiverImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/ErrorReceiverImpl.java deleted file mode 100644 index b3f02da16c4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/ErrorReceiverImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.apt.Messager; -import com.sun.tools.internal.xjc.ErrorReceiver; - -import org.xml.sax.SAXParseException; - -/** - * @author Kohsuke Kawaguchi - */ -final class ErrorReceiverImpl extends ErrorReceiver { - private final Messager messager; - private final boolean debug; - - public ErrorReceiverImpl(Messager messager, boolean debug) { - this.messager = messager; - this.debug = debug; - } - - public ErrorReceiverImpl(Messager messager) { - this(messager,false); - } - - public ErrorReceiverImpl(AnnotationProcessorEnvironment env) { - this(env.getMessager()); - } - - public void error(SAXParseException exception) { - messager.printError(exception.getMessage()); - messager.printError(getLocation(exception)); - printDetail(exception); - } - - public void fatalError(SAXParseException exception) { - messager.printError(exception.getMessage()); - messager.printError(getLocation(exception)); - printDetail(exception); - } - - public void warning(SAXParseException exception) { - messager.printWarning(exception.getMessage()); - messager.printWarning(getLocation(exception)); - printDetail(exception); - } - - public void info(SAXParseException exception) { - printDetail(exception); - } - - private String getLocation(SAXParseException e) { - // TODO: format the location information for printing - return ""; - } - - private void printDetail(SAXParseException e) { - if(debug) { - e.printStackTrace(System.out); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/InlineAnnotationReaderImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/InlineAnnotationReaderImpl.java deleted file mode 100644 index 1b711803a27..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/InlineAnnotationReaderImpl.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import com.sun.mirror.declaration.AnnotationMirror; -import com.sun.mirror.declaration.Declaration; -import com.sun.mirror.declaration.FieldDeclaration; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.declaration.ParameterDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.type.MirroredTypeException; -import com.sun.mirror.type.MirroredTypesException; -import com.sun.mirror.type.TypeMirror; -import com.sun.xml.internal.bind.v2.model.annotation.AbstractInlineAnnotationReaderImpl; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.annotation.LocatableAnnotation; - -/** - * {@link AnnotationReader} implementation that reads annotation inline from APT. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public final class InlineAnnotationReaderImpl extends AbstractInlineAnnotationReaderImpl { - - /** The singleton instance. */ - public static final InlineAnnotationReaderImpl theInstance = new InlineAnnotationReaderImpl(); - - private InlineAnnotationReaderImpl() {} - - public A getClassAnnotation(Class a, TypeDeclaration clazz, Locatable srcPos) { - return LocatableAnnotation.create(clazz.getAnnotation(a),srcPos); - } - - public A getFieldAnnotation(Class a, FieldDeclaration f, Locatable srcPos) { - return LocatableAnnotation.create(f.getAnnotation(a),srcPos); - } - - public boolean hasFieldAnnotation(Class annotationType, FieldDeclaration f) { - return f.getAnnotation(annotationType)!=null; - } - - public boolean hasClassAnnotation(TypeDeclaration clazz, Class annotationType) { - return clazz.getAnnotation(annotationType)!=null; - } - - public Annotation[] getAllFieldAnnotations(FieldDeclaration field, Locatable srcPos) { - return getAllAnnotations(field,srcPos); - } - - public A getMethodAnnotation(Class a, MethodDeclaration method, Locatable srcPos) { - return LocatableAnnotation.create(method.getAnnotation(a),srcPos); - } - - public boolean hasMethodAnnotation(Class a, MethodDeclaration method) { - return method.getAnnotation(a)!=null; - } - - private static final Annotation[] EMPTY_ANNOTATION = new Annotation[0]; - - public Annotation[] getAllMethodAnnotations(MethodDeclaration method, Locatable srcPos) { - return getAllAnnotations(method,srcPos); - } - - /** - * Gets all the annotations on the given declaration. - */ - private Annotation[] getAllAnnotations(Declaration decl, Locatable srcPos) { - List r = new ArrayList(); - - for( AnnotationMirror m : decl.getAnnotationMirrors() ) { - try { - String fullName = m.getAnnotationType().getDeclaration().getQualifiedName(); - Class type = - getClass().getClassLoader().loadClass(fullName).asSubclass(Annotation.class); - Annotation annotation = decl.getAnnotation(type); - if(annotation!=null) - r.add( LocatableAnnotation.create(annotation,srcPos) ); - } catch (ClassNotFoundException e) { - // just continue - } - } - - return r.toArray(EMPTY_ANNOTATION); - } - - public A getMethodParameterAnnotation(Class a, MethodDeclaration m, int paramIndex, Locatable srcPos) { - ParameterDeclaration[] params = m.getParameters().toArray(new ParameterDeclaration[0]); - return LocatableAnnotation.create( - params[paramIndex].getAnnotation(a), srcPos ); - } - - public A getPackageAnnotation(Class a, TypeDeclaration clazz, Locatable srcPos) { - return LocatableAnnotation.create(clazz.getPackage().getAnnotation(a),srcPos); - } - - public TypeMirror getClassValue(Annotation a, String name) { - try { - a.annotationType().getMethod(name).invoke(a); - assert false; - throw new IllegalStateException("should throw a MirroredTypeException"); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - if( e.getCause() instanceof MirroredTypeException ) { - MirroredTypeException me = (MirroredTypeException)e.getCause(); - return me.getTypeMirror(); - } - // impossible - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new NoSuchMethodError(e.getMessage()); - } - } - - public TypeMirror[] getClassArrayValue(Annotation a, String name) { - try { - a.annotationType().getMethod(name).invoke(a); - assert false; - throw new IllegalStateException("should throw a MirroredTypesException"); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - if( e.getCause() instanceof MirroredTypesException ) { - MirroredTypesException me = (MirroredTypesException)e.getCause(); - Collection r = me.getTypeMirrors(); - return r.toArray(new TypeMirror[r.size()]); - } - // impossible - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new NoSuchMethodError(e.getMessage()); - } - } - - protected String fullName(MethodDeclaration m) { - return m.getDeclaringType().getQualifiedName()+'#'+m.getSimpleName(); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/MessageBundle.properties b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/MessageBundle.properties deleted file mode 100644 index c70e9506eeb..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/MessageBundle.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -NON_EXISTENT_FILE = \ - Directory "{0}" doesn't exist. - -UNRECOGNIZED_PARAMETER = \ - Unrecognized option {0} is not valid. - -OPERAND_MISSING = \ - Option "{0}" is missing an operand. diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Messages.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Messages.java deleted file mode 100644 index ed257a6cc4d..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Messages.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources. - * - * @author Kohsuke Kawaguchi - */ -enum Messages { - // Accessor - NON_EXISTENT_FILE, // 1 arg - UNRECOGNIZED_PARAMETER, //1 arg - OPERAND_MISSING, // 1 arg - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getPackage().getName() +".MessageBundle"); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Options.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Options.java deleted file mode 100644 index ea9ad29ec8e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/Options.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.apt; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import com.sun.tools.internal.xjc.BadCommandLineException; - -/** - * This stores the invocation configuration for - * SchemaGenerator - * - * @author Bhakti Mehta - */ -public class Options { - - // honor CLASSPATH environment variable, but it will be overrided by -cp - public String classpath = System.getenv("CLASSPATH"); - - public File targetDir = null; - - public File episodeFile = null; - - public final List arguments = new ArrayList(); - - public void parseArguments(String[] args) throws BadCommandLineException { - for (int i = 0 ; i schemaLocations = new HashMap(); - - private File episodeFile; - - public SchemaGenerator() { - } - - public SchemaGenerator( Map m ) { - schemaLocations.putAll(m); - } - - public void setEpisodeFile(File episodeFile) { - this.episodeFile = episodeFile; - } - - public Collection supportedOptions() { - return Collections.emptyList(); - } - - public Collection supportedAnnotationTypes() { - return Arrays.asList("*"); - } - - public AnnotationProcessor getProcessorFor(Set atds, final AnnotationProcessorEnvironment env) { - return new AnnotationProcessor() { - final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(env); - - public void process() { - List decls = new ArrayList(); - for(TypeDeclaration d : env.getTypeDeclarations()) { - // simply ignore all the interface definitions, - // so that users won't have to manually exclude interfaces, which is silly. - if(d instanceof ClassDeclaration) - decls.add(new Reference(d,env)); - } - - J2SJAXBModel model = XJC.createJavaCompiler().bind(decls,Collections.emptyMap(),null,env); - if(model==null) - return; // error - - try { - model.generateSchema( - new SchemaOutputResolver() { - public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { - File file; - OutputStream out; - if(schemaLocations.containsKey(namespaceUri)) { - file = schemaLocations.get(namespaceUri); - if(file==null) return null; // don't generate - out = new FileOutputStream(file); - } else { - // use the default - file = new File(suggestedFileName); - out = env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE,"",file); - file = file.getAbsoluteFile(); - } - - StreamResult ss = new StreamResult(out); - env.getMessager().printNotice("Writing "+file); - ss.setSystemId(file.toURL().toExternalForm()); - return ss; - } - }, errorListener); - - if(episodeFile!=null) { - env.getMessager().printNotice("Writing "+episodeFile); - model.generateEpisodeFile(new StreamResult(episodeFile)); - } - } catch (IOException e) { - errorListener.error(e.getMessage(),e); - } - } - }; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/package.html b/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/package.html deleted file mode 100644 index c3bb171c271..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/apt/package.html +++ /dev/null @@ -1,30 +0,0 @@ - - -APT related code. - -This package hosts a driver that runs inside APT for java-to-schema processing, -and additional implementations that deal primarily with APT. - diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/AttributesImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/AttributesImpl.java deleted file mode 100644 index 86f8fda6b44..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/AttributesImpl.java +++ /dev/null @@ -1,625 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -// AttributesImpl.java - default implementation of Attributes. -// Written by David Megginson, sax@megginson.com -// NO WARRANTY! This class is in the public domain. - -// $Id: AttributesImpl.java,v 1.4 2002/09/29 02:55:48 okajima Exp $ - -//fixed bug at removeAttribute!! by Daisuke OKAJIMA 2002.4.21 - -package com.sun.tools.internal.jxc.gen.config; - -import org.xml.sax.Attributes; - - -/** - * Default implementation of the Attributes interface. - * - *

- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - *
- * - *

This class provides a default implementation of the SAX2 - * {@link org.xml.sax.Attributes Attributes} interface, with the - * addition of manipulators so that the list can be modified or - * reused.

- * - *

There are two typical uses of this class:

- * - *
    - *
  1. to take a persistent snapshot of an Attributes object - * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or
  2. - *
  3. to construct or modify an Attributes object in a SAX2 driver or filter.
  4. - *
- * - *

This class replaces the now-deprecated SAX1 {@link - * org.xml.sax.helpers.AttributeListImpl AttributeListImpl} - * class; in addition to supporting the updated Attributes - * interface rather than the deprecated {@link org.xml.sax.AttributeList - * AttributeList} interface, it also includes a much more efficient - * implementation using a single array rather than a set of Vectors.

- * - * @since SAX 2.0 - * @author David Megginson, - *
sax@megginson.com - * @version 2.0 - */ -public class AttributesImpl implements Attributes -{ - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Construct a new, empty AttributesImpl object. - */ - public AttributesImpl () - { - length = 0; - data = null; - } - - - /** - * Copy an existing Attributes object. - * - *

This constructor is especially useful inside a - * {@link org.xml.sax.ContentHandler#startElement startElement} event.

- * - * @param atts The existing Attributes object. - */ - public AttributesImpl (Attributes atts) - { - setAttributes(atts); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.Attributes. - //////////////////////////////////////////////////////////////////// - - - /** - * Return the number of attributes in the list. - * - * @return The number of attributes in the list. - * @see org.xml.sax.Attributes#getLength - */ - public int getLength () - { - return length; - } - - - /** - * Return an attribute's Namespace URI. - * - * @param index The attribute's index (zero-based). - * @return The Namespace URI, the empty string if none is - * available, or null if the index is out of range. - * @see org.xml.sax.Attributes#getURI - */ - public String getURI (int index) - { - if (index >= 0 && index < length) { - return data[index*5]; - } else { - return null; - } - } - - - /** - * Return an attribute's local name. - * - * @param index The attribute's index (zero-based). - * @return The attribute's local name, the empty string if - * none is available, or null if the index if out of range. - * @see org.xml.sax.Attributes#getLocalName - */ - public String getLocalName (int index) - { - if (index >= 0 && index < length) { - return data[index*5+1]; - } else { - return null; - } - } - - - /** - * Return an attribute's qualified (prefixed) name. - * - * @param index The attribute's index (zero-based). - * @return The attribute's qualified name, the empty string if - * none is available, or null if the index is out of bounds. - * @see org.xml.sax.Attributes#getQName - */ - public String getQName (int index) - { - if (index >= 0 && index < length) { - return data[index*5+2]; - } else { - return null; - } - } - - - /** - * Return an attribute's type by index. - * - * @param index The attribute's index (zero-based). - * @return The attribute's type, "CDATA" if the type is unknown, or null - * if the index is out of bounds. - * @see org.xml.sax.Attributes#getType(int) - */ - public String getType (int index) - { - if (index >= 0 && index < length) { - return data[index*5+3]; - } else { - return null; - } - } - - - /** - * Return an attribute's value by index. - * - * @param index The attribute's index (zero-based). - * @return The attribute's value or null if the index is out of bounds. - * @see org.xml.sax.Attributes#getValue(int) - */ - public String getValue (int index) - { - if (index >= 0 && index < length) { - return data[index*5+4]; - } else { - return null; - } - } - - - /** - * Look up an attribute's index by Namespace name. - * - *

In many cases, it will be more efficient to look up the name once and - * use the index query methods rather than using the name query methods - * repeatedly.

- * - * @param uri The attribute's Namespace URI, or the empty - * string if none is available. - * @param localName The attribute's local name. - * @return The attribute's index, or -1 if none matches. - * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) - */ - public int getIndex (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return i / 5; - } - } - return -1; - } - - - /** - * Look up an attribute's index by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's index, or -1 if none matches. - * @see org.xml.sax.Attributes#getIndex(java.lang.String) - */ - public int getIndex (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return i / 5; - } - } - return -1; - } - - - /** - * Look up an attribute's type by Namespace-qualified name. - * - * @param uri The Namespace URI, or the empty string for a name - * with no explicit Namespace URI. - * @param localName The local name. - * @return The attribute's type, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) - */ - public String getType (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return data[i+3]; - } - } - return null; - } - - - /** - * Look up an attribute's type by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's type, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getType(java.lang.String) - */ - public String getType (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return data[i+3]; - } - } - return null; - } - - - /** - * Look up an attribute's value by Namespace-qualified name. - * - * @param uri The Namespace URI, or the empty string for a name - * with no explicit Namespace URI. - * @param localName The local name. - * @return The attribute's value, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String) - */ - public String getValue (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return data[i+4]; - } - } - return null; - } - - - /** - * Look up an attribute's value by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's value, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getValue(java.lang.String) - */ - public String getValue (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return data[i+4]; - } - } - return null; - } - - - - //////////////////////////////////////////////////////////////////// - // Manipulators. - //////////////////////////////////////////////////////////////////// - - - /** - * Clear the attribute list for reuse. - * - *

Note that no memory is actually freed by this call: - * the current arrays are kept so that they can be - * reused.

- */ - public void clear () - { - length = 0; - } - - - /** - * Copy an entire Attributes object. - * - *

It may be more efficient to reuse an existing object - * rather than constantly allocating new ones.

- * - * @param atts The attributes to copy. - */ - public void setAttributes (Attributes atts) - { - clear(); - length = atts.getLength(); - data = new String[length*5]; - for (int i = 0; i < length; i++) { - data[i*5] = atts.getURI(i); - data[i*5+1] = atts.getLocalName(i); - data[i*5+2] = atts.getQName(i); - data[i*5+3] = atts.getType(i); - data[i*5+4] = atts.getValue(i); - } - } - - - /** - * Add an attribute to the end of the list. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param uri The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - */ - public void addAttribute (String uri, String localName, String qName, - String type, String value) - { - ensureCapacity(length+1); - data[length*5] = uri; - data[length*5+1] = localName; - data[length*5+2] = qName; - data[length*5+3] = type; - data[length*5+4] = value; - length++; - } - - - /** - * Set an attribute in the list. - * - *

For the sake of speed, this method does no checking - * for name conflicts or well-formedness: such checks are the - * responsibility of the application.

- * - * @param index The index of the attribute (zero-based). - * @param uri The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setAttribute (int index, String uri, String localName, - String qName, String type, String value) - { - if (index >= 0 && index < length) { - data[index*5] = uri; - data[index*5+1] = localName; - data[index*5+2] = qName; - data[index*5+3] = type; - data[index*5+4] = value; - } else { - badIndex(index); - } - } - - - /** - * Remove an attribute from the list. - * - * @param index The index of the attribute (zero-based). - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void removeAttribute (int index) - { - if (index >= 0 && index < length) { - if (index < length - 1) { - System.arraycopy(data, (index+1)*5, data, index*5, - (length-index-1)*5); - } - length--; - } else { - badIndex(index); - } - } - - - /** - * Set the Namespace URI of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param uri The attribute's Namespace URI, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setURI (int index, String uri) - { - if (index >= 0 && index < length) { - data[index*5] = uri; - } else { - badIndex(index); - } - } - - - /** - * Set the local name of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param localName The attribute's local name, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setLocalName (int index, String localName) - { - if (index >= 0 && index < length) { - data[index*5+1] = localName; - } else { - badIndex(index); - } - } - - - /** - * Set the qualified name of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param qName The attribute's qualified name, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setQName (int index, String qName) - { - if (index >= 0 && index < length) { - data[index*5+2] = qName; - } else { - badIndex(index); - } - } - - - /** - * Set the type of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param type The attribute's type. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setType (int index, String type) - { - if (index >= 0 && index < length) { - data[index*5+3] = type; - } else { - badIndex(index); - } - } - - - /** - * Set the value of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param value The attribute's value. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setValue (int index, String value) - { - if (index >= 0 && index < length) { - data[index*5+4] = value; - } else { - badIndex(index); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Ensure the internal array's capacity. - * - * @param n The minimum number of attributes that the array must - * be able to hold. - */ - private void ensureCapacity (int n) - { - if (n > 0 && (data == null || data.length==0)) { - data = new String[25]; - } - - int max = data.length; - if (max >= n * 5) { - return; - } - - - while (max < n * 5) { - max *= 2; - } - String newData[] = new String[max]; - System.arraycopy(data, 0, newData, 0, length*5); - data = newData; - } - - - /** - * Report a bad array index in a manipulator. - * - * @param index The index to report. - * @exception java.lang.ArrayIndexOutOfBoundsException Always. - */ - private void badIndex (int index) - throws ArrayIndexOutOfBoundsException - { - String msg = - "Attempt to modify attribute at illegal index: " + index; - throw new ArrayIndexOutOfBoundsException(msg); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - int length; - String data []; - -} - -// end of AttributesImpl.java diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/Classes.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/Classes.java deleted file mode 100644 index 858fd9ab1b0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/Classes.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -/* this file is generated by RelaxNGCC */ -package com.sun.tools.internal.jxc.gen.config; -import org.xml.sax.SAXException; -import org.xml.sax.Attributes; -import com.sun.tools.internal.jxc.NGCCRuntimeEx; - -import java.util.List; - import java.util.ArrayList; - - -public class Classes extends NGCCHandler { - private String __text; - private String exclude_content; - private String include_content; - protected final NGCCRuntimeEx $runtime; - private int $_ngcc_current_state; - protected String $uri; - protected String $localName; - protected String $qname; - - public final NGCCRuntime getRuntime() { - return($runtime); - } - - public Classes(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) { - super(source, parent, cookie); - $runtime = runtime; - $_ngcc_current_state = 12; - } - - public Classes(NGCCRuntimeEx runtime) { - this(null, runtime, runtime, -1); - } - - private void action0()throws SAXException { - this.excludes.add(exclude_content); -} - - private void action1()throws SAXException { - $runtime.processList(__text);} - - private void action2()throws SAXException { - this.includes.add(include_content); -} - - private void action3()throws SAXException { - $runtime.processList(__text);} - - public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs); - } - break; - case 12: - { - if(($__uri == "" && $__local == "classes")) { - $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); - $_ngcc_current_state = 11; - } - else { - unexpectedEnterElement($__qname); - } - } - break; - case 4: - { - $_ngcc_current_state = 3; - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - break; - case 11: - { - if(($__uri == "" && $__local == "includes")) { - $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); - $_ngcc_current_state = 10; - } - else { - unexpectedEnterElement($__qname); - } - } - break; - case 2: - { - if(($__uri == "" && $__local == "excludes")) { - $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); - $_ngcc_current_state = 6; - } - else { - $_ngcc_current_state = 1; - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - } - break; - default: - { - unexpectedEnterElement($__qname); - } - break; - } - } - - public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 4: - { - $_ngcc_current_state = 3; - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - break; - case 3: - { - if(($__uri == "" && $__local == "excludes")) { - $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); - $_ngcc_current_state = 1; - } - else { - unexpectedLeaveElement($__qname); - } - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - break; - case 8: - { - if(($__uri == "" && $__local == "includes")) { - $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); - $_ngcc_current_state = 2; - } - else { - unexpectedLeaveElement($__qname); - } - } - break; - case 1: - { - if(($__uri == "" && $__local == "classes")) { - $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); - $_ngcc_current_state = 0; - } - else { - unexpectedLeaveElement($__qname); - } - } - break; - default: - { - unexpectedLeaveElement($__qname); - } - break; - } - } - - public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 4: - { - $_ngcc_current_state = 3; - $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - default: - { - unexpectedEnterAttribute($__qname); - } - break; - } - } - - public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 4: - { - $_ngcc_current_state = 3; - $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - default: - { - unexpectedLeaveAttribute($__qname); - } - break; - } - } - - public void text(String $value) throws SAXException { - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromText(this, super._cookie, $value); - } - break; - case 9: - { - include_content = $value; - $_ngcc_current_state = 8; - action2(); - } - break; - case 4: - { - exclude_content = $value; - $_ngcc_current_state = 3; - action0(); - } - break; - case 3: - { - exclude_content = $value; - $_ngcc_current_state = 3; - action0(); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendText(super._cookie, $value); - } - break; - case 10: - { - __text = $value; - $_ngcc_current_state = 9; - action3(); - } - break; - case 8: - { - include_content = $value; - $_ngcc_current_state = 8; - action2(); - } - break; - case 6: - { - __text = $value; - $_ngcc_current_state = 4; - action1(); - } - break; - } - } - - public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { - switch($__cookie__) { - } - } - - public boolean accepted() { - return(($_ngcc_current_state == 0)); - } - - - private List includes = new ArrayList(); - public List getIncludes() { return $runtime.getIncludePatterns(this.includes);} - private List excludes = new ArrayList(); - public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);} - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/Config.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/Config.java deleted file mode 100644 index c0e1539c5ec..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/Config.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -/* this file is generated by RelaxNGCC */ -package com.sun.tools.internal.jxc.gen.config; -import org.xml.sax.SAXException; -import org.xml.sax.Attributes; -import com.sun.tools.internal.jxc.NGCCRuntimeEx; - -import java.util.List; - import java.util.ArrayList; - import java.io.File; - - -public class Config extends NGCCHandler { - private String bd; - private Schema _schema; - protected final NGCCRuntimeEx $runtime; - private int $_ngcc_current_state; - protected String $uri; - protected String $localName; - protected String $qname; - - public final NGCCRuntime getRuntime() { - return($runtime); - } - - public Config(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) { - super(source, parent, cookie); - $runtime = runtime; - $_ngcc_current_state = 8; - } - - public Config(NGCCRuntimeEx runtime) { - this(null, runtime, runtime, -1); - } - - private void action0()throws SAXException { - this.schema.add (_schema); -} - - private void action1()throws SAXException { - baseDir = $runtime.getBaseDir(bd); -} - - public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { - int $ai; - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 4: - { - if(($__uri == "" && $__local == "classes")) { - NGCCHandler h = new Classes(this, super._source, $runtime, 34); - spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); - } - else { - unexpectedEnterElement($__qname); - } - } - break; - case 8: - { - if(($__uri == "" && $__local == "config")) { - $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); - $_ngcc_current_state = 7; - } - else { - unexpectedEnterElement($__qname); - } - } - break; - case 1: - { - if(($__uri == "" && $__local == "schema")) { - NGCCHandler h = new Schema(this, super._source, $runtime, 31, baseDir); - spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); - } - else { - unexpectedEnterElement($__qname); - } - } - break; - case 0: - { - revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs); - } - break; - case 2: - { - if(($__uri == "" && $__local == "schema")) { - NGCCHandler h = new Schema(this, super._source, $runtime, 32, baseDir); - spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); - } - else { - $_ngcc_current_state = 1; - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - } - break; - case 7: - { - if(($ai = $runtime.getAttributeIndex("","baseDir"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - else { - unexpectedEnterElement($__qname); - } - } - break; - default: - { - unexpectedEnterElement($__qname); - } - break; - } - } - - public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { - int $ai; - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 1: - { - if(($__uri == "" && $__local == "config")) { - $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); - $_ngcc_current_state = 0; - } - else { - unexpectedLeaveElement($__qname); - } - } - break; - case 0: - { - revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - break; - case 7: - { - if(($ai = $runtime.getAttributeIndex("","baseDir"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - else { - unexpectedLeaveElement($__qname); - } - } - break; - default: - { - unexpectedLeaveElement($__qname); - } - break; - } - } - - public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - case 7: - { - if(($__uri == "" && $__local == "baseDir")) { - $_ngcc_current_state = 6; - } - else { - unexpectedEnterAttribute($__qname); - } - } - break; - default: - { - unexpectedEnterAttribute($__qname); - } - break; - } - } - - public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - case 5: - { - if(($__uri == "" && $__local == "baseDir")) { - $_ngcc_current_state = 4; - } - else { - unexpectedLeaveAttribute($__qname); - } - } - break; - default: - { - unexpectedLeaveAttribute($__qname); - } - break; - } - } - - public void text(String $value) throws SAXException { - int $ai; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromText(this, super._cookie, $value); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendText(super._cookie, $value); - } - break; - case 7: - { - if(($ai = $runtime.getAttributeIndex("","baseDir"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendText(super._cookie, $value); - } - } - break; - case 6: - { - bd = $value; - $_ngcc_current_state = 5; - action1(); - } - break; - } - } - - public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { - switch($__cookie__) { - case 34: - { - classes = ((Classes)$__result__); - $_ngcc_current_state = 2; - } - break; - case 31: - { - _schema = ((Schema)$__result__); - action0(); - $_ngcc_current_state = 1; - } - break; - case 32: - { - _schema = ((Schema)$__result__); - action0(); - $_ngcc_current_state = 1; - } - break; - } - } - - public boolean accepted() { - return(($_ngcc_current_state == 0)); - } - - - private File baseDir; - private Classes classes; - private List schema = new ArrayList(); - public Classes getClasses() { return this.classes;} - public File getBaseDir() { return baseDir;} - public List getSchema() { return this.schema;} - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCEventReceiver.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCEventReceiver.java deleted file mode 100644 index 3c6624a93cc..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCEventReceiver.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.jxc.gen.config; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface NGCCEventReceiver { - void enterElement(String uri, String localName, String qname,Attributes atts) throws SAXException; - void leaveElement(String uri, String localName, String qname) throws SAXException; - void text(String value) throws SAXException; - void enterAttribute(String uri, String localName, String qname) throws SAXException; - void leaveAttribute(String uri, String localName, String qname) throws SAXException; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCEventSource.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCEventSource.java deleted file mode 100644 index 6ef8d69e971..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCEventSource.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.jxc.gen.config; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface NGCCEventSource { - /** - * Replaces an old handler with a new handler, and returns - * ID of the EventReceiver thread. - */ - int replace( NGCCEventReceiver _old, NGCCEventReceiver _new ); - - /** Sends an enter element event to the specified EventReceiver thread. */ - void sendEnterElement( int receiverThreadId, String uri, String local, String qname, Attributes atts ) throws SAXException; - - void sendLeaveElement( int receiverThreadId, String uri, String local, String qname ) throws SAXException; - void sendEnterAttribute( int receiverThreadId, String uri, String local, String qname ) throws SAXException; - void sendLeaveAttribute( int receiverThreadId, String uri, String local, String qname ) throws SAXException; - void sendText( int receiverThreadId, String value ) throws SAXException; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCHandler.java deleted file mode 100644 index 279d5651868..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCHandler.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.jxc.gen.config; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * - * - * @version $Id: NGCCHandler.java,v 1.9 2002/09/29 02:55:48 okajima Exp $ - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public abstract class NGCCHandler implements NGCCEventReceiver { - protected NGCCHandler( NGCCEventSource source, NGCCHandler parent, int parentCookie ) { - - _parent = parent; - _source = source; - _cookie = parentCookie; - } - - /** - * Parent NGCCHandler, if any. - * If this is the root handler, this field will be null. - */ - protected final NGCCHandler _parent; - - /** - * Event source. - */ - protected final NGCCEventSource _source; - - /** - * This method will be implemented by the generated code - * and returns a reference to the current runtime. - */ - protected abstract NGCCRuntime getRuntime(); - - /** - * Cookie assigned by the parent. - * - * This value will be passed to the onChildCompleted handler - * of the parent. - */ - protected final int _cookie; - - // used to copy parameters to (enter|leave)(Element|Attribute) events. - //protected String localName,uri,qname; - - - /** - * Notifies the completion of a child object. - * - * @param result - * The parsing result of the child state. - * @param cookie - * The cookie value passed to the child object - * when it is created. - * @param needAttCheck - * This flag is true when the callee needs to call the - * processAttribute method to check attribute transitions. - * This flag is set to false when this method is triggered by - * attribute transition. - */ - protected abstract void onChildCompleted( Object result, int cookie, boolean needAttCheck ) throws SAXException; - -// -// -// spawns a new child object from event handlers. -// -// - public void spawnChildFromEnterElement( NGCCEventReceiver child, - String uri, String localname, String qname, Attributes atts) throws SAXException { - - int id = _source.replace(this,child); - _source.sendEnterElement(id,uri,localname,qname,atts); - } - public void spawnChildFromEnterAttribute( NGCCEventReceiver child, - String uri, String localname, String qname) throws SAXException { - - int id = _source.replace(this,child); - _source.sendEnterAttribute(id,uri,localname,qname); - } - public void spawnChildFromLeaveElement( NGCCEventReceiver child, - String uri, String localname, String qname) throws SAXException { - - int id = _source.replace(this,child); - _source.sendLeaveElement(id,uri,localname,qname); - } - public void spawnChildFromLeaveAttribute( NGCCEventReceiver child, - String uri, String localname, String qname) throws SAXException { - - int id = _source.replace(this,child); - _source.sendLeaveAttribute(id,uri,localname,qname); - } - public void spawnChildFromText( NGCCEventReceiver child, - String value) throws SAXException { - - int id = _source.replace(this,child); - _source.sendText(id,value); - } - -// -// -// reverts to the parent object from the child handler -// -// - public void revertToParentFromEnterElement( Object result, int cookie, - String uri,String local,String qname, Attributes atts ) throws SAXException { - - int id = _source.replace(this,_parent); - _parent.onChildCompleted(result,cookie,true); - _source.sendEnterElement(id,uri,local,qname,atts); - } - public void revertToParentFromLeaveElement( Object result, int cookie, - String uri,String local,String qname ) throws SAXException { - - if(uri==NGCCRuntime.IMPOSSIBLE && uri==local && uri==qname && _parent==null ) - // all the handlers are properly finalized. - // quit now, because we don't have any more NGCCHandler. - // see the endDocument handler for detail - return; - - int id = _source.replace(this,_parent); - _parent.onChildCompleted(result,cookie,true); - _source.sendLeaveElement(id,uri,local,qname); - } - public void revertToParentFromEnterAttribute( Object result, int cookie, - String uri,String local,String qname ) throws SAXException { - - int id = _source.replace(this,_parent); - _parent.onChildCompleted(result,cookie,true); - _source.sendEnterAttribute(id,uri,local,qname); - } - public void revertToParentFromLeaveAttribute( Object result, int cookie, - String uri,String local,String qname ) throws SAXException { - - int id = _source.replace(this,_parent); - _parent.onChildCompleted(result,cookie,true); - _source.sendLeaveAttribute(id,uri,local,qname); - } - public void revertToParentFromText( Object result, int cookie, - String text ) throws SAXException { - - int id = _source.replace(this,_parent); - _parent.onChildCompleted(result,cookie,true); - _source.sendText(id,text); - } - - -// -// -// error handler -// -// - public void unexpectedEnterElement(String qname) throws SAXException { - getRuntime().unexpectedX('<'+qname+'>'); - } - public void unexpectedLeaveElement(String qname) throws SAXException { - getRuntime().unexpectedX("'); - } - public void unexpectedEnterAttribute(String qname) throws SAXException { - getRuntime().unexpectedX('@'+qname); - } - public void unexpectedLeaveAttribute(String qname) throws SAXException { - getRuntime().unexpectedX("/@"+qname); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCInterleaveFilter.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCInterleaveFilter.java deleted file mode 100644 index 2bd6dc42be5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCInterleaveFilter.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.jxc.gen.config; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Dispatches incoming events into sub handlers appropriately - * so that the interleaving semantics will be correctly realized. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public abstract class NGCCInterleaveFilter implements NGCCEventSource, NGCCEventReceiver { - protected NGCCInterleaveFilter( NGCCHandler parent, int cookie ) { - this._parent = parent; - this._cookie = cookie; - } - - protected void setHandlers( NGCCEventReceiver[] receivers ) { - this._receivers = receivers; - } - - /** event receiverse. */ - protected NGCCEventReceiver[] _receivers; - - public int replace(NGCCEventReceiver oldHandler, NGCCEventReceiver newHandler) { - for( int i=0; i<_receivers.length; i++ ) - if( _receivers[i]==oldHandler ) { - _receivers[i]=newHandler; - return i; - } - throw new InternalError(); // a bug in RelaxNGCC. - } - - - /** Parent handler. */ - private final NGCCHandler _parent; - /** Cookie given by the parent. */ - private final int _cookie; - - - -// -// -// event handler -// -// - /** - * Receiver that is being locked and therefore receives all the events. - *

-     * <interleave>
-     *   <element name="foo"/>
-     *   <element name="bar">
-     *     <element name="foo"/>
-     *   </element>
-     * </interlaeve>
-     * 
- * When processing inside the bar element, this receiver is - * "locked" so that it can correctly receive its child foo element. - */ - private int lockedReceiver; - /** - * Nest level. Lock will be release when the lockCount becomes 0. - */ - private int lockCount=0; - - public void enterElement( - String uri, String localName, String qname,Attributes atts) throws SAXException { - - if(isJoining) return; // ignore any token if we are joining. See joinByXXXX. - - if(lockCount++==0) { - lockedReceiver = findReceiverOfElement(uri,localName); - if(lockedReceiver==-1) { - // we can't process this token. join. - joinByEnterElement(null,uri,localName,qname,atts); - return; - } - } - - _receivers[lockedReceiver].enterElement(uri,localName,qname,atts); - } - public void leaveElement(String uri, String localName, String qname) throws SAXException { - if(isJoining) return; // ignore any token if we are joining. See joinByXXXX. - - if( lockCount-- == 0 ) - joinByLeaveElement(null,uri,localName,qname); - else - _receivers[lockedReceiver].leaveElement(uri,localName,qname); - } - public void enterAttribute(String uri, String localName, String qname) throws SAXException { - if(isJoining) return; // ignore any token if we are joining. See joinByXXXX. - - if(lockCount++==0) { - lockedReceiver = findReceiverOfAttribute(uri,localName); - if(lockedReceiver==-1) { - // we can't process this token. join. - joinByEnterAttribute(null,uri,localName,qname); - return; - } - } - - _receivers[lockedReceiver].enterAttribute(uri,localName,qname); - } - public void leaveAttribute(String uri, String localName, String qname) throws SAXException { - if(isJoining) return; // ignore any token if we are joining. See joinByXXXX. - - if( lockCount-- == 0 ) - joinByLeaveAttribute(null,uri,localName,qname); - else - _receivers[lockedReceiver].leaveAttribute(uri,localName,qname); - } - public void text(String value) throws SAXException { - if(isJoining) return; // ignore any token if we are joining. See joinByXXXX. - - if(lockCount!=0) - _receivers[lockedReceiver].text(value); - else { - int receiver = findReceiverOfText(); - if(receiver!=-1) _receivers[receiver].text(value); - else joinByText(null,value); - } - } - - - - /** - * Implemented by the generated code to determine the handler - * that can receive the given element. - * - * @return - * Thread ID of the receiver that can handle this event, - * or -1 if none. - */ - protected abstract int findReceiverOfElement( String uri, String local ); - - /** - * Returns the handler that can receive the given attribute, or null. - */ - protected abstract int findReceiverOfAttribute( String uri, String local ); - - /** - * Returns the handler that can receive text events, or null. - */ - protected abstract int findReceiverOfText(); - - - - -// -// -// join method -// -// - - - /** - * Set to true when this handler is in the process of - * joining all branches. - */ - private boolean isJoining = false; - - /** - * Joins all the child receivers. - * - *

- * This method is called by a child receiver when it sees - * something that it cannot handle, or by this object itself - * when it sees an event that it can't process. - * - *

- * This method forces children to move to its final state, - * then revert to the parent. - * - * @param source - * If this method is called by one of the child receivers, - * the receiver object. If this method is called by itself, - * null. - */ - public void joinByEnterElement( NGCCEventReceiver source, - String uri, String local, String qname, Attributes atts ) throws SAXException { - - if(isJoining) return; // we are already in the process of joining. ignore. - isJoining = true; - - // send special token to the rest of the branches. - // these branches don't understand this token, so they will - // try to move to a final state and send the token back to us, - // which this object will ignore (because isJoining==true) - // Otherwise branches will find an error. - for( int i=0; i<_receivers.length; i++ ) - if( _receivers[i]!=source ) - _receivers[i].enterElement(uri,local,qname,atts); - - // revert to the parent - _parent._source.replace(this,_parent); - _parent.onChildCompleted(null,_cookie,true); - // send this event to the parent - _parent.enterElement(uri,local,qname,atts); - } - - public void joinByLeaveElement( NGCCEventReceiver source, - String uri, String local, String qname ) throws SAXException { - - if(isJoining) return; // we are already in the process of joining. ignore. - isJoining = true; - - // send special token to the rest of the branches. - // these branches don't understand this token, so they will - // try to move to a final state and send the token back to us, - // which this object will ignore (because isJoining==true) - // Otherwise branches will find an error. - for( int i=0; i<_receivers.length; i++ ) - if( _receivers[i]!=source ) - _receivers[i].leaveElement(uri,local,qname); - - // revert to the parent - _parent._source.replace(this,_parent); - _parent.onChildCompleted(null,_cookie,true); - // send this event to the parent - _parent.leaveElement(uri,local,qname); - } - - public void joinByEnterAttribute( NGCCEventReceiver source, - String uri, String local, String qname ) throws SAXException { - - if(isJoining) return; // we are already in the process of joining. ignore. - isJoining = true; - - // send special token to the rest of the branches. - // these branches don't understand this token, so they will - // try to move to a final state and send the token back to us, - // which this object will ignore (because isJoining==true) - // Otherwise branches will find an error. - for( int i=0; i<_receivers.length; i++ ) - if( _receivers[i]!=source ) - _receivers[i].enterAttribute(uri,local,qname); - - // revert to the parent - _parent._source.replace(this,_parent); - _parent.onChildCompleted(null,_cookie,true); - // send this event to the parent - _parent.enterAttribute(uri,local,qname); - } - - public void joinByLeaveAttribute( NGCCEventReceiver source, - String uri, String local, String qname ) throws SAXException { - - if(isJoining) return; // we are already in the process of joining. ignore. - isJoining = true; - - // send special token to the rest of the branches. - // these branches don't understand this token, so they will - // try to move to a final state and send the token back to us, - // which this object will ignore (because isJoining==true) - // Otherwise branches will find an error. - for( int i=0; i<_receivers.length; i++ ) - if( _receivers[i]!=source ) - _receivers[i].leaveAttribute(uri,local,qname); - - // revert to the parent - _parent._source.replace(this,_parent); - _parent.onChildCompleted(null,_cookie,true); - // send this event to the parent - _parent.leaveAttribute(uri,local,qname); - } - - public void joinByText( NGCCEventReceiver source, - String value ) throws SAXException { - - if(isJoining) return; // we are already in the process of joining. ignore. - isJoining = true; - - // send special token to the rest of the branches. - // these branches don't understand this token, so they will - // try to move to a final state and send the token back to us, - // which this object will ignore (because isJoining==true) - // Otherwise branches will find an error. - for( int i=0; i<_receivers.length; i++ ) - if( _receivers[i]!=source ) - _receivers[i].text(value); - - // revert to the parent - _parent._source.replace(this,_parent); - _parent.onChildCompleted(null,_cookie,true); - // send this event to the parent - _parent.text(value); - } - - - -// -// -// event dispatching methods -// -// - - public void sendEnterAttribute( int threadId, - String uri, String local, String qname) throws SAXException { - - _receivers[threadId].enterAttribute(uri,local,qname); - } - - public void sendEnterElement( int threadId, - String uri, String local, String qname, Attributes atts) throws SAXException { - - _receivers[threadId].enterElement(uri,local,qname,atts); - } - - public void sendLeaveAttribute( int threadId, - String uri, String local, String qname) throws SAXException { - - _receivers[threadId].leaveAttribute(uri,local,qname); - } - - public void sendLeaveElement( int threadId, - String uri, String local, String qname) throws SAXException { - - _receivers[threadId].leaveElement(uri,local,qname); - } - - public void sendText(int threadId, String value) throws SAXException { - _receivers[threadId].text(value); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCRuntime.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCRuntime.java deleted file mode 100644 index 581fef308b1..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/NGCCRuntime.java +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.jxc.gen.config; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Stack; -import java.util.StringTokenizer; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -/** - * Runtime Engine for RELAXNGCC execution. - * - * This class has the following functionalities: - * - *

    - *
  1. Managing a stack of NGCCHandler objects and - * switching between them appropriately. - * - *
  2. Keep track of all Attributes. - * - *
  3. manage mapping between namespace URIs and prefixes. - * - *
  4. TODO: provide support for interleaving. - * - * @version $Id: NGCCRuntime.java,v 1.16 2003/03/23 02:47:46 okajima Exp $ - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public class NGCCRuntime implements ContentHandler, NGCCEventSource { - - public NGCCRuntime() { - reset(); - } - - /** - * Sets the root handler, which will be used to parse the - * root element. - *

    - * This method can be called right after the object is created - * or the reset method is called. You can't replace the root - * handler while parsing is in progress. - *

    - * Usually a generated class that corresponds to the <start> - * pattern will be used as the root handler, but any NGCCHandler - * can be a root handler. - * - * @exception IllegalStateException - * If this method is called but it doesn't satisfy the - * pre-condition stated above. - */ - public void setRootHandler( NGCCHandler rootHandler ) { - if(currentHandler!=null) - throw new IllegalStateException(); - currentHandler = rootHandler; - } - - - /** - * Cleans up all the data structure so that the object can be reused later. - * Normally, applications do not need to call this method directly, - * - * as the runtime resets itself after the endDocument method. - */ - public void reset() { - attStack.clear(); - currentAtts = null; - currentHandler = null; - indent=0; - locator = null; - namespaces.clear(); - needIndent = true; - redirect = null; - redirectionDepth = 0; - text = new StringBuffer(); - - // add a dummy attributes at the bottom as a "centinel." - attStack.push(new AttributesImpl()); - } - - // current content handler can be acccessed via set/getContentHandler. - - private Locator locator; - public void setDocumentLocator( Locator _loc ) { this.locator=_loc; } - /** - * Gets the source location of the current event. - * - *

    - * One can call this method from RelaxNGCC handlers to access - * the line number information. Note that to - */ - public Locator getLocator() { return locator; } - - - /** stack of {@link Attributes}. */ - private final Stack attStack = new Stack(); - /** current attributes set. always equal to attStack.peek() */ - private AttributesImpl currentAtts; - - /** - * Attributes that belong to the current element. - *

    - * It's generally not recommended for applications to use - * this method. RelaxNGCC internally removes processed attributes, - * so this doesn't correctly reflect all the attributes an element - * carries. - */ - public Attributes getCurrentAttributes() { - return currentAtts; - } - - /** accumulated text. */ - private StringBuffer text = new StringBuffer(); - - - - - /** The current NGCCHandler. Always equals to handlerStack.peek() */ - private NGCCEventReceiver currentHandler; - - public int replace( NGCCEventReceiver o, NGCCEventReceiver n ) { - if(o!=currentHandler) - throw new IllegalStateException(); // bug of RelaxNGCC - currentHandler = n; - - return 0; // we only have one thread. - } - - /** - * Processes buffered text. - * - * This method will be called by the start/endElement event to process - * buffered text as a text event. - * - *

    - * Whitespace handling is a tricky business. Consider the following - * schema fragment: - * - *

    - * <element name="foo"> - * <choice> - * <element name="bar"><empty/></element> - * <text/> - * </choice> - * </element> - * - * - * Assume we hit the following instance: - * - * <foo> <bar/></foo> - * - * - * Then this first space needs to be ignored (for otherwise, we will - * end up treating this space as the match to <text/> and won't - * be able to process <bar>.) - * - * Now assume the following instance: - * - * <foo/> - * - * - * This time, we need to treat this empty string as a text, for - * otherwise we won't be able to accept this instance. - * - *

    - * This is very difficult to solve in general, but one seemingly - * easy solution is to use the type of next event. If a text is - * followed by a start tag, it follows from the constraint on - * RELAX NG that that text must be either whitespaces or a match - * to <text/>. - * - *

    - * On the contrary, if a text is followed by a end tag, then it - * cannot be whitespace unless the content model can accept empty, - * in which case sending a text event will be harmlessly ignored - * by the NGCCHandler. - * - *

    - * Thus this method take one parameter, which controls the - * behavior of this method. - * - *

    - * TODO: according to the constraint of RELAX NG, if characters - * follow an end tag, then they must be either whitespaces or - * must match to <text/>. - * - * @param possiblyWhitespace - * True if the buffered character can be ignorabale. False if - * it needs to be consumed. - */ - private void processPendingText(boolean ignorable) throws SAXException { - if(ignorable && text.toString().trim().length()==0) - ; // ignore. See the above javadoc comment for the description - else - currentHandler.text(text.toString()); // otherwise consume this token - - // truncate StringBuffer, but avoid excessive allocation. - if(text.length()>1024) text = new StringBuffer(); - else text.setLength(0); - } - - public void processList( String str ) throws SAXException { - StringTokenizer t = new StringTokenizer(str, " \t\r\n"); - while(t.hasMoreTokens()) - currentHandler.text(t.nextToken()); - } - - public void startElement(String uri, String localname, String qname, Attributes atts) - throws SAXException { - - uri = uri.intern(); - localname = localname.intern(); - qname = qname.intern(); - - if(redirect!=null) { - redirect.startElement(uri,localname,qname,atts); - redirectionDepth++; - } else { - processPendingText(true); - // System.out.println("startElement:"+localname+"->"+_attrStack.size()); - currentHandler.enterElement(uri, localname, qname, atts); - } - } - - /** - * Called by the generated handler code when an enter element - * event is consumed. - * - *

    - * Pushes a new attribute set. - * - *

    - * Note that attributes are NOT pushed at the startElement method, - * because the processing of the enterElement event can trigger - * other attribute events and etc. - *

    - * This method will be called from one of handlers when it truely - * consumes the enterElement event. - */ - public void onEnterElementConsumed( - String uri, String localName, String qname,Attributes atts) throws SAXException { - attStack.push(currentAtts=new AttributesImpl(atts)); - nsEffectiveStack.push( new Integer(nsEffectivePtr) ); - nsEffectivePtr = namespaces.size(); - } - - public void onLeaveElementConsumed(String uri, String localName, String qname) throws SAXException { - attStack.pop(); - if(attStack.isEmpty()) - currentAtts = null; - else - currentAtts = (AttributesImpl)attStack.peek(); - nsEffectivePtr = ((Integer)nsEffectiveStack.pop()).intValue(); - } - - public void endElement(String uri, String localname, String qname) - throws SAXException { - - uri = uri.intern(); - localname = localname.intern(); - qname = qname.intern(); - - if(redirect!=null) { - redirect.endElement(uri,localname,qname); - redirectionDepth--; - - if(redirectionDepth!=0) - return; - - // finished redirection. - for( int i=0; i - // - // - // - // - // With this grammar, when the endElement event is consumed, two handlers - // are on the stack (because a child object won't revert to its parent - // unless it sees a next event.) - - // pass around an "impossible" token. - currentHandler.leaveElement(IMPOSSIBLE,IMPOSSIBLE,IMPOSSIBLE); - - reset(); - } - public void startDocument() throws SAXException {} - - - - -// -// -// event dispatching methods -// -// - - public void sendEnterAttribute( int threadId, - String uri, String local, String qname) throws SAXException { - - currentHandler.enterAttribute(uri,local,qname); - } - - public void sendEnterElement( int threadId, - String uri, String local, String qname, Attributes atts) throws SAXException { - - currentHandler.enterElement(uri,local,qname,atts); - } - - public void sendLeaveAttribute( int threadId, - String uri, String local, String qname) throws SAXException { - - currentHandler.leaveAttribute(uri,local,qname); - } - - public void sendLeaveElement( int threadId, - String uri, String local, String qname) throws SAXException { - - currentHandler.leaveElement(uri,local,qname); - } - - public void sendText(int threadId, String value) throws SAXException { - currentHandler.text(value); - } - - -// -// -// redirection of SAX2 events. -// -// - /** When redirecting a sub-tree, this value will be non-null. */ - private ContentHandler redirect = null; - - /** - * Counts the depth of the elements when we are re-directing - * a sub-tree to another ContentHandler. - */ - private int redirectionDepth = 0; - - /** - * This method can be called only from the enterElement handler. - * The sub-tree rooted at the new element will be redirected - * to the specified ContentHandler. - * - *

    - * Currently active NGCCHandler will only receive the leaveElement - * event of the newly started element. - * - * @param uri,local,qname - * Parameters passed to the enter element event. Used to - * simulate the startElement event for the new ContentHandler. - */ - public void redirectSubtree( ContentHandler child, - String uri, String local, String qname ) throws SAXException { - - redirect = child; - redirect.setDocumentLocator(locator); - redirect.startDocument(); - - // TODO: when a prefix is re-bound to something else, - // the following code is potentially dangerous. It should be - // modified to report active bindings only. - for( int i=0; inamespaces.size(). - *

    - * For example, consider the following schema: - *

    
    -     *  <oneOrMore>
    -     *   <element name="foo"><empty/></element>
    -     *  </oneOrMore>
    -     *  code fragment X
    -     *  <element name="bob"/>
    -     * 
    - * Code fragment X is executed after we see a startElement event, - * but at this time the namespaces variable already include new - * namespace bindings declared on "bob". - */ - private int nsEffectivePtr=0; - - /** - * Stack to preserve old nsEffectivePtr values. - */ - private final Stack nsEffectiveStack = new Stack(); - - public String resolveNamespacePrefix( String prefix ) { - for( int i = nsEffectivePtr-2; i>=0; i-=2 ) - if( namespaces.get(i).equals(prefix) ) - return (String)namespaces.get(i+1); - - // no binding was found. - if(prefix.equals("")) return ""; // return the default no-namespace - if(prefix.equals("xml")) // pre-defined xml prefix - return "http://www.w3.org/XML/1998/namespace"; - else return null; // prefix undefined - } - - -// error reporting - protected void unexpectedX(String token) throws SAXException { - throw new SAXParseException(MessageFormat.format( - "Unexpected {0} appears at line {1} column {2}", - new Object[]{ - token, - new Integer(getLocator().getLineNumber()), - new Integer(getLocator().getColumnNumber()) }), - getLocator()); - } - - - - -// -// -// trace functions -// -// - private int indent=0; - private boolean needIndent=true; - private void printIndent() { - for( int i=0; i=0) { - $runtime.consumeAttribute($ai); - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - else { - $_ngcc_current_state = 1; - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - } - break; - case 6: - { - if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - else { - $_ngcc_current_state = 2; - $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); - } - } - break; - case 10: - { - if(($__uri == "" && $__local == "schema")) { - $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); - $_ngcc_current_state = 6; - } - else { - unexpectedEnterElement($__qname); - } - } - break; - default: - { - unexpectedEnterElement($__qname); - } - break; - } - } - - public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { - int $ai; - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - if(($ai = $runtime.getAttributeIndex("","location"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - else { - $_ngcc_current_state = 1; - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - } - break; - case 1: - { - if(($__uri == "" && $__local == "schema")) { - $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); - $_ngcc_current_state = 0; - } - else { - unexpectedLeaveElement($__qname); - } - } - break; - case 6: - { - if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - else { - $_ngcc_current_state = 2; - $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); - } - } - break; - default: - { - unexpectedLeaveElement($__qname); - } - break; - } - } - - public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - if(($__uri == "" && $__local == "location")) { - $_ngcc_current_state = 4; - } - else { - $_ngcc_current_state = 1; - $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); - } - } - break; - case 6: - { - if(($__uri == "" && $__local == "namespace")) { - $_ngcc_current_state = 8; - } - else { - $_ngcc_current_state = 2; - $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); - } - } - break; - default: - { - unexpectedEnterAttribute($__qname); - } - break; - } - } - - public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { - $uri = $__uri; - $localName = $__local; - $qname = $__qname; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname); - } - break; - case 2: - { - $_ngcc_current_state = 1; - $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - case 7: - { - if(($__uri == "" && $__local == "namespace")) { - $_ngcc_current_state = 2; - } - else { - unexpectedLeaveAttribute($__qname); - } - } - break; - case 6: - { - $_ngcc_current_state = 2; - $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); - } - break; - case 3: - { - if(($__uri == "" && $__local == "location")) { - $_ngcc_current_state = 1; - } - else { - unexpectedLeaveAttribute($__qname); - } - } - break; - default: - { - unexpectedLeaveAttribute($__qname); - } - break; - } - } - - public void text(String $value) throws SAXException { - int $ai; - switch($_ngcc_current_state) { - case 0: - { - revertToParentFromText(this, super._cookie, $value); - } - break; - case 2: - { - if(($ai = $runtime.getAttributeIndex("","location"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendText(super._cookie, $value); - } - else { - $_ngcc_current_state = 1; - $runtime.sendText(super._cookie, $value); - } - } - break; - case 8: - { - namespace = $value; - $_ngcc_current_state = 7; - } - break; - case 4: - { - loc = $value; - $_ngcc_current_state = 3; - action0(); - } - break; - case 6: - { - if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { - $runtime.consumeAttribute($ai); - $runtime.sendText(super._cookie, $value); - } - else { - $_ngcc_current_state = 2; - $runtime.sendText(super._cookie, $value); - } - } - break; - } - } - - public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { - switch($__cookie__) { - } - } - - public boolean accepted() { - return(($_ngcc_current_state == 0)); - } - - - private File location; - private String namespace; - public String getNamespace() { return this.namespace;} - public File getLocation() { return this.location;} - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/config.rng b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/config.rng deleted file mode 100644 index e3c593f25d0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/config.rng +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - import java.util.List; - import java.util.ArrayList; - import java.io.File; - - - - private File baseDir; - private Classes classes; - private List schema = new ArrayList(); - public Classes getClasses() { return this.classes;} - public File getBaseDir() { return baseDir;} - public List getSchema() { return this.schema;} - - - - - bd = - baseDir = $runtime.getBaseDir(bd); - - - - (baseDir); - this.schema.add (_schema); - - - - - - - - import java.util.List; - import java.util.ArrayList; - - - private List includes = new ArrayList(); - public List getIncludes() { return $runtime.getIncludePatterns(this.includes);} - private List excludes = new ArrayList(); - public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);} - - - - - - - - this.includes.add(include_content); - - - - - - - - - - this.excludes.add(exclude_content); - - - - - - - - - - - - import java.io.File; - - - private File location; - private String namespace; - public String getNamespace() { return this.namespace;} - public File getLocation() { return this.location;} - - - - - namespace = - - - - - - loc = - location = new File(baseDir,loc); - - - - - diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/config.xsd b/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/config.xsd deleted file mode 100644 index ea9f46256a8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/gen/config/config.xsd +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jaxws/src/share/classes/com/sun/tools/internal/jxc/model/nav/APTNavigator.java b/jaxws/src/share/classes/com/sun/tools/internal/jxc/model/nav/APTNavigator.java deleted file mode 100644 index 9a886bd373f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/jxc/model/nav/APTNavigator.java +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.jxc.model.nav; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.sun.istack.internal.tools.APTTypeVisitor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.ClassDeclaration; -import com.sun.mirror.declaration.ConstructorDeclaration; -import com.sun.mirror.declaration.Declaration; -import com.sun.mirror.declaration.EnumConstantDeclaration; -import com.sun.mirror.declaration.EnumDeclaration; -import com.sun.mirror.declaration.FieldDeclaration; -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.MemberDeclaration; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.declaration.Modifier; -import com.sun.mirror.declaration.ParameterDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.type.ArrayType; -import com.sun.mirror.type.ClassType; -import com.sun.mirror.type.DeclaredType; -import com.sun.mirror.type.InterfaceType; -import com.sun.mirror.type.PrimitiveType; -import com.sun.mirror.type.ReferenceType; -import com.sun.mirror.type.TypeMirror; -import com.sun.mirror.type.TypeVariable; -import com.sun.mirror.type.VoidType; -import com.sun.mirror.type.WildcardType; -import com.sun.mirror.util.Declarations; -import com.sun.mirror.util.SourcePosition; -import com.sun.mirror.util.TypeVisitor; -import com.sun.mirror.util.Types; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Navigator} implementation for APT. - * - * TODO: check the spec on how generics are supposed to be handled - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public class APTNavigator implements Navigator { - - private final AnnotationProcessorEnvironment env; - - private final PrimitiveType primitiveByte; - - public APTNavigator(AnnotationProcessorEnvironment env) { - this.env = env; - this.primitiveByte = env.getTypeUtils().getPrimitiveType(PrimitiveType.Kind.BYTE); - } - - public TypeDeclaration getSuperClass(TypeDeclaration t) { - if (t instanceof ClassDeclaration) { - ClassDeclaration c = (ClassDeclaration) t; - ClassType sup = c.getSuperclass(); - if(sup!=null) - return sup.getDeclaration(); - else - return null; - } - return env.getTypeDeclaration(Object.class.getName()); - } - - public TypeMirror getBaseClass(TypeMirror type, TypeDeclaration sup) { - return baseClassFinder.apply(type,sup); - } - - public String getClassName(TypeDeclaration t) { - return t.getQualifiedName(); - } - - public String getTypeName(TypeMirror typeMirror) { - return typeMirror.toString(); - } - - public String getClassShortName(TypeDeclaration t) { - return t.getSimpleName(); - } - - public Collection getDeclaredFields(TypeDeclaration c) { - List l = new ArrayList(c.getFields()); - return sort(l); - } - - public FieldDeclaration getDeclaredField(TypeDeclaration clazz, String fieldName) { - for( FieldDeclaration fd : clazz.getFields() ) { - if(fd.getSimpleName().equals(fieldName)) - return fd; - } - return null; - } - - public Collection getDeclaredMethods(TypeDeclaration c) { - List l = new ArrayList(c.getMethods()); - return sort(l); - } - - private List sort(List l) { - if(l.isEmpty()) return l; - - // APT supports the operation mode where it creates Declarations from - // a class file, in which case the source position is not available - // use that as a key to sort them correctly. This isn't "correct" in - // the sense that it relies on undocumented behavior of APT where - // it returns declarations in the reverse order, but this makes things work. - SourcePosition pos = l.get(0).getPosition(); - if(pos!=null) - Collections.sort(l,SOURCE_POS_COMPARATOR); - else - Collections.reverse(l); - return l; - } - - public ClassDeclaration getDeclaringClassForField(FieldDeclaration f) { - return (ClassDeclaration)f.getDeclaringType(); - } - - public ClassDeclaration getDeclaringClassForMethod(MethodDeclaration m) { - return (ClassDeclaration)m.getDeclaringType(); - } - - public TypeMirror getFieldType(FieldDeclaration f) { - return f.getType(); - } - - public String getFieldName(FieldDeclaration f) { - return f.getSimpleName(); - } - - public String getMethodName(MethodDeclaration m) { - return m.getSimpleName(); - } - - public TypeMirror getReturnType(MethodDeclaration m) { - return m.getReturnType(); - } - - public TypeMirror[] getMethodParameters(MethodDeclaration m) { - Collection ps = m.getParameters(); - TypeMirror[] r = new TypeMirror[ps.size()]; - int i=0; - for( ParameterDeclaration p : ps ) - r[i++] = p.getType(); - return r; - } - - public boolean isStaticMethod(MethodDeclaration m) { - return hasModifier(m, Modifier.STATIC); - } - - private boolean hasModifier(Declaration d, Modifier mod) { - return d.getModifiers().contains(mod); - } - - public boolean isSubClassOf(TypeMirror sub, TypeMirror sup) { - if(sup==DUMMY) - // see ref(). if the sub type is known to APT, - // its base class must be known. Thus if the sup is DUMMY, - // it cannot possibly be the super type. - return false; - return env.getTypeUtils().isSubtype(sub,sup); - } - - private String getSourceClassName(Class clazz) { - Class d = clazz.getDeclaringClass(); - if(d==null) - return clazz.getName(); - else { - String shortName = clazz.getName().substring(d.getName().length()+1/*for $*/); - return getSourceClassName(d)+'.'+shortName; - } - } - - public TypeMirror ref(Class c) { - if(c.isArray()) - return env.getTypeUtils().getArrayType( ref(c.getComponentType()) ); - if(c.isPrimitive()) - return getPrimitive(c); - TypeDeclaration t = env.getTypeDeclaration(getSourceClassName(c)); - // APT only operates on a set of classes used in the compilation, - // and it won't recognize additional classes (even if they are visible from javac) - // and return null. - // - // this is causing a problem where we check if a type is collection. - // so until the problem is fixed in APT, work around the issue - // by returning a dummy token - if(t==null) - return DUMMY; - return env.getTypeUtils().getDeclaredType(t); - } - - public TypeMirror use(TypeDeclaration t) { - assert t!=null; - return env.getTypeUtils().getDeclaredType(t); - } - - public TypeDeclaration asDecl(TypeMirror m) { - m = env.getTypeUtils().getErasure(m); - if (m instanceof DeclaredType) { - DeclaredType d = (DeclaredType) m; - return d.getDeclaration(); - } else - return null; - } - - public TypeDeclaration asDecl(Class c) { - return env.getTypeDeclaration(getSourceClassName(c)); - } - - public TypeMirror erasure(TypeMirror t) { - Types tu = env.getTypeUtils(); - t = tu.getErasure(t); - if(t instanceof DeclaredType) { - DeclaredType dt = (DeclaredType)t; - if(!dt.getActualTypeArguments().isEmpty()) - return tu.getDeclaredType(dt.getDeclaration()); - } - return t; - } - - public boolean isAbstract(TypeDeclaration clazz) { - return hasModifier(clazz,Modifier.ABSTRACT); - } - - public boolean isFinal(TypeDeclaration clazz) { - return hasModifier(clazz,Modifier.FINAL); - } - - public FieldDeclaration[] getEnumConstants(TypeDeclaration clazz) { - EnumDeclaration ed = (EnumDeclaration) clazz; - Collection constants = ed.getEnumConstants(); - return constants.toArray(new EnumConstantDeclaration[constants.size()]); - } - - public TypeMirror getVoidType() { - return env.getTypeUtils().getVoidType(); - } - - public String getPackageName(TypeDeclaration clazz) { - return clazz.getPackage().getQualifiedName(); - } - - public TypeDeclaration findClass(String className, TypeDeclaration referencePoint) { - return env.getTypeDeclaration(className); - } - - public boolean isBridgeMethod(MethodDeclaration method) { - return method.getModifiers().contains(Modifier.VOLATILE); - } - - public boolean isOverriding(MethodDeclaration method, TypeDeclaration base) { - ClassDeclaration sc = (ClassDeclaration) base; - - Declarations declUtil = env.getDeclarationUtils(); - - while(true) { - for (MethodDeclaration m : sc.getMethods()) { - if(declUtil.overrides(method,m)) - return true; - } - - if(sc.getSuperclass()==null) - return false; - sc = sc.getSuperclass().getDeclaration(); - } - } - - public boolean isInterface(TypeDeclaration clazz) { - return clazz instanceof InterfaceDeclaration; - } - - public boolean isTransient(FieldDeclaration f) { - return f.getModifiers().contains(Modifier.TRANSIENT); - } - - public boolean isInnerClass(TypeDeclaration clazz) { - return clazz.getDeclaringType()!=null && !clazz.getModifiers().contains(Modifier.STATIC); - } - - public boolean isArray(TypeMirror t) { - return t instanceof ArrayType; - } - - public boolean isArrayButNotByteArray(TypeMirror t) { - if(!isArray(t)) - return false; - - ArrayType at = (ArrayType) t; - TypeMirror ct = at.getComponentType(); - - return !ct.equals(primitiveByte); - } - - public TypeMirror getComponentType(TypeMirror t) { - if (t instanceof ArrayType) { - ArrayType at = (ArrayType) t; - return at.getComponentType(); - } - - throw new IllegalArgumentException(); - } - - public TypeMirror getTypeArgument(TypeMirror typeMirror, int i) { - if (typeMirror instanceof DeclaredType){ - DeclaredType d = (DeclaredType)typeMirror; - TypeMirror[] args = d.getActualTypeArguments().toArray(new TypeMirror[0]); - return args[i]; - } else throw new IllegalArgumentException(); - } - - public boolean isParameterizedType(TypeMirror t) { - if (t instanceof DeclaredType) { - DeclaredType d = (DeclaredType) t; - return !d.getActualTypeArguments().isEmpty(); - } - return false; - } - - public boolean isPrimitive(TypeMirror t) { - return t instanceof PrimitiveType; - } - - private static final Map primitives = new HashMap(); - - static { - primitives.put(Integer.TYPE, PrimitiveType.Kind.INT); - primitives.put(Byte.TYPE, PrimitiveType.Kind.BYTE); - primitives.put(Float.TYPE, PrimitiveType.Kind.FLOAT); - primitives.put(Boolean.TYPE, PrimitiveType.Kind.BOOLEAN); - primitives.put(Short.TYPE, PrimitiveType.Kind.SHORT); - primitives.put(Long.TYPE, PrimitiveType.Kind.LONG); - primitives.put(Double.TYPE, PrimitiveType.Kind.DOUBLE); - primitives.put(Character.TYPE, PrimitiveType.Kind.CHAR); - - } - - public TypeMirror getPrimitive(Class primitiveType) { - assert primitiveType.isPrimitive(); - if(primitiveType==void.class) - return getVoidType(); - return env.getTypeUtils().getPrimitiveType(primitives.get(primitiveType)); - } - - /** - * see {@link #ref(Class)}. - */ - private static final TypeMirror DUMMY = new TypeMirror() { - public void accept(TypeVisitor v) { - throw new IllegalStateException(); - } - }; - - /** - * Implements {@link #getBaseClass}. - */ - private final APTTypeVisitor baseClassFinder = new APTTypeVisitor(){ - public TypeMirror onClassType(ClassType type, TypeDeclaration sup) { - TypeMirror r = onDeclaredType(type,sup); - if(r!=null) return r; - - // otherwise recursively apply super class and base types - if(type.getSuperclass()!=null) { - r = onClassType(type.getSuperclass(),sup); - if(r!=null) return r; - } - - return null; - } - - protected TypeMirror onPrimitiveType(PrimitiveType type, TypeDeclaration param) { - return type; - } - - protected TypeMirror onVoidType(VoidType type, TypeDeclaration param) { - return type; - } - - public TypeMirror onInterfaceType(InterfaceType type, TypeDeclaration sup) { - return onDeclaredType(type,sup); - } - - private TypeMirror onDeclaredType(DeclaredType t, TypeDeclaration sup) { - // t = sup<...> - if(t.getDeclaration().equals(sup)) - return t; - - for(InterfaceType i : t.getSuperinterfaces()) { - TypeMirror r = onInterfaceType(i,sup); - if(r!=null) return r; - } - - return null; - } - - public TypeMirror onTypeVariable(TypeVariable t, TypeDeclaration sup) { - // we are checking if T (declared as T extends A&B&C) is assignable to sup. - // so apply bounds recursively. - for( ReferenceType r : t.getDeclaration().getBounds() ) { - TypeMirror m = apply(r,sup); - if(m!=null) return m; - } - return null; - } - - public TypeMirror onArrayType(ArrayType type, TypeDeclaration sup) { - // we are checking if t=T[] is assignable to sup. - // the only case this is allowed is sup=Object, - // and Object isn't parameterized. - return null; - } - - public TypeMirror onWildcard(WildcardType type, TypeDeclaration sup) { - // we are checking if T (= ? extends A&B&C) is assignable to sup. - // so apply bounds recursively. - for( ReferenceType r : type.getLowerBounds() ) { - TypeMirror m = apply(r,sup); - if(m!=null) return m; - } - return null; - } - } ; - - - public Location getClassLocation(TypeDeclaration decl) { - return getLocation(decl.getQualifiedName(),decl.getPosition()); - } - - public Location getFieldLocation(FieldDeclaration decl) { - return getLocation(decl); - } - - public Location getMethodLocation(MethodDeclaration decl) { - return getLocation(decl); - } - - public boolean hasDefaultConstructor(TypeDeclaration t) { - if(!(t instanceof ClassDeclaration)) - return false; - - ClassDeclaration c = (ClassDeclaration) t; - for( ConstructorDeclaration init : c.getConstructors() ) { - if(init.getParameters().isEmpty()) - return true; - } - return false; - } - - public boolean isStaticField(FieldDeclaration f) { - return hasModifier(f,Modifier.STATIC); - } - - public boolean isPublicMethod(MethodDeclaration m) { - return hasModifier(m,Modifier.PUBLIC); - } - - public boolean isPublicField(FieldDeclaration f) { - return hasModifier(f,Modifier.PUBLIC); - } - - public boolean isEnum(TypeDeclaration t) { - return t instanceof EnumDeclaration; - } - - private Location getLocation(MemberDeclaration decl) { - return getLocation(decl.getDeclaringType().getQualifiedName()+'.'+decl.getSimpleName(),decl.getPosition()); - } - - private Location getLocation(final String name, final SourcePosition sp) { - return new Location() { - public String toString() { - if(sp==null) - return name+" (Unknown Source)"; - // just like stack trace, we just print the file name and - // not the whole path. The idea is that the pakage name should - // provide enough clue on which directory it lives. - return name+'('+sp.file().getName()+':'+sp.line()+')'; - } - }; - } - - /** - * Comparator that uses the source position - */ - private static final Comparator SOURCE_POS_COMPARATOR = new Comparator() { - public int compare(Declaration d1, Declaration d2) { - if (d1 == d2) - return 0; - - SourcePosition p1 = d1.getPosition(); - SourcePosition p2 = d2.getPosition(); - - if (p1 == null) { - return (p2 == null) ? 0 : 1; - } else { - if (p2 == null) - return -1; - - int fileComp = p1.file().compareTo(p2.file()); - if (fileComp == 0) { - long diff = (long) p1.line() - (long) p2.line(); - if (diff == 0) { - diff = Long.signum((long) p1.column() - (long) p2.column()); - if (diff != 0) - return (int) diff; - else { - // declarations may be two - // compiler-generated members with the - // same source position - return (Long.signum((long) System.identityHashCode(d1) - - (long) System.identityHashCode(d2))); - } - } else - return (diff < 0) ? -1 : 1; - } else - return fileComp; - } - } - }; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/Invoker.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/Invoker.java deleted file mode 100644 index 595b316ab11..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/Invoker.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws; - -import com.sun.istack.internal.tools.MaskingClassLoader; -import com.sun.istack.internal.tools.ParallelWorldClassLoader; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.xjc.api.util.ToolsJarNotFoundException; -import com.sun.xml.internal.bind.util.Which; - -import javax.xml.ws.Service; -import javax.xml.ws.WebServiceFeature; -import java.io.File; -import java.io.OutputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Invokes JAX-WS tools in a special class loader that can pick up APT classes, - * even if it's not available in the tool launcher classpath. - * - * @author Kohsuke Kawaguchi - */ -public final class Invoker { - static int invoke(String mainClass, String[] args) throws Throwable { - // use the platform default proxy if available. - // see sun.net.spi.DefaultProxySelector for details. - if(!noSystemProxies) { - try { - System.setProperty("java.net.useSystemProxies","true"); - } catch (SecurityException e) { - // failing to set this property isn't fatal - } - } - - ClassLoader oldcc = Thread.currentThread().getContextClassLoader(); - try { - ClassLoader cl = Invoker.class.getClassLoader(); - if(Arrays.asList(args).contains("-Xendorsed")) - cl = createClassLoader(cl); // perform JDK6 workaround hack - else { - if(!checkIfLoading21API()) { - if(Service.class.getClassLoader()==null) - System.err.println(WscompileMessages.INVOKER_NEED_ENDORSED()); - else - System.err.println(WscompileMessages.WRAPPER_TASK_LOADING_20_API(Which.which(Service.class))); - return -1; - } - //find and load tools.jar - List urls = new ArrayList(); - findToolsJar(cl, urls); - - if(urls.size() > 0){ - List mask = new ArrayList(Arrays.asList(maskedPackages)); - - // first create a protected area so that we load JAXB/WS 2.1 API - // and everything that depends on them inside - cl = new MaskingClassLoader(cl,mask); - - // then this classloader loads the API and tools.jar - cl = new URLClassLoader(urls.toArray(new URL[urls.size()]), cl); - - // finally load the rest of the RI. The actual class files are loaded from ancestors - cl = new ParallelWorldClassLoader(cl,""); - } - - } - - Thread.currentThread().setContextClassLoader(cl); - - Class compileTool = cl.loadClass(mainClass); - Constructor ctor = compileTool.getConstructor(OutputStream.class); - Object tool = ctor.newInstance(System.out); - Method runMethod = compileTool.getMethod("run",String[].class); - boolean r = (Boolean)runMethod.invoke(tool,new Object[]{args}); - return r ? 0 : 1; - } catch (ToolsJarNotFoundException e) { - System.err.println(e.getMessage()); - } catch (InvocationTargetException e) { - throw e.getCause(); - } catch(ClassNotFoundException e){ - throw e; - }finally { - Thread.currentThread().setContextClassLoader(oldcc); - } - - return -1; - } - - /** - * Returns true if the RI appears to be loading the JAX-WS 2.1 API. - */ - public static boolean checkIfLoading21API() { - try { - Service.class.getMethod("getPort",Class.class, WebServiceFeature[].class); - // yup. things look good. - return true; - } catch (NoSuchMethodException e) { - } catch (LinkageError e) { - } - // nope - return false; - } - - /** - * Creates a classloader that can load JAXB/WS 2.1 API and tools.jar, - * and then return a classloader that can RI classes, which can see all those APIs and tools.jar. - */ - public static ClassLoader createClassLoader(ClassLoader cl) throws ClassNotFoundException, MalformedURLException, ToolsJarNotFoundException { - - URL[] urls = findIstackAPIs(cl); - if(urls.length==0) - return cl; // we seem to be able to load everything already. no need for the hack - - List mask = new ArrayList(Arrays.asList(maskedPackages)); - if(urls.length>1) { - // we need to load 2.1 API from side. so add them to the mask - mask.add("javax.xml.bind."); - mask.add("javax.xml.ws."); - } - - // first create a protected area so that we load JAXB/WS 2.1 API - // and everything that depends on them inside - cl = new MaskingClassLoader(cl,mask); - - // then this classloader loads the API and tools.jar - cl = new URLClassLoader(urls, cl); - - // finally load the rest of the RI. The actual class files are loaded from ancestors - cl = new ParallelWorldClassLoader(cl,""); - - return cl; - } - - /** - * Creates a classloader for loading JAXB/WS 2.1 jar and tools.jar - */ - private static URL[] findIstackAPIs(ClassLoader cl) throws ClassNotFoundException, MalformedURLException, ToolsJarNotFoundException { - List urls = new ArrayList(); - - if(Service.class.getClassLoader()==null) { - // JAX-WS API is loaded from bootstrap classloader - URL res = cl.getResource("javax/xml/ws/EndpointReference.class"); - if(res==null) - throw new ClassNotFoundException("There's no JAX-WS 2.1 API in the classpath"); - urls.add(ParallelWorldClassLoader.toJarUrl(res)); - - res = cl.getResource("javax/xml/bind/annotation/XmlSeeAlso.class"); - if(res==null) - throw new ClassNotFoundException("There's no JAXB 2.1 API in the classpath"); - urls.add(ParallelWorldClassLoader.toJarUrl(res)); - } - - findToolsJar(cl, urls); - - return urls.toArray(new URL[urls.size()]); - } - - private static void findToolsJar(ClassLoader cl, List urls) throws ToolsJarNotFoundException, MalformedURLException { - try { - Class.forName("com.sun.tools.javac.Main",false,cl); - Class.forName("com.sun.tools.apt.Main",false,cl); - // we can already load them in the parent class loader. - // so no need to look for tools.jar. - // this happens when we are run inside IDE/Ant, or - // in Mac OS. - } catch (ClassNotFoundException e) { - // otherwise try to find tools.jar - File jreHome = new File(System.getProperty("java.home")); - File toolsJar = new File( jreHome.getParent(), "lib/tools.jar" ); - - if (!toolsJar.exists()) { - throw new ToolsJarNotFoundException(toolsJar); - } - urls.add(toolsJar.toURL()); - } - } - - /** - * The list of package prefixes we want the - * {@link MaskingClassLoader} to prevent the parent - * classLoader from loading - */ - public static String[] maskedPackages = new String[]{ - "com.sun.istack.internal.tools.", - "com.sun.tools.internal.jxc.", - "com.sun.tools.internal.xjc.", - "com.sun.tools.internal.ws.", - "com.sun.codemodel.internal.", - "com.sun.relaxng.", - "com.sun.xml.internal.xsom.", - "com.sun.xml.internal.bind.", - "com.sun.xml.internal.ws." - }; - - /** - * Escape hatch to work around IBM JDK problem. - * See http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?nav=false&forum=367&thread=164718&cat=10 - */ - public static boolean noSystemProxies = false; - - static { - try { - noSystemProxies = Boolean.getBoolean(Invoker.class.getName()+".noSystemProxies"); - } catch(SecurityException e) { - // ignore - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/ToolVersion.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/ToolVersion.java deleted file mode 100644 index 7d5aa32531e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/ToolVersion.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws; - -import com.sun.xml.internal.ws.util.Version; - -/** - * Obtains the version number of the JAX-WS tools. - * @author Kohsuke Kawaguchi - */ -public abstract class ToolVersion { - private ToolVersion() {} // no instanciation please - - public static final Version VERSION = Version.create(ToolVersion.class.getResourceAsStream("version.properties")); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/WsGen.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/WsGen.java deleted file mode 100644 index a4b3de5da4d..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/WsGen.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws; - -import com.sun.tools.internal.ws.wscompile.WsgenTool; - -/** - * WsGen tool entry point. - * - * @author Vivek Pandey - * @author Kohsuke Kawaguchi - */ -public class WsGen { - /** - * CLI entry point. Use {@link Invoker} to - * load tools.jar - */ - public static void main(String[] args) throws Throwable { - System.exit(Invoker.invoke("com.sun.tools.internal.ws.wscompile.WsgenTool", args)); - } - - /** - * Entry point for tool integration. - * - *

    - * This does the same as {@link #main(String[])} except - * it doesn't invoke {@link System#exit(int)}. This method - * also doesn't play with classloaders. It's the caller's - * responsibility to set up the classloader to load all jars - * needed to run the tool, including $JAVA_HOME/lib/tools.jar - * - * @return - * 0 if the tool runs successfully. - */ - public static int doMain(String[] args) throws Throwable { - return new WsgenTool(System.out).run(args) ? 0 : 1; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/WsImport.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/WsImport.java deleted file mode 100644 index 94fd2a83a41..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/WsImport.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws; - -import com.sun.tools.internal.ws.wscompile.WsimportTool; - -/** - * WsImport tool entry point. - * - * @author Vivek Pandey - * @author Kohsuke Kawaguchi - */ -public class WsImport { - /** - * CLI entry point. Use {@link Invoker} to - * load tools.jar - */ - public static void main(String[] args) throws Throwable { - System.exit(Invoker.invoke("com.sun.tools.internal.ws.wscompile.WsimportTool", args)); - } - - /** - * Entry point for tool integration. - * - *

    - * This does the same as {@link #main(String[])} except - * it doesn't invoke {@link System#exit(int)}. This method - * also doesn't play with classloaders. It's the caller's - * responsibility to set up the classloader to load all jars - * needed to run the tool, including $JAVA_HOME/lib/tools.jar - * - * @return - * 0 if the tool runs successfully. - */ - public static int doMain(String[] args) throws Throwable { - return new WsimportTool(System.out).run(args) ? 0 : 1; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/TJavaGeneratorExtension.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/TJavaGeneratorExtension.java deleted file mode 100644 index 54a13505fac..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/TJavaGeneratorExtension.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.api; - -import com.sun.codemodel.internal.JMethod; -import com.sun.tools.internal.ws.api.wsdl.TWSDLOperation; -import com.sun.tools.internal.ws.processor.generator.JavaGeneratorExtensionFacade; - -/** - * Provides Java SEI Code generation Extensiblity mechanism. - * - * @see JavaGeneratorExtensionFacade - * @author Vivek Pandey - * @deprecated This class is deprecated, will be removed in JAX-WS 2.2 RI. - */ -public abstract class TJavaGeneratorExtension { - /** - * This method should be used to write annotations on {@link JMethod}. - * - * @param wsdlOperation non-null wsdl extensiblity element - wsdl:portType/wsdl:operation. - * @param jMethod non-null {@link JMethod} - */ - public abstract void writeMethodAnnotations(TWSDLOperation wsdlOperation, JMethod jMethod); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/WsgenExtension.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/WsgenExtension.java deleted file mode 100644 index 62841fe1f79..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/WsgenExtension.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.api; - -/** - * Allows to customize wsgen behaviour using this extension. - * The extension implementations are found using service - * discovery mechanism i.e. JAX-WS tooltime locates - * {@link WsgenExtension}s through the - * META-INF/services/com.sun.tools.internal.ws.api.WsgenExtension - * files. - * - * {@link WsgenProtocol} annotation can be specified on the - * extensions to extend -wsdl[:protocol] behaviour. - * - * @author Jitendra Kotamraju - * @since JAX-WS RI 2.1.6 - * @see WsgenProtocol - */ -public abstract class WsgenExtension { -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/WsgenProtocol.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/WsgenProtocol.java deleted file mode 100644 index 87a39e1652f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/WsgenProtocol.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.api; - -import java.lang.annotation.*; - -/** - * Allows to extend protocol for wsgen's wsdl[:protocol] switch. - * This annotation must be specified on {@link WsgenExtension} - * implementations. - * - * @author Jitendra Kotamraju - * @since JAX-WS RI 2.1.6 - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface WsgenProtocol { - /** - * Token for wsgen -wsdl[:protocol] - * @return - */ - String token(); - - /** - * The corresponding lexical string used to create BindingID - * @return - */ - String lexical(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensible.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensible.java deleted file mode 100644 index 20ec348377a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensible.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.api.wsdl; - - -import javax.xml.namespace.QName; - -/** - * A WSDL element or attribute that can be extended. - * - * @author Vivek Pandey - * @deprecated This interface is deprecated, will be removed in JAX-WS 2.2 RI. - * - */ -public interface TWSDLExtensible { - /** - * Gives the wsdl extensiblity element's name attribute value. It can be null as @name on some of the wsdl - * extensibility elements are optinal such as wsdl:input - */ - String getNameValue(); - - /** - * Gives namespace URI of a wsdl extensibility element. - */ - String getNamespaceURI(); - - /** - * Gives the WSDL element or WSDL extensibility element name - */ - QName getWSDLElementName(); - - /** - * An {@link TWSDLExtensionHandler} will call this method to add an {@link TWSDLExtension} object - * - * @param e non-null extension object - */ - void addExtension(TWSDLExtension e); - - /** - * Gives iterator over {@link TWSDLExtension}s - */ - Iterable extensions(); - - /** - * Gives the parent of a wsdl extensibility element. - *

    -     * For example,
    -     *
    -     *     
    -     *         
    -     *     ...
    -     * Here, the {@link TWSDLExtensible}representing wsdl:operation's parent would be wsdl:portType
    -     *
    -     * @return null if the {@link TWSDLExtensible} has no parent, root of wsdl document - wsdl:definition.
    -     */
    -    TWSDLExtensible getParent();
    -}
    diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtension.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtension.java
    deleted file mode 100644
    index 1cca601e943..00000000000
    --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtension.java
    +++ /dev/null
    @@ -1,39 +0,0 @@
    -/*
    - * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
    - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    - *
    - * This code is free software; you can redistribute it and/or modify it
    - * under the terms of the GNU General Public License version 2 only, as
    - * published by the Free Software Foundation.  Sun designates this
    - * particular file as subject to the "Classpath" exception as provided
    - * by Sun in the LICENSE file that accompanied this code.
    - *
    - * This code is distributed in the hope that it will be useful, but WITHOUT
    - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    - * version 2 for more details (a copy is included in the LICENSE file that
    - * accompanied this code).
    - *
    - * You should have received a copy of the GNU General Public License version
    - * 2 along with this work; if not, write to the Free Software Foundation,
    - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    - *
    - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    - * CA 95054 USA or visit www.sun.com if you need additional information or
    - * have any questions.
    - */
    -
    -package com.sun.tools.internal.ws.api.wsdl;
    -
    -/**
    - * A WSDL extension
    - *
    - * @author Vivek Pandey
    - * @deprecated This interface is deprecated, will be removed in JAX-WS 2.2 RI.
    - */
    -public interface TWSDLExtension {
    -    /**
    -     * Gives Parent {@link TWSDLExtensible} element
    -     */
    -    TWSDLExtensible getParent();
    -}
    diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensionHandler.java
    deleted file mode 100644
    index ce4569ef1cf..00000000000
    --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensionHandler.java
    +++ /dev/null
    @@ -1,216 +0,0 @@
    -/*
    - * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
    - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    - *
    - * This code is free software; you can redistribute it and/or modify it
    - * under the terms of the GNU General Public License version 2 only, as
    - * published by the Free Software Foundation.  Sun designates this
    - * particular file as subject to the "Classpath" exception as provided
    - * by Sun in the LICENSE file that accompanied this code.
    - *
    - * This code is distributed in the hope that it will be useful, but WITHOUT
    - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    - * version 2 for more details (a copy is included in the LICENSE file that
    - * accompanied this code).
    - *
    - * You should have received a copy of the GNU General Public License version
    - * 2 along with this work; if not, write to the Free Software Foundation,
    - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    - *
    - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    - * CA 95054 USA or visit www.sun.com if you need additional information or
    - * have any questions.
    - */
    -
    -package com.sun.tools.internal.ws.api.wsdl;
    -
    -import com.sun.tools.internal.ws.wsdl.document.WSDLConstants;
    -import org.w3c.dom.Element;
    -
    -/**
    - * JAXWS WSDL parser {@link com.sun.tools.internal.ws.wsdl.parser.WSDLParser} will call an {@link TWSDLExtensionHandler} registered
    - * with it for the WSDL extensibility elements thats not already defined in the WSDL 1.1 spec, such as SOAP or MIME.
    - *
    - * @author Vivek Pandey
    - * @deprecated This class is deprecated, will be removed in JAX-WS 2.2 RI.
    - */
    -public abstract class TWSDLExtensionHandler {
    -    /**
    -     * Gives the namespace of an extensibility element.
    -     * 

    - * For example a soap 1.1 XXExtensionHandler would return ""http://schemas.xmlsoap.org/wsdl/soap/" - */ - public String getNamespaceURI() { - return null; - } - - /** - * This interface is called during WSDL parsing on detecting any wsdl extension. - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean doHandleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_DEFINITIONS)) { - return handleDefinitionsExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_TYPES)) { - return handleTypesExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_PORT_TYPE)) { - return handlePortTypeExtension(context, parent, e); - } else if ( - parent.getWSDLElementName().equals(WSDLConstants.QNAME_BINDING)) { - return handleBindingExtension(context, parent, e); - } else if ( - parent.getWSDLElementName().equals(WSDLConstants.QNAME_OPERATION)) { - return handleOperationExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_INPUT)) { - return handleInputExtension(context, parent, e); - } else if ( - parent.getWSDLElementName().equals(WSDLConstants.QNAME_OUTPUT)) { - return handleOutputExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_FAULT)) { - return handleFaultExtension(context, parent, e); - } else if ( - parent.getWSDLElementName().equals(WSDLConstants.QNAME_SERVICE)) { - return handleServiceExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_PORT)) { - return handlePortExtension(context, parent, e); - } else { - return false; - } - } - - /** - * Callback for wsdl:portType - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:definitions - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleDefinitionsExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:type - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleTypesExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:binding - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:portType/wsdl:operation. - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:input - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:output - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:fault - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:service - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } - - /** - * Callback for wsdl:port - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return false; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLOperation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLOperation.java deleted file mode 100644 index 058feaf8b22..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLOperation.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.api.wsdl; - -import com.sun.codemodel.internal.JClass; - -import java.util.Map; - -/** - * Abstracts wsdl:portType/wsdl:operation - * - * @author Vivek Pandey - * @deprecated This interface is deprecated, will be removed in JAX-WS 2.2 RI. - */ -public interface TWSDLOperation extends TWSDLExtensible{ - /** - * Gives a Map of fault name attribute value to the {@link JClass} - */ - Map getFaults(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLParserContext.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLParserContext.java deleted file mode 100644 index 87b517259d0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/api/wsdl/TWSDLParserContext.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.api.wsdl; - -import org.w3c.dom.Element; -import org.xml.sax.Locator; - -/** - * Provides WSDL parsing context. It should be used by the WSDL extension handlers to register their namespaces so that - * it can be latter used by other extensions to resolve the namespaces. - * - * @author Vivek Pandey - * @deprecated This interface is deprecated, will be removed in JAX-WS 2.2 RI. - */ -public interface TWSDLParserContext { - - /** - * Pushes the parsing context - */ - void push(); - - /** - * pops the parsing context - */ - void pop(); - - /** - * Gives the namespace URI for a given prefix - * - * @param prefix non-null prefix - * @return null of the prefix is not found - */ - String getNamespaceURI(String prefix); - - /** - * Gives the prefixes in the current context - */ - Iterable getPrefixes(); - - /** - * Gives default namespace - * - * @return null if there is no default namespace declaration found - */ - String getDefaultNamespaceURI(); - - /** - * Registers naemespace declarations of a given {@link Element} found in the WSDL - * - * @param e {@link Element} whose namespace declarations need to be registered - */ - void registerNamespaces(Element e); - - /** - * gives the location information for the given Element. - */ - Locator getLocation(Element e); - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/package-info.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/package-info.java deleted file mode 100644 index 72e90c70780..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/package-info.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/** - *

    JAX-WS 2.1 Tools

    - * This document describes the tools included with JAX-WS 2.0.1. - * - * {@DotDiagram - digraph G { - // external tools - APT; - - // ANT tasks - node [style=filled,color=lightyellow]; - "WsGen ANT Task"; "WsImport ANT Task"; "Apt ANT Task"; - - // commandline - node [style=filled,color=lightpink]; - wsgen; wsimport; - - // libraries - node [style=filled,color=lightblue]; - WsimportTool; WsgenTool;"WSAP"; WebServiceAP; WSDLModeler;WSDLParser;SeiGenerator;ServiceGenerator;ExceptionGenerator;"JAXB XJC APIs";CodeModel; - - // aps -# node [style=filled,color=lightpink]; -# "JAX-WS"; tools; runtime; SPI; "Annotation Processor"; - - "Apt ANT Task" -> APT; - "WsGen ANT Task" -> wsgen -> WsgenTool; - "WsImport ANT Task" -> wsimport -> WsimportTool; - - WsgenTool -> APT -> WSAP -> WebServiceAP; - WsimportTool -> WSDLModeler; - WSDLModeler->WSDLParser; - WSDLModeler->"JAXB XJC APIs" - WsimportTool->SeiGenerator->CodeModel; - WsimportTool->ServiceGenerator->CodeModel; - WsimportTool->ExceptionGenerator->CodeModel; - WebServiceAP->CodeModel - } - * } - *
    - * Legend: blue: implementation classes, pink: command-line toosl, white: external tool, yellow: ANT tasks - *
    - * - *

    ANT Tasks

    - - *
    {@link com.sun.tools.internal.ws.ant.Apt Apt} - *
    An ANT task to invoke APT. - - *
    {@link com.sun.tools.internal.ws.ant.WsGen2 WsGen} - *
    - * An ANT task to invoke {@link com.sun.tools.internal.ws.WsGen WsGen} - - *
    {@link com.sun.tools.internal.ws.ant.WsImport2 WsImport} - *
    - * An ANT task to invoke {@link com.sun.tools.internal.ws.WsImport WsImport} - * - * - *

    Command-line Tools

    - - *
    APT -
    A Java SE tool and framework for processing annotations. APT will invoke a JAX-WS AnnotationProcossor for - * processing Java source files with javax.jws.* annotations and making them web services. - * APT will compile the Java source files and generate any additional classes needed to make an javax.jws.WebService - * annotated class a Web service. - * - *
    {@link com.sun.tools.internal.ws.WsGen WsGen} - *
    Tool to process a compiled javax.jws.WebService annotated class and to generate the necessary classes to make - * it a Web service. - - *
    {@link com.sun.tools.internal.ws.ant.WsImport2 WsImport} - *
    - * Tool to import a WSDL and to generate an SEI (a javax.jws.WebService) interface that can be either implemented - * on the server to build a web service, or can be used on the client to invoke the web service. - * - *

    Implementation Classes

    - * - *
    {@link com.sun.tools.internal.ws.processor.model.Model Model} - *
    The model is used to represent the entire Web Service. The JAX-WS ProcessorActions can process - * this Model to generate Java artifacts such as the service interface. - * - * - *
    {@link com.sun.tools.internal.ws.processor.modeler.Modeler Modeler} - *
    A Modeler is used to create a Model of a Web Service from a particular Web - * Web Service description such as a WSDL - * file. - * - *
    {@link com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler WSDLModeler} - *
    The WSDLModeler processes a WSDL to create a Model. - * - *
    {@link com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP WebServiceAP} - *
    WebServiceAP is a APT AnnotationProcessor for processing javax.jws.* and - * javax.xml.ws.* annotations. This class is used either by the WsGen (CompileTool) tool or - * idirectly via the {@link com.sun.istack.internal.ws.WSAP WSAP} when invoked by APT. - * - *
    {@link com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl WSAP} - *
    This is the entry point for the WebServiceAP when APT is invoked on a SEI - * annotated with the javax.jws.WebService annotation. - * - * - * @ArchitectureDocument - **/ -package com.sun.tools.internal.ws; diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/ProcessorException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/ProcessorException.java deleted file mode 100644 index fd998f244de..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/ProcessorException.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor; - -import com.sun.xml.internal.ws.util.exception.JAXWSExceptionBase; - -/** - * ProcessorException represents an exception that occurred while processing - * a web service. - * - * @see JAXWSExceptionBase - * - * @author WS Development Team - */ -public class ProcessorException extends JAXWSExceptionBase { - - public ProcessorException(String key, Object... args) { - super(key, args); - } - - public ProcessorException(String msg){ - super(msg); - } - - public ProcessorException(Throwable throwable) { - super(throwable); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.processor"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/CustomExceptionGenerator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/CustomExceptionGenerator.java deleted file mode 100644 index a933faa0173..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/CustomExceptionGenerator.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.codemodel.internal.ClassType; -import com.sun.codemodel.internal.JAnnotationUse; -import com.sun.codemodel.internal.JBlock; -import com.sun.codemodel.internal.JClass; -import com.sun.codemodel.internal.JClassAlreadyExistsException; -import com.sun.codemodel.internal.JDefinedClass; -import com.sun.codemodel.internal.JDocComment; -import com.sun.codemodel.internal.JExpr; -import com.sun.codemodel.internal.JFieldRef; -import com.sun.codemodel.internal.JFieldVar; -import com.sun.codemodel.internal.JMethod; -import com.sun.codemodel.internal.JMod; -import com.sun.codemodel.internal.JType; -import com.sun.codemodel.internal.JVar; -import com.sun.tools.internal.ws.processor.model.Fault; -import com.sun.tools.internal.ws.processor.model.Model; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; - -import javax.xml.ws.WebFault; -import java.util.HashMap; -import java.util.Map; - -/** - * - * @author WS Development Team - */ -public class CustomExceptionGenerator extends GeneratorBase { - private Map faults = new HashMap(); - - public static void generate(Model model, - WsimportOptions options, - ErrorReceiver receiver){ - CustomExceptionGenerator exceptionGen = new CustomExceptionGenerator(model, options, receiver); - exceptionGen.doGeneration(); - } - private CustomExceptionGenerator( - Model model, - WsimportOptions options, - ErrorReceiver receiver) { - super(model, options, receiver); - } - - public GeneratorBase getGenerator(Model model, WsimportOptions options, ErrorReceiver receiver) { - return new CustomExceptionGenerator(model, options, receiver); - } - - @Override - public void visit(Fault fault) throws Exception { - if (isRegistered(fault)) - return; - registerFault(fault); - } - - private boolean isRegistered(Fault fault) { - if(faults.keySet().contains(fault.getJavaException().getName())){ - fault.setExceptionClass(faults.get(fault.getJavaException().getName())); - return true; - } - return false; - } - - private void registerFault(Fault fault) { - try { - write(fault); - faults.put(fault.getJavaException().getName(), fault.getExceptionClass()); - } catch (JClassAlreadyExistsException e) { - throw new GeneratorException("generator.nestedGeneratorError",e); - } - } - - private void write(Fault fault) throws JClassAlreadyExistsException { - String className = Names.customExceptionClassName(fault); - - JDefinedClass cls = cm._class(className, ClassType.CLASS); - JDocComment comment = cls.javadoc(); - if(fault.getJavaDoc() != null){ - comment.add(fault.getJavaDoc()); - comment.add("\n\n"); - } - - for (String doc : getJAXWSClassComment()) { - comment.add(doc); - } - - cls._extends(java.lang.Exception.class); - - //@WebFault - JAnnotationUse faultAnn = cls.annotate(WebFault.class); - faultAnn.param("name", fault.getBlock().getName().getLocalPart()); - faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI()); - - JType faultBean = fault.getBlock().getType().getJavaType().getType().getType(); - - //faultInfo filed - JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo"); - - //add jaxb annotations - fault.getBlock().getType().getJavaType().getType().annotate(fi); - - fi.javadoc().add("Java type that goes as soapenv:Fault detail element."); - JFieldRef fr = JExpr.ref(JExpr._this(), fi); - - //Constructor - JMethod constrc1 = cls.constructor(JMod.PUBLIC); - JVar var1 = constrc1.param(String.class, "message"); - JVar var2 = constrc1.param(faultBean, "faultInfo"); - constrc1.javadoc().addParam(var1); - constrc1.javadoc().addParam(var2); - JBlock cb1 = constrc1.body(); - cb1.invoke("super").arg(var1); - - cb1.assign(fr, var2); - - //constructor with Throwable - JMethod constrc2 = cls.constructor(JMod.PUBLIC); - var1 = constrc2.param(String.class, "message"); - var2 = constrc2.param(faultBean, "faultInfo"); - JVar var3 = constrc2.param(Throwable.class, "cause"); - constrc2.javadoc().addParam(var1); - constrc2.javadoc().addParam(var2); - constrc2.javadoc().addParam(var3); - JBlock cb2 = constrc2.body(); - cb2.invoke("super").arg(var1).arg(var3); - cb2.assign(fr, var2); - - - //getFaultInfo() method - JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo"); - fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName()); - JBlock fib = fim.body(); - fib._return(fi); - fault.setExceptionClass(cls); - - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorBase.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorBase.java deleted file mode 100644 index 9d5f9b18c21..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorBase.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.codemodel.internal.ClassType; -import com.sun.codemodel.internal.JAnnotationUse; -import com.sun.codemodel.internal.JClassAlreadyExistsException; -import com.sun.codemodel.internal.JCodeModel; -import com.sun.codemodel.internal.JDefinedClass; -import com.sun.tools.internal.ws.ToolVersion; -import com.sun.tools.internal.ws.processor.model.Block; -import com.sun.tools.internal.ws.processor.model.Fault; -import com.sun.tools.internal.ws.processor.model.Model; -import com.sun.tools.internal.ws.processor.model.ModelVisitor; -import com.sun.tools.internal.ws.processor.model.Operation; -import com.sun.tools.internal.ws.processor.model.Parameter; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.Request; -import com.sun.tools.internal.ws.processor.model.Response; -import com.sun.tools.internal.ws.processor.model.Service; -import com.sun.tools.internal.ws.processor.util.DirectoryUtil; -import com.sun.tools.internal.ws.processor.util.IndentingWriter; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.xml.internal.ws.util.xml.XmlUtil; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import javax.jws.HandlerChain; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * - * @author WS Development Team - */ -public abstract class GeneratorBase - implements - GeneratorConstants, - ModelVisitor{ - private File destDir; - private String targetVersion; - protected boolean donotOverride; - protected JCodeModel cm; - protected final Model model; - protected final String wsdlLocation; - protected final ErrorReceiver receiver; - protected final WsimportOptions options; - - protected GeneratorBase(Model model, WsimportOptions options, ErrorReceiver receiver){ - this.model = model; - this.options = options; - this.destDir = options.destDir; - this.receiver = receiver; - this.wsdlLocation = options.wsdlLocation; - this.targetVersion = options.target.getVersion(); - this.cm = options.getCodeModel(); - } - - protected void doGeneration() { - try { - model.accept(this); - } catch (Exception e) { - receiver.error(e); - } - } - - public void visit(Model model) throws Exception { - for (Service service : model.getServices()) { - service.accept(this); - } - } - - public void visit(Service service) throws Exception { - for (Port port : service.getPorts()) { - port.accept(this); - } - } - - public void visit(Port port) throws Exception { - for (Operation operation : port.getOperations()) { - operation.accept(this); - } - } - - public void visit(Operation operation) throws Exception { - operation.getRequest().accept(this); - if (operation.getResponse() != null) - operation.getResponse().accept(this); - Iterator faults = operation.getFaultsSet().iterator(); - if (faults != null) { - Fault fault; - while (faults.hasNext()) { - fault = (Fault) faults.next(); - fault.accept(this); - } - } - } - - public void visit(Parameter param) throws Exception { - } - - public void visit(Block block) throws Exception { - } - - public void visit(Response response) throws Exception { - } - - - public void visit(Request request) throws Exception { - } - - public void visit(Fault fault) throws Exception { - } - - public List getJAXWSClassComment(){ - return getJAXWSClassComment(targetVersion); - } - - public static List getJAXWSClassComment(String targetVersion) { - List comments = new ArrayList(); - comments.add("This class was generated by the JAX-WS RI.\n"); - comments.add(ToolVersion.VERSION.BUILD_VERSION+"\n"); - comments.add("Generated source version: " + targetVersion); - return comments; - } - - protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException { - JDefinedClass cls; - try { - cls = cm._class(className, type); - } catch (JClassAlreadyExistsException e){ - cls = cm._getClass(className); - if(cls == null) - throw e; - } - return cls; - } - - protected void log(String msg) { - if (options.verbose) { - System.out.println( - "[" - + Names.stripQualifier(this.getClass().getName()) - + ": " - + msg - + "]"); - } - } - - protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) { - Element e = options.getHandlerChainConfiguration(); - if(e == null) - return; - JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class)); - NodeList nl = e.getElementsByTagNameNS( - "http://java.sun.com/xml/ns/javaee", "handler-chain"); - if(nl.getLength() > 0){ - String fName = getHandlerConfigFileName(className); - handlerChainAnn.param("file", fName); - generateHandlerChainFile(e, className); - } - } - - private String getHandlerConfigFileName(String fullName){ - String name = Names.stripQualifier(fullName); - return name+"_handler.xml"; - } - - private void generateHandlerChainFile(Element hChains, String name) { - String hcName = getHandlerConfigFileName(name); - - File packageDir = DirectoryUtil.getOutputDirectoryFor(name, destDir); - File hcFile = new File(packageDir, hcName); - - options.addGeneratedFile(hcFile); - - try { - IndentingWriter p = - new IndentingWriter( - new OutputStreamWriter(new FileOutputStream(hcFile))); - Transformer it = XmlUtil.newTransformer(); - - it.setOutputProperty(OutputKeys.METHOD, "xml"); - it.setOutputProperty(OutputKeys.INDENT, "yes"); - it.setOutputProperty( - "{http://xml.apache.org/xslt}indent-amount", - "2"); - it.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - it.transform( new DOMSource(hChains), new StreamResult(p) ); - p.close(); - } catch (Exception e) { - throw new GeneratorException( - "generator.nestedGeneratorError", - e); - } - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorConstants.java deleted file mode 100644 index 0688b6b3a84..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorConstants.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.tools.internal.ws.processor.modeler.ModelerConstants; - -/** - * @author WS Development Team - */ -public interface GeneratorConstants extends ModelerConstants { - public static final char DOTC = '.'; - public static final String SIG_INNERCLASS = "$"; - public static final String JAVA_SRC_SUFFIX = ".java"; - public static final String QNAME_SUFFIX = "_QNAME"; - public static final String GET = "get"; - public static final String IS = "is"; - public static final String RESPONSE = "Response"; - public static final String FAULT_CLASS_MEMBER_NAME = "faultInfo"; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorException.java deleted file mode 100644 index 36d6c6d148c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.tools.internal.ws.processor.ProcessorException; - -/** - * - * @author WS Development Team - */ -public class GeneratorException extends ProcessorException { - - public GeneratorException(String key, Object... args) { - super(key, args); - } - - public GeneratorException(Throwable throwable) { - super(throwable); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.generator"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorUtil.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorUtil.java deleted file mode 100644 index 64dbe6f5953..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/GeneratorUtil.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.tools.internal.ws.wscompile.Options; - - -/** - * - * @author WS Development Team - */ -public class GeneratorUtil implements GeneratorConstants { - - public static boolean classExists( - Options options, - String className) { - try { - // Takes care of inner classes. - getLoadableClassName(className, options.getClassLoader()); - return true; - } catch(ClassNotFoundException ce) { - return false; - } - } - - private static String getLoadableClassName( - String className, - ClassLoader classLoader) - throws ClassNotFoundException { - - try { - Class.forName(className, true, classLoader); - } catch (ClassNotFoundException e) { - int idx = className.lastIndexOf(DOTC); - if (idx > -1) { - String tmp = className.substring(0, idx) + SIG_INNERCLASS; - tmp += className.substring(idx + 1); - return getLoadableClassName(tmp, classLoader); - } - throw e; - } - return className; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/JavaGeneratorExtensionFacade.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/JavaGeneratorExtensionFacade.java deleted file mode 100644 index 2936437caf8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/JavaGeneratorExtensionFacade.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.codemodel.internal.JMethod; -import com.sun.tools.internal.ws.api.TJavaGeneratorExtension; -import com.sun.tools.internal.ws.api.wsdl.TWSDLOperation; - -/** - * @author Arun Gupta - */ -public final class JavaGeneratorExtensionFacade extends TJavaGeneratorExtension { - private final TJavaGeneratorExtension[] extensions; - - JavaGeneratorExtensionFacade(TJavaGeneratorExtension... extensions) { - assert extensions != null; - this.extensions = extensions; - } - - public void writeMethodAnnotations(TWSDLOperation wsdlOperation, JMethod jMethod) { - for (TJavaGeneratorExtension e : extensions) { - e.writeMethodAnnotations(wsdlOperation, jMethod); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/Names.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/Names.java deleted file mode 100644 index 0d77a452853..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/Names.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.tools.internal.ws.processor.model.Fault; -import com.sun.tools.internal.ws.processor.model.ModelProperties; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.Service; -import com.sun.tools.internal.ws.processor.model.java.JavaInterface; -import com.sun.tools.internal.ws.processor.model.java.JavaStructureMember; -import com.sun.tools.internal.ws.util.ClassNameInfo; -import com.sun.xml.internal.ws.util.StringUtils; -import com.sun.istack.internal.Nullable; -import com.sun.istack.internal.NotNull; - -import javax.xml.namespace.QName; -import java.util.HashMap; -import java.util.Map; - -/** - * Names provides utility methods used by other wscompile classes - * for dealing with identifiers. - * - * @author WS Development Team - */ -public class Names implements GeneratorConstants{ - - public static String getPortName(Port port) { - String javaPortName = - (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME); - if (javaPortName != null) { - return javaPortName; - } else { - QName portName = - (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_PORT_NAME); - if (portName != null) { - return portName.getLocalPart(); - } else { - String name = stripQualifier(port.getJavaInterface().getName()); - return ClassNameInfo.replaceInnerClassSym(name); - } - } - } - - - public static String stripQualifier(String name) { - return ClassNameInfo.getName(name); - } - - public static String getPackageName(String className) { - String packageName = ClassNameInfo.getQualifier(className); - return packageName != null ? packageName : ""; - } - - - public static String customJavaTypeClassName(JavaInterface intf) { - return intf.getName(); - } - - public static String customExceptionClassName(Fault fault) { - return fault.getJavaException().getName(); - } - - public static String getExceptionClassMemberName(){ - return FAULT_CLASS_MEMBER_NAME; - } - - public static boolean isJavaReservedWord(String name) { - return reservedWords.get(name) != null; - } - - /** - * See if its a java keyword name, if so then mangle the name - */ - public static @NotNull String getJavaReserverVarialbeName(@NotNull String name){ - return (reservedWords.get(name) == null)?name:reservedWords.get(name); - } - - /* here we check on wether return values datatype is - boolean. If its boolean, instead of a get method - its set a is to comply with JavaBeans - Pattern spec */ - public static String getJavaMemberReadMethod(JavaStructureMember member) { - String return_value; - if (member.getType().getRealName().equals("boolean")) { - return_value = IS + StringUtils.capitalize(member.getName()); - } else { - return_value = GET + StringUtils.capitalize(member.getName()); - } - return (return_value); - } - - public static String getResponseName(String messageName) { - return messageName + RESPONSE; - } - - private static final Map reservedWords; - - static { - reservedWords = new HashMap(); - reservedWords.put("abstract", "_abstract"); - reservedWords.put("assert", "_assert"); - reservedWords.put("boolean", "_boolean"); - reservedWords.put("break", "_break"); - reservedWords.put("byte", "_byte"); - reservedWords.put("case", "_case"); - reservedWords.put("catch", "_catch"); - reservedWords.put("char", "_char"); - reservedWords.put("class", "_class"); - reservedWords.put("const", "_const"); - reservedWords.put("continue", "_continue"); - reservedWords.put("default", "_default"); - reservedWords.put("do", "_do"); - reservedWords.put("double", "_double"); - reservedWords.put("else", "_else"); - reservedWords.put("extends", "_extends"); - reservedWords.put("false", "_false"); - reservedWords.put("final", "_final"); - reservedWords.put("finally", "_finally"); - reservedWords.put("float", "_float"); - reservedWords.put("for", "_for"); - reservedWords.put("goto", "_goto"); - reservedWords.put("if", "_if"); - reservedWords.put("implements", "_implements"); - reservedWords.put("import", "_import"); - reservedWords.put("instanceof", "_instanceof"); - reservedWords.put("int", "_int"); - reservedWords.put("interface", "_interface"); - reservedWords.put("long", "_long"); - reservedWords.put("native", "_native"); - reservedWords.put("new", "_new"); - reservedWords.put("null", "_null"); - reservedWords.put("package", "_package"); - reservedWords.put("private", "_private"); - reservedWords.put("protected", "_protected"); - reservedWords.put("public", "_public"); - reservedWords.put("return", "_return"); - reservedWords.put("short", "_short"); - reservedWords.put("static", "_static"); - reservedWords.put("strictfp", "_strictfp"); - reservedWords.put("super", "_super"); - reservedWords.put("switch", "_switch"); - reservedWords.put("synchronized", "_synchronized"); - reservedWords.put("this", "_this"); - reservedWords.put("throw", "_throw"); - reservedWords.put("throws", "_throws"); - reservedWords.put("transient", "_transient"); - reservedWords.put("true", "_true"); - reservedWords.put("try", "_try"); - reservedWords.put("void", "_void"); - reservedWords.put("volatile", "_volatile"); - reservedWords.put("while", "_while"); - reservedWords.put("enum", "_enum"); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/SeiGenerator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/SeiGenerator.java deleted file mode 100644 index bb68e8dee79..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/SeiGenerator.java +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.codemodel.internal.*; -import com.sun.tools.internal.ws.api.TJavaGeneratorExtension; -import com.sun.tools.internal.ws.processor.model.*; -import com.sun.tools.internal.ws.processor.model.java.JavaInterface; -import com.sun.tools.internal.ws.processor.model.java.JavaMethod; -import com.sun.tools.internal.ws.processor.model.java.JavaParameter; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBType; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.Options; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; -import com.sun.tools.internal.ws.wsdl.document.PortType; -import com.sun.tools.internal.ws.wsdl.document.Kinds; -import com.sun.tools.internal.ws.resources.GeneratorMessages; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.namespace.QName; -import javax.xml.ws.Holder; -import java.util.ArrayList; -import java.util.List; - -import org.xml.sax.Locator; - -public class SeiGenerator extends GeneratorBase{ - private String serviceNS; - private TJavaGeneratorExtension extension; - private List extensionHandlers; - - public static void generate(Model model, WsimportOptions options, ErrorReceiver receiver, TJavaGeneratorExtension... extensions){ - SeiGenerator seiGenerator = new SeiGenerator(model, options, receiver, extensions); - seiGenerator.doGeneration(); - } - - private SeiGenerator(Model model, WsimportOptions options, ErrorReceiver receiver, TJavaGeneratorExtension... extensions) { - super(model, options, receiver); - extensionHandlers = new ArrayList(); - - // register handlers for default extensions - //spec does not require generation of these annotations - // and we can infer from wsdl anyway, so lets disable it - //register(new W3CAddressingJavaGeneratorExtension()); - - for (TJavaGeneratorExtension j : extensions) - register(j); - - this.extension = new JavaGeneratorExtensionFacade(extensionHandlers.toArray(new TJavaGeneratorExtension[0])); - } - - private void write(Port port) { - JavaInterface intf = port.getJavaInterface(); - String className = Names.customJavaTypeClassName(intf); - - if (donotOverride && GeneratorUtil.classExists(options, className)) { - log("Class " + className + " exists. Not overriding."); - return; - } - - - JDefinedClass cls = null; - try { - cls = getClass(className, ClassType.INTERFACE); - } catch (JClassAlreadyExistsException e) { - QName portTypeName = - (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - Locator loc = null; - if(portTypeName != null){ - PortType pt = port.portTypes.get(portTypeName); - if(pt!=null) - loc = pt.getLocator(); - } - receiver.error(loc, GeneratorMessages.GENERATOR_SEI_CLASS_ALREADY_EXIST(intf.getName(), portTypeName)); - return; - } - // If the class has methods it has already been defined - // so skip it. - if (!cls.methods().isEmpty()) - return; - - //write class comment - JAXWS warning - JDocComment comment = cls.javadoc(); - - String ptDoc = intf.getJavaDoc(); - if(ptDoc != null){ - comment.add(ptDoc); - comment.add("\n\n"); - } - - for(String doc:getJAXWSClassComment()){ - comment.add(doc); - } - - - //@WebService - JAnnotationUse webServiceAnn = cls.annotate(cm.ref(WebService.class)); - writeWebServiceAnnotation(port, webServiceAnn); - - //@HandlerChain - writeHandlerConfig(Names.customJavaTypeClassName(port.getJavaInterface()), cls, options); - - //@SOAPBinding - writeSOAPBinding(port, cls); - - //@XmlSeeAlso - if(options.target.isLaterThan(Options.Target.V2_1)) - writeXmlSeeAlso(cls); - - for (Operation operation: port.getOperations()) { - JavaMethod method = operation.getJavaMethod(); - - //@WebMethod - JMethod m; - JDocComment methodDoc; - String methodJavaDoc = operation.getJavaDoc(); - if(method.getReturnType().getName().equals("void")){ - m = cls.method(JMod.PUBLIC, void.class, method.getName()); - methodDoc = m.javadoc(); - }else { - JAXBTypeAndAnnotation retType = method.getReturnType().getType(); - m = cls.method(JMod.PUBLIC, retType.getType(), method.getName()); - retType.annotate(m); - methodDoc = m.javadoc(); - JCommentPart ret = methodDoc.addReturn(); - ret.add("returns "+retType.getName()); - } - if(methodJavaDoc != null) - methodDoc.add(methodJavaDoc); - - writeWebMethod(operation, m); - JClass holder = cm.ref(Holder.class); - for (JavaParameter parameter: method.getParametersList()) { - JVar var; - JAXBTypeAndAnnotation paramType = parameter.getType().getType(); - if (parameter.isHolder()) { - var = m.param(holder.narrow(paramType.getType().boxify()), parameter.getName()); - }else{ - var = m.param(paramType.getType(), parameter.getName()); - } - - //annotate parameter with JAXB annotations - paramType.annotate(var); - methodDoc.addParam(var); - JAnnotationUse paramAnn = var.annotate(cm.ref(WebParam.class)); - writeWebParam(operation, parameter, paramAnn); - } - com.sun.tools.internal.ws.wsdl.document.Operation wsdlOp = operation.getWSDLPortTypeOperation(); - for(Fault fault:operation.getFaultsSet()){ - m._throws(fault.getExceptionClass()); - methodDoc.addThrows(fault.getExceptionClass()); - wsdlOp.putFault(fault.getWsdlFaultName(), fault.getExceptionClass()); - } - - //It should be the last thing to invoke after JMethod is built completely - extension.writeMethodAnnotations(wsdlOp, m); - } - } - - private void writeXmlSeeAlso(JDefinedClass cls) { - if (model.getJAXBModel().getS2JJAXBModel() != null) { - List objectFactories = model.getJAXBModel().getS2JJAXBModel().getAllObjectFactories(); - - //if there are no object facotires, dont generate @XmlSeeAlso - if(objectFactories.size() == 0) - return; - - JAnnotationUse xmlSeeAlso = cls.annotate(cm.ref(XmlSeeAlso.class)); - JAnnotationArrayMember paramArray = xmlSeeAlso.paramArray("value"); - for (JClass of : objectFactories) { - paramArray = paramArray.param(of); - } - } - - } - - private void writeWebMethod(Operation operation, JMethod m) { - Response response = operation.getResponse(); - JAnnotationUse webMethodAnn = m.annotate(cm.ref(WebMethod.class)); - String operationName = (operation instanceof AsyncOperation)? - ((AsyncOperation)operation).getNormalOperation().getName().getLocalPart(): - operation.getName().getLocalPart(); - - if(!m.name().equals(operationName)){ - webMethodAnn.param("operationName", operationName); - } - - if (operation.getSOAPAction() != null && operation.getSOAPAction().length() > 0){ - webMethodAnn.param("action", operation.getSOAPAction()); - } - - if (operation.getResponse() == null){ - m.annotate(javax.jws.Oneway.class); - }else if (!operation.getJavaMethod().getReturnType().getName().equals("void") && - operation.getResponse().getParametersList().size() > 0){ - Block block; - String resultName = null; - String nsURI = null; - if (operation.getResponse().getBodyBlocks().hasNext()) { - block = operation.getResponse().getBodyBlocks().next(); - resultName = block.getName().getLocalPart(); - if(isDocStyle || block.getLocation() == Block.HEADER){ - nsURI = block.getName().getNamespaceURI(); - } - } - - for (Parameter parameter : operation.getResponse().getParametersList()) { - if (parameter.getParameterIndex() == -1) { - if(operation.isWrapped()||!isDocStyle){ - if(parameter.getBlock().getLocation() == Block.HEADER){ - resultName = parameter.getBlock().getName().getLocalPart(); - }else{ - resultName = parameter.getName(); - } - if (isDocStyle || (parameter.getBlock().getLocation() == Block.HEADER)) { - nsURI = parameter.getType().getName().getNamespaceURI(); - } - }else if(isDocStyle){ - JAXBType t = (JAXBType)parameter.getType(); - resultName = t.getName().getLocalPart(); - nsURI = t.getName().getNamespaceURI(); - } - if(!(operation instanceof AsyncOperation)){ - JAnnotationUse wr = null; - - if(!resultName.equals("return")){ - wr = m.annotate(javax.jws.WebResult.class); - wr.param("name", resultName); - } - if((nsURI != null) && (!nsURI.equals(serviceNS) || (isDocStyle && operation.isWrapped()))){ - if(wr == null) - wr = m.annotate(javax.jws.WebResult.class); - wr.param("targetNamespace", nsURI); - } - //doclit wrapped could have additional headers - if(!(isDocStyle && operation.isWrapped()) || - (parameter.getBlock().getLocation() == Block.HEADER)){ - if(wr == null) - wr = m.annotate(javax.jws.WebResult.class); - wr.param("partName", parameter.getName()); - } - if(parameter.getBlock().getLocation() == Block.HEADER){ - if(wr == null) - wr = m.annotate(javax.jws.WebResult.class); - wr.param("header",true); - } - } - } - - } - } - - //DOC/BARE - if (!sameParamStyle) { - if(!operation.isWrapped()) { - JAnnotationUse sb = m.annotate(SOAPBinding.class); - sb.param("parameterStyle", SOAPBinding.ParameterStyle.BARE); - } - } - - if (operation.isWrapped() && operation.getStyle().equals(SOAPStyle.DOCUMENT)) { - Block reqBlock = operation.getRequest().getBodyBlocks().next(); - JAnnotationUse reqW = m.annotate(javax.xml.ws.RequestWrapper.class); - reqW.param("localName", reqBlock.getName().getLocalPart()); - reqW.param("targetNamespace", reqBlock.getName().getNamespaceURI()); - reqW.param("className", reqBlock.getType().getJavaType().getName()); - - if (response != null) { - JAnnotationUse resW = m.annotate(javax.xml.ws.ResponseWrapper.class); - Block resBlock = response.getBodyBlocks().next(); - resW.param("localName", resBlock.getName().getLocalPart()); - resW.param("targetNamespace", resBlock.getName().getNamespaceURI()); - resW.param("className", resBlock.getType().getJavaType().getName()); - } - } - } - - private boolean isMessageParam(Parameter param, Message message) { - Block block = param.getBlock(); - - return (message.getBodyBlockCount() > 0 && block.equals(message.getBodyBlocks().next())) || - (message.getHeaderBlockCount() > 0 && - block.equals(message.getHeaderBlocks().next())); - } - - private boolean isHeaderParam(Parameter param, Message message) { - if (message.getHeaderBlockCount() == 0) - return false; - - for (Block headerBlock : message.getHeaderBlocksMap().values()) - if (param.getBlock().equals(headerBlock)) - return true; - - return false; - } - - private boolean isAttachmentParam(Parameter param, Message message){ - if (message.getAttachmentBlockCount() == 0) - return false; - - for (Block attBlock : message.getAttachmentBlocksMap().values()) - if (param.getBlock().equals(attBlock)) - return true; - - return false; - } - - private boolean isUnboundParam(Parameter param, Message message){ - if (message.getUnboundBlocksCount() == 0) - return false; - - for (Block unboundBlock : message.getUnboundBlocksMap().values()) - if (param.getBlock().equals(unboundBlock)) - return true; - - return false; - } - - private void writeWebParam(Operation operation, JavaParameter javaParameter, JAnnotationUse paramAnno) { - Parameter param = javaParameter.getParameter(); - Request req = operation.getRequest(); - Response res = operation.getResponse(); - - boolean header = isHeaderParam(param, req) || - (res != null && isHeaderParam(param, res)); - - String name; - boolean isWrapped = operation.isWrapped(); - - if((param.getBlock().getLocation() == Block.HEADER) || (isDocStyle && !isWrapped)) - name = param.getBlock().getName().getLocalPart(); - else - name = param.getName(); - - paramAnno.param("name", name); - - String ns= null; - - if (isDocStyle) { - ns = param.getBlock().getName().getNamespaceURI(); // its bare nsuri - if(isWrapped){ - ns = param.getType().getName().getNamespaceURI(); - } - }else if(header){ - ns = param.getBlock().getName().getNamespaceURI(); - } - - if((ns != null) && (!ns.equals(serviceNS) || (isDocStyle && isWrapped))) - paramAnno.param("targetNamespace", ns); - - if (header) { - paramAnno.param("header", true); - } - - if (param.isINOUT()){ - paramAnno.param("mode", javax.jws.WebParam.Mode.INOUT); - }else if ((res != null) && (isMessageParam(param, res) || isHeaderParam(param, res) || isAttachmentParam(param, res) || - isUnboundParam(param,res) || param.isOUT())){ - paramAnno.param("mode", javax.jws.WebParam.Mode.OUT); - } - - //doclit wrapped could have additional headers - if(!(isDocStyle && isWrapped) || header) - paramAnno.param("partName", javaParameter.getParameter().getName()); - } - - private boolean isDocStyle = true; - private boolean sameParamStyle = true; - private void writeSOAPBinding(Port port, JDefinedClass cls) { - JAnnotationUse soapBindingAnn = null; - isDocStyle = port.getStyle() == null || port.getStyle().equals(SOAPStyle.DOCUMENT); - if(!isDocStyle){ - soapBindingAnn = cls.annotate(SOAPBinding.class); - soapBindingAnn.param("style", SOAPBinding.Style.RPC); - port.setWrapped(true); - } - if(isDocStyle){ - boolean first = true; - boolean isWrapper = true; - for(Operation operation:port.getOperations()){ - if(first){ - isWrapper = operation.isWrapped(); - first = false; - continue; - } - sameParamStyle = (isWrapper == operation.isWrapped()); - if(!sameParamStyle) - break; - } - if(sameParamStyle) - port.setWrapped(isWrapper); - } - if(sameParamStyle && !port.isWrapped()){ - if(soapBindingAnn == null) - soapBindingAnn = cls.annotate(SOAPBinding.class); - soapBindingAnn.param("parameterStyle", SOAPBinding.ParameterStyle.BARE); - } - } - - private void writeWebServiceAnnotation(Port port, JAnnotationUse wsa) { - QName name = (QName) port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - wsa.param("name", name.getLocalPart()); - wsa.param("targetNamespace", name.getNamespaceURI()); - } - - - - - public void visit(Model model) throws Exception { - for(Service s:model.getServices()){ - s.accept(this); - } - } - - public void visit(Service service) throws Exception { - String jd = model.getJavaDoc(); - if(jd != null){ - JPackage pkg = cm._package(options.defaultPackage); - pkg.javadoc().add(jd); - } - - for(Port p:service.getPorts()){ - visitPort(service, p); - } - } - - private void visitPort(Service service, Port port) { - if (port.isProvider()) { - return; // Not generating for Provider based endpoint - } - write(port); - } - - private void register(TJavaGeneratorExtension h) { - extensionHandlers.add(h); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/ServiceGenerator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/ServiceGenerator.java deleted file mode 100644 index 863139188ac..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/ServiceGenerator.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.codemodel.internal.*; -import com.sun.tools.internal.ws.processor.model.Model; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.Service; -import com.sun.tools.internal.ws.processor.model.ModelProperties; -import com.sun.tools.internal.ws.processor.model.java.JavaInterface; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.Options; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.resources.GeneratorMessages; -import com.sun.tools.internal.ws.wsdl.document.PortType; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.ws.util.JAXWSUtils; - -import javax.xml.namespace.QName; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import java.io.IOException; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Logger; - -import org.xml.sax.Locator; - - -/** - * @author WS Development Team - */ -public class ServiceGenerator extends GeneratorBase { - - public static void generate(Model model, WsimportOptions options, ErrorReceiver receiver) { - ServiceGenerator serviceGenerator = new ServiceGenerator(model, options, receiver); - serviceGenerator.doGeneration(); - } - - private ServiceGenerator(Model model, WsimportOptions options, ErrorReceiver receiver) { - super(model, options, receiver); - } - - @Override - public void visit(Service service) { - JavaInterface intf = service.getJavaInterface(); - String className = Names.customJavaTypeClassName(intf); - if (donotOverride && GeneratorUtil.classExists(options, className)) { - log("Class " + className + " exists. Not overriding."); - return; - } - - JDefinedClass cls; - try { - cls = getClass(className, ClassType.CLASS); - } catch (JClassAlreadyExistsException e) { - receiver.error(service.getLocator(), GeneratorMessages.GENERATOR_SERVICE_CLASS_ALREADY_EXIST(className, service.getName())); - return; - } - - cls._extends(javax.xml.ws.Service.class); - String serviceFieldName = JAXBRIContext.mangleNameToClassName(service.getName().getLocalPart()).toUpperCase(); - String wsdlLocationName = serviceFieldName + "_WSDL_LOCATION"; - JFieldVar urlField = cls.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, URL.class, wsdlLocationName); - - - cls.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL, Logger.class, "logger", cm.ref(Logger.class).staticInvoke("getLogger").arg(JExpr.dotclass(cm.ref(className)).invoke("getName"))); - - JClass qNameCls = cm.ref(QName.class); - JInvocation inv; - inv = JExpr._new(qNameCls); - inv.arg("namespace"); - inv.arg("localpart"); - - - JBlock staticBlock = cls.init(); - JVar urlVar = staticBlock.decl(cm.ref(URL.class), "url", JExpr._null()); - JTryBlock tryBlock = staticBlock._try(); - JVar baseUrl = tryBlock.body().decl(cm.ref(URL.class), "baseUrl"); - tryBlock.body().assign(baseUrl, JExpr.dotclass(cm.ref(className)).invoke("getResource").arg(".")); - tryBlock.body().assign(urlVar, JExpr._new(cm.ref(URL.class)).arg(baseUrl).arg(wsdlLocation)); - JCatchBlock catchBlock = tryBlock._catch(cm.ref(MalformedURLException.class)); - catchBlock.param("e"); - - catchBlock.body().directStatement("logger.warning(\"Failed to create URL for the wsdl Location: " + JExpr.quotify('\'', wsdlLocation) + ", retrying as a local file\");"); - catchBlock.body().directStatement("logger.warning(e.getMessage());"); - - staticBlock.assign(urlField, urlVar); - - //write class comment - JAXWS warning - JDocComment comment = cls.javadoc(); - - if (service.getJavaDoc() != null) { - comment.add(service.getJavaDoc()); - comment.add("\n\n"); - } - - for (String doc : getJAXWSClassComment()) { - comment.add(doc); - } - - JMethod constructor = cls.constructor(JMod.PUBLIC); - constructor.param(URL.class, "wsdlLocation"); - constructor.param(QName.class, "serviceName"); - constructor.body().directStatement("super(wsdlLocation, serviceName);"); - - constructor = cls.constructor(JMod.PUBLIC); - constructor.body().directStatement("super(" + wsdlLocationName + ", new QName(\"" + service.getName().getNamespaceURI() + "\", \"" + service.getName().getLocalPart() + "\"));"); - - //@WebService - JAnnotationUse webServiceClientAnn = cls.annotate(cm.ref(WebServiceClient.class)); - writeWebServiceClientAnnotation(service, webServiceClientAnn); - - //@HandlerChain - writeHandlerConfig(Names.customJavaTypeClassName(service.getJavaInterface()), cls, options); - - for (Port port : service.getPorts()) { - if (port.isProvider()) { - continue; // No getXYZPort() for porvider based endpoint - } - - //Get the SEI class - JType retType; - try { - retType = getClass(port.getJavaInterface().getName(), ClassType.INTERFACE); - } catch (JClassAlreadyExistsException e) { - QName portTypeName = - (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - Locator loc = null; - if (portTypeName != null) { - PortType pt = port.portTypes.get(portTypeName); - if (pt != null) - loc = pt.getLocator(); - } - receiver.error(loc, GeneratorMessages.GENERATOR_SEI_CLASS_ALREADY_EXIST(port.getJavaInterface().getName(), portTypeName)); - return; - } - - //write getXyzPort() - writeDefaultGetPort(port, retType, cls); - - //write getXyzPort(WebServicesFeature...) - if (options.target.isLaterThan(Options.Target.V2_1)) - writeGetPort(port, retType, cls); - } - } - - private void writeGetPort(Port port, JType retType, JDefinedClass cls) { - JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter()); - JDocComment methodDoc = m.javadoc(); - if (port.getJavaDoc() != null) - methodDoc.add(port.getJavaDoc()); - JCommentPart ret = methodDoc.addReturn(); - JCommentPart paramDoc = methodDoc.addParam("features"); - paramDoc.append("A list of "); - paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}"); - paramDoc.append("to configure on the proxy. Supported features not in the features parameter will have their default values."); - ret.add("returns " + retType.name()); - m.varParam(WebServiceFeature.class, "features"); - JBlock body = m.body(); - StringBuffer statement = new StringBuffer("return "); - statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); - statement.append(retType.name()); - statement.append(".class, features);"); - body.directStatement(statement.toString()); - writeWebEndpoint(port, m); - } - - private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { - String portGetter = port.getPortGetter(); - JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); - JDocComment methodDoc = m.javadoc(); - if (port.getJavaDoc() != null) - methodDoc.add(port.getJavaDoc()); - JCommentPart ret = methodDoc.addReturn(); - ret.add("returns " + retType.name()); - JBlock body = m.body(); - StringBuffer statement = new StringBuffer("return "); - statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); - statement.append(retType.name()); - statement.append(".class);"); - body.directStatement(statement.toString()); - writeWebEndpoint(port, m); - } - - private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) { - String serviceName = service.getName().getLocalPart(); - String serviceNS = service.getName().getNamespaceURI(); - wsa.param("name", serviceName); - wsa.param("targetNamespace", serviceNS); - wsa.param("wsdlLocation", wsdlLocation); - } - - private void writeWebEndpoint(Port port, JMethod m) { - JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class)); - webEndpointAnn.param("name", port.getName().getLocalPart()); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java deleted file mode 100644 index 71224850728..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.generator; - -import com.sun.codemodel.internal.JAnnotationArrayMember; -import com.sun.codemodel.internal.JAnnotationUse; -import com.sun.codemodel.internal.JClass; -import com.sun.codemodel.internal.JMethod; -import com.sun.tools.internal.ws.api.TJavaGeneratorExtension; -import com.sun.tools.internal.ws.api.wsdl.TWSDLOperation; -import com.sun.tools.internal.ws.wsdl.document.Fault; -import com.sun.tools.internal.ws.wsdl.document.Operation; - -import javax.xml.ws.Action; -import javax.xml.ws.FaultAction; -import java.util.Map; - -/** - * @author Arun Gupta - */ -public class W3CAddressingJavaGeneratorExtension extends TJavaGeneratorExtension { - @Override - public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) { - JAnnotationUse actionAnn = null; - - if (!(two instanceof Operation)) - return; - - Operation o = ((Operation)two); - - // explicit input action - if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) { - // explicitly specified - actionAnn = jMethod.annotate(Action.class); - actionAnn.param("input", o.getInput().getAction()); - } - - // explicit output action - if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) { - // explicitly specified - if (actionAnn == null) - actionAnn = jMethod.annotate(Action.class); - - actionAnn.param("output", o.getOutput().getAction()); - } - - // explicit fault action - if (o.getFaults() != null && o.getFaults().size() > 0) { - Map map = o.getFaults(); - JAnnotationArrayMember jam = null; - - for (Fault f : o.faults()) { - if (f.getAction() == null) - continue; - - if (f.getAction().equals("")) - continue; - - if (actionAnn == null) { - actionAnn = jMethod.annotate(Action.class); - } - if (jam == null) { - jam = actionAnn.paramArray("fault"); - } - final JAnnotationUse faAnn = jam.annotate(FaultAction.class); - faAnn.param("className", map.get(f.getName())); - faAnn.param("value", f.getAction()); - } - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AbstractType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AbstractType.java deleted file mode 100644 index b84bbe0a46f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AbstractType.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.model.java.JavaType; - -import javax.xml.namespace.QName; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * - * @author WS Development Team - */ -public abstract class AbstractType { - - protected AbstractType() {} - - protected AbstractType(QName name) { - this(name, null, null); - } - - protected AbstractType(QName name, String version) { - this(name, null, version); - } - - protected AbstractType(QName name, JavaType javaType) { - this(name, javaType, null); - } - - protected AbstractType(QName name, JavaType javaType, String version) { - this.name = name; - this.javaType = javaType; - this.version = version; - } - - public QName getName() { - return name; - } - - public void setName(QName name) { - this.name = name; - } - - public JavaType getJavaType() { - return javaType; - } - - public void setJavaType(JavaType javaType) { - this.javaType = javaType; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public boolean isNillable() { - return false; - } - - public boolean isSOAPType() { - return false; - } - - public boolean isLiteralType() { - return false; - } - - public Object getProperty(String key) { - if (properties == null) { - return null; - } - return properties.get(key); - } - - public void setProperty(String key, Object value) { - if (value == null) { - removeProperty(key); - return; - } - - if (properties == null) { - properties = new HashMap(); - } - properties.put(key, value); - } - - public void removeProperty(String key) { - if (properties != null) { - properties.remove(key); - } - } - - public Iterator getProperties() { - if (properties == null) { - return Collections.emptyList().iterator(); - } else { - return properties.keySet().iterator(); - } - } - - /* serialization */ - public Map getPropertiesMap() { - return properties; - } - - /* serialization */ - public void setPropertiesMap(Map m) { - properties = m; - } - - private QName name; - private JavaType javaType; - private String version = null; - private Map properties; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AsyncOperation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AsyncOperation.java deleted file mode 100644 index 9aa2642241a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AsyncOperation.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model; - -import com.sun.codemodel.internal.JClass; -import com.sun.codemodel.internal.JCodeModel; -import com.sun.tools.internal.ws.processor.model.java.JavaSimpleType; -import com.sun.tools.internal.ws.processor.model.java.JavaType; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation; -import com.sun.tools.internal.ws.wsdl.framework.Entity; - -import javax.xml.namespace.QName; - - -/** - * @author Vivek Pandey - * - * - */ -public class AsyncOperation extends Operation { - - /** - * - */ - public AsyncOperation(Entity entity) { - super(entity); - // TODO Auto-generated constructor stub - } - - /** - * @param operation - */ - public AsyncOperation(Operation operation, Entity entity) { - super(operation, entity); - this.operation = operation; - } - - /** - * @param name - */ - public AsyncOperation(QName name, Entity entity) { - super(name, entity); - // TODO Auto-generated constructor stub - } - - /** - * @return Returns the async. - */ - public boolean isAsync() { - return _async; - } - - public void setAsyncType(AsyncOperationType type) { - this._asyncOpType = type; - _async = true; - } - - public AsyncOperationType getAsyncType(){ - return _asyncOpType; - } - - public void setResponseBean(AbstractType type){ - _responseBean = type; - } - - public AbstractType getResponseBeanType(){ - return _responseBean; - } - - public JavaType getResponseBeanJavaType(){ - JCodeModel cm = _responseBean.getJavaType().getType().getType().owner(); - if(_asyncOpType.equals(AsyncOperationType.CALLBACK)){ - JClass future = cm.ref(java.util.concurrent.Future.class).narrow(cm.ref(Object.class).wildcard()); - return new JavaSimpleType(new JAXBTypeAndAnnotation(future)); - }else if(_asyncOpType.equals(AsyncOperationType.POLLING)){ - JClass polling = cm.ref(javax.xml.ws.Response.class).narrow(_responseBean.getJavaType().getType().getType().boxify()); - return new JavaSimpleType(new JAXBTypeAndAnnotation(polling)); - } - return null; - } - - public JavaType getCallBackType(){ - if(_asyncOpType.equals(AsyncOperationType.CALLBACK)){ - JCodeModel cm = _responseBean.getJavaType().getType().getType().owner(); - JClass cb = cm.ref(javax.xml.ws.AsyncHandler.class).narrow(_responseBean.getJavaType().getType().getType().boxify()); - return new JavaSimpleType(new JAXBTypeAndAnnotation(cb)); - - } - return null; - } - - public Operation getNormalOperation(){ - return operation; - } - - public void setNormalOperation(Operation operation){ - this.operation = operation; - } - - @Override public String getJavaMethodName() { - return super.getJavaMethodName() + "Async"; - } - - //Normal operation - private Operation operation; - private boolean _async; - private AsyncOperationType _asyncOpType; - private AbstractType _responseBean; - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AsyncOperationType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AsyncOperationType.java deleted file mode 100644 index 786281d1fd8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/AsyncOperationType.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model; - - - -/** - * @author Vivek Pandey - * - * Async WSDLOperation type - */ -public final class AsyncOperationType { - - public static final AsyncOperationType POLLING = new AsyncOperationType(); - public static final AsyncOperationType CALLBACK = new AsyncOperationType(); - - private AsyncOperationType() { - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Block.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Block.java deleted file mode 100644 index 690eb5d3b34..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Block.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model; - - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.document.*; - -import javax.xml.namespace.QName; - -/** - * - * @author WS Development Team - */ -public class Block extends ModelObject { - - public static final int UNBOUND = 0; - public static final int BODY = 1; - public static final int HEADER = 2; - public static final int ATTACHMENT = 3; - - public Block(QName name, AbstractType type, Entity entity) { - super(entity); - this.name = name; - this.type = type; - } - - public QName getName() { - return name; - } - - public AbstractType getType() { - return type; - } - - public void setType(AbstractType type) { - this.type = type; - } - - public int getLocation() { - return location; - } - - public void setLocation(int i) { - location = i; - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - private final QName name; - private AbstractType type; - private int location; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ExtendedModelVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ExtendedModelVisitor.java deleted file mode 100644 index e2d63deadd0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ExtendedModelVisitor.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model; - -import java.util.Iterator; - -/** - * - * A model visitor incorporating all the logic required to walk through the model. - * - * @author WS Development Team - */ -public class ExtendedModelVisitor { - - public ExtendedModelVisitor() {} - - public void visit(Model model) throws Exception { - preVisit(model); - for (Service service : model.getServices()) { - preVisit(service); - for (Port port : service.getPorts()) { - preVisit(port); - if (shouldVisit(port)) { - for (Operation operation : port.getOperations()) { - preVisit(operation); - Request request = operation.getRequest(); - if (request != null) { - preVisit(request); - for (Iterator iter4 = request.getHeaderBlocks(); - iter4.hasNext();) { - - Block block = (Block) iter4.next(); - visitHeaderBlock(block); - } - for (Iterator iter4 = request.getBodyBlocks(); - iter4.hasNext();) { - - Block block = (Block) iter4.next(); - visitBodyBlock(block); - } - for (Iterator iter4 = request.getParameters(); - iter4.hasNext();) { - - Parameter parameter = (Parameter) iter4.next(); - visit(parameter); - } - postVisit(request); - } - - Response response = operation.getResponse(); - if (response != null) { - preVisit(response); - for (Iterator iter4 = response.getHeaderBlocks(); - iter4.hasNext();) { - - Block block = (Block) iter4.next(); - visitHeaderBlock(block); - } - for (Iterator iter4 = response.getBodyBlocks(); - iter4.hasNext();) { - - Block block = (Block) iter4.next(); - visitBodyBlock(block); - } - for (Iterator iter4 = response.getParameters(); - iter4.hasNext();) { - - Parameter parameter = (Parameter) iter4.next(); - visit(parameter); - } - postVisit(response); - } - - for (Iterator iter4 = operation.getFaults(); - iter4.hasNext();) { - - Fault fault = (Fault) iter4.next(); - preVisit(fault); - visitFaultBlock(fault.getBlock()); - postVisit(fault); - } - postVisit(operation); - } - } - postVisit(port); - } - postVisit(service); - } - postVisit(model); - } - - protected boolean shouldVisit(Port port) { - return true; - } - - // these methods are intended for subclasses - protected void preVisit(Model model) throws Exception {} - protected void postVisit(Model model) throws Exception {} - protected void preVisit(Service service) throws Exception {} - protected void postVisit(Service service) throws Exception {} - protected void preVisit(Port port) throws Exception {} - protected void postVisit(Port port) throws Exception {} - protected void preVisit(Operation operation) throws Exception {} - protected void postVisit(Operation operation) throws Exception {} - protected void preVisit(Request request) throws Exception {} - protected void postVisit(Request request) throws Exception {} - protected void preVisit(Response response) throws Exception {} - protected void postVisit(Response response) throws Exception {} - protected void preVisit(Fault fault) throws Exception {} - protected void postVisit(Fault fault) throws Exception {} - protected void visitBodyBlock(Block block) throws Exception {} - protected void visitHeaderBlock(Block block) throws Exception {} - protected void visitFaultBlock(Block block) throws Exception {} - protected void visit(Parameter parameter) throws Exception {} -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Fault.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Fault.java deleted file mode 100644 index e5c1f091800..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Fault.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model; - -import com.sun.codemodel.internal.JClass; -import com.sun.tools.internal.ws.processor.generator.GeneratorUtil; -import com.sun.tools.internal.ws.processor.model.java.JavaException; -import com.sun.tools.internal.ws.wsdl.framework.Entity; - -import javax.xml.namespace.QName; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.TreeSet; - -/** - * - * @author WS Development Team - */ -public class Fault extends ModelObject { - - public Fault(Entity entity) { - super(entity); - } - - public Fault(String name, Entity entity) { - super(entity); - this.name = name; - parentFault = null; - } - - public String getName() { - return name; - } - - public void setName(String s) { - name = s; - } - - public Block getBlock() { - return block; - } - - public void setBlock(Block b) { - block = b; - } - - public JavaException getJavaException() { - return javaException; - } - - public void setJavaException(JavaException e) { - javaException = e; - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - public Fault getParentFault() { - return parentFault; - } - - public Iterator getSubfaults() { - if (subfaults.size() == 0) { - return null; - } - return subfaults.iterator(); - } - - /* serialization */ - public Set getSubfaultsSet() { - return subfaults; - } - - /* serialization */ - public void setSubfaultsSet(Set s) { - subfaults = s; - } - - public Iterator getAllFaults() { - Set allFaults = getAllFaultsSet(); - if (allFaults.size() == 0) { - return null; - } - return allFaults.iterator(); - } - - public Set getAllFaultsSet() { - Set transSet = new HashSet(); - Iterator iter = subfaults.iterator(); - while (iter.hasNext()) { - transSet.addAll(((Fault)iter.next()).getAllFaultsSet()); - } - transSet.addAll(subfaults); - return transSet; - } - - public QName getElementName() { - return elementName; - } - - public void setElementName(QName elementName) { - this.elementName = elementName; - } - - public String getJavaMemberName() { - return javaMemberName; - } - - public void setJavaMemberName(String javaMemberName) { - this.javaMemberName = javaMemberName; - } - - /** - * @return Returns the wsdlFault. - */ - public boolean isWsdlException() { - return wsdlException; - } - /** - * @param wsdlFault The wsdlFault to set. - */ - public void setWsdlException(boolean wsdlFault) { - this.wsdlException = wsdlFault; - } - - public void setExceptionClass(JClass ex){ - exceptionClass = ex; - } - - public JClass getExceptionClass(){ - return exceptionClass; - } - - private boolean wsdlException = true; - private String name; - private Block block; - private JavaException javaException; - private Fault parentFault; - private Set subfaults = new HashSet(); - private QName elementName = null; - private String javaMemberName = null; - private JClass exceptionClass; - - public String getWsdlFaultName() { - return wsdlFaultName; - } - - public void setWsdlFaultName(String wsdlFaultName) { - this.wsdlFaultName = wsdlFaultName; - } - - private String wsdlFaultName; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/HeaderFault.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/HeaderFault.java deleted file mode 100644 index 397c96439c4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/HeaderFault.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; - -import javax.xml.namespace.QName; - -public class HeaderFault extends Fault { - - public HeaderFault(Entity entity) { - super(entity); - } - - public HeaderFault(String name, Entity entity) { - super(name, entity); - } - - public QName getMessage() { - return _message; - } - - public void setMessage(QName message) { - _message = message; - } - - public String getPart() { - return _part; - } - - public void setPart(String part) { - _part = part; - } - - private QName _message; - private String _part; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Message.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Message.java deleted file mode 100644 index 117aeb35580..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Message.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.resources.ModelMessages; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * - * @author WS Development Team - */ -public abstract class Message extends ModelObject { - protected Message(com.sun.tools.internal.ws.wsdl.document.Message entity, ErrorReceiver receiver) { - super(entity); - setErrorReceiver(receiver); - } - - public void addBodyBlock(Block b) { - if (_bodyBlocks.containsKey(b.getName())) { - errorReceiver.error(getEntity().getLocator(), ModelMessages.MODEL_PART_NOT_UNIQUE(((com.sun.tools.internal.ws.wsdl.document.Message)getEntity()).getName(), b.getName())); - throw new AbortException(); - } - _bodyBlocks.put(b.getName(), b); - b.setLocation(Block.BODY); - } - - public Iterator getBodyBlocks() { - return _bodyBlocks.values().iterator(); - } - - public int getBodyBlockCount() { - return _bodyBlocks.size(); - } - - /* serialization */ - public Map getBodyBlocksMap() { - return _bodyBlocks; - } - - /* serialization */ - public void setBodyBlocksMap(Map m) { - _bodyBlocks = m; - } - - public boolean isBodyEmpty() { - return getBodyBlocks().hasNext(); - } - - public boolean isBodyEncoded() { - boolean isEncoded = false; - for (Iterator iter = getBodyBlocks(); iter.hasNext();) { - Block bodyBlock = (Block) iter.next(); - if (bodyBlock.getType().isSOAPType()) { - isEncoded = true; - } - } - return isEncoded; - } - - public void addHeaderBlock(Block b) { - if (_headerBlocks.containsKey(b.getName())) { - errorReceiver.error(getEntity().getLocator(), ModelMessages.MODEL_PART_NOT_UNIQUE(((com.sun.tools.internal.ws.wsdl.document.Message)getEntity()).getName(), b.getName())); - throw new AbortException(); - } - _headerBlocks.put(b.getName(), b); - b.setLocation(Block.HEADER); - } - - public Iterator getHeaderBlocks() { - return _headerBlocks.values().iterator(); - } - - public Collection getHeaderBlockCollection() { - return _headerBlocks.values(); - } - - public int getHeaderBlockCount() { - return _headerBlocks.size(); - } - - /* serialization */ - public Map getHeaderBlocksMap() { - return _headerBlocks; - } - - /* serialization */ - public void setHeaderBlocksMap(Map m) { - _headerBlocks = m; - } - - /** attachment block */ - public void addAttachmentBlock(Block b) { - if (_attachmentBlocks.containsKey(b.getName())) { - errorReceiver.error(getEntity().getLocator(), ModelMessages.MODEL_PART_NOT_UNIQUE(((com.sun.tools.internal.ws.wsdl.document.Message)getEntity()).getName(), b.getName())); - throw new AbortException(); - } - _attachmentBlocks.put(b.getName(), b); - b.setLocation(Block.ATTACHMENT); - } - - public void addUnboundBlock(Block b) { - if (_unboundBlocks.containsKey(b.getName())) { - return; - } - _unboundBlocks.put(b.getName(), b); - b.setLocation(Block.UNBOUND); - } - - public Iterator getUnboundBlocks() { - return _unboundBlocks.values().iterator(); - } - - /* serialization */ - public Map getUnboundBlocksMap() { - return _unboundBlocks; - } - - public int getUnboundBlocksCount() { - return _unboundBlocks.size(); - } - - /* serialization */ - public void setUnboundBlocksMap(Map m) { - _unboundBlocks = m; - } - - - public Iterator getAttachmentBlocks() { - return _attachmentBlocks.values().iterator(); - } - - public int getAttachmentBlockCount () { - return _attachmentBlocks.size(); - } - - /* serialization */ - public Map getAttachmentBlocksMap() { - return _attachmentBlocks; - } - - /* serialization */ - public void setAttachmentBlocksMap(Map m) { - _attachmentBlocks = m; - } - - public void addParameter(Parameter p) { - if (_parametersByName.containsKey(p.getName())) { - errorReceiver.error(getEntity().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(p.getName(), p.getName())); - throw new AbortException(); - } - _parameters.add(p); - _parametersByName.put(p.getName(), p); - } - - public Parameter getParameterByName(String name) { - if (_parametersByName.size() != _parameters.size()) { - initializeParametersByName(); - } - return _parametersByName.get(name); - } - - public Iterator getParameters() { - return _parameters.iterator(); - } - - /* serialization */ - public List getParametersList() { - return _parameters; - } - - /* serialization */ - public void setParametersList(List l) { - _parameters = l; - } - - private void initializeParametersByName() { - _parametersByName = new HashMap(); - if (_parameters != null) { - for (Iterator iter = _parameters.iterator(); iter.hasNext();) { - Parameter param = (Parameter) iter.next(); - if (param.getName() != null && - _parametersByName.containsKey(param.getName())) { - errorReceiver.error(getEntity().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(param.getName(), param.getName())); - throw new AbortException(); - } - _parametersByName.put(param.getName(), param); - } - } - } - - public Set getAllBlocks(){ - Set blocks = new HashSet(); - blocks.addAll(_bodyBlocks.values()); - blocks.addAll(_headerBlocks.values()); - blocks.addAll(_attachmentBlocks.values()); - return blocks; - } - - private Map _attachmentBlocks = new HashMap(); - private Map _bodyBlocks = new HashMap(); - private Map _headerBlocks = new HashMap(); - private Map _unboundBlocks = new HashMap(); - private List _parameters = new ArrayList(); - private Map _parametersByName = new HashMap(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Model.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Model.java deleted file mode 100644 index ef68703b50a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Model.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBModel; -import com.sun.tools.internal.ws.wsdl.framework.Entity; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * The model is used to represent the entire Web Service. The JAX-WS ProcessorActions can process - * this Model to generate Java artifacts such as the service interface. - * - * @author WS Development Team - */ -public class Model extends ModelObject { - - public Model(Entity entity) { - super(entity); - } - - public Model(QName name, Entity entity) { - super(entity); - this.name = name; - } - - public QName getName() { - return name; - } - - public void setName(QName n) { - name = n; - } - - public String getTargetNamespaceURI() { - return targetNamespace; - } - - public void setTargetNamespaceURI(String s) { - targetNamespace = s; - } - - public void addService(Service service) { - if (servicesByName.containsKey(service.getName())) { - throw new ModelException("model.uniqueness"); - } - services.add(service); - servicesByName.put(service.getName(), service); - } - - public Service getServiceByName(QName name) { - if (servicesByName.size() != services.size()) { - initializeServicesByName(); - } - return (Service)servicesByName.get(name); - } - - /* serialization */ - public List getServices() { - return services; - } - - /* serialization */ - public void setServices(List l) { - services = l; - } - - private void initializeServicesByName() { - servicesByName = new HashMap(); - if (services != null) { - for (Service service : services) { - if (service.getName() != null && - servicesByName.containsKey(service.getName())) { - - throw new ModelException("model.uniqueness"); - } - servicesByName.put(service.getName(), service); - } - } - } - - public void addExtraType(AbstractType type) { - extraTypes.add(type); - } - - public Iterator getExtraTypes() { - return extraTypes.iterator(); - } - - /* serialization */ - public Set getExtraTypesSet() { - return extraTypes; - } - - /* serialization */ - public void setExtraTypesSet(Set s) { - extraTypes = s; - } - - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - /** - * @return the source version - */ - public String getSource() { - return source; - } - - /** - * @param string - */ - public void setSource(String string) { - source = string; - } - - public void setJAXBModel(JAXBModel jaxBModel) { - this.jaxBModel = jaxBModel; - } - - public JAXBModel getJAXBModel() { - return jaxBModel; - } - - private QName name; - private String targetNamespace; - private List services = new ArrayList(); - private Map servicesByName = new HashMap(); - private Set extraTypes = new HashSet(); - private String source; - private JAXBModel jaxBModel = null; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelException.java deleted file mode 100644 index 4b14db94f98..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelException.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.ProcessorException; -import com.sun.xml.internal.ws.util.localization.Localizable; - -/** - * ModelException represents an exception that occurred while - * visiting service model. - * - * @see ProcessorException - * - * @author WS Development Team - */ -public class ModelException extends ProcessorException { - - public ModelException(String key, Object... args) { - super(key, args); - } - - public ModelException(Throwable throwable) { - super(throwable); - } - - public ModelException(Localizable arg) { - super("model.nestedModelError", arg); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.model"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelObject.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelObject.java deleted file mode 100644 index 1f2faebfe93..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelObject.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.xml.sax.Locator; - -/** - * - * @author WS Development Team - */ -public abstract class ModelObject { - public abstract void accept(ModelVisitor visitor) throws Exception; - - private final Entity entity; - protected ErrorReceiver errorReceiver; - - protected ModelObject(Entity entity) { - this.entity = entity; - } - - public void setErrorReceiver(ErrorReceiver errorReceiver) { - this.errorReceiver = errorReceiver; - } - - public Entity getEntity() { - return entity; - } - - public Object getProperty(String key) { - if (_properties == null) { - return null; - } - return _properties.get(key); - } - - public void setProperty(String key, Object value) { - if (value == null) { - removeProperty(key); - return; - } - - if (_properties == null) { - _properties = new HashMap(); - } - _properties.put(key, value); - } - - public void removeProperty(String key) { - if (_properties != null) { - _properties.remove(key); - } - } - - public Iterator getProperties() { - if (_properties == null) { - return Collections.emptyList().iterator(); - } else { - return _properties.keySet().iterator(); - } - } - - public Locator getLocator(){ - return entity.getLocator(); - } - - public Map getPropertiesMap() { - return _properties; - } - - public void setPropertiesMap(Map m) { - _properties = m; - } - - public String getJavaDoc() { - return javaDoc; - } - - public void setJavaDoc(String javaDoc) { - this.javaDoc = javaDoc; - } - - private String javaDoc; - private Map _properties; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelProperties.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelProperties.java deleted file mode 100644 index 9885f4bc8c8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelProperties.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -/** - * - * @author WS Development Team - */ -public interface ModelProperties { - - //to set WSDL_MODELER_NAME from inside WSDLModeler - public static final String WSDL_MODELER_NAME = - "com.sun.xml.internal.ws.processor.modeler.wsdl.WSDLModeler"; - public static final String PROPERTY_PARAM_MESSAGE_PART_NAME = - "com.sun.xml.internal.ws.processor.model.ParamMessagePartName"; - public static final String PROPERTY_ANONYMOUS_TYPE_NAME = - "com.sun.xml.internal.ws.processor.model.AnonymousTypeName"; - public static final String PROPERTY_ANONYMOUS_ARRAY_TYPE_NAME = - "com.sun.xml.internal.ws.processor.model.AnonymousArrayTypeName"; - public static final String PROPERTY_ANONYMOUS_ARRAY_JAVA_TYPE = - "com.sun.xml.internal.ws.processor.model.AnonymousArrayJavaType"; - - public static final String PROPERTY_PTIE_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.PtieClassName"; - public static final String PROPERTY_EPTFF_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.EPTFFClassName"; - public static final String PROPERTY_SED_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.SEDClassName"; - public static final String PROPERTY_WSDL_PORT_NAME = - "com.sun.xml.internal.ws.processor.model.WSDLPortName"; - public static final String PROPERTY_WSDL_PORT_TYPE_NAME = - "com.sun.xml.internal.ws.processor.model.WSDLPortTypeName"; - public static final String PROPERTY_WSDL_BINDING_NAME = - "com.sun.xml.internal.ws.processor.model.WSDLBindingName"; - public static final String PROPERTY_WSDL_MESSAGE_NAME = - "com.sun.xml.internal.ws.processor.model.WSDLMessageName"; - public static final String PROPERTY_MODELER_NAME = - "com.sun.xml.internal.ws.processor.model.ModelerName"; - public static final String PROPERTY_STUB_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.StubClassName"; - public static final String PROPERTY_STUB_OLD_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.StubOldClassName"; - public static final String PROPERTY_DELEGATE_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.DelegateClassName"; - public static final String PROPERTY_CLIENT_ENCODER_DECODER_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.ClientEncoderClassName"; - public static final String PROPERTY_CLIENT_CONTACTINFOLIST_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.ClientContactInfoListClassName"; - public static final String PROPERTY_TIE_CLASS_NAME = - "com.sun.xml.internal.ws.processor.model.TieClassName"; - public static final String PROPERTY_JAVA_PORT_NAME = - "com.sun.xml.internal.ws.processor.model.JavaPortName"; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelVisitor.java deleted file mode 100644 index 448cb66a681..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/ModelVisitor.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -/** - * - * @author WS Development Team - */ -public interface ModelVisitor { - public void visit(Model model) throws Exception; - public void visit(Service service) throws Exception; - public void visit(Port port) throws Exception; - public void visit(Operation operation) throws Exception; - public void visit(Request request) throws Exception; - public void visit(Response response) throws Exception; - public void visit(Fault fault) throws Exception; - public void visit(Block block) throws Exception; - public void visit(Parameter parameter) throws Exception; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Operation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Operation.java deleted file mode 100644 index 48c0453aeab..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Operation.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.model.java.JavaMethod; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.xml.internal.bind.api.JAXBRIContext; - -import javax.xml.namespace.QName; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -/** - * - * @author WS Development Team - */ -public class Operation extends ModelObject { - - public Operation(Entity entity) { - super(entity); - } - - public Operation(Operation operation, Entity entity){ - this(operation._name, entity); - this._style = operation._style; - this._use = operation._use; - this.customizedName = operation.customizedName; - } - public Operation(QName name, Entity entity) { - super(entity); - _name = name; - _uniqueName = name.getLocalPart(); - _faultNames = new HashSet(); - _faults = new HashSet(); - } - - public QName getName() { - return _name; - } - - public void setName(QName n) { - _name = n; - } - - public String getUniqueName() { - return _uniqueName; - } - - public void setUniqueName(String s) { - _uniqueName = s; - } - - public Request getRequest() { - return _request; - } - - public void setRequest(Request r) { - _request = r; - } - - public Response getResponse() { - return _response; - } - - public void setResponse(Response r) { - _response = r; - } - - public boolean isOverloaded() { - return !_name.getLocalPart().equals(_uniqueName); - } - - public void addFault(Fault f) { - if (_faultNames.contains(f.getName())) { - throw new ModelException("model.uniqueness"); - } - _faultNames.add(f.getName()); - _faults.add(f); - } - - public Iterator getFaults() { - return _faults.iterator(); - } - - public Set getFaultsSet() { - return _faults; - } - - /* serialization */ - public void setFaultsSet(Set s) { - _faults = s; - initializeFaultNames(); - } - - private void initializeFaultNames() { - _faultNames = new HashSet(); - if (_faults != null) { - for (Iterator iter = _faults.iterator(); iter.hasNext();) { - Fault f = (Fault) iter.next(); - if (f.getName() != null && _faultNames.contains(f.getName())) { - throw new ModelException("model.uniqueness"); - } - _faultNames.add(f.getName()); - } - } - } - - public Iterator getAllFaults() { - Set allFaults = getAllFaultsSet(); - return allFaults.iterator(); - } - - public Set getAllFaultsSet() { - Set transSet = new HashSet(); - transSet.addAll(_faults); - Iterator iter = _faults.iterator(); - Fault fault; - Set tmpSet; - while (iter.hasNext()) { - tmpSet = ((Fault)iter.next()).getAllFaultsSet(); - transSet.addAll(tmpSet); - } - return transSet; - } - - public int getFaultCount() { - return _faults.size(); - } - - public Set getAllFaultBlocks(){ - Set blocks = new HashSet(); - Iterator faults = _faults.iterator(); - while(faults.hasNext()){ - Fault f = (Fault)faults.next(); - blocks.add(f.getBlock()); - } - return blocks; - } - - public JavaMethod getJavaMethod() { - return _javaMethod; - } - - public void setJavaMethod(JavaMethod i) { - _javaMethod = i; - } - - public String getSOAPAction() { - return _soapAction; - } - - public void setSOAPAction(String s) { - _soapAction = s; - } - - public SOAPStyle getStyle() { - return _style; - } - - public void setStyle(SOAPStyle s) { - _style = s; - } - - public SOAPUse getUse() { - return _use; - } - - public void setUse(SOAPUse u) { - _use = u; - } - - public boolean isWrapped() { - return _isWrapped; - } - - public void setWrapped(boolean isWrapped) { - _isWrapped = isWrapped; - } - - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - public void setCustomizedName(String name){ - this.customizedName = name; - } - - public String getCustomizedName(){ - return customizedName; - } - - public String getJavaMethodName(){ - //if JavaMethod is created return the name - if(_javaMethod != null){ - return _javaMethod.getName(); - } - - //return the customized operation name if any without mangling - if(customizedName != null){ - return customizedName; - } - - return JAXBRIContext.mangleNameToVariableName(_name.getLocalPart()); - } - - public com.sun.tools.internal.ws.wsdl.document.Operation getWSDLPortTypeOperation(){ - return wsdlOperation; - } - - public void setWSDLPortTypeOperation(com.sun.tools.internal.ws.wsdl.document.Operation wsdlOperation){ - this.wsdlOperation = wsdlOperation; - } - - - - private String customizedName; - private boolean _isWrapped = true; - private QName _name; - private String _uniqueName; - private Request _request; - private Response _response; - private JavaMethod _javaMethod; - private String _soapAction; - private SOAPStyle _style = SOAPStyle.DOCUMENT; - private SOAPUse _use = SOAPUse.LITERAL; - private Set _faultNames; - private Set _faults; - private com.sun.tools.internal.ws.wsdl.document.Operation wsdlOperation; - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Parameter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Parameter.java deleted file mode 100644 index 1299de46d96..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Parameter.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.model.java.JavaParameter; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.document.MessagePart; - -import javax.jws.WebParam.Mode; -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author WS Development Team - */ -public class Parameter extends ModelObject { - private final String entityName; - - public Parameter(String name, Entity entity) { - super(entity); - this.name = name; - if(entity instanceof com.sun.tools.internal.ws.wsdl.document.Message){ - this.entityName = ((com.sun.tools.internal.ws.wsdl.document.Message)entity).getName(); - }else if(entity instanceof MessagePart){ - this.entityName = ((MessagePart)entity).getName(); - }else{ - this.entityName = name; - } - - } - - - public String getEntityName() { - return entityName; - } - - public String getName() { - return name; - } - - public void setName(String s) { - name = s; - } - - public JavaParameter getJavaParameter() { - return javaParameter; - } - - public void setJavaParameter(JavaParameter p) { - javaParameter = p; - } - - public AbstractType getType() { - return type; - } - - public void setType(AbstractType t) { - type = t; - } - - public String getTypeName() { - return typeName; - } - - public void setTypeName(String t) { - typeName = t; - } - - public Block getBlock() { - return block; - } - - public void setBlock(Block d) { - block = d; - } - - public Parameter getLinkedParameter() { - return link; - } - - public void setLinkedParameter(Parameter p) { - link = p; - } - - public boolean isEmbedded() { - return embedded; - } - - public void setEmbedded(boolean b) { - embedded = b; - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - private String name; - private JavaParameter javaParameter; - private AbstractType type; - private Block block; - private Parameter link; - private boolean embedded; - private String typeName; - private String customName; - private Mode mode; - - public int getParameterIndex() { - return parameterOrderPosition; - } - - public void setParameterIndex(int parameterOrderPosition) { - this.parameterOrderPosition = parameterOrderPosition; - } - - public boolean isReturn(){ - return (parameterOrderPosition == -1); - } - - // 0 is the first parameter, -1 is the return type - private int parameterOrderPosition; - /** - * @return Returns the customName. - */ - public String getCustomName() { - return customName; - } - /** - * @param customName The customName to set. - */ - public void setCustomName(String customName) { - this.customName = customName; - } - - private List annotations = new ArrayList(); - - /** - * @return Returns the annotations. - */ - public List getAnnotations() { - return annotations; - } - - - /** - * @param annotations The annotations to set. - */ - public void setAnnotations(List annotations) { - this.annotations = annotations; - } - - public void setMode(Mode mode){ - this.mode = mode; - } - - public boolean isIN(){ - return (mode == Mode.IN); - } - - public boolean isOUT(){ - return (mode == Mode.OUT); - } - - public boolean isINOUT(){ - return (mode == Mode.INOUT); - } - - - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Port.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Port.java deleted file mode 100644 index b6d727bd259..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Port.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.model.java.JavaInterface; -import com.sun.tools.internal.ws.wsdl.document.PortType; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; -import com.sun.tools.internal.ws.wsdl.framework.Entity; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author WS Development Team - */ -public class Port extends ModelObject { - - public Port(Entity entity) { - super(entity); - } - - public Port(QName name, Entity entity) { - super(entity); - _name = name; - } - - public QName getName() { - return _name; - } - - public void setName(QName n) { - _name = n; - } - - public void addOperation(Operation operation) { - _operations.add(operation); - operationsByName.put(operation.getUniqueName(), operation); - } - - public Operation getOperationByUniqueName(String name) { - if (operationsByName.size() != _operations.size()) { - initializeOperationsByName(); - } - return operationsByName.get(name); - } - - private void initializeOperationsByName() { - operationsByName = new HashMap(); - if (_operations != null) { - for (Operation operation : _operations) { - if (operation.getUniqueName() != null && - operationsByName.containsKey(operation.getUniqueName())) { - - throw new ModelException("model.uniqueness"); - } - operationsByName.put(operation.getUniqueName(), operation); - } - } - } - - /* serialization */ - public List getOperations() { - return _operations; - } - - /* serialization */ - public void setOperations(List l) { - _operations = l; - } - - public JavaInterface getJavaInterface() { - return _javaInterface; - } - - public void setJavaInterface(JavaInterface i) { - _javaInterface = i; - } - - public String getAddress() { - return _address; - } - - public void setAddress(String s) { - _address = s; - } - - public String getServiceImplName() { - return _serviceImplName; - } - - public void setServiceImplName(String name) { - _serviceImplName = name; - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - public boolean isProvider() { - JavaInterface intf = getJavaInterface(); - if (intf != null) { - String sei = intf.getName(); - if (sei.equals(javax.xml.ws.Provider.class.getName())) { - return true; - } - } - return false; - } - - /** - * XYZ_Service.getABC() method name - * - * @return Returns the portGetterName. - */ - public String getPortGetter() { - return portGetter; - } - - /** - * @param portGetterName The portGetterName to set. - */ - public void setPortGetter(String portGetterName) { - this.portGetter = portGetterName; - } - - public SOAPStyle getStyle() { - return _style; - } - - public void setStyle(SOAPStyle s) { - _style = s; - } - - public boolean isWrapped() { - return _isWrapped; - } - - public void setWrapped(boolean isWrapped) { - _isWrapped = isWrapped; - } - - private SOAPStyle _style = null; - private boolean _isWrapped = true; - - private String portGetter; - private QName _name; - private List _operations = new ArrayList(); - private JavaInterface _javaInterface; - private String _address; - private String _serviceImplName; - private Map operationsByName = new HashMap(); - public Map portTypes = new HashMap(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Request.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Request.java deleted file mode 100644 index 1c50dee5baa..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Request.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; - -/** - * - * @author WS Development Team - */ -public class Request extends Message { - - public Request(com.sun.tools.internal.ws.wsdl.document.Message entity, ErrorReceiver receiver) { - super(entity, receiver); - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Response.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Response.java deleted file mode 100644 index 19349c0ae5b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Response.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * - * @author WS Development Team - */ -public class Response extends Message { - - public Response(com.sun.tools.internal.ws.wsdl.document.Message entity, ErrorReceiver receiver) { - super(entity, receiver); - } - - public void addFaultBlock(Block b) { - if (_faultBlocks.containsKey(b.getName())) { - throw new ModelException("model.uniqueness"); - } - _faultBlocks.put(b.getName(), b); - } - - public Iterator getFaultBlocks() { - return _faultBlocks.values().iterator(); - } - - public int getFaultBlockCount () { - return _faultBlocks.size(); - } - - /* serialization */ - public Map getFaultBlocksMap() { - return _faultBlocks; - } - - public void setFaultBlocksMap(Map m) { - _faultBlocks = m; - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - private Map _faultBlocks = new HashMap(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Service.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Service.java deleted file mode 100644 index 4f2c06263cb..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/Service.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model; - -import com.sun.tools.internal.ws.processor.model.java.JavaInterface; -import com.sun.tools.internal.ws.wsdl.framework.Entity; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * - * @author WS Development Team - */ -public class Service extends ModelObject { - - public Service(Entity entity) { - super(entity); - } - - public Service(QName name, JavaInterface javaInterface, Entity entity) { - super(entity); - this.name = name; - this.javaInterface = javaInterface; - } - - public QName getName() { - return name; - } - - public void setName(QName n) { - name = n; - } - - public void addPort(Port port) { - if (portsByName.containsKey(port.getName())) { - throw new ModelException("model.uniqueness"); - } - ports.add(port); - portsByName.put(port.getName(), port); - } - - - public Port getPortByName(QName n) { - if (portsByName.size() != ports.size()) { - initializePortsByName(); - } - return (Port) portsByName.get(n); - } - - /* serialization */ - public List getPorts() { - return ports; - } - - /* serialization */ - public void setPorts(List m) { - ports = m; -// initializePortsByName(); - } - - private void initializePortsByName() { - portsByName = new HashMap(); - if (ports != null) { - for (Iterator iter = ports.iterator(); iter.hasNext();) { - Port port = (Port) iter.next(); - if (port.getName() != null && - portsByName.containsKey(port.getName())) { - - throw new ModelException("model.uniqueness"); - } - portsByName.put(port.getName(), port); - } - } - } - - public JavaInterface getJavaIntf() { - return getJavaInterface(); - } - - public JavaInterface getJavaInterface() { - return javaInterface; - } - - public void setJavaInterface(JavaInterface i) { - javaInterface = i; - } - - public void accept(ModelVisitor visitor) throws Exception { - visitor.visit(this); - } - - private QName name; - private List ports = new ArrayList(); - private Map portsByName = new HashMap(); - private JavaInterface javaInterface; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/exporter/ExternalObject.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/exporter/ExternalObject.java deleted file mode 100644 index 281ba6470f3..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/exporter/ExternalObject.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.exporter; - -import org.xml.sax.ContentHandler; - -/** - * "Opaque" object in the object graph that knows how - * to persist itself to XML. - * - * TODO: ExternalObjectReader - * - */ -public interface ExternalObject { - /** - * Type name of this object. This will be used - * when loading the object back from XML. - */ - String getType(); - - /** - * Saves the object into XML. - */ - void saveTo(ContentHandler receiver); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaArrayType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaArrayType.java deleted file mode 100644 index 1c172f57933..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaArrayType.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -/** - * - * @author WS Development Team - */ -public class JavaArrayType extends JavaType { - - public JavaArrayType() { - } - - public JavaArrayType(String name) { - super(name, true, "null"); - } - - public JavaArrayType(String name, String elementName, - JavaType elementType) { - - super(name, true, "null"); - this.elementName = elementName; - this.elementType = elementType; - } - - public String getElementName() { - return elementName; - } - - public void setElementName(String name) { - elementName = name; - } - - public JavaType getElementType() { - return elementType; - } - - public void setElementType(JavaType type) { - elementType = type; - } - - // bug fix:4904604 - public String getSOAPArrayHolderName() { - return soapArrayHolderName; - } - - public void setSOAPArrayHolderName(String holderName) { - this.soapArrayHolderName = holderName; - } - - private String elementName; - private JavaType elementType; - private String soapArrayHolderName; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaException.java deleted file mode 100644 index 343d47bd237..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -/** - * - * @author WS Development Team - */ -public class JavaException extends JavaStructureType { - - public JavaException() {} - - public JavaException(String name, boolean present, Object owner) { - super(name, present, owner); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaInterface.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaInterface.java deleted file mode 100644 index 11f98f8c190..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaInterface.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -import com.sun.tools.internal.ws.processor.model.ModelException; -import com.sun.tools.internal.ws.util.ClassNameInfo; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * - * @author WS Development Team - */ -public class JavaInterface { - - public JavaInterface() {} - - public JavaInterface(String name) { - this(name, null); - } - - public JavaInterface(String name, String impl) { - this.realName = name; - this.name = name.replace('$', '.'); - this.impl = impl; - } - - public String getName() { - return name; - } - - public String getFormalName() { - return name; - } - - public void setFormalName(String s) { - name = s; - } - - public String getRealName() { - return realName; - } - - public void setRealName(String s) { - realName = s; - } - - public String getImpl() { - return impl; - } - - public void setImpl(String s) { - impl = s; - } - - public Iterator getMethods() { - return methods.iterator(); - } - - public boolean hasMethod(JavaMethod method) { - for (int i=0; i parameters = new ArrayList(); - private final List exceptions = new ArrayList(); - private final WsimportOptions options; - private JavaType returnType; - - public JavaMethod(String name, WsimportOptions options, ErrorReceiver receiver) { - this.name = name; - this.returnType = null; - this.errorReceiver = receiver; - this.options = options; - } - - public String getName() { - return name; - } - - public JavaType getReturnType() { - return returnType; - } - - public void setReturnType(JavaType returnType) { - this.returnType = returnType; - } - - private boolean hasParameter(String paramName) { - for (JavaParameter parameter : parameters) { - if (paramName.equals(parameter.getName())) { - return true; - } - } - return false; - } - - private Parameter getParameter(String paramName){ - for (JavaParameter parameter : parameters) { - if (paramName.equals(parameter.getName())) { - return parameter.getParameter(); - } - } - return null; - } - - public void addParameter(JavaParameter param) { - // verify that this member does not already exist - if (hasParameter(param.getName())) { - if(options.isExtensionMode()){ - param.setName(getUniqueName(param.getName())); - }else{ - Parameter duplicParam = getParameter(param.getName()); - if(param.getParameter().isEmbedded()){ - errorReceiver.error(param.getParameter().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE_WRAPPER(param.getName(), param.getParameter().getEntityName())); - errorReceiver.error(duplicParam.getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE_WRAPPER(param.getName(), duplicParam.getEntityName())); - }else{ - errorReceiver.error(param.getParameter().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(param.getName(), param.getParameter().getEntityName())); - errorReceiver.error(duplicParam.getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(param.getName(), duplicParam.getEntityName())); - } - return; - } - } - parameters.add(param); - } - - public List getParametersList() { - return parameters; - } - - public void addException(String exception) { - // verify that this exception does not already exist - if (!exceptions.contains(exception)) { - exceptions.add(exception); - } - } - - /** TODO: NB uses it, remove it once we expose it thru some API **/ - public Iterator getExceptions() { - return exceptions.iterator(); - } - - private String getUniqueName(String param){ - int parmNum = 0; - while(hasParameter(param)){ - param = param + Integer.toString(parmNum++); - } - return param; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaParameter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaParameter.java deleted file mode 100644 index cebe5366808..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaParameter.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -import com.sun.tools.internal.ws.processor.model.Parameter; - -/** - * - * @author WS Development Team - */ -public class JavaParameter { - - public JavaParameter() {} - - public JavaParameter(String name, JavaType type, Parameter parameter) { - this(name, type, parameter, false); - } - - public JavaParameter(String name, JavaType type, Parameter parameter, - boolean holder) { - - this.name = name; - this.type = type; - this.parameter = parameter; - this.holder = holder; - } - - public String getName() { - return name; - } - - public void setName(String s) { - name = s; - } - - public JavaType getType() { - return type; - } - - public void setType(JavaType t) { - type = t; - } - - public Parameter getParameter() { - return parameter; - } - - public void setParameter(Parameter p) { - parameter = p; - } - - public boolean isHolder() { - return holder; - } - - public void setHolder(boolean b) { - holder = b; - } - - public String getHolderName() { - return holderName; - } - - public void setHolderName(String holderName) { - this.holderName = holderName; - } - - private String name; - private JavaType type; - private Parameter parameter; - private boolean holder; - private String holderName; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaSimpleType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaSimpleType.java deleted file mode 100644 index 720691400ca..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaSimpleType.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation; - -/** - * - * @author WS Development Team - */ -public class JavaSimpleType extends JavaType { - - public JavaSimpleType() {} - - public JavaSimpleType(String name, String initString) { - super(name, true, initString); - } - - public JavaSimpleType(JAXBTypeAndAnnotation jtype) { - super(jtype); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaStructureMember.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaStructureMember.java deleted file mode 100644 index f2c92ded4b2..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaStructureMember.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -/** - * - * @author WS Development Team - */ -public class JavaStructureMember { - - public JavaStructureMember() {} - - public JavaStructureMember(String name, JavaType type, Object owner) { - this(name, type, owner, false); - } - public JavaStructureMember(String name, JavaType type, - Object owner, boolean isPublic) { - - this.name = name; - this.type = type; - this.owner = owner; - this.isPublic = isPublic; - constructorPos = -1; - } - - public String getName() { - return name; - } - - public void setName(String s) { - name = s; - } - - public JavaType getType() { - return type; - } - - public void setType(JavaType t) { - type = t; - } - - public boolean isPublic() { - return isPublic; - } - - public void setPublic(boolean b) { - isPublic = b; - } - - public boolean isInherited() { - return isInherited; - } - - public void setInherited(boolean b) { - isInherited = b; - } - - public String getReadMethod() { - return readMethod; - } - - public void setReadMethod(String readMethod) { - this.readMethod = readMethod; - } - - public String getWriteMethod() { - return writeMethod; - } - - public void setWriteMethod(String writeMethod) { - this.writeMethod = writeMethod; - } - - public String getDeclaringClass() { - return declaringClass; - } - public void setDeclaringClass(String declaringClass) { - this.declaringClass = declaringClass; - } - - public Object getOwner() { - return owner; - } - - public void setOwner(Object owner) { - this.owner = owner; - } - - public int getConstructorPos() { - return constructorPos; - } - - public void setConstructorPos(int idx) { - constructorPos = idx; - } - - private String name; - private JavaType type; - private boolean isPublic = false; - private boolean isInherited = false; - private String readMethod; - private String writeMethod; - private String declaringClass; - private Object owner; - private int constructorPos; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaStructureType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaStructureType.java deleted file mode 100644 index c2df0d563e9..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaStructureType.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -import com.sun.tools.internal.ws.processor.model.ModelException; - -import java.util.*; - -/** - * - * @author WS Development Team - */ -public class JavaStructureType extends JavaType { - - public JavaStructureType() {} - - public JavaStructureType(String name, boolean present, Object owner) { - super(name, present, "null"); - this.owner = owner; - } - - public void add(JavaStructureMember m) { - if (membersByName.containsKey(m.getName())) { - throw new ModelException("model.uniqueness.javastructuretype", - new Object[] {m.getName(), getRealName()}); - } - members.add(m); - membersByName.put(m.getName(), m); - } - - - public JavaStructureMember getMemberByName(String name) { - if (membersByName.size() != members.size()) { - initializeMembersByName(); - } - return membersByName.get(name); - } - - public Iterator getMembers() { - return members.iterator(); - } - - public int getMembersCount() { - return members.size(); - } - - /* serialization */ - public List getMembersList() { - return members; - } - - /* serialization */ - public void setMembersList(List l) { - members = l; - } - - private void initializeMembersByName() { - membersByName = new HashMap(); - if (members != null) { - for (JavaStructureMember m : members) { - if (m.getName() != null && - membersByName.containsKey(m.getName())) { - - throw new ModelException("model.uniqueness"); - } - membersByName.put(m.getName(), m); - } - } - } - - public boolean isAbstract() { - return isAbstract; - } - - public void setAbstract(boolean isAbstract) { - this.isAbstract = isAbstract; - } - - public JavaStructureType getSuperclass() { - return superclass; - } - - public void setSuperclass(JavaStructureType superclassType) { - superclass = superclassType; - } - - public void addSubclass(JavaStructureType subclassType) { - subclasses.add(subclassType); - subclassType.setSuperclass(this); - } - - public Iterator getSubclasses() { - if (subclasses == null || subclasses.size() == 0) { - return null; - } - return subclasses.iterator(); - } - - public Set getSubclassesSet() { - return subclasses; - } - - /* serialization */ - public void setSubclassesSet(Set s) { - subclasses = s; - for (Iterator iter = s.iterator(); iter.hasNext();) { - ((JavaStructureType) iter.next()).setSuperclass(this); - } - } - - public Iterator getAllSubclasses() { - Set subs = getAllSubclassesSet(); - if (subs.size() == 0) { - return null; - } - return subs.iterator(); - } - - public Set getAllSubclassesSet() { - Set transitiveSet = new HashSet(); - Iterator subs = subclasses.iterator(); - while (subs.hasNext()) { - transitiveSet.addAll( - ((JavaStructureType)subs.next()).getAllSubclassesSet()); - } - transitiveSet.addAll(subclasses); - return transitiveSet; - } - - public Object getOwner() { - - // usually a SOAPStructureType - return owner; - } - - public void setOwner(Object owner) { - - // usually a SOAPStructureType - this.owner = owner; - } - - private List members = new ArrayList(); - private Map membersByName = new HashMap(); - - // known subclasses of this type - private Set subclasses = new HashSet(); - private JavaStructureType superclass; - - // usually a SOAPStructureType - private Object owner; - private boolean isAbstract = false; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaType.java deleted file mode 100644 index 89721ea49d1..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/java/JavaType.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.model.java; - -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation; - -/** - * - * @author WS Development Team - */ -public abstract class JavaType { - - private String name; - private String realName; - private boolean present; - private boolean holder; - private boolean holderPresent; - private String initString; - private String holderName; - private JAXBTypeAndAnnotation type; - - public JavaType() {} - - public JavaType(JAXBTypeAndAnnotation type){ - this.type = type; - init(type.getName(), false, null, null); - } - - public JavaType(String name, boolean present, String initString) { - init(name, present, initString, null); - } - - public JavaType(String name, boolean present, String initString, - String holderName) { - - init(name, present, initString, holderName); - } - - public JAXBTypeAndAnnotation getType(){ - return type; - } - - private void init(String name, boolean present, String initString, - String holderName) { - - this.realName = name; - this.name = name.replace('$', '.'); - this.present = present; - this.initString = initString; - this.holderName = holderName; - holder = holderName != null; - } - - public String getName() { - return name; - } - - public void doSetName(String name) { - - // renamed to avoid creating a "name" property with broken semantics - this.realName = name; - this.name = name.replace('$', '.'); - } - - public String getRealName() { - return realName; - } - - /* serialization */ - public void setRealName(String s) { - realName = s; - } - - public String getFormalName() { - return name; - } - - public void setFormalName(String s) { - name = s; - } - - public boolean isPresent() { - return present; - } - - /* serialization */ - public void setPresent(boolean b) { - present = b; - } - - public boolean isHolder() { - return holder; - } - - public void setHolder(boolean holder) { - this.holder = holder; - } - - public boolean isHolderPresent() { - return holderPresent; - } - public void setHolderPresent(boolean holderPresent) { - this.holderPresent = holderPresent; - } - - public String getInitString() { - return initString; - } - - /* serialization */ - public void setInitString(String s) { - initString = s; - } - - public String getHolderName() { - return holderName; - } - - public void setHolderName(String holderName) { - this.holderName = holderName; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBElementMember.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBElementMember.java deleted file mode 100644 index 6a93252a902..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBElementMember.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.ws.processor.model.java.JavaStructureMember; - -import javax.xml.namespace.QName; - -/** - * @author Kathy Walsh, Vivek Pandey - * - * - */ - -public class JAXBElementMember { - public JAXBElementMember() { - } - public JAXBElementMember(QName name, JAXBType type) { - this(name, type, null); - } - public JAXBElementMember(QName name, JAXBType type, - JavaStructureMember javaStructureMember) { - _name = name; - _type = type; - _javaStructureMember = javaStructureMember; - } - public QName getName() { - return _name; - } - public void setName(QName n) { - _name = n; - } - public JAXBType getType() { - return _type; - } - public void setType(JAXBType t) { - _type = t; - } - public boolean isRepeated() { - return _repeated; - } - public void setRepeated(boolean b) { - _repeated = b; - } - public JavaStructureMember getJavaStructureMember() { - return _javaStructureMember; - } - public void setJavaStructureMember(JavaStructureMember javaStructureMember) { - _javaStructureMember = javaStructureMember; - } - public boolean isInherited() { - return isInherited; - } - public void setInherited(boolean b) { - isInherited = b; - } - public JAXBProperty getProperty() { - if(_prop == null && _type != null) { - for (JAXBProperty prop: _type.getWrapperChildren()){ - if(prop.getElementName().equals(_name)) - setProperty(prop); - } - } - return _prop; - } - public void setProperty(JAXBProperty prop) { - _prop = prop; - } - - private QName _name; - private JAXBType _type; - private JavaStructureMember _javaStructureMember; - private boolean _repeated; - private boolean isInherited = false; - private JAXBProperty _prop; - private static final String JAXB_UNIQUE_PARRAM = "__jaxbUniqueParam_"; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBMapping.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBMapping.java deleted file mode 100644 index 17e7d2e27e6..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBMapping.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.xjc.api.Mapping; -import com.sun.tools.internal.xjc.api.Property; -import com.sun.tools.internal.xjc.api.TypeAndAnnotation; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kohsuke Kawaguchi, Vivek Pandey - */ -public class JAXBMapping { - - /** - * @see Mapping#getElement() - */ - private QName elementName; - - /** - * - */ - private JAXBTypeAndAnnotation type; - - /** - * @see Mapping#getWrapperStyleDrilldown() - */ - private List wrapperStyleDrilldown; - - /** - * Default constructor for the persistence. - */ - public JAXBMapping() {} - - /** - * Constructor that fills in the values from the given raw model - */ - JAXBMapping( com.sun.tools.internal.xjc.api.Mapping rawModel ) { - elementName = rawModel.getElement(); - TypeAndAnnotation typeAndAnno = rawModel.getType(); - type = new JAXBTypeAndAnnotation(typeAndAnno); - List list = rawModel.getWrapperStyleDrilldown(); - if(list==null) - wrapperStyleDrilldown = null; - else { - wrapperStyleDrilldown = new ArrayList(list.size()); - for( Property p : list ) - wrapperStyleDrilldown.add(new JAXBProperty(p)); - } - - } - - /** - * @see Mapping#getElement() - */ - public QName getElementName() { - return elementName; - } - - public void setElementName(QName elementName) { - this.elementName = elementName; - } - - - public JAXBTypeAndAnnotation getType() { - return type; - } - - /** - * @see Mapping#getWrapperStyleDrilldown() - */ - public List getWrapperStyleDrilldown() { - return wrapperStyleDrilldown; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBModel.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBModel.java deleted file mode 100644 index 0a16d495925..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBModel.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.xjc.api.J2SJAXBModel; -import com.sun.tools.internal.xjc.api.Mapping; -import com.sun.tools.internal.xjc.api.S2JJAXBModel; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * Root of the JAXB Model. - * - *

    - * This is just a wrapper around a list of {@link JAXBMapping}s. - * - * @author Kohsuke Kawaguchi, Vivek Pandey - */ -public class JAXBModel { - - /** - * All the mappings known to this model. - */ - private List mappings; - - // index for faster access. - private final Map byQName = new HashMap(); - private final Map byClassName = new HashMap(); - - private com.sun.tools.internal.xjc.api.JAXBModel rawJAXBModel; - - public com.sun.tools.internal.xjc.api.JAXBModel getRawJAXBModel() { - return rawJAXBModel; - } - - /** - * @return Schema to Java model - */ - public S2JJAXBModel getS2JJAXBModel(){ - if(rawJAXBModel instanceof S2JJAXBModel) - return (S2JJAXBModel)rawJAXBModel; - return null; - } - - /** - * @return Java to Schema JAXBModel - */ - public J2SJAXBModel getJ2SJAXBModel(){ - if(rawJAXBModel instanceof J2SJAXBModel) - return (J2SJAXBModel)rawJAXBModel; - return null; - } - - - /** - * Default constructor for the persistence. - */ - public JAXBModel() {} - - /** - * Constructor that fills in the values from the given raw model - */ - public JAXBModel( com.sun.tools.internal.xjc.api.JAXBModel rawModel ) { - this.rawJAXBModel = rawModel; - if(rawModel instanceof S2JJAXBModel){ - S2JJAXBModel model = (S2JJAXBModel)rawModel; - List ms = new ArrayList(model.getMappings().size()); - for( Mapping m : model.getMappings()) - ms.add(new JAXBMapping(m)); - setMappings(ms); - } - } - - /** - */ - public List getMappings() { - return mappings; - } - - //public void setMappings(List mappings) { - public void setMappings(List mappings) { - this.mappings = mappings; - byQName.clear(); - byClassName.clear(); - for( JAXBMapping m : mappings ) { - byQName.put(m.getElementName(),m); - byClassName.put(m.getType().getName(),m); - } - } - - /** - */ - public JAXBMapping get( QName elementName ) { - return byQName.get(elementName); - } - - /** - */ - public JAXBMapping get( String className ) { - return byClassName.get(className); - } - - - /** - * - * @return set of full qualified class names that jaxb will generate - */ - public Set getGeneratedClassNames() { - return generatedClassNames; - } - - public void setGeneratedClassNames(Set generatedClassNames) { - this.generatedClassNames = generatedClassNames; - } - - private Set generatedClassNames; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBProperty.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBProperty.java deleted file mode 100644 index 3fe9ed77aed..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBProperty.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.xjc.api.Property; - -import javax.xml.namespace.QName; - -/** - * @author Kohsuke Kawaguchi - */ -public class JAXBProperty { - - /** - * @see Property#name() - */ - private String name; - - private JAXBTypeAndAnnotation type; - /** - * @see Property#elementName() - */ - private QName elementName; - - /** - * Default constructor for the persistence. - */ - public JAXBProperty() {} - - /** - * Constructor that fills in the values from the given raw model - */ - JAXBProperty( Property prop ) { - this.name = prop.name(); - this.type = new JAXBTypeAndAnnotation(prop.type()); - this.elementName = prop.elementName(); - } - - /** - * @see Property#name() - */ - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public JAXBTypeAndAnnotation getType() { - return type; - } - - /** - * @see Property#elementName() - */ - public QName getElementName() { - return elementName; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBStructuredType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBStructuredType.java deleted file mode 100644 index a9dbdf32fbe..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBStructuredType.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.ws.processor.model.ModelException; -import com.sun.tools.internal.ws.processor.model.java.JavaStructureType; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * Top-level binding between JAXB generated Java type - * and XML Schema element declaration. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class JAXBStructuredType extends JAXBType { - - public JAXBStructuredType(JAXBType jaxbType){ - super(jaxbType); - } - - public JAXBStructuredType() {} - - public JAXBStructuredType(QName name) { - this(name, null); - } - - public JAXBStructuredType(QName name, JavaStructureType javaType) { - super(name, javaType); - } - - public void add(JAXBElementMember m) { - if (_elementMembersByName.containsKey(m.getName())) { - throw new ModelException("model.uniqueness"); - } - _elementMembers.add(m); - if (m.getName() != null) { - _elementMembersByName.put(m.getName().getLocalPart(), m); - } - } - - public Iterator getElementMembers() { - return _elementMembers.iterator(); - } - - public int getElementMembersCount() { - return _elementMembers.size(); - } - - /* serialization */ - public List getElementMembersList() { - return _elementMembers; - } - - /* serialization */ - public void setElementMembersList(List l) { - _elementMembers = l; - } - - public void addSubtype(JAXBStructuredType type) { - if (_subtypes == null) { - _subtypes = new HashSet(); - } - _subtypes.add(type); - type.setParentType(this); - } - - public Iterator getSubtypes() { - if (_subtypes != null) { - return _subtypes.iterator(); - } - return null; - } - - /* (non-Javadoc) - * @see JAXBType#isUnwrapped() - */ - public boolean isUnwrapped() { - return true; - } - /* serialization */ - public Set getSubtypesSet() { - return _subtypes; - } - - /* serialization */ - public void setSubtypesSet(Set s) { - _subtypes = s; - } - - public void setParentType(JAXBStructuredType parent) { - if (_parentType != null && - parent != null && - !_parentType.equals(parent)) { - - throw new ModelException("model.parent.type.already.set", - new Object[] { getName().toString(), - _parentType.getName().toString(), - parent.getName().toString()}); - } - this._parentType = parent; - } - - public JAXBStructuredType getParentType() { - return _parentType; - } - - - private List _elementMembers = new ArrayList(); - private Map _elementMembersByName = new HashMap(); - private Set _subtypes = null; - private JAXBStructuredType _parentType = null; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBType.java deleted file mode 100644 index 0d09383a280..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBType.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.ws.processor.model.AbstractType; -import com.sun.tools.internal.ws.processor.model.java.JavaType; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - -/** - * Top-level binding between JAXB generated Java type - * and XML Schema element declaration. - * - * @author - * Vivek Pandey - */ -public class JAXBType extends AbstractType{ - public JAXBType(JAXBType jaxbType){ - setName(jaxbType.getName()); - this.jaxbMapping = jaxbType.getJaxbMapping(); - this.jaxbModel = jaxbType.getJaxbModel(); - init(); - } - - public JAXBType(){} - - public JAXBType(QName name, JavaType type){ - super(name, type); - } - - public JAXBType(QName name, JavaType type, JAXBMapping jaxbMapping, JAXBModel jaxbModel){ - super(name, type); - this.jaxbMapping = jaxbMapping; - this.jaxbModel = jaxbModel; - init(); - } - - public void accept(JAXBTypeVisitor visitor) throws Exception { - visitor.visit(this); - } - - private void init() { - if (jaxbMapping != null) - wrapperChildren = jaxbMapping.getWrapperStyleDrilldown(); - else - wrapperChildren = new ArrayList(); - } - - public boolean isUnwrappable(){ - return jaxbMapping != null && jaxbMapping.getWrapperStyleDrilldown() != null; - } - - public boolean hasWrapperChildren(){ - return wrapperChildren.size() > 0; - } - - public boolean isLiteralType() { - return true; - } - - public List getWrapperChildren(){ - return wrapperChildren; - } - - public void setWrapperChildren(List children) { - wrapperChildren = children; - } - - public JAXBMapping getJaxbMapping() { - return jaxbMapping; - } - - public void setJaxbMapping(JAXBMapping jaxbMapping) { - this.jaxbMapping = jaxbMapping; - init(); - } - - public void setUnwrapped(boolean unwrapped) { - this.unwrapped = unwrapped; - } - - public boolean isUnwrapped() { - return unwrapped; - } - - private JAXBMapping jaxbMapping; - - public JAXBModel getJaxbModel() { - return jaxbModel; - } - - public void setJaxbModel(JAXBModel jaxbModel) { - this.jaxbModel = jaxbModel; - } - - private JAXBModel jaxbModel; - private boolean unwrapped = false; - private List wrapperChildren; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java deleted file mode 100644 index 07be64ed56a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.codemodel.internal.JAnnotatable; -import com.sun.codemodel.internal.JType; -import com.sun.tools.internal.xjc.api.TypeAndAnnotation; - -/** - * Holds JAXB JType and TypeAndAnnotation. This provides abstration over - * types from JAXBMapping and Property. - */ -public class JAXBTypeAndAnnotation { - TypeAndAnnotation typeAnn; - JType type; - - public JAXBTypeAndAnnotation(TypeAndAnnotation typeAnn) { - this.typeAnn = typeAnn; - this.type = typeAnn.getTypeClass(); - } - - public JAXBTypeAndAnnotation(JType type) { - this.type = type; - } - - public JAXBTypeAndAnnotation(TypeAndAnnotation typeAnn, JType type) { - this.typeAnn = typeAnn; - this.type = type; - } - - public void annotate(JAnnotatable typeVar) { - if(typeAnn != null) - typeAnn.annotate(typeVar); - } - - public JType getType() { - return type; - } - - public String getName(){ - return type.fullName(); - } - - public TypeAndAnnotation getTypeAnn() { - return typeAnn; - } - - public void setTypeAnn(TypeAndAnnotation typeAnn) { - this.typeAnn = typeAnn; - } - - public void setType(JType type) { - this.type = type; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBTypeVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBTypeVisitor.java deleted file mode 100644 index e1926580680..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/JAXBTypeVisitor.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -/** - * @author Vivek Pandey - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public interface JAXBTypeVisitor { - public void visit(JAXBType type) throws Exception; - public void visit(RpcLitStructure type) throws Exception; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/RpcLitMember.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/RpcLitMember.java deleted file mode 100644 index 70fb9188582..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/RpcLitMember.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.ws.processor.model.AbstractType; - -import javax.xml.namespace.QName; - -/** - * @author Vivek Pandey - * - * Represents RpcLit member parts - */ -public class RpcLitMember extends AbstractType { - - //wsdl:part type attribute java mapped object - private String javaTypeName; - private QName schemaTypeName; - - /** - * - */ - public RpcLitMember() { - super(); - // TODO Auto-generated constructor stub - } - public RpcLitMember(QName name, String javaTypeName){ - setName(name); - this.javaTypeName = javaTypeName; - } - public RpcLitMember(QName name, String javaTypeName, QName schemaTypeName){ - setName(name); - this.javaTypeName = javaTypeName; - this.schemaTypeName = schemaTypeName; - } - - /** - * @return Returns the type. - */ - public String getJavaTypeName() { - return javaTypeName; - } - /** - * @param type The type to set. - */ - public void setJavaTypeName(String type) { - this.javaTypeName = type; - } - - /** - * @return Returns the type. - */ - public QName getSchemaTypeName() { - return schemaTypeName; - } - /** - * @param type The type to set. - */ - public void setSchemaTypeName(QName type) { - this.schemaTypeName = type; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/RpcLitStructure.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/RpcLitStructure.java deleted file mode 100644 index 095eb682837..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/RpcLitStructure.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -import com.sun.tools.internal.ws.processor.model.AbstractType; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Vivek Pandey - * - * RPC Structure that will be used to create RpcLitPayload latter - */ -public class RpcLitStructure extends AbstractType { - private List members; - private JAXBModel jaxbModel; - - /** - * - */ - public RpcLitStructure() { - super(); - // TODO Auto-generated constructor stub - } - public RpcLitStructure(QName name, JAXBModel jaxbModel){ - setName(name); - this.jaxbModel = jaxbModel; - this.members = new ArrayList(); - - } - public RpcLitStructure(QName name, JAXBModel jaxbModel, List members){ - setName(name); - this.members = members; - } - - public void accept(JAXBTypeVisitor visitor) throws Exception { - visitor.visit(this); - } - - public List getRpcLitMembers(){ - return members; - } - - public List setRpcLitMembers(List members){ - return this.members = members; - } - - public void addRpcLitMember(RpcLitMember member){ - members.add(member); - } - /** - * @return Returns the jaxbModel. - */ - public JAXBModel getJaxbModel() { - return jaxbModel; - } - /** - * @param jaxbModel The jaxbModel to set. - */ - public void setJaxbModel(JAXBModel jaxbModel) { - this.jaxbModel = jaxbModel; - } - - public boolean isLiteralType() { - return true; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/Util.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/Util.java deleted file mode 100644 index c96e2c42b15..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/model/jaxb/Util.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.model.jaxb; - -/** - * @author Kohsuke Kawaguchi - */ -class Util { - /** - * Replaces the marcros in the first string by the actual given arguments. - */ - static String replace( String macro, String... args ) { - int len = macro.length(); - StringBuilder buf = new StringBuilder(len); - for( int i=0; i seiContextMap; - private int round = 1; - private boolean modelCompleted = false; - - /** Creates a new instance of AnnotationProcessorContext */ - public AnnotationProcessorContext() { - seiContextMap = new HashMap(); - } - - public void addSEIContext(String seiName, SEIContext seiContext) { - seiContextMap.put(seiName, seiContext); - } - - public SEIContext getSEIContext(String seiName) { - SEIContext context = seiContextMap.get(seiName); - if (context == null) { - context = new SEIContext(seiName); - addSEIContext(seiName, context); - } - return context; - } - - public SEIContext getSEIContext(TypeDeclaration d) { - SEIContext context = getSEIContext(d.getQualifiedName()); - return context; - } - - public Collection getSEIContexts() { - return seiContextMap.values(); - } - - public int getRound() { - return round; - } - - public void incrementRound() { - round++; - } - - public static boolean isEncoded(Model model) { - if (model == null) - return false; - for (Service service : model.getServices()) { - for (Port port : service.getPorts()) { - for (Operation operation : port.getOperations()) { - if (operation.getUse() != null && operation.getUse().equals(SOAPUse.LITERAL)) - return false; - } - } - } - return true; - } - - public void setModelCompleted(boolean modelCompleted) { - this.modelCompleted = modelCompleted; - } - - public boolean isModelCompleted() { - return modelCompleted; - } - - public static class SEIContext { - private Map reqOperationWrapperMap; - private Map resOperationWrapperMap; - private Map exceptionBeanMap; - - private String seiName; - private String seiImplName; - private boolean implementsSEI = false; - private String namespaceURI = null; - - public SEIContext(String seiName) { - reqOperationWrapperMap = new HashMap(); - resOperationWrapperMap = new HashMap(); - exceptionBeanMap = new HashMap(); - this.seiName = seiName; - } - - public void setImplementsSEI(boolean implementsSEI) { - this.implementsSEI = implementsSEI; - } - - public boolean getImplementsSEI() { - return implementsSEI; - } - - public void setNamespaceURI(String namespaceURI) { - this.namespaceURI = namespaceURI; - } - - public String getNamespaceURI() { - return namespaceURI; - } - - public String getSEIImplName() { - return seiImplName; - } - - public void setSEIImplName(String implName) { - seiImplName = implName; - } - - public void setReqWrapperOperation(MethodDeclaration method, WrapperInfo wrapperInfo) { - reqOperationWrapperMap.put(methodToString(method), wrapperInfo); - } - - public WrapperInfo getReqOperationWrapper(MethodDeclaration method) { - return reqOperationWrapperMap.get(methodToString(method)); - } - - public void setResWrapperOperation(MethodDeclaration method, WrapperInfo wrapperInfo) { - resOperationWrapperMap.put(methodToString(method), wrapperInfo); - } - - public WrapperInfo getResOperationWrapper(MethodDeclaration method) { - return resOperationWrapperMap.get(methodToString(method)); - } - - public String methodToString(MethodDeclaration method) { - StringBuffer buf = new StringBuffer(method.getSimpleName()); - for (ParameterDeclaration param : method.getParameters()) - buf.append(";"+param.getType().toString()); - return buf.toString(); - } - - public void clearExceptionMap() { - exceptionBeanMap.clear(); - } - - public void addExceptionBeanEntry(String exception, FaultInfo faultInfo, ModelBuilder builder) { - exceptionBeanMap.put(exception,faultInfo); - } - - public FaultInfo getExceptionBeanName(String exception) { - return exceptionBeanMap.get(exception); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/FaultInfo.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/FaultInfo.java deleted file mode 100644 index bad0e695e81..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/FaultInfo.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author dkohlert - */ -public class FaultInfo { - public String beanName; - public TypeMoniker beanTypeMoniker; - public boolean isWSDLException; - public QName elementName; - public List members; - - /** Creates a new instance of FaultInfo */ - public FaultInfo() { - } - public FaultInfo(String beanName) { - this.beanName = beanName; - } - public FaultInfo(String beanName, boolean isWSDLException) { - this.beanName = beanName; - this.isWSDLException = isWSDLException; - } - public FaultInfo(TypeMoniker typeMoniker, boolean isWSDLException) { - this.beanTypeMoniker = typeMoniker; - this.isWSDLException = isWSDLException; - } - - public void setIsWSDLException(boolean isWSDLException) { - this.isWSDLException = isWSDLException; - } - - public boolean isWSDLException() { - return isWSDLException; - } - - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getBeanName() { - return beanName; - } - - public void setElementName(QName elementName) { - this.elementName = elementName; - } - - public QName getElementName() { - return elementName; - } - public void setBeanTypeMoniker(TypeMoniker typeMoniker) { - this.beanTypeMoniker = typeMoniker; - } - public TypeMoniker getBeanTypeMoniker() { - return beanTypeMoniker; - } - public List getMembers() { - return members; - } - public void setMembers(List members) { - this.members = members; - } - public void addMember(MemberInfo member) { - if (members == null) - members = new ArrayList(); - members.add(member); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java deleted file mode 100644 index 5651dd2ab23..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import com.sun.istack.internal.tools.APTTypeVisitor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.type.*; -import com.sun.mirror.util.Types; - -import java.util.Collection; - -/** - * - * @author dkohlert - */ -public class MakeSafeTypeVisitor extends APTTypeVisitor implements WebServiceConstants { - TypeDeclaration collectionDecl; - TypeDeclaration mapDecl; - - /** - * Creates a new instance of MakeSafeTypeVisitor - */ - public MakeSafeTypeVisitor(AnnotationProcessorEnvironment apEnv) { - collectionDecl = apEnv.getTypeDeclaration(COLLECTION_CLASSNAME); - mapDecl = apEnv.getTypeDeclaration(MAP_CLASSNAME); - } - - protected TypeMirror onArrayType(ArrayType type, Types apTypes) { - return apTypes.getErasure(type); - } - - protected TypeMirror onPrimitiveType(PrimitiveType type, Types apTypes) { - return apTypes.getErasure(type); - } - - protected TypeMirror onClassType(ClassType type, Types apTypes) { - return processDeclaredType(type, apTypes); - } - - protected TypeMirror onInterfaceType(InterfaceType type, Types apTypes) { - return processDeclaredType(type, apTypes); - } - - private TypeMirror processDeclaredType(DeclaredType type, Types apTypes) { - if (TypeModeler.isSubtype(type.getDeclaration(), collectionDecl) || - TypeModeler.isSubtype(type.getDeclaration(), mapDecl)) { - Collection args = type.getActualTypeArguments(); - TypeMirror[] safeArgs = new TypeMirror[args.size()]; - int i = 0; - for (TypeMirror arg : args) { - safeArgs[i++]= apply(arg, apTypes); - } - return apTypes.getDeclaredType(type.getDeclaration(), safeArgs); - } - return apTypes.getErasure(type); - } - - protected TypeMirror onTypeVariable(TypeVariable type, Types apTypes) { - return apTypes.getErasure(type); - } - - protected TypeMirror onVoidType(VoidType type, Types apTypes) { - return type; - } - - protected TypeMirror onWildcard(WildcardType type, Types apTypes) { - return apTypes.getErasure(type); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/MemberInfo.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/MemberInfo.java deleted file mode 100644 index ea4f7d3cd54..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/MemberInfo.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import com.sun.istack.internal.NotNull; -import com.sun.mirror.declaration.Declaration; -import com.sun.mirror.type.TypeMirror; - -import javax.xml.namespace.QName; -import java.lang.annotation.Annotation; - -/** - * - * @author WS Development Team - */ -public final class MemberInfo implements Comparable { - private final TypeMirror paramType; - private final String paramName; - private final QName elementName; - private final Annotation[] jaxbAnnotations; - /** - * Use this to look up annotations on this parameter/return type. - */ - private final Declaration decl; - - public MemberInfo(TypeMirror paramType, String paramName, QName elementName, @NotNull Declaration decl, Annotation... jaxbAnnotations) { - this.paramType = paramType; - this.paramName = paramName; - this.elementName = elementName; - this.decl = decl; - this.jaxbAnnotations = jaxbAnnotations; - } - - - public Annotation[] getJaxbAnnotations() { - return jaxbAnnotations; - } - - public TypeMirror getParamType() { - return paramType; - } - - public String getParamName() { - return paramName; - } - - public QName getElementName() { - return elementName; - } - - public @NotNull Declaration getDecl() { - return decl; - } - - public int compareTo(MemberInfo member) { - return paramName.compareTo(member.paramName); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/ModelBuilder.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/ModelBuilder.java deleted file mode 100644 index ef0f522b738..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/ModelBuilder.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.type.TypeMirror; -import com.sun.mirror.util.SourcePosition; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.Service; -import com.sun.tools.internal.ws.processor.modeler.ModelerException; -import com.sun.tools.internal.ws.wscompile.WsgenOptions; -import com.sun.xml.internal.ws.util.localization.Localizable; - -import java.io.File; - -/** - * - * @author WS Development Team - */ -public interface ModelBuilder { - public AnnotationProcessorEnvironment getAPEnv(); - public void setService(Service service); - public void setPort(Port port); - public String getOperationName(String methodName); - public String getResponseName(String operationName); - public TypeMirror getHolderValueType(TypeMirror type); - public boolean checkAndSetProcessed(TypeDeclaration typeDecl); - public boolean isRemoteException(TypeDeclaration typeDecl); - public boolean isRemote(TypeDeclaration typeDecl); - public boolean canOverWriteClass(String className); - public void setWrapperGenerated(boolean wrapperGenerated); - public TypeDeclaration getTypeDeclaration(String typeName); - public String getSourceVersion(); - public WsgenOptions getOptions(); - public File getSourceDir(); - public String getXMLName(String javaName); - public void log(String msg); - - public void onError(String s); - public void onError(SourcePosition pos, Localizable msg) throws ModelerException; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeModeler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeModeler.java deleted file mode 100644 index 6cad883d8fd..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeModeler.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; -import com.sun.xml.internal.ws.util.StringUtils; - -import java.util.*; - - -/** - * - * @author WS Development Team - */ -public class TypeModeler implements WebServiceConstants { - - public static TypeDeclaration getDeclaration(TypeMirror typeMirror) { - if (typeMirror instanceof DeclaredType) - return ((DeclaredType)typeMirror).getDeclaration(); - return null; - } - - public static TypeDeclaration getDeclaringClassMethod( - TypeMirror theClass, - String methodName, - TypeMirror[] args) { - - return getDeclaringClassMethod(getDeclaration(theClass), methodName, args); - } - - public static TypeDeclaration getDeclaringClassMethod( - TypeDeclaration theClass, - String methodName, - TypeMirror[] args) { - - TypeDeclaration retClass = null; - if (theClass instanceof ClassDeclaration) { - ClassType superClass = ((ClassDeclaration)theClass).getSuperclass(); - if (superClass != null) - retClass = getDeclaringClassMethod(superClass, methodName, args); - } - if (retClass == null) { - for (InterfaceType interfaceType : theClass.getSuperinterfaces()) - retClass = - getDeclaringClassMethod(interfaceType, methodName, args); - } - if (retClass == null) { - Collection methods; - methods = theClass.getMethods(); - for (MethodDeclaration method : methods) { - if (method.getSimpleName().equals(methodName) && - method.getDeclaringType().equals(theClass)) { - retClass = theClass; - break; - } - } - } - return retClass; - } - - public static Collection collectInterfaces(TypeDeclaration type) { - Collection superInterfaces = type.getSuperinterfaces(); - Collection interfaces = type.getSuperinterfaces(); - for (InterfaceType interfaceType : superInterfaces) { - interfaces.addAll(collectInterfaces(getDeclaration(interfaceType))); - } - return interfaces; - } - - public static boolean isSubclass(String subTypeName, String superTypeName, - AnnotationProcessorEnvironment env) { - return isSubclass(env.getTypeDeclaration(subTypeName), - env.getTypeDeclaration(superTypeName)); - } - - public static boolean isSubclass( - TypeDeclaration subType, - TypeDeclaration superType) { - - if (subType.equals(superType)) - return false; - return isSubtype(subType, superType); - } - - public static TypeMirror getHolderValueType( - TypeMirror type, - TypeDeclaration defHolder - ) { - - TypeDeclaration typeDecl = getDeclaration(type); - if (typeDecl == null) - return null; - - if (isSubtype(typeDecl, defHolder)) { - if (type instanceof DeclaredType) { - Collection argTypes = ((DeclaredType)type).getActualTypeArguments(); - if (argTypes.size() == 1) { - TypeMirror mirror = argTypes.iterator().next(); -// System.out.println("argsTypes.iterator().next(): "+mirror); - return mirror; - } - else if (argTypes.size() == 0) { - FieldDeclaration member = getValueMember(typeDecl); - if (member != null) { -// System.out.println("member: "+member+" getType(): "+member.getType()); - return member.getType(); - } - } - } - } - return null; - } - - public static FieldDeclaration getValueMember(TypeMirror classType) { - return getValueMember(getDeclaration(classType)); - } - - public static FieldDeclaration getValueMember(TypeDeclaration type) { - FieldDeclaration member = null; - for (FieldDeclaration field : type.getFields()){ - if (field.getSimpleName().equals("value")) { - member = field; - break; - } - } - if (member == null) { - if (type instanceof ClassDeclaration) - member = getValueMember(((ClassDeclaration)type).getSuperclass()); - } - return member; - } - - - /* is d1 a subtype of d2 */ - public static boolean isSubtype(TypeDeclaration d1, TypeDeclaration d2) { - if (d1.equals(d2)) - return true; - ClassDeclaration superClassDecl = null; - if (d1 instanceof ClassDeclaration) { - ClassType superClass = ((ClassDeclaration)d1).getSuperclass(); - if (superClass != null) { - superClassDecl = superClass.getDeclaration(); - if (superClassDecl.equals(d2)) - return true; - } - } - for (InterfaceType superIntf : d1.getSuperinterfaces()) { - if (superIntf.getDeclaration().equals(d2)) { - return true; - } - if (isSubtype(superIntf.getDeclaration(), d2)) { - return true; - } else if (superClassDecl != null && isSubtype(superClassDecl, d2)) { - return true; - } - } - return false; - } - - public static Map getExceptionProperties(TypeMirror type) { - return getExceptionProperties(getDeclaration(type)); - } - - public static Map getExceptionProperties(TypeDeclaration type) { - Map members = new HashMap(); - collectExceptionProperties(type, members); - return members; - } - - public static void collectExceptionProperties(TypeMirror type, Map members) { - collectExceptionProperties(getDeclaration(type), members); - } - - public static void collectExceptionProperties(TypeDeclaration type, Map members) { -// System.out.println("type: "+type.toString()); - Collection methods; - methods = type.getMethods(); - for (MethodDeclaration method : methods) { - Collection modifiers = method.getModifiers(); - if (!modifiers.contains(Modifier.PUBLIC) - || (modifiers.contains(Modifier.FINAL) && - modifiers.contains(Modifier.STATIC)) - || modifiers.contains(Modifier.TRANSIENT)) { // no final static, transient, non-public - continue; - } - String name = method.getSimpleName(); - if (name.length() <= 3 && !name.startsWith(IS_PREFIX) || - skipProperties.contains(name)) { - // Optimization. Don't bother with invalid propertyNames. - continue; - } - TypeMirror resultType = method.getReturnType(); - Collection params = method.getParameters(); - if (params.size() == 0) { - if (name.startsWith(GET_PREFIX) && - !(resultType instanceof PrimitiveType && - ((PrimitiveType)resultType).getKind() == PrimitiveType.Kind.BOOLEAN)) { - // Simple getter -// System.out.println("exception property: "+ StringUtils.decapitalize(name.substring(3))); - members.put(StringUtils.decapitalize(name.substring(3)), method); - } else if (resultType instanceof PrimitiveType && - ((PrimitiveType)resultType).getKind() == PrimitiveType.Kind.BOOLEAN && - name.startsWith(IS_PREFIX)) { - // Boolean getter -// System.out.println("exception property: "+ StringUtils.decapitalize(name.substring(2))); - members.put(StringUtils.decapitalize(name.substring(2)), method); - } - } - } -// System.out.println("type class: "+type.getClass().toString()); - if (type instanceof ClassDeclaration && ((ClassDeclaration)type).getSuperclass() != null) { - collectExceptionProperties(((ClassDeclaration)type).getSuperclass(), members); - } - for (InterfaceType intfType : type.getSuperinterfaces()) { - collectExceptionProperties(intfType, members); - } - } - - private static Set skipProperties = new HashSet (); - static{ - skipProperties.add("getCause"); - skipProperties.add("getLocalizedMessage"); - skipProperties.add("getClass"); - skipProperties.add("getStackTrace"); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeMoniker.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeMoniker.java deleted file mode 100644 index 4a75f2d8133..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeMoniker.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.type.TypeMirror; - -/** - * - * @author dkohlert - */ -public interface TypeMoniker { - - public TypeMirror create(AnnotationProcessorEnvironment apEnv); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeMonikerFactory.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeMonikerFactory.java deleted file mode 100644 index aa93759870b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/TypeMonikerFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - - -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.type.ArrayType; -import com.sun.mirror.type.DeclaredType; -import com.sun.mirror.type.PrimitiveType; -import com.sun.mirror.type.TypeMirror; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * - * @author dkohlert - */ -public class TypeMonikerFactory { - - public static TypeMoniker getTypeMoniker(TypeMirror typeMirror) { - if (typeMirror instanceof PrimitiveType) - return new PrimitiveTypeMoniker((PrimitiveType)typeMirror); - else if (typeMirror instanceof ArrayType) - return new ArrayTypeMoniker((ArrayType)typeMirror); - else if (typeMirror instanceof DeclaredType) - return new DeclaredTypeMoniker((DeclaredType)typeMirror); - return getTypeMoniker(typeMirror.toString()); - } - - public static TypeMoniker getTypeMoniker(String typeName) { - return new StringMoniker(typeName); - } - - static class ArrayTypeMoniker implements TypeMoniker { - private TypeMoniker arrayType; - - public ArrayTypeMoniker(ArrayType type) { - arrayType = TypeMonikerFactory.getTypeMoniker(type.getComponentType()); - } - - public TypeMirror create(AnnotationProcessorEnvironment apEnv) { - return apEnv.getTypeUtils().getArrayType(arrayType.create(apEnv)); - } - } - static class DeclaredTypeMoniker implements TypeMoniker { - private String typeDeclName; - private Collection typeArgs = new ArrayList(); - - public DeclaredTypeMoniker(DeclaredType type) { - typeDeclName = type.getDeclaration().getQualifiedName(); - for (TypeMirror arg : type.getActualTypeArguments()) - typeArgs.add(TypeMonikerFactory.getTypeMoniker(arg)); - } - - public TypeMirror create(AnnotationProcessorEnvironment apEnv) { - TypeDeclaration typeDecl = apEnv.getTypeDeclaration(typeDeclName); - TypeMirror[] tmpArgs = new TypeMirror[typeArgs.size()]; - int idx = 0; - for (TypeMoniker moniker : typeArgs) - tmpArgs[idx++] = moniker.create(apEnv); - - return apEnv.getTypeUtils().getDeclaredType(typeDecl, tmpArgs); - } - } - static class PrimitiveTypeMoniker implements TypeMoniker { - private PrimitiveType.Kind kind; - - public PrimitiveTypeMoniker(PrimitiveType type) { - kind = type.getKind(); - } - - public TypeMirror create(AnnotationProcessorEnvironment apEnv) { - return apEnv.getTypeUtils().getPrimitiveType(kind); - } - } - static class StringMoniker implements TypeMoniker { - private String typeName; - - public StringMoniker(String typeName) { - this.typeName = typeName; - } - - public TypeMirror create(AnnotationProcessorEnvironment apEnv) { - return apEnv.getTypeUtils().getDeclaredType(apEnv.getTypeDeclaration(typeName)); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceAP.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceAP.java deleted file mode 100644 index 9482d323de5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceAP.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.apt.Messager; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.ClassType; -import com.sun.mirror.type.InterfaceType; -import com.sun.mirror.type.TypeMirror; -import com.sun.mirror.util.SourcePosition; -import com.sun.tools.internal.ws.ToolVersion; -import com.sun.tools.internal.ws.processor.generator.GeneratorUtil; -import com.sun.tools.internal.ws.processor.generator.Names; -import com.sun.tools.internal.ws.processor.model.Operation; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.Service; -import com.sun.tools.internal.ws.processor.modeler.ModelerException; -import com.sun.tools.internal.ws.processor.modeler.wsdl.ConsoleErrorReporter; -import com.sun.tools.internal.ws.resources.WebserviceapMessages; -import com.sun.tools.internal.ws.wscompile.*; -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.Localizer; -import org.xml.sax.SAXParseException; - -import javax.jws.WebService; -import javax.xml.ws.WebServiceProvider; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.PrintStream; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - - -/** - * WebServiceAP is a APT AnnotationProcessor for processing javax.jws.* and - * javax.xml.ws.* annotations. This class is used either by the WsGen (CompileTool) tool or - * idirectly via the {@link com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl} when invoked by APT. - * - * @author WS Development Team - */ -public class WebServiceAP implements AnnotationProcessor, ModelBuilder, WebServiceConstants{ - - protected AnnotationProcessorEnvironment apEnv; - - private File sourceDir; - - private TypeDeclaration remoteDecl; - private TypeDeclaration remoteExceptionDecl; - private TypeDeclaration exceptionDecl; - private TypeDeclaration defHolderDecl; - private Service service; - private Port port; - protected AnnotationProcessorContext context; - private Set processedTypeDecls = new HashSet(); - protected Messager messager; - private boolean doNotOverWrite = false; - private WsgenOptions options; - private ErrorReceiver receiver; - private PrintStream out; - - /* - * Is this invocation from APT or JavaC? - */ - private boolean isAPTInvocation = false; - - - public void run() { - } - - protected boolean parseArguments(String[] args) { - return true; - } - - - public WebServiceAP(WsgenOptions options, AnnotationProcessorContext context, ErrorReceiver receiver, PrintStream out) { - this.options = options; - this.sourceDir = (options != null)?options.sourceDir:null; - this.doNotOverWrite = (options != null) && options.doNotOverWrite; - this.receiver = receiver; - this.out = out; - this.context = context; - } - - public void init(AnnotationProcessorEnvironment apEnv) { - this.apEnv = apEnv; - remoteDecl = this.apEnv.getTypeDeclaration(REMOTE_CLASSNAME); - remoteExceptionDecl = this.apEnv.getTypeDeclaration(REMOTE_EXCEPTION_CLASSNAME); - exceptionDecl = this.apEnv.getTypeDeclaration(EXCEPTION_CLASSNAME); - defHolderDecl = this.apEnv.getTypeDeclaration(HOLDER_CLASSNAME); - if (options == null) { - options = new WsgenOptions(); - out = new PrintStream(new ByteArrayOutputStream()); - class Listener extends WsimportListener { - ConsoleErrorReporter cer = new ConsoleErrorReporter(out); - - @Override - public void generatedFile(String fileName) { - message(fileName); - } - - @Override - public void message(String msg) { - out.println(msg); - } - - @Override - public void error(SAXParseException exception) { - cer.error(exception); - } - - @Override - public void fatalError(SAXParseException exception) { - cer.fatalError(exception); - } - - @Override - public void warning(SAXParseException exception) { - cer.warning(exception); - } - - @Override - public void info(SAXParseException exception) { - cer.info(exception); - } - } - - final Listener listener = new Listener(); - receiver = new ErrorReceiverFilter(new Listener()) { - public void info(SAXParseException exception) { - if (options.verbose) - super.info(exception); - } - - public void warning(SAXParseException exception) { - if (!options.quiet) - super.warning(exception); - } - - @Override - public void pollAbort() throws AbortException { - if (listener.isCanceled()) - throw new AbortException(); - } - }; - Map apOptions = apEnv.getOptions(); - String classDir = apOptions.get("-d"); - if (classDir == null) - classDir = "."; - if (apOptions.get("-s") != null) - sourceDir = new File(apOptions.get("-s")); - else - sourceDir = new File(classDir); - String cp = apOptions.get("-classpath"); - String cpath = classDir + - File.pathSeparator + - cp + File.pathSeparator + - System.getProperty("java.class.path"); - options.classpath = cpath; - boolean setVerbose = false; - for (String key : apOptions.keySet()) { - if (key.equals("-verbose")) - setVerbose = true; - } - options.verbose = setVerbose; - messager = apEnv.getMessager(); - isAPTInvocation = true; - } - options.filer = apEnv.getFiler(); -// env.setFiler(apEnv.getFiler()); - } - - public AnnotationProcessorEnvironment getAPEnv() { - return apEnv; - } - - public WsgenOptions getOptions() { - return options; - } - - public File getSourceDir() { - return sourceDir; - } - - public void onError(String message) { - if (messager != null) { - messager.printError(message); - throw new AbortException(); - } else { - throw new ModelerException(message); - } - } - - private final static Localizer localizer = new Localizer(); - - public void onError(SourcePosition pos, Localizable msg) throws ModelerException { - if (messager != null) { - messager.printError(pos, localizer.localize(msg)); - } else { - throw new ModelerException(msg); - } - } - - - public void onWarning(String message) { - if (messager != null) { - messager.printWarning(message); - } else { - report(message); - } - } - public void onInfo(String message) { - if (messager != null) { - messager.printNotice(message); - } else { - report(message); - } - } - - protected void report(String msg) { - PrintStream outstream = - out instanceof PrintStream - ? out - : new PrintStream(out, true); - outstream.println(msg); - outstream.flush(); - } - - public void process() { - if (context.getRound() == 1) { - buildModel(); - } - context.incrementRound(); - } - - public boolean checkAndSetProcessed(TypeDeclaration typeDecl) { - if (!processedTypeDecls.contains(typeDecl)) { - processedTypeDecls.add(typeDecl); - return false; - } - return true; - } - - public void clearProcessed() { - processedTypeDecls.clear(); - } - - public void setService(Service service) { - this.service = service; - } - - public void setPort(Port port) { - this.port = port; - service.addPort(port); - } - - public void addOperation(Operation operation) { - port.addOperation(operation); - } - - public void setWrapperGenerated(boolean wrapperGenerated) { - } - - public TypeDeclaration getTypeDeclaration(String typeName) { - return apEnv.getTypeDeclaration(typeName); - } - - public String getSourceVersion() { - return ToolVersion.VERSION.MAJOR_VERSION; - } - - private void buildModel() { - WebService webService; - WebServiceProvider webServiceProvider; - WebServiceVisitor wrapperGenerator = createWrapperGenerator(); - boolean processedEndpoint = false; - for (TypeDeclaration typedecl: apEnv.getTypeDeclarations()) { - if (!(typedecl instanceof ClassDeclaration)) - continue; - webServiceProvider = typedecl.getAnnotation(WebServiceProvider.class); - webService = typedecl.getAnnotation(WebService.class); - if (webServiceProvider != null) { - if (webService != null) { - onError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(typedecl.getQualifiedName())); - } - processedEndpoint = true; - } - if (!shouldProcessWebService(webService)) - continue; - typedecl.accept(wrapperGenerator); - processedEndpoint = true; - } - if (!processedEndpoint) { - if (isAPTInvocation) - onWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND()); - else - onError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND()); - } - } - - protected WebServiceVisitor createWrapperGenerator() { - return new WebServiceWrapperGenerator(this, context); - } - - protected boolean shouldProcessWebService(WebService webService) { - return webService != null; - } - - - public boolean isException(TypeDeclaration typeDecl) { - return isSubtype(typeDecl, exceptionDecl); - } - - public boolean isRemoteException(TypeDeclaration typeDecl) { - return isSubtype(typeDecl, remoteExceptionDecl); - } - - public boolean isRemote(TypeDeclaration typeDecl) { - return isSubtype(typeDecl, remoteDecl); - } - - - public static boolean isSubtype(TypeDeclaration d1, TypeDeclaration d2) { - if (d1.equals(d2)) - return true; - ClassDeclaration superClassDecl = null; - if (d1 instanceof ClassDeclaration) { - ClassType superClass = ((ClassDeclaration)d1).getSuperclass(); - if (superClass != null) { - superClassDecl = superClass.getDeclaration(); - if (superClassDecl.equals(d2)) - return true; - } - } - InterfaceDeclaration superIntf = null; - for (InterfaceType interfaceType : d1.getSuperinterfaces()) { - superIntf = interfaceType.getDeclaration(); - if (superIntf.equals(d2)) - return true; - } - if (superIntf != null && isSubtype(superIntf, d2)) { - return true; - } else if (superClassDecl != null && isSubtype(superClassDecl, d2)) { - return true; - } - return false; - } - - - public static String getMethodSig(MethodDeclaration method) { - StringBuffer buf = new StringBuffer(method.getSimpleName() + "("); - Iterator params = method.getFormalTypeParameters().iterator(); - TypeParameterDeclaration param; - for (int i =0; params.hasNext(); i++) { - if (i > 0) - buf.append(", "); - param = params.next(); - buf.append(param.getSimpleName()); - } - buf.append(")"); - return buf.toString(); - } - - public String getOperationName(String messageName) { - return messageName; - } - - public String getResponseName(String operationName) { - return Names.getResponseName(operationName); - } - - - public TypeMirror getHolderValueType(TypeMirror type) { - return TypeModeler.getHolderValueType(type, defHolderDecl); - } - - public boolean canOverWriteClass(String className) { - return !((doNotOverWrite && GeneratorUtil.classExists(options, className))); - } - - public void log(String msg) { - if (options != null && options.verbose) { - String message = "[" + msg + "]"; - if (messager != null) { - messager.printNotice(message); - } else { - System.out.println(message); - } - } - } - - public String getXMLName(String javaName) { - return javaName; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceConstants.java deleted file mode 100644 index 94ffafb7855..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceConstants.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - - -/** - * - * @author dkohlert - */ -public interface WebServiceConstants { //extends RmiConstants { - - public static final String RETURN = "return"; - public static final String RETURN_CAPPED = "Return"; - public static final String RETURN_VALUE = "_return"; - public static final String SERVICE = "Service"; - public static final String PD = "."; - public static final String JAXWS = "jaxws"; - public static final String JAXWS_PACKAGE_PD = JAXWS+PD; - public static final String PD_JAXWS_PACKAGE_PD = PD+JAXWS+PD; - public static final String BEAN = "Bean"; - public static final String GET_PREFIX = "get"; - public static final String IS_PREFIX = "is"; - public static final String FAULT_INFO = "faultInfo"; - public static final String GET_FAULT_INFO = "getFaultInfo"; - public static final String HTTP_PREFIX = "http://"; - public static final String JAVA_LANG_OBJECT = "java.lang.Object"; - public static final String EMTPY_NAMESPACE_ID = ""; - - - public static final char SIGC_INNERCLASS = '$'; - public static final char SIGC_UNDERSCORE = '_'; - - public static final String DOT = "."; - public static final String PORT = "WSDLPort"; - public static final String BINDING = "Binding"; - public static final String RESPONSE = "Response"; - - /* - * Identifiers potentially useful for all Generators - */ - public static final String EXCEPTION_CLASSNAME = - java.lang.Exception.class.getName(); - public static final String REMOTE_CLASSNAME = - java.rmi.Remote.class.getName(); - public static final String REMOTE_EXCEPTION_CLASSNAME = - java.rmi.RemoteException.class.getName(); - public static final String RUNTIME_EXCEPTION_CLASSNAME = - java.lang.RuntimeException.class.getName(); - public static final String SERIALIZABLE_CLASSNAME = - java.io.Serializable.class.getName(); - public static final String HOLDER_CLASSNAME = - javax.xml.ws.Holder.class.getName(); - public static final String COLLECTION_CLASSNAME = - java.util.Collection.class.getName(); - public static final String MAP_CLASSNAME = - java.util.Map.class.getName(); - - - // 181 constants - public static final String WEBSERVICE_NAMESPACE = "http://www.bea.com/xml/ns/jws"; - public static final String HANDLER_CONFIG = "handler-config"; - public static final String HANDLER_CHAIN = "handler-chain"; - public static final String HANDLER_CHAIN_NAME = "handler-chain-name"; - public static final String HANDLER = "handler"; - public static final String HANDLER_NAME = "handler-name"; - public static final String HANDLER_CLASS = "handler-class"; - public static final String INIT_PARAM = "init-param"; - public static final String SOAP_ROLE = "soap-role"; - public static final String SOAP_HEADER = "soap-header"; - public static final String PARAM_NAME = "param-name"; - public static final String PARAM_VALUE = "param-value"; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceVisitor.java deleted file mode 100644 index 3809c712f4b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceVisitor.java +++ /dev/null @@ -1,794 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - - -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; -import com.sun.mirror.util.SimpleDeclarationVisitor; -import com.sun.mirror.util.SourcePosition; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.modeler.JavaSimpleTypeCreator; -import com.sun.tools.internal.ws.processor.modeler.annotation.AnnotationProcessorContext.SEIContext; -import com.sun.tools.internal.ws.resources.WebserviceapMessages; -import com.sun.tools.internal.ws.util.ClassNameInfo; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse; -import com.sun.xml.internal.ws.developer.Stateful; -import com.sun.xml.internal.ws.model.RuntimeModeler; -import com.sun.xml.internal.ws.util.localization.Localizable; - -import javax.jws.*; -import javax.jws.soap.SOAPBinding; -import javax.jws.soap.SOAPBinding.ParameterStyle; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; -import java.util.Stack; - -/** - * - * @author WS Development Team - */ -public abstract class WebServiceVisitor extends SimpleDeclarationVisitor implements WebServiceConstants { - protected ModelBuilder builder; - protected String wsdlNamespace; - protected String typeNamespace; - protected Stack soapBindingStack; - protected SOAPBinding typeDeclSOAPBinding; - protected SOAPUse soapUse = SOAPUse.LITERAL; - protected SOAPStyle soapStyle = SOAPStyle.DOCUMENT; - protected boolean wrapped = true; - protected HandlerChain hChain; - protected Port port; - protected String serviceImplName; - protected String endpointInterfaceName; - protected AnnotationProcessorContext context; - protected SEIContext seiContext; - protected boolean processingSEI = false; - protected String serviceName; - protected String packageName; - protected String portName; - protected boolean endpointReferencesInterface = false; - protected boolean hasWebMethods = false; - protected JavaSimpleTypeCreator simpleTypeCreator; - protected TypeDeclaration typeDecl; - protected Set processedMethods; - protected boolean pushedSOAPBinding = false; - protected static final String ANNOTATION_ELEMENT_ERROR = "webserviceap.endpointinteface.plus.element"; - - - - public WebServiceVisitor(ModelBuilder builder, AnnotationProcessorContext context) { - this.builder = builder; - this.context = context; - this.simpleTypeCreator = new JavaSimpleTypeCreator(); - soapBindingStack = new Stack(); - processedMethods = new HashSet(); - } - - public void visitInterfaceDeclaration(InterfaceDeclaration d) { - WebService webService = d.getAnnotation(WebService.class); - if (!shouldProcessWebService(webService, d)) - return; - if (builder.checkAndSetProcessed(d)) - return; - typeDecl = d; - if (endpointInterfaceName != null && !endpointInterfaceName.equals(d.getQualifiedName())) { - builder.onError(d.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ENDPOINTINTERFACES_DO_NOT_MATCH(endpointInterfaceName, d.getQualifiedName())); - } - verifySEIAnnotations(webService, d); - endpointInterfaceName = d.getQualifiedName(); - processingSEI = true; - preProcessWebService(webService, d); - processWebService(webService, d); - postProcessWebService(webService, d); - } - - public void visitClassDeclaration(ClassDeclaration d) { - WebService webService = d.getAnnotation(WebService.class); - if (!shouldProcessWebService(webService, d)) - return; - if (builder.checkAndSetProcessed(d)) - return; - typeDeclSOAPBinding = d.getAnnotation(SOAPBinding.class); - typeDecl = d; - if (serviceImplName == null) - serviceImplName = d.getQualifiedName(); - String endpointInterfaceName = webService != null ? webService.endpointInterface() : null; - if (endpointInterfaceName != null && endpointInterfaceName.length() > 0) { - SourcePosition pos = pos = d.getPosition(); - checkForInvalidImplAnnotation(d, SOAPBinding.class); - if (webService.name().length() > 0) - annotationError(pos, WebserviceapMessages.localizableWEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ELEMENT("name")); - endpointReferencesInterface = true; - verifyImplAnnotations(d); - inspectEndpointInterface(endpointInterfaceName, d); - serviceImplName = null; - return; - } - processingSEI = false; - preProcessWebService(webService, d); - processWebService(webService, d); - serviceImplName = null; - postProcessWebService(webService, d); - serviceImplName = null; - } - - protected void verifySEIAnnotations(WebService webService, InterfaceDeclaration d) { - if (webService.endpointInterface().length() > 0) { - builder.onError(d.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(d.getQualifiedName(), webService.endpointInterface())); - } - if (webService.serviceName().length() > 0) { - builder.onError(d.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT("serviceName", d.getQualifiedName())); - } - if (webService.portName().length() > 0) { - builder.onError(d.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT("portName", d.getQualifiedName())); - } - } - - protected void verifyImplAnnotations(ClassDeclaration d) { - for (MethodDeclaration method : d.getMethods()) { - checkForInvalidImplAnnotation(method, WebMethod.class); - checkForInvalidImplAnnotation(method, Oneway.class); - checkForInvalidImplAnnotation(method, WebResult.class); - for (ParameterDeclaration param : method.getParameters()) { - checkForInvalidImplAnnotation(param, WebParam.class); - } - } - } - - protected void checkForInvalidSEIAnnotation(InterfaceDeclaration d, Class annotationClass) { - Object annotation = d.getAnnotation(annotationClass); - if (annotation != null) { - SourcePosition pos = d.getPosition(); - annotationError(pos, WebserviceapMessages.localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION(annotationClass.getName(), d.getQualifiedName())); - } - } - - protected void checkForInvalidImplAnnotation(Declaration d, Class annotationClass) { - Object annotation = d.getAnnotation(annotationClass); - if (annotation != null) { - SourcePosition pos = d.getPosition(); - annotationError(pos, WebserviceapMessages.localizableWEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ANNOTATION(annotationClass.getName())); - } - } - - protected void annotationError(SourcePosition pos, Localizable message) { - builder.onError(pos, message); - } - - - protected void preProcessWebService(WebService webService, TypeDeclaration d) { - processedMethods = new HashSet(); - seiContext = context.getSEIContext(d); - String targetNamespace = null; - if (webService != null) - targetNamespace = webService.targetNamespace(); - if (targetNamespace == null || targetNamespace.length() == 0) { - String packageName = d.getPackage().getQualifiedName(); - if (packageName == null || packageName.length() == 0) { - builder.onError(d.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(d.getQualifiedName())); - } - targetNamespace = getNamespace(d.getPackage()); - } - seiContext.setNamespaceURI(targetNamespace); - if (serviceImplName == null) - serviceImplName = seiContext.getSEIImplName(); - if (serviceImplName != null) { - seiContext.setSEIImplName(serviceImplName); - context.addSEIContext(serviceImplName, seiContext); - } - portName = ClassNameInfo.getName( - d.getSimpleName().replace( - SIGC_INNERCLASS, - SIGC_UNDERSCORE));; - packageName = d.getPackage().getQualifiedName(); - portName = webService != null && webService.name() != null && webService.name().length() >0 ? - webService.name() : portName; - serviceName = ClassNameInfo.getName(d.getQualifiedName())+SERVICE; - serviceName = webService != null && webService.serviceName() != null && - webService.serviceName().length() > 0 ? - webService.serviceName() : serviceName; - wsdlNamespace = seiContext.getNamespaceURI(); - typeNamespace = wsdlNamespace; - - SOAPBinding soapBinding = d.getAnnotation(SOAPBinding.class); - if (soapBinding != null) { - pushedSOAPBinding = pushSOAPBinding(soapBinding, d, d); - } else if (d.equals(typeDecl)) { - pushedSOAPBinding = pushSOAPBinding(new MySOAPBinding(), d, d); - } - } - - public static boolean sameStyle(SOAPBinding.Style style, SOAPStyle soapStyle) { - if (style.equals(SOAPBinding.Style.DOCUMENT) && - soapStyle.equals(SOAPStyle.DOCUMENT)) - return true; - if (style.equals(SOAPBinding.Style.RPC) && - soapStyle.equals(SOAPStyle.RPC)) - return true; - return false; - } - - protected boolean pushSOAPBinding(SOAPBinding soapBinding, Declaration bindingDecl, - TypeDeclaration classDecl) { - boolean changed = false; - if (!sameStyle(soapBinding.style(), soapStyle)) { - changed = true; - if (pushedSOAPBinding) - builder.onError(bindingDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_MIXED_BINDING_STYLE(classDecl.getQualifiedName())); - } - if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { - soapStyle = SOAPStyle.RPC; - wrapped = true; - if (soapBinding.parameterStyle().equals(ParameterStyle.BARE)) { - builder.onError(bindingDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_RPC_LITERAL_MUST_NOT_BE_BARE(classDecl.getQualifiedName())); - } - - } else { - soapStyle = SOAPStyle.DOCUMENT; - if (wrapped != soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED)) { - wrapped = soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED); - changed = true; - } - } - if (soapBinding.use().equals(SOAPBinding.Use.ENCODED)) { - String style = "rpc"; - if(soapBinding.style().equals(SOAPBinding.Style.DOCUMENT)) - style = "document"; - builder.onError(bindingDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICE_ENCODED_NOT_SUPPORTED(classDecl.getQualifiedName(), style)); - } - if (changed || soapBindingStack.empty()) { - soapBindingStack.push(soapBinding); - pushedSOAPBinding = true; - } - return changed; - } - - - protected SOAPBinding popSOAPBinding() { - if (pushedSOAPBinding) - soapBindingStack.pop(); - SOAPBinding soapBinding = null; - if (!soapBindingStack.empty()) { - soapBinding = soapBindingStack.peek(); - if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { - soapStyle = SOAPStyle.RPC; - wrapped = true; - } else { - soapStyle = SOAPStyle.DOCUMENT; - wrapped = soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED); - } - } - return soapBinding; - } - - protected String getNamespace(PackageDeclaration packageDecl) { - return RuntimeModeler.getNamespace(packageDecl.getQualifiedName()); - } - -// abstract protected boolean shouldProcessWebService(WebService webService, InterfaceDeclaration intf); - -// abstract protected boolean shouldProcessWebService(WebService webService, ClassDeclaration decl); - protected boolean shouldProcessWebService(WebService webService, InterfaceDeclaration intf) { - hasWebMethods = false; - if (webService == null) - builder.onError(intf.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ENDPOINTINTERFACE_HAS_NO_WEBSERVICE_ANNOTATION(intf.getQualifiedName())); - if (isLegalSEI(intf)) - return true; - return false; - } - - protected boolean shouldProcessWebService(WebService webService, ClassDeclaration classDecl) { - if (webService == null) - return false; - hasWebMethods = hasWebMethods(classDecl); - return isLegalImplementation(webService, classDecl); - } - - abstract protected void processWebService(WebService webService, TypeDeclaration d); - - protected void postProcessWebService(WebService webService, InterfaceDeclaration d) { - processMethods(d); - popSOAPBinding(); - } - - protected void postProcessWebService(WebService webService, ClassDeclaration d) { - processMethods(d); - popSOAPBinding(); - } - - - protected boolean hasWebMethods(ClassDeclaration d) { - if (d.getQualifiedName().equals(JAVA_LANG_OBJECT)) - return false; - WebMethod webMethod; - for (MethodDeclaration method : d.getMethods()) { - webMethod = method.getAnnotation(WebMethod.class); - if (webMethod != null) { - if (webMethod.exclude()) { - if (webMethod.operationName().length() > 0) - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE("operationName", d.getQualifiedName(), method.toString())); - if (webMethod.action().length() > 0) - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE("action", d.getQualifiedName(), method.toString())); - } else { - return true; - } - } - } - return false;//hasWebMethods(d.getSuperclass().getDeclaration()); - } - - protected void processMethods(InterfaceDeclaration d) { - builder.log("ProcessedMethods Interface: "+d); - hasWebMethods = false; - for (MethodDeclaration methodDecl : d.getMethods()) { - methodDecl.accept(this); - } - for (InterfaceType superType : d.getSuperinterfaces()) - processMethods(superType.getDeclaration()); - } - - protected void processMethods(ClassDeclaration d) { - builder.log("ProcessedMethods Class: "+d); - hasWebMethods = hasWebMethods(d); - if (d.getQualifiedName().equals(JAVA_LANG_OBJECT)) - return; - if (d.getAnnotation(WebService.class) != null) { - // Super classes must have @WebService annotations to pick up their methods - for (MethodDeclaration methodDecl : d.getMethods()) { - methodDecl.accept(this); - } - } - if (d.getSuperclass() != null) { - processMethods(d.getSuperclass().getDeclaration()); - } - } - - private InterfaceDeclaration getEndpointInterfaceDecl(String endpointInterfaceName, - ClassDeclaration d) { - InterfaceDeclaration intTypeDecl = null; - for (InterfaceType interfaceType : d.getSuperinterfaces()) { - if (endpointInterfaceName.equals(interfaceType.toString())) { - intTypeDecl = interfaceType.getDeclaration(); - seiContext = context.getSEIContext(intTypeDecl.getQualifiedName()); - assert(seiContext != null); - seiContext.setImplementsSEI(true); - break; - } - } - if (intTypeDecl == null) { - intTypeDecl = (InterfaceDeclaration)builder.getTypeDeclaration(endpointInterfaceName); - } - if (intTypeDecl == null) - builder.onError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_CLASS_NOT_FOUND(endpointInterfaceName)); - return intTypeDecl; - } - - - private void inspectEndpointInterface(String endpointInterfaceName, ClassDeclaration d) { - TypeDeclaration intTypeDecl = getEndpointInterfaceDecl(endpointInterfaceName, d); - if (intTypeDecl != null) - intTypeDecl.accept(this); - } - - public void visitMethodDeclaration(MethodDeclaration method) { - // Methods must be public - if (!method.getModifiers().contains(Modifier.PUBLIC)) - return; - if (processedMethod(method)) - return; - WebMethod webMethod = method.getAnnotation(WebMethod.class); - if (webMethod != null && webMethod.exclude()) - return; - SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); - if (soapBinding == null && !method.getDeclaringType().equals(typeDecl)) { - if (method.getDeclaringType() instanceof ClassDeclaration) { - soapBinding = method.getDeclaringType().getAnnotation(SOAPBinding.class); - if (soapBinding != null) - builder.log("using "+method.getDeclaringType()+"'s SOAPBinding."); - else { - soapBinding = new MySOAPBinding(); - } - } - } - boolean newBinding = false; - if (soapBinding != null) { - newBinding = pushSOAPBinding(soapBinding, method, typeDecl); - } - try { - if (shouldProcessMethod(method, webMethod)) { - processMethod(method, webMethod); - } - } finally { - if (newBinding) { - popSOAPBinding(); - } - } - } - - protected boolean processedMethod(MethodDeclaration method) { - String id = method.toString(); - if (processedMethods.contains(id)) - return true; - processedMethods.add(id); - return false; - } - - - protected boolean shouldProcessMethod(MethodDeclaration method, WebMethod webMethod) { - builder.log("should process method: "+method.getSimpleName()+" hasWebMethods: "+ hasWebMethods+" "); - /* - Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577 - if (hasWebMethods && webMethod == null) { - builder.log("webMethod == null"); - return false; - } - */ - Collection modifiers = method.getModifiers(); - boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL); - if (staticFinal) { - if (webMethod != null) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getDeclaringType(), method)); - } - return false; - } - boolean retval = (endpointReferencesInterface || - method.getDeclaringType().equals(typeDecl) || - (method.getDeclaringType().getAnnotation(WebService.class) != null)); - builder.log("endpointReferencesInterface: "+endpointReferencesInterface); - builder.log("declaring class has WebSevice: "+(method.getDeclaringType().getAnnotation(WebService.class) != null)); - builder.log("returning: "+retval); - return retval; - } - - abstract protected void processMethod(MethodDeclaration method, WebMethod webMethod); - - - protected boolean isLegalImplementation(WebService webService, ClassDeclaration classDecl) { - - boolean isStateful = isStateful(classDecl); - - Collection modifiers = classDecl.getModifiers(); - if (!modifiers.contains(Modifier.PUBLIC)){ - builder.onError(classDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_CLASS_NOT_PUBLIC(classDecl.getQualifiedName())); - return false; - } - if (modifiers.contains(Modifier.FINAL) && !isStateful) { - builder.onError(classDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_FINAL(classDecl.getQualifiedName())); - return false; - } - if (modifiers.contains(Modifier.ABSTRACT) && !isStateful) { - builder.onError(classDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_ABSTRACT(classDecl.getQualifiedName())); - return false; - } - boolean hasDefaultConstructor = false; - for (ConstructorDeclaration constructor : classDecl.getConstructors()) { - if (constructor.getModifiers().contains(Modifier.PUBLIC) && - constructor.getParameters().size() == 0) { - hasDefaultConstructor = true; - break; - } - } - if (!hasDefaultConstructor && !isStateful) { - if (classDecl.getDeclaringType() != null && !modifiers.contains(Modifier.STATIC)) { - builder.onError(classDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_INNERCLASS_NOT_STATIC(classDecl.getQualifiedName())); - return false; - } - - builder.onError(classDecl.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_NO_DEFAULT_CONSTRUCTOR(classDecl.getQualifiedName())); - return false; - } - if (webService.endpointInterface().length() == 0) { - if (!methodsAreLegal(classDecl)) - return false; - } else { - InterfaceDeclaration intfDecl = getEndpointInterfaceDecl(webService.endpointInterface(), classDecl); - if (!classImplementsSEI(classDecl, intfDecl)) - return false; - } - - return true; - } - - private boolean isStateful(ClassDeclaration classDecl) { - return classDecl.getAnnotation(Stateful.class)!=null; - } - - protected boolean classImplementsSEI(ClassDeclaration classDecl, - InterfaceDeclaration intfDecl) { - for (InterfaceType interfaceType : classDecl.getSuperinterfaces()) { - if (interfaceType.getDeclaration().equals(intfDecl)) - return true; - } - boolean implementsMethod; - for (MethodDeclaration method : intfDecl.getMethods()) { - implementsMethod = false; - for (MethodDeclaration classMethod : classDecl.getMethods()) { - if (sameMethod(method, classMethod)) { - implementsMethod = true; - break; - } - } - if (!implementsMethod) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_METHOD_NOT_IMPLEMENTED(intfDecl.getSimpleName(), classDecl.getSimpleName(), method)); - return false; - } - } - return true; - } - - protected boolean sameMethod(MethodDeclaration method1, MethodDeclaration method2) { - if (!method1.getSimpleName().equals(method2.getSimpleName())) - return false; - if (!method1.getReturnType().equals(method2.getReturnType())) - return false; - ParameterDeclaration[] params1 = method1.getParameters().toArray(new ParameterDeclaration[0]); - ParameterDeclaration[] params2 = method2.getParameters().toArray(new ParameterDeclaration[0]); - if (params1.length != params2.length) - return false; - int pos = 0; - for (ParameterDeclaration param1 : method1.getParameters()) { - if (!param1.getType().equals(params2[pos++].getType())) - return false; - } - return true; - } - - protected boolean isLegalSEI(InterfaceDeclaration intf) { - for (FieldDeclaration field : intf.getFields()) - if (field.getConstantValue() != null) { - builder.onError(WebserviceapMessages.WEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(intf.getQualifiedName(), field.getSimpleName())); - return false; - } - if (!methodsAreLegal(intf)) - return false; - return true; - } - - protected boolean methodsAreLegal(InterfaceDeclaration intfDecl) { - hasWebMethods = false; - for (MethodDeclaration method : intfDecl.getMethods()) { - if (!isLegalMethod(method, intfDecl)) - return false; - } - for (InterfaceType superIntf : intfDecl.getSuperinterfaces()) { - if (!methodsAreLegal(superIntf.getDeclaration())) - return false; - } - return true; - } - - protected boolean methodsAreLegal(ClassDeclaration classDecl) { - hasWebMethods = hasWebMethods(classDecl); - for (MethodDeclaration method : classDecl.getMethods()) { - if (!isLegalMethod(method, classDecl)) - return false; - } - ClassType superClass = classDecl.getSuperclass(); - - if (!superClass.getDeclaration().getQualifiedName().equals(JAVA_LANG_OBJECT) && !methodsAreLegal(superClass.getDeclaration())) { - return false; - } - return true; - } - - - protected boolean isLegalMethod(MethodDeclaration method, TypeDeclaration typeDecl) { - WebMethod webMethod = method.getAnnotation(WebMethod.class); - //SEI cannot have methods with @WebMethod(exclude=true) - if (typeDecl instanceof InterfaceDeclaration && webMethod != null && webMethod.exclude()) - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeDecl.getQualifiedName(), method.toString())); - - if (hasWebMethods && (webMethod == null)) - return true; - if (!hasWebMethods && (webMethod !=null) && webMethod.exclude()) { - return true; - } - /* - This check is not needed as Impl class is already checked that it is not abstract. - if (typeDecl instanceof ClassDeclaration && method.getModifiers().contains(Modifier.ABSTRACT)) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeDecl.getQualifiedName(), method.getSimpleName())); - return false; - } - */ - if (!isLegalType(method.getReturnType())) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeDecl.getQualifiedName(), - method.getSimpleName(), - method.getReturnType())); - } - boolean isOneway = method.getAnnotation(Oneway.class) != null; - if (isOneway && !isValidOnewayMethod(method, typeDecl)) - return false; - - - SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); - if (soapBinding != null) { - if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeDecl.getQualifiedName(), method.toString())); - } - } - - int paramIndex = 0; - for (ParameterDeclaration parameter : method.getParameters()) { - if (!isLegalParameter(parameter, method, typeDecl, paramIndex++)) - return false; - } - - if (!isDocLitWrapped() && - soapStyle.equals(SOAPStyle.DOCUMENT)) { - ParameterDeclaration outParam = getOutParameter(method); - int inParams = getModeParameterCount(method, WebParam.Mode.IN); - int outParams = getModeParameterCount(method, WebParam.Mode.OUT); - if (inParams != 1) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeDecl.getQualifiedName(), method.toString())); - } - if (method.getReturnType() instanceof VoidType) { - if (outParam == null && !isOneway) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_DOC_BARE_NO_OUT(typeDecl.getQualifiedName(), method.toString())); - } - if (outParams != 1) { - if (!isOneway && outParams != 0) - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeDecl.getQualifiedName(), method.toString())); - } - } else { - if (outParams > 0) { - builder.onError(outParam.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeDecl.getQualifiedName(), method.toString())); - } - } - } - return true; - } - - protected boolean isLegalParameter(ParameterDeclaration param, - MethodDeclaration method, - TypeDeclaration typeDecl, - int paramIndex) { - if (!isLegalType(param.getType())) { - builder.onError(param.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_METHOD_PARAMETER_TYPES_CANNOT_IMPLEMENT_REMOTE(typeDecl.getQualifiedName(), - method.getSimpleName(), - param.getSimpleName(), - param.getType().toString())); - return false; - } - TypeMirror holderType; - holderType = builder.getHolderValueType(param.getType()); - WebParam webParam = param.getAnnotation(WebParam.class); - WebParam.Mode mode = null; - if (webParam != null) - mode = webParam.mode(); - - if (holderType != null) { - if (mode != null && mode==WebParam.Mode.IN) - builder.onError(param.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_HOLDER_PARAMETERS_MUST_NOT_BE_IN_ONLY(typeDecl.getQualifiedName(), method.toString(), paramIndex)); - } else if (mode != null && mode!=WebParam.Mode.IN) { - builder.onError(param.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_NON_IN_PARAMETERS_MUST_BE_HOLDER(typeDecl.getQualifiedName(), method.toString(), paramIndex)); - } - - - - return true; - } - - protected boolean isDocLitWrapped() { - return soapStyle.equals(SOAPStyle.DOCUMENT) && wrapped; - } - - protected boolean isValidOnewayMethod(MethodDeclaration method, TypeDeclaration typeDecl) { - boolean valid = true; - if (!(method.getReturnType() instanceof VoidType)) { - // this is an error, cannot be Oneway and have a return type - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_RETURN_TYPE(typeDecl.getQualifiedName(), method.toString())); - valid = false; - } - ParameterDeclaration outParam = getOutParameter(method); - if (outParam != null) { - builder.onError(outParam.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ONEWAY_AND_OUT(typeDecl.getQualifiedName(), method.toString())); - valid = false; - } - if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { - int inCnt = getModeParameterCount(method, WebParam.Mode.IN); - if (inCnt != 1) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ONEWAY_AND_NOT_ONE_IN(typeDecl.getQualifiedName(), method.toString())); - valid = false; - } - } - ClassDeclaration exDecl; - for (ReferenceType thrownType : method.getThrownTypes()) { - exDecl = ((ClassType)thrownType).getDeclaration(); - if (!builder.isRemoteException(exDecl)) { - builder.onError(method.getPosition(), WebserviceapMessages.localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_DECLARE_EXCEPTIONS(typeDecl.getQualifiedName(), method.toString(), exDecl.getQualifiedName())); - valid = false; - } - } - return valid; - } - - protected int getModeParameterCount(MethodDeclaration method, WebParam.Mode mode) { - WebParam webParam; - int cnt = 0; - for (ParameterDeclaration param : method.getParameters()) { - webParam = param.getAnnotation(WebParam.class); - if (webParam != null) { - if (webParam.header()) - continue; - if (isEquivalentModes(mode, webParam.mode())) - cnt++; - } else { - if (isEquivalentModes(mode, WebParam.Mode.IN)) { - cnt++; - } - } - } - return cnt; - } - - protected boolean isEquivalentModes(WebParam.Mode mode1, WebParam.Mode mode2) { - if (mode1.equals(mode2)) - return true; - assert mode1==WebParam.Mode.IN || mode1==WebParam.Mode.OUT; - if (mode1==WebParam.Mode.IN && mode2!=WebParam.Mode.OUT) - return true; - if (mode1==WebParam.Mode.OUT && mode2!=WebParam.Mode.IN) - return true; - return false; - } - - protected boolean isHolder(ParameterDeclaration param) { - return builder.getHolderValueType(param.getType()) != null; - } - - protected boolean isLegalType(TypeMirror type) { - if (!(type instanceof DeclaredType)) - return true; - TypeDeclaration typeDecl = ((DeclaredType)type).getDeclaration(); - if(typeDecl == null) { - // can be null, if this type's declaration is unknown. This may be the result of a processing error, such as a missing class file. - builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(typeDecl.toString(), context.getRound())); - } - return !builder.isRemote(typeDecl); - } - - protected ParameterDeclaration getOutParameter(MethodDeclaration method) { - WebParam webParam; - for (ParameterDeclaration param : method.getParameters()) { - webParam = param.getAnnotation(WebParam.class); - if (webParam != null && webParam.mode()!=WebParam.Mode.IN) { - return param; - } - } - return null; - } - - protected static class MySOAPBinding implements SOAPBinding { - public Style style() {return SOAPBinding.Style.DOCUMENT;} - public Use use() {return SOAPBinding.Use.LITERAL; } - public ParameterStyle parameterStyle() { return SOAPBinding.ParameterStyle.WRAPPED;} - public Class annotationType() { - return SOAPBinding.class; - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java deleted file mode 100644 index 17fb0729946..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java +++ /dev/null @@ -1,615 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import static com.sun.codemodel.internal.ClassType.CLASS; -import com.sun.codemodel.internal.*; -import com.sun.codemodel.internal.writer.ProgressCodeWriter; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.ClassType; -import com.sun.mirror.type.*; -import com.sun.tools.internal.ws.processor.generator.GeneratorBase; -import com.sun.tools.internal.ws.processor.generator.GeneratorConstants; -import com.sun.tools.internal.ws.processor.generator.Names; -import com.sun.tools.internal.ws.processor.modeler.ModelerException; -import com.sun.tools.internal.ws.processor.util.DirectoryUtil; -import com.sun.tools.internal.ws.resources.WebserviceapMessages; -import com.sun.tools.internal.ws.util.ClassNameInfo; -import com.sun.tools.internal.ws.wscompile.FilerCodeWriter; -import com.sun.tools.internal.ws.wscompile.WsgenOptions; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; -import com.sun.xml.internal.ws.util.StringUtils; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.api.impl.NameConverter; - -import javax.jws.*; -import javax.xml.bind.annotation.*; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.namespace.QName; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.WebFault; -import java.io.File; -import java.io.IOException; -import java.util.*; -import java.lang.annotation.Annotation; - - -/** - * This class generates the request/response and Exception Beans - * used by the JAX-WS runtime. - * - * @author WS Development Team - */ -public class WebServiceWrapperGenerator extends WebServiceVisitor { - protected Set wrapperNames; - protected Set processedExceptions; - protected JCodeModel cm; - protected MakeSafeTypeVisitor makeSafeVisitor; - - - public WebServiceWrapperGenerator(ModelBuilder builder, AnnotationProcessorContext context) { - super(builder, context); - makeSafeVisitor = new MakeSafeTypeVisitor(builder.getAPEnv()); - } - - protected void processWebService(WebService webService, TypeDeclaration d) { - cm = new JCodeModel(); - wrapperNames = new HashSet(); - processedExceptions = new HashSet(); - } - - protected void postProcessWebService(WebService webService, InterfaceDeclaration d) { - super.postProcessWebService(webService, d); - doPostProcessWebService(webService, d); - } - protected void postProcessWebService(WebService webService, ClassDeclaration d) { - super.postProcessWebService(webService, d); - doPostProcessWebService(webService, d); - } - - protected void doPostProcessWebService(WebService webService, TypeDeclaration d) { - if (cm != null) { - File sourceDir = builder.getSourceDir(); - assert(sourceDir != null); - WsgenOptions options = builder.getOptions(); - try { - CodeWriter cw = new FilerCodeWriter(sourceDir, options); - if(options.verbose) - cw = new ProgressCodeWriter(cw, System.out); - cm.build(cw); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - protected void processMethod(MethodDeclaration method, WebMethod webMethod) { - builder.log("WrapperGen - method: "+method); - builder.log("method.getDeclaringType(): "+method.getDeclaringType()); - boolean generatedWrapper = false; - if (wrapped && soapStyle.equals(SOAPStyle.DOCUMENT)) { - generatedWrapper = generateWrappers(method, webMethod); - } - generatedWrapper = generateExceptionBeans(method) || generatedWrapper; - if (generatedWrapper) { - // Theres not going to be a second round - builder.setWrapperGenerated(generatedWrapper); - } - } - - private boolean generateExceptionBeans(MethodDeclaration method) { - String beanPackage = packageName + PD_JAXWS_PACKAGE_PD; - if (packageName.length() == 0) - beanPackage = JAXWS_PACKAGE_PD; - boolean beanGenerated = false; - for (ReferenceType thrownType : method.getThrownTypes()) { - ClassDeclaration typeDecl = ((ClassType)thrownType).getDeclaration(); - if (typeDecl == null){ - builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(thrownType.toString(), context.getRound())); - return false; - } - boolean tmp = generateExceptionBean(typeDecl, beanPackage); - beanGenerated = beanGenerated || tmp; - } - return beanGenerated; - } - - private boolean duplicateName(String name) { - for (String str : wrapperNames) { - if (str.equalsIgnoreCase(name)) - return true; - } - wrapperNames.add(name); - return false; - } - - private boolean generateWrappers(MethodDeclaration method, WebMethod webMethod) { - boolean isOneway = method.getAnnotation(Oneway.class) != null; - String beanPackage = packageName + PD_JAXWS_PACKAGE_PD; - if (packageName.length() == 0) - beanPackage = JAXWS_PACKAGE_PD; - String methodName = method.getSimpleName(); - String operationName = builder.getOperationName(methodName); - operationName = webMethod != null && webMethod.operationName().length() > 0 ? - webMethod.operationName() : operationName; - String reqName = operationName; - String resName = operationName+RESPONSE; - String reqNamespace = typeNamespace; - String resNamespace = typeNamespace; - - String requestClassName = beanPackage + StringUtils.capitalize(method.getSimpleName()); - RequestWrapper reqWrapper = method.getAnnotation(RequestWrapper.class); - if (reqWrapper != null) { - if (reqWrapper.className().length() > 0) - requestClassName = reqWrapper.className(); - if (reqWrapper.localName().length() > 0) - reqName = reqWrapper.localName(); - if (reqWrapper.targetNamespace().length() > 0) - reqNamespace = reqWrapper.targetNamespace(); - } - builder.log("requestWrapper: "+requestClassName); -///// fix for wsgen CR 6442344 - File file = new File(DirectoryUtil.getOutputDirectoryFor(requestClassName, builder.getSourceDir()), - Names.stripQualifier(requestClassName) + GeneratorConstants.JAVA_SRC_SUFFIX); - builder.getOptions().addGeneratedFile(file); -////////// - boolean canOverwriteRequest = builder.canOverWriteClass(requestClassName); - if (!canOverwriteRequest) { - builder.log("Class " + requestClassName + " exists. Not overwriting."); - } - if (duplicateName(requestClassName) && canOverwriteRequest) { - builder.onError(WebserviceapMessages.WEBSERVICEAP_METHOD_REQUEST_WRAPPER_BEAN_NAME_NOT_UNIQUE(typeDecl.getQualifiedName(), method.toString())); - } - - String responseClassName = null; - boolean canOverwriteResponse = canOverwriteRequest; - if (!isOneway) { - responseClassName = beanPackage+StringUtils.capitalize(method.getSimpleName())+RESPONSE; - ResponseWrapper resWrapper = method.getAnnotation(ResponseWrapper.class); - if(resWrapper != null) { - if (resWrapper.className().length() > 0) - responseClassName = resWrapper.className(); - if (resWrapper.localName().length() > 0) - resName = resWrapper.localName(); - if (resWrapper.targetNamespace().length() > 0) - resNamespace = resWrapper.targetNamespace(); - } - canOverwriteResponse = builder.canOverWriteClass(responseClassName); - if (!canOverwriteResponse) { - builder.log("Class " + responseClassName + " exists. Not overwriting."); - } - if (duplicateName(responseClassName) && canOverwriteResponse) { - builder.onError(WebserviceapMessages.WEBSERVICEAP_METHOD_RESPONSE_WRAPPER_BEAN_NAME_NOT_UNIQUE(typeDecl.getQualifiedName(), method.toString())); - } - file = new File(DirectoryUtil.getOutputDirectoryFor(responseClassName, builder.getSourceDir()), - Names.stripQualifier(responseClassName) + GeneratorConstants.JAVA_SRC_SUFFIX); - builder.getOptions().addGeneratedFile(file); - } - ArrayList reqMembers = new ArrayList(); - ArrayList resMembers = new ArrayList(); - WrapperInfo reqWrapperInfo = new WrapperInfo(requestClassName); - reqWrapperInfo.setMembers(reqMembers); - WrapperInfo resWrapperInfo = null; - if (!isOneway) { - resWrapperInfo = new WrapperInfo(responseClassName); - resWrapperInfo.setMembers(resMembers); - } - seiContext.setReqWrapperOperation(method, reqWrapperInfo); - if (!isOneway) - seiContext.setResWrapperOperation(method, resWrapperInfo); - try { - if (!canOverwriteRequest && !canOverwriteResponse) { - return false; - } - - JDefinedClass reqCls = null; - if (canOverwriteRequest) { - reqCls = getCMClass(requestClassName, CLASS); - } - - JDefinedClass resCls = null; - if (!isOneway && canOverwriteResponse) { - resCls = getCMClass(responseClassName, CLASS); - } - - // XMLElement Declarations - writeXmlElementDeclaration(reqCls, reqName,reqNamespace); - writeXmlElementDeclaration(resCls, resName, resNamespace); - - collectMembers(method, reqMembers, resMembers); - - // XmlType - writeXmlTypeDeclaration(reqCls, reqName, reqNamespace, reqMembers); - writeXmlTypeDeclaration(resCls, resName, resNamespace, resMembers); - - // class members - writeMembers(reqCls, reqMembers); - writeMembers(resCls, resMembers); - - } catch (Exception e) { - throw new ModelerException("modeler.nestedGeneratorError",e); - } - return true; - } - - private void collectMembers(MethodDeclaration method, - ArrayList requestMembers, - ArrayList responseMembers) { - - WebResult webResult = method.getAnnotation(WebResult.class); - List jaxbRespAnnotations = collectJAXBAnnotations(method); - String responseElementName = RETURN; - String responseName = RETURN_VALUE; - String responseNamespace = wrapped ? EMTPY_NAMESPACE_ID : typeNamespace; - boolean isResultHeader = false; - if (webResult != null) { - if (webResult.name().length() > 0) { - responseElementName = webResult.name(); - responseName = JAXBRIContext.mangleNameToVariableName(webResult.name()); - - //We wont have to do this if JAXBRIContext.mangleNameToVariableName() takes - //care of mangling java identifiers - responseName = Names.getJavaReserverVarialbeName(responseName); - } - responseNamespace = webResult.targetNamespace().length() > 1 ? - webResult.targetNamespace() : - responseNamespace; - isResultHeader = webResult.header(); - } - - // class members - WebParam webParam; - TypeMirror paramType; - String paramName; - - String paramNamespace; - TypeMirror holderType; - int paramIndex = -1; - TypeMirror typeMirror = getSafeType(method.getReturnType()); - - if (!(method.getReturnType() instanceof VoidType) && !isResultHeader) { - responseMembers.add(new MemberInfo(typeMirror, responseName, - new QName(responseNamespace, responseElementName), method, jaxbRespAnnotations.toArray(new Annotation[jaxbRespAnnotations.size()]))); - } - - for (ParameterDeclaration param : method.getParameters()) { - List jaxbAnnotation = collectJAXBAnnotations(param); - WebParam.Mode mode = null; - paramIndex++; - holderType = builder.getHolderValueType(param.getType()); - webParam = param.getAnnotation(WebParam.class); - typeMirror = getSafeType(param.getType()); - paramType = typeMirror; - paramNamespace = wrapped ? EMTPY_NAMESPACE_ID : typeNamespace; - if (holderType != null) { - paramType = holderType; - } - paramName = "arg"+paramIndex; - if (webParam != null && webParam.header()) { - continue; - } - if (webParam != null) { - mode = webParam.mode(); - if (webParam.name().length() > 0) - paramName = webParam.name(); - if (webParam.targetNamespace().length() > 0) - paramNamespace = webParam.targetNamespace(); - } - - String propertyName = JAXBRIContext.mangleNameToVariableName(paramName); - //We wont have to do this if JAXBRIContext.mangleNameToVariableName() takes - //care of mangling java identifiers - propertyName = Names.getJavaReserverVarialbeName(propertyName); - - MemberInfo memInfo = new MemberInfo(paramType, propertyName, - new QName(paramNamespace, paramName), param, jaxbAnnotation.toArray(new Annotation[jaxbAnnotation.size()])); - if (holderType != null) { - if (mode == null || mode.equals(WebParam.Mode.INOUT)) { - requestMembers.add(memInfo); - } - responseMembers.add(memInfo); - } else { - requestMembers.add(memInfo); - } - } - } - - private List collectJAXBAnnotations(ParameterDeclaration param) { - List jaxbAnnotation = new ArrayList(); - Annotation ann = param.getAnnotation(XmlAttachmentRef.class); - if(ann != null) - jaxbAnnotation.add(ann); - - ann = param.getAnnotation(XmlMimeType.class); - if(ann != null) - jaxbAnnotation.add(ann); - - ann = param.getAnnotation(XmlJavaTypeAdapter.class); - if(ann != null) - jaxbAnnotation.add(ann); - - ann = param.getAnnotation(XmlList.class); - if(ann != null) - jaxbAnnotation.add(ann); - return jaxbAnnotation; - } - - private List collectJAXBAnnotations(MethodDeclaration method) { - List jaxbAnnotation = new ArrayList(); - Annotation ann = method.getAnnotation(XmlAttachmentRef.class); - if(ann != null) - jaxbAnnotation.add(ann); - - ann = method.getAnnotation(XmlMimeType.class); - if(ann != null) - jaxbAnnotation.add(ann); - - ann = method.getAnnotation(XmlJavaTypeAdapter.class); - if(ann != null) - jaxbAnnotation.add(ann); - - ann = method.getAnnotation(XmlList.class); - if(ann != null) - jaxbAnnotation.add(ann); - return jaxbAnnotation; - } - - private TypeMirror getSafeType(TypeMirror type) { - return makeSafeVisitor.apply(type, builder.getAPEnv().getTypeUtils()); - } - - private JType getType(TypeMirror typeMirror) { - String type = typeMirror.toString(); - try { -// System.out.println("typeName: "+typeName); - return cm.parseType(type); -// System.out.println("type: "+type); - } catch (ClassNotFoundException e) { - return cm.ref(type); - } - } - - private ArrayList sortMembers(ArrayList members) { - Map sortedMap = new java.util.TreeMap(); - for (MemberInfo member : members) { - sortedMap.put(member.getParamName(), member); - } - ArrayList sortedMembers = new ArrayList(); - sortedMembers.addAll(sortedMap.values()); - return sortedMembers; - } - - private void writeMembers(JDefinedClass cls, ArrayList members) { - if (cls == null) - return; - for (MemberInfo memInfo : members) { - JType type = getType(memInfo.getParamType()); - JFieldVar field = cls.field(JMod.PRIVATE, type, memInfo.getParamName()); - QName elementName = memInfo.getElementName(); - if (elementName != null) { - if (soapStyle.equals(SOAPStyle.RPC) || wrapped) { - JAnnotationUse xmlElementAnn = field.annotate(XmlElement.class); - xmlElementAnn.param("name", elementName.getLocalPart()); - xmlElementAnn.param("namespace", elementName.getNamespaceURI()); - if(memInfo.getParamType() instanceof ArrayType){ - xmlElementAnn.param("nillable", true); - } - } else { - field.annotate(XmlValue.class); - } - annotateParameterWithJAXBAnnotations(field, memInfo.getJaxbAnnotations()); - } - - // copy adapter if needed - XmlJavaTypeAdapter xjta = memInfo.getDecl().getAnnotation(XmlJavaTypeAdapter.class); - if(xjta!=null) { - JAnnotationUse xjtaA = field.annotate(XmlJavaTypeAdapter.class); - try { - xjta.value(); - throw new AssertionError(); - } catch (MirroredTypeException e) { - xjtaA.param("value",getType(e.getTypeMirror())); - } - // XmlJavaTypeAdapter.type() is for package only. No need to copy. - } - } - for (MemberInfo memInfo : members) { - writeMember(cls, memInfo.getParamType(), - memInfo.getParamName()); - } - } - - private void annotateParameterWithJAXBAnnotations(JFieldVar field, Annotation[] jaxbAnnotations) { - for(Annotation ann : jaxbAnnotations){ - if(ann instanceof XmlMimeType){ - JAnnotationUse jaxbAnn = field.annotate(XmlMimeType.class); - jaxbAnn.param("value", ((XmlMimeType)ann).value()); - }else if(ann instanceof XmlJavaTypeAdapter){ - JAnnotationUse jaxbAnn = field.annotate(XmlJavaTypeAdapter.class); - XmlJavaTypeAdapter ja = (XmlJavaTypeAdapter) ann; - jaxbAnn.param("value", ja.value()); - jaxbAnn.param("type", ja.type()); - }else if(ann instanceof XmlAttachmentRef){ - field.annotate(XmlAttachmentRef.class); - }else if(ann instanceof XmlList){ - field.annotate(XmlList.class); - } - } - } - - protected JDefinedClass getCMClass(String className, com.sun.codemodel.internal.ClassType type) { - JDefinedClass cls; - try { - cls = cm._class(className, type); - } catch (com.sun.codemodel.internal.JClassAlreadyExistsException e){ - cls = cm._getClass(className); - } - return cls; - } - - private boolean generateExceptionBean(ClassDeclaration thrownDecl, String beanPackage) { - if (builder.isRemoteException(thrownDecl)) - return false; - - String exceptionName = ClassNameInfo.getName(thrownDecl.getQualifiedName()); - if (processedExceptions.contains(exceptionName)) - return false; - processedExceptions.add(exceptionName); - WebFault webFault = thrownDecl.getAnnotation(WebFault.class); - String className = beanPackage+ exceptionName + BEAN; - - TreeMap propertyToTypeMap = new TreeMap(); - - TypeModeler.collectExceptionProperties(thrownDecl,propertyToTypeMap); - - boolean isWSDLException = isWSDLException(propertyToTypeMap, thrownDecl); - String namespace = typeNamespace; - String name = exceptionName; - FaultInfo faultInfo; - if (isWSDLException) { - TypeMirror beanType = getSafeType(propertyToTypeMap.get(FAULT_INFO).getReturnType()); - faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType), true); - namespace = webFault.targetNamespace().length()>0 ? - webFault.targetNamespace() : namespace; - name = webFault.name().length()>0 ? - webFault.name() : name; - faultInfo.setElementName(new QName(namespace, name)); - seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder); - return false; - } - if (webFault != null) { - namespace = webFault.targetNamespace().length()>0 ? - webFault.targetNamespace() : namespace; - name = webFault.name().length()>0 ? - webFault.name() : name; - className = webFault.faultBean().length()>0 ? - webFault.faultBean() : className; - - } - JDefinedClass cls = getCMClass(className, CLASS); - faultInfo = new FaultInfo(className, false); - - if (duplicateName(className)) { - builder.onError(WebserviceapMessages.WEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(typeDecl.getQualifiedName(), thrownDecl.getQualifiedName())); - } - - ArrayList members = new ArrayList(); - for (String key : propertyToTypeMap.keySet()) { - MethodDeclaration method = propertyToTypeMap.get(key); - TypeMirror erasureType = getSafeType(method.getReturnType()); - MemberInfo member = new MemberInfo(erasureType, key, null, method); - members.add(member); - } - faultInfo.setMembers(members); - - boolean canOverWriteBean = builder.canOverWriteClass(className); - if (!canOverWriteBean) { - builder.log("Class " + className + " exists. Not overwriting."); - seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder); - return false; - } - if (seiContext.getExceptionBeanName(thrownDecl.getQualifiedName()) != null) - return false; - - //write class comment - JAXWS warning - JDocComment comment = cls.javadoc(); - for (String doc : GeneratorBase.getJAXWSClassComment(builder.getSourceVersion())) { - comment.add(doc); - } - - // XmlElement Declarations - writeXmlElementDeclaration(cls, name, namespace); - - // XmlType Declaration - members = sortMembers(members); - writeXmlTypeDeclaration(cls, exceptionName, typeNamespace, members); - - writeMembers(cls, members); - - seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder); - return true; - } - - protected boolean isWSDLException(Map map, ClassDeclaration thrownDecl) { - WebFault webFault = thrownDecl.getAnnotation(WebFault.class); - if (webFault == null) - return false; - return !(map.size() != 2 || map.get(FAULT_INFO) == null); - } - - private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) { - - if (cls == null) - return; - JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class); - xmlRootElementAnn.param("name", elementName); - if (namespaceUri.length() > 0) { - xmlRootElementAnn.param("namespace", namespaceUri); - } - JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class)); - xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD); - } - - private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri, - ArrayList members) { - if (cls == null) - return; - JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class)); - xmlTypeAnn.param("name", typeName); - xmlTypeAnn.param("namespace", namespaceUri); - if (members.size() > 1) { - JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder"); - for (MemberInfo memInfo : members) { - paramArray.param(memInfo.getParamName()); - } - } - } - - private void writeMember(JDefinedClass cls, TypeMirror paramType, - String paramName) { - - if (cls == null) - return; - - String accessorName =JAXBRIContext.mangleNameToPropertyName(paramName); - String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; - JType propType = getType(paramType); - JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); - JDocComment methodDoc = m.javadoc(); - JCommentPart ret = methodDoc.addReturn(); - ret.add("returns "+propType.name()); - JBlock body = m.body(); - body._return( JExpr._this().ref(paramName) ); - - m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); - JVar param = m.param(propType, paramName); - methodDoc = m.javadoc(); - JCommentPart part = methodDoc.addParam(paramName); - part.add("the value for the "+ paramName+" property"); - body = m.body(); - body.assign( JExpr._this().ref(paramName), param ); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WrapperInfo.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WrapperInfo.java deleted file mode 100644 index 635f53b4d3e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/annotation/WrapperInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.annotation; - -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author dkohlert - */ -public class WrapperInfo { - public String wrapperName; - public List members; - - /** Creates a new instance of FaultInfo */ - public WrapperInfo() { - } - public WrapperInfo(String wrapperName) { - this.wrapperName = wrapperName; - } - - public void setWrapperName(String wrapperName) { - this.wrapperName = wrapperName; - } - - public String getWrapperName() { - return wrapperName; - } - public List getMembers() { - return members; - } - public void setMembers(List members) { - this.members = members; - } - public void addMember(MemberInfo member) { - if (members == null) - members = new ArrayList(); - members.add(member); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/AccessorElement.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/AccessorElement.java deleted file mode 100644 index aef8f22fbd7..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/AccessorElement.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import javax.xml.namespace.QName; - - -/** - * @author Vivek Pandey - * - * Rpc/Lit AccessorElement to be used to generate pseudo schema - */ -class AccessorElement { - - private QName type; - private String name; - - - /** - * @param type - * @param name - */ - public AccessorElement(String name, QName type) { - this.type = type; - this.name = name; - } - /** - * @return Returns the type. - */ - public QName getType() { - return type; - } - /** - * @param type The type to set. - */ - public void setType(QName type) { - this.type = type; - } - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java deleted file mode 100644 index 4f6c6ceaa28..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.processor.util.ClassNameCollector; -import com.sun.tools.internal.xjc.api.ClassNameAllocator; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Vivek Pandey - *

    - * Implementation of Callback interface that allows the driver of the XJC API to rename JAXB-generated classes/interfaces/enums. - */ -public class ClassNameAllocatorImpl implements ClassNameAllocator { - public ClassNameAllocatorImpl(ClassNameCollector classNameCollector) { - this.classNameCollector = classNameCollector; - this.jaxbClasses = new HashSet(); - } - - public String assignClassName(String packageName, String className) { - if(packageName== null || className == null){ - //TODO: throw Exception - return className; - } - - //if either of the values are empty string return the default className - if(packageName.equals("") || className.equals("")) - return className; - - String fullClassName = packageName+"."+className; - - // Check if there is any conflict with jaxws generated classes - Set seiClassNames = classNameCollector.getSeiClassNames(); - if(seiClassNames != null && seiClassNames.contains(fullClassName)){ - className += TYPE_SUFFIX; - } - - jaxbClasses.add(packageName+"."+className); - return className; - } - - /** - * - * @return jaxbGenerated classNames - */ - public Set getJaxbGeneratedClasses() { - return jaxbClasses; - } - - private final static String TYPE_SUFFIX = "_Type"; - private ClassNameCollector classNameCollector; - private Set jaxbClasses; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ConsoleErrorReporter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ConsoleErrorReporter.java deleted file mode 100644 index 8ee0219f5ac..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ConsoleErrorReporter.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import org.xml.sax.SAXParseException; - -import java.io.OutputStream; -import java.io.PrintStream; - -public class ConsoleErrorReporter extends ErrorReceiver { - - private boolean hasError; - private PrintStream output; - private boolean debug; - - public ConsoleErrorReporter(PrintStream stream) { - this.output = stream; - } - - public ConsoleErrorReporter(OutputStream outputStream) { - this.output = new PrintStream(outputStream); - } - - public boolean hasError() { - return hasError; - } - - public void error(SAXParseException e) { - if(debug) - e.printStackTrace(); - hasError = true; - print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e); - } - - - - public void fatalError(SAXParseException e) { - if(debug) - e.printStackTrace(); - hasError = true; - print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e); - } - - public void warning(SAXParseException e) { - print(WscompileMessages.WSIMPORT_WARNING_MESSAGE(e.getMessage()), e); - } - - /** - * Used to report possibly verbose information that - * can be safely ignored. - */ - public void info(SAXParseException e) { - print(WscompileMessages.WSIMPORT_INFO_MESSAGE(e.getMessage()), e); - } - - public void debug(SAXParseException e){ - print(WscompileMessages.WSIMPORT_DEBUG_MESSAGE(e.getMessage()), e); - } - - - private void print(String message, SAXParseException e) { - output.println(message); - output.println(getLocationString(e)); - output.println(); - } - - public void enableDebugging(){ - this.debug = true; - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/JAXBModelBuilder.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/JAXBModelBuilder.java deleted file mode 100644 index 880d63d0e23..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/JAXBModelBuilder.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.processor.model.ModelException; -import com.sun.tools.internal.ws.processor.model.java.JavaSimpleType; -import com.sun.tools.internal.ws.processor.model.java.JavaType; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBMapping; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBModel; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBType; -import com.sun.tools.internal.ws.processor.util.ClassNameCollector; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.parser.DOMForestScanner; -import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder; -import com.sun.tools.internal.xjc.api.S2JJAXBModel; -import com.sun.tools.internal.xjc.api.SchemaCompiler; -import com.sun.tools.internal.xjc.api.TypeAndAnnotation; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; -import org.xml.sax.helpers.LocatorImpl; - -import javax.xml.namespace.QName; - -/** - * @author Vivek Pandey - * - * Uses JAXB XJC apis to build JAXBModel and resolves xml to java type mapping from JAXBModel - */ -public class JAXBModelBuilder { - - private final ErrorReceiver errReceiver; - private final WsimportOptions options; - private final MetadataFinder forest; - - public JAXBModelBuilder(WsimportOptions options, ClassNameCollector classNameCollector, MetadataFinder finder, ErrorReceiver errReceiver) { - this._classNameAllocator = new ClassNameAllocatorImpl(classNameCollector); - this.errReceiver = errReceiver; - this.options = options; - this.forest = finder; - - internalBuildJAXBModel(); - } - - /** - * Builds model from WSDL document. Model contains abstraction which is used by the - * generators to generate the stub/tie/serializers etc. code. - * - * @see com.sun.tools.internal.ws.processor.modeler.Modeler#buildModel() - */ - - private void internalBuildJAXBModel(){ - try { - schemaCompiler = options.getSchemaCompiler(); - schemaCompiler.resetSchema(); - schemaCompiler.setEntityResolver(options.entityResolver); - schemaCompiler.setClassNameAllocator(_classNameAllocator); - schemaCompiler.setErrorListener(errReceiver); - int schemaElementCount = 1; - - for (Element element : forest.getInlinedSchemaElement()) { - String location = element.getOwnerDocument().getDocumentURI(); - String systemId = location + "#types?schema" + schemaElementCount++; - if(forest.isMexMetadata) - schemaCompiler.parseSchema(systemId,element); - else - new DOMForestScanner(forest).scan(element,schemaCompiler.getParserHandler(systemId)); - } - - //feed external jaxb:bindings file - InputSource[] externalBindings = options.getSchemaBindings(); - if(externalBindings != null){ - for(InputSource jaxbBinding : externalBindings){ - schemaCompiler.parseSchema(jaxbBinding); - } - } - } catch (Exception e) { - throw new ModelException(e); - } - } - - public JAXBType getJAXBType(QName qname){ - JAXBMapping mapping = jaxbModel.get(qname); - if (mapping == null){ - return null; - } - JavaType javaType = new JavaSimpleType(mapping.getType()); - return new JAXBType(qname, javaType, mapping, jaxbModel); - } - - public TypeAndAnnotation getElementTypeAndAnn(QName qname){ - JAXBMapping mapping = jaxbModel.get(qname); - if (mapping == null){ - return null; - } - return mapping.getType().getTypeAnn(); - } - - protected void bind(){ - S2JJAXBModel rawJaxbModel = schemaCompiler.bind(); - if(rawJaxbModel == null) - throw new AbortException(); - options.setCodeModel(rawJaxbModel.generateCode(null, errReceiver)); - jaxbModel = new JAXBModel(rawJaxbModel); - jaxbModel.setGeneratedClassNames(_classNameAllocator.getJaxbGeneratedClasses()); - } - - protected SchemaCompiler getJAXBSchemaCompiler(){ - return schemaCompiler; - } - - public JAXBModel getJAXBModel(){ - return jaxbModel; - } - - private JAXBModel jaxbModel; - private SchemaCompiler schemaCompiler; - private final ClassNameAllocatorImpl _classNameAllocator; - protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl(); - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/MimeHelper.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/MimeHelper.java deleted file mode 100644 index bd661005e53..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/MimeHelper.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.processor.modeler.JavaSimpleTypeCreator; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Vivek Pandey - * - */ -public class MimeHelper { - /** - * @param mimePart - * @return unique attachment ID - */ - protected static String getAttachmentUniqueID(String mimePart) { - //return "uuid@" + mimePart; - return mimePart; - } - - /** - * @param mimeType - * @return true if mimeType is a binary type - */ - protected static boolean isMimeTypeBinary(String mimeType) { - if (mimeType.equals(JPEG_IMAGE_MIME_TYPE) - || mimeType.equals(GIF_IMAGE_MIME_TYPE) - ) { - return true; - } else if ( - mimeType.equals(TEXT_XML_MIME_TYPE) - || mimeType.equals(TEXT_HTML_MIME_TYPE) - || mimeType.equals(TEXT_PLAIN_MIME_TYPE) - || mimeType.equals(APPLICATION_XML_MIME_TYPE) - || mimeType.equals(MULTIPART_MIME_TYPE)) { - return false; - } - //some unknown mime type, will be mapped to DataHandler java type so - // return true - return true; - } - - protected static void initMimeTypeToJavaType() { - mimeTypeToJavaType.put(JPEG_IMAGE_MIME_TYPE, javaType.IMAGE_JAVATYPE); - //mimeTypeToJavaType.put(PNG_IMAGE_MIME_TYPE, javaType.IMAGE_JAVATYPE); - mimeTypeToJavaType.put(GIF_IMAGE_MIME_TYPE, - javaType.IMAGE_JAVATYPE); - mimeTypeToJavaType.put(TEXT_XML_MIME_TYPE, javaType.SOURCE_JAVATYPE); - //mimeTypeToJavaType.put(TEXT_HTML_MIME_TYPE, javaType.SOURCE_JAVATYPE); - mimeTypeToJavaType.put( - APPLICATION_XML_MIME_TYPE, - javaType.SOURCE_JAVATYPE); - mimeTypeToJavaType.put(TEXT_PLAIN_MIME_TYPE, javaType.STRING_JAVATYPE); - mimeTypeToJavaType.put( - MULTIPART_MIME_TYPE, - javaType.MIME_MULTIPART_JAVATYPE); - - } - - protected static Map mimeTypeToJavaType; - protected static JavaSimpleTypeCreator javaType; - - public static final String JPEG_IMAGE_MIME_TYPE = "image/jpeg"; - //public static final String PNG_IMAGE_MIME_TYPE = "image/png"; - public static final String GIF_IMAGE_MIME_TYPE = "image/gif"; - public static final String TEXT_XML_MIME_TYPE = "text/xml"; - public static final String TEXT_HTML_MIME_TYPE = "text/html"; - public static final String TEXT_PLAIN_MIME_TYPE = "text/plain"; - public static final String APPLICATION_XML_MIME_TYPE = "application/xml"; - public static final String MULTIPART_MIME_TYPE = "multipart/*"; - - /** - * - */ - public MimeHelper() { - mimeTypeToJavaType = new HashMap(); - javaType = new JavaSimpleTypeCreator(); - initMimeTypeToJavaType(); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ModelerUtils.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ModelerUtils.java deleted file mode 100644 index 729dfb04790..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/ModelerUtils.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.processor.model.AbstractType; -import com.sun.tools.internal.ws.processor.model.Block; -import com.sun.tools.internal.ws.processor.model.ModelProperties; -import com.sun.tools.internal.ws.processor.model.Parameter; -import com.sun.tools.internal.ws.processor.model.java.JavaSimpleType; -import com.sun.tools.internal.ws.processor.model.java.JavaStructureMember; -import com.sun.tools.internal.ws.processor.model.java.JavaStructureType; -import com.sun.tools.internal.ws.processor.model.java.JavaType; -import com.sun.tools.internal.ws.processor.model.jaxb.*; -import com.sun.tools.internal.ws.resources.ModelerMessages; -import com.sun.tools.internal.ws.util.ClassNameInfo; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wscompile.ErrorReceiverFilter; -import com.sun.tools.internal.ws.wsdl.document.Message; -import com.sun.tools.internal.ws.wsdl.document.MessagePart; -import com.sun.tools.internal.xjc.api.S2JJAXBModel; -import com.sun.tools.internal.xjc.api.TypeAndAnnotation; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * Utilities to be used by WSDLModeler - * - * @author Vivek Pandey - * - */ -class ModelerUtils { - - /** - * This method should be called incase of wrapper style operations. This is - * equivalent to wrapper style schema component or JAXB Mapping object. - * - * @param jaxbType JAXBType from which a JAXBStructured type will be created. - * @return returns JAXBStructured type - */ - public static JAXBStructuredType createJAXBStructureType(JAXBType jaxbType) { - JAXBStructuredType type = new JAXBStructuredType(jaxbType); - type.setName(jaxbType.getName()); - type.setJavaType(jaxbType.getJavaType()); - return type; - } - - /** - * This method uses JAXBStructured type (wrapper style operations) and - * unwraps it to create list of parameters. - * - * - * @param jaxbType instance of JAXBType, could be JAXBStructured type. - * @param block The Block (body/Header/Attachment) to which the created Parameter belong. - * @return list of Parameters - */ - public static List createUnwrappedParameters(JAXBType jaxbType, - Block block) { - List paramList = new ArrayList(); - JAXBStructuredType type = null; - if (!(jaxbType instanceof JAXBStructuredType)) - type = createJAXBStructureType(jaxbType); - else - type = (JAXBStructuredType) jaxbType; - - JavaStructureType jst = new JavaStructureType(jaxbType.getJavaType() - .getRealName(), true, type); - type.setJavaType(jst); - block.setType(type); - List memberList = jaxbType.getWrapperChildren(); - Iterator props = memberList.iterator(); - while (props.hasNext()) { - JAXBProperty prop = (JAXBProperty) props.next(); - paramList.add(createUnwrappedParameter(prop, jaxbType, block, type, - jst)); - } - - return paramList; - } - - /** - * @param prop - * @param jaxbType - * @param block - * @return - */ - private static Parameter createUnwrappedParameter(JAXBProperty prop, - JAXBType jaxbType, Block block, JAXBStructuredType type, - JavaStructureType jst) { - QName elementName = prop.getElementName(); - JavaType javaType = new JavaSimpleType(prop.getType()); - JAXBElementMember eType = new JAXBElementMember(elementName, jaxbType); - JavaStructureMember jsm = new JavaStructureMember(elementName - .getLocalPart(), javaType, eType); - eType.setJavaStructureMember(jsm); - jst.add(jsm); - eType.setProperty(prop); - type.add(eType); - JAXBType t = new JAXBType(elementName, javaType, jaxbType - .getJaxbMapping(), jaxbType.getJaxbModel()); - t.setUnwrapped(true); - Parameter parameter = createParameter(elementName.getLocalPart(), t, block); - parameter.setEmbedded(true); - return parameter; - } - - public static List createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){ - RpcLitStructure rpcStruct = (RpcLitStructure)block.getType(); - - List parameters = new ArrayList(); - for(MessagePart part : message.getParts()){ - if(!ModelerUtils.isBoundToSOAPBody(part)) - continue; - QName name = part.getDescriptor(); - TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name); - if(typeAndAnn == null){ - String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName(); - errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(), - part.getName(), msgQName)); - throw new AbortException(); - } - String type = typeAndAnn.getTypeClass().fullName(); - type = ClassNameInfo.getGenericClass(type); - RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type); - JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn)); - param.setJavaType(javaType); - rpcStruct.addRpcLitMember(param); - Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block); - parameter.setEmbedded(true); - parameters.add(parameter); - } - return parameters; - } - - /** - * Called for non-wrapper style operations. It returns a Parameter constructed - * using the JAXBType and the Block. - * - * @param partName typically wsdl:part or any name to be given to the parameter - * @param jaxbType type of Parameter - * @param block Block to which the parameter belongs to - * @return Parameter created. - */ - public static Parameter createParameter(String partName, AbstractType jaxbType, - Block block) { - Parameter parameter = new Parameter(partName, block.getEntity()); - parameter.setProperty(ModelProperties.PROPERTY_PARAM_MESSAGE_PART_NAME, - partName); - parameter.setEmbedded(false); - parameter.setType(jaxbType); - parameter.setTypeName(jaxbType.getJavaType().getType().getName()); - parameter.setBlock(block); - return parameter; - } - - /** - * Get Parameter from the list of parameters. - * - * @param paramName - * @param parameters - * @return the Parameter with name paramName from parameters - */ - public static Parameter getParameter(String paramName, List parameters){ - if(parameters == null) - return null; - for(Parameter param: parameters){ - //if(param.getName().equals("_return") && paramName.equals("return") || param.getName().equals(paramName)) { - if(param.getName().equals(paramName)){ - return param; - } - } - return null; - } - - /** - * Compares two JAXBStructures. - * - * @param struct1 - * @param struct2 - * @return true if struct1 and struct2 are equivalent. - */ - public static boolean isEquivalentLiteralStructures( - JAXBStructuredType struct1, - JAXBStructuredType struct2) { - if (struct1.getElementMembersCount() != struct2.getElementMembersCount()) - return false; - Iterator members = struct1.getElementMembers(); - JAXBElementMember member1; - JavaStructureMember javaMember1, javaMember2; - for (int i = 0; members.hasNext(); i++) { - member1 = (JAXBElementMember)members.next(); - javaMember1 = member1.getJavaStructureMember(); - javaMember2 = - ((JavaStructureType)struct2.getJavaType()).getMemberByName( - member1.getJavaStructureMember().getName()); - if (javaMember2.getConstructorPos() != i - || !javaMember1.getType().equals(javaMember2.getType())) { - return false; - } - } - return false; - } - - /** - * @param part - * @return true if part is bound to Mime content - */ - public static boolean isBoundToMimeContent(MessagePart part) { - if((part != null) && part.getBindingExtensibilityElementKind() == MessagePart.WSDL_MIME_BINDING) - return true; - return false; - } - - /** - * @param part - * @return true if part is bound to SOAPBody - */ - public static boolean isBoundToSOAPBody(MessagePart part) { - if((part != null) && part.getBindingExtensibilityElementKind() == MessagePart.SOAP_BODY_BINDING) - return true; - return false; - } - - /** - * @param part - * @return true if part is bound to SOAPHeader - */ - public static boolean isBoundToSOAPHeader(MessagePart part) { - if((part != null) && part.getBindingExtensibilityElementKind() == MessagePart.SOAP_HEADER_BINDING) - return true; - return false; - } - - public static boolean isUnbound(MessagePart part) { - if((part != null) && part.getBindingExtensibilityElementKind() == MessagePart.PART_NOT_BOUNDED) - return true; - return false; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java deleted file mode 100644 index 958c24ccbba..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.processor.generator.Names; -import static com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModelerBase.getExtensionOfType; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wscompile.Options; -import com.sun.tools.internal.ws.wsdl.document.*; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAP12Binding; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPBinding; -import org.xml.sax.InputSource; - -import javax.xml.namespace.QName; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.io.StringWriter; -import java.text.MessageFormat; -import java.util.*; - - -/** - * Builds all possible pseudo schemas for async operation ResponseBean to feed to XJC. - * - * @author Vivek Pandey - */ -public class PseudoSchemaBuilder { - - private final StringWriter buf = new StringWriter(); - private final WSDLDocument wsdlDocument; - private WSDLModeler wsdlModeler; - private final List schemas = new ArrayList(); - private final HashMap bindingNameToPortMap = new HashMap(); - private static final String w3ceprSchemaBinding = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - - private static final String memberSubmissionEPR = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - - private final static String sysId = "http://dummy.pseudo-schema#schema"; - - private WsimportOptions options; - public static List build(WSDLModeler wsdlModeler, WsimportOptions options, ErrorReceiver errReceiver) { - PseudoSchemaBuilder b = new PseudoSchemaBuilder(wsdlModeler.document); - b.wsdlModeler = wsdlModeler; - b.options = options; - b.build(); - int i; - for(i = 0; i < b.schemas.size(); i++){ - InputSource is = b.schemas.get(i); - is.setSystemId(sysId+(i + 1)); - } - //add w3c EPR binding - if(!(options.noAddressingBbinding) && options.target.isLaterThan(Options.Target.V2_1)){ - InputSource is = new InputSource(new ByteArrayInputStream(w3ceprSchemaBinding.getBytes())); - is.setSystemId(sysId+(++i +1)); - b.schemas.add(is); - } - - - //TODO: uncomment after JAXB fixes the issue related to passing multiples of such bindings - //add member submission EPR binding -// InputSource is1 = new InputSource(new ByteArrayInputStream(memberSubmissionEPR.getBytes())); -// is1.setSystemId(sysId+(++i + 1)); -// b.schemas.add(is1); - - return b.schemas; - } - - - private PseudoSchemaBuilder(WSDLDocument _wsdl) { - this.wsdlDocument = _wsdl; - } - - private void build() { - for(Iterator itr=wsdlDocument.getDefinitions().services(); itr.hasNext(); ) - build(itr.next()); - } - - private void build(Service service) { - for( Iterator itr=service.ports(); itr.hasNext(); ) - build(itr.next() ); - } - - private void build(Port port) { - if(wsdlModeler.isProvider(port)) - return; - Binding binding = port.resolveBinding(wsdlDocument); - - SOAPBinding soapBinding = - (SOAPBinding)getExtensionOfType(binding, SOAPBinding.class); - //lets try and see if its SOAP 1.2. dont worry about extension flag, its - // handled much earlier - if (soapBinding == null) { - soapBinding = - (SOAPBinding)getExtensionOfType(binding, SOAP12Binding.class); - } - if(soapBinding == null) - return; - PortType portType = binding.resolvePortType(wsdlDocument); - - QName bindingName = WSDLModelerBase.getQNameOf(binding); - - //we dont want to process the port bound to the binding processed earlier - if(bindingNameToPortMap.containsKey(bindingName)) - return; - - bindingNameToPortMap.put(bindingName, port); - - - for(Iterator itr=binding.operations(); itr.hasNext();){ - BindingOperation bindingOperation = (BindingOperation)itr.next(); - - // get only the bounded operations - Set boundedOps = portType.getOperationsNamed(bindingOperation.getName()); - if(boundedOps.size() != 1) - continue; - Operation operation = (Operation)boundedOps.iterator().next(); - - // No pseudo schema required for doc/lit - if(wsdlModeler.isAsync(portType, operation)){ - buildAsync(portType, operation, bindingOperation); - } - } - } - - /** - * @param portType - * @param operation - * @param bindingOperation - */ - private void buildAsync(PortType portType, Operation operation, BindingOperation bindingOperation) { - String operationName = getCustomizedOperationName(operation);//operation.getName(); - if(operationName == null) - return; - Message outputMessage = null; - if(operation.getOutput() != null) - outputMessage = operation.getOutput().resolveMessage(wsdlDocument); - if(outputMessage != null){ - List allParts = new ArrayList(outputMessage.getParts()); - if(allParts.size() > 1) - build(getOperationName(operationName), allParts); - } - - } - - private String getCustomizedOperationName(Operation operation) { - JAXWSBinding jaxwsCustomization = (JAXWSBinding)getExtensionOfType(operation, JAXWSBinding.class); - String operationName = (jaxwsCustomization != null)?((jaxwsCustomization.getMethodName() != null)?jaxwsCustomization.getMethodName().getName():null):null; - if(operationName != null){ - if(Names.isJavaReservedWord(operationName)){ - return null; - } - - return operationName; - } - return operation.getName(); - } - - private void writeImports(QName elementName, List parts){ - Set uris = new HashSet(); - for(MessagePart p:parts){ - String ns = p.getDescriptor().getNamespaceURI(); - if(!uris.contains(ns) && !ns.equals("http://www.w3.org/2001/XMLSchema") && !ns.equals(elementName.getNamespaceURI())){ - print("", ns); - uris.add(ns); - } - } - } - - boolean asyncRespBeanBinding = false; - private void build(QName elementName, List allParts){ - - print( - "", - elementName.getNamespaceURI()); - - writeImports(elementName, allParts); - - if(!asyncRespBeanBinding){ - print( - "" + - " " + - " " + - " " + - "", - wsdlModeler.getJavaPackage() ); - asyncRespBeanBinding = true; - } - - print("", elementName.getLocalPart()); - print(""); - print(""); - - - for(MessagePart p:allParts) { - //rpclit wsdl:part must reference schema type not element, also it must exclude headers and mime parts - if(p.getDescriptorKind() == SchemaKinds.XSD_ELEMENT){ - print("",p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI()); - }else{ - print("", - p.getName(), - p.getDescriptor().getLocalPart(), - p.getDescriptor().getNamespaceURI() ); - } - } - - print(""); - print(""); - print(""); - print(""); - - // reset the StringWriter, so that next operation element could be written - if(buf.toString().length() > 0){ - //System.out.println("Response bean Schema for operation========> "+ elementName+"\n\n"+buf); - InputSource is = new InputSource(new StringReader(buf.toString())); - schemas.add(is); - buf.getBuffer().setLength(0); - } - } - - private QName getOperationName(String operationName){ - if(operationName == null) - return null; -// String namespaceURI = wsdlDocument.getDefinitions().getTargetNamespaceURI()+"?"+portType.getName()+"?" + operationName; - String namespaceURI = ""; - return new QName(namespaceURI, operationName+"Response"); - } - - private void print( String msg ) { - print( msg, new Object[0] ); - } - private void print( String msg, Object arg1 ) { - print( msg, new Object[]{arg1} ); - } - private void print( String msg, Object arg1, Object arg2 ) { - print( msg, new Object[]{arg1, arg2} ); - } - private void print( String msg, Object arg1, Object arg2, Object arg3 ) { - print( msg, new Object[]{arg1,arg2,arg3} ); - } - private void print( String msg, Object[] args ) { - buf.write(MessageFormat.format(msg,args)); - buf.write('\n'); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModeler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModeler.java deleted file mode 100644 index 6bc17fa2547..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModeler.java +++ /dev/null @@ -1,2791 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.codemodel.internal.JType; -import com.sun.istack.internal.SAXParseException2; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.processor.generator.Names; -import com.sun.tools.internal.ws.processor.model.*; -import com.sun.tools.internal.ws.processor.model.Fault; -import com.sun.tools.internal.ws.processor.model.Operation; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.Service; -import com.sun.tools.internal.ws.processor.model.java.*; -import com.sun.tools.internal.ws.processor.model.jaxb.*; -import com.sun.tools.internal.ws.processor.modeler.JavaSimpleTypeCreator; -import com.sun.tools.internal.ws.processor.util.ClassNameCollector; -import com.sun.tools.internal.ws.resources.ModelerMessages; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.document.*; -import com.sun.tools.internal.ws.wsdl.document.Message; -import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding; -import com.sun.tools.internal.ws.wsdl.document.mime.MIMEContent; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds; -import com.sun.tools.internal.ws.wsdl.document.soap.*; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wsdl.parser.WSDLParser; -import com.sun.tools.internal.xjc.api.S2JJAXBModel; -import com.sun.tools.internal.xjc.api.TypeAndAnnotation; -import com.sun.tools.internal.xjc.api.XJC; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.ws.util.xml.XmlUtil; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.LocatorImpl; - -import javax.jws.WebParam.Mode; -import javax.xml.namespace.QName; -import java.util.*; -import java.io.IOException; - - -/** - * The WSDLModeler processes a WSDL to create a Model. - * - * @author WS Development Team - */ -public class WSDLModeler extends WSDLModelerBase { - - //map of wsdl:operation QName to child, as per BP it must be unique in a port - private final Map uniqueBodyBlocks = new HashMap(); - private final QName VOID_BODYBLOCK = new QName(""); - private ClassNameCollector classNameCollector; - private final String explicitDefaultPackage; - - public WSDLModeler(WsimportOptions options, ErrorReceiver receiver) { - super(options, receiver); - this.classNameCollector = new ClassNameCollector(); - this.explicitDefaultPackage = options.defaultPackage; - } - - - protected enum StyleAndUse { - RPC_LITERAL, DOC_LITERAL - } - - private JAXBModelBuilder jaxbModelBuilder; - - public Model buildModel() { - try { - - parser = new WSDLParser(options, errReceiver); - parser.addParserListener(new ParserListener() { - public void ignoringExtension(Entity entity, QName name, QName parent) { - if (parent.equals(WSDLConstants.QNAME_TYPES)) { - // check for a schema element with the wrong namespace URI - if (name.getLocalPart().equals("schema") - && !name.getNamespaceURI().equals("")) { - warning(entity, ModelerMessages.WSDLMODELER_WARNING_IGNORING_UNRECOGNIZED_SCHEMA_EXTENSION(name.getNamespaceURI())); - } - } - - } - - public void doneParsingEntity(QName element, Entity entity) { - } - }); - - document = parser.parse(); - if (document == null || document.getDefinitions() == null) - return null; - - document.validateLocally(); - forest = parser.getDOMForest(); - - Model model = internalBuildModel(document); - if(model == null || errReceiver.hadError()) - return null; - //ClassNameCollector classNameCollector = new ClassNameCollector(); - classNameCollector.process(model); - if (classNameCollector.getConflictingClassNames().isEmpty()) { - if(errReceiver.hadError()) - return null; - return model; - } - // do another pass, this time with conflict resolution enabled - model = internalBuildModel(document); - - classNameCollector.process(model); - if (classNameCollector.getConflictingClassNames().isEmpty()) { - // we're done - if(errReceiver.hadError()) - return null; - return model; - } - // give up - StringBuffer conflictList = new StringBuffer(); - boolean first = true; - for (Iterator iter = - classNameCollector.getConflictingClassNames().iterator(); - iter.hasNext(); - ) { - if (!first) { - conflictList.append(", "); - } else { - first = false; - } - conflictList.append((String) iter.next()); - } - error(document.getDefinitions(), ModelerMessages.WSDLMODELER_UNSOLVABLE_NAMING_CONFLICTS(conflictList.toString())); - } catch (ModelException e) { - reportError(document.getDefinitions(), e.getMessage(), e); - } catch (ParseException e) { - errReceiver.error(e); - } catch (ValidationException e) { - errReceiver.error(e.getMessage(), e); - } catch (SAXException e) { - errReceiver.error(e); - } catch (IOException e) { - errReceiver.error(e); - } - //should never reach here - return null; - } - - private Model internalBuildModel(WSDLDocument document) { - numPasses++; - - //build the jaxbModel to be used latter - buildJAXBModel(document); - - QName modelName = - new QName( - document.getDefinitions().getTargetNamespaceURI(), - document.getDefinitions().getName() == null - ? "model" - : document.getDefinitions().getName()); - Model model = new Model(modelName, document.getDefinitions()); - model.setJAXBModel(getJAXBModelBuilder().getJAXBModel()); - - // This fails with the changed classname (WSDLModeler to WSDLModeler11 etc.) - // with this source comaptibility change the WSDL Modeler class name is changed. Right now hardcoding the - // modeler class name to the same one being checked in WSDLGenerator. - - model.setProperty( - ModelProperties.PROPERTY_MODELER_NAME, - ModelProperties.WSDL_MODELER_NAME); - - _javaTypes = new JavaSimpleTypeCreator(); - _javaExceptions = new HashMap(); - _bindingNameToPortMap = new HashMap(); - - // grab target namespace - model.setTargetNamespaceURI(document.getDefinitions().getTargetNamespaceURI()); - - setDocumentationIfPresent(model, - document.getDefinitions().getDocumentation()); - - boolean hasServices = document.getDefinitions().services().hasNext(); - if (hasServices) { - for (Iterator iter = document.getDefinitions().services(); - iter.hasNext(); - ) { - processService((com.sun.tools.internal.ws.wsdl.document.Service) iter.next(), - model, document); - hasServices = true; - } - } else { - // emit a warning if there are no service definitions - warning(model.getEntity(), ModelerMessages.WSDLMODELER_WARNING_NO_SERVICE_DEFINITIONS_FOUND()); - } - - return model; - } - - /* (non-Javadoc) - * @see WSDLModelerBase#processService(Service, Model, WSDLDocument) - */ - protected void processService(com.sun.tools.internal.ws.wsdl.document.Service wsdlService, Model model, WSDLDocument document) { - String serviceInterface = ""; - QName serviceQName = getQNameOf(wsdlService); - serviceInterface = getServiceInterfaceName(serviceQName, wsdlService); - if (isConflictingServiceClassName(serviceInterface)) { - serviceInterface += "_Service"; - } - Service service = - new Service( - serviceQName, - new JavaInterface(serviceInterface, serviceInterface + "Impl"), wsdlService); - - setDocumentationIfPresent(service, wsdlService.getDocumentation()); - boolean hasPorts = false; - for (Iterator iter = wsdlService.ports(); iter.hasNext();) { - boolean processed = - processPort( - (com.sun.tools.internal.ws.wsdl.document.Port) iter.next(), - service, - document); - hasPorts = hasPorts || processed; - } - if (!hasPorts) { - // emit a warning if there are no ports - warning(wsdlService, ModelerMessages.WSDLMODELER_WARNING_NO_PORTS_IN_SERVICE(wsdlService.getName())); - } else { - model.addService(service); - } - } - - /* (non-Javadoc) - * @see WSDLModelerBase#processPort(WSDLPort, Service, WSDLDocument) - */ - protected boolean processPort(com.sun.tools.internal.ws.wsdl.document.Port wsdlPort, - Service service, WSDLDocument document) { - try { - - //clear the unique block map - uniqueBodyBlocks.clear(); - - QName portQName = getQNameOf(wsdlPort); - Port port = new Port(portQName, wsdlPort); - - setDocumentationIfPresent(port, wsdlPort.getDocumentation()); - - SOAPAddress soapAddress = - (SOAPAddress) getExtensionOfType(wsdlPort, SOAPAddress.class); - if (soapAddress == null) { - if(options.isExtensionMode()){ - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_NO_SOAP_ADDRESS(wsdlPort.getName())); - }else{ - // not a SOAP port, ignore it - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT_NO_ADDRESS(wsdlPort.getName())); - return false; - } - } - if(soapAddress != null) - port.setAddress(soapAddress.getLocation()); - Binding binding = wsdlPort.resolveBinding(document); - QName bindingName = getQNameOf(binding); - PortType portType = binding.resolvePortType(document); - - port.setProperty( - ModelProperties.PROPERTY_WSDL_PORT_NAME, - getQNameOf(wsdlPort)); - port.setProperty( - ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME, - getQNameOf(portType)); - port.setProperty( - ModelProperties.PROPERTY_WSDL_BINDING_NAME, - bindingName); - - boolean isProvider = isProvider(wsdlPort); - if (_bindingNameToPortMap.containsKey(bindingName) && !isProvider) { - // this binding has been processed before - Port existingPort = - _bindingNameToPortMap.get(bindingName); - port.setOperations(existingPort.getOperations()); - port.setJavaInterface(existingPort.getJavaInterface()); - port.setStyle(existingPort.getStyle()); - port.setWrapped(existingPort.isWrapped()); - } else { - // find out the SOAP binding extension, if any - SOAPBinding soapBinding = - (SOAPBinding) getExtensionOfType(binding, SOAPBinding.class); - - if (soapBinding == null) { - soapBinding = - (SOAPBinding) getExtensionOfType(binding, SOAP12Binding.class); - if (soapBinding == null) { - if(!options.isExtensionMode()){ - // cannot deal with non-SOAP ports - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT(wsdlPort.getName())); - return false; - }else{ - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_NON_SOAP_PORT(wsdlPort.getName())); - } - }else{ - // we can only do soap1.2 if extensions are on - if (options.isExtensionMode()) { - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_PORT_SOAP_BINDING_12(wsdlPort.getName())); - } else { - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_IGNORING_SOAP_BINDING_12(wsdlPort.getName())); - return false; - } - } - } - - if (soapBinding != null && (soapBinding.getTransport() == null - || (!soapBinding.getTransport().equals( - SOAPConstants.URI_SOAP_TRANSPORT_HTTP) && !soapBinding.getTransport().equals( - SOAP12Constants.URI_SOAP_TRANSPORT_HTTP)))) { - if (!options.isExtensionMode()) { - // cannot deal with non-HTTP ports - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_IGNORING_SOAP_BINDING_NON_HTTP_TRANSPORT(wsdlPort.getName())); - return false; - } - - } - - /** - * validate wsdl:binding uniqueness in style, e.g. rpclit or doclit - * ref: WSI BP 1.1 R 2705 - */ - if (soapBinding != null && !validateWSDLBindingStyle(binding)) { - if (options.isExtensionMode()) { - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_PORT_SOAP_BINDING_MIXED_STYLE(wsdlPort.getName())); - } else { - error(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_IGNORING_SOAP_BINDING_MIXED_STYLE(wsdlPort.getName())); - } - } - - if(soapBinding != null){ - port.setStyle(soapBinding.getStyle()); - } - - boolean hasOverloadedOperations = false; - Set operationNames = new HashSet(); - for (Iterator iter = portType.operations(); iter.hasNext();) { - com.sun.tools.internal.ws.wsdl.document.Operation operation = - (com.sun.tools.internal.ws.wsdl.document.Operation) iter.next(); - - if (operationNames.contains(operation.getName())) { - hasOverloadedOperations = true; - break; - } - operationNames.add(operation.getName()); - - for (Iterator itr = binding.operations(); - iter.hasNext(); - ) { - BindingOperation bindingOperation = - (BindingOperation) itr.next(); - if (operation - .getName() - .equals(bindingOperation.getName())) { - break; - } else if (!itr.hasNext()) { - error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_NOT_FOUND(operation.getName(), bindingOperation.getName())); - } - } - } - - Map headers = new HashMap(); - boolean hasOperations = false; - for (Iterator iter = binding.operations(); iter.hasNext();) { - BindingOperation bindingOperation = - (BindingOperation) iter.next(); - - com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation = - null; - Set operations = - portType.getOperationsNamed(bindingOperation.getName()); - if (operations.size() == 0) { - // the WSDL document is invalid - error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_NOT_IN_PORT_TYPE(bindingOperation.getName(), binding.getName())); - } else if (operations.size() == 1) { - portTypeOperation = - (com.sun.tools.internal.ws.wsdl.document.Operation) operations - .iterator() - .next(); - } else { - boolean found = false; - String expectedInputName = - bindingOperation.getInput().getName(); - String expectedOutputName = - bindingOperation.getOutput().getName(); - - for (Iterator iter2 = operations.iterator(); iter2.hasNext();) { - com.sun.tools.internal.ws.wsdl.document.Operation candidateOperation = - (com.sun.tools.internal.ws.wsdl.document.Operation) iter2 - .next(); - - if (expectedInputName == null) { - // the WSDL document is invalid - error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_MISSING_INPUT_NAME(bindingOperation.getName())); - } - if (expectedOutputName == null) { - // the WSDL document is invalid - error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_MISSING_OUTPUT_NAME(bindingOperation.getName())); - } - if (expectedInputName - .equals(candidateOperation.getInput().getName()) - && expectedOutputName.equals( - candidateOperation - .getOutput() - .getName())) { - if (found) { - // the WSDL document is invalid - error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_MATCHING_OPERATIONS(bindingOperation.getName(), bindingOperation.getName())); - } - // got it! - found = true; - portTypeOperation = candidateOperation; - } - } - if (!found) { - // the WSDL document is invalid - error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_NOT_FOUND(bindingOperation.getName(), binding.getName())); - } - } - if (!isProvider) { - this.info = - new ProcessSOAPOperationInfo( - port, - wsdlPort, - portTypeOperation, - bindingOperation, - soapBinding, - document, - hasOverloadedOperations, - headers); - - - Operation operation; - if(soapBinding != null) - operation = processSOAPOperation(); - else{ - operation = processNonSOAPOperation(); - } - if (operation != null) { - port.addOperation(operation); - hasOperations = true; - } - } - } - if (!isProvider && !hasOperations) { - // emit a warning if there are no operations, except when its a provider port - warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_NO_OPERATIONS_IN_PORT(wsdlPort.getName())); - return false; - } - createJavaInterfaceForPort(port, isProvider); - PortType pt = binding.resolvePortType(document); - String jd = (pt.getDocumentation() != null) ? pt.getDocumentation().getContent() : null; - port.getJavaInterface().setJavaDoc(jd); - _bindingNameToPortMap.put(bindingName, port); - } - - service.addPort(port); - applyPortMethodCustomization(port, wsdlPort); - applyWrapperStyleCustomization(port, binding.resolvePortType(document)); - - return true; - - } catch (NoSuchEntityException e) { - warning(document.getDefinitions(), e.getMessage()); - // should not happen - return false; - } - } - - /** - * Returns an operation purely from abstract operation - */ - private Operation processNonSOAPOperation() { - Operation operation = - new Operation(new QName(null, info.bindingOperation.getName()), info.bindingOperation); - - setDocumentationIfPresent( - operation, - info.portTypeOperation.getDocumentation()); - - if (info.portTypeOperation.getStyle() - != OperationStyle.REQUEST_RESPONSE - && info.portTypeOperation.getStyle() != OperationStyle.ONE_WAY) { - if (options.isExtensionMode()) { - warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_SUPPORTED_STYLE(info.portTypeOperation.getName())); - return null; - } else { - error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_NOT_SUPPORTED_STYLE(info.portTypeOperation.getName(), - info.port.resolveBinding(document).resolvePortType(document).getName())); - } - } - - boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; - Message inputMessage = getInputMessage(); - Request request = new Request(inputMessage, errReceiver); - request.setErrorReceiver(errReceiver); - info.operation = operation; - info.operation.setWSDLPortTypeOperation(info.portTypeOperation); - - Response response = null; - - Message outputMessage = null; - if (isRequestResponse) { - outputMessage = getOutputMessage(); - response = new Response(outputMessage, errReceiver); - }else{ - response = new Response(null, errReceiver); - } - - //set the style based on heuristic that message has either all parts defined - // using type(RPC) or element(DOCUMENT) - setNonSoapStyle(inputMessage, outputMessage); - - // Process parameterOrder and get the parameterList - List parameterList = getParameterOrder(); - - List params = null; - boolean unwrappable = isUnwrappable(); - info.operation.setWrapped(unwrappable); - params = getDoclitParameters(request, response, parameterList); - if (!validateParameterName(params)) { - return null; - } - - // create a definitive list of parameters to match what we'd like to get - // in the java interface (which is generated much later), parameterOrder - List definitiveParameterList = new ArrayList(); - for (Parameter param : params) { - if (param.isReturn()) { - info.operation.setProperty(WSDL_RESULT_PARAMETER, param); - response.addParameter(param); - continue; - } - if (param.isIN()) { - request.addParameter(param); - } else if (param.isOUT()) { - response.addParameter(param); - } else if (param.isINOUT()) { - request.addParameter(param); - response.addParameter(param); - } - definitiveParameterList.add(param); - } - - info.operation.setRequest(request); - - if (isRequestResponse) { - info.operation.setResponse(response); - } - - // faults with duplicate names - Set duplicateNames = getDuplicateFaultNames(); - - // handle soap:fault - handleLiteralSOAPFault(response, duplicateNames); - info.operation.setProperty( - WSDL_PARAMETER_ORDER, - definitiveParameterList); - - Binding binding = info.port.resolveBinding(document); - PortType portType = binding.resolvePortType(document); - if (isAsync(portType, info.portTypeOperation)) { - warning(portType, "Can not generate Async methods for non-soap binding!"); - } - return info.operation; - } - - /** - * This method is added to fix one of the use case for j2ee se folks, so that we determine - * for non_soap wsdl what could be the style - rpc or document based on parts in the message. - * - * We assume that the message parts could have either all of them with type attribute (RPC) - * or element (DOCUMENT) - * - * Shall this check if parts are mixed and throw error message? - */ - private void setNonSoapStyle(Message inputMessage, Message outputMessage) { - SOAPStyle style = SOAPStyle.DOCUMENT; - for(MessagePart part:inputMessage.getParts()){ - if(part.getDescriptorKind() == SchemaKinds.XSD_TYPE) - style = SOAPStyle.RPC; - else - style = SOAPStyle.DOCUMENT; - } - - //check the outputMessage parts - if(outputMessage != null){ - for(MessagePart part:outputMessage.getParts()){ - if(part.getDescriptorKind() == SchemaKinds.XSD_TYPE) - style = SOAPStyle.RPC; - else - style = SOAPStyle.DOCUMENT; - } - } - info.modelPort.setStyle(style); - } - - /* (non-Javadoc) - * @see WSDLModelerBase#processSOAPOperation() - */ - protected Operation processSOAPOperation() { - Operation operation = - new Operation(new QName(null, info.bindingOperation.getName()), info.bindingOperation); - - setDocumentationIfPresent( - operation, - info.portTypeOperation.getDocumentation()); - - if (info.portTypeOperation.getStyle() - != OperationStyle.REQUEST_RESPONSE - && info.portTypeOperation.getStyle() != OperationStyle.ONE_WAY) { - if (options.isExtensionMode()) { - warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_SUPPORTED_STYLE(info.portTypeOperation.getName())); - return null; - } else { - error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_NOT_SUPPORTED_STYLE(info.portTypeOperation.getName(), - info.port.resolveBinding(document).resolvePortType(document).getName())); - } - } - - SOAPStyle soapStyle = info.soapBinding.getStyle(); - - // find out the SOAP operation extension, if any - SOAPOperation soapOperation = - (SOAPOperation) getExtensionOfType(info.bindingOperation, - SOAPOperation.class); - - if (soapOperation != null) { - if (soapOperation.getStyle() != null) { - soapStyle = soapOperation.getStyle(); - } - if (soapOperation.getSOAPAction() != null) { - operation.setSOAPAction(soapOperation.getSOAPAction()); - } - } - - operation.setStyle(soapStyle); - - String uniqueOperationName = - getUniqueName(info.portTypeOperation, info.hasOverloadedOperations); - if (info.hasOverloadedOperations) { - operation.setUniqueName(uniqueOperationName); - } - - info.operation = operation; - info.uniqueOperationName = uniqueOperationName; - - //attachment - SOAPBody soapRequestBody = getSOAPRequestBody(); - if (soapRequestBody == null) { - // the WSDL document is invalid - error(info.bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(info.bindingOperation.getName())); - } - - if (soapStyle == SOAPStyle.RPC) { - if (soapRequestBody.isEncoded()) { - if(options.isExtensionMode()){ - warning(soapRequestBody, ModelerMessages.WSDLMODELER_20_RPCENC_NOT_SUPPORTED()); - processNonSOAPOperation(); - }else{ - error(soapRequestBody, ModelerMessages.WSDLMODELER_20_RPCENC_NOT_SUPPORTED()); - } - } - return processLiteralSOAPOperation(StyleAndUse.RPC_LITERAL); - } - // document style - return processLiteralSOAPOperation(StyleAndUse.DOC_LITERAL); - } - - protected Operation processLiteralSOAPOperation(StyleAndUse styleAndUse) { - //returns false if the operation name is not acceptable - if (!applyOperationNameCustomization()) - return null; - - boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; - Message inputMessage = getInputMessage(); - Request request = new Request(inputMessage, errReceiver); - request.setErrorReceiver(errReceiver); - info.operation.setUse(SOAPUse.LITERAL); - info.operation.setWSDLPortTypeOperation(info.portTypeOperation); - SOAPBody soapRequestBody = getSOAPRequestBody(); - if ((StyleAndUse.DOC_LITERAL == styleAndUse) && (soapRequestBody.getNamespace() != null)) { - warning(soapRequestBody, ModelerMessages.WSDLMODELER_WARNING_R_2716("soapbind:body", info.bindingOperation.getName())); - } - - - Response response = null; - - SOAPBody soapResponseBody = null; - Message outputMessage = null; - if (isRequestResponse) { - soapResponseBody = getSOAPResponseBody(); - if (isOperationDocumentLiteral(styleAndUse) && (soapResponseBody.getNamespace() != null)) { - warning(soapResponseBody, ModelerMessages.WSDLMODELER_WARNING_R_2716("soapbind:body", info.bindingOperation.getName())); - } - outputMessage = getOutputMessage(); - response = new Response(outputMessage, errReceiver); - }else{ - response = new Response(null, errReceiver); - } - - //ignore operation if there are more than one root part - if (!validateMimeParts(getMimeParts(info.bindingOperation.getInput())) || - !validateMimeParts(getMimeParts(info.bindingOperation.getOutput()))) - return null; - - - if (!validateBodyParts(info.bindingOperation)) { - // BP 1.1 - // R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s), - // only to wsdl:part element(s) that have been defined using the element attribute. - - // R2203 An rpc-literal binding in a DESCRIPTION MUST refer, in its soapbind:body element(s), - // only to wsdNl:part element(s) that have been defined using the type attribute. - if (isOperationDocumentLiteral(styleAndUse)) - if (options.isExtensionMode()) - warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_TYPE_MESSAGE_PART(info.portTypeOperation.getName())); - else - error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_DOCLITOPERATION(info.portTypeOperation.getName())); - else if (isOperationRpcLiteral(styleAndUse)) { - if (options.isExtensionMode()) - warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_ELEMENT_MESSAGE_PART(info.portTypeOperation.getName())); - else - error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_RPCLITOPERATION(info.portTypeOperation.getName())); - } - return null; - } - - // Process parameterOrder and get the parameterList - List parameterList = getParameterOrder(); - - //binding is invalid in the wsdl, ignore the operation. - if (!setMessagePartsBinding(styleAndUse)) - return null; - - List params = null; - boolean unwrappable = isUnwrappable(); - info.operation.setWrapped(unwrappable); - if (isOperationDocumentLiteral(styleAndUse)) { - params = getDoclitParameters(request, response, parameterList); - } else if (isOperationRpcLiteral(styleAndUse)) { - String operationName = info.bindingOperation.getName(); - Block reqBlock = null; - if (inputMessage != null) { - QName name = new QName(getRequestNamespaceURI(soapRequestBody), operationName); - RpcLitStructure rpcStruct = new RpcLitStructure(name, getJAXBModelBuilder().getJAXBModel()); - rpcStruct.setJavaType(new JavaSimpleType("com.sun.xml.internal.ws.encoding.jaxb.RpcLitPayload", null)); - reqBlock = new Block(name, rpcStruct, inputMessage); - request.addBodyBlock(reqBlock); - } - - Block resBlock = null; - if (isRequestResponse && outputMessage != null) { - QName name = new QName(getResponseNamespaceURI(soapResponseBody), operationName + "Response"); - RpcLitStructure rpcStruct = new RpcLitStructure(name, getJAXBModelBuilder().getJAXBModel()); - rpcStruct.setJavaType(new JavaSimpleType("com.sun.xml.internal.ws.encoding.jaxb.RpcLitPayload", null)); - resBlock = new Block(name, rpcStruct, outputMessage); - response.addBodyBlock(resBlock); - } - params = getRpcLitParameters(request, response, reqBlock, resBlock, parameterList); - } - - - if (!validateParameterName(params)) { - return null; - } - - // create a definitive list of parameters to match what we'd like to get - // in the java interface (which is generated much later), parameterOrder - List definitiveParameterList = new ArrayList(); - for (Parameter param : params) { - if (param.isReturn()) { - info.operation.setProperty(WSDL_RESULT_PARAMETER, param); - response.addParameter(param); - continue; - } - if (param.isIN()) { - request.addParameter(param); - } else if (param.isOUT()) { - response.addParameter(param); - } else if (param.isINOUT()) { - request.addParameter(param); - response.addParameter(param); - } - definitiveParameterList.add(param); - } - - info.operation.setRequest(request); - - if (isRequestResponse) { - info.operation.setResponse(response); - } - - Iterator bb = request.getBodyBlocks(); - QName body = VOID_BODYBLOCK; - QName opName = null; - - Operation thatOp; - if (bb.hasNext()) { - body = bb.next().getName(); - thatOp = uniqueBodyBlocks.get(body); - } else { - //there is no body block - body = VOID_BODYBLOCK; - thatOp = uniqueBodyBlocks.get(VOID_BODYBLOCK); - } - - if(thatOp != null){ - if(options.isExtensionMode()){ - warning(info.port, ModelerMessages.WSDLMODELER_NON_UNIQUE_BODY_WARNING(info.port.getName(), info.operation.getName(), thatOp.getName(), body)); - }else{ - error(info.port, ModelerMessages.WSDLMODELER_NON_UNIQUE_BODY_ERROR(info.port.getName(), info.operation.getName(), thatOp.getName(), body)); - } - }else{ - uniqueBodyBlocks.put(body, info.operation); - } - - //Add additional headers - if (options.additionalHeaders) { - List additionalHeaders = new ArrayList(); - if (inputMessage != null) { - for (MessagePart part : getAdditionHeaderParts(inputMessage, true)) { - QName name = part.getDescriptor(); - JAXBType jaxbType = getJAXBType(part); - Block block = new Block(name, jaxbType, part); - Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType, block); - additionalHeaders.add(param); - request.addHeaderBlock(block); - request.addParameter(param); - definitiveParameterList.add(param); - } - } - - if (isRequestResponse && outputMessage != null) { - List outParams = new ArrayList(); - for (MessagePart part : getAdditionHeaderParts(outputMessage, false)) { - QName name = part.getDescriptor(); - JAXBType jaxbType = getJAXBType(part); - Block block = new Block(name, jaxbType, part); - Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType, block); - param.setMode(Mode.OUT); - outParams.add(param); - response.addHeaderBlock(block); - response.addParameter(param); - } - for (Parameter outParam : outParams) { - for (Parameter inParam : additionalHeaders) { - if (inParam.getName().equals(outParam.getName()) && - inParam.getBlock().getName().equals(outParam.getBlock().getName())) { - //it is INOUT - inParam.setMode(Mode.INOUT); - outParam.setMode(Mode.INOUT); - break; - } - } - if (outParam.isOUT()) { - definitiveParameterList.add(outParam); - } - } - } - } - - // faults with duplicate names - Set duplicateNames = getDuplicateFaultNames(); - - // handle soap:fault - handleLiteralSOAPFault(response, duplicateNames); - info.operation.setProperty( - WSDL_PARAMETER_ORDER, - definitiveParameterList); - - //set Async property - Binding binding = info.port.resolveBinding(document); - PortType portType = binding.resolvePortType(document); - if (isAsync(portType, info.portTypeOperation)) { - addAsyncOperations(info.operation, styleAndUse); - } - - return info.operation; - } - - - private boolean validateParameterName(List params) { - if (options.isExtensionMode()) - return true; - - Message msg = getInputMessage(); - for (Parameter param : params) { - if (param.isOUT()) - continue; - if (param.getCustomName() != null) { - if (Names.isJavaReservedWord(param.getCustomName())) { - error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(info.operation.getName(), param.getCustomName())); - return false; - } - return true; - } - //process doclit wrapper style - if (param.isEmbedded() && !(param.getBlock().getType() instanceof RpcLitStructure)) { - if (Names.isJavaReservedWord(param.getName())) { - error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(info.operation.getName(), param.getName(), param.getBlock().getName())); - return false; - } - } else { - //non-wrapper style and rpclit - if (Names.isJavaReservedWord(param.getName())) { - error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(info.operation.getName(), msg.getName(), param.getName())); - return false; - } - } - } - - boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; - if (isRequestResponse) { - msg = getOutputMessage(); - for (Parameter param : params) { - if (param.isIN()) - continue; - if (param.getCustomName() != null) { - if (Names.isJavaReservedWord(param.getCustomName())) { - error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(info.operation.getName(), param.getCustomName())); - return false; - } - return true; - } - //process doclit wrapper style - if (param.isEmbedded() && !(param.getBlock().getType() instanceof RpcLitStructure)) { - if (param.isReturn()) - continue; - if (!param.getName().equals("return") && Names.isJavaReservedWord(param.getName())) { - error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(info.operation.getName(), param.getName(), param.getBlock().getName())); - return false; - } - } else { - if (param.isReturn()) - continue; - - //non-wrapper style and rpclit - if (Names.isJavaReservedWord(param.getName())) { - error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(info.operation.getName(), msg.getName(), param.getName())); - return false; - } - } - } - } - - return true; - } - - private boolean enableMimeContent() { - //first we look at binding operation - JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.bindingOperation, JAXWSBinding.class); - Boolean mimeContentMapping = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableMimeContentMapping() : null; - if (mimeContentMapping != null) - return mimeContentMapping; - - //then in wsdl:binding - Binding binding = info.port.resolveBinding(info.document); - jaxwsCustomization = (JAXWSBinding) getExtensionOfType(binding, JAXWSBinding.class); - mimeContentMapping = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableMimeContentMapping() : null; - if (mimeContentMapping != null) - return mimeContentMapping; - - //at last look in wsdl:definitions - jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.document.getDefinitions(), JAXWSBinding.class); - mimeContentMapping = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableMimeContentMapping() : null; - if (mimeContentMapping != null) - return mimeContentMapping; - return false; - } - - private boolean applyOperationNameCustomization() { - JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class); - String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null; - if (operationName != null) { - if (Names.isJavaReservedWord(operationName)) { - if (options.isExtensionMode()) - warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName)); - else - error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName)); - return false; - } - - info.operation.setCustomizedName(operationName); - } - - if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) { - if (options.isExtensionMode()) - warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName())); - else - error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName())); - return false; - } - return true; - } - - protected String getAsyncOperationName(Operation operation) { - String name = operation.getCustomizedName(); - if (name == null) - name = operation.getUniqueName(); - return name; - } - - /** - * @param styleAndUse - */ - private void addAsyncOperations(Operation syncOperation, StyleAndUse styleAndUse) { - Operation operation = createAsyncOperation(syncOperation, styleAndUse, AsyncOperationType.POLLING); - if (operation != null) - info.modelPort.addOperation(operation); - - operation = createAsyncOperation(syncOperation, styleAndUse, AsyncOperationType.CALLBACK); - if (operation != null) - info.modelPort.addOperation(operation); - } - - private Operation createAsyncOperation(Operation syncOperation, StyleAndUse styleAndUse, AsyncOperationType asyncType) { - boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; - if (!isRequestResponse) - return null; - - //create async operations - AsyncOperation operation = new AsyncOperation(info.operation, info.bindingOperation); - - //creation the async operation name: operationName+Async or customized name - //operation.setName(new QName(operation.getName().getNamespaceURI(), getAsyncOperationName(info.portTypeOperation, operation))); - if (asyncType.equals(AsyncOperationType.CALLBACK)) - operation.setUniqueName(info.operation.getUniqueName() + "_async_callback"); - else if (asyncType.equals(AsyncOperationType.POLLING)) - operation.setUniqueName(info.operation.getUniqueName() + "_async_polling"); - - setDocumentationIfPresent( - operation, - info.portTypeOperation.getDocumentation()); - - operation.setAsyncType(asyncType); - operation.setSOAPAction(info.operation.getSOAPAction()); - boolean unwrappable = info.operation.isWrapped(); - operation.setWrapped(unwrappable); - SOAPBody soapRequestBody = getSOAPRequestBody(); - - Message inputMessage = getInputMessage(); - Request request = new Request(inputMessage, errReceiver); - Response response = new Response(null, errReceiver); - - SOAPBody soapResponseBody = null; - Message outputMessage = null; - if (isRequestResponse) { - soapResponseBody = getSOAPResponseBody(); - outputMessage = getOutputMessage(); - response = new Response(outputMessage, errReceiver); - } - - // Process parameterOrder and get the parameterList - java.util.List parameterList = getAsynParameterOrder(); - - List inParameters = null; - if (isOperationDocumentLiteral(styleAndUse)) { - inParameters = getRequestParameters(request, parameterList); - // outParameters = getResponseParameters(response); - // re-create parameterList with unwrapped parameters - if (unwrappable) { - List unwrappedParameterList = new ArrayList(); - if (inputMessage != null) { - Iterator parts = inputMessage.parts(); - if (parts.hasNext()) { - MessagePart part = parts.next(); - JAXBType jaxbType = getJAXBType(part); - List memberList = jaxbType.getWrapperChildren(); - Iterator props = memberList.iterator(); - while (props.hasNext()) { - JAXBProperty prop = props.next(); - unwrappedParameterList.add(prop.getElementName().getLocalPart()); - } - } - } - - parameterList.clear(); - parameterList.addAll(unwrappedParameterList); - } - } else if (isOperationRpcLiteral(styleAndUse)) { - String operationName = info.bindingOperation.getName(); - Block reqBlock = null; - if (inputMessage != null) { - QName name = new QName(getRequestNamespaceURI(soapRequestBody), operationName); - RpcLitStructure rpcStruct = new RpcLitStructure(name, getJAXBModelBuilder().getJAXBModel()); - rpcStruct.setJavaType(new JavaSimpleType("com.sun.xml.internal.ws.encoding.jaxb.RpcLitPayload", null)); - reqBlock = new Block(name, rpcStruct, inputMessage); - request.addBodyBlock(reqBlock); - } - inParameters = createRpcLitRequestParameters(request, parameterList, reqBlock); - } - - // add response blocks, we dont need to create respnse parameters, just blocks will be fine, lets - // copy them from sync optraions - //copy the response blocks from the sync operation - Iterator blocks = info.operation.getResponse().getBodyBlocks(); - - while (blocks.hasNext()) { - response.addBodyBlock(blocks.next()); - } - - blocks = info.operation.getResponse().getHeaderBlocks(); - while (blocks.hasNext()) { - response.addHeaderBlock(blocks.next()); - } - - blocks = info.operation.getResponse().getAttachmentBlocks(); - while (blocks.hasNext()) { - response.addAttachmentBlock(blocks.next()); - } - - List outputParts = outputMessage.getParts(); - - // handle headers - int numOfOutMsgParts = outputParts.size(); - - if (isRequestResponse) { - if (numOfOutMsgParts == 1) { - MessagePart part = outputParts.get(0); - if (isOperationDocumentLiteral(styleAndUse)) { - JAXBType type = getJAXBType(part); - operation.setResponseBean(type); - } else if (isOperationRpcLiteral(styleAndUse)) { - String operationName = info.bindingOperation.getName(); - Block resBlock = null; - if (isRequestResponse && outputMessage != null) { - resBlock = info.operation.getResponse().getBodyBlocksMap().get(new QName(getResponseNamespaceURI(soapResponseBody), - operationName + "Response")); - } - RpcLitStructure resBean = (resBlock == null) ? null : (RpcLitStructure) resBlock.getType(); - List members = resBean.getRpcLitMembers(); - - operation.setResponseBean(members.get(0)); - } - } else { - //create response bean - String nspace = ""; - QName responseBeanName = new QName(nspace, getAsyncOperationName(info.operation) + "Response"); - JAXBType responseBeanType = jaxbModelBuilder.getJAXBType(responseBeanName); - if(responseBeanType == null){ - error(info.operation.getEntity(), ModelerMessages.WSDLMODELER_RESPONSEBEAN_NOTFOUND(info.operation.getName())); - } - operation.setResponseBean(responseBeanType); - } - } - QName respBeanName = new QName(soapResponseBody.getNamespace(), getAsyncOperationName(info.operation) + "Response"); - Block block = new Block(respBeanName, operation.getResponseBeanType(), outputMessage); - JavaType respJavaType = operation.getResponseBeanJavaType(); - JAXBType respType = new JAXBType(respBeanName, respJavaType); - Parameter respParam = ModelerUtils.createParameter(info.operation.getName() + "Response", respType, block); - respParam.setParameterIndex(-1); - response.addParameter(respParam); - operation.setProperty(WSDL_RESULT_PARAMETER, respParam.getName()); - - - List definitiveParameterList = new ArrayList(); - int parameterOrderPosition = 0; - for (String name : parameterList) { - Parameter inParameter = null; - - inParameter = ModelerUtils.getParameter(name, inParameters); - if (inParameter == null) { - if (options.isExtensionMode()) - warning(info.operation.getEntity(), ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_PART_NOT_FOUND(info.operation.getName().getLocalPart(), name)); - else - error(info.operation.getEntity(), ModelerMessages.WSDLMODELER_ERROR_PART_NOT_FOUND(info.operation.getName().getLocalPart(), name)); - return null; - } - request.addParameter(inParameter); - inParameter.setParameterIndex(parameterOrderPosition); - definitiveParameterList.add(name); - parameterOrderPosition++; - } - - if (isRequestResponse) { - operation.setResponse(response); - } - - // add callback handlerb Parameter to request - if (operation.getAsyncType().equals(AsyncOperationType.CALLBACK)) { - JavaType cbJavaType = operation.getCallBackType(); - JAXBType callbackType = new JAXBType(respBeanName, cbJavaType); - Parameter cbParam = ModelerUtils.createParameter("asyncHandler", callbackType, block); - request.addParameter(cbParam); - } - - operation.setRequest(request); - - return operation; - } - - protected boolean isAsync(com.sun.tools.internal.ws.wsdl.document.PortType portType, com.sun.tools.internal.ws.wsdl.document.Operation wsdlOperation) { - //First look into wsdl:operation - JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(wsdlOperation, JAXWSBinding.class); - Boolean isAsync = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableAsyncMapping() : null; - - if (isAsync != null) - return isAsync; - - // then into wsdl:portType - QName portTypeName = new QName(portType.getDefining().getTargetNamespaceURI(), portType.getName()); - if (portTypeName != null) { - jaxwsCustomization = (JAXWSBinding) getExtensionOfType(portType, JAXWSBinding.class); - isAsync = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableAsyncMapping() : null; - if (isAsync != null) - return isAsync; - } - - //then wsdl:definitions - jaxwsCustomization = (JAXWSBinding) getExtensionOfType(document.getDefinitions(), JAXWSBinding.class); - isAsync = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableAsyncMapping() : null; - if (isAsync != null) - return isAsync; - return false; - } - - protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator headerParts, Set duplicateNames, List definitiveParameterList, boolean processRequest) { - QName headerName = null; - Block headerBlock = null; - JAXBType jaxbType = null; - int parameterOrderPosition = definitiveParameterList.size(); - while (headerParts.hasNext()) { - MessagePart part = (MessagePart) headerParts.next(); - headerName = part.getDescriptor(); - jaxbType = getJAXBType(part); - headerBlock = new Block(headerName, jaxbType, part); - TWSDLExtensible ext; - if (processRequest) { - ext = info.bindingOperation.getInput(); - } else { - ext = info.bindingOperation.getOutput(); - } - Message headerMessage = getHeaderMessage(part, ext); - - if (processRequest) { - request.addHeaderBlock(headerBlock); - } else { - response.addHeaderBlock(headerBlock); - } - - Parameter parameter = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock); - parameter.setParameterIndex(parameterOrderPosition); - setCustomizedParameterName(info.bindingOperation, headerMessage, part, parameter, false); - if (processRequest && definitiveParameterList != null) { - request.addParameter(parameter); - definitiveParameterList.add(parameter.getName()); - } else { - if (definitiveParameterList != null) { - for (Iterator iterInParams = definitiveParameterList.iterator(); iterInParams.hasNext();) { - String inParamName = - (String) iterInParams.next(); - if (inParamName.equals(parameter.getName())) { - Parameter inParam = request.getParameterByName(inParamName); - parameter.setLinkedParameter(inParam); - inParam.setLinkedParameter(parameter); - //its in/out parameter, input and output parameter have the same order position. - parameter.setParameterIndex(inParam.getParameterIndex()); - } - } - if (!definitiveParameterList.contains(parameter.getName())) { - definitiveParameterList.add(parameter.getName()); - } - } - response.addParameter(parameter); - } - parameterOrderPosition++; - } - - } - - protected void handleLiteralSOAPFault(Response response, Set duplicateNames) { - for (BindingFault bindingFault : info.bindingOperation.faults()) { - com.sun.tools.internal.ws.wsdl.document.Fault portTypeFault = null; - for (com.sun.tools.internal.ws.wsdl.document.Fault aFault : info.portTypeOperation.faults()) { - if (aFault.getName().equals(bindingFault.getName())) { - if (portTypeFault != null) { - // the WSDL document is invalid, a wsld:fault in a wsdl:operation of a portType can be bound only once - error(portTypeFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(bindingFault.getName(), info.bindingOperation.getName())); - } - portTypeFault = aFault; - } - } - - // The WSDL document is invalid, the wsdl:fault in abstract operation is does not have any binding - if (portTypeFault == null) { - error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NOT_FOUND(bindingFault.getName(), info.bindingOperation.getName())); - - } - - // wsdl:fault message name is used to create the java exception name later on - String faultName = getFaultClassName(portTypeFault); - Fault fault = new Fault(faultName, portTypeFault); - fault.setWsdlFaultName(portTypeFault.getName()); - setDocumentationIfPresent(fault, portTypeFault.getDocumentation()); - - //get the soapbind:fault from wsdl:fault in the binding - SOAPFault soapFault = (SOAPFault) getExtensionOfType(bindingFault, SOAPFault.class); - - // The WSDL document is invalid, can't have wsdl:fault without soapbind:fault - if (soapFault == null) { - if(options.isExtensionMode()){ - warning(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(bindingFault.getName(), info.bindingOperation.getName())); - soapFault = new SOAPFault(new LocatorImpl()); - }else{ - error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(bindingFault.getName(), info.bindingOperation.getName())); - } - } - - //the soapbind:fault must have use="literal" or no use attribute, in that case its assumed "literal" - if (!soapFault.isLiteral()) { - if (options.isExtensionMode()) - warning(soapFault, ModelerMessages.WSDLMODELER_WARNING_IGNORING_FAULT_NOT_LITERAL(bindingFault.getName(), info.bindingOperation.getName())); - else - error(soapFault, ModelerMessages.WSDLMODELER_INVALID_OPERATION_FAULT_NOT_LITERAL(bindingFault.getName(), info.bindingOperation.getName())); - continue; - } - - // the soapFault name must be present - if (soapFault.getName() == null) { - warning(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NO_SOAP_FAULT_NAME(bindingFault.getName(), info.bindingOperation.getName())); - } else if (!soapFault.getName().equals(bindingFault.getName())) { - warning(soapFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_WRONG_SOAP_FAULT_NAME(soapFault.getName(), bindingFault.getName(), info.bindingOperation.getName())); - } else if (soapFault.getNamespace() != null) { - warning(soapFault, ModelerMessages.WSDLMODELER_WARNING_R_2716_R_2726("soapbind:fault", soapFault.getName())); - } - - String faultNamespaceURI = soapFault.getNamespace(); - if (faultNamespaceURI == null) { - faultNamespaceURI = portTypeFault.getMessage().getNamespaceURI(); - } - - com.sun.tools.internal.ws.wsdl.document.Message faultMessage = portTypeFault.resolveMessage(info.document); - Iterator iter2 = faultMessage.parts(); - if (!iter2.hasNext()) { - // the WSDL document is invalid - error(faultMessage, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_EMPTY_MESSAGE(bindingFault.getName(), faultMessage.getName())); - } - MessagePart faultPart = (MessagePart) iter2.next(); - QName faultQName = faultPart.getDescriptor(); - - // Don't include fault messages with non-unique soap:fault names - if (duplicateNames.contains(faultQName)) { - warning(faultPart, ModelerMessages.WSDLMODELER_DUPLICATE_FAULT_SOAP_NAME(bindingFault.getName(), info.portTypeOperation.getName(), faultPart.getName())); - continue; - } - - if (iter2.hasNext()) { - // the WSDL document is invalid - error(faultMessage, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_MESSAGE_HAS_MORE_THAN_ONE_PART(bindingFault.getName(), faultMessage.getName())); - } - - if (faultPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) { - error(faultPart, ModelerMessages.WSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(faultMessage.getName(), faultPart.getName())); - } - - JAXBType jaxbType = getJAXBType(faultPart); - - fault.setElementName(faultPart.getDescriptor()); - fault.setJavaMemberName(Names.getExceptionClassMemberName()); - - Block faultBlock = new Block(faultQName, jaxbType, faultPart); - fault.setBlock(faultBlock); - //createParentFault(fault); - //createSubfaults(fault); - if (!response.getFaultBlocksMap().containsKey(faultBlock.getName())) - response.addFaultBlock(faultBlock); - info.operation.addFault(fault); - } - } - - private String getFaultClassName(com.sun.tools.internal.ws.wsdl.document.Fault portTypeFault) { - JAXWSBinding jaxwsBinding = (JAXWSBinding) getExtensionOfType(portTypeFault, JAXWSBinding.class); - if (jaxwsBinding != null) { - CustomName className = jaxwsBinding.getClassName(); - if (className != null) { - return className.getName(); - } - } - return portTypeFault.getMessage().getLocalPart(); - } - - protected boolean setMessagePartsBinding(StyleAndUse styleAndUse) { - SOAPBody inBody = getSOAPRequestBody(); - Message inMessage = getInputMessage(); - if (!setMessagePartsBinding(inBody, inMessage, styleAndUse, true)) - return false; - - if (isRequestResponse()) { - SOAPBody outBody = getSOAPResponseBody(); - Message outMessage = getOutputMessage(); - if (!setMessagePartsBinding(outBody, outMessage, styleAndUse, false)) - return false; - } - return true; - } - - //returns false if the wsdl is invalid and operation should be ignored - protected boolean setMessagePartsBinding(SOAPBody body, Message message, StyleAndUse styleAndUse, boolean isInput) { - List parts = new ArrayList(); - - //get Mime parts - List mimeParts = null; - List headerParts = null; - List bodyParts = getBodyParts(body, message); - - if (isInput) { - headerParts = getHeaderPartsFromMessage(message, isInput); - mimeParts = getMimeContentParts(message, info.bindingOperation.getInput()); - } else { - headerParts = getHeaderPartsFromMessage(message, isInput); - mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput()); - } - - //As of now WSDL MIME binding is not supported, so throw the exception when such binding is encounterd -// if(mimeParts.size() > 0){ -// fail("wsdlmodeler.unsupportedBinding.mime", new Object[]{}); -// } - - //if soap:body parts attribute not there, then all unbounded message parts will - // belong to the soap body - if (bodyParts == null) { - bodyParts = new ArrayList(); - for (Iterator iter = message.parts(); iter.hasNext();) { - MessagePart mPart = iter.next(); - //Its a safe assumption that the parts in the message not belonging to header or mime will - // belong to the body? - if (mimeParts.contains(mPart) || headerParts.contains(mPart) || boundToFault(mPart.getName())) { - //throw error that a part cant be bound multiple times, not ignoring operation, if there - //is conflict it will fail latter - if (options.isExtensionMode()) - warning(mPart, ModelerMessages.WSDLMODELER_WARNING_BINDING_OPERATION_MULTIPLE_PART_BINDING(info.bindingOperation.getName(), mPart.getName())); - else - error(mPart, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_PART_BINDING(info.bindingOperation.getName(), mPart.getName())); - } - bodyParts.add(mPart); - } - } - - //now build the final parts list with header, mime parts and body parts - for (Iterator iter = message.parts(); iter.hasNext();) { - MessagePart mPart = (MessagePart) iter.next(); - if (mimeParts.contains(mPart)) { - mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING); - parts.add(mPart); - } else if (headerParts.contains(mPart)) { - mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING); - parts.add(mPart); - } else if (bodyParts.contains(mPart)) { - mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); - parts.add(mPart); - } else { - mPart.setBindingExtensibilityElementKind(MessagePart.PART_NOT_BOUNDED); - } - } - - if (isOperationDocumentLiteral(styleAndUse) && bodyParts.size() > 1) { - if (options.isExtensionMode()) - warning(message, ModelerMessages.WSDLMODELER_WARNING_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(info.portTypeOperation.getName())); - else - error(message, ModelerMessages.WSDLMODELER_INVALID_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(info.portTypeOperation.getName())); - return false; - } - return true; - } - - private boolean boundToFault(String partName) { - for (BindingFault bindingFault : info.bindingOperation.faults()) { - if (partName.equals(bindingFault.getName())) - return true; - } - return false; - } - - //get MessagePart(s) referenced by parts attribute of soap:body element - private List getBodyParts(SOAPBody body, Message message) { - String bodyParts = body.getParts(); - if (bodyParts != null) { - List partsList = new ArrayList(); - StringTokenizer in = new StringTokenizer(bodyParts.trim(), " "); - while (in.hasMoreTokens()) { - String part = in.nextToken(); - MessagePart mPart = message.getPart(part); - if (null == mPart) { - error(message, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName())); - } - mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); - partsList.add(mPart); - } - return partsList; - } - return null; - } - - private List getAdditionHeaderParts(Message message, boolean isInput){ - List headerParts = new ArrayList(); - List parts = message.getParts(); - List headers = getHeaderParts(isInput); - - for(MessagePart part: headers){ - if(parts.contains(part)) - continue; - headerParts.add(part); - } - return headerParts; - } - - private List getHeaderPartsFromMessage(Message message, boolean isInput) { - List headerParts = new ArrayList(); - Iterator parts = message.parts(); - List headers = getHeaderParts(isInput); - while (parts.hasNext()) { - MessagePart part = parts.next(); - if (headers.contains(part)) { - headerParts.add(part); - } - } - return headerParts; - } - - private Message getHeaderMessage(MessagePart part, TWSDLExtensible ext) { - Iterator headers = getHeaderExtensions(ext).iterator(); - while (headers.hasNext()) { - SOAPHeader header = headers.next(); - if (!header.isLiteral()) - continue; - com.sun.tools.internal.ws.wsdl.document.Message headerMessage = findMessage(header.getMessage(), info); - if (headerMessage == null) - continue; - - MessagePart headerPart = headerMessage.getPart(header.getPart()); - if (headerPart == part) - return headerMessage; - } - return null; - } - - private List getHeaderParts(boolean isInput) { - TWSDLExtensible ext; - if (isInput) { - ext = info.bindingOperation.getInput(); - } else { - ext = info.bindingOperation.getOutput(); - } - - List parts = new ArrayList(); - Iterator headers = getHeaderExtensions(ext).iterator(); - while (headers.hasNext()) { - SOAPHeader header = headers.next(); - if (!header.isLiteral()) { - error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_NOT_LITERAL(header.getPart(), info.bindingOperation.getName())); - } - - if (header.getNamespace() != null) { - warning(header, ModelerMessages.WSDLMODELER_WARNING_R_2716_R_2726("soapbind:header", info.bindingOperation.getName())); - } - com.sun.tools.internal.ws.wsdl.document.Message headerMessage = findMessage(header.getMessage(), info); - if (headerMessage == null) { - error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_CANT_RESOLVE_MESSAGE(header.getMessage(), info.bindingOperation.getName())); - } - - MessagePart part = headerMessage.getPart(header.getPart()); - if (part == null) { - error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_NOT_FOUND(header.getPart(), info.bindingOperation.getName())); - } - if (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) { - error(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), info.bindingOperation.getName())); - } - part.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING); - parts.add(part); - } - return parts; - } - - private boolean isOperationDocumentLiteral(StyleAndUse styleAndUse) { - return StyleAndUse.DOC_LITERAL == styleAndUse; - } - - private boolean isOperationRpcLiteral(StyleAndUse styleAndUse) { - return StyleAndUse.RPC_LITERAL == styleAndUse; - } - - /** - * @param part - * @return Returns a JAXBType object - */ - private JAXBType getJAXBType(MessagePart part) { - JAXBType type = null; - QName name = part.getDescriptor(); - if (part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)) { - type = jaxbModelBuilder.getJAXBType(name); - if(type == null){ - error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName())); - } - } else { - S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel(); - TypeAndAnnotation typeAnno = jaxbModel.getJavaType(name); - if (typeAnno == null) { - error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName())); - } - JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno)); - type = new JAXBType(new QName("", part.getName()), javaType); - } - return type; - } - - private List getDoclitParameters(Request req, Response res, List parameterList) { - if (parameterList.size() == 0) - return new ArrayList(); - List params = new ArrayList(); - Message inMsg = getInputMessage(); - Message outMsg = getOutputMessage(); - boolean unwrappable = isUnwrappable(); - List outParams = null; - int pIndex = 0; - for (MessagePart part : parameterList) { - QName reqBodyName = part.getDescriptor(); - JAXBType jaxbType = getJAXBType(part); - Block block = new Block(reqBodyName, jaxbType, part); - if (unwrappable) { - //So build body and header blocks and set to request and response - JAXBStructuredType jaxbStructType = ModelerUtils.createJAXBStructureType(jaxbType); - block = new Block(reqBodyName, jaxbStructType, part); - if (ModelerUtils.isBoundToSOAPBody(part)) { - if (part.isIN()) { - req.addBodyBlock(block); - } else if (part.isOUT()) { - res.addBodyBlock(block); - } else if (part.isINOUT()) { - req.addBodyBlock(block); - res.addBodyBlock(block); - } - } else if (ModelerUtils.isUnbound(part)) { - if (part.isIN()) - req.addUnboundBlock(block); - else if (part.isOUT()) - res.addUnboundBlock(block); - else if (part.isINOUT()) { - req.addUnboundBlock(block); - res.addUnboundBlock(block); - } - - } - if (part.isIN() || part.isINOUT()) { - params = ModelerUtils.createUnwrappedParameters(jaxbStructType, block); - int index = 0; - Mode mode = part.isINOUT() ? Mode.INOUT : Mode.IN; - for (Parameter param : params) { - param.setParameterIndex(index++); - param.setMode(mode); - setCustomizedParameterName(info.portTypeOperation, inMsg, part, param, unwrappable); - } - } else if (part.isOUT()) { - outParams = ModelerUtils.createUnwrappedParameters(jaxbStructType, block); - for (Parameter param : outParams) { - param.setMode(Mode.OUT); - setCustomizedParameterName(info.portTypeOperation, outMsg, part, param, unwrappable); - } - } - } else { - if (ModelerUtils.isBoundToSOAPBody(part)) { - if (part.isIN()) { - req.addBodyBlock(block); - } else if (part.isOUT()) { - res.addBodyBlock(block); - } else if (part.isINOUT()) { - req.addBodyBlock(block); - res.addBodyBlock(block); - } - } else if (ModelerUtils.isBoundToSOAPHeader(part)) { - if (part.isIN()) { - req.addHeaderBlock(block); - } else if (part.isOUT()) { - res.addHeaderBlock(block); - } else if (part.isINOUT()) { - req.addHeaderBlock(block); - res.addHeaderBlock(block); - } - } else if (ModelerUtils.isBoundToMimeContent(part)) { - List mimeContents = null; - - if (part.isIN()) { - mimeContents = getMimeContents(info.bindingOperation.getInput(), - getInputMessage(), part.getName()); - jaxbType = getAttachmentType(mimeContents, part); - block = new Block(jaxbType.getName(), jaxbType, part); - req.addAttachmentBlock(block); - } else if (part.isOUT()) { - mimeContents = getMimeContents(info.bindingOperation.getOutput(), - getOutputMessage(), part.getName()); - jaxbType = getAttachmentType(mimeContents, part); - block = new Block(jaxbType.getName(), jaxbType, part); - res.addAttachmentBlock(block); - } else if (part.isINOUT()) { - mimeContents = getMimeContents(info.bindingOperation.getInput(), - getInputMessage(), part.getName()); - jaxbType = getAttachmentType(mimeContents, part); - block = new Block(jaxbType.getName(), jaxbType, part); - req.addAttachmentBlock(block); - res.addAttachmentBlock(block); - - mimeContents = getMimeContents(info.bindingOperation.getOutput(), - getOutputMessage(), part.getName()); - JAXBType outJaxbType = getAttachmentType(mimeContents, part); - - String inType = jaxbType.getJavaType().getType().getName(); - String outType = outJaxbType.getJavaType().getType().getName(); - - TypeAndAnnotation inTa = jaxbType.getJavaType().getType().getTypeAnn(); - TypeAndAnnotation outTa = outJaxbType.getJavaType().getType().getTypeAnn(); - if ((((inTa != null) && (outTa != null) && inTa.equals(outTa))) && !inType.equals(outType)) { - String javaType = "javax.activation.DataHandler"; - - S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel(); - //JCodeModel cm = jaxbModel.generateCode(null, errReceiver); - JType jt = null; - jt = options.getCodeModel().ref(javaType); - JAXBTypeAndAnnotation jaxbTa = jaxbType.getJavaType().getType(); - jaxbTa.setType(jt); - } - } - } else if (ModelerUtils.isUnbound(part)) { - if (part.isIN()) { - req.addUnboundBlock(block); - } else if (part.isOUT()) { - res.addUnboundBlock(block); - } else if (part.isINOUT()) { - req.addUnboundBlock(block); - res.addUnboundBlock(block); - } - } - Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType, block); - param.setMode(part.getMode()); - if (part.isReturn()) { - param.setParameterIndex(-1); - } else { - param.setParameterIndex(pIndex++); - } - - if (part.isIN()) - setCustomizedParameterName(info.portTypeOperation, inMsg, part, param, false); - else if (outMsg != null) - setCustomizedParameterName(info.portTypeOperation, outMsg, part, param, false); - - params.add(param); - } - } - if (unwrappable && (outParams != null)) { - int index = params.size(); - for (Parameter param : outParams) { - if (JAXBRIContext.mangleNameToVariableName(param.getName()).equals("return")) { - param.setParameterIndex(-1); - } else { - Parameter inParam = ModelerUtils.getParameter(param.getName(), params); - if ((inParam != null) && inParam.isIN()) { - QName inElementName = inParam.getType().getName(); - QName outElementName = param.getType().getName(); - String inJavaType = inParam.getTypeName(); - String outJavaType = param.getTypeName(); - TypeAndAnnotation inTa = inParam.getType().getJavaType().getType().getTypeAnn(); - TypeAndAnnotation outTa = param.getType().getJavaType().getType().getTypeAnn(); - if (inElementName.getLocalPart().equals(outElementName.getLocalPart()) && inJavaType.equals(outJavaType) && - (inTa == null || outTa == null || inTa.equals(outTa))) { - inParam.setMode(Mode.INOUT); - continue; - } - } - if (outParams.size() == 1) { - param.setParameterIndex(-1); - } else { - param.setParameterIndex(index++); - } - } - params.add(param); - } - } - return params; - } - - private List getRpcLitParameters(Request req, Response res, Block reqBlock, Block resBlock, List paramList) { - List params = new ArrayList(); - Message inMsg = getInputMessage(); - Message outMsg = getOutputMessage(); - S2JJAXBModel jaxbModel = ((RpcLitStructure) reqBlock.getType()).getJaxbModel().getS2JJAXBModel(); - List inParams = ModelerUtils.createRpcLitParameters(inMsg, reqBlock, jaxbModel, errReceiver); - List outParams = null; - if (outMsg != null) - outParams = ModelerUtils.createRpcLitParameters(outMsg, resBlock, jaxbModel, errReceiver); - - //create parameters for header and mime parts - int index = 0; - for (MessagePart part : paramList) { - Parameter param = null; - if (ModelerUtils.isBoundToSOAPBody(part)) { - if (part.isIN()) { - param = ModelerUtils.getParameter(part.getName(), inParams); - } else if (outParams != null) { - param = ModelerUtils.getParameter(part.getName(), outParams); - } - } else if (ModelerUtils.isBoundToSOAPHeader(part)) { - QName headerName = part.getDescriptor(); - JAXBType jaxbType = getJAXBType(part); - Block headerBlock = new Block(headerName, jaxbType, part); - param = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock); - if (part.isIN()) { - req.addHeaderBlock(headerBlock); - } else if (part.isOUT()) { - res.addHeaderBlock(headerBlock); - } else if (part.isINOUT()) { - req.addHeaderBlock(headerBlock); - res.addHeaderBlock(headerBlock); - } - } else if (ModelerUtils.isBoundToMimeContent(part)) { - List mimeContents = null; - if (part.isIN() || part.isINOUT()) - mimeContents = getMimeContents(info.bindingOperation.getInput(), - getInputMessage(), part.getName()); - else - mimeContents = getMimeContents(info.bindingOperation.getOutput(), - getOutputMessage(), part.getName()); - - JAXBType type = getAttachmentType(mimeContents, part); - //create Parameters in request or response - //Block mimeBlock = new Block(new QName(part.getName()), type); - Block mimeBlock = new Block(type.getName(), type, part); - param = ModelerUtils.createParameter(part.getName(), type, mimeBlock); - if (part.isIN()) { - req.addAttachmentBlock(mimeBlock); - } else if (part.isOUT()) { - res.addAttachmentBlock(mimeBlock); - } else if (part.isINOUT()) { - mimeContents = getMimeContents(info.bindingOperation.getOutput(), - getOutputMessage(), part.getName()); - JAXBType outJaxbType = getAttachmentType(mimeContents, part); - - String inType = type.getJavaType().getType().getName(); - String outType = outJaxbType.getJavaType().getType().getName(); - if (!inType.equals(outType)) { - String javaType = "javax.activation.DataHandler"; - JType jt = null; - jt = options.getCodeModel().ref(javaType); - JAXBTypeAndAnnotation jaxbTa = type.getJavaType().getType(); - jaxbTa.setType(jt); - } - req.addAttachmentBlock(mimeBlock); - res.addAttachmentBlock(mimeBlock); - } - } else if (ModelerUtils.isUnbound(part)) { - QName name = part.getDescriptor(); - JAXBType type = getJAXBType(part); - Block unboundBlock = new Block(name, type, part); - if (part.isIN()) { - req.addUnboundBlock(unboundBlock); - } else if (part.isOUT()) { - res.addUnboundBlock(unboundBlock); - } else if (part.isINOUT()) { - req.addUnboundBlock(unboundBlock); - res.addUnboundBlock(unboundBlock); - } - param = ModelerUtils.createParameter(part.getName(), type, unboundBlock); - } - if (param != null) { - if (part.isReturn()) { - param.setParameterIndex(-1); - } else { - param.setParameterIndex(index++); - } - param.setMode(part.getMode()); - params.add(param); - } - } - for (Parameter param : params) { - if (param.isIN()) - setCustomizedParameterName(info.portTypeOperation, inMsg, inMsg.getPart(param.getName()), param, false); - else if (outMsg != null) - setCustomizedParameterName(info.portTypeOperation, outMsg, outMsg.getPart(param.getName()), param, false); - } - return params; - } - - private List getRequestParameters(Request request, List parameterList) { - Message inputMessage = getInputMessage(); - //there is no input message, return zero parameters - if (inputMessage != null && !inputMessage.parts().hasNext()) - return new ArrayList(); - - List inParameters = null; - QName reqBodyName = null; - Block reqBlock = null; - JAXBType jaxbReqType = null; - boolean unwrappable = isUnwrappable(); - boolean doneSOAPBody = false; - //setup request parameters - for (String inParamName : parameterList) { - MessagePart part = inputMessage.getPart(inParamName); - if (part == null) - continue; - reqBodyName = part.getDescriptor(); - jaxbReqType = getJAXBType(part); - if (unwrappable) { - //So build body and header blocks and set to request and response - JAXBStructuredType jaxbRequestType = ModelerUtils.createJAXBStructureType(jaxbReqType); - reqBlock = new Block(reqBodyName, jaxbRequestType, part); - if (ModelerUtils.isBoundToSOAPBody(part)) { - request.addBodyBlock(reqBlock); - } else if (ModelerUtils.isUnbound(part)) { - request.addUnboundBlock(reqBlock); - } - inParameters = ModelerUtils.createUnwrappedParameters(jaxbRequestType, reqBlock); - for (Parameter param : inParameters) { - setCustomizedParameterName(info.portTypeOperation, inputMessage, part, param, unwrappable); - } - } else { - reqBlock = new Block(reqBodyName, jaxbReqType, part); - if (ModelerUtils.isBoundToSOAPBody(part) && !doneSOAPBody) { - doneSOAPBody = true; - request.addBodyBlock(reqBlock); - } else if (ModelerUtils.isBoundToSOAPHeader(part)) { - request.addHeaderBlock(reqBlock); - } else if (ModelerUtils.isBoundToMimeContent(part)) { - List mimeContents = getMimeContents(info.bindingOperation.getInput(), - getInputMessage(), part.getName()); - jaxbReqType = getAttachmentType(mimeContents, part); - //reqBlock = new Block(new QName(part.getName()), jaxbReqType); - reqBlock = new Block(jaxbReqType.getName(), jaxbReqType, part); - request.addAttachmentBlock(reqBlock); - } else if (ModelerUtils.isUnbound(part)) { - request.addUnboundBlock(reqBlock); - } - if (inParameters == null) - inParameters = new ArrayList(); - Parameter param = ModelerUtils.createParameter(part.getName(), jaxbReqType, reqBlock); - setCustomizedParameterName(info.portTypeOperation, inputMessage, part, param, false); - inParameters.add(param); - } - } - return inParameters; - } - - /** - * @param part - * @param param - * @param wrapperStyle TODO - */ - private void setCustomizedParameterName(TWSDLExtensible extension, Message msg, MessagePart part, Parameter param, boolean wrapperStyle) { - JAXWSBinding jaxwsBinding = (JAXWSBinding) getExtensionOfType(extension, JAXWSBinding.class); - if (jaxwsBinding == null) - return; - String paramName = part.getName(); - QName elementName = part.getDescriptor(); - if (wrapperStyle) - elementName = param.getType().getName(); - String customName = jaxwsBinding.getParameterName(msg.getName(), paramName, elementName, wrapperStyle); - if (customName != null && !customName.equals("")) { - param.setCustomName(customName); - } - } - - protected boolean isConflictingPortClassName(String name) { - return false; - } - - protected boolean isUnwrappable() { - if (!getWrapperStyleCustomization()) - return false; - - com.sun.tools.internal.ws.wsdl.document.Message inputMessage = getInputMessage(); - com.sun.tools.internal.ws.wsdl.document.Message outputMessage = getOutputMessage(); - - // Wrapper style if the operation's input and output messages each contain - // only a single part - if ((inputMessage != null && inputMessage.numParts() != 1) - || (outputMessage != null && outputMessage.numParts() != 1)) { - return false; - } - - MessagePart inputPart = inputMessage != null - ? inputMessage.parts().next() : null; - MessagePart outputPart = outputMessage != null - ? outputMessage.parts().next() : null; - String operationName = info.portTypeOperation.getName(); - - // Wrapper style if the input message part refers to a global element declaration whose localname - // is equal to the operation name - // Wrapper style if the output message part refers to a global element declaration - if ((inputPart != null && !inputPart.getDescriptor().getLocalPart().equals(operationName)) || - (outputPart != null && outputPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) - return false; - - //check to see if either input or output message part not bound to soapbing:body - //in that case the operation is not wrapper style - if (((inputPart != null) && (inputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING)) || - ((outputPart != null) && (outputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING))) - return false; - - // Wrapper style if the elements referred to by the input and output message parts - // (henceforth referred to as wrapper elements) are both complex types defined - // using the xsd:sequence compositor - // Wrapper style if the wrapper elements only contain child elements, they must not - // contain other structures such as xsd:choice, substitution groups1 or attributes - //These checkins are done by jaxb, we just check if jaxb has wrapper children. If there - // are then its wrapper style - //if(inputPart != null && outputPart != null){ - if (inputPart != null) { - boolean inputWrappable = false; - JAXBType inputType = getJAXBType(inputPart); - if (inputType != null) { - inputWrappable = inputType.isUnwrappable(); - } - //if there are no output part (oneway), the operation can still be wrapper style - if (outputPart == null) { - return inputWrappable; - } - JAXBType outputType = getJAXBType(outputPart); - if ((inputType != null) && (outputType != null)) - return inputType.isUnwrappable() && outputType.isUnwrappable(); - } - - return false; - } - - private boolean getWrapperStyleCustomization() { - //first we look into wsdl:portType/wsdl:operation - com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation = info.portTypeOperation; - JAXWSBinding jaxwsBinding = (JAXWSBinding) getExtensionOfType(portTypeOperation, JAXWSBinding.class); - if (jaxwsBinding != null) { - Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle(); - if (isWrappable != null) - return isWrappable; - } - - //then into wsdl:portType - PortType portType = info.port.resolveBinding(document).resolvePortType(document); - jaxwsBinding = (JAXWSBinding) getExtensionOfType(portType, JAXWSBinding.class); - if (jaxwsBinding != null) { - Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle(); - if (isWrappable != null) - return isWrappable; - } - - //then wsdl:definitions - jaxwsBinding = (JAXWSBinding) getExtensionOfType(document.getDefinitions(), JAXWSBinding.class); - if (jaxwsBinding != null) { - Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle(); - if (isWrappable != null) - return isWrappable; - } - return true; - } - - /* (non-Javadoc) - * @see WSDLModelerBase#isSingleInOutPart(Set, MessagePart) - */ - protected boolean isSingleInOutPart(Set inputParameterNames, - MessagePart outputPart) { - // As of now, we dont have support for in/out in doc-lit. So return false. - SOAPOperation soapOperation = - (SOAPOperation) getExtensionOfType(info.bindingOperation, - SOAPOperation.class); - if ((soapOperation != null) && (soapOperation.isDocument() || info.soapBinding.isDocument())) { - Iterator iter = getInputMessage().parts(); - while (iter.hasNext()) { - MessagePart part = (MessagePart) iter.next(); - if (outputPart.getName().equals(part.getName()) && outputPart.getDescriptor().equals(part.getDescriptor())) - return true; - } - } else if (soapOperation != null && soapOperation.isRPC() || info.soapBinding.isRPC()) { - com.sun.tools.internal.ws.wsdl.document.Message inputMessage = getInputMessage(); - if (inputParameterNames.contains(outputPart.getName())) { - if (inputMessage.getPart(outputPart.getName()).getDescriptor().equals(outputPart.getDescriptor())) { - return true; - } - } - } - return false; - } - - private List createRpcLitRequestParameters(Request request, List parameterList, Block block) { - Message message = getInputMessage(); - S2JJAXBModel jaxbModel = ((RpcLitStructure) block.getType()).getJaxbModel().getS2JJAXBModel(); - List parameters = ModelerUtils.createRpcLitParameters(message, block, jaxbModel, errReceiver); - - //create parameters for header and mime parts - for (String paramName : parameterList) { - MessagePart part = message.getPart(paramName); - if (part == null) - continue; - if (ModelerUtils.isBoundToSOAPHeader(part)) { - if (parameters == null) - parameters = new ArrayList(); - QName headerName = part.getDescriptor(); - JAXBType jaxbType = getJAXBType(part); - Block headerBlock = new Block(headerName, jaxbType, part); - request.addHeaderBlock(headerBlock); - Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock); - if (param != null) { - parameters.add(param); - } - } else if (ModelerUtils.isBoundToMimeContent(part)) { - if (parameters == null) - parameters = new ArrayList(); - List mimeContents = getMimeContents(info.bindingOperation.getInput(), - getInputMessage(), paramName); - - JAXBType type = getAttachmentType(mimeContents, part); - //create Parameters in request or response - //Block mimeBlock = new Block(new QName(part.getName()), type); - Block mimeBlock = new Block(type.getName(), type, part); - request.addAttachmentBlock(mimeBlock); - Parameter param = ModelerUtils.createParameter(part.getName(), type, mimeBlock); - if (param != null) { - parameters.add(param); - } - } else if (ModelerUtils.isUnbound(part)) { - if (parameters == null) - parameters = new ArrayList(); - QName name = part.getDescriptor(); - JAXBType type = getJAXBType(part); - Block unboundBlock = new Block(name, type, part); - request.addUnboundBlock(unboundBlock); - Parameter param = ModelerUtils.createParameter(part.getName(), type, unboundBlock); - if (param != null) { - parameters.add(param); - } - } - } - for (Parameter param : parameters) { - setCustomizedParameterName(info.portTypeOperation, message, message.getPart(param.getName()), param, false); - } - return parameters; - } - - private String getJavaTypeForMimeType(String mimeType) { - if (mimeType.equals("image/jpeg") || mimeType.equals("image/gif")) { - return "java.awt.Image"; - } else if (mimeType.equals("text/xml") || mimeType.equals("application/xml")) { - return "javax.xml.transform.Source"; - } - return "javax.activation.DataHandler"; - } - - private JAXBType getAttachmentType(List mimeContents, MessagePart part) { - if (!enableMimeContent()) { - return getJAXBType(part); - } - String javaType = null; - List mimeTypes = getAlternateMimeTypes(mimeContents); - if (mimeTypes.size() > 1) { - javaType = "javax.activation.DataHandler"; - } else { - javaType = getJavaTypeForMimeType(mimeTypes.get(0)); - } - - S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel(); - JType jt = null; - jt = options.getCodeModel().ref(javaType); - QName desc = part.getDescriptor(); - TypeAndAnnotation typeAnno = null; - - if (part.getDescriptorKind() == SchemaKinds.XSD_TYPE) { - typeAnno = jaxbModel.getJavaType(desc); - desc = new QName("", part.getName()); - } else if (part.getDescriptorKind() == SchemaKinds.XSD_ELEMENT) { - typeAnno = getJAXBModelBuilder().getElementTypeAndAnn(desc); - if(typeAnno == null){ - error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(part.getDescriptor(), part.getName())); - } - for (Iterator mimeTypeIter = mimeTypes.iterator(); mimeTypeIter.hasNext();) { - String mimeType = (String) mimeTypeIter.next(); - if ((!mimeType.equals("text/xml") && - !mimeType.equals("application/xml"))) { - //According to AP 1.0, - //RZZZZ: In a DESCRIPTION, if a wsdl:part element refers to a - //global element declaration (via the element attribute of the wsdl:part - //element) then the value of the type attribute of a mime:content element - //that binds that part MUST be a content type suitable for carrying an - //XML serialization. - //should we throw warning? - //type = MimeHelper.javaType.DATA_HANDLER_JAVATYPE; - warning(part, ModelerMessages.MIMEMODELER_ELEMENT_PART_INVALID_ELEMENT_MIME_TYPE(part.getName(), mimeType)); - } - } - } - if (typeAnno == null) { - error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(desc, part.getName())); - } - return new JAXBType(desc, new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno, jt)), - null, getJAXBModelBuilder().getJAXBModel()); - } - - protected void buildJAXBModel(WSDLDocument wsdlDocument) { - JAXBModelBuilder jaxbModelBuilder = new JAXBModelBuilder(options, classNameCollector, forest, errReceiver); - //set the java package where wsdl artifacts will be generated - //if user provided package name using -p switch (or package property on wsimport ant task) - //ignore the package customization in the wsdl and schema bidnings - //formce the -p option only in the first pass - if (explicitDefaultPackage != null) { - jaxbModelBuilder.getJAXBSchemaCompiler().forcePackageName(options.defaultPackage); - } else { - options.defaultPackage = getJavaPackage(); - } - - //create pseudo schema for async operations(if any) response bean - List schemas = PseudoSchemaBuilder.build(this, options, errReceiver); - for (InputSource schema : schemas) { - jaxbModelBuilder.getJAXBSchemaCompiler().parseSchema(schema); - } - jaxbModelBuilder.bind(); - this.jaxbModelBuilder = jaxbModelBuilder; - } - - protected String getJavaPackage() { - String jaxwsPackage = null; - JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(document.getDefinitions(), JAXWSBinding.class); - if (jaxwsCustomization != null && jaxwsCustomization.getJaxwsPackage() != null) { - jaxwsPackage = jaxwsCustomization.getJaxwsPackage().getName(); - } - if (jaxwsPackage != null) { - return jaxwsPackage; - } - String wsdlUri = document.getDefinitions().getTargetNamespaceURI(); - return XJC.getDefaultPackageName(wsdlUri); - - } - - protected void createJavaInterfaceForProviderPort(Port port) { - String interfaceName = "javax.xml.ws.Provider"; - JavaInterface intf = new JavaInterface(interfaceName); - port.setJavaInterface(intf); - } - - protected void createJavaInterfaceForPort(Port port, boolean isProvider) { - if (isProvider) { - createJavaInterfaceForProviderPort(port); - return; - } - String interfaceName = getJavaNameOfSEI(port); - - if (isConflictingPortClassName(interfaceName)) { - interfaceName += "_PortType"; - } - - JavaInterface intf = new JavaInterface(interfaceName); - for (Operation operation : port.getOperations()) { - createJavaMethodForOperation( - port, - operation, - intf); - - for (JavaParameter jParam : operation.getJavaMethod().getParametersList()) { - Parameter param = jParam.getParameter(); - if (param.getCustomName() != null) - jParam.setName(param.getCustomName()); - } - } - - port.setJavaInterface(intf); - } - - protected String getServiceInterfaceName(QName serviceQName, com.sun.tools.internal.ws.wsdl.document.Service wsdlService) { - String serviceName = wsdlService.getName(); - JAXWSBinding jaxwsCust = (JAXWSBinding) getExtensionOfType(wsdlService, JAXWSBinding.class); - if (jaxwsCust != null && jaxwsCust.getClassName() != null) { - CustomName name = jaxwsCust.getClassName(); - if (name != null && !name.equals("")) - serviceName = name.getName(); - } - String serviceInterface = ""; - String javaPackageName = options.defaultPackage; - serviceInterface = javaPackageName + "."; - - serviceInterface - += JAXBRIContext.mangleNameToClassName(serviceName); - return serviceInterface; - } - - protected String getJavaNameOfSEI(Port port) { - QName portTypeName = - (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - PortType pt = (PortType) document.find(Kinds.PORT_TYPE, portTypeName); - //populate the portType map here. We should get rid of all these properties - // lets not do it as it may break NB - //TODO: clean all these stuff part of NB RFE - port.portTypes.put(portTypeName, pt); - JAXWSBinding jaxwsCust = (JAXWSBinding) getExtensionOfType(pt, JAXWSBinding.class); - if (jaxwsCust != null && jaxwsCust.getClassName() != null) { - CustomName name = jaxwsCust.getClassName(); - if (name != null && !name.equals("")) { - return makePackageQualified(name.getName()); - } - } - - String interfaceName = null; - if (portTypeName != null) { - // got portType information from WSDL, use it to name the interface - interfaceName = - makePackageQualified(JAXBRIContext.mangleNameToClassName(portTypeName.getLocalPart())); - } else { - // somehow we only got the port name, so we use that - interfaceName = - makePackageQualified(JAXBRIContext.mangleNameToClassName(port.getName().getLocalPart())); - } - return interfaceName; - } - - private void createJavaMethodForAsyncOperation(Port port, Operation operation, - JavaInterface intf) { - String candidateName = getJavaNameForOperation(operation); - JavaMethod method = new JavaMethod(candidateName, options, errReceiver); - Request request = operation.getRequest(); - Iterator requestBodyBlocks = request.getBodyBlocks(); - Block requestBlock = - (requestBodyBlocks.hasNext() - ? (Block) request.getBodyBlocks().next() - : null); - - Response response = operation.getResponse(); - Iterator responseBodyBlocks = null; - Block responseBlock; - if (response != null) { - responseBodyBlocks = response.getBodyBlocks(); - responseBlock = - responseBodyBlocks.hasNext() - ? (Block) response.getBodyBlocks().next() - : null; - } - - // build a signature of the form "opName%arg1type%arg2type%...%argntype so that we - // detect overloading conflicts in the generated java interface/classes - String signature = candidateName; - for (Iterator iter = request.getParameters(); iter.hasNext();) { - Parameter parameter = (Parameter) iter.next(); - - if (parameter.getJavaParameter() != null) { - error(operation.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION(operation.getName().getLocalPart())); - } - - JavaType parameterType = parameter.getType().getJavaType(); - JavaParameter javaParameter = - new JavaParameter( - JAXBRIContext.mangleNameToVariableName(parameter.getName()), - parameterType, - parameter, - parameter.getLinkedParameter() != null); - if (javaParameter.isHolder()) { - javaParameter.setHolderName(javax.xml.ws.Holder.class.getName()); - } - method.addParameter(javaParameter); - parameter.setJavaParameter(javaParameter); - - signature += "%" + parameterType.getName(); - } - - if (response != null) { - String resultParameterName = - (String) operation.getProperty(WSDL_RESULT_PARAMETER); - Parameter resultParameter = - response.getParameterByName(resultParameterName); - JavaType returnType = resultParameter.getType().getJavaType(); - method.setReturnType(returnType); - - } - operation.setJavaMethod(method); - intf.addMethod(method); - } - - /* (non-Javadoc) - * @see WSDLModelerBase#createJavaMethodForOperation(WSDLPort, WSDLOperation, JavaInterface, Set, Set) - */ - protected void createJavaMethodForOperation(Port port, Operation operation, JavaInterface intf) { - if ((operation instanceof AsyncOperation)) { - createJavaMethodForAsyncOperation(port, operation, intf); - return; - } - String candidateName = getJavaNameForOperation(operation); - JavaMethod method = new JavaMethod(candidateName, options, errReceiver); - Request request = operation.getRequest(); - Parameter returnParam = (Parameter) operation.getProperty(WSDL_RESULT_PARAMETER); - if (returnParam != null) { - JavaType parameterType = returnParam.getType().getJavaType(); - method.setReturnType(parameterType); - } else { - JavaType ret = new JavaSimpleTypeCreator().VOID_JAVATYPE; - method.setReturnType(ret); - } - List parameterOrder = (List) operation.getProperty(WSDL_PARAMETER_ORDER); - for (Parameter param : parameterOrder) { - JavaType parameterType = param.getType().getJavaType(); - String name = (param.getCustomName() != null) ? param.getCustomName() : param.getName(); - name = JAXBRIContext.mangleNameToVariableName(name); - //if its a java keyword after name mangling, then we simply put underscore as there is no - //need to ask user to customize the parameter name if its java keyword - if(Names.isJavaReservedWord(name)){ - name = "_"+name; - } - JavaParameter javaParameter = - new JavaParameter( - name, - parameterType, - param, - param.isINOUT() || param.isOUT()); - if (javaParameter.isHolder()) { - javaParameter.setHolderName(javax.xml.ws.Holder.class.getName()); - } - method.addParameter(javaParameter); - param.setJavaParameter(javaParameter); - } - operation.setJavaMethod(method); - intf.addMethod(method); - - String opName = JAXBRIContext.mangleNameToVariableName(operation.getName().getLocalPart()); - for (Iterator iter = operation.getFaults(); - iter != null && iter.hasNext(); - ) { - Fault fault = (Fault) iter.next(); - createJavaExceptionFromLiteralType(fault, port, opName); - } - JavaException javaException; - Fault fault; - for (Iterator iter = operation.getFaults(); iter.hasNext();) { - fault = (Fault) iter.next(); - javaException = fault.getJavaException(); - method.addException(javaException.getName()); - } - - } - - protected boolean createJavaExceptionFromLiteralType(Fault fault, com.sun.tools.internal.ws.processor.model.Port port, String operationName) { - JAXBType faultType = (JAXBType) fault.getBlock().getType(); - - String exceptionName = - makePackageQualified(JAXBRIContext.mangleNameToClassName(fault.getName())); - - // use fault namespace attribute - JAXBStructuredType jaxbStruct = new JAXBStructuredType(new QName( - fault.getBlock().getName().getNamespaceURI(), - fault.getName())); - - QName memberName = fault.getElementName(); - JAXBElementMember jaxbMember = - new JAXBElementMember(memberName, faultType); - //jaxbMember.setNillable(faultType.isNillable()); - - String javaMemberName = getLiteralJavaMemberName(fault); - JavaStructureMember javaMember = new JavaStructureMember( - javaMemberName, - faultType.getJavaType(), - jaxbMember); - jaxbMember.setJavaStructureMember(javaMember); - javaMember.setReadMethod(Names.getJavaMemberReadMethod(javaMember)); - javaMember.setInherited(false); - jaxbMember.setJavaStructureMember(javaMember); - jaxbStruct.add(jaxbMember); - - if (isConflictingExceptionClassName(exceptionName)) { - exceptionName += "_Exception"; - } - - JavaException existingJavaException = (JavaException) _javaExceptions.get(exceptionName); - if (existingJavaException != null) { - if (existingJavaException.getName().equals(exceptionName)) { - if (((JAXBType) existingJavaException.getOwner()).getName().equals(jaxbStruct.getName()) - || ModelerUtils.isEquivalentLiteralStructures(jaxbStruct, (JAXBStructuredType) existingJavaException.getOwner())) { - // we have mapped this fault already - if (faultType instanceof JAXBStructuredType) { - fault.getBlock().setType((JAXBType) existingJavaException.getOwner()); - } - fault.setJavaException(existingJavaException); - return false; - } - } - } - - JavaException javaException = new JavaException(exceptionName, false, jaxbStruct); - javaException.add(javaMember); - jaxbStruct.setJavaType(javaException); - - _javaExceptions.put(javaException.getName(), javaException); - - fault.setJavaException(javaException); - return true; - } - - protected boolean isRequestResponse() { - return info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE; - } - - protected java.util.List getAsynParameterOrder() { - //for async operation ignore the parameterOrder - java.util.List parameterList = new ArrayList(); - Message inputMessage = getInputMessage(); - List inputParts = inputMessage.getParts(); - for (MessagePart part : inputParts) { - parameterList.add(part.getName()); - } - return parameterList; - } - - - protected List getParameterOrder() { - List params = new ArrayList(); - String parameterOrder = info.portTypeOperation.getParameterOrder(); - java.util.List parameterList = new ArrayList(); - boolean parameterOrderPresent = false; - if ((parameterOrder != null) && !(parameterOrder.trim().equals(""))) { - parameterList = XmlUtil.parseTokenList(parameterOrder); - parameterOrderPresent = true; - } else { - parameterList = new ArrayList(); - } - Message inputMessage = getInputMessage(); - Message outputMessage = getOutputMessage(); - List outputParts = null; - List inputParts = inputMessage.getParts(); - //reset the mode and ret flag, as MEssagePArts aer shared across ports - for (MessagePart part : inputParts) { - part.setMode(Mode.IN); - part.setReturn(false); - } - if (isRequestResponse()) { - outputParts = outputMessage.getParts(); - for (MessagePart part : outputParts) { - part.setMode(Mode.OUT); - part.setReturn(false); - } - } - - if (parameterOrderPresent) { - boolean validParameterOrder = true; - Iterator paramOrders = parameterList.iterator(); - // If any part in the parameterOrder is not present in the request or - // response message, we completely ignore the parameterOrder hint - while (paramOrders.hasNext()) { - String param = paramOrders.next(); - boolean partFound = false; - for (MessagePart part : inputParts) { - if (param.equals(part.getName())) { - partFound = true; - break; - } - } - // if not found, check in output parts - if (!partFound) { - for (MessagePart part : outputParts) { - if (param.equals(part.getName())) { - partFound = true; - break; - } - } - } - if (!partFound) { - warning(info.operation.getEntity(), ModelerMessages.WSDLMODELER_INVALID_PARAMETERORDER_PARAMETER(param, info.operation.getName().getLocalPart())); - validParameterOrder = false; - } - } - - List inputUnlistedParts = new ArrayList(); - List outputUnlistedParts = new ArrayList(); - - //gather input Parts - if (validParameterOrder) { - for (String param : parameterList) { - MessagePart part = inputMessage.getPart(param); - if (part != null) { - params.add(part); - continue; - } - if (isRequestResponse()) { - MessagePart outPart = outputMessage.getPart(param); - if (outPart != null) { - params.add(outPart); - continue; - } - } - } - - for (MessagePart part : inputParts) { - if (!parameterList.contains(part.getName())) { - inputUnlistedParts.add(part); - } - } - - if (isRequestResponse()) { - // at most one output part should be unlisted - for (MessagePart part : outputParts) { - if (!parameterList.contains(part.getName())) { - MessagePart inPart = inputMessage.getPart(part.getName()); - //dont add inout as unlisted part - if ((inPart != null) && inPart.getDescriptor().equals(part.getDescriptor())) { - inPart.setMode(Mode.INOUT); - } else { - outputUnlistedParts.add(part); - } - } else { - //param list may contain it, check if its INOUT - MessagePart inPart = inputMessage.getPart(part.getName()); - //dont add inout as unlisted part - if ((inPart != null) && inPart.getDescriptor().equals(part.getDescriptor())) { - inPart.setMode(Mode.INOUT); - } else if (!params.contains(part)) { - params.add(part); - } - } - } - if (outputUnlistedParts.size() == 1) { - MessagePart resultPart = outputUnlistedParts.get(0); - resultPart.setReturn(true); - params.add(resultPart); - outputUnlistedParts.clear(); - } - } - - //add the input and output unlisted parts - for (MessagePart part : inputUnlistedParts) { - params.add(part); - } - - for (MessagePart part : outputUnlistedParts) { - params.add(part); - } - return params; - - } - //parameterOrder attribute is not valid, we ignore it - warning(info.operation.getEntity(), ModelerMessages.WSDLMODELER_INVALID_PARAMETER_ORDER_INVALID_PARAMETER_ORDER(info.operation.getName().getLocalPart())); - parameterOrderPresent = false; - parameterList.clear(); - } - - List outParts = new ArrayList(); - - //construct input parameter list with the same order as in input message - for (MessagePart part : inputParts) { - params.add(part); - } - - if (isRequestResponse()) { - for (MessagePart part : outputParts) { - MessagePart inPart = inputMessage.getPart(part.getName()); - if (inPart != null && part.getDescriptorKind() == inPart.getDescriptorKind() && - part.getDescriptor().equals(inPart.getDescriptor())) { - inPart.setMode(Mode.INOUT); - continue; - } - outParts.add(part); - } - - //append the out parts to the parameterList - for (MessagePart part : outParts) { - if (outParts.size() == 1) - part.setReturn(true); - params.add(part); - } - } - return params; - } - - /** - * @param port - * @param suffix - * @return the Java ClassName for a port - */ - protected String getClassName(Port port, String suffix) { - String prefix = JAXBRIContext.mangleNameToClassName((port.getName().getLocalPart())); - return options.defaultPackage + "." + prefix + suffix; - } - - protected boolean isConflictingServiceClassName(String name) { - return conflictsWithSEIClass(name) || conflictsWithJAXBClass(name) || conflictsWithExceptionClass(name); - } - - private boolean conflictsWithSEIClass(String name) { - Set seiNames = classNameCollector.getSeiClassNames(); - return seiNames != null && seiNames.contains(name); - } - - private boolean conflictsWithJAXBClass(String name) { - Set jaxbNames = classNameCollector.getJaxbGeneratedClassNames(); - return jaxbNames != null && jaxbNames.contains(name); - } - - private boolean conflictsWithExceptionClass(String name) { - Set exceptionNames = classNameCollector.getExceptionClassNames(); - return exceptionNames != null && exceptionNames.contains(name); - } - - protected boolean isConflictingExceptionClassName(String name) { - return conflictsWithSEIClass(name) || conflictsWithJAXBClass(name); - } - - protected JAXBModelBuilder getJAXBModelBuilder() { - return jaxbModelBuilder; - } - - protected boolean validateWSDLBindingStyle(Binding binding) { - SOAPBinding soapBinding = - (SOAPBinding) getExtensionOfType(binding, SOAPBinding.class); - - //dont process the binding - if (soapBinding == null) - soapBinding = - (SOAPBinding) getExtensionOfType(binding, SOAP12Binding.class); - if (soapBinding == null) - return false; - - //if soapbind:binding has no style attribute, the default is DOCUMENT - if (soapBinding.getStyle() == null) - soapBinding.setStyle(SOAPStyle.DOCUMENT); - - SOAPStyle opStyle = soapBinding.getStyle(); - for (Iterator iter = binding.operations(); iter.hasNext();) { - BindingOperation bindingOperation = - (BindingOperation) iter.next(); - SOAPOperation soapOperation = - (SOAPOperation) getExtensionOfType(bindingOperation, - SOAPOperation.class); - if (soapOperation != null) { - SOAPStyle currOpStyle = (soapOperation.getStyle() != null) ? soapOperation.getStyle() : soapBinding.getStyle(); - //dont check for the first operation - if (!currOpStyle.equals(opStyle)) - return false; - } - } - return true; - } - - /** - * @param port - */ - private void applyWrapperStyleCustomization(Port port, PortType portType) { - JAXWSBinding jaxwsBinding = (JAXWSBinding) getExtensionOfType(portType, JAXWSBinding.class); - Boolean wrapperStyle = (jaxwsBinding != null) ? jaxwsBinding.isEnableWrapperStyle() : null; - if (wrapperStyle != null) { - port.setWrapped(wrapperStyle); - } - } - - protected static void setDocumentationIfPresent( - ModelObject obj, - Documentation documentation) { - if (documentation != null && documentation.getContent() != null) { - obj.setJavaDoc(documentation.getContent()); - } - } - - protected String getJavaNameForOperation(Operation operation) { - String name = operation.getJavaMethodName(); - if (Names.isJavaReservedWord(name)) { - name = "_" + name; - } - return name; - } - - private void reportError(Entity entity, - String formattedMsg, Exception nestedException ) { - Locator locator = (entity == null)?null:entity.getLocator(); - - SAXParseException e = new SAXParseException2( formattedMsg, - locator, - nestedException ); - errReceiver.error(e); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModelerBase.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModelerBase.java deleted file mode 100644 index cd087ed1487..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModelerBase.java +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.processor.modeler.wsdl; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.processor.generator.Names; -import com.sun.tools.internal.ws.processor.model.Fault; -import com.sun.tools.internal.ws.processor.model.Operation; -import com.sun.tools.internal.ws.processor.model.Port; -import com.sun.tools.internal.ws.processor.model.java.JavaException; -import com.sun.tools.internal.ws.processor.modeler.JavaSimpleTypeCreator; -import com.sun.tools.internal.ws.processor.modeler.Modeler; -import com.sun.tools.internal.ws.resources.ModelerMessages; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.ErrorReceiverFilter; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.document.*; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding; -import com.sun.tools.internal.ws.wsdl.document.mime.MIMEContent; -import com.sun.tools.internal.ws.wsdl.document.mime.MIMEMultipartRelated; -import com.sun.tools.internal.ws.wsdl.document.mime.MIMEPart; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds; -import com.sun.tools.internal.ws.wsdl.document.soap.*; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.GloballyKnown; -import com.sun.tools.internal.ws.wsdl.framework.NoSuchEntityException; -import com.sun.tools.internal.ws.wsdl.parser.DOMForest; -import com.sun.tools.internal.ws.wsdl.parser.WSDLParser; -import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import org.xml.sax.helpers.LocatorImpl; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * - * @author WS Development Team - * - * Base class for WSDL->Model classes. - */ -public abstract class WSDLModelerBase implements Modeler { - protected final ErrorReceiverFilter errReceiver; - protected final WsimportOptions options; - protected MetadataFinder forest; - - - public WSDLModelerBase(WsimportOptions options, ErrorReceiver receiver) { - this.options = options; - this.errReceiver = new ErrorReceiverFilter(receiver);; - } - - /** - * - * @param port - * @param wsdlPort - */ - protected void applyPortMethodCustomization(Port port, com.sun.tools.internal.ws.wsdl.document.Port wsdlPort) { - if(isProvider(wsdlPort)) - return; - JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class); - - String portMethodName = (jaxwsBinding != null)?((jaxwsBinding.getMethodName() != null)?jaxwsBinding.getMethodName().getName():null):null; - if(portMethodName != null){ - port.setPortGetter(portMethodName); - }else{ - portMethodName = Names.getPortName(port); - portMethodName = JAXBRIContext.mangleNameToClassName(portMethodName); - port.setPortGetter("get"+portMethodName); - } - - } - - protected boolean isProvider(com.sun.tools.internal.ws.wsdl.document.Port wsdlPort){ - JAXWSBinding portCustomization = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class); - Boolean isProvider = (portCustomization != null)?portCustomization.isProvider():null; - if(isProvider != null){ - return isProvider; - } - - JAXWSBinding jaxwsGlobalCustomization = (JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class); - isProvider = (jaxwsGlobalCustomization != null)?jaxwsGlobalCustomization.isProvider():null; - if(isProvider != null) - return isProvider; - return false; - } - - protected SOAPBody getSOAPRequestBody() { - SOAPBody requestBody = - (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getInput(), - SOAPBody.class); - if (requestBody == null) { - // the WSDL document is invalid - error(info.bindingOperation.getInput(), ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(info.bindingOperation.getName())); - } - return requestBody; - } - - protected boolean isRequestMimeMultipart() { - for (TWSDLExtension extension: info.bindingOperation.getInput().extensions()) { - if (extension.getClass().equals(MIMEMultipartRelated.class)) { - return true; - } - } - return false; - } - - protected boolean isResponseMimeMultipart() { - for (TWSDLExtension extension: info.bindingOperation.getOutput().extensions()) { - if (extension.getClass().equals(MIMEMultipartRelated.class)) { - return true; - } - } - return false; - } - - - - - protected SOAPBody getSOAPResponseBody() { - SOAPBody responseBody = - (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getOutput(), - SOAPBody.class); - if (responseBody == null) { - // the WSDL document is invalid - error(info.bindingOperation.getOutput(), ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(info.bindingOperation.getName())); - } - return responseBody; - } - - protected com.sun.tools.internal.ws.wsdl.document.Message getOutputMessage() { - if (info.portTypeOperation.getOutput() == null) - return null; - return info.portTypeOperation.getOutput().resolveMessage(info.document); - } - - protected com.sun.tools.internal.ws.wsdl.document.Message getInputMessage() { - return info.portTypeOperation.getInput().resolveMessage(info.document); - } - - /** - * @param body request or response body, represents soap:body - * @param message Input or output message, equivalent to wsdl:message - * @return iterator over MessagePart - */ - protected List getMessageParts( - SOAPBody body, - com.sun.tools.internal.ws.wsdl.document.Message message, boolean isInput) { - String bodyParts = body.getParts(); - ArrayList partsList = new ArrayList(); - List parts = new ArrayList(); - - //get Mime parts - List mimeParts; - if(isInput) - mimeParts = getMimeContentParts(message, info.bindingOperation.getInput()); - else - mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput()); - - if (bodyParts != null) { - StringTokenizer in = new StringTokenizer(bodyParts.trim(), " "); - while (in.hasMoreTokens()) { - String part = in.nextToken(); - MessagePart mPart = message.getPart(part); - if (null == mPart) { - error(message, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName())); - } - mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); - partsList.add(mPart); - } - } else { - for (MessagePart mPart : message.getParts()) { - if (!mimeParts.contains(mPart)) - mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); - partsList.add(mPart); - } - } - - for (MessagePart mPart : message.getParts()) { - if(mimeParts.contains(mPart)) { - mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING); - parts.add(mPart); - }else if(partsList.contains(mPart)) { - mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING); - parts.add(mPart); - } - } - - return parts; - } - - /** - * @param message - * @return MessageParts referenced by the mime:content - */ - protected List getMimeContentParts(Message message, TWSDLExtensible ext) { - ArrayList mimeContentParts = new ArrayList(); - - for (MIMEPart mimePart : getMimeParts(ext)) { - MessagePart part = getMimeContentPart(message, mimePart); - if (part != null) - mimeContentParts.add(part); - } - return mimeContentParts; - } - - /** - * @param mimeParts - */ - protected boolean validateMimeParts(Iterable mimeParts) { - boolean gotRootPart = false; - List mimeContents = new ArrayList(); - for (MIMEPart mPart : mimeParts) { - for (TWSDLExtension obj : mPart.extensions()) { - if (obj instanceof SOAPBody) { - if (gotRootPart) { - warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart())); - return false; - } - gotRootPart = true; - } else if (obj instanceof MIMEContent) { - mimeContents.add((MIMEContent) obj); - } - } - if(!validateMimeContentPartNames(mimeContents)) - return false; - if(mPart.getName() != null) { - warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName())); - } - } - return true; - - } - - private MessagePart getMimeContentPart(Message message, MIMEPart part) { - for( MIMEContent mimeContent : getMimeContents(part) ) { - String mimeContentPartName = mimeContent.getPart(); - MessagePart mPart = message.getPart(mimeContentPartName); - //RXXXX mime:content MUST have part attribute - if(null == mPart) { - error(mimeContent, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(mimeContentPartName, message.getName())); - } - mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING); - return mPart; - } - return null; - } - - //List of mimeTypes - protected List getAlternateMimeTypes(List mimeContents) { - List mimeTypes = new ArrayList(); - //validateMimeContentPartNames(mimeContents.iterator()); -// String mimeType = null; - for(MIMEContent mimeContent:mimeContents){ - String mimeType = getMimeContentType(mimeContent); - if(!mimeTypes.contains(mimeType)) - mimeTypes.add(mimeType); - } - return mimeTypes; - } - - private boolean validateMimeContentPartNames(List mimeContents) { - //validate mime:content(s) in the mime:part as per R2909 - for (MIMEContent mimeContent : mimeContents) { - String mimeContnetPart; - mimeContnetPart = getMimeContentPartName(mimeContent); - if(mimeContnetPart == null) { - warning(mimeContent, ModelerMessages.MIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(info.operation.getName().getLocalPart())); - return false; - } - } - return true; - } - - protected Iterable getMimeParts(TWSDLExtensible ext) { - MIMEMultipartRelated multiPartRelated = - (MIMEMultipartRelated) getAnyExtensionOfType(ext, - MIMEMultipartRelated.class); - if(multiPartRelated == null) { - return Collections.emptyList(); - } - return multiPartRelated.getParts(); - } - - //returns MIMEContents - protected List getMimeContents(MIMEPart part) { - List mimeContents = new ArrayList(); - for (TWSDLExtension mimeContent : part.extensions()) { - if (mimeContent instanceof MIMEContent) { - mimeContents.add((MIMEContent) mimeContent); - } - } - //validateMimeContentPartNames(mimeContents.iterator()); - return mimeContents; - } - - private String getMimeContentPartName(MIMEContent mimeContent){ - /*String partName = mimeContent.getPart(); - if(partName == null){ - throw new ModelerException("mimemodeler.invalidMimeContent.missingPartAttribute", - new Object[] {info.operation.getName().getLocalPart()}); - } - return partName;*/ - return mimeContent.getPart(); - } - - private String getMimeContentType(MIMEContent mimeContent){ - String mimeType = mimeContent.getType(); - if(mimeType == null){ - error(mimeContent, ModelerMessages.MIMEMODELER_INVALID_MIME_CONTENT_MISSING_TYPE_ATTRIBUTE(info.operation.getName().getLocalPart())); - } - return mimeType; - } - - /** - * For Document/Lit the wsdl:part should only have element attribute and - * for RPC/Lit or RPC/Encoded the wsdl:part should only have type attribute - * inside wsdl:message. - */ - protected boolean isStyleAndPartMatch( - SOAPOperation soapOperation, - MessagePart part) { - - // style attribute on soap:operation takes precedence over the - // style attribute on soap:binding - - if ((soapOperation != null) && (soapOperation.getStyle() != null)) { - if ((soapOperation.isDocument() - && (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) - || (soapOperation.isRPC() - && (part.getDescriptorKind() != SchemaKinds.XSD_TYPE))) { - return false; - } - } else { - if ((info.soapBinding.isDocument() - && (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) - || (info.soapBinding.isRPC() - && (part.getDescriptorKind() != SchemaKinds.XSD_TYPE))) { - return false; - } - } - - return true; - } - - - - protected String getRequestNamespaceURI(SOAPBody body) { - String namespaceURI = body.getNamespace(); - if (namespaceURI == null) { - if(options.isExtensionMode()){ - return info.modelPort.getName().getNamespaceURI(); - } - // the WSDL document is invalid - // at least, that's my interpretation of section 3.5 of the WSDL 1.1 spec! - error(body, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_SOAP_BODY_MISSING_NAMESPACE(info.bindingOperation.getName())); - } - return namespaceURI; - } - - protected String getResponseNamespaceURI(SOAPBody body) { - String namespaceURI = body.getNamespace(); - if (namespaceURI == null) { - if(options.isExtensionMode()){ - return info.modelPort.getName().getNamespaceURI(); - } - // the WSDL document is invalid - // at least, that's my interpretation of section 3.5 of the WSDL 1.1 spec! - error(body, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(info.bindingOperation.getName())); - } - return namespaceURI; - } - - /** - * @return List of SOAPHeader extensions - */ - protected List getHeaderExtensions(TWSDLExtensible extensible) { - List headerList = new ArrayList(); - for (TWSDLExtension extension : extensible.extensions()) { - if (extension.getClass()==MIMEMultipartRelated.class) { - for( MIMEPart part : ((MIMEMultipartRelated) extension).getParts() ) { - boolean isRootPart = isRootPart(part); - for (TWSDLExtension obj : part.extensions()) { - if (obj instanceof SOAPHeader) { - //bug fix: 5024015 - if (!isRootPart) { - warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName())); - return new ArrayList(); - } - headerList.add((SOAPHeader) obj); - } - } - } - } else if (extension instanceof SOAPHeader) { - headerList.add((SOAPHeader) extension); - } - } - return headerList; - } - - /** - * @param part - * @return true if part is the Root part - */ - private boolean isRootPart(MIMEPart part) { - for (TWSDLExtension twsdlExtension : part.extensions()) { - if (twsdlExtension instanceof SOAPBody) - return true; - } - return false; - } - - protected Set getDuplicateFaultNames() { - // look for fault messages with the same soap:fault name - Set faultNames = new HashSet(); - Set duplicateNames = new HashSet(); - for( BindingFault bindingFault : info.bindingOperation.faults() ) { - com.sun.tools.internal.ws.wsdl.document.Fault portTypeFault = null; - for (com.sun.tools.internal.ws.wsdl.document.Fault aFault : info.portTypeOperation.faults()) { - if (aFault.getName().equals(bindingFault.getName())) { - if (portTypeFault != null) { - // the WSDL document is invalid - error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(bindingFault.getName(), - info.bindingOperation.getName())); - } else { - portTypeFault = aFault; - } - } - } - if (portTypeFault == null) { - // the WSDL document is invalid - error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NOT_FOUND(bindingFault.getName(), - info.bindingOperation.getName())); - } - SOAPFault soapFault = - (SOAPFault)getExtensionOfType(bindingFault, SOAPFault.class); - if (soapFault == null) { - // the WSDL document is invalid - if(options.isExtensionMode()){ - warning(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(bindingFault.getName(), - info.bindingOperation.getName())); - }else { - error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(bindingFault.getName(), - info.bindingOperation.getName())); - } - } - - com.sun.tools.internal.ws.wsdl.document.Message faultMessage = - portTypeFault.resolveMessage(info.document); - if(faultMessage.getParts().isEmpty()) { - // the WSDL document is invalid - error(faultMessage, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_EMPTY_MESSAGE(bindingFault.getName(), - faultMessage.getName())); - } - // bug fix: 4852729 - if (!options.isExtensionMode() && (soapFault != null && soapFault.getNamespace() != null)) { - warning(soapFault, ModelerMessages.WSDLMODELER_WARNING_R_2716_R_2726("soapbind:fault", soapFault.getName())); - } - String faultNamespaceURI = (soapFault != null && soapFault.getNamespace() != null)?soapFault.getNamespace():portTypeFault.getMessage().getNamespaceURI(); - String faultName = faultMessage.getName(); - QName faultQName = new QName(faultNamespaceURI, faultName); - if (faultNames.contains(faultQName)) { - duplicateNames.add(faultQName); - } else { - faultNames.add(faultQName); - } - } - return duplicateNames; - } - - - /** - * @param operation - * @return true if operation has valid body parts - */ - protected boolean validateBodyParts(BindingOperation operation) { - boolean isRequestResponse = - info.portTypeOperation.getStyle() - == OperationStyle.REQUEST_RESPONSE; - List inputParts = getMessageParts(getSOAPRequestBody(), getInputMessage(), true); - if(!validateStyleAndPart(operation, inputParts)) - return false; - - if(isRequestResponse){ - List outputParts = getMessageParts(getSOAPResponseBody(), getOutputMessage(), false); - if(!validateStyleAndPart(operation, outputParts)) - return false; - } - return true; - } - - /** - * @param operation - * @return true if operation has valid style and part - */ - private boolean validateStyleAndPart(BindingOperation operation, List parts) { - SOAPOperation soapOperation = - (SOAPOperation) getExtensionOfType(operation, SOAPOperation.class); - for (MessagePart part : parts) { - if (part.getBindingExtensibilityElementKind() == MessagePart.SOAP_BODY_BINDING) { - if (!isStyleAndPartMatch(soapOperation, part)) - return false; - } - } - return true; - } - - protected String getLiteralJavaMemberName(Fault fault) { - String javaMemberName; - - QName memberName = fault.getElementName(); - javaMemberName = fault.getJavaMemberName(); - if (javaMemberName == null) - javaMemberName = memberName.getLocalPart(); - return javaMemberName; - } - - /** - * @param ext - * @param message - * @param name - * @return List of MimeContents from ext - */ - protected List getMimeContents(TWSDLExtensible ext, Message message, String name) { - for (MIMEPart mimePart : getMimeParts(ext)) { - List mimeContents = getMimeContents(mimePart); - for (MIMEContent mimeContent : mimeContents) { - if (mimeContent.getPart().equals(name)) - return mimeContents; - } - } - return null; - } - - protected String makePackageQualified(String s) { - if (options.defaultPackage != null - && !options.defaultPackage.equals("")) { - return options.defaultPackage + "." + s; - } else { - return s; - } - } - - - protected String getUniqueName( - com.sun.tools.internal.ws.wsdl.document.Operation operation, - boolean hasOverloadedOperations) { - if (hasOverloadedOperations) { - return operation.getUniqueKey().replace(' ', '_'); - } else { - return operation.getName(); - } - } - - protected static QName getQNameOf(GloballyKnown entity) { - return new QName( - entity.getDefining().getTargetNamespaceURI(), - entity.getName()); - } - - protected static TWSDLExtension getExtensionOfType( - TWSDLExtensible extensible, - Class type) { - for (TWSDLExtension extension:extensible.extensions()) { - if (extension.getClass().equals(type)) { - return extension; - } - } - - return null; - } - - protected TWSDLExtension getAnyExtensionOfType( - TWSDLExtensible extensible, - Class type) { - if(extensible == null) - return null; - for (TWSDLExtension extension:extensible.extensions()) { - if(extension.getClass().equals(type)) { - return extension; - }else if (extension.getClass().equals(MIMEMultipartRelated.class) && - (type.equals(SOAPBody.class) || type.equals(MIMEContent.class) - || type.equals(MIMEPart.class))) { - for (MIMEPart part : ((MIMEMultipartRelated)extension).getParts()) { - //bug fix: 5024001 - TWSDLExtension extn = getExtensionOfType(part, type); - if (extn != null) - return extn; - } - } - } - - return null; - } - - // bug fix: 4857100 - protected static com.sun.tools.internal.ws.wsdl.document.Message findMessage( - QName messageName, - ProcessSOAPOperationInfo info) { - com.sun.tools.internal.ws.wsdl.document.Message message = null; - try { - message = - (com.sun.tools.internal.ws.wsdl.document.Message)info.document.find( - Kinds.MESSAGE, - messageName); - } catch (NoSuchEntityException e) { - } - return message; - } - - protected static boolean tokenListContains( - String tokenList, - String target) { - if (tokenList == null) { - return false; - } - - StringTokenizer tokenizer = new StringTokenizer(tokenList, " "); - while (tokenizer.hasMoreTokens()) { - String s = tokenizer.nextToken(); - if (target.equals(s)) { - return true; - } - } - return false; - } - - protected String getUniqueClassName(String className) { - int cnt = 2; - String uniqueName = className; - while (reqResNames.contains(uniqueName.toLowerCase())) { - uniqueName = className + cnt; - cnt++; - } - reqResNames.add(uniqueName.toLowerCase()); - return uniqueName; - } - - protected boolean isConflictingClassName(String name) { - if (_conflictingClassNames == null) { - return false; - } - - return _conflictingClassNames.contains(name); - } - - protected boolean isConflictingServiceClassName(String name) { - return isConflictingClassName(name); - } - - protected boolean isConflictingStubClassName(String name) { - return isConflictingClassName(name); - } - - protected boolean isConflictingTieClassName(String name) { - return isConflictingClassName(name); - } - - protected boolean isConflictingPortClassName(String name) { - return isConflictingClassName(name); - } - - protected boolean isConflictingExceptionClassName(String name) { - return isConflictingClassName(name); - } - - int numPasses = 0; - - protected void warning(Entity entity, String message){ - //avoid duplicate warning for the second pass - if(numPasses > 1) - return; - if(entity == null) - errReceiver.warning(null, message); - else - errReceiver.warning(entity.getLocator(), message); - } - - protected void error(Entity entity, String message){ - if(entity == null) - errReceiver.error(null, message); - else - errReceiver.error(entity.getLocator(), message); - throw new AbortException(); - } - - protected static final String OPERATION_HAS_VOID_RETURN_TYPE = - "com.sun.xml.internal.ws.processor.modeler.wsdl.operationHasVoidReturnType"; - protected static final String WSDL_PARAMETER_ORDER = - "com.sun.xml.internal.ws.processor.modeler.wsdl.parameterOrder"; - public static final String WSDL_RESULT_PARAMETER = - "com.sun.xml.internal.ws.processor.modeler.wsdl.resultParameter"; - public static final String MESSAGE_HAS_MIME_MULTIPART_RELATED_BINDING = - "com.sun.xml.internal.ws.processor.modeler.wsdl.mimeMultipartRelatedBinding"; - - - protected ProcessSOAPOperationInfo info; - - private Set _conflictingClassNames; - protected Map _javaExceptions; - protected Map _faultTypeToStructureMap; - protected JavaSimpleTypeCreator _javaTypes; - protected Map _bindingNameToPortMap; - protected boolean useWSIBasicProfile = true; - - private final Set reqResNames = new HashSet(); - - public class ProcessSOAPOperationInfo { - - public ProcessSOAPOperationInfo( - Port modelPort, - com.sun.tools.internal.ws.wsdl.document.Port port, - com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation, - BindingOperation bindingOperation, - SOAPBinding soapBinding, - WSDLDocument document, - boolean hasOverloadedOperations, - Map headers) { - this.modelPort = modelPort; - this.port = port; - this.portTypeOperation = portTypeOperation; - this.bindingOperation = bindingOperation; - this.soapBinding = soapBinding; - this.document = document; - this.hasOverloadedOperations = hasOverloadedOperations; - this.headers = headers; - } - - public Port modelPort; - public com.sun.tools.internal.ws.wsdl.document.Port port; - public com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation; - public BindingOperation bindingOperation; - public SOAPBinding soapBinding; - public WSDLDocument document; - public boolean hasOverloadedOperations; - public Map headers; - - // additional data - public Operation operation; - public String uniqueOperationName; - } - - public static class WSDLExceptionInfo { - public String exceptionType; - public QName wsdlMessage; - public String wsdlMessagePartName; - public HashMap constructorOrder; // mapping of element name to - // constructor order (of type Integer) - } - - - protected WSDLParser parser; - protected WSDLDocument document; - protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/ClassNameCollector.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/ClassNameCollector.java deleted file mode 100644 index 0d7b12b2d37..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/ClassNameCollector.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.util; - -import com.sun.tools.internal.ws.processor.model.*; -import com.sun.tools.internal.ws.processor.model.java.JavaInterface; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBType; -import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeVisitor; -import com.sun.tools.internal.ws.processor.model.jaxb.RpcLitStructure; - -import javax.xml.namespace.QName; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -/** - * This class writes out a Model as an XML document. - * - * @author WS Development Team - */ -public class ClassNameCollector extends ExtendedModelVisitor - implements JAXBTypeVisitor { - - public ClassNameCollector() { - } - - public void process(Model model) { - try { - _allClassNames = new HashSet(); - _exceptions = new HashSet(); - _wsdlBindingNames = new HashSet(); - _conflictingClassNames = new HashSet(); - _seiClassNames = new HashSet(); - _jaxbGeneratedClassNames = new HashSet(); - _exceptionClassNames = new HashSet(); - _portTypeNames = new HashSet(); - visit(model); - } catch (Exception e) { - e.printStackTrace(); - // fail silently - } finally { - _allClassNames = null; - _exceptions = null; - } - } - - public Set getConflictingClassNames() { - return _conflictingClassNames; - } - - protected void postVisit(Model model) throws Exception { - for (Iterator iter = model.getExtraTypes(); iter.hasNext();) { - visitType((AbstractType)iter.next()); - } - } - - protected void preVisit(Service service) throws Exception { - registerClassName( - ((JavaInterface)service.getJavaInterface()).getName()); - // We don't generate Impl classes, commenting it out. - // Otherwise, it would cause naming conflicts - //registerClassName( - // ((JavaInterface)service.getJavaInterface()).getImpl()); - } - - protected void processPort11x(Port port){ - QName wsdlBindingName = (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_BINDING_NAME); - if (!_wsdlBindingNames.contains(wsdlBindingName)) { - - // multiple ports can share a binding without causing a conflict - registerClassName(port.getJavaInterface().getName()); - } - registerClassName((String) port.getProperty( - ModelProperties.PROPERTY_STUB_CLASS_NAME)); - registerClassName((String) port.getProperty( - ModelProperties.PROPERTY_TIE_CLASS_NAME)); - } - - protected void preVisit(Port port) throws Exception { - QName portTypeName = (QName)port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - if(_portTypeNames.contains(portTypeName)) - return; - - //in 2.0, stub/tie class are binding agnostic so they should be per port, that is multiple - // bindings can share the same port - - addSEIClassName(port.getJavaInterface().getName()); - } - - private void addSEIClassName(String s) { - _seiClassNames.add(s); - registerClassName(s); - } - - protected void postVisit(Port port) throws Exception { - QName wsdlBindingName = (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_BINDING_NAME); - if (!_wsdlBindingNames.contains(wsdlBindingName)) { - _wsdlBindingNames.add(wsdlBindingName); - } - - QName portTypeName = (QName)port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - if(!_portTypeNames.contains(portTypeName)){ - _portTypeNames.add(portTypeName); - } - } - - protected boolean shouldVisit(Port port) { - QName wsdlBindingName = (QName) port.getProperty( - ModelProperties.PROPERTY_WSDL_BINDING_NAME); - return !_wsdlBindingNames.contains(wsdlBindingName); - } - - protected void preVisit(Fault fault) throws Exception { - if (!_exceptions.contains(fault.getJavaException())) { - - /* the same exception can be used in several faults, but that - * doesn't mean that there is a conflict - */ - _exceptions.add(fault.getJavaException()); - addExceptionClassName(fault.getJavaException().getName()); - - if (fault.getParentFault() != null) { - preVisit(fault.getParentFault()); - } - for (Iterator iter = fault.getSubfaults(); - iter != null && iter.hasNext();) { - - Fault subfault = (Fault) iter.next(); - preVisit(subfault); - } - } - } - - private void addExceptionClassName(String name) { - if(_allClassNames.contains(name)) - _exceptionClassNames.add(name); - registerClassName(name); - //To change body of created methods use File | Settings | File Templates. - } - - protected void visitBodyBlock(Block block) throws Exception { - visitBlock(block); - } - - protected void visitHeaderBlock(Block block) throws Exception { - visitBlock(block); - } - - protected void visitFaultBlock(Block block) throws Exception { - } - - protected void visitBlock(Block block) throws Exception { - visitType(block.getType()); - } - - protected void visit(Parameter parameter) throws Exception { - visitType(parameter.getType()); - } - - private void visitType(AbstractType type) throws Exception { - if (type != null) { - if (type instanceof JAXBType) - visitType((JAXBType)type); - else if (type instanceof RpcLitStructure) - visitType((RpcLitStructure)type); - } - } - - - private void visitType(JAXBType type) throws Exception { - type.accept(this); - } - - private void visitType(RpcLitStructure type) throws Exception { - type.accept(this); - } - private void registerClassName(String name) { - if (name == null || name.equals("")) { - return; - } - if (_allClassNames.contains(name)) { - _conflictingClassNames.add(name); - } else { - _allClassNames.add(name); - } - } - - public Set getSeiClassNames() { - return _seiClassNames; - } - - private Set _seiClassNames; - - public Set getJaxbGeneratedClassNames() { - return _jaxbGeneratedClassNames; - } - - private Set _jaxbGeneratedClassNames; - - - public Set getExceptionClassNames() { - return _exceptionClassNames; - } - - private Set _exceptionClassNames; - boolean doneVisitingJAXBModel = false; - public void visit(JAXBType type) throws Exception { - if(!doneVisitingJAXBModel && type.getJaxbModel() != null){ - Set classNames = type.getJaxbModel().getGeneratedClassNames(); - for(String className : classNames){ - addJAXBGeneratedClassName(className); - } - doneVisitingJAXBModel = true; - } - } - - public void visit(RpcLitStructure type) throws Exception { - if(!doneVisitingJAXBModel){ - Set classNames = type.getJaxbModel().getGeneratedClassNames(); - for(String className : classNames){ - addJAXBGeneratedClassName(className); - } - doneVisitingJAXBModel = true; - } - } - - - private void addJAXBGeneratedClassName(String name) { - _jaxbGeneratedClassNames.add(name); - registerClassName(name); - } - - private Set _allClassNames; - private Set _exceptions; - private Set _wsdlBindingNames; - private Set _conflictingClassNames; - private Set _portTypeNames; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/DirectoryUtil.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/DirectoryUtil.java deleted file mode 100644 index 4d5f21c5f5c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/DirectoryUtil.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.util; - -import com.sun.tools.internal.ws.processor.generator.GeneratorException; -import com.sun.tools.internal.ws.util.ClassNameInfo; - -import java.io.File; - -/** - * Util provides static utility methods used by other wscompile classes. - * - * @author WS Development Team - */ -public class DirectoryUtil { - - public static File getOutputDirectoryFor(String theClass, File rootDir) throws GeneratorException { - - File outputDir = null; - String qualifiedClassName = theClass; - String packagePath = null; - String packageName = ClassNameInfo.getQualifier(qualifiedClassName); - if (packageName != null && packageName.length() > 0) { - packagePath = packageName.replace('.', File.separatorChar); - } - - // Do we have a root directory? - if (rootDir != null) { - - // Yes, do we have a package name? - if (packagePath != null) { - - // Yes, so use it as the root. Open the directory... - outputDir = new File(rootDir, packagePath); - - // Make sure the directory exists... - ensureDirectory(outputDir); - } else { - - // Default package, so use root as output dir... - outputDir = rootDir; - } - } else { - - // No root directory. Get the current working directory... - String workingDirPath = System.getProperty("user.dir"); - File workingDir = new File(workingDirPath); - - // Do we have a package name? - if (packagePath == null) { - - // No, so use working directory... - outputDir = workingDir; - } else { - - // Yes, so use working directory as the root... - outputDir = new File(workingDir, packagePath); - - // Make sure the directory exists... - ensureDirectory(outputDir); - } - } - - // Finally, return the directory... - return outputDir; - } - - private static void ensureDirectory(File dir) - throws GeneratorException { - - if (!dir.exists()) { - dir.mkdirs(); - if (!dir.exists()) { - throw new GeneratorException("generator.cannot.create.dir", - dir.getAbsolutePath()); - } - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/IndentingWriter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/IndentingWriter.java deleted file mode 100644 index 4acc46907ae..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/processor/util/IndentingWriter.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.processor.util; - -import com.sun.tools.internal.ws.processor.generator.GeneratorException; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; -import java.text.MessageFormat; - -/** - * - * @author WS Development Team - */ -public class IndentingWriter extends BufferedWriter { - - private boolean beginningOfLine = true; - private int currentIndent = 0; - private int indentStep = 4; - - public IndentingWriter(Writer out) { - super(out); - } - - public IndentingWriter(Writer out,int step) { - this(out); - - if (indentStep < 0) { - throw new IllegalArgumentException("negative indent step"); - } - indentStep = step; - } - - public void write(int c) throws IOException { - checkWrite(); - super.write(c); - } - - public void write(char[] cbuf, int off, int len) throws IOException { - if (len > 0) { - checkWrite(); - } - super.write(cbuf, off, len); - } - - public void write(String s, int off, int len) throws IOException { - if (len > 0) { - checkWrite(); - } - super.write(s, off, len); - } - - public void newLine() throws IOException { - super.newLine(); - beginningOfLine = true; - } - - protected void checkWrite() throws IOException { - if (beginningOfLine) { - beginningOfLine = false; - int i = currentIndent; - while (i > 0) { - super.write(' '); - -- i; - } - } - } - - protected void indentIn() { - currentIndent += indentStep; - } - - protected void indentOut() { - currentIndent -= indentStep; - if (currentIndent < 0) { - currentIndent = 0; - } - } - - public void pI() { - indentIn(); - } - - public void pO() { - indentOut(); - } - - public void pI(int levels) { - for (int i = 0; i < levels; ++i) { - indentIn(); - } - } - - public void pO(int levels) { - for (int i = 0; i < levels; ++i) { - indentOut(); - } - } - - public void p(String s) throws IOException { - /* - int tabCount = 0; - for (int i = 0; i < s.length(); ++i) { - if (s.charAt(i) == '\t') { - ++tabCount; - indentIn(); - } - } - - String printStr = s.substring(tabCount); - */ - boolean canEncode = true; - - //bug fix: 4839636 - try{ - if(!canEncode(s)) { - canEncode = false; - } - } catch (Throwable t) { - - // there was some exception, what should we do? - // lets ignore it for now and proceed with the code generation! - } - - if(!canEncode) { - throw new GeneratorException( - "generator.indentingwriter.charset.cantencode", s); - } - write(s); -/* - while (tabCount-- > 0) { - indentOut(); - } - */ - } - - /** - * Check if encode can handle the chars in this string. - * - */ - protected boolean canEncode(String s) { - final CharsetEncoder encoder = - Charset.forName(System.getProperty("file.encoding")).newEncoder(); - char[] chars = s.toCharArray(); - for (int i=0; ifalse wsdl customization. - * - */ - public static String MODEL_PARAMETER_NOTUNIQUE_WRAPPER(Object arg0, Object arg1) { - return localizer.localize(localizableMODEL_PARAMETER_NOTUNIQUE_WRAPPER(arg0, arg1)); - } - - public static Localizable localizableMODEL_SCHEMA_NOT_IMPLEMENTED(Object arg0) { - return messageFactory.getMessage("model.schema.notImplemented", arg0); - } - - /** - * unsupported XML Schema feature ({0}) - * - */ - public static String MODEL_SCHEMA_NOT_IMPLEMENTED(Object arg0) { - return localizer.localize(localizableMODEL_SCHEMA_NOT_IMPLEMENTED(arg0)); - } - - public static Localizable localizableMODEL_SCHEMA_INVALID_LITERAL_IN_ENUMERATION_ANONYMOUS(Object arg0) { - return messageFactory.getMessage("model.schema.invalidLiteralInEnumeration.anonymous", arg0); - } - - /** - * invalid literal "{0}" in anonymous enumeration - * - */ - public static String MODEL_SCHEMA_INVALID_LITERAL_IN_ENUMERATION_ANONYMOUS(Object arg0) { - return localizer.localize(localizableMODEL_SCHEMA_INVALID_LITERAL_IN_ENUMERATION_ANONYMOUS(arg0)); - } - - public static Localizable localizableMODEL_ARRAYWRAPPER_NO_CONTENT_MEMBER() { - return messageFactory.getMessage("model.arraywrapper.no.content.member"); - } - - /** - * LiteralArrayWrapper cannot have a content member - * - */ - public static String MODEL_ARRAYWRAPPER_NO_CONTENT_MEMBER() { - return localizer.localize(localizableMODEL_ARRAYWRAPPER_NO_CONTENT_MEMBER()); - } - - public static Localizable localizableMODEL_PART_NOT_UNIQUE(Object arg0, Object arg1) { - return messageFactory.getMessage("model.part.notUnique", arg0, arg1); - } - - /** - * parts in wsdl:message "{0}", reference "{1}", they must reference unique global elements. - * - */ - public static String MODEL_PART_NOT_UNIQUE(Object arg0, Object arg1) { - return localizer.localize(localizableMODEL_PART_NOT_UNIQUE(arg0, arg1)); - } - - public static Localizable localizableMODEL_PARENT_FAULT_ALREADY_SET(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("model.parent.fault.already.set", arg0, arg1, arg2); - } - - /** - * parent of fault "{0}" already set to "{1}", new value = "{2}" - * - */ - public static String MODEL_PARENT_FAULT_ALREADY_SET(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableMODEL_PARENT_FAULT_ALREADY_SET(arg0, arg1, arg2)); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/ModelerMessages.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/ModelerMessages.java deleted file mode 100644 index f5160b16359..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/ModelerMessages.java +++ /dev/null @@ -1,1614 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.resources; - -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory; -import com.sun.xml.internal.ws.util.localization.Localizer; - - -/** - * Defines string formatting method for each constant in the resource file - * - */ -public final class ModelerMessages { - - private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("com.sun.tools.internal.ws.resources.modeler"); - private final static Localizer localizer = new Localizer(); - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_INVALID_SCHEMA_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.invalidSchemaType", arg0, arg1); - } - - /** - * Ignoring the mime:part. mime part: {0} can not be mapped to schema type: {1} - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_INVALID_SCHEMA_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_INVALID_SCHEMA_TYPE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_PARAMETERORDER_PARAMETER(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.parameterorder.parameter", arg0, arg1); - } - - /** - * "{0}" specified in the parameterOrder attribute of operation "{1}" is not a valid part of the message. - * - */ - public static String WSDLMODELER_INVALID_PARAMETERORDER_PARAMETER(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_PARAMETERORDER_PARAMETER(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_NO_SOAP_FAULT_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.noSoapFaultName", arg0, arg1); - } - - /** - * soap:fault name not specified, wsdl:fault "{0}" in operation "{1}" - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_NO_SOAP_FAULT_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_NO_SOAP_FAULT_NAME(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NONCONFORMING_WSDL_IMPORT() { - return messageFactory.getMessage("wsdlmodeler.warning.nonconforming.wsdl.import"); - } - - /** - * Non conforming WS-I WSDL used for wsdl:import - * - */ - public static String WSDLMODELER_WARNING_NONCONFORMING_WSDL_IMPORT() { - return localizer.localize(localizableWSDLMODELER_WARNING_NONCONFORMING_WSDL_IMPORT()); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.outputSoapBody.missingNamespace", arg0); - } - - /** - * output message of binding operation "{0}" must specify a value for the "namespace" attribute - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_FAULT_NOT_LITERAL(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.fault.notLiteral", arg0, arg1); - } - - /** - * ignoring encoded fault "{0}" in literal binding operation "{1}" - * - */ - public static String WSDLMODELER_INVALID_OPERATION_FAULT_NOT_LITERAL(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_FAULT_NOT_LITERAL(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.inputMissingSoapBody", arg0); - } - - /** - * input message of binding operation "{0}" does not have a SOAP body extension - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_SOAP_BINDING_NON_HTTP_TRANSPORT(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringSOAPBinding.nonHTTPTransport", arg0); - } - - /** - * ignoring SOAP port "{0}": unrecognized transport. try running wsimport with -extension switch. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_SOAP_BINDING_NON_HTTP_TRANSPORT(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_SOAP_BINDING_NON_HTTP_TRANSPORT(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.notFound", arg0, arg1); - } - - /** - * in binding "{1}", operation "{0}" does not match any operation in the corresponding port type - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_UNSUPPORTED_BINDING_MIME() { - return messageFactory.getMessage("wsdlmodeler.unsupportedBinding.mime"); - } - - /** - * WSDL MIME binding is not currently supported! - * - */ - public static String WSDLMODELER_UNSUPPORTED_BINDING_MIME() { - return localizer.localize(localizableWSDLMODELER_UNSUPPORTED_BINDING_MIME()); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NO_ELEMENT_ATTRIBUTE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeaderFault.noElementAttribute", arg0, arg1, arg2); - } - - /** - * ignoring header fault part="{0}" message="{1}" of operation {2} - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NO_ELEMENT_ATTRIBUTE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NO_ELEMENT_ATTRIBUTE(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.nonWrapperStyle", arg0, arg1, arg2); - } - - /** - * Invalid operation "{0}", can''t generate java method. Parameter: part "{2}" in wsdl:message "{1}", is a java keyword. Use customization to change the parameter name or change the wsdl:part name. - * - */ - public static String WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_INVALID_HEADERFAULT_NOT_LITERAL(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.headerfault.notLiteral", arg0, arg1); - } - - /** - * Invalid headerfault "{0}" of binding operation "{1}": not literal - * - */ - public static String WSDLMODELER_INVALID_HEADERFAULT_NOT_LITERAL(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_HEADERFAULT_NOT_LITERAL(arg0, arg1)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_DIFFERENT_PART() { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.differentPart"); - } - - /** - * Ignoring the mime:part. Invalid mime:part, the mime:content has different part attribute. - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_DIFFERENT_PART() { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_DIFFERENT_PART()); - } - - public static Localizable localizableWSDLMODELER_ERROR_PART_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.error.partNotFound", arg0, arg1); - } - - /** - * part "{1}" of operation "{0}" could not be resolved! - * - */ - public static String WSDLMODELER_ERROR_PART_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_ERROR_PART_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.header.message.partMustHaveElementDescriptor", arg0, arg1); - } - - /** - * Invalid header "{0}" in operation {1}: part must specify a "element" attribute - * - */ - public static String WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.operationName", arg0); - } - - /** - * Invalid operation "{0}", it''s java reserved word, can''t generate java method. Use customization to change the operation name. - * - */ - public static String WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.outputMissingSoapFault", arg0, arg1); - } - - /** - * fault "{0}" in operation "{1}" does not have a SOAP fault extension - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_OUTPUT_MISSING_SOAP_FAULT(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_ELEMENT_MESSAGE_PART(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleElementMessagePart", arg0); - } - - /** - * ignoring operation "{0}": message part does not refer to a schema type declaration - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_ELEMENT_MESSAGE_PART(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_ELEMENT_MESSAGE_PART(arg0)); - } - - public static Localizable localizableWSDLMODLER_WARNING_OPERATION_USE() { - return messageFactory.getMessage("wsdlmodler.warning.operation.use"); - } - - /** - * The WSDL used has operations with literal and encoded use. -f:searchschema is not supported for this scenario. - * - */ - public static String WSDLMODLER_WARNING_OPERATION_USE() { - return localizer.localize(localizableWSDLMODLER_WARNING_OPERATION_USE()); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringNonSOAPPort", arg0); - } - - /** - * ignoring port "{0}": not a standard SOAP port. try running wsimport with -extension switch. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_MESSAGE_HAS_MORE_THAN_ONE_PART(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.messageHasMoreThanOnePart", arg0, arg1); - } - - /** - * fault "{0}" refers to message "{1}", but the message has more than one parts - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_MESSAGE_HAS_MORE_THAN_ONE_PART(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_MESSAGE_HAS_MORE_THAN_ONE_PART(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NO_SERVICE_DEFINITIONS_FOUND() { - return messageFactory.getMessage("wsdlmodeler.warning.noServiceDefinitionsFound"); - } - - /** - * WSDL document does not define any services - * - */ - public static String WSDLMODELER_WARNING_NO_SERVICE_DEFINITIONS_FOUND() { - return localizer.localize(localizableWSDLMODELER_WARNING_NO_SERVICE_DEFINITIONS_FOUND()); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_FAULT_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringFault.cant.resolve.message", arg0, arg1); - } - - /** - * ignoring fault "{0}" of binding operation "{1}": cannot resolve message - * - */ - public static String WSDLMODELER_WARNING_IGNORING_FAULT_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_FAULT_CANT_RESOLVE_MESSAGE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_JAXB_JAVATYPE_NOTFOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.jaxb.javatype.notfound", arg0, arg1); - } - - /** - * Schema descriptor {0} in message part "{1}" is not defined and could not be bound to Java. Perhaps the schema descriptor {0} is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch. - * - */ - public static String WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_JAXB_JAVATYPE_NOTFOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_PORT_SOAP_BINDING_MIXED_STYLE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.port.SOAPBinding.mixedStyle", arg0); - } - - /** - * not a WS-I BP1.1 compliant SOAP port "{0}": the wsdl binding has mixed style, it must be rpc-literal or document-literal operation! - * - */ - public static String WSDLMODELER_WARNING_PORT_SOAP_BINDING_MIXED_STYLE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_PORT_SOAP_BINDING_MIXED_STYLE(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_DOCLITOPERATION(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.doclitoperation", arg0); - } - - /** - * Invalid wsdl:operation "{0}": its a document-literal operation, message part must refer to a schema element declaration - * - */ - public static String WSDLMODELER_INVALID_DOCLITOPERATION(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_DOCLITOPERATION(arg0)); - } - - public static Localizable localizableMODELER_NESTED_MODEL_ERROR(Object arg0) { - return messageFactory.getMessage("modeler.nestedModelError", arg0); - } - - /** - * modeler error: {0} - * - */ - public static String MODELER_NESTED_MODEL_ERROR(Object arg0) { - return localizer.localize(localizableMODELER_NESTED_MODEL_ERROR(arg0)); - } - - public static Localizable localizableWSDLMODELER_DUPLICATE_FAULT_SOAP_NAME(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.duplicate.fault.soap.name", arg0, arg1, arg2); - } - - /** - * ignoring fault "{0}" of operation "{1}", soap:fault name "{2}" is not unique - * - */ - public static String WSDLMODELER_DUPLICATE_FAULT_SOAP_NAME(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_DUPLICATE_FAULT_SOAP_NAME(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_WRONG_SOAP_FAULT_NAME(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.wrongSoapFaultName", arg0, arg1, arg2); - } - - /** - * name of soap:fault "{0}" doesn''t match the name of wsdl:fault "{1}" in operation "{2}" - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_WRONG_SOAP_FAULT_NAME(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_WRONG_SOAP_FAULT_NAME(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_LITERAL(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.notLiteral", arg0); - } - - /** - * ignoring document-style operation "{0}": parameters are not literal - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_LITERAL(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_LITERAL(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_DOCUMENT_STYLE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleDocumentStyle", arg0); - } - - /** - * ignoring operation "{0}": cannot handle document-style operations - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_DOCUMENT_STYLE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_DOCUMENT_STYLE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_FAULT_NOT_LITERAL(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringFault.notLiteral", arg0, arg1); - } - - /** - * ignoring encoded fault "{0}" of binding operation "{1}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_FAULT_NOT_LITERAL(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_FAULT_NOT_LITERAL(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_RPCLITOPERATION(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.rpclitoperation", arg0); - } - - /** - * Invalid wsdl:operation "{0}": its a rpc-literal operation, message part must refer to a schema type declaration - * - */ - public static String WSDLMODELER_INVALID_RPCLITOPERATION(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_RPCLITOPERATION(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customName", arg0, arg1); - } - - /** - * Invalid operation "{0}", can''t generate java method. Parameter,customized name "{1}" is a java keyword. - * - */ - public static String WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_BINDING_OPERATION_MULTIPLE_PART_BINDING(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.bindingOperation.multiplePartBinding", arg0, arg1); - } - - /** - * Check the abstract operation "{0}" binding, part "{1}" has multiple binding. Will try to generated artiffacts anyway... - * - */ - public static String WSDLMODELER_WARNING_BINDING_OPERATION_MULTIPLE_PART_BINDING(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_BINDING_OPERATION_MULTIPLE_PART_BINDING(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_PORT_SOAP_BINDING_12(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.port.SOAPBinding12", arg0); - } - - /** - * SOAP port "{0}": uses a non-standard SOAP 1.2 binding. - * - */ - public static String WSDLMODELER_WARNING_PORT_SOAP_BINDING_12(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_PORT_SOAP_BINDING_12(arg0)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(Object arg0) { - return messageFactory.getMessage("mimemodeler.invalidMimePart.nameNotAllowed", arg0); - } - - /** - * name attribute on wsdl:part in Operation "{0}" is ignored. Its not allowed as per WS-I AP 1.0. - * - */ - public static String MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(Object arg0) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_MIME_PART_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringMimePart.notFound", arg0, arg1); - } - - /** - * ignoring mime:part, cannot find part "{0}" referenced by the mime:content in the wsdl:operation "{1}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_MIME_PART_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_MIME_PART_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.operation.MoreThanOnePartInMessage", arg0); - } - - /** - * Ingoring operation "{0}": more than one part bound to body - * - */ - public static String WSDLMODELER_WARNING_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.nonWrapperStyle", arg0, arg1, arg2); - } - - /** - * Ignoring operation "{0}", can''t generate java method. Parameter: part "{2}" in wsdl:message "{1}", is a java keyword. Use customization to change the parameter name or change the wsdl:part name. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_INVALID_FAULT_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.fault.cant.resolve.message", arg0, arg1); - } - - /** - * fault message "{0}" in binding operation "{1}" could not be resolved - * - */ - public static String WSDLMODELER_INVALID_FAULT_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_FAULT_CANT_RESOLVE_MESSAGE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_EMPTY_MESSAGE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.emptyMessage", arg0, arg1); - } - - /** - * fault "{0}" refers to message "{1}", but the message has no parts - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_EMPTY_MESSAGE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_EMPTY_MESSAGE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.rpclit.unkownschematype", arg0, arg1, arg2); - } - - /** - * XML type "{0}" could not be resolved, XML to JAVA binding failed! Please check the wsdl:part "{1}" in the wsdl:message "{2}". - * - */ - public static String WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_HEADERFAULT_PART_NOT_FOUND(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.headerfault.part.notFound", arg0, arg1, arg2); - } - - /** - * part "{1}" not found for the header fault "{0}", in binding "{2}" - * - */ - public static String WSDLMODELER_HEADERFAULT_PART_NOT_FOUND(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_HEADERFAULT_PART_NOT_FOUND(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_BODY_PARTS_ATTRIBUTE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleBodyPartsAttribute", arg0); - } - - /** - * ignoring operation "{0}": cannot handle "parts" attribute of "soap:body" element - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_BODY_PARTS_ATTRIBUTE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_BODY_PARTS_ATTRIBUTE(arg0)); - } - - public static Localizable localizableWSDLMODELER_NON_UNIQUE_BODY_ERROR(Object arg0, Object arg1, Object arg2, Object arg3) { - return messageFactory.getMessage("wsdlmodeler.nonUnique.body.error", arg0, arg1, arg2, arg3); - } - - /** - * Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signaure on the wire for successful dispatch. In port {0}, Operations "{1}" and "{2}" have the same request body block {3}. Try running wsimport with -extension switch, runtime will try to dispatch using SOAPAction - * - */ - public static String WSDLMODELER_NON_UNIQUE_BODY_ERROR(Object arg0, Object arg1, Object arg2, Object arg3) { - return localizer.localize(localizableWSDLMODELER_NON_UNIQUE_BODY_ERROR(arg0, arg1, arg2, arg3)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_SOAP_BINDING_MIXED_STYLE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringSOAPBinding.mixedStyle", arg0); - } - - /** - * ignoring port "{0}", its not WS-I BP 1.1 compliant: the wsdl binding has mixed style, it must be rpc-literal or document-literal operation. try running wsimport with -extension switch. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_SOAP_BINDING_MIXED_STYLE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_SOAP_BINDING_MIXED_STYLE(arg0)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_MISSING_TYPE_ATTRIBUTE(Object arg0) { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.missingTypeAttribute", arg0); - } - - /** - * Missing type attribute in mime:content in operation "{0}". part attribute must be present in mime:content declaration. - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_MISSING_TYPE_ATTRIBUTE(Object arg0) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_MISSING_TYPE_ATTRIBUTE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_EMPTY_INPUT_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleEmptyInputMessage", arg0); - } - - /** - * ignoring operation "{0}": input message is empty - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_EMPTY_INPUT_MESSAGE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_EMPTY_INPUT_MESSAGE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NO_PORTS_IN_SERVICE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.noPortsInService", arg0); - } - - /** - * Service "{0}" does not contain any usable ports. try running wsimport with -extension switch. - * - */ - public static String WSDLMODELER_WARNING_NO_PORTS_IN_SERVICE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_NO_PORTS_IN_SERVICE(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_PARAMETER_ORDER_TOO_MANY_UNMENTIONED_PARTS(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.parameterOrder.tooManyUnmentionedParts", arg0); - } - - /** - * more than one part left out in the parameterOrder attribute of operation "{0}" - * - */ - public static String WSDLMODELER_INVALID_PARAMETER_ORDER_TOO_MANY_UNMENTIONED_PARTS(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_PARAMETER_ORDER_TOO_MANY_UNMENTIONED_PARTS(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_INPUT_SOAP_BODY_MISSING_NAMESPACE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.inputSoapBody.missingNamespace", arg0); - } - - /** - * input message of binding operation "{0}" must specify a value for the "namespace" attribute - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_SOAP_BODY_MISSING_NAMESPACE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_INPUT_SOAP_BODY_MISSING_NAMESPACE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader", arg0, arg1); - } - - /** - * ignoring header "{0}" of binding operation "{1}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_RESPONSEBEAN_NOTFOUND(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.responsebean.notfound", arg0); - } - - /** - * wsimport failed to generate async response bean for operation: {0} - * - */ - public static String WSDLMODELER_RESPONSEBEAN_NOTFOUND(Object arg0) { - return localizer.localize(localizableWSDLMODELER_RESPONSEBEAN_NOTFOUND(arg0)); - } - - public static Localizable localizableWSDLMODELER_20_RPCENC_NOT_SUPPORTED() { - return messageFactory.getMessage("wsdlmodeler20.rpcenc.not.supported"); - } - - /** - * rpc/encoded wsdl's are not supported in JAXWS 2.0. - * - */ - public static String WSDLMODELER_20_RPCENC_NOT_SUPPORTED() { - return localizer.localize(localizableWSDLMODELER_20_RPCENC_NOT_SUPPORTED()); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_PART_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.partNotFound", arg0, arg1); - } - - /** - * ignoring operation "{0}": part "{1}" not found - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_PART_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_PART_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.message.partMustHaveElementDescriptor", arg0, arg1); - } - - /** - * in message "{0}", part "{1}" must specify a "element" attribute - * - */ - public static String WSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_ERROR_PARTS_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.error.partsNotFound", arg0, arg1); - } - - /** - * parts "{0}" not found in the message "{1}", wrong WSDL - * - */ - public static String WSDLMODELER_ERROR_PARTS_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_ERROR_PARTS_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_FAULT_NOT_ENCODED(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringFault.notEncoded", arg0, arg1); - } - - /** - * ignoring literal fault "{0}" of binding operation "{1}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_FAULT_NOT_ENCODED(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_FAULT_NOT_ENCODED(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_SUPPORTED_STYLE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.notSupportedStyle", arg0); - } - - /** - * ignoring operation "{0}": not request-response or one-way - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_SUPPORTED_STYLE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_SUPPORTED_STYLE(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_TYPE_DESCRIPTOR(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.message.partMustHaveTypeDescriptor", arg0, arg1); - } - - /** - * in message "{0}", part "{1}" must specify a "type" attribute - * - */ - public static String WSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_TYPE_DESCRIPTOR(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_TYPE_DESCRIPTOR(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_MULTIPLE_OUTPUT_PARAMETERS(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.multipleOutputParameters", arg0); - } - - /** - * multiple "out" parameters in operation: {0} - * - */ - public static String WSDLMODELER_MULTIPLE_OUTPUT_PARAMETERS(Object arg0) { - return localizer.localize(localizableWSDLMODELER_MULTIPLE_OUTPUT_PARAMETERS(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_PART_BINDING(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.multiplePartBinding", arg0, arg1); - } - - /** - * abstract operation "{0}" binding, part "{1}" has multiple binding. - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_PART_BINDING(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_PART_BINDING(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID() { - return messageFactory.getMessage("wsdlmodeler.invalid"); - } - - /** - * invalid WSDL document - * - */ - public static String WSDLMODELER_INVALID() { - return localizer.localize(localizableWSDLMODELER_INVALID()); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_MATCHING_OPERATIONS(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.multipleMatchingOperations", arg0, arg1); - } - - /** - * in binding "{1}", operation "{0}" does not reference a unique operation in the corresponding port type - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_MATCHING_OPERATIONS(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_MATCHING_OPERATIONS(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader.cant.resolve.message", arg0, arg1); - } - - /** - * ignoring header "{0}" of binding operation "{1}": cannot resolve message - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_CANT_RESOLVE_MESSAGE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customizedOperationName", arg0, arg1); - } - - /** - * Ignoring operation "{0}", can''t generate java method ,customized name "{1}" of the wsdl:operation is a java keyword. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_NOT_LITERAL(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader.notLiteral", arg0, arg1); - } - - /** - * ignoring header "{0}" of binding operation "{1}": not literal - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_NOT_LITERAL(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_NOT_LITERAL(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_INPUT_HEADER_MISSING_NAMESPACE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.inputHeader.missingNamespace", arg0, arg1); - } - - /** - * input header "{1}" of binding operation "{0}" must specify a value for the "namespace" attribute - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_HEADER_MISSING_NAMESPACE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_INPUT_HEADER_MISSING_NAMESPACE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_MISSING_INPUT_NAME(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.missingInputName", arg0); - } - - /** - * binding operation "{0}" must specify a name for its input message - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_MISSING_INPUT_NAME(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_MISSING_INPUT_NAME(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT_NO_ADDRESS(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringNonSOAPPort.noAddress", arg0); - } - - /** - * ignoring port "{0}": no SOAP address specified. try running wsimport with -extension switch. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT_NO_ADDRESS(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT_NO_ADDRESS(arg0)); - } - - public static Localizable localizableWSDLMODELER_RESULT_IS_IN_OUT_PARAMETER(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.resultIsInOutParameter", arg0); - } - - /** - * result is "inout" parameter in operation: {0} - * - */ - public static String WSDLMODELER_RESULT_IS_IN_OUT_PARAMETER(Object arg0) { - return localizer.localize(localizableWSDLMODELER_RESULT_IS_IN_OUT_PARAMETER(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_HEADER_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.header.notFound", arg0, arg1); - } - - /** - * header "{0}" of binding operation "{1}": not found - * - */ - public static String WSDLMODELER_INVALID_HEADER_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_HEADER_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableMIMEMODELER_ELEMENT_PART_INVALID_ELEMENT_MIME_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("mimemodeler.elementPart.invalidElementMimeType", arg0, arg1); - } - - /** - * The mime:content part refers to wsdl:part "{0}", defined using element attribute. Please make sure the mime type: "{1}" is appropriate to serialize XML. - * - */ - public static String MIMEMODELER_ELEMENT_PART_INVALID_ELEMENT_MIME_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableMIMEMODELER_ELEMENT_PART_INVALID_ELEMENT_MIME_TYPE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_HEADER_NOT_LITERAL(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.header.notLiteral", arg0, arg1); - } - - /** - * Invalid header "{0}" of binding operation "{1}": not literal - * - */ - public static String WSDLMODELER_INVALID_HEADER_NOT_LITERAL(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_HEADER_NOT_LITERAL(arg0, arg1)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_MESAGE_PART_ELEMENT_KIND(Object arg0) { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.mesagePartElementKind", arg0); - } - - /** - * wsdl:part element referenced by mime:content part attribute: {0} must be defined using type attribute! - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_MESAGE_PART_ELEMENT_KIND(Object arg0) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_MESAGE_PART_ELEMENT_KIND(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_ENCODED(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.notEncoded", arg0); - } - - /** - * ignoring RPC-style operation "{0}": parameters are not encoded - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_ENCODED(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_ENCODED(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NONCONFORMING_WSDL_TYPES() { - return messageFactory.getMessage("wsdlmodeler.warning.nonconforming.wsdl.types"); - } - - /** - * Non conforming WS-I WSDL used for wsdl:types - * - */ - public static String WSDLMODELER_WARNING_NONCONFORMING_WSDL_TYPES() { - return localizer.localize(localizableWSDLMODELER_WARNING_NONCONFORMING_WSDL_TYPES()); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_MORE_THAN_ONE_PART_IN_INPUT_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleMoreThanOnePartInInputMessage", arg0); - } - - /** - * ignoring operation "{0}": more than one part in input message - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_MORE_THAN_ONE_PART_IN_INPUT_MESSAGE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_MORE_THAN_ONE_PART_IN_INPUT_MESSAGE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_EMPTY_OUTPUT_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleEmptyOutputMessage", arg0); - } - - /** - * ignoring operation "{0}": output message is empty - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_EMPTY_OUTPUT_MESSAGE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_EMPTY_OUTPUT_MESSAGE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_R_2716_R_2726(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.r2716r2726", arg0, arg1); - } - - /** - * R2716/R2726 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit or rpc/lit for {0}: "{1}" - * - */ - public static String WSDLMODELER_WARNING_R_2716_R_2726(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_R_2716_R_2726(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NO_SOAP_ADDRESS(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.noSOAPAddress", arg0); - } - - /** - * port "{0}" is not a SOAP port, it has no soap:address - * - */ - public static String WSDLMODELER_WARNING_NO_SOAP_ADDRESS(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_NO_SOAP_ADDRESS(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_FAULTS(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringFaults", arg0); - } - - /** - * ignoring faults declared by operation "{0}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_FAULTS(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_FAULTS(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_MISSING_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.missingName", arg0, arg1); - } - - /** - * fault "{0}" in operation "{1}" must specify a value for the "name" attribute - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_MISSING_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_MISSING_NAME(arg0, arg1)); - } - - public static Localizable localizableMIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(Object arg0) { - return messageFactory.getMessage("mimemodeler.warning.IgnoringinvalidHeaderPart.notDeclaredInRootPart", arg0); - } - - /** - * Headers not in root mime:part with soap:body, ignoring headers in operation "{0}" - * - */ - public static String MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(Object arg0) { - return localizer.localize(localizableMIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(arg0)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_ERROR_LOADING_JAVA_CLASS() { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.errorLoadingJavaClass"); - } - - /** - * Couldn't find class "{0}" for mime type "{1}" - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_ERROR_LOADING_JAVA_CLASS() { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_ERROR_LOADING_JAVA_CLASS()); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_NOT_IN_PORT_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.notInPortType", arg0, arg1); - } - - /** - * in binding "{1}", operation "{0}" does not appear in the corresponding port type - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_NOT_IN_PORT_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_NOT_IN_PORT_TYPE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CONFLICT_STYLE_IN_WSI_MODE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.conflictStyleInWSIMode", arg0); - } - - /** - * ignoring operation "{0}": binding style and operation style are conflicting - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CONFLICT_STYLE_IN_WSI_MODE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CONFLICT_STYLE_IN_WSI_MODE(arg0)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(Object arg0) { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.missingPartAttribute", arg0); - } - - /** - * Ignoring operation "{0}", missing part attribute in mime:content. part attribute must be present in mime:content declaration. - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(Object arg0) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_SEARCH_SCHEMA_UNRECOGNIZED_TYPES(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.searchSchema.unrecognizedTypes", arg0); - } - - /** - * encountered {0} unrecognized type(s) - * - */ - public static String WSDLMODELER_WARNING_SEARCH_SCHEMA_UNRECOGNIZED_TYPES(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_SEARCH_SCHEMA_UNRECOGNIZED_TYPES(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customizedOperationName", arg0, arg1); - } - - /** - * Invalid operation "{0}", can''t generate java method ,customized name "{1}" of the wsdl:operation is a java keyword. - * - */ - public static String WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_HEADER_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.header.cant.resolve.message", arg0, arg1); - } - - /** - * header "{0}" of binding operation "{1}": cannot resolve message - * - */ - public static String WSDLMODELER_INVALID_HEADER_CANT_RESOLVE_MESSAGE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_HEADER_CANT_RESOLVE_MESSAGE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_MISSING_NAMESPACE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.missingNamespace", arg0, arg1); - } - - /** - * fault "{0}" in operation "{1}" must specify a value for the "namespace" attribute - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_MISSING_NAMESPACE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_MISSING_NAMESPACE(arg0, arg1)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(Object arg0) { - return messageFactory.getMessage("mimemodeler.invalidMimePart.moreThanOneSOAPBody", arg0); - } - - /** - * Ignoring operation "{0}". The Multipart/Related structure has invalid root part: more than one soap:body parts found - * - */ - public static String MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(Object arg0) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_INCONSISTENT_DEFINITION(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader.inconsistentDefinition", arg0, arg1); - } - - /** - * ignoring header "{0}" of operation "{1}": part not found - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_INCONSISTENT_DEFINITION(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_INCONSISTENT_DEFINITION(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.notFound", arg0, arg1); - } - - /** - * fault "{0}" in operation "{1}" does not match any fault in the corresponding port type operation - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customName", arg0, arg1); - } - - /** - * Ignoring operation "{0}", can''t generate java method. Parameter,customized name "{1}" is a java keyword. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_UNRECOGNIZED_SCHEMA_EXTENSION(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringUnrecognizedSchemaExtension", arg0); - } - - /** - * ignoring schema element (unsupported version): {0} - * - */ - public static String WSDLMODELER_WARNING_IGNORING_UNRECOGNIZED_SCHEMA_EXTENSION(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_UNRECOGNIZED_SCHEMA_EXTENSION(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NOT_FOUND(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeaderFault.notFound", arg0, arg1, arg2); - } - - /** - * ignoring header fault "{0}", cannot find part "{1}" in binding "{2}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NOT_FOUND(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NOT_FOUND(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_NON_UNIQUE_BODY_WARNING(Object arg0, Object arg1, Object arg2, Object arg3) { - return messageFactory.getMessage("wsdlmodeler.nonUnique.body.warning", arg0, arg1, arg2, arg3); - } - - /** - * Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signaure on the wire for successful dispatch. In port {0}, Operations "{1}" and "{2}" have the same request body block {3}. Method dispatching may fail, runtime will try to dispatch using SOAPAction - * - */ - public static String WSDLMODELER_NON_UNIQUE_BODY_WARNING(Object arg0, Object arg1, Object arg2, Object arg3) { - return localizer.localize(localizableWSDLMODELER_NON_UNIQUE_BODY_WARNING(arg0, arg1, arg2, arg3)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.wrapperStyle", arg0, arg1, arg2); - } - - /** - * Invalid operation "{0}", can''t generate java method parameter. Local name of the wrapper child "{1}" in the global element "{2}" is a java keyword. Use customization to change the parameter name. - * - */ - public static String WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(arg0, arg1, arg2)); - } - - public static Localizable localizableMIMEMODELER_INVALID_MIME_CONTENT_UNKNOWN_SCHEMA_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("mimemodeler.invalidMimeContent.unknownSchemaType", arg0, arg1); - } - - /** - * Unknown schema type: {1} for mime:content part: {0} - * - */ - public static String MIMEMODELER_INVALID_MIME_CONTENT_UNKNOWN_SCHEMA_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableMIMEMODELER_INVALID_MIME_CONTENT_UNKNOWN_SCHEMA_TYPE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_R_2716(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.r2716", arg0, arg1); - } - - /** - * R2716 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit for {0}: "{1}" - * - */ - public static String WSDLMODELER_WARNING_R_2716(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_R_2716(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader.notFound", arg0, arg1); - } - - /** - * ignoring header "{0}" of binding operation "{1}": not found - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_TYPE_MESSAGE_PART(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleTypeMessagePart", arg0); - } - - /** - * ignoring operation "{0}": message part does not refer to a schema element declaration - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_TYPE_MESSAGE_PART(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_TYPE_MESSAGE_PART(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_PARAMETER_ORDER_INVALID_PARAMETER_ORDER(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.parameterOrder.invalidParameterOrder", arg0); - } - - /** - * parameterOrder attribute on operation "{0}" is invalid, ignoring parameterOrder hint - * - */ - public static String WSDLMODELER_INVALID_PARAMETER_ORDER_INVALID_PARAMETER_ORDER(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_PARAMETER_ORDER_INVALID_PARAMETER_ORDER(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_MISSING_OUTPUT_NAME(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.missingOutputName", arg0); - } - - /** - * binding operation "{0}" must specify a name for its output message - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_MISSING_OUTPUT_NAME(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_MISSING_OUTPUT_NAME(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalidOperation", arg0); - } - - /** - * invalid operation: {0} - * - */ - public static String WSDLMODELER_INVALID_OPERATION(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_HEADER_MISSING_NAMESPACE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.outputHeader.missingNamespace", arg0, arg1); - } - - /** - * output header "{1}" of binding operation "{0}" must specify a value for the "namespace" attribute - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_HEADER_MISSING_NAMESPACE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_HEADER_MISSING_NAMESPACE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_PART_FROM_BODY(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader.partFromBody", arg0); - } - - /** - * header part: "{0}" already bound by soapbind:body, illegal to bind the part twice - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_PART_FROM_BODY(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_PART_FROM_BODY(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_NOT_SUPPORTED_STYLE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.notSupportedStyle", arg0, arg1); - } - - /** - * Invalid WSDL, wsdl:operation "{0}" in wsdl:portType "{1}": not request-response or one-way - * - */ - public static String WSDLMODELER_INVALID_OPERATION_NOT_SUPPORTED_STYLE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_NOT_SUPPORTED_STYLE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_NC_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.notNCName", arg0, arg1); - } - - /** - * Ignoring operation "{0}", it has illegal character ''{1}'' in its name. Its rpc-literal operation - jaxws won't be able to serialize it! - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_NOT_NC_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_NOT_NC_NAME(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_PARAMETER_DIFFERENT_TYPES(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.parameter.differentTypes", arg0, arg1); - } - - /** - * parameter "{0}" of operation "{1}" appears with different types in the input and output messages - * - */ - public static String WSDLMODELER_INVALID_PARAMETER_DIFFERENT_TYPES(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_PARAMETER_DIFFERENT_TYPES(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_FAULT_DOCUMENT_OPERATION(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringFault.documentOperation", arg0, arg1); - } - - /** - * ignoring fault "{0}" of document-style operation "{1}" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_FAULT_DOCUMENT_OPERATION(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_FAULT_DOCUMENT_OPERATION(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NONCONFORMING_WSDL_USE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.nonconforming.wsdl.use", arg0); - } - - /** - * Processing WS-I non conforming operation "{0}" with RPC-Style and SOAP-encoded - * - */ - public static String WSDLMODELER_WARNING_NONCONFORMING_WSDL_USE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_NONCONFORMING_WSDL_USE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NON_SOAP_PORT(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.nonSOAPPort", arg0); - } - - /** - * port "{0}": not a standard SOAP port. The generated artifacts may not work with JAXWS runtime. - * - */ - public static String WSDLMODELER_WARNING_NON_SOAP_PORT(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_NON_SOAP_PORT(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_HEADERFAULT_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.invalid.headerfault.message.partMustHaveElementDescriptor", arg0, arg1, arg2); - } - - /** - * Invalid headerfault "{0}" for header {1} in operation {2}: part must specify a "element" attribute - * - */ - public static String WSDLMODELER_INVALID_HEADERFAULT_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_INVALID_HEADERFAULT_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_INVALID_STATE_MODELING_OPERATION(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalidState.modelingOperation", arg0); - } - - /** - * invalid state while modeling operation: {0} - * - */ - public static String WSDLMODELER_INVALID_STATE_MODELING_OPERATION(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_STATE_MODELING_OPERATION(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.operationName", arg0); - } - - /** - * Ignoring operation "{0}", it''s java reserved word, can''t generate java method. Use customization to change the operation name. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_NOT_ENCODED(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeader.notEncoded", arg0, arg1); - } - - /** - * ignoring header "{0}" of binding operation "{1}": not SOAP-encoded - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_NOT_ENCODED(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_NOT_ENCODED(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_DUPLICATE_FAULT_PART_NAME(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.duplicate.fault.part.name", arg0, arg1, arg2); - } - - /** - * ignoring fault "{0}" of operation "{1}", part name "{2}" is not unique - * - */ - public static String WSDLMODELER_DUPLICATE_FAULT_PART_NAME(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_DUPLICATE_FAULT_PART_NAME(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_INVALID_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.operation.MoreThanOnePartInMessage", arg0); - } - - /** - * operation "{0}": more than one part bound to body - * - */ - public static String WSDLMODELER_INVALID_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_SOAP_BINDING_12(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringSOAPBinding12", arg0); - } - - /** - * Ignoring SOAP port "{0}": it uses non-standard SOAP 1.2 binding. - * You must specify the "-extension" option to use this binding. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_SOAP_BINDING_12(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_SOAP_BINDING_12(arg0)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingFault.notUnique", arg0, arg1); - } - - /** - * fault "{0}" in operation "{1}" matches more than one fault in the corresponding port type operation - * - */ - public static String WSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(Object arg0, Object arg1) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(arg0, arg1)); - } - - public static Localizable localizableWSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.invalid.bindingOperation.outputMissingSoapBody", arg0); - } - - /** - * output message of binding operation "{0}" does not have a SOAP body extension - * - */ - public static String WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(Object arg0) { - return localizer.localize(localizableWSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NOT_LITERAL(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringHeaderFault.notLiteral", arg0, arg1, arg2); - } - - /** - * ignoring header fault part="{0}" message="{1}" of operation {2}, use attribute MUST be "literal" - * - */ - public static String WSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NOT_LITERAL(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_HEADER_FAULT_NOT_LITERAL(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_MORE_THAN_ONE_PART_IN_OUTPUT_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.cannotHandleMoreThanOnePartInOutputMessage", arg0); - } - - /** - * ignoring operation "{0}": more than one part in output message - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_MORE_THAN_ONE_PART_IN_OUTPUT_MESSAGE(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_MORE_THAN_ONE_PART_IN_OUTPUT_MESSAGE(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_NO_OPERATIONS_IN_PORT(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.warning.noOperationsInPort", arg0); - } - - /** - * Port "{0}" does not contain any usable operations - * - */ - public static String WSDLMODELER_WARNING_NO_OPERATIONS_IN_PORT(Object arg0) { - return localizer.localize(localizableWSDLMODELER_WARNING_NO_OPERATIONS_IN_PORT(arg0)); - } - - public static Localizable localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.wrapperStyle", arg0, arg1, arg2); - } - - /** - * Ignoring operation "{0}", can''t generate java method parameter. Local name of the wrapper child "{1}" in the global element "{2}" is a java keyword. Use customization to change the parameter name. - * - */ - public static String WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(arg0, arg1, arg2)); - } - - public static Localizable localizableWSDLMODELER_UNSOLVABLE_NAMING_CONFLICTS(Object arg0) { - return messageFactory.getMessage("wsdlmodeler.unsolvableNamingConflicts", arg0); - } - - /** - * the following naming conflicts occurred: {0} - * - */ - public static String WSDLMODELER_UNSOLVABLE_NAMING_CONFLICTS(Object arg0) { - return localizer.localize(localizableWSDLMODELER_UNSOLVABLE_NAMING_CONFLICTS(arg0)); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/ProcessorMessages.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/ProcessorMessages.java deleted file mode 100644 index c0d6bb12b09..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/ProcessorMessages.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.resources; - -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory; -import com.sun.xml.internal.ws.util.localization.Localizer; - - -/** - * Defines string formatting method for each constant in the resource file - * - */ -public final class ProcessorMessages { - - private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("com.sun.tools.internal.ws.resources.processor"); - private final static Localizer localizer = new Localizer(); - - public static Localizable localizablePROCESSOR_MISSING_MODEL() { - return messageFactory.getMessage("processor.missing.model"); - } - - /** - * model is missing - * - */ - public static String PROCESSOR_MISSING_MODEL() { - return localizer.localize(localizablePROCESSOR_MISSING_MODEL()); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/UtilMessages.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/UtilMessages.java deleted file mode 100644 index 2be9eef1f79..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/UtilMessages.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.resources; - -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory; -import com.sun.xml.internal.ws.util.localization.Localizer; - - -/** - * Defines string formatting method for each constant in the resource file - * - */ -public final class UtilMessages { - - private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("com.sun.tools.internal.ws.resources.util"); - private final static Localizer localizer = new Localizer(); - - public static Localizable localizableSAX_2_DOM_NOTSUPPORTED_CREATEELEMENT(Object arg0) { - return messageFactory.getMessage("sax2dom.notsupported.createelement", arg0); - } - - /** - * SAX2DOMEx.DomImplDoesntSupportCreateElementNs: {0} - * - */ - public static String SAX_2_DOM_NOTSUPPORTED_CREATEELEMENT(Object arg0) { - return localizer.localize(localizableSAX_2_DOM_NOTSUPPORTED_CREATEELEMENT(arg0)); - } - - public static Localizable localizableNULL_NAMESPACE_FOUND(Object arg0) { - return messageFactory.getMessage("null.namespace.found", arg0); - } - - /** - * Encountered error in wsdl. Check namespace of element <{0}> - * - */ - public static String NULL_NAMESPACE_FOUND(Object arg0) { - return localizer.localize(localizableNULL_NAMESPACE_FOUND(arg0)); - } - - public static Localizable localizableHOLDER_VALUEFIELD_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("holder.valuefield.not.found", arg0); - } - - /** - * Could not find the field in the Holder that contains the Holder''s value: {0} - * - */ - public static String HOLDER_VALUEFIELD_NOT_FOUND(Object arg0) { - return localizer.localize(localizableHOLDER_VALUEFIELD_NOT_FOUND(arg0)); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WebserviceapMessages.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WebserviceapMessages.java deleted file mode 100644 index 407a455f4d1..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WebserviceapMessages.java +++ /dev/null @@ -1,905 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.resources; - -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory; -import com.sun.xml.internal.ws.util.localization.Localizer; - - -/** - * Defines string formatting method for each constant in the resource file - * - */ -public final class WebserviceapMessages { - - private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("com.sun.tools.internal.ws.resources.webserviceap"); - private final static Localizer localizer = new Localizer(); - - public static Localizable localizableWEBSERVICEAP_ENDPOINTINTERFACES_DO_NOT_MATCH(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.endpointinterfaces.do.not.match", arg0, arg1); - } - - /** - * The endpoint interface {0} does not match the interface {1}. - * - */ - public static String WEBSERVICEAP_ENDPOINTINTERFACES_DO_NOT_MATCH(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_ENDPOINTINTERFACES_DO_NOT_MATCH(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.invalid.webmethod.element.with.exclude", arg0, arg1, arg2); - } - - /** - * The @javax.jws.WebMethod.{0} element cannot be specified with the @javax.jws.WebMethod.exclude element. Class: {1} method: {2} - * - */ - public static String WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.sei.cannot.contain.constant.values", arg0, arg1); - } - - /** - * An service endpoint interface cannot contain constant declaration: Interface: {0} field: {1}. - * - */ - public static String WEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_RPC_LITERAL_PARAMETERS_MUST_HAVE_WEBPARAM(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.rpc.literal.parameters.must.have.webparam", arg0, arg1, arg2); - } - - /** - * All rpc literal parameters must have a WebParam annotation. Class: {0} method: {1} parameter {2} - * - */ - public static String WEBSERVICEAP_RPC_LITERAL_PARAMETERS_MUST_HAVE_WEBPARAM(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_RPC_LITERAL_PARAMETERS_MUST_HAVE_WEBPARAM(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.method.exception.bean.name.not.unique", arg0, arg1); - } - - /** - * Exception bean names must be unique and must not clash with other generated classes. Class: {0} exception {1} - * - */ - public static String WEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(Object arg0) { - return messageFactory.getMessage("webserviceap.webservice.and.webserviceprovider", arg0); - } - - /** - * Classes cannot be annotated with both @javax.jws.WebService and @javax.xml.ws.WebServiceProvider. Class: {0} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_NO_DEFAULT_CONSTRUCTOR(Object arg0) { - return messageFactory.getMessage("webserviceap.webservice.no.default.constructor", arg0); - } - - /** - * Classes annotated with @javax.jws.WebService must have a public default constructor. Class: {0} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_NO_DEFAULT_CONSTRUCTOR(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_NO_DEFAULT_CONSTRUCTOR(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_DOC_BARE_NO_OUT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.doc.bare.no.out", arg0, arg1); - } - - /** - * Document/literal bare methods with no return type or OUT/INOUT parameters must be annotated as @Oneway. Class: {0}, method: {1} - * - */ - public static String WEBSERVICEAP_DOC_BARE_NO_OUT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_DOC_BARE_NO_OUT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_FAILED_TO_PARSE_HANDLERCHAIN_FILE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.failed.to.parse.handlerchain.file", arg0, arg1); - } - - /** - * Failed to parse HandlerChain file. Class: {0}, file: {1} - * - */ - public static String WEBSERVICEAP_FAILED_TO_PARSE_HANDLERCHAIN_FILE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_FAILED_TO_PARSE_HANDLERCHAIN_FILE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_JAVA_TYPE_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("webserviceap.java.typeNotFound", arg0); - } - - /** - * The type: {0} was not found in the mapping - * - */ - public static String WEBSERVICEAP_JAVA_TYPE_NOT_FOUND(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_JAVA_TYPE_NOT_FOUND(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_DECLARE_EXCEPTIONS(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.oneway.operation.cannot.declare.exceptions", arg0, arg1, arg2); - } - - /** - * The method {1} of class {0} is annotated @Oneway but declares the exception {2} - * - */ - public static String WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_DECLARE_EXCEPTIONS(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_DECLARE_EXCEPTIONS(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.webservice.method.is.static.or.final", arg0, arg1); - } - - /** - * Method annotated with @javax.jws.WebMethod must not be static or final. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_RETURN_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.oneway.operation.cannot.have.return.type", arg0, arg1); - } - - /** - * The method {1} of class {0} is annotated @Oneway but has a return type. - * - */ - public static String WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_RETURN_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_RETURN_TYPE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_WARNING(Object arg0) { - return messageFactory.getMessage("webserviceap.warning", arg0); - } - - /** - * warning: {0} - * - */ - public static String WEBSERVICEAP_WARNING(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WARNING(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_RESPONSE_WRAPPER_BEAN_NAME_NOT_UNIQUE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.method.response.wrapper.bean.name.not.unique", arg0, arg1); - } - - /** - * Response wrapper bean names must be unique and must not clash with other generated classes. Class: {0} method {1} - * - */ - public static String WEBSERVICEAP_METHOD_RESPONSE_WRAPPER_BEAN_NAME_NOT_UNIQUE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_RESPONSE_WRAPPER_BEAN_NAME_NOT_UNIQUE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.endpointinterface.on.interface", arg0, arg1); - } - - /** - * Service endpointpoint interface: {0} has cannot have a WebService.endpointInterface annotation: {1} - * - */ - public static String WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_NESTED_MODEL_ERROR(Object arg0) { - return messageFactory.getMessage("webserviceap.nestedModelError", arg0); - } - - /** - * modeler error: {0} - * - */ - public static String WEBSERVICEAP_NESTED_MODEL_ERROR(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_NESTED_MODEL_ERROR(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_ONEWAY_AND_OUT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.oneway.and.out", arg0, arg1); - } - - /** - * @Oneway methods cannot have out parameters. Class: {0} method {1} - * - */ - public static String WEBSERVICEAP_ONEWAY_AND_OUT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_ONEWAY_AND_OUT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_RPC_LITERAL_WEBPARAMS_MUST_SPECIFY_NAME(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.rpc.literal.webparams.must.specify.name", arg0, arg1, arg2); - } - - /** - * All rpc literal WebParams must specify a name. Class: {0} method {1} paramter {2} - * - */ - public static String WEBSERVICEAP_RPC_LITERAL_WEBPARAMS_MUST_SPECIFY_NAME(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_RPC_LITERAL_WEBPARAMS_MUST_SPECIFY_NAME(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.invalid.sei.annotation.element.exclude", arg0, arg1, arg2); - } - - /** - * The @javax.jws.WebMethod({0}) cannot be used on a service endpoint interface. Class: {1} method: {2} - * - */ - public static String WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_CLASS_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("webserviceap.class.not.found", arg0); - } - - /** - * Class Not Found: {0} - * - */ - public static String WEBSERVICEAP_CLASS_NOT_FOUND(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_CLASS_NOT_FOUND(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ELEMENT(Object arg0) { - return messageFactory.getMessage("webserviceap.endpointinteface.plus.element", arg0); - } - - /** - * The @javax.jws.WebService.{0} element cannot be used in with @javax.jws.WebService.endpointInterface element. - * - */ - public static String WEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ELEMENT(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ELEMENT(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_CANNOT_COMBINE_HANDLERCHAIN_SOAPMESSAGEHANDLERS() { - return messageFactory.getMessage("webserviceap.cannot.combine.handlerchain.soapmessagehandlers"); - } - - /** - * You cannot specify both HanlderChain and SOAPMessageHandlers annotations - * - */ - public static String WEBSERVICEAP_CANNOT_COMBINE_HANDLERCHAIN_SOAPMESSAGEHANDLERS() { - return localizer.localize(localizableWEBSERVICEAP_CANNOT_COMBINE_HANDLERCHAIN_SOAPMESSAGEHANDLERS()); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_INNERCLASS_NOT_STATIC(Object arg0) { - return messageFactory.getMessage("webserviceap.webservice.class.is.innerclass.not.static", arg0); - } - - /** - * Inner classes annotated with @javax.jws.WebService must be static. Class: {0} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_CLASS_IS_INNERCLASS_NOT_STATIC(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_INNERCLASS_NOT_STATIC(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_NON_IN_PARAMETERS_MUST_BE_HOLDER(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.non.in.parameters.must.be.holder", arg0, arg1, arg2); - } - - /** - * Class: {0}, method: {1}, parameter: {2} is not WebParam.Mode.IN and is not of type javax.xml.ws.Holder. - * - */ - public static String WEBSERVICEAP_NON_IN_PARAMETERS_MUST_BE_HOLDER(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_NON_IN_PARAMETERS_MUST_BE_HOLDER(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.invalid.sei.annotation.element", arg0, arg1); - } - - /** - * The @javax.jws.WebService.{0} element cannot be specified on a service endpoint interface. Class: {1} - * - */ - public static String WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_SUCCEEDED() { - return messageFactory.getMessage("webserviceap.succeeded"); - } - - /** - * Success - * - */ - public static String WEBSERVICEAP_SUCCEEDED() { - return localizer.localize(localizableWEBSERVICEAP_SUCCEEDED()); - } - - public static Localizable localizableWEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.doc.bare.and.no.one.in", arg0, arg1); - } - - /** - * Document literal bare methods must have one non-header, IN/INOUT parameter. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.webservice.method.is.abstract", arg0, arg1); - } - - /** - * Classes annotated with @javax.jws.WebService must not have abstract methods. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_METHOD_RETURN_NOT_UNIQUE(Object arg0, Object arg1, Object arg2, Object arg3) { - return messageFactory.getMessage("webserviceap.document.literal.bare.method.return.not.unique", arg0, arg1, arg2, arg3); - } - - /** - * Document literal bare methods must have a unique result name return type combination. Class {0} method: {1}, result name: {2} return type: {3} - * - */ - public static String WEBSERVICEAP_DOCUMENT_LITERAL_BARE_METHOD_RETURN_NOT_UNIQUE(Object arg0, Object arg1, Object arg2, Object arg3) { - return localizer.localize(localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_METHOD_RETURN_NOT_UNIQUE(arg0, arg1, arg2, arg3)); - } - - public static Localizable localizableWEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND() { - return messageFactory.getMessage("webserviceap.no.webservice.endpoint.found"); - } - - /** - * A web service endpoint could not be found - * - */ - public static String WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND() { - return localizer.localize(localizableWEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND()); - } - - public static Localizable localizableWEBSERVICEAP_FILE_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("webserviceap.fileNotFound", arg0); - } - - /** - * error: file not found: {0} - * - */ - public static String WEBSERVICEAP_FILE_NOT_FOUND(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_FILE_NOT_FOUND(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_INVALID_HANDLERCHAIN_FILE_NOHANDLER_CONFIG(Object arg0) { - return messageFactory.getMessage("webserviceap.invalid.handlerchain.file.nohandler-config", arg0); - } - - /** - * The handlerchain file {0} is invalid, it does not contain a handler-config element - * - */ - public static String WEBSERVICEAP_INVALID_HANDLERCHAIN_FILE_NOHANDLER_CONFIG(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_INVALID_HANDLERCHAIN_FILE_NOHANDLER_CONFIG(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_HEADER_PARAMETERS_MUST_HAVE_WEBPARAM_NAME(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.header.parameters.must.have.webparam.name", arg0, arg1, arg2); - } - - /** - * All WebParam annotations on header parameters must specify a name. Class: {0} method {1} paramter {2} - * - */ - public static String WEBSERVICEAP_HEADER_PARAMETERS_MUST_HAVE_WEBPARAM_NAME(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_HEADER_PARAMETERS_MUST_HAVE_WEBPARAM_NAME(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.method.return.type.cannot.implement.remote", arg0, arg1, arg2); - } - - /** - * Method return types cannot implement java.rmi.Remote. Class: {0} method: {1} return type: {2} - * - */ - public static String WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ANNOTATION(Object arg0) { - return messageFactory.getMessage("webserviceap.endpointinteface.plus.annotation", arg0); - } - - /** - * The @{0} annotation cannot be used in with @javax.jws.WebService.endpointInterface element. - * - */ - public static String WEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ANNOTATION(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ANNOTATION(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_HOLDER_PARAMETERS_MUST_NOT_BE_IN_ONLY(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.holder.parameters.must.not.be.in.only", arg0, arg1, arg2); - } - - /** - * javax.xml.ws.Holder parameters must not be annotated with the WebParam.Mode.IN property. Class: {0} method: {1} parameter: {2} - * - */ - public static String WEBSERVICEAP_HOLDER_PARAMETERS_MUST_NOT_BE_IN_ONLY(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_HOLDER_PARAMETERS_MUST_NOT_BE_IN_ONLY(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_MUST_HAVE_ONLY_ONE_IN_PARAMETER(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.document.literal.bare.must.have.only.one.in.parameter", arg0, arg1, arg2); - } - - /** - * Document literal bare methods must have no more than 1 non-header in parameter. Class: {0} method: {1} number of non-header parameters: {2} - * - */ - public static String WEBSERVICEAP_DOCUMENT_LITERAL_BARE_MUST_HAVE_ONLY_ONE_IN_PARAMETER(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_MUST_HAVE_ONLY_ONE_IN_PARAMETER(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.doc.bare.return.and.out", arg0, arg1); - } - - /** - * Document/literal bare methods cannot have a return type and out parameters. Class: {0}, method: {1} - * - */ - public static String WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_PARAMETER_TYPES_CANNOT_IMPLEMENT_REMOTE(Object arg0, Object arg1, Object arg2, Object arg3) { - return messageFactory.getMessage("webserviceap.method.parameter.types.cannot.implement.remote", arg0, arg1, arg2, arg3); - } - - /** - * Method parameter types cannot implement java.rmi.Remote. Class: {0} method: {1} parameter: {2} type: {3} - * - */ - public static String WEBSERVICEAP_METHOD_PARAMETER_TYPES_CANNOT_IMPLEMENT_REMOTE(Object arg0, Object arg1, Object arg2, Object arg3) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_PARAMETER_TYPES_CANNOT_IMPLEMENT_REMOTE(arg0, arg1, arg2, arg3)); - } - - public static Localizable localizableWEBSERVICEAP_COMPILATION_FAILED() { - return messageFactory.getMessage("webserviceap.compilationFailed"); - } - - /** - * compilation failed, errors should have been reported - * - */ - public static String WEBSERVICEAP_COMPILATION_FAILED() { - return localizer.localize(localizableWEBSERVICEAP_COMPILATION_FAILED()); - } - - public static Localizable localizableWEBSERVICEAP_MODEL_ALREADY_EXISTS() { - return messageFactory.getMessage("webserviceap.model.already.exists"); - } - - /** - * model already exists - * - */ - public static String WEBSERVICEAP_MODEL_ALREADY_EXISTS() { - return localizer.localize(localizableWEBSERVICEAP_MODEL_ALREADY_EXISTS()); - } - - public static Localizable localizableWEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.could.not.find.typedecl", arg0, arg1); - } - - /** - * Could not get TypeDeclaration for: {0} in apt round: {1} - * - */ - public static String WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_CLASS_NOT_PUBLIC(Object arg0) { - return messageFactory.getMessage("webserviceap.webservice.class.not.public", arg0); - } - - /** - * Classes annotated with @javax.jws.WebService must be public. Class: {0} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_CLASS_NOT_PUBLIC(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_CLASS_NOT_PUBLIC(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_METHOD_NOT_UNIQUE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.document.literal.bare.method.not.unique", arg0, arg1, arg2); - } - - /** - * Document literal bare methods must have unique parameter names. Class: {0} method: {1} parameter name: {2} - * - */ - public static String WEBSERVICEAP_DOCUMENT_LITERAL_BARE_METHOD_NOT_UNIQUE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_METHOD_NOT_UNIQUE(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.rpc.soapbinding.not.allowed.on.method", arg0, arg1); - } - - /** - * SOAPBinding.Style.RPC binding annotations are not allowed on methods. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(Object arg0) { - return messageFactory.getMessage("webserviceap.no.package.class.must.have.targetnamespace", arg0); - } - - /** - * @javax.jws.Webservice annotated classes that do not belong to a package must have the @javax.jws.Webservice.targetNamespace element. Class: {0} - * - */ - public static String WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_ENDPOINTINTERFACE_HAS_NO_WEBSERVICE_ANNOTATION(Object arg0) { - return messageFactory.getMessage("webserviceap.endpointinterface.has.no.webservice.annotation", arg0); - } - - /** - * The endpoint interface {0} must have a WebService annotation - * - */ - public static String WEBSERVICEAP_ENDPOINTINTERFACE_HAS_NO_WEBSERVICE_ANNOTATION(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_ENDPOINTINTERFACE_HAS_NO_WEBSERVICE_ANNOTATION(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_INFO(Object arg0) { - return messageFactory.getMessage("webserviceap.info", arg0); - } - - /** - * info: {0} - * - */ - public static String WEBSERVICEAP_INFO(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_INFO(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_RPC_LITERAL_MUST_NOT_BE_BARE(Object arg0) { - return messageFactory.getMessage("webserviceap.rpc.literal.must.not.be.bare", arg0); - } - - /** - * RPC literal SOAPBindings must have parameterStyle WRAPPPED. Class: {0}. - * - */ - public static String WEBSERVICEAP_RPC_LITERAL_MUST_NOT_BE_BARE(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_RPC_LITERAL_MUST_NOT_BE_BARE(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_COULD_NOT_FIND_HANDLERCHAIN(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.could.not.find.handlerchain", arg0, arg1); - } - - /** - * Could not find the handlerchain {0} in the handler file {1} - * - */ - public static String WEBSERVICEAP_COULD_NOT_FIND_HANDLERCHAIN(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_COULD_NOT_FIND_HANDLERCHAIN(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_RPC_ENCODED_NOT_SUPPORTED(Object arg0) { - return messageFactory.getMessage("webserviceap.rpc.encoded.not.supported", arg0); - } - - /** - * The {0} class has a rpc/encoded SOAPBinding. Rpc/encoded SOAPBindings are not supported in JAXWS 2.0. - * - */ - public static String WEBSERVICEAP_RPC_ENCODED_NOT_SUPPORTED(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_RPC_ENCODED_NOT_SUPPORTED(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_ERROR(Object arg0) { - return messageFactory.getMessage("webserviceap.error", arg0); - } - - /** - * error: {0} - * - */ - public static String WEBSERVICEAP_ERROR(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_ERROR(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_ENDPOINTINTERFACE_CLASS_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("webserviceap.endpointinterface.class.not.found", arg0); - } - - /** - * The endpointInterface class {0} could not be found - * - */ - public static String WEBSERVICEAP_ENDPOINTINTERFACE_CLASS_NOT_FOUND(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_ENDPOINTINTERFACE_CLASS_NOT_FOUND(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_NOT_IMPLEMENTED(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.method.not.implemented", arg0, arg1, arg2); - } - - /** - * Methods in an endpointInterface must be implemented in the implementation class. Interface Class:{0} Implementation Class:{1} Method: {2} - * - */ - public static String WEBSERVICEAP_METHOD_NOT_IMPLEMENTED(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_NOT_IMPLEMENTED(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICE_ENCODED_NOT_SUPPORTED(Object arg0, Object arg1) { - return messageFactory.getMessage("webservice.encoded.not.supported", arg0, arg1); - } - - /** - * The {0} class has invalid SOAPBinding annotation. {1}/encoded SOAPBinding is not supported - * - */ - public static String WEBSERVICE_ENCODED_NOT_SUPPORTED(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICE_ENCODED_NOT_SUPPORTED(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_HANDLERCLASS_NOTSPECIFIED(Object arg0) { - return messageFactory.getMessage("webserviceap.handlerclass.notspecified", arg0); - } - - /** - * A handler in the HandlerChain file: {0} does not specify a handler-class - * - */ - public static String WEBSERVICEAP_HANDLERCLASS_NOTSPECIFIED(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_HANDLERCLASS_NOTSPECIFIED(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_FAILED_TO_FIND_HANDLERCHAIN_FILE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.failed.to.find.handlerchain.file", arg0, arg1); - } - - /** - * Cannot find HandlerChain file. class: {0}, file: {1} - * - */ - public static String WEBSERVICEAP_FAILED_TO_FIND_HANDLERCHAIN_FILE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_FAILED_TO_FIND_HANDLERCHAIN_FILE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.doc.bare.no.return.and.no.out", arg0, arg1); - } - - /** - * Document literal bare methods that do not have a return value must have a single OUT/INOUT parameter. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_ABSTRACT(Object arg0) { - return messageFactory.getMessage("webserviceap.webservice.class.is.abstract", arg0); - } - - /** - * Classes annotated with @javax.jws.WebService must not be abstract. Class: {0} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_CLASS_IS_ABSTRACT(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_ABSTRACT(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_INIT_PARAM_FORMAT_ERROR() { - return messageFactory.getMessage("webserviceap.init_param.format.error"); - } - - /** - * a element must have exactly 1 and 1 - * - */ - public static String WEBSERVICEAP_INIT_PARAM_FORMAT_ERROR() { - return localizer.localize(localizableWEBSERVICEAP_INIT_PARAM_FORMAT_ERROR()); - } - - public static Localizable localizableWEBSERVICEAP_MIXED_BINDING_STYLE(Object arg0) { - return messageFactory.getMessage("webserviceap.mixed.binding.style", arg0); - } - - /** - * Class: {0} contains mixed bindings. SOAPBinding.Style.RPC and SOAPBinding.Style.DOCUMENT cannot be mixed. - * - */ - public static String WEBSERVICEAP_MIXED_BINDING_STYLE(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_MIXED_BINDING_STYLE(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_NOT_ANNOTATED(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.method.not.annotated", arg0, arg1); - } - - /** - * The method {0} on class {1} is not annotated. - * - */ - public static String WEBSERVICEAP_METHOD_NOT_ANNOTATED(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_NOT_ANNOTATED(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_HOLDERS(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.oneway.operation.cannot.have.holders", arg0, arg1); - } - - /** - * The method {1} of class {0} is annotated @Oneway but contains inout or out paramerters (javax.xml.ws.Holder) - * - */ - public static String WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_HOLDERS(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_HOLDERS(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_CANNOT_HAVE_MORE_THAN_ONE_OUT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.document.literal.bare.cannot.have.more.than.one.out", arg0, arg1); - } - - /** - * Document literal bare methods must have a return value or one out parameter. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_DOCUMENT_LITERAL_BARE_CANNOT_HAVE_MORE_THAN_ONE_OUT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_CANNOT_HAVE_MORE_THAN_ONE_OUT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.invalid.sei.annotation", arg0, arg1); - } - - /** - * The @{0} annotation cannot be used on a service endpoint interface. Class: {1} - * - */ - public static String WEBSERVICEAP_INVALID_SEI_ANNOTATION(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_INVALID_SEI_ANNOTATION(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_OPERATION_NAME_NOT_UNIQUE(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.operation.name.not.unique", arg0, arg1, arg2); - } - - /** - * Operation names must be unique. Class: {0} method: {1} operation name: {2} - * - */ - public static String WEBSERVICEAP_OPERATION_NAME_NOT_UNIQUE(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_OPERATION_NAME_NOT_UNIQUE(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_FINAL(Object arg0) { - return messageFactory.getMessage("webserviceap.webservice.class.is.final", arg0); - } - - /** - * Classes annotated with @javax.jws.WebService must not be final. Class: {0} - * - */ - public static String WEBSERVICEAP_WEBSERVICE_CLASS_IS_FINAL(Object arg0) { - return localizer.localize(localizableWEBSERVICEAP_WEBSERVICE_CLASS_IS_FINAL(arg0)); - } - - public static Localizable localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_MUST_HAVE_ONE_IN_OR_OUT(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.document.literal.bare.must.have.one.in.or.out", arg0, arg1); - } - - /** - * Document literal bare methods must have at least one of: a return, an in parameter or an out parameter. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_DOCUMENT_LITERAL_BARE_MUST_HAVE_ONE_IN_OR_OUT(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_DOCUMENT_LITERAL_BARE_MUST_HAVE_ONE_IN_OR_OUT(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_METHOD_REQUEST_WRAPPER_BEAN_NAME_NOT_UNIQUE(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.method.request.wrapper.bean.name.not.unique", arg0, arg1); - } - - /** - * Request wrapper bean names must be unique and must not clash with other generated classes. Class: {0} method {1} - * - */ - public static String WEBSERVICEAP_METHOD_REQUEST_WRAPPER_BEAN_NAME_NOT_UNIQUE(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_METHOD_REQUEST_WRAPPER_BEAN_NAME_NOT_UNIQUE(arg0, arg1)); - } - - public static Localizable localizableWEBSERVICEAP_DOCUMENT_BARE_HOLDER_PARAMETERS_MUST_NOT_BE_INOUT(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("webserviceap.document.bare.holder.parameters.must.not.be.inout", arg0, arg1, arg2); - } - - /** - * javax.xml.ws.Holder parameters in document bare operations must be WebParam.Mode.INOUT; Class: {0} method: {1} parameter: {2} - * - */ - public static String WEBSERVICEAP_DOCUMENT_BARE_HOLDER_PARAMETERS_MUST_NOT_BE_INOUT(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWEBSERVICEAP_DOCUMENT_BARE_HOLDER_PARAMETERS_MUST_NOT_BE_INOUT(arg0, arg1, arg2)); - } - - public static Localizable localizableWEBSERVICEAP_ONEWAY_AND_NOT_ONE_IN(Object arg0, Object arg1) { - return messageFactory.getMessage("webserviceap.oneway.and.not.one.in", arg0, arg1); - } - - /** - * Document literal bare methods annotated with @javax.jws.Oneway must have one non-header IN parameter. Class: {0} Method: {1} - * - */ - public static String WEBSERVICEAP_ONEWAY_AND_NOT_ONE_IN(Object arg0, Object arg1) { - return localizer.localize(localizableWEBSERVICEAP_ONEWAY_AND_NOT_ONE_IN(arg0, arg1)); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java deleted file mode 100644 index e30b9616918..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java +++ /dev/null @@ -1,794 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.resources; - -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory; -import com.sun.xml.internal.ws.util.localization.Localizer; - - -/** - * Defines string formatting method for each constant in the resource file - * - */ -public final class WscompileMessages { - - private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("com.sun.tools.internal.ws.resources.wscompile"); - private final static Localizer localizer = new Localizer(); - - public static Localizable localizableWSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(Object arg0) { - return messageFactory.getMessage("wsgen.class.must.be.implementation.class", arg0); - } - - /** - * The class "{0}" is not an endpoint implementation class. - * - */ - public static String WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(Object arg0) { - return localizer.localize(localizableWSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(arg0)); - } - - public static Localizable localizableWSGEN_CLASS_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("wsgen.class.not.found", arg0); - } - - /** - * Class not found: "{0}" - * - */ - public static String WSGEN_CLASS_NOT_FOUND(Object arg0) { - return localizer.localize(localizableWSGEN_CLASS_NOT_FOUND(arg0)); - } - - public static Localizable localizableWSIMPORT_HTTP_REDIRECT(Object arg0, Object arg1) { - return messageFactory.getMessage("wsimport.httpRedirect", arg0, arg1); - } - - /** - * Server returned HTTP Status code: "{0}", retrying with "{1}" - * - */ - public static String WSIMPORT_HTTP_REDIRECT(Object arg0, Object arg1) { - return localizer.localize(localizableWSIMPORT_HTTP_REDIRECT(arg0, arg1)); - } - - public static Localizable localizableWSIMPORT_AUTH_INFO_NEEDED(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsimport.authInfoNeeded", arg0, arg1, arg2); - } - - /** - * {0}, "{1}" needs authorization, please provide authorization file with read access at {2} or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port// - * - */ - public static String WSIMPORT_AUTH_INFO_NEEDED(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSIMPORT_AUTH_INFO_NEEDED(arg0, arg1, arg2)); - } - - public static Localizable localizableWSGEN_USAGE_EXAMPLES() { - return messageFactory.getMessage("wsgen.usage.examples"); - } - - /** - * - * Examples: - * wsgen -cp . example.Stock - * wsgen -cp . example.Stock -wsdl -servicename '{http://mynamespace}MyService' - * - * - */ - public static String WSGEN_USAGE_EXAMPLES() { - return localizer.localize(localizableWSGEN_USAGE_EXAMPLES()); - } - - public static Localizable localizableWRAPPER_TASK_LOADING_20_API(Object arg0) { - return messageFactory.getMessage("wrapperTask.loading20Api", arg0); - } - - /** - * You are loading JAX-WS 2.0 API from {0} but this tool requires JAX-WS 2.1 API. - * - */ - public static String WRAPPER_TASK_LOADING_20_API(Object arg0) { - return localizer.localize(localizableWRAPPER_TASK_LOADING_20_API(arg0)); - } - - public static Localizable localizableWSGEN_INVALID_PROTOCOL(Object arg0, Object arg1) { - return messageFactory.getMessage("wsgen.invalid.protocol", arg0, arg1); - } - - /** - * "{0}" is not a supported protocol. Supported protocols include: {1}. - * - */ - public static String WSGEN_INVALID_PROTOCOL(Object arg0, Object arg1) { - return localizer.localize(localizableWSGEN_INVALID_PROTOCOL(arg0, arg1)); - } - - public static Localizable localizableWSIMPORT_USAGE_EXAMPLES() { - return messageFactory.getMessage("wsimport.usage.examples"); - } - - /** - * - * Examples: - * wsimport stock.wsdl -b stock.xml -b stock.xjb - * wsimport -d generated http://example.org/stock?wsdl - * - * - */ - public static String WSIMPORT_USAGE_EXAMPLES() { - return localizer.localize(localizableWSIMPORT_USAGE_EXAMPLES()); - } - - public static Localizable localizableINVOKER_NEED_ENDORSED() { - return messageFactory.getMessage("invoker.needEndorsed"); - } - - /** - * You are running on JDK6 which comes with JAX-WS 2.0 API, but this tool requires JAX-WS 2.1 API. Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), or use -Xendorsed option. - * - */ - public static String INVOKER_NEED_ENDORSED() { - return localizer.localize(localizableINVOKER_NEED_ENDORSED()); - } - - public static Localizable localizableWSIMPORT_MISSING_FILE() { - return messageFactory.getMessage("wsimport.missingFile"); - } - - /** - * Missing WSDL_URI - * - */ - public static String WSIMPORT_MISSING_FILE() { - return localizer.localize(localizableWSIMPORT_MISSING_FILE()); - } - - public static Localizable localizableWSIMPORT_USAGE_EXTENSIONS() { - return messageFactory.getMessage("wsimport.usage.extensions"); - } - - /** - * - * Extensions: - * -XadditionalHeaders map headers not bound to request or response message to - * Java method parameters - * -Xauthfile file to carry authorization information in the format - * http://username:password@example.org/stock?wsdl - * -Xdebug print debug information - * -Xno-addressing-databinding enable binding of W3C EndpointReferenceType to Java - * -Xnocompile do not compile generated Java files - * - * - */ - public static String WSIMPORT_USAGE_EXTENSIONS() { - return localizer.localize(localizableWSIMPORT_USAGE_EXTENSIONS()); - } - - public static Localizable localizableWSIMPORT_USAGE(Object arg0) { - return messageFactory.getMessage("wsimport.usage", arg0); - } - - /** - * Usage: {0} [options] - * - * Use "wsimport -help" for a detailed description of options. - * - */ - public static String WSIMPORT_USAGE(Object arg0) { - return localizer.localize(localizableWSIMPORT_USAGE(arg0)); - } - - public static Localizable localizablePLEASE() { - return messageFactory.getMessage("Please"); - } - - /** - * specify "-extension" and "-wsdl:protocol XSoap1.2" switches. For example: - * - * - * - */ - public static String PLEASE() { - return localizer.localize(localizablePLEASE()); - } - - public static Localizable localizableWSIMPORT_PARSING_WSDL() { - return messageFactory.getMessage("wsimport.ParsingWSDL"); - } - - /** - * parsing WSDL... - * - * - * - */ - public static String WSIMPORT_PARSING_WSDL() { - return localizer.localize(localizableWSIMPORT_PARSING_WSDL()); - } - - public static Localizable localizableWSGEN_MISSING_FILE() { - return messageFactory.getMessage("wsgen.missingFile"); - } - - /** - * Missing SEI - * - */ - public static String WSGEN_MISSING_FILE() { - return localizer.localize(localizableWSGEN_MISSING_FILE()); - } - - public static Localizable localizableWSIMPORT_HELP(Object arg0) { - return messageFactory.getMessage("wsimport.help", arg0); - } - - /** - * - * Usage: {0} [options] - * - * where [options] include: - * -b specify jaxws/jaxb binding files or additional schemas - * (Each must have its own -b) - * -B Pass this option to JAXB schema compiler - * -catalog specify catalog file to resolve external entity references - * supports TR9401, XCatalog, and OASIS XML Catalog format. - * -d specify where to place generated output files - * -extension allow vendor extensions - functionality not specified - * by the specification. Use of extensions may - * result in applications that are not portable or - * may not interoperate with other implementations - * -help display help - * -httpproxy:: specify a HTTP proxy server (port defaults to 8080) - * -keep keep generated files - * -p specifies the target package - * -quiet suppress wsimport output - * -s specify where to place generated source files - * -target generate code as per the given JAXWS spec version - * e.g. 2.0 will generate compliant code for JAXWS 2.0 spec - * -verbose output messages about what the compiler is doing - * -version print version information - * -wsdllocation @WebServiceClient.wsdlLocation value - * - * - */ - public static String WSIMPORT_HELP(Object arg0) { - return localizer.localize(localizableWSIMPORT_HELP(arg0)); - } - - public static Localizable localizableWSCOMPILE_ERROR(Object arg0) { - return messageFactory.getMessage("wscompile.error", arg0); - } - - /** - * error: {0} - * - */ - public static String WSCOMPILE_ERROR(Object arg0) { - return localizer.localize(localizableWSCOMPILE_ERROR(arg0)); - } - - public static Localizable localizableWSGEN_PROTOCOL_WITHOUT_EXTENSION(Object arg0) { - return messageFactory.getMessage("wsgen.protocol.without.extension", arg0); - } - - /** - * The optional protocol "{0}" must be used in conjunction with the "-extension" option. - * - */ - public static String WSGEN_PROTOCOL_WITHOUT_EXTENSION(Object arg0) { - return localizer.localize(localizableWSGEN_PROTOCOL_WITHOUT_EXTENSION(arg0)); - } - - public static Localizable localizableWSIMPORT_COMPILING_CODE() { - return messageFactory.getMessage("wsimport.CompilingCode"); - } - - /** - * - * compiling code... - * - * - */ - public static String WSIMPORT_COMPILING_CODE() { - return localizer.localize(localizableWSIMPORT_COMPILING_CODE()); - } - - public static Localizable localizableWSIMPORT_READING_AUTH_FILE(Object arg0) { - return messageFactory.getMessage("wsimport.readingAuthFile", arg0); - } - - /** - * Trying to read authorization file : "{0}"... - * - */ - public static String WSIMPORT_READING_AUTH_FILE(Object arg0) { - return localizer.localize(localizableWSIMPORT_READING_AUTH_FILE(arg0)); - } - - public static Localizable localizableWSGEN_NO_WEBSERVICES_CLASS(Object arg0) { - return messageFactory.getMessage("wsgen.no.webservices.class", arg0); - } - - /** - * wsgen did not find any class with @WebService annotation. Please specify @WebService annotation on {0}. - * - */ - public static String WSGEN_NO_WEBSERVICES_CLASS(Object arg0) { - return localizer.localize(localizableWSGEN_NO_WEBSERVICES_CLASS(arg0)); - } - - public static Localizable localizableWSCOMPILE_NO_SUCH_DIRECTORY(Object arg0) { - return messageFactory.getMessage("wscompile.noSuchDirectory", arg0); - } - - /** - * directory not found: {0} - * - */ - public static String WSCOMPILE_NO_SUCH_DIRECTORY(Object arg0) { - return localizer.localize(localizableWSCOMPILE_NO_SUCH_DIRECTORY(arg0)); - } - - public static Localizable localizableWSCOMPILE_INFO(Object arg0) { - return messageFactory.getMessage("wscompile.info", arg0); - } - - /** - * info: {0} - * - */ - public static String WSCOMPILE_INFO(Object arg0) { - return localizer.localize(localizableWSCOMPILE_INFO(arg0)); - } - - public static Localizable localizableWSIMPORT_MAX_REDIRECT_ATTEMPT() { - return messageFactory.getMessage("wsimport.maxRedirectAttempt"); - } - - /** - * Can not get a WSDL maximum number of redirects(5) reached - * - */ - public static String WSIMPORT_MAX_REDIRECT_ATTEMPT() { - return localizer.localize(localizableWSIMPORT_MAX_REDIRECT_ATTEMPT()); - } - - public static Localizable localizableWSIMPORT_WARNING_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsimport.WarningMessage", arg0); - } - - /** - * [WARNING] {0} - * - */ - public static String WSIMPORT_WARNING_MESSAGE(Object arg0) { - return localizer.localize(localizableWSIMPORT_WARNING_MESSAGE(arg0)); - } - - public static Localizable localizableWSCOMPILE_INVALID_OPTION(Object arg0) { - return messageFactory.getMessage("wscompile.invalidOption", arg0); - } - - /** - * unrecognized parameter {0} - * - */ - public static String WSCOMPILE_INVALID_OPTION(Object arg0) { - return localizer.localize(localizableWSCOMPILE_INVALID_OPTION(arg0)); - } - - public static Localizable localizableWSIMPORT_ERROR_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsimport.ErrorMessage", arg0); - } - - /** - * [ERROR] {0} - * - */ - public static String WSIMPORT_ERROR_MESSAGE(Object arg0) { - return localizer.localize(localizableWSIMPORT_ERROR_MESSAGE(arg0)); - } - - public static Localizable localizableWSIMPORT_GENERATING_CODE() { - return messageFactory.getMessage("wsimport.GeneratingCode"); - } - - /** - * generating code... - * - * - */ - public static String WSIMPORT_GENERATING_CODE() { - return localizer.localize(localizableWSIMPORT_GENERATING_CODE()); - } - - public static Localizable localizableWSGEN() { - return messageFactory.getMessage("wsgen"); - } - - /** - * -wsdl:protocol XSoap1.2 -extenson {1} - * - */ - public static String WSGEN() { - return localizer.localize(localizableWSGEN()); - } - - public static Localizable localizableWSIMPORT_NOT_A_FILE_NOR_URL(Object arg0) { - return messageFactory.getMessage("wsimport.NotAFileNorURL", arg0); - } - - /** - * "{0}" is neither a file name nor an URL - * - */ - public static String WSIMPORT_NOT_A_FILE_NOR_URL(Object arg0) { - return localizer.localize(localizableWSIMPORT_NOT_A_FILE_NOR_URL(arg0)); - } - - public static Localizable localizableWSCOMPILE_WARNING(Object arg0) { - return messageFactory.getMessage("wscompile.warning", arg0); - } - - /** - * warning: {0} - * - */ - public static String WSCOMPILE_WARNING(Object arg0) { - return localizer.localize(localizableWSCOMPILE_WARNING(arg0)); - } - - public static Localizable localizableWRAPPER_TASK_NEED_ENDORSED(Object arg0) { - return messageFactory.getMessage("wrapperTask.needEndorsed", arg0); - } - - /** - * You are running on JDK6 which comes with JAX-WS 2.0 API, but this tool requires JAX-WS 2.1 API. Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), or set xendorsed="true" on <{0}>. - * - */ - public static String WRAPPER_TASK_NEED_ENDORSED(Object arg0) { - return localizer.localize(localizableWRAPPER_TASK_NEED_ENDORSED(arg0)); - } - - public static Localizable localizableWSIMPORT_NO_SUCH_JAXB_OPTION(Object arg0) { - return messageFactory.getMessage("wsimport.noSuchJaxbOption", arg0); - } - - /** - * no such JAXB option: {0} - * - */ - public static String WSIMPORT_NO_SUCH_JAXB_OPTION(Object arg0) { - return localizer.localize(localizableWSIMPORT_NO_SUCH_JAXB_OPTION(arg0)); - } - - public static Localizable localizableWSIMPORT_AUTH_FILE_NOT_FOUND(Object arg0, Object arg1) { - return messageFactory.getMessage("wsimport.authFileNotFound", arg0, arg1); - } - - /** - * Authorization file "{0}" not found. If the WSDL access needs Basic Authentication, please provide authorization file with read access at {1} or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port// - * - */ - public static String WSIMPORT_AUTH_FILE_NOT_FOUND(Object arg0, Object arg1) { - return localizer.localize(localizableWSIMPORT_AUTH_FILE_NOT_FOUND(arg0, arg1)); - } - - public static Localizable localizableWSIMPORT_DEBUG_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsimport.DebugMessage", arg0); - } - - /** - * [DEBUG] {0} - * - */ - public static String WSIMPORT_DEBUG_MESSAGE(Object arg0) { - return localizer.localize(localizableWSIMPORT_DEBUG_MESSAGE(arg0)); - } - - public static Localizable localizableWSGEN_COULD_NOT_CREATE_FILE(Object arg0) { - return messageFactory.getMessage("wsgen.could.not.create.file", arg0); - } - - /** - * "Could not create file: "{0}" - * - */ - public static String WSGEN_COULD_NOT_CREATE_FILE(Object arg0) { - return localizer.localize(localizableWSGEN_COULD_NOT_CREATE_FILE(arg0)); - } - - public static Localizable localizableWSGEN_WSDL_ARG_NO_GENWSDL(Object arg0) { - return messageFactory.getMessage("wsgen.wsdl.arg.no.genwsdl", arg0); - } - - /** - * The "{0}" option can only be in conjunction with the "-wsdl" option. - * - */ - public static String WSGEN_WSDL_ARG_NO_GENWSDL(Object arg0) { - return localizer.localize(localizableWSGEN_WSDL_ARG_NO_GENWSDL(arg0)); - } - - public static Localizable localizableWSGEN_HELP(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("wsgen.help", arg0, arg1, arg2); - } - - /** - * - * Usage: {0} [options] - * - * where [options] include: - * -classpath specify where to find input class files - * -cp same as -classpath - * -d specify where to place generated output files - * -extension allow vendor extensions - functionality not specified - * by the specification. Use of extensions may - * result in applications that are not portable or - * may not interoperate with other implementations - * -help display help - * -keep keep generated files - * -r resource destination directory, specify where to - * place resouce files such as WSDLs - * -s specify where to place generated source files - * -verbose output messages about what the compiler is doing - * -version print version information - * -wsdl[:protocol] generate a WSDL file. The protocol is optional. - * Valid protocols are {1}, - * the default is soap1.1. - * The non stanadard protocols {2} - * can only be used in conjunction with the - * -extension option. - * -servicename specify the Service name to use in the generated WSDL - * Used in conjunction with the -wsdl option. - * -portname specify the Port name to use in the generated WSDL - * Used in conjunction with the -wsdl option. - * - */ - public static String WSGEN_HELP(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWSGEN_HELP(arg0, arg1, arg2)); - } - - public static Localizable localizableWSIMPORT_INFO_MESSAGE(Object arg0) { - return messageFactory.getMessage("wsimport.InfoMessage", arg0); - } - - /** - * [INFO] {0} - * - */ - public static String WSIMPORT_INFO_MESSAGE(Object arg0) { - return localizer.localize(localizableWSIMPORT_INFO_MESSAGE(arg0)); - } - - public static Localizable localizableWSGEN_SOAP_12_WITHOUT_EXTENSION() { - return messageFactory.getMessage("wsgen.soap12.without.extension"); - } - - /** - * The optional protocol "Xsoap1.2" must be used in conjunction with the "-extension" option. - * - */ - public static String WSGEN_SOAP_12_WITHOUT_EXTENSION() { - return localizer.localize(localizableWSGEN_SOAP_12_WITHOUT_EXTENSION()); - } - - public static Localizable localizableWSIMPORT_ILLEGAL_AUTH_INFO(Object arg0) { - return messageFactory.getMessage("wsimport.ILLEGAL_AUTH_INFO", arg0); - } - - /** - * "{0}" is not a valid authorization information format. The format is http[s]://user:password@host:port//. - * - */ - public static String WSIMPORT_ILLEGAL_AUTH_INFO(Object arg0) { - return localizer.localize(localizableWSIMPORT_ILLEGAL_AUTH_INFO(arg0)); - } - - public static Localizable localizableWSCOMPILE_COMPILATION_FAILED() { - return messageFactory.getMessage("wscompile.compilationFailed"); - } - - /** - * compilation failed, errors should have been reported - * - */ - public static String WSCOMPILE_COMPILATION_FAILED() { - return localizer.localize(localizableWSCOMPILE_COMPILATION_FAILED()); - } - - public static Localizable localizableWSCOMPILE_MISSING_OPTION_ARGUMENT(Object arg0) { - return messageFactory.getMessage("wscompile.missingOptionArgument", arg0); - } - - /** - * option "{0}" requires an argument - * - */ - public static String WSCOMPILE_MISSING_OPTION_ARGUMENT(Object arg0) { - return localizer.localize(localizableWSCOMPILE_MISSING_OPTION_ARGUMENT(arg0)); - } - - public static Localizable localizableWSGEN_CANNOT_GEN_WSDL_FOR_NON_SOAP_BINDING(Object arg0, Object arg1) { - return messageFactory.getMessage("wsgen.cannot.gen.wsdl.for.non.soap.binding", arg0, arg1); - } - - /** - * wsgen can not generate WSDL for non-SOAP binding: {0} on Class {1} - * - */ - public static String WSGEN_CANNOT_GEN_WSDL_FOR_NON_SOAP_BINDING(Object arg0, Object arg1) { - return localizer.localize(localizableWSGEN_CANNOT_GEN_WSDL_FOR_NON_SOAP_BINDING(arg0, arg1)); - } - - public static Localizable localizableWSCOMPILE_DUPLICATE_OPTION(Object arg0) { - return messageFactory.getMessage("wscompile.duplicateOption", arg0); - } - - /** - * duplicate option: {0} - * - */ - public static String WSCOMPILE_DUPLICATE_OPTION(Object arg0) { - return localizer.localize(localizableWSCOMPILE_DUPLICATE_OPTION(arg0)); - } - - public static Localizable localizableWSIMPORT_FAILED_TO_PARSE(Object arg0, Object arg1) { - return messageFactory.getMessage("wsimport.FailedToParse", arg0, arg1); - } - - /** - * Failed to parse "{0}": {1} - * - */ - public static String WSIMPORT_FAILED_TO_PARSE(Object arg0, Object arg1) { - return localizer.localize(localizableWSIMPORT_FAILED_TO_PARSE(arg0, arg1)); - } - - public static Localizable localizableWSIMPORT_NO_WSDL(Object arg0) { - return messageFactory.getMessage("wsimport.no.wsdl", arg0); - } - - /** - * Failed to read the WSDL document: {0}, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not . - * - */ - public static String WSIMPORT_NO_WSDL(Object arg0) { - return localizer.localize(localizableWSIMPORT_NO_WSDL(arg0)); - } - - public static Localizable localizableWSIMPORT_AUTH_INFO_LINENO(Object arg0, Object arg1) { - return messageFactory.getMessage("wsimport.AUTH_INFO_LINENO", arg0, arg1); - } - - /** - * "line {0} of {1} - * - */ - public static String WSIMPORT_AUTH_INFO_LINENO(Object arg0, Object arg1) { - return localizer.localize(localizableWSIMPORT_AUTH_INFO_LINENO(arg0, arg1)); - } - - public static Localizable localizableWSGEN_USAGE(Object arg0) { - return messageFactory.getMessage("wsgen.usage", arg0); - } - - /** - * Usage: {0} [options] - * - * Use "wsgen -help" for a detailed description of options. - * - */ - public static String WSGEN_USAGE(Object arg0) { - return localizer.localize(localizableWSGEN_USAGE(arg0)); - } - - public static Localizable localizableWSGEN_SERVICENAME_MISSING_LOCALNAME(Object arg0) { - return messageFactory.getMessage("wsgen.servicename.missing.localname", arg0); - } - - /** - * The service name "{0}" is missing a localname. - * - */ - public static String WSGEN_SERVICENAME_MISSING_LOCALNAME(Object arg0) { - return localizer.localize(localizableWSGEN_SERVICENAME_MISSING_LOCALNAME(arg0)); - } - - public static Localizable localizableWSGEN_SERVICENAME_MISSING_NAMESPACE(Object arg0) { - return messageFactory.getMessage("wsgen.servicename.missing.namespace", arg0); - } - - /** - * The service name "{0}" is missing a namespace. - * - */ - public static String WSGEN_SERVICENAME_MISSING_NAMESPACE(Object arg0) { - return localizer.localize(localizableWSGEN_SERVICENAME_MISSING_NAMESPACE(arg0)); - } - - public static Localizable localizableWSGEN_INVALID_TRANSPORT(Object arg0, Object arg1) { - return messageFactory.getMessage("wsgen.invalid.transport", arg0, arg1); - } - - /** - * "{0}" is not a supported transport. Supported transport include: {1}. - * - */ - public static String WSGEN_INVALID_TRANSPORT(Object arg0, Object arg1) { - return localizer.localize(localizableWSGEN_INVALID_TRANSPORT(arg0, arg1)); - } - - public static Localizable localizableWSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(Object arg0, Object arg1) { - return messageFactory.getMessage("wsgen.cannot.gen.wsdl.for.soap12.binding", arg0, arg1); - } - - /** - * wsgen can not generate WSDL for SOAP 1.2 binding: {0} on class: {1}. - * - * - */ - public static String WSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(Object arg0, Object arg1) { - return localizer.localize(localizableWSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(arg0, arg1)); - } - - public static Localizable localizableWSIMPORT_ILLEGAL_TARGET_VERSION(Object arg0) { - return messageFactory.getMessage("wsimport.ILLEGAL_TARGET_VERSION", arg0); - } - - /** - * "{0}" is not a valid target version. "2.0" and "2.1" are supported. - * - */ - public static String WSIMPORT_ILLEGAL_TARGET_VERSION(Object arg0) { - return localizer.localize(localizableWSIMPORT_ILLEGAL_TARGET_VERSION(arg0)); - } - - public static Localizable localizableWSGEN_PORTNAME_MISSING_LOCALNAME(Object arg0) { - return messageFactory.getMessage("wsgen.portname.missing.localname", arg0); - } - - /** - * The port name "{0}" is missing a localname. - * - */ - public static String WSGEN_PORTNAME_MISSING_LOCALNAME(Object arg0) { - return localizer.localize(localizableWSGEN_PORTNAME_MISSING_LOCALNAME(arg0)); - } - - public static Localizable localizableWSGEN_PORTNAME_MISSING_NAMESPACE(Object arg0) { - return messageFactory.getMessage("wsgen.portname.missing.namespace", arg0); - } - - /** - * The port name "{0}" is missing a namespace. - * - */ - public static String WSGEN_PORTNAME_MISSING_NAMESPACE(Object arg0) { - return localizer.localize(localizableWSGEN_PORTNAME_MISSING_NAMESPACE(arg0)); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WsdlMessages.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WsdlMessages.java deleted file mode 100644 index 11771f1a018..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/WsdlMessages.java +++ /dev/null @@ -1,1020 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.resources; - -import com.sun.xml.internal.ws.util.localization.Localizable; -import com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory; -import com.sun.xml.internal.ws.util.localization.Localizer; - - -/** - * Defines string formatting method for each constant in the resource file - * - */ -public final class WsdlMessages { - - private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("com.sun.tools.internal.ws.resources.wsdl"); - private final static Localizer localizer = new Localizer(); - - public static Localizable localizablePARSING_ELEMENT_EXPECTED() { - return messageFactory.getMessage("parsing.elementExpected"); - } - - /** - * unexpected non-element found - * - */ - public static String PARSING_ELEMENT_EXPECTED() { - return localizer.localize(localizablePARSING_ELEMENT_EXPECTED()); - } - - public static Localizable localizableENTITY_NOT_FOUND_BINDING(Object arg0, Object arg1) { - return messageFactory.getMessage("entity.notFound.binding", arg0, arg1); - } - - /** - * wsdl:binding "{0}" referenced by wsdl:port "{1}", but it's not found in the wsdl - * - */ - public static String ENTITY_NOT_FOUND_BINDING(Object arg0, Object arg1) { - return localizer.localize(localizableENTITY_NOT_FOUND_BINDING(arg0, arg1)); - } - - public static Localizable localizablePARSING_UNABLE_TO_GET_METADATA(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.unableToGetMetadata", arg0, arg1); - } - - /** - * {0} - * - * {1} - * - */ - public static String PARSING_UNABLE_TO_GET_METADATA(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_UNABLE_TO_GET_METADATA(arg0, arg1)); - } - - public static Localizable localizablePARSING_PARSE_FAILED() { - return messageFactory.getMessage("Parsing.ParseFailed"); - } - - /** - * Failed to parse the WSDL. - * - */ - public static String PARSING_PARSE_FAILED() { - return localizer.localize(localizablePARSING_PARSE_FAILED()); - } - - public static Localizable localizableVALIDATION_INVALID_PREFIX(Object arg0) { - return messageFactory.getMessage("validation.invalidPrefix", arg0); - } - - /** - * undeclared namespace prefix: "{0}" - * - */ - public static String VALIDATION_INVALID_PREFIX(Object arg0) { - return localizer.localize(localizableVALIDATION_INVALID_PREFIX(arg0)); - } - - public static Localizable localizablePARSING_INVALID_ATTRIBUTE_VALUE(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.invalidAttributeValue", arg0, arg1); - } - - /** - * invalid value "{1}" for attribute "{0}" - * - */ - public static String PARSING_INVALID_ATTRIBUTE_VALUE(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_INVALID_ATTRIBUTE_VALUE(arg0, arg1)); - } - - public static Localizable localizableVALIDATION_INVALID_ATTRIBUTE_VALUE(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.invalidAttributeValue", arg0, arg1); - } - - /** - * invalid value "{1}" for attribute "{0}" - * - */ - public static String VALIDATION_INVALID_ATTRIBUTE_VALUE(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INVALID_ATTRIBUTE_VALUE(arg0, arg1)); - } - - public static Localizable localizableVALIDATION_INVALID_RANGE(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.invalidRange", arg0, arg1); - } - - /** - * invalid range found (min: {0}, max: {1}) - * - */ - public static String VALIDATION_INVALID_RANGE(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INVALID_RANGE(arg0, arg1)); - } - - public static Localizable localizablePARSING_INVALID_TAG(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.invalidTag", arg0, arg1); - } - - /** - * expected element "{1}", found "{0}" - * - */ - public static String PARSING_INVALID_TAG(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_INVALID_TAG(arg0, arg1)); - } - - public static Localizable localizableENTITY_NOT_FOUND_PORT_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("entity.notFound.portType", arg0, arg1); - } - - /** - * wsdl:portType "{0}" referenced by wsdl:binding "{1}", but it's not found in the wsdl - * - */ - public static String ENTITY_NOT_FOUND_PORT_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableENTITY_NOT_FOUND_PORT_TYPE(arg0, arg1)); - } - - public static Localizable localizablePARSING_MISSING_REQUIRED_ATTRIBUTE(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.missingRequiredAttribute", arg0, arg1); - } - - /** - * missing required attribute "{1}" of element "{0}" - * - */ - public static String PARSING_MISSING_REQUIRED_ATTRIBUTE(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_MISSING_REQUIRED_ATTRIBUTE(arg0, arg1)); - } - - public static Localizable localizablePARSING_INVALID_ELEMENT(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.invalidElement", arg0, arg1); - } - - /** - * invalid element: "{0}" (in namespace "{1}") - * - */ - public static String PARSING_INVALID_ELEMENT(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_INVALID_ELEMENT(arg0, arg1)); - } - - public static Localizable localizableVALIDATION_INVALID_ELEMENT(Object arg0) { - return messageFactory.getMessage("validation.invalidElement", arg0); - } - - /** - * invalid element: "{0}" - * - */ - public static String VALIDATION_INVALID_ELEMENT(Object arg0) { - return localizer.localize(localizableVALIDATION_INVALID_ELEMENT(arg0)); - } - - public static Localizable localizableINTERNALIZER_TWO_VERSION_ATTRIBUTES() { - return messageFactory.getMessage("Internalizer.TwoVersionAttributes"); - } - - /** - * Both jaxws:version and version are present - * - */ - public static String INTERNALIZER_TWO_VERSION_ATTRIBUTES() { - return localizer.localize(localizableINTERNALIZER_TWO_VERSION_ATTRIBUTES()); - } - - public static Localizable localizableVALIDATION_DUPLICATE_PART_NAME(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.duplicatePartName", arg0, arg1); - } - - /** - * Invalid WSDL, duplicate parts in a wsdl:message is not allowed. - * wsdl:message {0} has a duplicated part name: "{1}" - * - */ - public static String VALIDATION_DUPLICATE_PART_NAME(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_DUPLICATE_PART_NAME(arg0, arg1)); - } - - public static Localizable localizablePARSING_INVALID_WSDL_ELEMENT(Object arg0) { - return messageFactory.getMessage("parsing.invalidWsdlElement", arg0); - } - - /** - * invalid WSDL element: "{0}" - * - */ - public static String PARSING_INVALID_WSDL_ELEMENT(Object arg0) { - return localizer.localize(localizablePARSING_INVALID_WSDL_ELEMENT(arg0)); - } - - public static Localizable localizableVALIDATION_INVALID_COMPLEX_TYPE_IN_ELEMENT(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.invalidComplexTypeInElement", arg0, arg1); - } - - /** - * invalid element: "{1}", has named complexType: "{0}" - * - */ - public static String VALIDATION_INVALID_COMPLEX_TYPE_IN_ELEMENT(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INVALID_COMPLEX_TYPE_IN_ELEMENT(arg0, arg1)); - } - - public static Localizable localizablePARSING_NON_WHITESPACE_TEXT_FOUND(Object arg0) { - return messageFactory.getMessage("parsing.nonWhitespaceTextFound", arg0); - } - - /** - * found unexpected non-whitespace text: "{0}" - * - */ - public static String PARSING_NON_WHITESPACE_TEXT_FOUND(Object arg0) { - return localizer.localize(localizablePARSING_NON_WHITESPACE_TEXT_FOUND(arg0)); - } - - public static Localizable localizableINTERNALIZER_TARGET_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("internalizer.targetNotFound", arg0); - } - - /** - * No target found for the wsdlLocation: {0} - * - */ - public static String INTERNALIZER_TARGET_NOT_FOUND(Object arg0) { - return localizer.localize(localizableINTERNALIZER_TARGET_NOT_FOUND(arg0)); - } - - public static Localizable localizableVALIDATION_NOT_SIMPLE_TYPE(Object arg0) { - return messageFactory.getMessage("validation.notSimpleType", arg0); - } - - /** - * not a simple type: "{0}" - * - */ - public static String VALIDATION_NOT_SIMPLE_TYPE(Object arg0) { - return localizer.localize(localizableVALIDATION_NOT_SIMPLE_TYPE(arg0)); - } - - public static Localizable localizablePARSING_SAX_EXCEPTION_WITH_SYSTEM_ID(Object arg0) { - return messageFactory.getMessage("parsing.saxExceptionWithSystemId", arg0); - } - - /** - * invalid WSDL file! failed to parse document at "{0}" - * - */ - public static String PARSING_SAX_EXCEPTION_WITH_SYSTEM_ID(Object arg0) { - return localizer.localize(localizablePARSING_SAX_EXCEPTION_WITH_SYSTEM_ID(arg0)); - } - - public static Localizable localizablePARSING_REQUIRED_EXTENSIBILITY_ELEMENT(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.requiredExtensibilityElement", arg0, arg1); - } - - /** - * unknown required extensibility element "{0}" (in namespace "{1}") - * - */ - public static String PARSING_REQUIRED_EXTENSIBILITY_ELEMENT(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_REQUIRED_EXTENSIBILITY_ELEMENT(arg0, arg1)); - } - - public static Localizable localizableENTITY_NOT_FOUND_BY_ID(Object arg0) { - return messageFactory.getMessage("entity.notFoundByID", arg0); - } - - /** - * invalid entity id: "{0}" - * - */ - public static String ENTITY_NOT_FOUND_BY_ID(Object arg0) { - return localizer.localize(localizableENTITY_NOT_FOUND_BY_ID(arg0)); - } - - public static Localizable localizableVALIDATION_EXCLUSIVE_ATTRIBUTES(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.exclusiveAttributes", arg0, arg1); - } - - /** - * exclusive attributes: "{0}", "{1}" - * - */ - public static String VALIDATION_EXCLUSIVE_ATTRIBUTES(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_EXCLUSIVE_ATTRIBUTES(arg0, arg1)); - } - - public static Localizable localizableVALIDATION_MISSING_REQUIRED_SUB_ENTITY(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.missingRequiredSubEntity", arg0, arg1); - } - - /** - * missing required sub-entity "{0}" of element "{1}" - * - */ - public static String VALIDATION_MISSING_REQUIRED_SUB_ENTITY(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_MISSING_REQUIRED_SUB_ENTITY(arg0, arg1)); - } - - public static Localizable localizableINTERNALIZER_INCORRECT_VERSION() { - return messageFactory.getMessage("Internalizer.IncorrectVersion"); - } - - /** - * JAXWS version attribute must be "2.0" - * - */ - public static String INTERNALIZER_INCORRECT_VERSION() { - return localizer.localize(localizableINTERNALIZER_INCORRECT_VERSION()); - } - - public static Localizable localizableLOCALIZED_ERROR(Object arg0) { - return messageFactory.getMessage("localized.error", arg0); - } - - /** - * {0} - * - */ - public static String LOCALIZED_ERROR(Object arg0) { - return localizer.localize(localizableLOCALIZED_ERROR(arg0)); - } - - public static Localizable localizableENTITY_DUPLICATE_WITH_TYPE(Object arg0, Object arg1) { - return messageFactory.getMessage("entity.duplicateWithType", arg0, arg1); - } - - /** - * duplicate "{0}" entity: "{1}" - * - */ - public static String ENTITY_DUPLICATE_WITH_TYPE(Object arg0, Object arg1) { - return localizer.localize(localizableENTITY_DUPLICATE_WITH_TYPE(arg0, arg1)); - } - - public static Localizable localizablePARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(Object arg0) { - return messageFactory.getMessage("parsing.onlyOneOfElementOrTypeRequired", arg0); - } - - /** - * only one of the "element" or "type" attributes is allowed in part "{0}" - * - */ - public static String PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(Object arg0) { - return localizer.localize(localizablePARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(arg0)); - } - - public static Localizable localizablePARSING_INCORRECT_ROOT_ELEMENT(Object arg0, Object arg1, Object arg2, Object arg3) { - return messageFactory.getMessage("parsing.incorrectRootElement", arg0, arg1, arg2, arg3); - } - - /** - * expected root element "{2}" (in namespace "{3}"), found element "{0}" (in namespace "{1}") - * - */ - public static String PARSING_INCORRECT_ROOT_ELEMENT(Object arg0, Object arg1, Object arg2, Object arg3) { - return localizer.localize(localizablePARSING_INCORRECT_ROOT_ELEMENT(arg0, arg1, arg2, arg3)); - } - - public static Localizable localizableTRY_WITH_MEX(Object arg0) { - return messageFactory.getMessage("try.with.mex", arg0); - } - - /** - * {0} - * - * retrying with MEX... - * - */ - public static String TRY_WITH_MEX(Object arg0) { - return localizer.localize(localizableTRY_WITH_MEX(arg0)); - } - - public static Localizable localizableVALIDATION_MISSING_REQUIRED_ATTRIBUTE(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.missingRequiredAttribute", arg0, arg1); - } - - /** - * missing required attribute "{0}" of element "{1}" - * - */ - public static String VALIDATION_MISSING_REQUIRED_ATTRIBUTE(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_MISSING_REQUIRED_ATTRIBUTE(arg0, arg1)); - } - - public static Localizable localizableINTERNALIZER_X_PATH_EVAULATES_TO_TOO_MANY_TARGETS(Object arg0, Object arg1) { - return messageFactory.getMessage("internalizer.XPathEvaulatesToTooManyTargets", arg0, arg1); - } - - /** - * XPath evaluation of "{0}" results in too many ({1}) target nodes - * - */ - public static String INTERNALIZER_X_PATH_EVAULATES_TO_TOO_MANY_TARGETS(Object arg0, Object arg1) { - return localizer.localize(localizableINTERNALIZER_X_PATH_EVAULATES_TO_TOO_MANY_TARGETS(arg0, arg1)); - } - - public static Localizable localizablePARSING_IO_EXCEPTION(Object arg0) { - return messageFactory.getMessage("parsing.ioException", arg0); - } - - /** - * parsing failed: {0} - * - */ - public static String PARSING_IO_EXCEPTION(Object arg0) { - return localizer.localize(localizablePARSING_IO_EXCEPTION(arg0)); - } - - public static Localizable localizablePARSER_NOT_A_BINDING_FILE(Object arg0, Object arg1) { - return messageFactory.getMessage("Parser.NotABindingFile", arg0, arg1); - } - - /** - * not an external binding file. The root element must be '{'http://java.sun.com/xml/ns/jaxws'}'bindings but it is '{'{0}'}'{1} - * - */ - public static String PARSER_NOT_A_BINDING_FILE(Object arg0, Object arg1) { - return localizer.localize(localizablePARSER_NOT_A_BINDING_FILE(arg0, arg1)); - } - - public static Localizable localizablePARSING_UNKNOWN_NAMESPACE_PREFIX(Object arg0) { - return messageFactory.getMessage("parsing.unknownNamespacePrefix", arg0); - } - - /** - * undeclared namespace prefix: "{0}" - * - */ - public static String PARSING_UNKNOWN_NAMESPACE_PREFIX(Object arg0) { - return localizer.localize(localizablePARSING_UNKNOWN_NAMESPACE_PREFIX(arg0)); - } - - public static Localizable localizablePARSING_FACTORY_CONFIG_EXCEPTION(Object arg0) { - return messageFactory.getMessage("parsing.factoryConfigException", arg0); - } - - /** - * invalid WSDL file! parsing failed: {0} - * - */ - public static String PARSING_FACTORY_CONFIG_EXCEPTION(Object arg0) { - return localizer.localize(localizablePARSING_FACTORY_CONFIG_EXCEPTION(arg0)); - } - - public static Localizable localizableVALIDATION_MISSING_REQUIRED_PROPERTY(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.missingRequiredProperty", arg0, arg1); - } - - /** - * missing required property "{0}" of element "{1}" - * - */ - public static String VALIDATION_MISSING_REQUIRED_PROPERTY(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_MISSING_REQUIRED_PROPERTY(arg0, arg1)); - } - - public static Localizable localizablePARSING_INVALID_OPERATION_STYLE(Object arg0) { - return messageFactory.getMessage("parsing.invalidOperationStyle", arg0); - } - - /** - * operation "{0}" has an invalid style - * - */ - public static String PARSING_INVALID_OPERATION_STYLE(Object arg0) { - return localizer.localize(localizablePARSING_INVALID_OPERATION_STYLE(arg0)); - } - - public static Localizable localizableINTERNALIZER_X_PATH_EVALUATION_ERROR(Object arg0) { - return messageFactory.getMessage("internalizer.XPathEvaluationError", arg0); - } - - /** - * XPath error: {0} - * - */ - public static String INTERNALIZER_X_PATH_EVALUATION_ERROR(Object arg0) { - return localizer.localize(localizableINTERNALIZER_X_PATH_EVALUATION_ERROR(arg0)); - } - - public static Localizable localizableVALIDATION_INVALID_TOKEN(Object arg0) { - return messageFactory.getMessage("validation.invalidToken", arg0); - } - - /** - * invalid token "{0}" - * - */ - public static String VALIDATION_INVALID_TOKEN(Object arg0) { - return localizer.localize(localizableVALIDATION_INVALID_TOKEN(arg0)); - } - - public static Localizable localizableVALIDATION_INVALID_SUB_ENTITY(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.invalidSubEntity", arg0, arg1); - } - - /** - * invalid sub-element "{0}" of element "{1}" - * - */ - public static String VALIDATION_INVALID_SUB_ENTITY(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INVALID_SUB_ENTITY(arg0, arg1)); - } - - public static Localizable localizableVALIDATION_SHOULD_NOT_HAPPEN(Object arg0) { - return messageFactory.getMessage("validation.shouldNotHappen", arg0); - } - - /** - * internal error ("{0}") - * - */ - public static String VALIDATION_SHOULD_NOT_HAPPEN(Object arg0) { - return localizer.localize(localizableVALIDATION_SHOULD_NOT_HAPPEN(arg0)); - } - - public static Localizable localizableABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(Object arg0, Object arg1) { - return messageFactory.getMessage("AbstractReferenceFinderImpl.UnableToParse", arg0, arg1); - } - - /** - * Unable to parse "{0}" : {1} - * - */ - public static String ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(Object arg0, Object arg1) { - return localizer.localize(localizableABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(arg0, arg1)); - } - - public static Localizable localizableWARNING_FAULT_EMPTY_ACTION(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("warning.faultEmptyAction", arg0, arg1, arg2); - } - - /** - * ignoring empty Action in "{0}" {1} element of "{2}" operation, using default instead - * - */ - public static String WARNING_FAULT_EMPTY_ACTION(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableWARNING_FAULT_EMPTY_ACTION(arg0, arg1, arg2)); - } - - public static Localizable localizablePARSING_INVALID_EXTENSION_ELEMENT(Object arg0, Object arg1) { - return messageFactory.getMessage("parsing.invalidExtensionElement", arg0, arg1); - } - - /** - * invalid extension element: "{0}" (in namespace "{1}") - * - */ - public static String PARSING_INVALID_EXTENSION_ELEMENT(Object arg0, Object arg1) { - return localizer.localize(localizablePARSING_INVALID_EXTENSION_ELEMENT(arg0, arg1)); - } - - public static Localizable localizableINTERNALIZER_X_PATH_EVALUATES_TO_NON_ELEMENT(Object arg0) { - return messageFactory.getMessage("internalizer.XPathEvaluatesToNonElement", arg0); - } - - /** - * XPath evaluation of "{0}" needs to result in an element. - * - */ - public static String INTERNALIZER_X_PATH_EVALUATES_TO_NON_ELEMENT(Object arg0) { - return localizer.localize(localizableINTERNALIZER_X_PATH_EVALUATES_TO_NON_ELEMENT(arg0)); - } - - public static Localizable localizableINTERNALIZER_X_PATH_EVALUATES_TO_NO_TARGET(Object arg0) { - return messageFactory.getMessage("internalizer.XPathEvaluatesToNoTarget", arg0); - } - - /** - * XPath evaluation of "{0}" results in an empty target node - * - */ - public static String INTERNALIZER_X_PATH_EVALUATES_TO_NO_TARGET(Object arg0) { - return localizer.localize(localizableINTERNALIZER_X_PATH_EVALUATES_TO_NO_TARGET(arg0)); - } - - public static Localizable localizablePARSING_SAX_EXCEPTION(Object arg0) { - return messageFactory.getMessage("parsing.saxException", arg0); - } - - /** - * invalid WSDL file! parsing failed: {0} - * - */ - public static String PARSING_SAX_EXCEPTION(Object arg0) { - return localizer.localize(localizablePARSING_SAX_EXCEPTION(arg0)); - } - - public static Localizable localizableINVALID_CUSTOMIZATION_NAMESPACE(Object arg0) { - return messageFactory.getMessage("invalid.customization.namespace", arg0); - } - - /** - * Ignoring customization: "{0}", because it has no namespace. It must belong to the customization namespace. - * - */ - public static String INVALID_CUSTOMIZATION_NAMESPACE(Object arg0) { - return localizer.localize(localizableINVALID_CUSTOMIZATION_NAMESPACE(arg0)); - } - - public static Localizable localizableVALIDATION_INVALID_ATTRIBUTE(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.invalidAttribute", arg0, arg1); - } - - /** - * invalid attribute "{0}" of element "{1}" - * - */ - public static String VALIDATION_INVALID_ATTRIBUTE(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INVALID_ATTRIBUTE(arg0, arg1)); - } - - public static Localizable localizablePARSING_PARSER_CONFIG_EXCEPTION(Object arg0) { - return messageFactory.getMessage("parsing.parserConfigException", arg0); - } - - /** - * invalid WSDL file! parsing failed: {0} - * - */ - public static String PARSING_PARSER_CONFIG_EXCEPTION(Object arg0) { - return localizer.localize(localizablePARSING_PARSER_CONFIG_EXCEPTION(arg0)); - } - - public static Localizable localizablePARSING_ONLY_ONE_TYPES_ALLOWED(Object arg0) { - return messageFactory.getMessage("parsing.onlyOneTypesAllowed", arg0); - } - - /** - * only one "types" element allowed in "{0}" - * - */ - public static String PARSING_ONLY_ONE_TYPES_ALLOWED(Object arg0) { - return localizer.localize(localizablePARSING_ONLY_ONE_TYPES_ALLOWED(arg0)); - } - - public static Localizable localizablePARSING_INVALID_URI(Object arg0) { - return messageFactory.getMessage("parsing.invalidURI", arg0); - } - - /** - * invalid URI: {0} - * - */ - public static String PARSING_INVALID_URI(Object arg0) { - return localizer.localize(localizablePARSING_INVALID_URI(arg0)); - } - - public static Localizable localizableVALIDATION_INCORRECT_TARGET_NAMESPACE(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.incorrectTargetNamespace", arg0, arg1); - } - - /** - * target namespace is incorrect (expected: {1}, found: {0}) - * - */ - public static String VALIDATION_INCORRECT_TARGET_NAMESPACE(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INCORRECT_TARGET_NAMESPACE(arg0, arg1)); - } - - public static Localizable localizableENTITY_NOT_FOUND_BY_Q_NAME(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("entity.notFoundByQName", arg0, arg1, arg2); - } - - /** - * {0} "{1}" not found in the wsdl: {2} - * - */ - public static String ENTITY_NOT_FOUND_BY_Q_NAME(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizableENTITY_NOT_FOUND_BY_Q_NAME(arg0, arg1, arg2)); - } - - public static Localizable localizableINVALID_WSDL(Object arg0, Object arg1, Object arg2, Object arg3) { - return messageFactory.getMessage("invalid.wsdl", arg0, arg1, arg2, arg3); - } - - /** - * Invalid WSDL {0}, expected {1} found {2} at (line {3}) - * - */ - public static String INVALID_WSDL(Object arg0, Object arg1, Object arg2, Object arg3) { - return localizer.localize(localizableINVALID_WSDL(arg0, arg1, arg2, arg3)); - } - - public static Localizable localizableVALIDATION_UNSUPPORTED_SCHEMA_FEATURE(Object arg0) { - return messageFactory.getMessage("validation.unsupportedSchemaFeature", arg0); - } - - /** - * unsupported XML Schema feature: "{0}" - * - */ - public static String VALIDATION_UNSUPPORTED_SCHEMA_FEATURE(Object arg0) { - return localizer.localize(localizableVALIDATION_UNSUPPORTED_SCHEMA_FEATURE(arg0)); - } - - public static Localizable localizablePARSING_UNKNOWN_IMPORTED_DOCUMENT_TYPE(Object arg0) { - return messageFactory.getMessage("parsing.unknownImportedDocumentType", arg0); - } - - /** - * imported document is of unknown type: {0} - * - */ - public static String PARSING_UNKNOWN_IMPORTED_DOCUMENT_TYPE(Object arg0) { - return localizer.localize(localizablePARSING_UNKNOWN_IMPORTED_DOCUMENT_TYPE(arg0)); - } - - public static Localizable localizablePARSING_IO_EXCEPTION_WITH_SYSTEM_ID(Object arg0) { - return messageFactory.getMessage("parsing.ioExceptionWithSystemId", arg0); - } - - /** - * failed to parse document at "{0}" - * - */ - public static String PARSING_IO_EXCEPTION_WITH_SYSTEM_ID(Object arg0) { - return localizer.localize(localizablePARSING_IO_EXCEPTION_WITH_SYSTEM_ID(arg0)); - } - - public static Localizable localizableVALIDATION_AMBIGUOUS_NAME(Object arg0) { - return messageFactory.getMessage("validation.ambiguousName", arg0); - } - - /** - * ambiguous operation name: "{0}" - * - */ - public static String VALIDATION_AMBIGUOUS_NAME(Object arg0) { - return localizer.localize(localizableVALIDATION_AMBIGUOUS_NAME(arg0)); - } - - public static Localizable localizablePARSING_WSDL_NOT_DEFAULT_NAMESPACE(Object arg0) { - return messageFactory.getMessage("parsing.wsdlNotDefaultNamespace", arg0); - } - - /** - * default namespace must be "{0}" - * - */ - public static String PARSING_WSDL_NOT_DEFAULT_NAMESPACE(Object arg0) { - return localizer.localize(localizablePARSING_WSDL_NOT_DEFAULT_NAMESPACE(arg0)); - } - - public static Localizable localizableVALIDATION_DUPLICATED_ELEMENT(Object arg0) { - return messageFactory.getMessage("validation.duplicatedElement", arg0); - } - - /** - * duplicated element: "{0}" - * - */ - public static String VALIDATION_DUPLICATED_ELEMENT(Object arg0) { - return localizer.localize(localizableVALIDATION_DUPLICATED_ELEMENT(arg0)); - } - - public static Localizable localizableINTERNALIZER_TARGET_NOT_AN_ELEMENT() { - return messageFactory.getMessage("internalizer.targetNotAnElement"); - } - - /** - * Target node is not an element - * - */ - public static String INTERNALIZER_TARGET_NOT_AN_ELEMENT() { - return localizer.localize(localizableINTERNALIZER_TARGET_NOT_AN_ELEMENT()); - } - - public static Localizable localizableWARNING_INPUT_OUTPUT_EMPTY_ACTION(Object arg0, Object arg1) { - return messageFactory.getMessage("warning.inputOutputEmptyAction", arg0, arg1); - } - - /** - * ignoring empty Action in {0} element of "{1}" operation, using default instead - * - */ - public static String WARNING_INPUT_OUTPUT_EMPTY_ACTION(Object arg0, Object arg1) { - return localizer.localize(localizableWARNING_INPUT_OUTPUT_EMPTY_ACTION(arg0, arg1)); - } - - public static Localizable localizablePARSING_INVALID_TAG_NS(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) { - return messageFactory.getMessage("parsing.invalidTagNS", arg0, arg1, arg2, arg3, arg4); - } - - /** - * Invalid WSDL at {4}: expected element "{2}" (in namespace "{3}"), found element "{0}" (in namespace "{1}") - * - */ - public static String PARSING_INVALID_TAG_NS(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) { - return localizer.localize(localizablePARSING_INVALID_TAG_NS(arg0, arg1, arg2, arg3, arg4)); - } - - public static Localizable localizableINVALID_WSDL_WITH_DOOC(Object arg0, Object arg1) { - return messageFactory.getMessage("invalid.wsdl.with.dooc", arg0, arg1); - } - - /** - * "Not a WSDL document: {0}, it gives "{1}", retrying with MEX..." - * - */ - public static String INVALID_WSDL_WITH_DOOC(Object arg0, Object arg1) { - return localizer.localize(localizableINVALID_WSDL_WITH_DOOC(arg0, arg1)); - } - - public static Localizable localizablePARSING_NOT_AWSDL(Object arg0) { - return messageFactory.getMessage("Parsing.NotAWSDL", arg0); - } - - /** - * Failed to get WSDL components, probably {0} is not a valid WSDL file. - * - */ - public static String PARSING_NOT_AWSDL(Object arg0) { - return localizer.localize(localizablePARSING_NOT_AWSDL(arg0)); - } - - public static Localizable localizableENTITY_DUPLICATE(Object arg0) { - return messageFactory.getMessage("entity.duplicate", arg0); - } - - /** - * duplicate entity: "{0}" - * - */ - public static String ENTITY_DUPLICATE(Object arg0) { - return localizer.localize(localizableENTITY_DUPLICATE(arg0)); - } - - public static Localizable localizableWARNING_WSI_R_2004() { - return messageFactory.getMessage("warning.wsi.r2004"); - } - - /** - * Not a WSI-BP compliant WSDL (R2001, R2004). xsd:import must not import XML Schema definitions embedded inline within the WSDL document. - * - */ - public static String WARNING_WSI_R_2004() { - return localizer.localize(localizableWARNING_WSI_R_2004()); - } - - public static Localizable localizableWARNING_WSI_R_2003() { - return messageFactory.getMessage("warning.wsi.r2003"); - } - - /** - * Not a WSI-BP compliant WSDL (R2003). xsd:import must only be used inside xsd:schema elements. - * - */ - public static String WARNING_WSI_R_2003() { - return localizer.localize(localizableWARNING_WSI_R_2003()); - } - - public static Localizable localizableWARNING_WSI_R_2002(Object arg0, Object arg1) { - return messageFactory.getMessage("warning.wsi.r2002", arg0, arg1); - } - - /** - * Not a WSI-BP compliant WSDL (R2002). wsdl:import must not be used to import XML Schema embedded in the WSDL document. Expected wsdl namespace: {0}, found: {1} - * - */ - public static String WARNING_WSI_R_2002(Object arg0, Object arg1) { - return localizer.localize(localizableWARNING_WSI_R_2002(arg0, arg1)); - } - - public static Localizable localizablePARSING_ELEMENT_OR_TYPE_REQUIRED(Object arg0) { - return messageFactory.getMessage("parsing.elementOrTypeRequired", arg0); - } - - /** - * warning: part {0} is ignored, either the "element" or the "type" attribute is required in part "{0}" - * - */ - public static String PARSING_ELEMENT_OR_TYPE_REQUIRED(Object arg0) { - return localizer.localize(localizablePARSING_ELEMENT_OR_TYPE_REQUIRED(arg0)); - } - - public static Localizable localizableWARNING_WSI_R_2001() { - return messageFactory.getMessage("warning.wsi.r2001"); - } - - /** - * Not a WSI-BP compliant WSDL (R2001, R2002). wsdl:import must import only WSDL documents. It's trying to import: "{0}" - * - */ - public static String WARNING_WSI_R_2001() { - return localizer.localize(localizableWARNING_WSI_R_2001()); - } - - public static Localizable localizableFILE_NOT_FOUND(Object arg0) { - return messageFactory.getMessage("file.not.found", arg0); - } - - /** - * {0} is unreachable - * - */ - public static String FILE_NOT_FOUND(Object arg0) { - return localizer.localize(localizableFILE_NOT_FOUND(arg0)); - } - - public static Localizable localizableVALIDATION_INVALID_SIMPLE_TYPE_IN_ELEMENT(Object arg0, Object arg1) { - return messageFactory.getMessage("validation.invalidSimpleTypeInElement", arg0, arg1); - } - - /** - * invalid element: "{1}", has named simpleType: "{0}" - * - */ - public static String VALIDATION_INVALID_SIMPLE_TYPE_IN_ELEMENT(Object arg0, Object arg1) { - return localizer.localize(localizableVALIDATION_INVALID_SIMPLE_TYPE_IN_ELEMENT(arg0, arg1)); - } - - public static Localizable localizablePARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(Object arg0) { - return messageFactory.getMessage("parsing.onlyOneDocumentationAllowed", arg0); - } - - /** - * only one "documentation" element allowed in "{0}" - * - */ - public static String PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(Object arg0) { - return localizer.localize(localizablePARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(arg0)); - } - - public static Localizable localizableINTERNALIZER_VERSION_NOT_PRESENT() { - return messageFactory.getMessage("Internalizer.VersionNotPresent"); - } - - /** - * JAXWS version attribute must be present - * - */ - public static String INTERNALIZER_VERSION_NOT_PRESENT() { - return localizer.localize(localizableINTERNALIZER_VERSION_NOT_PRESENT()); - } - - public static Localizable localizableFAILED_NOSERVICE(Object arg0) { - return messageFactory.getMessage("failed.noservice", arg0); - } - - /** - * failed.noservice=Could not find wsdl:service in the provided WSDL(s): - * - * {0} At least one WSDL with at least one service definition needs to be provided. - * - */ - public static String FAILED_NOSERVICE(Object arg0) { - return localizer.localize(localizableFAILED_NOSERVICE(arg0)); - } - - public static Localizable localizablePARSING_TOO_MANY_ELEMENTS(Object arg0, Object arg1, Object arg2) { - return messageFactory.getMessage("parsing.tooManyElements", arg0, arg1, arg2); - } - - /** - * too many "{0}" elements under "{1}" element "{2}" - * - */ - public static String PARSING_TOO_MANY_ELEMENTS(Object arg0, Object arg1, Object arg2) { - return localizer.localize(localizablePARSING_TOO_MANY_ELEMENTS(arg0, arg1, arg2)); - } - - public static Localizable localizableINTERNALIZER_INCORRECT_SCHEMA_REFERENCE(Object arg0, Object arg1) { - return messageFactory.getMessage("Internalizer.IncorrectSchemaReference", arg0, arg1); - } - - /** - * "{0}" is not a part of this compilation. Is this a mistake for "{1}"? - * - */ - public static String INTERNALIZER_INCORRECT_SCHEMA_REFERENCE(Object arg0, Object arg1) { - return localizer.localize(localizableINTERNALIZER_INCORRECT_SCHEMA_REFERENCE(arg0, arg1)); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/configuration.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/configuration.properties deleted file mode 100644 index 2a476ee4b0c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/configuration.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1}) -configuration.notBindingFile=Ignoring: binding file "\"{0}\". It is not a jaxws or a jaxb binding file. diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/generator.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/generator.properties deleted file mode 100644 index 3d82a4556f0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/generator.properties +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -# Generator -generator.nestedGeneratorError=generator error: {0} -generator.cant.write=can''t write file: {0} -generator.cannot.create.dir=can''t create directory: {0} -generator.internal.error.should.not.happen=internal error (should not happen): {0} - - -#IndentingWriter -generator.indentingwriter.charset.cantencode=WSDL has some characters which native java encoder can''t encode: \"{0}\" -generator.sei.classAlreadyExist=Could not generate SEI, class: {0} already exists. Rename wsdl:portType \"{1}\" using JAX-WS customization -generator.service.classAlreadyExist=Could not generate Service, class: {0} already exists. Rename wsdl:Service \"{1}\" using JAX-WS customization diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/javacompiler.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/javacompiler.properties deleted file mode 100644 index 2d7cc5461e7..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/javacompiler.properties +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -# -# Generic Messages -# -javacompiler.classpath.error={0} is not available in the classpath, requires Sun's JDK version 5.0 or latter. -javacompiler.nosuchmethod.error=There is no such method {0} available, requires Sun's JDK version 5.0 or latter. -javacompiler.error=error : {0}. diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/model.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/model.properties deleted file mode 100644 index 1ed355769af..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/model.properties +++ /dev/null @@ -1,92 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - - -model.nestedModelError=model error: {0} -model.duplicate.porttype=duplicate PortType added to model: {0} -model.duplicate.operation=duplicate Operation added to model: {0} -model.duplicate.faultmessage=duplicate fault message added to model: {0} -model.duplicate.part=duplicate part added to model: {0} -model.duplicate.property=duplicate property added to model: {0} -model.duplicate.service=duplicate service added to model: {0} -model.invalid.message.type=invalid message type: {0} - -model.schema.notImplemented=unsupported XML Schema feature ({0}) -model.schema.circularity=circularity detected in schema: \"{0}\" - -model.schema.unsupportedType=unsupported type ({0}): \"{1}\" (namespace: {2}) -model.schema.unsupportedType.anonymous=unsupported anonymous type ({0}) -model.schema.invalidLiteralInEnumeration=invalid literal \"{0}\" in enumeration \"{1}\" (namespace: {2}) -model.schema.invalidLiteralInEnumeration.anonymous=invalid literal \"{0}\" in anonymous enumeration - -model.schema.notImplemented.generatingSOAPElement=unsupported XML Schema feature: \"{0}\" in component {1}, mapping it to javax.xml.soap.SOAPElement - -//replacement for Uxxx codes -model.schema.unsupportedSchemaType=unsupported schema type: \"{0}\" -model.schema.invalidSimpleType=invalid simpleType: \"{0}\" -model.schema.invalidSimpleType.noJavaType=no java mapping for simpleType: \"{0}\" -model.schema.simpleTypeWithFacets=facet \"{0}\" not supported on simple type: \"{0}\" -model.schema.unionNotSupported=simpleType: \"{0}\" derivation by xsd:union not supported -model.schema.listNotSupported=simpleType: \"{0}\" derivation by xsd:list not supported -model.schema.invalidSimpleType.invalidItemType=in simpleType: \"{0}\", itemType \"{1}\" can not be derived by list -model.schema.invalidSimpleType.noItemLiteralType=in simpleType: \"{0}\", xsd:list itemType \"{1}\" is invalid -model.schema.invalidSimpleType.noNamespaceURI=invalid simpleType: \"{0}\", had null namespaceURI -model.schema.encoderNotFound=no encoder found for simpleType: \"{0}\" -model.schema.invalidWildcard.allCompositor=xsd:all compositor not supported for the wildcard in schema type: \"{0}\" - -model.uniqueness=uniqueness constraint violation -model.part.notUnique=parts in wsdl:message \"{0}\", reference \"{1}\", they must reference unique global elements. -model.exception.notunique=Failed to generate Java signature: duplicate exception names {0}. Use JAXWS binding customization to rename the wsdl:part \"{1}\" -model.uniqueness.javastructuretype=uniqueness constraint violation, duplicate member \"{0}\" added to JavaStructureType \"{1}\" -model.parent.type.already.set=parent of type \"{0}\" already set to \"{1}\", new value = \"{2}\" -model.parent.fault.already.set=parent of fault \"{0}\" already set to \"{1}\", new value = \"{2}\" -model.exporter.unsupportedClass=model exporter: unsupported class: {0} -model.importer.nonModel=not a valid model document -model.importer.syntaxError=syntax error in model document (line {0}) -model.importer.invalidVersion=invalid version \"{1}\" in model document (line {0}) -model.importer.invalidMinorMinorOrPatchVersion=model version \"{1}\" newer than runtime version \"{2}\" (line {0}): need to upgrade to a newer runtime -model.importer.invalidClass=invalid class name \"{1}\" in model document (line {0}) -model.importer.invalidId=invalid id \"{1}\ in model document (line {0}) -model.importer.invalidLiteral=invalid literal value in model document (line {0}) -model.importer.invalidProperty=invalid property in model document (line {0} -model.arraywrapper.only.one.member=LiteralArrayWrapper may only have one element member. -model.arraywrapper.member.already.set=LiteralArrayWrapper element member already set. -model.arraywrapper.no.parent=LiteralArrayWrapper cannot have a parent type -model.arraywrapper.no.subtypes=LiteralArrayWrapper cannot have subtypes -model.arraywrapper.no.content.member=LiteralArrayWrapper cannot have a content member -model.complexType.simpleContent.reservedName=invalid attribute name: "_value" in complexType: \"{0}\", _value is JAXWS reserved name, this name is generated in the generated javabean class to hold content value in the generated javabean class for complexType/simpleContent. -model.parameter.notunique.wrapper=Failed to generate Java signature: duplicate parameter name \"{0}\". Try one of these\n\t1. Use JAXWS binding customization to rename the wsdl:part \"{1}\"\n\t2. Run wsimport with -extension switch.\n\t3. This is wrapper style operation, to resolve parameter name conflict, you can also try disabling wrapper style by using false wsdl customization. -model.parameter.notunique=Failed to generate Java signature: duplicate parameter name \"{0}\". Try one of these\n\t1. Use JAXWS binding customization to rename the wsdl:part \"{1}\"\n\t2. Run wsimport with -extension switch. - -#JAXWS 2.0 -model.schema.elementNotFound=Element \"{0}\" not found. -model.schema.jaxbException.message="{0}" -model.saxparser.exception:{0}\n{1} - -ConsoleErrorReporter.UnknownLocation = \ - unknown location - -ConsoleErrorReporter.LineXOfY = \ - \ \ line {0} of {1} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/modeler.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/modeler.properties deleted file mode 100644 index dee7df8099a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/modeler.properties +++ /dev/null @@ -1,218 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -# general -modeler.nestedModelError=modeler error: {0} - - -# WSDLModeler -wsdlmodeler.multipleOutputParameters=multiple \"out\" parameters in operation: {0} -wsdlmodeler.invalidOperation=invalid operation: {0} -wsdlmodeler.invalidState.modelingOperation=invalid state while modeling operation: {0} -wsdlmodeler.resultIsInOutParameter=result is \"inout\" parameter in operation: {0} -wsdlmodeler.invalid.parameterorder.parameter=\"{0}\" specified in the parameterOrder attribute of operation \"{1}\" is not a valid part of the message. -wsdlmodeler.invalid.parameterOrder.tooManyUnmentionedParts=more than one part left out in the parameterOrder attribute of operation \"{0}\" -wsdlmodeler.invalid.parameterOrder.invalidParameterOrder=parameterOrder attribute on operation \"{0}\" is invalid, ignoring parameterOrder hint -wsdlmodeler.invalid.parameter.differentTypes=parameter \"{0}\" of operation \"{1}\" appears with different types in the input and output messages -wsdlmodeler.invalid.bindingOperation.notInPortType=in binding \"{1}\", operation \"{0}\" does not appear in the corresponding port type -wsdlmodeler.invalid.bindingOperation.inputMissingSoapBody=input message of binding operation \"{0}\" does not have a SOAP body extension -wsdlmodeler.invalid.bindingOperation.outputMissingSoapBody=output message of binding operation \"{0}\" does not have a SOAP body extension -wsdlmodeler.invalid.bindingOperation.missingInputName=binding operation \"{0}\" must specify a name for its input message -wsdlmodeler.invalid.bindingOperation.missingOutputName=binding operation \"{0}\" must specify a name for its output message -wsdlmodeler.invalid.bindingOperation.multipleMatchingOperations=in binding \"{1}\", operation \"{0}\" does not reference a unique operation in the corresponding port type -wsdlmodeler.invalid.bindingOperation.notFound=in binding \"{1}\", operation \"{0}\" does not match any operation in the corresponding port type -wsdlmodeler.invalid.bindingOperation.inputSoapBody.missingNamespace=input message of binding operation \"{0}\" must specify a value for the \"namespace\" attribute -wsdlmodeler.invalid.bindingOperation.outputSoapBody.missingNamespace=output message of binding operation \"{0}\" must specify a value for the \"namespace\" attribute -wsdlmodeler.invalid.bindingOperation.inputHeader.missingNamespace=input header \"{1}\" of binding operation \"{0}\" must specify a value for the \"namespace\" attribute -wsdlmodeler.invalid.bindingOperation.outputHeader.missingNamespace=output header \"{1}\" of binding operation \"{0}\" must specify a value for the \"namespace\" attribute -wsdlmodeler.invalid.bindingFault.notUnique=fault \"{0}\" in operation \"{1}\" matches more than one fault in the corresponding port type operation -wsdlmodeler.invalid.bindingFault.notFound=fault \"{0}\" in operation \"{1}\" does not match any fault in the corresponding port type operation -wsdlmodeler.invalid.bindingFault.outputMissingSoapFault=fault \"{0}\" in operation \"{1}\" does not have a SOAP fault extension -wsdlmodeler.invalid.bindingFault.missingName=fault \"{0}\" in operation \"{1}\" must specify a value for the \"name\" attribute -wsdlmodeler.invalid.bindingFault.missingNamespace=fault \"{0}\" in operation \"{1}\" must specify a value for the \"namespace\" attribute -wsdlmodeler.invalid.bindingFault.emptyMessage=fault \"{0}\" refers to message \"{1}\", but the message has no parts -wsdlmodeler.invalid.bindingFault.messageHasMoreThanOnePart=fault \"{0}\" refers to message \"{1}\", but the message has more than one parts -wsdlmodeler.invalid.message.partMustHaveTypeDescriptor=in message \"{0}\", part \"{1}\" must specify a \"type\" attribute -wsdlmodeler.invalid.message.partMustHaveElementDescriptor=in message \"{0}\", part \"{1}\" must specify a \"element\" attribute -wsdlmodeler.invalid=invalid WSDL document -wsdlmodeler.unsolvableNamingConflicts=the following naming conflicts occurred: {0} -# -wsdlmodeler.warning.ignoringUnrecognizedSchemaExtension=ignoring schema element (unsupported version): {0} -wsdlmodeler.warning.searchSchema.unrecognizedTypes=encountered {0} unrecognized type(s) -wsdlmodeler.warning.noServiceDefinitionsFound=WSDL document does not define any services -wsdlmodeler.warning.noPortsInService=Service \"{0}\" does not contain any usable ports. try running wsimport with -extension switch. -wsdlmodeler.warning.noOperationsInPort=Port \"{0}\" does not contain any usable operations -wsdlmodeler.warning.ignoringNonSOAPPort=ignoring port \"{0}\": not a standard SOAP port. try running wsimport with -extension switch. -wsdlmodeler.warning.nonSOAPPort=port \"{0}\": not a standard SOAP port. The generated artifacts may not work with JAXWS runtime. -wsdlmodeler.warning.ignoringNonSOAPPort.noAddress=ignoring port \"{0}\": no SOAP address specified. try running wsimport with -extension switch. -wsdlmodeler.warning.noSOAPAddress=port \"{0}\" is not a SOAP port, it has no soap:address -wsdlmodeler.warning.ignoringSOAPBinding.nonHTTPTransport:ignoring SOAP port \"{0}\": unrecognized transport. try running wsimport with -extension switch. - -#BP1.1 R2705 -wsdlmodeler.warning.ignoringSOAPBinding.mixedStyle=ignoring port \"{0}\", its not WS-I BP 1.1 compliant: the wsdl binding has mixed style, it must be rpc-literal or document-literal operation. try running wsimport with -extension switch. -wsdlmodeler.warning.port.SOAPBinding.mixedStyle=not a WS-I BP1.1 compliant SOAP port \"{0}\": the wsdl binding has mixed style, it must be rpc-literal or document-literal operation! - -wsdlmodeler.warning.ignoringOperation.notSupportedStyle=ignoring operation \"{0}\": not request-response or one-way -wsdlmodeler.invalid.operation.notSupportedStyle=Invalid WSDL, wsdl:operation \"{0}\" in wsdl:portType \"{1}\": not request-response or one-way -wsdlmodeler.warning.ignoringOperation.notEncoded=ignoring RPC-style operation \"{0}\": parameters are not encoded -wsdlmodeler.warning.ignoringOperation.cannotHandleBodyPartsAttribute=ignoring operation \"{0}\": cannot handle \"parts\" attribute of \"soap:body\" element - -wsdlmodeler.warning.ignoringOperation.cannotHandleTypeMessagePart=ignoring operation \"{0}\": message part does not refer to a schema element declaration -wsdlmodeler.invalid.doclitoperation=Invalid wsdl:operation \"{0}\": its a document-literal operation, message part must refer to a schema element declaration - -wsdlmodeler.warning.ignoringOperation.cannotHandleElementMessagePart=ignoring operation \"{0}\": message part does not refer to a schema type declaration -wsdlmodeler.invalid.rpclitoperation=Invalid wsdl:operation \"{0}\": its a rpc-literal operation, message part must refer to a schema type declaration - - -wsdlmodeler.warning.ignoringOperation.cannotHandleDocumentStyle=ignoring operation \"{0}\": cannot handle document-style operations -wsdlmodeler.warning.bindingOperation.multiplePartBinding=Check the abstract operation \"{0}\" binding, part \"{1}\" has multiple binding. Will try to generated artiffacts anyway... -wsdlmodeler.invalid.bindingOperation.multiplePartBinding=abstract operation \"{0}\" binding, part \"{1}\" has multiple binding. -wsdlmodeler.warning.ignoringFaults=ignoring faults declared by operation \"{0}\" -wsdlmodeler.warning.ignoringFault.notEncoded=ignoring literal fault \"{0}\" of binding operation \"{1}\" -wsdlmodeler.warning.ignoringFault.notLiteral=ignoring encoded fault \"{0}\" of binding operation \"{1}\" -wsdlmodeler.invalid.operation.fault.notLiteral=ignoring encoded fault \"{0}\" in literal binding operation \"{1}\" -wsdlmodeler.warning.ignoringHeader=ignoring header \"{0}\" of binding operation \"{1}\" -wsdlmodeler.warning.ignoringHeader.partFromBody=header part: \"{0}\" already bound by soapbind:body, illegal to bind the part twice -wsdlmodeler.warning.ignoringHeader.notLiteral=ignoring header \"{0}\" of binding operation \"{1}\": not literal -wsdlmodeler.invalid.header.notLiteral=Invalid header \"{0}\" of binding operation \"{1}\": not literal -wsdlmodeler.warning.ignoringHeader.notFound=ignoring header \"{0}\" of binding operation \"{1}\": not found -wsdlmodeler.invalid.header.notFound=header \"{0}\" of binding operation \"{1}\": not found -wsdlmodeler.warning.ignoringHeader.cant.resolve.message=ignoring header \"{0}\" of binding operation \"{1}\": cannot resolve message -wsdlmodeler.invalid.header.cant.resolve.message=header \"{0}\" of binding operation \"{1}\": cannot resolve message - -wsdlmodeler.warning.ignoringFault.cant.resolve.message=ignoring fault \"{0}\" of binding operation \"{1}\": cannot resolve message -wsdlmodeler.invalid.fault.cant.resolve.message=fault message \"{0}\" in binding operation \"{1}\" could not be resolved - -wsdlmodeler.warning.ignoringHeader.notEncoded=ignoring header \"{0}\" of binding operation \"{1}\": not SOAP-encoded -wsdlmodeler.warning.ignoringHeader.inconsistentDefinition=ignoring header \"{0}\" of operation \"{1}\": part not found -# -wsdlmodeler.warning.ignoringOperation.notLiteral=ignoring document-style operation \"{0}\": parameters are not literal -wsdlmodeler.warning.ignoringOperation.cannotHandleMoreThanOnePartInInputMessage=ignoring operation \"{0}\": more than one part in input message -wsdlmodeler.warning.ignoringOperation.cannotHandleEmptyInputMessage=ignoring operation \"{0}\": input message is empty -wsdlmodeler.warning.ignoringOperation.cannotHandleMoreThanOnePartInOutputMessage=ignoring operation \"{0}\": more than one part in output message -wsdlmodeler.warning.operation.MoreThanOnePartInMessage=Ingoring operation \"{0}\": more than one part bound to body -wsdlmodeler.invalid.operation.MoreThanOnePartInMessage=operation \"{0}\": more than one part bound to body -wsdlmodeler.warning.ignoringOperation.cannotHandleEmptyOutputMessage=ignoring operation \"{0}\": output message is empty -wsdlmodeler.warning.ignoringOperation.conflictStyleInWSIMode=ignoring operation \"{0}\": binding style and operation style are conflicting -wsdlmodeler.warning.ignoringOperation.partNotFound=ignoring operation \"{0}\": part \"{1}\" not found -wsdlmodeler.error.partNotFound=part \"{1}\" of operation \"{0}\" could not be resolved! -wsdlmodeler.warning.ignoringFault.documentOperation=ignoring fault \"{0}\" of document-style operation \"{1}\" -wsdlmodler.warning.operation.use=The WSDL used has operations with literal and encoded use. -f:searchschema is not supported for this scenario. -#wsdlmodeler.invalid.bindingFault.wrongSoapFaultName=The name of the SOAP fault extension does not match the name of the \"{0}\" fault in operation \"{1}\" -wsdlmodeler.invalid.bindingFault.wrongSoapFaultName=name of soap:fault \"{0}\" doesn''t match the name of wsdl:fault \"{1}\" in operation \"{2}\" -#wsdlmodeler.invalid.bindingFault.noSoapFaultName=The name of the SOAP fault extension is missing from the fault \"{0}\" in operation \"{1}\" -wsdlmodeler.invalid.bindingFault.noSoapFaultName=soap:fault name not specified, wsdl:fault \"{0}\" in operation \"{1}\" - -wsdlmodeler.duplicate.fault.part.name=ignoring fault \"{0}\" of operation \"{1}\", part name \"{2}\" is not unique -wsdlmodeler.duplicate.fault.soap.name=ignoring fault \"{0}\" of operation \"{1}\", soap:fault name \"{2}\" is not unique - -wsdlmodeler.warning.ignoringHeaderFault.notFound=ignoring header fault \"{0}\", cannot find part \"{1}\" in binding \"{2}\" -wsdlmodeler.headerfault.part.notFound=part \"{1}\" not found for the header fault \"{0}\", in binding \"{2}\" - -wsdlmodeler.warning.ignoringHeaderFault.notLiteral=ignoring header fault part=\"{0}\" message=\"{1}\" of operation {2}, use attribute MUST be \"literal\" - -wsdlmodeler.warning.ignoringHeaderFault.noElementAttribute=ignoring header fault part=\"{0}\" message=\"{1}\" of operation {2} - -wsdlmodeler.invalid.headerfault.notLiteral=Invalid headerfault \"{0}\" of binding operation \"{1}\": not literal -wsdlmodeler.invalid.headerfault.message.partMustHaveElementDescriptor=Invalid headerfault \"{0}\" for header {1} in operation {2}: part must specify a \"element\" attribute -wsdlmodeler.invalid.header.message.partMustHaveElementDescriptor=Invalid header \"{0}\" in operation {1}: part must specify a \"element\" attribute - - -#wsi warnings -wsdlmodeler.warning.nonconforming.wsdl.import=Non conforming WS-I WSDL used for wsdl:import -wsdlmodeler.warning.nonconforming.wsdl.types=Non conforming WS-I WSDL used for wsdl:types -wsdlmodeler.warning.nonconforming.wsdl.use=Processing WS-I non conforming operation \"{0}\" with RPC-Style and SOAP-encoded - -# optional parts -wsdlmodeler.error.partsNotFound=parts \"{0}\" not found in the message \"{1}\", wrong WSDL - -# soap 1.2 -wsdlmodeler.warning.port.SOAPBinding12=SOAP port \"{0}\": uses a non-standard SOAP 1.2 binding. -wsdlmodeler.warning.ignoringSOAPBinding12=Ignoring SOAP port \"{0}\": it uses non-standard SOAP 1.2 binding.\nYou must specify the \"-extension\" option to use this binding. - -#WSI-BP1.0 Warning/Errors -wsdlmodeler.warning.r2716=R2716 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit for {0}: \"{1}\" -wsdlmodeler.warning.r2716r2726=R2716/R2726 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit or rpc/lit for {0}: \"{1}\" - -#WSI-BP 1.1 Warning/Errors -# R2911 -mimemodeler.invalidMimePart.moreThanOneSOAPBody=Ignoring operation \"{0}\". The Multipart/Related structure has invalid root part: more than one soap:body parts found - -# R2906 -mimemodeler.warning.IgnoringinvalidHeaderPart.notDeclaredInRootPart=Headers not in root mime:part with soap:body, ignoring headers in operation \"{0}\" - -# R2909 -mimemodeler.invalidMimeContent.differentPart=Ignoring the mime:part. Invalid mime:part, the mime:content has different part attribute. - -mimemodeler.invalidMimeContent.invalidSchemaType=Ignoring the mime:part. mime part: {0} can not be mapped to schema type: {1} - -# Rxxxx A mime:content in a DESCRIPTION MUST refer to a wsdl:part element defined using the type attribute. -mimemodeler.invalidMimeContent.mesagePartElementKind=wsdl:part element referenced by mime:content part attribute: {0} must be defined using type attribute! - -# RXXXX RYYYY: In a description, a mime:content element MUST include the part attribute. -mimemodeler.invalidMimeContent.missingPartAttribute=Ignoring operation \"{0}\", missing part attribute in mime:content. part attribute must be present in mime:content declaration. - -mimemodeler.invalidMimeContent.missingTypeAttribute=Missing type attribute in mime:content in operation \"{0}\". part attribute must be present in mime:content declaration. - -# unknown schematype -mimemodeler.invalidMimeContent.unknownSchemaType=Unknown schema type: {1} for mime:content part: {0} -mimemodeler.invalidMimeContent.errorLoadingJavaClass=Couldn't find class \"{0}\" for mime type \"{1}\" - -# missing wsdl:part referenced by the mime:content -wsdlmodeler.warning.ignoringMimePart.notFound=ignoring mime:part, cannot find part \"{0}\" referenced by the mime:content in the wsdl:operation \"{1}\" - -mimemodeler.elementPart.invalidElementMimeType=The mime:content part refers to wsdl:part \"{0}\", defined using element attribute. Please make sure the mime type: \"{1}\" is appropriate to serialize XML. - -# R2708 The mime:part element in a DESCRIPTION MUST NOT have a name attribute. -mimemodeler.invalidMimePart.nameNotAllowed=name attribute on wsdl:part in Operation \"{0}\" is ignored. Its not allowed as per WS-I AP 1.0. - - -wsdlmodeler20.rpcenc.not.supported=rpc/encoded wsdl's are not supported in JAXWS 2.0. -wsdlmodeler.warning.ignoringOperation.notNCName=Ignoring operation \"{0}\", it has illegal character ''{1}'' in its name. Its rpc-literal operation - jaxws won't be able to serialize it! - -wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.nonWrapperStyle=Ignoring operation \"{0}\", can''t generate java method. Parameter: part "{2}\" in wsdl:message \"{1}\", is a java keyword. Use customization to change the parameter name or change the wsdl:part name. -wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.nonWrapperStyle=Invalid operation \"{0}\", can''t generate java method. Parameter: part "{2}\" in wsdl:message \"{1}\", is a java keyword. Use customization to change the parameter name or change the wsdl:part name. - -wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.wrapperStyle=Ignoring operation \"{0}\", can''t generate java method parameter. Local name of the wrapper child \"{1}\" in the global element \"{2}\" is a java keyword. Use customization to change the parameter name. -wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.wrapperStyle=Invalid operation \"{0}\", can''t generate java method parameter. Local name of the wrapper child \"{1}\" in the global element \"{2}\" is a java keyword. Use customization to change the parameter name. - -wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customName=Ignoring operation \"{0}\", can''t generate java method. Parameter,customized name \"{1}\" is a java keyword. -wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customName=Invalid operation \"{0}\", can''t generate java method. Parameter,customized name \"{1}\" is a java keyword. - -wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.operationName=Ignoring operation \"{0}\", it''s java reserved word, can''t generate java method. Use customization to change the operation name. -wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.operationName=Invalid operation \"{0}\", it''s java reserved word, can''t generate java method. Use customization to change the operation name. - -wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customizedOperationName=Ignoring operation \"{0}\", can''t generate java method ,customized name \"{1}\" of the wsdl:operation is a java keyword. -wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customizedOperationName=Invalid operation \"{0}\", can''t generate java method ,customized name \"{1}\" of the wsdl:operation is a java keyword. - -wsdlmodeler.jaxb.javatype.notfound=Schema descriptor {0} in message part \"{1}\" is not defined and could not be bound to Java. Perhaps the schema descriptor {0} is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch. -wsdlmodeler.unsupportedBinding.mime=WSDL MIME binding is not currently supported! - -wsdlmodeler.nonUnique.body.error=Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signaure on the wire for successful dispatch. In port {0}, Operations \"{1}\" and \"{2}\" have the same request body block {3}. Try running wsimport with -extension switch, runtime will try to dispatch using SOAPAction -wsdlmodeler.nonUnique.body.warning=Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signaure on the wire for successful dispatch. In port {0}, Operations \"{1}\" and \"{2}\" have the same request body block {3}. Method dispatching may fail, runtime will try to dispatch using SOAPAction - -wsdlmodeler.rpclit.unkownschematype=XML type \"{0}\" could not be resolved, XML to JAVA binding failed! Please check the wsdl:part \"{1}\" in the wsdl:message \"{2}\". - -wsdlmodeler.responsebean.notfound=wsimport failed to generate async response bean for operation: {0} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/processor.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/processor.properties deleted file mode 100644 index 85705032caa..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/processor.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -processor.missing.model=model is missing diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/util.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/util.properties deleted file mode 100644 index 6cc6dbf9b3a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/util.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -holder.valuefield.not.found=Could not find the field in the Holder that contains the Holder''s value: {0} -null.namespace.found=Encountered error in wsdl. Check namespace of element <{0}> -sax2dom.notsupported.createelement=SAX2DOMEx.DomImplDoesntSupportCreateElementNs: {0} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/webserviceap.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/webserviceap.properties deleted file mode 100644 index 53f5c341eed..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/webserviceap.properties +++ /dev/null @@ -1,156 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -webserviceap.nestedModelError=modeler error: {0} -webserviceap.fileNotFound=error: file not found: {0} -webserviceap.error=error: {0} -webserviceap.warning=warning: {0} -webserviceap.info=info: {0} -webserviceap.compilationFailed=compilation failed, errors should have been reported -webserviceap.succeeded: Success - -webserviceap.method.not.annotated=The method {0} on class {1} is not annotated. -webserviceap.rpc.encoded.not.supported=The {0} class has a rpc/encoded SOAPBinding. Rpc/encoded SOAPBindings are not supported in JAXWS 2.0. -webservice.encoded.not.supported=The {0} class has invalid SOAPBinding annotation. {1}/encoded SOAPBinding is not supported -webserviceap.model.already.exists=model already exists -webserviceap.endpointinterface.on.interface=Service endpointpoint interface\: {0} has cannot have a WebService.endpointInterface annotation\: {1} -webserviceap.java.typeNotFound=The type: {0} was not found in the mapping -webserviceap.endpointinterfaces.do.not.match=The endpoint interface {0} does not match the interface {1}. - -webserviceap.could.not.find.typedecl=Could not get TypeDeclaration for:\ {0} in apt round:\ {1} - -webserviceap.no.webservice.endpoint.found=A web service endpoint could not be found - -webserviceap.endpointinterface.has.no.webservice.annotation=The endpoint interface {0} must have a WebService annotation - -webserviceap.oneway.operation.cannot.have.return.type=The method {1} of class {0} is annotated @Oneway but has a return type. - -webserviceap.oneway.operation.cannot.have.holders=The method {1} of class {0} is annotated @Oneway but contains inout or out paramerters (javax.xml.ws.Holder) - -webserviceap.oneway.operation.cannot.declare.exceptions=The method {1} of class {0} is annotated @Oneway but declares the exception {2} - -webserviceap.cannot.combine.handlerchain.soapmessagehandlers=You cannot specify both HanlderChain and SOAPMessageHandlers annotations - -webserviceap.invalid.handlerchain.file.nohandler-config=The handlerchain file {0} is invalid, it does not contain a handler-config element - -webserviceap.could.not.find.handlerchain=Could not find the handlerchain {0} in the handler file {1} - -webserviceap.handlerclass.notspecified=A handler in the HandlerChain file\: {0} does not specify a handler-class - -webserviceap.init_param.format.error=a element must have exactly 1 and 1 - -webserviceap.document.literal.bare.method.return.not.unique=Document literal bare methods must have a unique result name return type combination. Class {0} method\: {1}, result name\: {2} return type\: {3} - -webserviceap.document.literal.bare.method.not.unique=Document literal bare methods must have unique parameter names. Class\: {0} method\: {1} parameter name\: {2} - -webserviceap.document.literal.bare.cannot.have.more.than.one.out=Document literal bare methods must have a return value or one out parameter. Class\: {0} Method\: {1} - -webserviceap.document.literal.bare.must.have.only.one.in.parameter=Document literal bare methods must have no more than 1 non-header in parameter. Class\: {0} method\: {1} number of non-header parameters\: {2} - -webserviceap.document.literal.bare.must.have.one.in.or.out=Document literal bare methods must have at least one of: a return, an in parameter or an out parameter. Class\: {0} Method\: {1} - -webserviceap.holder.parameters.must.not.be.in.only=javax.xml.ws.Holder parameters must not be annotated with the WebParam.Mode.IN property. Class\: {0} method\: {1} parameter\: {2} - -webserviceap.document.bare.holder.parameters.must.not.be.inout=javax.xml.ws.Holder parameters in document bare operations must be WebParam.Mode.INOUT; Class\: {0} method\: {1} parameter\: {2} - -webserviceap.endpointinterface.class.not.found=The endpointInterface class {0} could not be found - -webserviceap.sei.cannot.contain.constant.values=An service endpoint interface cannot contain constant declaration\: Interface\: {0} field\: {1}. - -webserviceap.method.return.type.cannot.implement.remote=Method return types cannot implement java.rmi.Remote. Class\: {0} method\: {1} return type\: {2} - -webserviceap.method.parameter.types.cannot.implement.remote=Method parameter types cannot implement java.rmi.Remote. Class\: {0} method\: {1} parameter\: {2} type\: {3} - -webserviceap.operation.name.not.unique=Operation names must be unique. Class\: {0} method\: {1} operation name\: {2} - -webserviceap.method.request.wrapper.bean.name.not.unique=Request wrapper bean names must be unique and must not clash with other generated classes. Class\: {0} method {1} - -webserviceap.method.response.wrapper.bean.name.not.unique=Response wrapper bean names must be unique and must not clash with other generated classes. Class\: {0} method {1} - -webserviceap.method.exception.bean.name.not.unique=Exception bean names must be unique and must not clash with other generated classes. Class\: {0} exception {1} - -webserviceap.rpc.literal.parameters.must.have.webparam=All rpc literal parameters must have a WebParam annotation. Class\: {0} method\: {1} parameter {2} - -webserviceap.rpc.literal.webparams.must.specify.name=All rpc literal WebParams must specify a name. Class\: {0} method {1} paramter {2} - -webserviceap.rpc.literal.must.not.be.bare=RPC literal SOAPBindings must have parameterStyle WRAPPPED. Class\: {0}. - -webserviceap.header.parameters.must.have.webparam.name=All WebParam annotations on header parameters must specify a name. Class\: {0} method {1} paramter {2} - -webserviceap.failed.to.find.handlerchain.file=Cannot find HandlerChain file. class\: {0}, file:\ {1} - -webserviceap.failed.to.parse.handlerchain.file=Failed to parse HandlerChain file. Class\: {0}, file\: {1} - -webserviceap.class.not.found=Class Not Found: {0} - -webserviceap.rpc.soapbinding.not.allowed.on.method=SOAPBinding.Style.RPC binding annotations are not allowed on methods. Class\: {0} Method\: {1} - -webserviceap.mixed.binding.style=Class\: {0} contains mixed bindings. SOAPBinding.Style.RPC and SOAPBinding.Style.DOCUMENT cannot be mixed. - -webserviceap.endpointinteface.plus.annotation=The @{0} annotation cannot be used in with @javax.jws.WebService.endpointInterface element. - -webserviceap.endpointinteface.plus.element=The @javax.jws.WebService.{0} element cannot be used in with @javax.jws.WebService.endpointInterface element. - -webserviceap.non.in.parameters.must.be.holder=Class:\ {0}, method: {1}, parameter: {2} is not WebParam.Mode.IN and is not of type javax.xml.ws.Holder. - -webserviceap.invalid.sei.annotation.element=The @javax.jws.WebService.{0} element cannot be specified on a service endpoint interface. Class\: {1} - -webserviceap.invalid.sei.annotation=The @{0} annotation cannot be used on a service endpoint interface. Class\: {1} - -webserviceap.invalid.sei.annotation.element.exclude=The @javax.jws.WebMethod({0}) cannot be used on a service endpoint interface. Class\: {1} method\: {2} - -webserviceap.invalid.webmethod.element.with.exclude=The @javax.jws.WebMethod.{0} element cannot be specified with the @javax.jws.WebMethod.exclude element. Class\: {1} method\: {2} - -webserviceap.doc.bare.no.out=Document/literal bare methods with no return type or OUT/INOUT parameters must be annotated as @Oneway. Class\: {0}, method: {1} -webserviceap.doc.bare.return.and.out=Document/literal bare methods cannot have a return type and out parameters. Class\: {0}, method: {1} -webserviceap.oneway.and.out=@Oneway methods cannot have out parameters. Class\: {0} method {1} - -webserviceap.webservice.class.not.public=Classes annotated with @javax.jws.WebService must be public. Class\: {0} - -webserviceap.webservice.class.is.final=Classes annotated with @javax.jws.WebService must not be final. Class\: {0} - -webserviceap.webservice.class.is.abstract=Classes annotated with @javax.jws.WebService must not be abstract. Class\: {0} - -webserviceap.webservice.class.is.innerclass.not.static=Inner classes annotated with @javax.jws.WebService must be static. Class\: {0} - -webserviceap.webservice.method.is.abstract=Classes annotated with @javax.jws.WebService must not have abstract methods. Class\: {0} Method: {1} - -webserviceap.webservice.method.is.static.or.final=Method annotated with @javax.jws.WebMethod must not be static or final. Class\: {0} Method: {1} - -#webserviceap.doc.bare.return.and.out=Document literal bare methods must not have a return value and an OUT/INOUT parameter. Class\: {0} Method\: {1} - -webserviceap.webservice.no.default.constructor=Classes annotated with @javax.jws.WebService must have a public default constructor. Class\: {0} - -webserviceap.oneway.and.not.one.in=Document literal bare methods annotated with @javax.jws.Oneway must have one non-header IN parameter. Class\: {0} Method\: {1} - -webserviceap.doc.bare.no.return.and.no.out=Document literal bare methods that do not have a return value must have a single OUT/INOUT parameter. Class\: {0} Method\: {1} - -webserviceap.doc.bare.and.no.one.in=Document literal bare methods must have one non-header, IN/INOUT parameter. Class\: {0} Method\: {1} - -webserviceap.method.not.implemented=Methods in an endpointInterface must be implemented in the implementation class. Interface Class\:{0} Implementation Class\:{1} Method\: {2} - -webserviceap.no.package.class.must.have.targetnamespace=@javax.jws.Webservice annotated classes that do not belong to a package must have the @javax.jws.Webservice.targetNamespace element. Class\: {0} - -webserviceap.webservice.and.webserviceprovider=Classes cannot be annotated with both @javax.jws.WebService and @javax.xml.ws.WebServiceProvider. Class\: {0} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties deleted file mode 100644 index 03f84bb8457..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties +++ /dev/null @@ -1,205 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -wsimport.usage=Usage: {0} [options] \n\n\ -Use "wsimport -help" for a detailed description of options. - -wsimport.help=\nUsage: {0} [options] \n\n\ -\where [options] include:\n\ -\ -b specify jaxws/jaxb binding files or additional schemas\n\ -\ (Each must have its own -b)\n\ -\ -B Pass this option to JAXB schema compiler\n\ -\ -catalog specify catalog file to resolve external entity references\n\ -\ supports TR9401, XCatalog, and OASIS XML Catalog format.\n\ -\ -d specify where to place generated output files\n\ -\ -extension allow vendor extensions - functionality not specified\n\ -\ by the specification. Use of extensions may\n\ -\ result in applications that are not portable or\n\ -\ may not interoperate with other implementations\n\ -\ -help display help\n\ -\ -httpproxy:: specify a HTTP proxy server (port defaults to 8080)\n\ -\ -keep keep generated files\n\ -\ -p specifies the target package\n\ -\ -quiet suppress wsimport output\n\ -\ -s specify where to place generated source files\n\ -\ -target generate code as per the given JAXWS spec version\n\ -\ e.g. 2.0 will generate compliant code for JAXWS 2.0 spec\n\ -\ -verbose output messages about what the compiler is doing\n\ -\ -version print version information\n\ -\ -wsdllocation @WebServiceClient.wsdlLocation value\n\ - -wsimport.usage.extensions=\n\ -\Extensions:\n\ -\ -XadditionalHeaders map headers not bound to request or response message to \n\ -\ Java method parameters\n\ -\ -Xauthfile file to carry authorization information in the format \n\ -\ http://username:password@example.org/stock?wsdl\n\ -\ -Xdebug print debug information\n\ -\ -Xno-addressing-databinding enable binding of W3C EndpointReferenceType to Java\n\ -\ -Xnocompile do not compile generated Java files\n\ - - -wsimport.usage.examples=\n\ -\Examples:\n\ -\ wsimport stock.wsdl -b stock.xml -b stock.xjb\n\ -\ wsimport -d generated http://example.org/stock?wsdl\n\ - - -wsgen.usage=Usage: {0} [options] \n\n\ -Use "wsgen -help" for a detailed description of options. - -wsgen.help=\nUsage: {0} [options] \n\n\ -\where [options] include:\n\ -\ -classpath specify where to find input class files\n\ -\ -cp same as -classpath \n\ -\ -d specify where to place generated output files\n\ -\ -extension allow vendor extensions - functionality not specified\n\ -\ by the specification. Use of extensions may\n\ -\ result in applications that are not portable or\n\ -\ may not interoperate with other implementations\n\ -\ -help display help\n\ -\ -keep keep generated files\n\ -\ -r resource destination directory, specify where to\n\ -\ place resouce files such as WSDLs\n\ -\ -s specify where to place generated source files\n\ -\ -verbose output messages about what the compiler is doing\n\ -\ -version print version information\n\ -\ -wsdl[:protocol] generate a WSDL file. The protocol is optional.\n\ -\ Valid protocols are {1},\n\ -\ the default is soap1.1.\n\ -\ The non stanadard protocols {2}\n\ -\ can only be used in conjunction with the\n\ -\ -extension option.\n\ -\ -servicename specify the Service name to use in the generated WSDL\n\ -\ Used in conjunction with the -wsdl option.\n\ -\ -portname specify the Port name to use in the generated WSDL\n\ -\ Used in conjunction with the -wsdl option. - - -wsgen.usage.examples=\n\ -\Examples:\n\ -\ wsgen -cp . example.Stock\n\ -\ wsgen -cp . example.Stock -wsdl -servicename '{http://mynamespace}MyService'\n\ - -wrapperTask.needEndorsed=\ -You are running on JDK6 which comes with JAX-WS 2.0 API, but this tool requires JAX-WS 2.1 API. \ -Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), \ -or set xendorsed="true" on <{0}>. - -wrapperTask.loading20Api=\ -You are loading JAX-WS 2.0 API from {0} but this tool requires JAX-WS 2.1 API. - -invoker.needEndorsed=\ -You are running on JDK6 which comes with JAX-WS 2.0 API, but this tool requires JAX-WS 2.1 API. \ -Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), \ -or use -Xendorsed option. - - -# -# Generic Messages -# -wscompile.invalidOption=unrecognized parameter {0} -wsimport.noSuchJaxbOption=no such JAXB option: {0} - -wscompile.error=error: {0} -wscompile.warning=warning: {0} -wscompile.info=info: {0} -wscompile.duplicateOption=duplicate option: {0} -wscompile.noSuchDirectory=directory not found: {0} -wscompile.missingOptionArgument=option \"{0}\" requires an argument -wscompile.compilationFailed=compilation failed, errors should have been reported - -wsimport.missingFile=Missing WSDL_URI - -wsgen.invalid.protocol=\"{0}\" is not a supported protocol. Supported protocols include: {1}. -wsgen.invalid.transport=\"{0}\" is not a supported transport. Supported transport include: {1}. -wsgen.class.not.found=Class not found: \"{0}\" -wsgen.could.not.create.file="Could not create file: "\{0}\" -wsgen.missingFile=Missing SEI -wsgen.soap12.without.extension=The optional protocol \"Xsoap1.2\" must be used in conjunction with the \"-extension\" option. -wsgen.protocol.without.extension=The optional protocol \"{0}\" must be used in conjunction with the \"-extension\" option. -wsgen.wsdl.arg.no.genwsdl=The \"{0}\" option can only be in conjunction with the "-wsdl" option. -wsgen.servicename.missing.namespace=The service name \"{0}\" is missing a namespace. -wsgen.servicename.missing.localname=The service name \"{0}\" is missing a localname. -wsgen.portname.missing.namespace=The port name \"{0}\" is missing a namespace. -wsgen.portname.missing.localname=The port name \"{0}\" is missing a localname. -wsgen.class.must.be.implementation.class=The class \"{0}\" is not an endpoint implementation class. -wsimport.NotAFileNorURL = \ - "{0}" is neither a file name nor an URL - -wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen can not generate WSDL for non-SOAP binding: {0} on Class {1} - -wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen can not generate WSDL for SOAP 1.2 binding: {0} on class: {1}.\n -Please specify \"-extension\" and \"-wsdl:protocol XSoap1.2\" switches. For example:\n\n -wsgen -wsdl:protocol XSoap1.2 -extenson {1} - -wsgen.no.webservices.class=wsgen did not find any class with @WebService annotation. Please specify @WebService annotation on {0}. - -wsimport.no.wsdl=Failed to read the WSDL document: {0}, because 1) could not find the document; /\ - 2) the document could not be read; \ - 3) the root element of the document is not . - -wsimport.FailedToParse = \ - Failed to parse "{0}": {1} - -wsimport.ParsingWSDL=parsing WSDL...\n\n -wsimport.GeneratingCode=generating code...\n -wsimport.CompilingCode=\ncompiling code...\n -wsimport.ILLEGAL_TARGET_VERSION = \ - "{0}" is not a valid target version. "2.0" and "2.1" are supported. - -wsimport.ILLEGAL_AUTH_INFO = \ - "{0}" is not a valid authorization information format. The format is http[s]://user:password@host:port//. - -wsimport.readingAuthFile = \ - Trying to read authorization file : "{0}"... - -wsimport.authFileNotFound = \ - Authorization file "{0}" not found. If the WSDL access needs Basic Authentication, please provide authorization file with read access at {1} or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port// - -wsimport.authInfoNeeded = \ - {0}, "{1}" needs authorization, please provide authorization file with read access at {2} or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port// - -wsimport.AUTH_INFO_LINENO = \ - "line {0} of {1} - - -wsimport.ErrorMessage = \ - [ERROR] {0} - -wsimport.WarningMessage = \ - [WARNING] {0} - -wsimport.InfoMessage = \ - [INFO] {0} - -wsimport.DebugMessage = \ - [DEBUG] {0} - -wsimport.httpRedirect = \ - Server returned HTTP Status code: "{0}", retrying with "{1}" - -wsimport.maxRedirectAttempt = \ - Can not get a WSDL maximum number of redirects(5) reached diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/wsdl.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/wsdl.properties deleted file mode 100644 index b23eee41495..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/resources/wsdl.properties +++ /dev/null @@ -1,140 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -localized.error={0} -parsing.wsdlNotDefaultNamespace=default namespace must be \"{0}\" -parsing.onlyOneOfElementOrTypeRequired=only one of the \"element\" or \"type\" attributes is allowed in part \"{0}\" -parsing.elementOrTypeRequired=warning: part {0} is ignored, either the \"element\" or the \"type\" attribute is required in part \"{0}\" -parsing.invalidElement=invalid element: \"{0}\" (in namespace \"{1}\") -parsing.invalidAttributeValue=invalid value \"{1}\" for attribute \"{0}\" -parsing.invalidExtensionElement=invalid extension element: \"{0}\" (in namespace \"{1}\") -parsing.invalidWsdlElement=invalid WSDL element: \"{0}\" -parsing.requiredExtensibilityElement=unknown required extensibility element \"{0}\" (in namespace \"{1}\") -parsing.tooManyElements=too many \"{0}\" elements under \"{1}\" element \"{2}\" -parsing.invalidOperationStyle=operation \"{0}\" has an invalid style -parsing.onlyOneTypesAllowed=only one "types" element allowed in "{0}" -parsing.onlyOneDocumentationAllowed=only one "documentation" element allowed in "{0}" -parsing.incorrectRootElement=expected root element \"{2}\" (in namespace \"{3}\"), found element \"{0}\" (in namespace \"{1}\") -parsing.unknownImportedDocumentType=imported document is of unknown type: {0} -parsing.unknownNamespacePrefix=undeclared namespace prefix: \"{0}\" -parsing.invalidURI=invalid URI: {0} -parsing.ioExceptionWithSystemId=failed to parse document at \"{0}\" -parsing.ioException=parsing failed: {0} -parsing.saxExceptionWithSystemId=invalid WSDL file! failed to parse document at \"{0}\" -parsing.saxException=invalid WSDL file! parsing failed: {0} -parsing.parserConfigException=invalid WSDL file! parsing failed: {0} -parsing.factoryConfigException=invalid WSDL file! parsing failed: {0} - -# -parsing.missingRequiredAttribute=missing required attribute \"{1}\" of element \"{0}\" -parsing.invalidTag=expected element \"{1}\", found \"{0}\" -parsing.invalidTagNS=Invalid WSDL at {4}: expected element \"{2}\" (in namespace \"{3}\"), found element \"{0}\" (in namespace \"{1}\") -parsing.nonWhitespaceTextFound=found unexpected non-whitespace text: \"{0}\" -parsing.elementExpected=unexpected non-element found -# -entity.duplicate=duplicate entity: \"{0}\" -entity.duplicateWithType=duplicate \"{0}\" entity: \"{1}\" - -entity.notFoundByID=invalid entity id: \"{0}\" -entity.notFoundByQName={0} \"{1}\" not found in the wsdl: {2} -entity.notFound.portType=wsdl:portType \"{0}\" referenced by wsdl:binding \"{1}\", but it's not found in the wsdl -entity.notFound.binding=wsdl:binding \"{0}" referenced by wsdl:port \"{1}\", but it's not found in the wsdl - -# -validation.missingRequiredAttribute=missing required attribute \"{0}\" of element \"{1}\" -validation.missingRequiredProperty=missing required property \"{0}\" of element \"{1}\" -validation.missingRequiredSubEntity=missing required sub-entity \"{0}\" of element \"{1}\" -validation.invalidElement=invalid element: \"{0}\" -validation.invalidComplexTypeInElement=invalid element: \"{1}\", has named complexType: \"{0}\" -validation.invalidSimpleTypeInElement=invalid element: \"{1}\", has named simpleType: \"{0}\" -validation.duplicatedElement=duplicated element: \"{0}\" -validation.duplicatePartName=Invalid WSDL, duplicate parts in a wsdl:message is not allowed. \nwsdl:message {0} has a duplicated part name: \"{1}\" -validation.invalidSubEntity=invalid sub-element \"{0}\" of element \"{1}\" -validation.invalidAttribute=invalid attribute \"{0}\" of element \"{1}\" -validation.invalidAttributeValue=invalid value \"{1}\" for attribute \"{0}\" -validation.invalidRange=invalid range found (min: {0}, max: {1}) -validation.exclusiveAttributes=exclusive attributes: \"{0}\", \"{1}\" -validation.incorrectTargetNamespace=target namespace is incorrect (expected: {1}, found: {0}) -validation.unsupportedSchemaFeature=unsupported XML Schema feature: \"{0}\" -validation.shouldNotHappen=internal error ("{0}") -validation.invalidToken=invalid token \"{0}\" -validation.notSimpleType=not a simple type: \"{0}\" -validation.ambiguousName=ambiguous operation name: \"{0}\" -validation.invalidPrefix=undeclared namespace prefix: \"{0}\" -warning.faultEmptyAction=ignoring empty Action in \"{0}\" {1} element of \"{2}\" operation, using default instead -warning.inputOutputEmptyAction=ignoring empty Action in {0} element of \"{1}\" operation, using default instead - -#wsi compliant WSDL warnings -warning.wsi.r2001=Not a WSI-BP compliant WSDL (R2001, R2002). wsdl:import must import only WSDL documents. It's trying to import: \"{0}\" -warning.wsi.r2002=Not a WSI-BP compliant WSDL (R2002). wsdl:import must not be used to import XML Schema embedded in the WSDL document. Expected wsdl namespace: {0}, found: {1} -warning.wsi.r2003=Not a WSI-BP compliant WSDL (R2003). xsd:import must only be used inside xsd:schema elements. -warning.wsi.r2004=Not a WSI-BP compliant WSDL (R2001, R2004). xsd:import must not import XML Schema definitions embedded inline within the WSDL document. - -#Parser -Parsing.ParseFailed = \ -\tFailed to parse the WSDL. - -Parsing.NotAWSDL=Failed to get WSDL components, probably {0} is not a valid WSDL file. - -AbstractReferenceFinderImpl.UnableToParse = \ -\tUnable to parse "{0}" : {1} - -Parser.NotABindingFile = \ -\tnot an external binding file. The root element must be '{'http://java.sun.com/xml/ns/jaxws'}'bindings but it is '{'{0}'}'{1} - - -#Internalizer -Internalizer.TwoVersionAttributes = \ -\tBoth jaxws:version and version are present -Internalizer.IncorrectVersion = \ -\tJAXWS version attribute must be "2.0" - -Internalizer.VersionNotPresent = \ -\tJAXWS version attribute must be present - -internalizer.targetNotAnElement= \ -\tTarget node is not an element -internalizer.targetNotFound= \ -\tNo target found for the wsdlLocation: {0} - -Internalizer.IncorrectSchemaReference= \ -\t"{0}" is not a part of this compilation. Is this a mistake for "{1}"? - -internalizer.XPathEvaluationError = \ - XPath error: {0} -internalizer.XPathEvaluatesToNoTarget = \ - XPath evaluation of "{0}" results in an empty target node -internalizer.XPathEvaulatesToTooManyTargets = \ - XPath evaluation of "{0}" results in too many ({1}) target nodes -internalizer.XPathEvaluatesToNonElement = \ - XPath evaluation of "{0}" needs to result in an element. -invalid.customization.namespace=Ignoring customization: \"{0}\", because it has no namespace. It must belong to the customization namespace. - -invalid.wsdl.with.dooc="Not a WSDL document: {0}, it gives \"{1}\", retrying with MEX..." -invalid.wsdl=Invalid WSDL {0}, expected {1} found {2} at (line {3}) -try.with.mex= {0} \n\nretrying with MEX... -file.not.found={0} is unreachable -parsing.unableToGetMetadata= {0}\n\n{1} -failed.noservice=failed.noservice=Could not find wsdl:service in the provided WSDL(s): \n\n{0} At least one WSDL with at least one service definition needs to be provided. diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/spi/WSToolsObjectFactory.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/spi/WSToolsObjectFactory.java deleted file mode 100644 index deae6066fb5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/spi/WSToolsObjectFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.spi; - -import com.sun.tools.internal.ws.util.WSToolsObjectFactoryImpl; -import com.sun.xml.internal.ws.api.server.Container; - -import java.io.OutputStream; - - -/** - * Singleton abstract factory used to produce JAX-WS tools related objects. - * - * @author JAX-WS Development Team - */ -public abstract class WSToolsObjectFactory { - - private static final WSToolsObjectFactory factory = new WSToolsObjectFactoryImpl(); - - /** - * Obtain an instance of a factory. Don't worry about synchronization(at the - * most, one more factory is created). - */ - public static WSToolsObjectFactory newInstance() { - return factory; - } - - /** - * Invokes wsimport on the wsdl URL argument, and generates the necessary - * portable artifacts like SEI, Service, Bean classes etc. - * - * @param logStream Stream used for reporting log messages like errors, warnings etc - * @param container gives an environment for tool if it is run during appserver - * deployment - * @param args arguments with various options and wsdl url - * - * @return true if there is no error, otherwise false - */ - public abstract boolean wsimport(OutputStream logStream, Container container, String[] args); - - /** - * Invokes wsimport on the wsdl URL argument, and generates the necessary - * portable artifacts like SEI, Service, Bean classes etc. - * - * @return true if there is no error, otherwise false - * - * @see {@link #wsimport(OutputStream, Container, String[])} - */ - public boolean wsimport(OutputStream logStream, String[] args) { - return wsimport(logStream, Container.NONE, args); - } - - /** - * Invokes wsgen on the endpoint implementation, and generates the necessary - * artifacts like wrapper, exception bean classes etc. - * - * @param logStream Stream used for reporting log messages like errors, warnings etc - * @param container gives an environment for tool if it is run during appserver - * deployment - * @param args arguments with various options and endpoint class - * - * @return true if there is no error, otherwise false - */ - public abstract boolean wsgen(OutputStream logStream, Container container, String[] args); - - /** - * Invokes wsgen on the endpoint implementation, and generates the necessary - * artifacts like wrapper, exception bean classes etc. - * - * @return true if there is no error, otherwise false - * @see {@link #wsgen(OutputStream, Container, String[])} - */ - public boolean wsgen(OutputStream logStream, String[] args) { - return wsgen(logStream, Container.NONE, args); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/spi/package-info.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/spi/package-info.java deleted file mode 100644 index a081fd17492..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/spi/package-info.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/** - * - *

    This document describes the SPI for the JAX-WS 2.0.1 tools. - * The WSToolsObjectFactory is used to create instances of WsGen - * and WsImport that other applications can use. -*/ -package com.sun.tools.internal.ws.spi; diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/ClassNameInfo.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/util/ClassNameInfo.java deleted file mode 100644 index f1a7be27907..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/ClassNameInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.util; - -/** - * @author WS Development Team - */ - -public final class ClassNameInfo { - - public static String getName(String className) { - String qual = getQualifier(className); - int len = className.length(); - int closingBracket = className.indexOf('>'); - if(closingBracket > 0) - len = closingBracket; - return qual != null - ? className.substring(qual.length() + 1, len) - : className; - } - - - /** - * - * - * @param className Generic class, such as java.util.List - * @return the generic class, such as java.util.List - */ - public static String getGenericClass(String className) { - int index = className.indexOf('<'); - if(index < 0) - return className; - return (index > 0)?className.substring(0, index):className; - } - - - public static String getQualifier(String className) { - int idot = className.indexOf(' '); - if (idot <= 0) - idot = className.length(); - else - idot -= 1; // back up over previous dot - int index = className.lastIndexOf('.', idot - 1); - return (index < 0) ? null : className.substring(0, index); - } - - public static String replaceInnerClassSym(String name) { - return name.replace('$', '_'); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/ForkEntityResolver.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/util/ForkEntityResolver.java deleted file mode 100644 index 6ea6a02fca5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/ForkEntityResolver.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.util; - -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import java.io.IOException; - -/** - * {@link EntityResolver} that delegates to two {@link EntityResolver}s. - * - * @author WS Development Team - */ -public class ForkEntityResolver implements EntityResolver { - private final EntityResolver lhs; - private final EntityResolver rhs; - - public ForkEntityResolver(EntityResolver lhs, EntityResolver rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { - InputSource is = lhs.resolveEntity(publicId, systemId); - if(is!=null) - return is; - return rhs.resolveEntity(systemId,systemId); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/WSDLParseException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/util/WSDLParseException.java deleted file mode 100644 index 2cc8c921511..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/WSDLParseException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.util; - -import com.sun.xml.internal.ws.util.exception.JAXWSExceptionBase; - -/** - * @author WS Development Team - */ -public class WSDLParseException extends JAXWSExceptionBase { - - public WSDLParseException(String key, Object... args) { - super(key, args); - } - - public WSDLParseException(Throwable throwable) { - super(throwable); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.util"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/WSToolsObjectFactoryImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/util/WSToolsObjectFactoryImpl.java deleted file mode 100644 index 7f3ff8e2f04..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/WSToolsObjectFactoryImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.util; - -import com.sun.tools.internal.ws.spi.WSToolsObjectFactory; -import com.sun.tools.internal.ws.wscompile.WsgenTool; -import com.sun.tools.internal.ws.wscompile.WsimportTool; -import com.sun.xml.internal.ws.api.server.Container; - -import java.io.OutputStream; - -/** - * Factory implementation class to instantiate concrete objects for JAX-WS tools. - * - * @author JAX-WS Development Team - */ -public class WSToolsObjectFactoryImpl extends WSToolsObjectFactory { - - @Override - public boolean wsimport(OutputStream logStream, Container container, String[] args) { - WsimportTool tool = new WsimportTool(logStream, container); - return tool.run(args); - } - - @Override - public boolean wsgen(OutputStream logStream, Container container, String[] args) { - WsgenTool tool = new WsgenTool(logStream, container); - return tool.run(args); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/xml/XmlUtil.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/util/xml/XmlUtil.java deleted file mode 100644 index c4d4ae0108e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/util/xml/XmlUtil.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.util.xml; - -import com.sun.tools.internal.ws.util.WSDLParseException; -import org.w3c.dom.Element; - -/** - * @author WS Development Team - */ -public class XmlUtil extends com.sun.xml.internal.ws.util.xml.XmlUtil { - - public static boolean matchesTagNS(Element e, String tag, String nsURI) { - try { - return e.getLocalName().equals(tag) - && e.getNamespaceURI().equals(nsURI); - } catch (NullPointerException npe) { - - // localname not null since parsing would fail before here - throw new WSDLParseException( - "null.namespace.found", - e.getLocalName()); - } - } - - public static boolean matchesTagNS( - Element e, - javax.xml.namespace.QName name) { - try { - return e.getLocalName().equals(name.getLocalPart()) - && e.getNamespaceURI().equals(name.getNamespaceURI()); - } catch (NullPointerException npe) { - - // localname not null since parsing would fail before here - throw new WSDLParseException( - "null.namespace.found", - e.getLocalName()); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/version.properties b/jaxws/src/share/classes/com/sun/tools/internal/ws/version.properties deleted file mode 100644 index b6719e45543..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/version.properties +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -#Fri May 15 16:16:14 CEST 2009 -build-id=JAX-WS RI 2.1.6 -major-version=2.1.6 -build-version=JAX-WS RI 2.1.6 diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/AbortException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/AbortException.java deleted file mode 100644 index 9cdbf39d009..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/AbortException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -/** - * @author Vivek Pandey - */ -/** - * Signals the abortion of the compilation. - *

    - * This exception should be only thrown from {@link ErrorReceiver} - * for the consistent error handling. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class AbortException extends RuntimeException { - public AbortException() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/AuthInfo.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/AuthInfo.java deleted file mode 100644 index 9a6af52cb02..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/AuthInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wscompile; - -import com.sun.istack.internal.NotNull; - -import java.net.URL; - -/** - * Represents authorization information needed by {@link com.sun.tools.internal.ws.wscompile.DefaultAuthenticator} to - * authenticate wsimport to access the wsdl. - * - * @author Vivek Pandey - */ - -public final class AuthInfo { - private final String user; - private final String password; - private final URL url; - - public AuthInfo(@NotNull URL url, @NotNull String user, @NotNull String password){ - this.url = url; - this.user = user; - this.password = password; - } - - public String getUser() { - return user; - } - - public String getPassword() { - return password; - } - - /** - * Returns if the requesting host and port are associated with this {@link AuthInfo} - */ - public boolean matchingHost(@NotNull URL requestingURL) { - return requestingURL.equals(url); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/BadCommandLineException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/BadCommandLineException.java deleted file mode 100644 index d0470153414..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/BadCommandLineException.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.istack.internal.Nullable; - -/** - * @author Vivek Pandey - */ -public class BadCommandLineException extends Exception { - private Options options; - - public BadCommandLineException(String msg) { - super(msg); - } - - public BadCommandLineException(String message, Throwable cause) { - super(message, cause); - } - - public BadCommandLineException() { - this(null); - } - - public void initOptions(Options opt) { - assert this.options==null; - this.options = opt; - } - - /** - * Gets the partly parsed option object, if any. - */ - public @Nullable - Options getOptions() { - return options; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/DefaultAuthTester.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/DefaultAuthTester.java deleted file mode 100644 index 433ea5c578e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/DefaultAuthTester.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wscompile; - -import com.sun.istack.internal.NotNull; -import com.sun.tools.internal.ws.processor.modeler.wsdl.ConsoleErrorReporter; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.PasswordAuthentication; -import java.net.URL; -import java.util.Arrays; - -/** - * @author Vivek Pandey - */ -public class DefaultAuthTester { - public static void main(String[] args) throws BadCommandLineException { - DefaultAuthenticator da = new MyAuthenticator(new ConsoleErrorReporter(System.out), new File("c:\\Users\\vivekp\\.metro\\auth")); - - PasswordAuthentication pa = da.getPasswordAuthentication(); - if(pa!= null && pa.getUserName().equals("vivek") && Arrays.equals(pa.getPassword(), "test".toCharArray())) - System.out.println("Success!"); - else - System.out.println("Failiure!"); - - } - - private static class MyAuthenticator extends DefaultAuthenticator{ - - public MyAuthenticator(@NotNull ErrorReceiver receiver, @NotNull File authfile) throws BadCommandLineException { - super(receiver, authfile); - } - - protected URL getRequestingURL() { - try { - return new URL("http://foo.com/myservice?wsdl"); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - return null; - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/DefaultAuthenticator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/DefaultAuthenticator.java deleted file mode 100644 index 3b43e0bf399..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/DefaultAuthenticator.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wscompile; - -import com.sun.istack.internal.NotNull; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.LocatorImpl; - -import java.io.*; -import java.net.Authenticator; -import java.net.PasswordAuthentication; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Vivek Pandey - */ -public class DefaultAuthenticator extends Authenticator { - - private final List authInfo = new ArrayList(); - private final ErrorReceiver errReceiver; - private final String proxyUser; - private final String proxyPasswd; - - //can user.home value be null? - public static final String defaultAuthfile = System.getProperty("user.home")+ System.getProperty("file.separator")+".metro"+System.getProperty("file.separator")+"auth"; - private File authFile = new File(defaultAuthfile); - private boolean giveError; - - public DefaultAuthenticator(@NotNull ErrorReceiver receiver, @NotNull File authfile) throws BadCommandLineException { - this.errReceiver = receiver; - this.proxyUser = System.getProperty("http.proxyUser"); - this.proxyPasswd = System.getProperty("http.proxyPassword"); - - if(authfile != null){ - this.authFile = authfile; - this.giveError = true; - } - - if(!authFile.exists()){ - try { - error(new SAXParseException(WscompileMessages.WSIMPORT_AUTH_FILE_NOT_FOUND(authFile.getCanonicalPath(), defaultAuthfile), null)); - } catch (IOException e) { - error(new SAXParseException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(authFile,e.getMessage()), null)); - } - return; - } - - if(!authFile.canRead()){ - error(new SAXParseException("Authorization file: "+authFile + " does not have read permission!", null)); - return; - } - parseAuth(); - } - - protected PasswordAuthentication getPasswordAuthentication() { - //If user sets proxy user and passwd and the RequestType is from proxy server then create - // PasswordAuthentication using proxyUser and proxyClass; - if((getRequestorType() == RequestorType.PROXY) && proxyUser != null && proxyPasswd != null){ - return new PasswordAuthentication(proxyUser, proxyPasswd.toCharArray()); - } - for(AuthInfo auth:authInfo){ - if(auth.matchingHost(getRequestingURL())){ - return new PasswordAuthentication(auth.getUser(), auth.getPassword().toCharArray()); - } - } - return null; - } - - private void parseAuth() { - errReceiver.info(new SAXParseException(WscompileMessages.WSIMPORT_READING_AUTH_FILE(authFile), null)); - - BufferedReader in; - try { - in = new BufferedReader(new InputStreamReader(new FileInputStream(authFile), "UTF-8")); - } catch (UnsupportedEncodingException e) { - error(new SAXParseException(e.getMessage(), null)); - return; - } catch (FileNotFoundException e) { - error(new SAXParseException(WscompileMessages.WSIMPORT_AUTH_FILE_NOT_FOUND(authFile, defaultAuthfile), null, e)); - return; - } - String text; - LocatorImpl locator = new LocatorImpl(); - try { - int lineno = 1; - - locator.setSystemId(authFile.getCanonicalPath()); - - while ((text = in.readLine()) != null) { - locator.setLineNumber(lineno++); - try { - URL url = new URL(text); - String authinfo = url.getUserInfo(); - - if (authinfo != null) { - int i = authinfo.indexOf(':'); - - if (i >= 0) { - String user = authinfo.substring(0, i); - String password = authinfo.substring(i + 1); - authInfo.add(new AuthInfo(new URL(text), user, password)); - } else { - error(new SAXParseException(WscompileMessages.WSIMPORT_ILLEGAL_AUTH_INFO(url), locator)); - } - } else { - error(new SAXParseException(WscompileMessages.WSIMPORT_ILLEGAL_AUTH_INFO(url), locator)); - } - - } catch (NumberFormatException e) { - error(new SAXParseException(WscompileMessages.WSIMPORT_ILLEGAL_AUTH_INFO(text), locator)); - } - } - in.close(); - } catch (IOException e) { - error(new SAXParseException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(authFile,e.getMessage()), locator)); - } - } - - /** - * When user provides authfile explicitly using -Xauthfile we throw error otherwise show the mesage by default with -Xdebug flag - */ - private void error(SAXParseException e){ - if(giveError){ - errReceiver.error(e); - } else{ - errReceiver.debug(e); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/ErrorReceiver.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/ErrorReceiver.java deleted file mode 100644 index 57d5019e94a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/ErrorReceiver.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.istack.internal.Nullable; -import com.sun.istack.internal.SAXParseException2; -import com.sun.tools.internal.ws.resources.ModelMessages; -import com.sun.tools.internal.xjc.api.ErrorListener; -import org.xml.sax.ErrorHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXParseException; - -/** - * Implemented by the driver of the compiler engine to handle - * errors found during the compiliation. - * - *

    - * This class implements {@link org.xml.sax.ErrorHandler} so it can be - * passed to anywhere where {@link org.xml.sax.ErrorHandler} is expected. - * - *

    - * However, to make the error handling easy (and make it work - * with visitor patterns nicely), - * none of the methods on thi class throws {@link org.xml.sax.SAXException}. - * Instead, when the compilation needs to be aborted, - * it throws {@link AbortException}, which is unchecked. - * - *

    - * This also implements the externally visible {@link com.sun.tools.internal.xjc.api.ErrorListener} - * so that we can reuse our internal implementation for testing and such. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @author Vivek Pandey - */ -public abstract class ErrorReceiver implements ErrorHandler, ErrorListener { - -// -// -// convenience methods for callers -// -// - /** - * @param loc - * can be null if the location is unknown - */ - public final void error( Locator loc, String msg ) { - error( new SAXParseException2(msg,loc) ); - } - - public final void error( Locator loc, String msg, Exception e ) { - error( new SAXParseException2(msg,loc,e) ); - } - - public final void error( String msg, Exception e ) { - error( new SAXParseException2(msg,null,e) ); - } - - public void error(Exception e) { - error(e.getMessage(),e); - } - - /** - * Reports a warning. - */ - public final void warning( @Nullable Locator loc, String msg ) { - warning( new SAXParseException(msg,loc) ); - } - -// -// -// ErrorHandler implementation, but can't throw SAXException -// -// - public abstract void error(SAXParseException exception) throws AbortException; - public abstract void fatalError(SAXParseException exception) throws AbortException; - public abstract void warning(SAXParseException exception) throws AbortException; - - /** - * This method will be invoked periodically to allow {@link com.sun.tools.internal.xjc.AbortException} - * to be thrown, especially when this is driven by some kind of GUI. - */ - public void pollAbort() throws AbortException { - } - - - /** - * Reports verbose messages to users. - * - * This method can be used to report additional non-essential - * messages. The implementation usually discards them - * unless some specific debug option is turned on. - */ - public abstract void info(SAXParseException exception) /*REVISIT:throws AbortException*/; - - /** - * Reports a debug message to users. - * - * @see #info(SAXParseException) - */ - public final void debug( String msg ) { - info( new SAXParseException(msg,null) ); - } - - public abstract void debug(SAXParseException exception); - -// -// -// convenience methods for derived classes -// -// - - /** - * Returns the human readable string representation of the - * {@link org.xml.sax.Locator} part of the specified - * {@link SAXParseException}. - * - * @return non-null valid object. - */ - protected final String getLocationString( SAXParseException e ) { - if(e.getLineNumber()!=-1 || e.getSystemId()!=null) { - int line = e.getLineNumber(); - return ModelMessages.CONSOLE_ERROR_REPORTER_LINE_X_OF_Y(line==-1?"?":Integer.toString( line ), - getShortName( e.getSystemId())); - } else { - return ""; //for unkown location just return empty string - } - } - - /** Computes a short name of a given URL for display. */ - private String getShortName( String url ) { - if(url==null) - return ModelMessages.CONSOLE_ERROR_REPORTER_UNKNOWN_LOCATION(); - return url; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/ErrorReceiverFilter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/ErrorReceiverFilter.java deleted file mode 100644 index 4de19e2c935..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/ErrorReceiverFilter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.tools.internal.xjc.api.ErrorListener; -import org.xml.sax.SAXParseException; - -/** - * Filter implementation of the ErrorReceiver. - * - * If an error is encountered, this filter sets a flag. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @author Vivek Pandey - */ -public class ErrorReceiverFilter extends ErrorReceiver { - - public ErrorReceiverFilter() {} - - public ErrorReceiverFilter( ErrorListener h ) { - setErrorReceiver(h); - } - - private ErrorListener core; - public void setErrorReceiver( ErrorListener handler ) { - core = handler; - } - - private boolean hadError = false; - public final boolean hadError() { return hadError; } - - /** - * Resets the error state its currently in. It allows to ignore the error reported by - * any sub-system. - */ - public void reset(){ - hadError = false; - } - - public void info(SAXParseException exception) { - if(core!=null) core.info(exception); - } - - public void debug(SAXParseException exception) { - - } - - public void warning(SAXParseException exception) { - if(core!=null) core.warning(exception); - } - - public void error(SAXParseException exception) { - hadError = true; - if(core!=null) core.error(exception); - } - - public void fatalError(SAXParseException exception) { - hadError = true; - if(core!=null) core.fatalError(exception); - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/FilerCodeWriter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/FilerCodeWriter.java deleted file mode 100644 index de57d828fba..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/FilerCodeWriter.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wscompile; - -import com.sun.codemodel.internal.JPackage; -import com.sun.mirror.apt.Filer; - -import java.io.File; -import java.io.IOException; -import java.io.Writer; - -/** - * Writes all the source files using the specified Filer. - * - * @author WS Development Team - */ -public class FilerCodeWriter extends WSCodeWriter { - - /** The Filer used to create files. */ - private final Filer filer; - - private Writer w; - - public FilerCodeWriter(File outDir, WsgenOptions options) throws IOException { - super(outDir, options); - this.filer = options.filer; - } - - - public Writer openSource(JPackage pkg, String fileName) throws IOException { - String tmp = fileName.substring(0, fileName.length()-5); - w = filer.createSourceFile(pkg.name()+"."+tmp); - return w; - } - - - public void close() throws IOException { - super.close(); - if (w != null) - w.close(); - w = null; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/JavaCompilerHelper.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/JavaCompilerHelper.java deleted file mode 100644 index 03b5d0503ae..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/JavaCompilerHelper.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.istack.internal.tools.ParallelWorldClassLoader; -import com.sun.tools.internal.ws.resources.JavacompilerMessages; - -import java.io.File; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URISyntaxException; - -/** - * A helper class to invoke javac. - * - * @author WS Development Team - */ -class JavaCompilerHelper{ - static File getJarFile(Class clazz) { - URL url = null; - try { - url = ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); - return new File(url.toURI()); - } catch (ClassNotFoundException e) { - // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. - throw new Error(e); - } catch (MalformedURLException e) { - // if we can't figure out where JAXB/JAX-WS API are, we couldn't have been executing this code. - throw new Error(e); - } catch (URISyntaxException e) { - // url.toURI() is picky and doesn't like ' ' in URL, so this is the fallback - return new File(url.getPath()); - } - } - - static boolean compile(String[] args, OutputStream out, ErrorReceiver receiver){ - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - try { - /* try to use the new compiler */ - Class comSunToolsJavacMainClass = - cl.loadClass("com.sun.tools.javac.Main"); - try { - Method compileMethod = - comSunToolsJavacMainClass.getMethod( - "compile", - compileMethodSignature); - Object result = - compileMethod.invoke( - null, args, new PrintWriter(out)); - return result instanceof Integer && (Integer) result == 0; - } catch (NoSuchMethodException e2) { - receiver.error(JavacompilerMessages.JAVACOMPILER_NOSUCHMETHOD_ERROR("getMethod(\"compile\", Class[])"), e2); - } catch (IllegalAccessException e) { - receiver.error(e); - } catch (InvocationTargetException e) { - receiver.error(e); - } - } catch (ClassNotFoundException e) { - receiver.error(JavacompilerMessages.JAVACOMPILER_CLASSPATH_ERROR("com.sun.tools.javac.Main"), e); - } catch (SecurityException e) { - receiver.error(e); - } - return false; - } - - private static final Class[] compileMethodSignature = {String[].class, PrintWriter.class}; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/Options.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/Options.java deleted file mode 100644 index da2a6d3cfd0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/Options.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.tools.internal.ws.resources.WscompileMessages; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -/** - * Provide common jaxws tool options. - * - * @author Vivek Pandey - */ -public class Options { - /** - * -verbose - */ - public boolean verbose; - - /** - * - quite - */ - public boolean quiet; - - /** - * -keep - */ - public boolean keep; - - - - /** - * -d - */ - public File destDir = new File("."); - - - /** - * -s - */ - public File sourceDir; - - public String classpath = System.getProperty("java.class.path"); - - - /** - * -Xnocompile - */ - public boolean nocompile; - - public enum Target { - V2_0, V2_1; - - /** - * Returns true if this version is equal or later than the given one. - */ - public boolean isLaterThan(Target t) { - return this.ordinal() >= t.ordinal(); - } - - /** - * Parses "2.0" and "2.1" into the {@link Target} object. - * - * @return null for parsing failure. - */ - public static Target parse(String token) { - if (token.equals("2.0")) - return Target.V2_0; - else if (token.equals("2.1")) - return Target.V2_1; - return null; - } - - /** - * Gives the String representation of the {@link Target} - */ - public String getVersion(){ - switch(this){ - case V2_0: - return "2.0"; - case V2_1: - return "2.1"; - default: - return null; - } - } - } - - public Target target = Target.V2_1; - - /** - * strictly follow the compatibility rules specified in JAXWS spec - */ - public static final int STRICT = 1; - - /** - * loosely follow the compatibility rules and allow the use of vendor - * binding extensions - */ - public static final int EXTENSION = 2; - - /** - * this switch determines how carefully the compiler will follow - * the compatibility rules in the spec. Either STRICT - * or EXTENSION. - */ - public int compatibilityMode = STRICT; - - public boolean isExtensionMode() { - return compatibilityMode == EXTENSION; - } - - /** - * Target direcoty when producing files. - */ - public File targetDir = new File("."); - - - - public boolean debug = false; - - /** - * -Xdebug - gives complete stack trace - */ - public boolean debugMode = false; - - - private final List generatedFiles = new ArrayList(); - private ClassLoader classLoader; - - - /** - * Remember info on generated source file generated so that it - * can be removed later, if appropriate. - */ - public void addGeneratedFile(File file) { - generatedFiles.add(file); - } - - /** - * Remove generated files - */ - public void removeGeneratedFiles(){ - for(File file : generatedFiles){ - if (file.getName().endsWith(".java")) { - file.delete(); - } - } - generatedFiles.clear(); - } - - /** - * Return all the generated files and its types. - */ - public Iterable getGeneratedFiles() { - return generatedFiles; - } - - /** - * Delete all the generated source files made during the execution - * of this environment (those that have been registered with the - * "addGeneratedFile" method). - */ - public void deleteGeneratedFiles() { - synchronized (generatedFiles) { - for (File file : generatedFiles) { - if (file.getName().endsWith(".java")) { - file.delete(); - } - } - generatedFiles.clear(); - } - } - - /** - * Parses arguments and fill fields of this object. - * - * @exception BadCommandLineException - * thrown when there's a problem in the command-line arguments - */ - public void parseArguments( String[] args ) throws BadCommandLineException { - - for (int i = 0; i < args.length; i++) { - if(args[i].length()==0) - throw new BadCommandLineException(); - if (args[i].charAt(0) == '-') { - int j = parseArguments(args,i); - if(j==0) - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); - i += (j-1); - } else { - addFile(args[i]); - } - } - if(destDir == null) - destDir = new File("."); - if(sourceDir == null) - sourceDir = destDir; - } - - - /** - * Adds a file from the argume - * - * @param arg a file, could be a wsdl or xsd or a Class - */ - protected void addFile(String arg) throws BadCommandLineException {} - - /** - * Parses an option args[i] and return - * the number of tokens consumed. - * - * @return - * 0 if the argument is not understood. Returning 0 - * will let the caller report an error. - * @exception BadCommandLineException - * If the callee wants to provide a custom message for an error. - */ - protected int parseArguments(String[] args, int i) throws BadCommandLineException { - if (args[i].equals("-g")) { - debug = true; - return 1; - } else if (args[i].equals("-Xdebug")) { - debugMode = true; - return 1; - } else if (args[i].equals("-Xendorsed")) { - // this option is processed much earlier, so just ignore. - return 1; - } else if (args[i].equals("-verbose")) { - verbose = true; - return 1; - } else if (args[i].equals("-quiet")) { - quiet = true; - return 1; - } else if (args[i].equals("-keep")) { - keep = true; - return 1; - } else if (args[i].equals("-target")) { - String token = requireArgument("-target", args, ++i); - target = Target.parse(token); - if(target == null) - throw new BadCommandLineException(WscompileMessages.WSIMPORT_ILLEGAL_TARGET_VERSION(token)); - return 2; - }else if (args[i].equals("-d")) { - destDir = new File(requireArgument("-d", args, ++i)); - if (!destDir.exists()) - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath())); - return 2; - } else if (args[i].equals("-s")) { - sourceDir = new File(requireArgument("-s", args, ++i)); - keep = true; - if (!sourceDir.exists()) { - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(sourceDir.getPath())); - } - return 2; - } else if (args[i].equals("-extension")) { - compatibilityMode = EXTENSION; - return 1; - } else if (args[i].startsWith("-help")) { - WeAreDone done = new WeAreDone(); - done.initOptions(this); - throw done; - } else if (args[i].equals("-Xnocompile")) { - // -nocompile implies -keep. this is undocumented switch. - nocompile = true; - keep = true; - return 1; - } - return 0; - } - - /** - * Obtains an operand and reports an error if it's not there. - */ - public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException { - //if (i == args.length || args[i].startsWith("-")) { - if (args[i].startsWith("-")) { - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_MISSING_OPTION_ARGUMENT(optionName)); - } - return args[i]; - } - - - - /** - * Used to signal that we've finished processing. - */ - public static final class WeAreDone extends BadCommandLineException {} - - /** - * Get a URLClassLoader from using the classpath - */ - public ClassLoader getClassLoader() { - if (classLoader == null) { - classLoader = - new URLClassLoader(pathToURLs(classpath), - this.getClass().getClassLoader()); - } - return classLoader; - } - - /** - * Utility method for converting a search path string to an array - * of directory and JAR file URLs. - * - * @param path the search path string - * @return the resulting array of directory and JAR file URLs - */ - public static URL[] pathToURLs(String path) { - StringTokenizer st = new StringTokenizer(path, File.pathSeparator); - URL[] urls = new URL[st.countTokens()]; - int count = 0; - while (st.hasMoreTokens()) { - URL url = fileToURL(new File(st.nextToken())); - if (url != null) { - urls[count++] = url; - } - } - if (urls.length != count) { - URL[] tmp = new URL[count]; - System.arraycopy(urls, 0, tmp, 0, count); - urls = tmp; - } - return urls; - } - - /** - * Returns the directory or JAR file URL corresponding to the specified - * local file name. - * - * @param file the File object - * @return the resulting directory or JAR file URL, or null if unknown - */ - public static URL fileToURL(File file) { - String name; - try { - name = file.getCanonicalPath(); - } catch (IOException e) { - name = file.getAbsolutePath(); - } - name = name.replace(File.separatorChar, '/'); - if (!name.startsWith("/")) { - name = "/" + name; - } - - // If the file does not exist, then assume that it's a directory - if (!file.isFile()) { - name = name + "/"; - } - try { - return new URL("file", "", name); - } catch (MalformedURLException e) { - throw new IllegalArgumentException("file"); - } - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WSCodeWriter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WSCodeWriter.java deleted file mode 100644 index 68ccb94e454..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WSCodeWriter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wscompile; - -import com.sun.codemodel.internal.JPackage; -import com.sun.codemodel.internal.writer.FileCodeWriter; - -import java.io.File; -import java.io.IOException; - -/** - * {@link FileCodeWriter} implementation that notifies - * JAX-WS about newly created files. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class WSCodeWriter extends FileCodeWriter { - private final Options options; - - public WSCodeWriter( File outDir, Options options) throws IOException { - super(outDir); - this.options = options; - } - - protected File getFile(JPackage pkg, String fileName ) throws IOException { - File f = super.getFile(pkg, fileName); - - options.addGeneratedFile(f); - // we can't really tell the file type, for we don't know - // what this file is used for. Fortunately, - // FILE_TYPE doesn't seem to be used, so it doesn't really - // matter what we set. - - return f; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsgenOptions.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsgenOptions.java deleted file mode 100644 index 1e6d109d18a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsgenOptions.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.mirror.apt.Filer; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.ws.api.WsgenExtension; -import com.sun.tools.internal.ws.api.WsgenProtocol; -import com.sun.xml.internal.ws.api.BindingID; -import com.sun.xml.internal.ws.util.ServiceFinder; -import com.sun.xml.internal.ws.binding.SOAPBindingImpl; - -import javax.jws.WebService; -import javax.xml.namespace.QName; -import java.io.File; -import java.util.*; - -/** - * @author Vivek Pandey - */ -public class WsgenOptions extends Options { - /** - * -servicename - */ - public QName serviceName; - - /** - * -portname - */ - public QName portName; - - /** - * -r - */ - public File nonclassDestDir; - - - /** - * -wsdl - */ - public boolean genWsdl; - - /** - * protocol value - */ - public String protocol = "soap1.1"; - - public Set protocols = new LinkedHashSet(); - public Map nonstdProtocols = new LinkedHashMap(); - - /** - * -XwsgenReport - */ - public File wsgenReport; - - /** - * -Xdonotoverwrite - */ - public boolean doNotOverWrite; - - public Filer filer; - - - /** - * Tells if user specified a specific protocol - */ - public boolean protocolSet = false; - - private static final String SERVICENAME_OPTION = "-servicename"; - private static final String PORTNAME_OPTION = "-portname"; - private static final String HTTP = "http"; - private static final String SOAP11 = "soap1.1"; - public static final String X_SOAP12 = "Xsoap1.2"; - - public WsgenOptions() { - protocols.add(SOAP11); - protocols.add(X_SOAP12); - nonstdProtocols.put(X_SOAP12, SOAPBindingImpl.X_SOAP12HTTP_BINDING); - ServiceFinder extn = ServiceFinder.find(WsgenExtension.class); - for(WsgenExtension ext : extn) { - Class clazz = ext.getClass(); - WsgenProtocol pro = (WsgenProtocol)clazz.getAnnotation(WsgenProtocol.class); - protocols.add(pro.token()); - nonstdProtocols.put(pro.token(), pro.lexical()); - } - } - - @Override - protected int parseArguments(String[] args, int i) throws BadCommandLineException { - - int j = super.parseArguments(args, i); - if (args[i].equals(SERVICENAME_OPTION)) { - serviceName = QName.valueOf(requireArgument(SERVICENAME_OPTION, args, ++i)); - if (serviceName.getNamespaceURI() == null || serviceName.getNamespaceURI().length() == 0) { - throw new BadCommandLineException(WscompileMessages.WSGEN_SERVICENAME_MISSING_NAMESPACE(args[i])); - } - if (serviceName.getLocalPart() == null || serviceName.getLocalPart().length() == 0) { - throw new BadCommandLineException(WscompileMessages.WSGEN_SERVICENAME_MISSING_LOCALNAME(args[i])); - } - return 2; - } else if (args[i].equals(PORTNAME_OPTION)) { - portName = QName.valueOf(requireArgument(PORTNAME_OPTION, args, ++i)); - if (portName.getNamespaceURI() == null || portName.getNamespaceURI().length() == 0) { - throw new BadCommandLineException(WscompileMessages.WSGEN_PORTNAME_MISSING_NAMESPACE(args[i])); - } - if (portName.getLocalPart() == null || portName.getLocalPart().length() == 0) { - throw new BadCommandLineException(WscompileMessages.WSGEN_PORTNAME_MISSING_LOCALNAME(args[i])); - } - return 2; - } else if (args[i].equals("-r")) { - nonclassDestDir = new File(requireArgument("-r", args, ++i)); - if (!nonclassDestDir.exists()) { - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(nonclassDestDir.getPath())); - } - return 2; - } else if (args[i].equals("-classpath") || args[i].equals("-cp")) { - classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path"); - return 2; - } else if (args[i].startsWith("-wsdl")) { - genWsdl = true; - //String value = requireArgument("-wsdl", args, ++i).substring(5); - String value = args[i].substring(5); - int index = value.indexOf(':'); - if (index == 0) { - value = value.substring(1); - index = value.indexOf('/'); - if (index == -1) { - protocol = value; - } else { - protocol = value.substring(0, index); - } - protocolSet = true; - } - return 1; - } else if (args[i].equals("-XwsgenReport")) { - // undocumented switch for the test harness - wsgenReport = new File(requireArgument("-XwsgenReport", args, ++i)); - return 2; - } else if (args[i].equals("-Xdonotoverwrite")) { - doNotOverWrite = true; - return 1; - } - return j; - } - - - @Override - protected void addFile(String arg) { - endpoints.add(arg); - } - - List endpoints = new ArrayList(); - - public Class endpoint; - - - private boolean isImplClass; - private boolean noWebServiceEndpoint; - - public void validate() throws BadCommandLineException { - if(nonclassDestDir == null) - nonclassDestDir = destDir; - - if (!protocols.contains(protocol)) { - throw new BadCommandLineException(WscompileMessages.WSGEN_INVALID_PROTOCOL(protocol, protocols)); - } - - if (endpoints.isEmpty()) { - throw new BadCommandLineException(WscompileMessages.WSGEN_MISSING_FILE()); - } - if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode()) { - throw new BadCommandLineException(WscompileMessages.WSGEN_SOAP_12_WITHOUT_EXTENSION()); - } - - if (nonstdProtocols.containsKey(protocol) && !isExtensionMode()) { - throw new BadCommandLineException(WscompileMessages.WSGEN_PROTOCOL_WITHOUT_EXTENSION(protocol)); - } - - validateEndpointClass(); - validateArguments(); - } - /** - * Get an implementation class annotated with @WebService annotation. - */ - private void validateEndpointClass() throws BadCommandLineException { - Class clazz = null; - for(String cls : endpoints){ - clazz = getClass(cls); - if (clazz == null) - continue; - - if (clazz.isEnum() || clazz.isInterface() || - clazz.isPrimitive()) { - continue; - } - isImplClass = true; - WebService webService = (WebService) clazz.getAnnotation(WebService.class); - if(webService == null) - continue; - break; - } - if(clazz == null){ - throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoints.get(0))); - } - if(!isImplClass){ - throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(clazz.getName())); - } - if(noWebServiceEndpoint){ - throw new BadCommandLineException(WscompileMessages.WSGEN_NO_WEBSERVICES_CLASS(clazz.getName())); - } - endpoint = clazz; - validateBinding(); - } - - private void validateBinding() throws BadCommandLineException { - if (genWsdl) { - BindingID binding = BindingID.parse(endpoint); - if ((binding.equals(BindingID.SOAP12_HTTP) || - binding.equals(BindingID.SOAP12_HTTP_MTOM)) && - !(protocol.equals(X_SOAP12) && isExtensionMode())) { - throw new BadCommandLineException(WscompileMessages.WSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(binding.toString(), endpoint.getName())); - } - if (binding.equals(BindingID.XML_HTTP)) { - throw new BadCommandLineException(WscompileMessages.WSGEN_CANNOT_GEN_WSDL_FOR_NON_SOAP_BINDING(binding.toString(), endpoint.getName())); - } - } - } - - private void validateArguments() throws BadCommandLineException { - if (!genWsdl) { - if (serviceName != null) { - throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(SERVICENAME_OPTION)); - } - if (portName != null) { - throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(PORTNAME_OPTION)); - } - } - } - - BindingID getBindingID(String protocol) { - if (protocol.equals(SOAP11)) - return BindingID.SOAP11_HTTP; - if (protocol.equals(X_SOAP12)) - return BindingID.SOAP12_HTTP; - String lexical = nonstdProtocols.get(protocol); - return (lexical != null) ? BindingID.parse(lexical) : null; - } - - - private Class getClass(String className) { - try { - return getClassLoader().loadClass(className); - } catch (ClassNotFoundException e) { - return null; - } - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java deleted file mode 100644 index 18c0d220efc..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; -import com.sun.tools.internal.ws.ToolVersion; -import com.sun.tools.internal.ws.api.WsgenExtension; -import com.sun.tools.internal.ws.api.WsgenProtocol; -import com.sun.tools.internal.ws.processor.modeler.annotation.AnnotationProcessorContext; -import com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP; -import com.sun.tools.internal.ws.processor.modeler.wsdl.ConsoleErrorReporter; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.xjc.util.NullStream; -import com.sun.xml.internal.txw2.TXW; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; -import com.sun.xml.internal.txw2.output.StreamSerializer; -import com.sun.xml.internal.ws.api.BindingID; -import com.sun.xml.internal.ws.api.server.Container; -import com.sun.xml.internal.ws.api.wsdl.writer.WSDLGeneratorExtension; -import com.sun.xml.internal.ws.binding.WebServiceFeatureList; -import com.sun.xml.internal.ws.binding.SOAPBindingImpl; -import com.sun.xml.internal.ws.model.AbstractSEIModelImpl; -import com.sun.xml.internal.ws.model.RuntimeModeler; -import com.sun.xml.internal.ws.util.ServiceFinder; -import com.sun.xml.internal.ws.wsdl.writer.WSDLGenerator; -import com.sun.xml.internal.ws.wsdl.writer.WSDLResolver; -import com.sun.istack.internal.tools.ParallelWorldClassLoader; -import org.xml.sax.SAXParseException; - -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.namespace.QName; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; -import javax.xml.ws.EndpointReference; -import javax.xml.ws.Holder; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.lang.reflect.Field; -import java.net.URLClassLoader; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * @author Vivek Pandey - */ -public class WsgenTool implements AnnotationProcessorFactory { - private final PrintStream out; - private final WsgenOptions options = new WsgenOptions(); - - - public WsgenTool(OutputStream out, Container container) { - this.out = (out instanceof PrintStream)?(PrintStream)out:new PrintStream(out); - this.container = container; - } - - - public WsgenTool(OutputStream out) { - this(out, null); - } - - public boolean run(String[] args){ - final Listener listener = new Listener(); - for (String arg : args) { - if (arg.equals("-version")) { - listener.message(ToolVersion.VERSION.BUILD_VERSION); - return true; - } - } - try { - options.parseArguments(args); - options.validate(); - if(!buildModel(options.endpoint.getName(), listener)){ - return false; - } - }catch (Options.WeAreDone done){ - usage((WsgenOptions)done.getOptions()); - }catch (BadCommandLineException e) { - if(e.getMessage()!=null) { - System.out.println(e.getMessage()); - System.out.println(); - } - usage((WsgenOptions)e.getOptions()); - return false; - }catch(AbortException e){ - //error might have been reported - }finally{ - if(!options.keep){ - options.removeGeneratedFiles(); - } - } - return true; - } - - private AnnotationProcessorContext context; - private final Container container; - - private WebServiceAP webServiceAP; - - private int round = 0; - - // Workaround for bug 6499165 on jax-ws, - // Original bug with JDK 6500594 , 6500594 when compiled with debug option, - private void workAroundJavacDebug() { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - try { - final Class aptMain = cl.loadClass("com.sun.tools.apt.main.Main"); - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - try { - Field forcedOpts = aptMain.getDeclaredField("forcedOpts"); - forcedOpts.setAccessible(true); - forcedOpts.set(null, new String[]{}); - } catch (NoSuchFieldException e) { - if(options.verbose) - e.printStackTrace(); - } catch (IllegalAccessException e) { - if(options.verbose) - e.printStackTrace(); - } - return null; - } - }); - } catch (ClassNotFoundException e) { - if(options.verbose) - e.printStackTrace(); - } - } - - /* - * To take care of JDK6-JDK6u3, where 2.1 API classes are not there - */ - private static boolean useBootClasspath(Class clazz) { - try { - ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); - return true; - } catch(Exception e) { - return false; - } - } - - - public boolean buildModel(String endpoint, Listener listener) throws BadCommandLineException { - final ErrorReceiverFilter errReceiver = new ErrorReceiverFilter(listener); - context = new AnnotationProcessorContext(); - webServiceAP = new WebServiceAP(options, context, errReceiver, out); - - boolean bootCP = useBootClasspath(EndpointReference.class) || useBootClasspath(XmlSeeAlso.class); - - String[] args = new String[8 + (bootCP ? 1 :0)]; - args[0] = "-d"; - args[1] = options.destDir.getAbsolutePath(); - args[2] = "-classpath"; - args[3] = options.classpath; - args[4] = "-s"; - args[5] = options.sourceDir.getAbsolutePath(); - args[6] = "-XclassesAsDecls"; - args[7] = endpoint; - if (bootCP) { - args[8] = "-Xbootclasspath/p:"+JavaCompilerHelper.getJarFile(EndpointReference.class)+File.pathSeparator+JavaCompilerHelper.getJarFile(XmlSeeAlso.class); - } - - // Workaround for bug 6499165: issue with javac debug option - workAroundJavacDebug(); - int result = com.sun.tools.apt.Main.process(this, args); - if (result != 0) { - out.println(WscompileMessages.WSCOMPILE_ERROR(WscompileMessages.WSCOMPILE_COMPILATION_FAILED())); - return false; - } - if (options.genWsdl) { - String tmpPath = options.destDir.getAbsolutePath()+ File.pathSeparator+options.classpath; - ClassLoader classLoader = new URLClassLoader(Options.pathToURLs(tmpPath), - this.getClass().getClassLoader()); - Class endpointClass; - try { - endpointClass = classLoader.loadClass(endpoint); - } catch (ClassNotFoundException e) { - throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoint)); - } - - BindingID bindingID = options.getBindingID(options.protocol); - if (!options.protocolSet) { - bindingID = BindingID.parse(endpointClass); - } - WebServiceFeatureList wsfeatures = new WebServiceFeatureList(endpointClass); - RuntimeModeler rtModeler = new RuntimeModeler(endpointClass, options.serviceName, bindingID, wsfeatures.toArray()); - rtModeler.setClassLoader(classLoader); - if (options.portName != null) - rtModeler.setPortName(options.portName); - AbstractSEIModelImpl rtModel = rtModeler.buildRuntimeModel(); - - final File[] wsdlFileName = new File[1]; // used to capture the generated WSDL file. - final Map schemaFiles = new HashMap(); - - WSDLGenerator wsdlGenerator = new WSDLGenerator(rtModel, - new WSDLResolver() { - private File toFile(String suggestedFilename) { - return new File(options.nonclassDestDir, suggestedFilename); - } - private Result toResult(File file) { - Result result; - try { - result = new StreamResult(new FileOutputStream(file)); - result.setSystemId(file.getPath().replace('\\', '/')); - } catch (FileNotFoundException e) { - errReceiver.error(e); - return null; - } - return result; - } - - public Result getWSDL(String suggestedFilename) { - File f = toFile(suggestedFilename); - wsdlFileName[0] = f; - return toResult(f); - } - public Result getSchemaOutput(String namespace, String suggestedFilename) { - if (namespace.equals("")) - return null; - File f = toFile(suggestedFilename); - schemaFiles.put(namespace,f); - return toResult(f); - } - public Result getAbstractWSDL(Holder filename) { - return toResult(toFile(filename.value)); - } - public Result getSchemaOutput(String namespace, Holder filename) { - return getSchemaOutput(namespace, filename.value); - } - // TODO pass correct impl's class name - }, bindingID.createBinding(wsfeatures.toArray()), container, endpointClass, ServiceFinder.find(WSDLGeneratorExtension.class).toArray()); - wsdlGenerator.doGeneration(); - - if(options.wsgenReport!=null) - generateWsgenReport(endpointClass,rtModel,wsdlFileName[0],schemaFiles); - } - return true; - } - - /** - * Generates a small XML file that captures the key activity of wsgen, - * so that test harness can pick up artifacts. - */ - private void generateWsgenReport(Class endpointClass, AbstractSEIModelImpl rtModel, File wsdlFile, Map schemaFiles) { - try { - ReportOutput.Report report = TXW.create(ReportOutput.Report.class, - new StreamSerializer(new BufferedOutputStream(new FileOutputStream(options.wsgenReport)))); - - report.wsdl(wsdlFile.getAbsolutePath()); - ReportOutput.writeQName(rtModel.getServiceQName(), report.service()); - ReportOutput.writeQName(rtModel.getPortName(), report.port()); - ReportOutput.writeQName(rtModel.getPortTypeName(), report.portType()); - - report.implClass(endpointClass.getName()); - - for (Map.Entry e : schemaFiles.entrySet()) { - ReportOutput.Schema s = report.schema(); - s.ns(e.getKey()); - s.location(e.getValue().getAbsolutePath()); - } - - report.commit(); - } catch (IOException e) { - // this is code for the test, so we can be lousy in the error handling - throw new Error(e); - } - } - - /** - * "Namespace" for code needed to generate the report file. - */ - static class ReportOutput { - @XmlElement("report") - interface Report extends TypedXmlWriter { - @XmlElement - void wsdl(String file); // location of WSDL - @XmlElement - QualifiedName portType(); - @XmlElement - QualifiedName service(); - @XmlElement - QualifiedName port(); - - /** - * Name of the class that has {@link javax.jws.WebService}. - */ - @XmlElement - void implClass(String name); - - @XmlElement - Schema schema(); - } - - interface QualifiedName extends TypedXmlWriter { - @XmlAttribute - void uri(String ns); - @XmlAttribute - void localName(String localName); - } - - interface Schema extends TypedXmlWriter { - @XmlAttribute - void ns(String ns); - @XmlAttribute - void location(String filePath); - } - - private static void writeQName( QName n, QualifiedName w ) { - w.uri(n.getNamespaceURI()); - w.localName(n.getLocalPart()); - } - } - - protected void usage(WsgenOptions options) { - // Just don't see any point in passing WsgenOptions - // BadCommandLineException also shouldn't have options - if (options == null) - options = this.options; - System.out.println(WscompileMessages.WSGEN_HELP("WSGEN", options.protocols, options.nonstdProtocols.keySet())); - System.out.println(WscompileMessages.WSGEN_USAGE_EXAMPLES()); - } - - public Collection supportedOptions() { - return supportedOptions; - } - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - public AnnotationProcessor getProcessorFor(Set set, AnnotationProcessorEnvironment apEnv) { - if (options.verbose) - apEnv.getMessager().printNotice("\tap round: " + ++round); - webServiceAP.init(apEnv); - return webServiceAP; - } - - class Listener extends WsimportListener { - ConsoleErrorReporter cer = new ConsoleErrorReporter(out == null ? new PrintStream(new NullStream()) : out); - - @Override - public void generatedFile(String fileName) { - message(fileName); - } - - @Override - public void message(String msg) { - out.println(msg); - } - - @Override - public void error(SAXParseException exception) { - cer.error(exception); - } - - @Override - public void fatalError(SAXParseException exception) { - cer.fatalError(exception); - } - - @Override - public void warning(SAXParseException exception) { - cer.warning(exception); - } - - @Override - public void info(SAXParseException exception) { - cer.info(exception); - } - } - - /* - * Processor doesn't examine any options. - */ - static final Collection supportedOptions = Collections - .unmodifiableSet(new HashSet()); - - /* - * All annotation types are supported. - */ - static final Collection supportedAnnotations; - static { - Collection types = new HashSet(); - types.add("*"); - types.add("javax.jws.*"); - types.add("javax.jws.soap.*"); - supportedAnnotations = Collections.unmodifiableCollection(types); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportListener.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportListener.java deleted file mode 100644 index 2a29eb4c854..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportListener.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.tools.internal.xjc.api.ErrorListener; -import org.xml.sax.SAXParseException; - -/** - * @author Vivek Pandey - */ -public class WsimportListener implements ErrorListener { - /** - * Called for each file generated by wsimport or wsgen. - * - *

    - * The file name includes the path portions that correspond with the package name. - * - *

    - * When generating files into a directory, file names will be relative to the - * output directory. - * - * @param fileName - * file names like "org/acme/foo/Foo.java" - * - */ - public void generatedFile(String fileName) {} - - /** - * Other miscellenous messages that do not have structures - * will be reported through this method. - * - * This method is used like {@link java.io.PrintStream#println(String)}. - * The callee is expected to add '\n'. - */ - public void message(String msg) {} - - public void error(SAXParseException exception) { - - } - - public void fatalError(SAXParseException exception) { - - } - - public void warning(SAXParseException exception) { - - } - - public void info(SAXParseException exception) { - - } - - public void debug(SAXParseException exception){} - - /** - * wsimport will periodically invoke this method to see if it should cancel a compilation. - * - * @return - * true if the {@link com.sun.tools.internal.ws.wscompile.WsimportListener} wants to abort the processing. - * @since 2.1 - */ - public boolean isCanceled() { - return false; - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java deleted file mode 100644 index 88b5994af80..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.codemodel.internal.JCodeModel; -import com.sun.tools.internal.ws.resources.ConfigurationMessages; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.ws.util.ForkEntityResolver; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; -import com.sun.tools.internal.xjc.api.SchemaCompiler; -import com.sun.tools.internal.xjc.api.SpecVersion; -import com.sun.tools.internal.xjc.api.XJC; -import com.sun.tools.internal.xjc.reader.Util; -import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory; -import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; -import com.sun.xml.internal.ws.util.JAXWSUtils; -import com.sun.xml.internal.ws.util.xml.XmlUtil; -import org.w3c.dom.Element; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.helpers.LocatorImpl; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamReader; -import java.io.File; -import java.io.IOException; -import java.net.Authenticator; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Vivek Pandey - */ -public class WsimportOptions extends Options { - /** - * -wsdlLocation - */ - public String wsdlLocation; - - /** - * Actually stores {@link com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver}, but the field - * type is made to {@link org.xml.sax.EntityResolver} so that XJC can be - * used even if resolver.jar is not available in the classpath. - */ - public EntityResolver entityResolver = null; - - /** - * The -p option that should control the default Java package that - * will contain the generated code. Null if unspecified. - */ - public String defaultPackage = null; - - /** - * -XadditionalHeaders - */ - public boolean additionalHeaders; - - /** - * Setting disableSSLHostVerification to true disables the SSL Hostname verification while fetching the wsdls. - * -XdisableSSLHostVerification - */ - public boolean disableSSLHostnameVerification; - - /** - * JAXB's {@link SchemaCompiler} to be used for handling the schema portion. - * This object is also configured through options. - */ - private SchemaCompiler schemaCompiler = XJC.createSchemaCompiler(); - - /** - * Authentication file - */ - public File authFile; - - public JCodeModel getCodeModel() { - if(codeModel == null) - codeModel = new JCodeModel(); - return codeModel; - } - - public SchemaCompiler getSchemaCompiler() { - schemaCompiler.setTargetVersion(SpecVersion.parse(target.getVersion())); - schemaCompiler.setEntityResolver(entityResolver); - return schemaCompiler; - } - - public void setCodeModel(JCodeModel codeModel) { - this.codeModel = codeModel; - } - - private JCodeModel codeModel; - - /** - * This captures jars passed on the commandline and passes them to XJC and puts them in the classpath for compilation - */ - public List cmdlineJars = new ArrayList(); - - /** - * Parses arguments and fill fields of this object. - * - * @exception BadCommandLineException - * thrown when there's a problem in the command-line arguments - */ - @Override - public final void parseArguments( String[] args ) throws BadCommandLineException { - - for (int i = 0; i < args.length; i++) { - if(args[i].length()==0) - throw new BadCommandLineException(); - if (args[i].charAt(0) == '-') { - int j = parseArguments(args,i); - if(j==0) - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); - i += (j-1); - } else { - if(args[i].endsWith(".jar")) { - - try { - cmdlineJars.add(args[i]); - schemaCompiler.getOptions().scanEpisodeFile(new File(args[i])); - - } catch (com.sun.tools.internal.xjc.BadCommandLineException e) { - //Driver.usage(jaxbOptions,false); - throw new BadCommandLineException(e.getMessage(), e); - } - } else{ - addFile(args[i]); - } - } - } - if(destDir == null) - destDir = new File("."); - if(sourceDir == null) - sourceDir = destDir; - } - - /** -Xno-addressing-databinding option to disable addressing namespace data binding. This is - * experimental switch and will be working as a temporary workaround till - * jaxb can provide a better way to selelctively disable compiling of an - * schema component. - * **/ - public boolean noAddressingBbinding; - - @Override - public int parseArguments(String[] args, int i) throws BadCommandLineException { - int j = super.parseArguments(args ,i); - if(j>0) return j; // understood by the super class - - if (args[i].equals("-b")) { - addBindings(requireArgument("-b", args, ++i)); - return 2; - } else if (args[i].equals("-wsdllocation")) { - wsdlLocation = requireArgument("-wsdllocation", args, ++i); - return 2; - } else if (args[i].equals("-XadditionalHeaders")) { - additionalHeaders = true; - return 1; - } else if (args[i].equals("-XdisableSSLHostnameVerification")) { - disableSSLHostnameVerification = true; - return 1; - } else if (args[i].equals("-p")) { - defaultPackage = requireArgument("-p", args, ++i); - return 2; - } else if (args[i].equals("-catalog")) { - String catalog = requireArgument("-catalog", args, ++i); - try { - if (entityResolver == null) { - if (catalog != null && catalog.length() > 0) - entityResolver = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog)))); - } else if (catalog != null && catalog.length() > 0) { - EntityResolver er = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog)))); - entityResolver = new ForkEntityResolver(er, entityResolver); - } - } catch (IOException e) { - throw new BadCommandLineException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(catalog, e.getMessage())); - } - return 2; - } else if (args[i].startsWith("-httpproxy:")) { - String value = args[i].substring(11); - if (value.length() == 0) { - throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); - } - int index = value.indexOf(':'); - if (index == -1) { - System.setProperty("proxySet", "true"); - System.setProperty("proxyHost", value); - System.setProperty("proxyPort", "8080"); - } else { - System.setProperty("proxySet", "true"); - System.setProperty("proxyHost", value.substring(0, index)); - System.setProperty("proxyPort", value.substring(index + 1)); - } - return 1; - } else if (args[i].equals("-Xno-addressing-databinding")) { - noAddressingBbinding = true; - return 1; - } else if (args[i].startsWith("-B")) { - // JAXB option pass through. - String[] subCmd = new String[args.length-i]; - System.arraycopy(args,i,subCmd,0,subCmd.length); - subCmd[0] = subCmd[0].substring(2); // trim off the first "-B" - - com.sun.tools.internal.xjc.Options jaxbOptions = schemaCompiler.getOptions(); - try { - int r = jaxbOptions.parseArgument(subCmd, 0); - if(r==0) { - //Driver.usage(jaxbOptions,false); - throw new BadCommandLineException(WscompileMessages.WSIMPORT_NO_SUCH_JAXB_OPTION(subCmd[0])); - } - return r; - } catch (com.sun.tools.internal.xjc.BadCommandLineException e) { - //Driver.usage(jaxbOptions,false); - throw new BadCommandLineException(e.getMessage(),e); - } - } else if (args[i].equals("-Xauthfile")) { - String authfile = requireArgument("-Xauthfile", args, ++i); - authFile = new File(authfile); - return 2; - } - - return 0; // what's this option? - } - - public void validate() throws BadCommandLineException { - if (wsdls.isEmpty()) { - throw new BadCommandLineException(WscompileMessages.WSIMPORT_MISSING_FILE()); - } - - if(wsdlLocation == null){ - wsdlLocation = wsdls.get(0).getSystemId(); - } - } - - @Override - protected void addFile(String arg) throws BadCommandLineException { - addFile(arg, wsdls, "*.wsdl"); - } - - private final List wsdls = new ArrayList(); - private final List schemas = new ArrayList(); - private final List bindingFiles = new ArrayList(); - private final List jaxwsCustomBindings = new ArrayList(); - private final List jaxbCustomBindings = new ArrayList(); - private final List handlerConfigs = new ArrayList(); - - /** - * There is supposed to be one handler chain per generated SEI. - * TODO: There is possible bug, how to associate a @HandlerChain - * with each port on the generated SEI. For now lets preserve the JAXWS 2.0 FCS - * behaviour and generate only one @HandlerChain on the SEI - */ - public Element getHandlerChainConfiguration(){ - if(handlerConfigs.size() > 0) - return handlerConfigs.get(0); - return null; - } - - public void addHandlerChainConfiguration(Element config){ - handlerConfigs.add(config); - } - - public InputSource[] getWSDLs() { - return wsdls.toArray(new InputSource[wsdls.size()]); - } - - public InputSource[] getSchemas() { - return schemas.toArray(new InputSource[schemas.size()]); - } - - public InputSource[] getWSDLBindings() { - return jaxwsCustomBindings.toArray(new InputSource[jaxwsCustomBindings.size()]); - } - - public InputSource[] getSchemaBindings() { - return jaxbCustomBindings.toArray(new InputSource[jaxbCustomBindings.size()]); - } - - public void addWSDL(File source) { - addWSDL(fileToInputSource(source)); - } - - public void addWSDL(InputSource is) { - wsdls.add(absolutize(is)); - } - - public void addSchema(File source) { - addSchema(fileToInputSource(source)); - } - - public void addSchema(InputSource is) { - schemas.add(is); - } - - private InputSource fileToInputSource(File source) { - try { - String url = source.toURL().toExternalForm(); - return new InputSource(Util.escapeSpace(url)); - } catch (MalformedURLException e) { - return new InputSource(source.getPath()); - } - } - - /** - * Recursively scan directories and add all XSD files in it. - */ - public void addGrammarRecursive(File dir) { - addRecursive(dir, ".wsdl", wsdls); - addRecursive(dir, ".xsd", schemas); - } - - /** - * Adds a new input schema. - */ - public void addWSDLBindFile(InputSource is) { - jaxwsCustomBindings.add(absolutize(is)); - } - - public void addSchemmaBindFile(InputSource is) { - jaxbCustomBindings.add(absolutize(is)); - } - - private void addRecursive(File dir, String suffix, List result) { - File[] files = dir.listFiles(); - if (files == null) return; // work defensively - - for (File f : files) { - if (f.isDirectory()) - addRecursive(f, suffix, result); - else if (f.getPath().endsWith(suffix)) - result.add(absolutize(fileToInputSource(f))); - } - } - - private InputSource absolutize(InputSource is) { - // absolutize all the system IDs in the input, - // so that we can map system IDs to DOM trees. - try { - URL baseURL = new File(".").getCanonicalFile().toURL(); - is.setSystemId(new URL(baseURL, is.getSystemId()).toExternalForm()); - } catch (IOException e) { - // ignore - } - return is; - } - - public void addBindings(String name) throws BadCommandLineException { - addFile(name, bindingFiles, null); - } - - /** - * Parses a token to a file (or a set of files) - * and add them as {@link InputSource} to the specified list. - * - * @param suffix If the given token is a directory name, we do a recusive search - * and find all files that have the given suffix. - */ - private void addFile(String name, List target, String suffix) throws BadCommandLineException { - Object src; - try { - src = Util.getFileOrURL(name); - } catch (IOException e) { - throw new BadCommandLineException(WscompileMessages.WSIMPORT_NOT_A_FILE_NOR_URL(name)); - } - if (src instanceof URL) { - target.add(absolutize(new InputSource(Util.escapeSpace(((URL) src).toExternalForm())))); - } else { - File fsrc = (File) src; - if (fsrc.isDirectory()) { - addRecursive(fsrc, suffix, target); - } else { - target.add(absolutize(fileToInputSource(fsrc))); - } - } - } - - - /** - * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it. - * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model - * - * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately - * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder} - * - * @param receiver {@link ErrorReceiver} - */ - public final void parseBindings(ErrorReceiver receiver){ - for (InputSource is : bindingFiles) { - XMLStreamReader reader = - XMLStreamReaderFactory.create(is,true); - XMLStreamReaderUtil.nextElementContent(reader); - if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) { - jaxwsCustomBindings.add(is); - } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) || - reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) { - jaxbCustomBindings.add(is); - } else { - LocatorImpl locator = new LocatorImpl(); - locator.setSystemId(reader.getLocation().getSystemId()); - locator.setPublicId(reader.getLocation().getPublicId()); - locator.setLineNumber(reader.getLocation().getLineNumber()); - locator.setColumnNumber(reader.getLocation().getColumnNumber()); - receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId())); - } - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java deleted file mode 100644 index 656e3132340..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wscompile; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.writer.ProgressCodeWriter; -import com.sun.tools.internal.ws.ToolVersion; -import com.sun.tools.internal.ws.api.TJavaGeneratorExtension; -import com.sun.tools.internal.ws.processor.generator.CustomExceptionGenerator; -import com.sun.tools.internal.ws.processor.generator.SeiGenerator; -import com.sun.tools.internal.ws.processor.generator.ServiceGenerator; -import com.sun.tools.internal.ws.processor.model.Model; -import com.sun.tools.internal.ws.processor.modeler.wsdl.ConsoleErrorReporter; -import com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.xjc.util.NullStream; -import com.sun.xml.internal.ws.api.server.Container; -import com.sun.xml.internal.ws.util.ServiceFinder; -import com.sun.istack.internal.tools.ParallelWorldClassLoader; -import org.xml.sax.EntityResolver; -import org.xml.sax.SAXParseException; - -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.EndpointReference; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.net.Authenticator; - -/** - * @author Vivek Pandey - */ -public class WsimportTool { - private static final String WSIMPORT = "wsimport"; - private final PrintStream out; - private final Container container; - - /** - * Wsimport specific options - */ - private final WsimportOptions options = new WsimportOptions(); - - public WsimportTool(OutputStream out) { - this(out, null); - } - - public WsimportTool(OutputStream logStream, Container container) { - this.out = (logStream instanceof PrintStream)?(PrintStream)logStream:new PrintStream(logStream); - this.container = container; - } - - public boolean run(String[] args) { - class Listener extends WsimportListener { - ConsoleErrorReporter cer = new ConsoleErrorReporter(out == null ? new PrintStream(new NullStream()) : out); - - @Override - public void generatedFile(String fileName) { - message(fileName); - } - - @Override - public void message(String msg) { - out.println(msg); - } - - @Override - public void error(SAXParseException exception) { - cer.error(exception); - } - - @Override - public void fatalError(SAXParseException exception) { - cer.fatalError(exception); - } - - @Override - public void warning(SAXParseException exception) { - cer.warning(exception); - } - - @Override - public void debug(SAXParseException exception) { - cer.debug(exception); - } - - @Override - public void info(SAXParseException exception) { - cer.info(exception); - } - - public void enableDebugging(){ - cer.enableDebugging(); - } - } - final Listener listener = new Listener(); - ErrorReceiverFilter receiver = new ErrorReceiverFilter(listener) { - public void info(SAXParseException exception) { - if (options.verbose) - super.info(exception); - } - - public void warning(SAXParseException exception) { - if (!options.quiet) - super.warning(exception); - } - - @Override - public void pollAbort() throws AbortException { - if (listener.isCanceled()) - throw new AbortException(); - } - - @Override - public void debug(SAXParseException exception){ - if(options.debugMode){ - listener.debug(exception); - } - } - }; - - for (String arg : args) { - if (arg.equals("-version")) { - listener.message(ToolVersion.VERSION.BUILD_VERSION); - return true; - } - } - try { - options.parseArguments(args); - options.validate(); - if(options.debugMode) - listener.enableDebugging(); - options.parseBindings(receiver); - - try { - if( !options.quiet ) - listener.message(WscompileMessages.WSIMPORT_PARSING_WSDL()); - - //set auth info - //if(options.authFile != null) - Authenticator.setDefault(new DefaultAuthenticator(receiver, options.authFile)); - - - WSDLModeler wsdlModeler = new WSDLModeler(options, receiver); - Model wsdlModel = wsdlModeler.buildModel(); - if (wsdlModel == null) { - listener.message(WsdlMessages.PARSING_PARSE_FAILED()); - return false; - } - - //generated code - if( !options.quiet ) - listener.message(WscompileMessages.WSIMPORT_GENERATING_CODE()); - - TJavaGeneratorExtension[] genExtn = ServiceFinder.find(TJavaGeneratorExtension.class).toArray(); - CustomExceptionGenerator.generate(wsdlModel, options, receiver); - SeiGenerator.generate(wsdlModel, options, receiver, genExtn); - if(receiver.hadError()){ - throw new AbortException(); - } - ServiceGenerator.generate(wsdlModel, options, receiver); - CodeWriter cw = new WSCodeWriter(options.sourceDir, options); - if (options.verbose) - cw = new ProgressCodeWriter(cw, out); - options.getCodeModel().build(cw); - } catch(AbortException e){ - //error might have been reported - }catch (IOException e) { - receiver.error(e); - } - - if (!options.nocompile){ - if(!compileGeneratedClasses(receiver, listener)){ - listener.message(WscompileMessages.WSCOMPILE_COMPILATION_FAILED()); - return false; - } - } - - } catch (Options.WeAreDone done) { - usage(done.getOptions()); - } catch (BadCommandLineException e) { - if (e.getMessage() != null) { - System.out.println(e.getMessage()); - System.out.println(); - } - usage(e.getOptions()); - return false; - } finally{ - if(!options.keep){ - options.removeGeneratedFiles(); - } - } - return true; - } - - public void setEntityResolver(EntityResolver resolver){ - this.options.entityResolver = resolver; - } - - /* - * To take care of JDK6-JDK6u3, where 2.1 API classes are not there - */ - private static boolean useBootClasspath(Class clazz) { - try { - ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); - return true; - } catch(Exception e) { - return false; - } - } - - - protected boolean compileGeneratedClasses(ErrorReceiver receiver, WsimportListener listener){ - List sourceFiles = new ArrayList(); - - for (File f : options.getGeneratedFiles()) { - if (f.exists() && f.getName().endsWith(".java")) { - sourceFiles.add(f.getAbsolutePath()); - } - } - - if (sourceFiles.size() > 0) { - String classDir = options.destDir.getAbsolutePath(); - String classpathString = createClasspathString(); - boolean bootCP = useBootClasspath(EndpointReference.class) || useBootClasspath(XmlSeeAlso.class); - String[] args = new String[4 + (bootCP ? 1 : 0) + (options.debug ? 1 : 0) - + sourceFiles.size()]; - args[0] = "-d"; - args[1] = classDir; - args[2] = "-classpath"; - args[3] = classpathString; - int baseIndex = 4; - if (bootCP) { - args[baseIndex++] = "-Xbootclasspath/p:"+JavaCompilerHelper.getJarFile(EndpointReference.class)+File.pathSeparator+JavaCompilerHelper.getJarFile(XmlSeeAlso.class); - } - - if (options.debug) { - args[baseIndex++] = "-g"; - } - for (int i = 0; i < sourceFiles.size(); ++i) { - args[baseIndex + i] = sourceFiles.get(i); - } - - listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE()); - if(options.verbose){ - StringBuffer argstr = new StringBuffer(); - for(String arg:args){ - argstr.append(arg).append(" "); - } - listener.message("javac "+ argstr.toString()); - } - - return JavaCompilerHelper.compile(args, out, receiver); - } - //there are no files to compile, so return true? - return true; - } - - private String createClasspathString() { - String classpathStr = System.getProperty("java.class.path"); - for(String s: options.cmdlineJars) { - classpathStr = classpathStr+File.pathSeparator+new File(s); - } - return classpathStr; - } - - protected void usage(Options options) { - System.out.println(WscompileMessages.WSIMPORT_HELP(WSIMPORT)); - System.out.println(WscompileMessages.WSIMPORT_USAGE_EXTENSIONS()); - System.out.println(WscompileMessages.WSIMPORT_USAGE_EXAMPLES()); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Binding.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Binding.java deleted file mode 100644 index acecc1abad2..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Binding.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * Entity corresponding to the "binding" WSDL element. - * - * @author WS Development Team - */ -public class Binding extends GlobalEntity implements TWSDLExtensible { - - public Binding(Defining defining, Locator locator, ErrorReceiver receiver) { - super(defining, locator, receiver); - _operations = new ArrayList(); - _helper = new ExtensibilityHelper(); - } - - public void add(BindingOperation operation) { - _operations.add(operation); - } - - public Iterator operations() { - return _operations.iterator(); - } - - public QName getPortType() { - return _portType; - } - - public void setPortType(QName n) { - _portType = n; - } - - public PortType resolvePortType(AbstractDocument document) { - try { - return (PortType) document.find(Kinds.PORT_TYPE, _portType); - } catch (NoSuchEntityException e) { - errorReceiver.error(getLocator(), WsdlMessages.ENTITY_NOT_FOUND_PORT_TYPE(_portType, new QName(getNamespaceURI(), getName()))); - throw new AbortException(); - } - } - - public Kind getKind() { - return Kinds.BINDING; - } - - public QName getElementName() { - return WSDLConstants.QNAME_BINDING; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllSubEntitiesDo(EntityAction action) { - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - _helper.withAllSubEntitiesDo(action); - } - - public void withAllQNamesDo(QNameAction action) { - super.withAllQNamesDo(action); - - if (_portType != null) { - action.perform(_portType); - } - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - super.withAllEntityReferencesDo(action); - if (_portType != null) { - action.perform(Kinds.PORT_TYPE, _portType); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - //bug fix: 4947340, extensions should be the first element - _helper.accept(visitor); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - ((BindingOperation) iter.next()).accept(visitor); - } - visitor.postVisit(this); - } - - public void validateThis() { - if (getName() == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - if (_portType == null) { - failValidation("validation.missingRequiredAttribute", "type"); - } - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getDefining().getTargetNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - private ExtensibilityHelper _helper; - private Documentation _documentation; - private QName _portType; - private List _operations; - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingFault.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingFault.java deleted file mode 100644 index d8aaaf8d2cd..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingFault.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "fault" child element of a binding operation. - * - * @author WS Development Team - */ -public class BindingFault extends Entity implements TWSDLExtensible { - - public BindingFault(Locator locator) { - super(locator); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getElementName() { - return WSDLConstants.QNAME_FAULT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getParent().getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void withAllSubEntitiesDo(EntityAction action) { - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - if (_name == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - } - - private ExtensibilityHelper _helper; - private Documentation _documentation; - private String _name; - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingInput.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingInput.java deleted file mode 100644 index 175e491bfa0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingInput.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "input" child element of a binding operation. - * - * @author WS Development Team - */ -public class BindingInput extends Entity implements TWSDLExtensible { - - public BindingInput(Locator locator) { - super(locator); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getElementName() { - return WSDLConstants.QNAME_INPUT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getParent().getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void withAllSubEntitiesDo(EntityAction action) { - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - } - - private ExtensibilityHelper _helper; - private Documentation _documentation; - private String _name; - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingOperation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingOperation.java deleted file mode 100644 index 2de06846124..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingOperation.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.List; - -/** - * Entity corresponding to the "operation" child element of a WSDL "binding" element. - * - * @author WS Development Team - */ -public class BindingOperation extends Entity implements TWSDLExtensible { - - public BindingOperation(Locator locator) { - super(locator); - _faults = new ArrayList(); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public String getUniqueKey() { - if (_uniqueKey == null) { - StringBuffer sb = new StringBuffer(); - sb.append(_name); - sb.append(' '); - if (_input != null) { - sb.append(_input.getName()); - } else { - sb.append(_name); - if (_style == OperationStyle.REQUEST_RESPONSE) { - sb.append("Request"); - } else if (_style == OperationStyle.SOLICIT_RESPONSE) { - sb.append("Response"); - } - } - sb.append(' '); - if (_output != null) { - sb.append(_output.getName()); - } else { - sb.append(_name); - if (_style == OperationStyle.SOLICIT_RESPONSE) { - sb.append("Solicit"); - } else if (_style == OperationStyle.REQUEST_RESPONSE) { - sb.append("Response"); - } - } - _uniqueKey = sb.toString(); - } - - return _uniqueKey; - } - - public OperationStyle getStyle() { - return _style; - } - - public void setStyle(OperationStyle s) { - _style = s; - } - - public BindingInput getInput() { - return _input; - } - - public void setInput(BindingInput i) { - _input = i; - } - - public BindingOutput getOutput() { - return _output; - } - - public void setOutput(BindingOutput o) { - _output = o; - } - - public void addFault(BindingFault f) { - _faults.add(f); - } - - public Iterable faults() { - return _faults; - } - - public QName getElementName() { - return WSDLConstants.QNAME_OPERATION; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return parent.getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void withAllSubEntitiesDo(EntityAction action) { - if (_input != null) { - action.perform(_input); - } - if (_output != null) { - action.perform(_output); - } - for (BindingFault _fault : _faults) { - action.perform(_fault); - } - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - //bug fix: 4947340, extensions should be the first element - _helper.accept(visitor); - if (_input != null) { - _input.accept(visitor); - } - if (_output != null) { - _output.accept(visitor); - } - for (BindingFault _fault : _faults) { - _fault.accept(visitor); - } - visitor.postVisit(this); - } - - public void validateThis() { - if (_name == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - if (_style == null) { - failValidation("validation.missingRequiredProperty", "style"); - } - - // verify operation style - if (_style == OperationStyle.ONE_WAY) { - if (_input == null) { - failValidation("validation.missingRequiredSubEntity", "input"); - } - if (_output != null) { - failValidation("validation.invalidSubEntity", "output"); - } - if (_faults != null && _faults.size() != 0) { - failValidation("validation.invalidSubEntity", "fault"); - } - } - } - - private ExtensibilityHelper _helper; - private Documentation _documentation; - private String _name; - private BindingInput _input; - private BindingOutput _output; - private List _faults; - private OperationStyle _style; - private String _uniqueKey; - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingOutput.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingOutput.java deleted file mode 100644 index 70482a7cfcd..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/BindingOutput.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "output" child element of a binding operation. - * - * @author WS Development Team - */ -public class BindingOutput extends Entity implements TWSDLExtensible { - - public BindingOutput(Locator locator) { - super(locator); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getElementName() { - return WSDLConstants.QNAME_OUTPUT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void withAllSubEntitiesDo(EntityAction action) { - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - } - - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; - private ExtensibilityHelper _helper; - private Documentation _documentation; - private String _name; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Definitions.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Definitions.java deleted file mode 100644 index 8fd70787d33..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Definitions.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * Entity corresponding to the "definitions" WSDL element. - * - * @author WS Development Team - */ -public class Definitions extends Entity implements Defining, TWSDLExtensible { - - public Definitions(AbstractDocument document, Locator locator) { - super(locator); - _document = document; - _bindings = new ArrayList(); - _imports = new ArrayList(); - _messages = new ArrayList(); - _portTypes = new ArrayList(); - _services = new ArrayList(); - _importedNamespaces = new HashSet(); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String s) { - _name = s; - } - - public String getTargetNamespaceURI() { - return _targetNsURI; - } - - public void setTargetNamespaceURI(String s) { - _targetNsURI = s; - } - - public void setTypes(Types t) { - _types = t; - } - - public Types getTypes() { - return _types; - } - - public void add(Message m) { - _document.define(m); - _messages.add(m); - } - - public void add(PortType p) { - _document.define(p); - _portTypes.add(p); - } - - public void add(Binding b) { - _document.define(b); - _bindings.add(b); - } - - public void add(Service s) { - _document.define(s); - _services.add(s); - } - - public void addServiceOveride(Service s) { - _services.add(s); - } - - public void add(Import i) { - _imports.add(i); - _importedNamespaces.add(i.getNamespace()); - } - - public Iterator imports() { - return _imports.iterator(); - } - - public Iterator messages() { - return _messages.iterator(); - } - - public Iterator portTypes() { - return _portTypes.iterator(); - } - - public Iterator bindings() { - return _bindings.iterator(); - } - - public Iterator services() { - return _services.iterator(); - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getTargetNamespaceURI(); - } - - public QName getWSDLElementName() { - return WSDLConstants.QNAME_DEFINITIONS; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - /** - * wsdl:definition is the root hence no parent so return null. - */ - public TWSDLExtensible getParent() { - return null; - } - - public void withAllSubEntitiesDo(EntityAction action) { - if (_types != null) { - action.perform(_types); - } - for (Iterator iter = _messages.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - for (Iterator iter = _portTypes.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - for (Iterator iter = _bindings.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - for (Iterator iter = _services.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - for (Iterator iter = _imports.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - - for (Iterator iter = _imports.iterator(); iter.hasNext();) { - ((Import) iter.next()).accept(visitor); - } - - if (_types != null) { - _types.accept(visitor); - } - - for (Iterator iter = _messages.iterator(); iter.hasNext();) { - ((Message) iter.next()).accept(visitor); - } - for (Iterator iter = _portTypes.iterator(); iter.hasNext();) { - ((PortType) iter.next()).accept(visitor); - } - for (Iterator iter = _bindings.iterator(); iter.hasNext();) { - ((Binding) iter.next()).accept(visitor); - } - for (Iterator iter = _services.iterator(); iter.hasNext();) { - ((Service) iter.next()).accept(visitor); - } - - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - } - - private AbstractDocument _document; - private ExtensibilityHelper _helper; - private Documentation _documentation; - private String _name; - private String _targetNsURI; - private Types _types; - private List _messages; - private List _portTypes; - private List _bindings; - private List _services; - private List _imports; - private Set _importedNamespaces; - - public QName getElementName() { - return getWSDLElementName(); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Documentation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Documentation.java deleted file mode 100644 index 820a8b904c2..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Documentation.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -/** - * Entity corresponding to the "documentation" WSDL element. - * - * @author WS Development Team - */ -public class Documentation { - - public Documentation(String s) { - content = s; - } - - public String getContent() { - return content; - } - - public void setContent(String s) { - content = s; - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.visit(this); - } - - private String content; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Fault.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Fault.java deleted file mode 100644 index a6d1a3dcd53..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Fault.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "fault" child element of a port type operation. - * - * @author WS Development Team - */ -public class Fault extends Entity implements TWSDLExtensible { - - public Fault(Locator locator) { - super(locator); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getMessage() { - return _message; - } - - public void setMessage(QName n) { - _message = n; - } - - public Message resolveMessage(AbstractDocument document) { - return (Message) document.find(Kinds.MESSAGE, _message); - } - - public QName getElementName() { - return WSDLConstants.QNAME_FAULT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllQNamesDo(QNameAction action) { - if (_message != null) { - action.perform(_message); - } - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - super.withAllEntityReferencesDo(action); - if (_message != null) { - action.perform(Kinds.MESSAGE, _message); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - visitor.postVisit(this); - } - - public void validateThis() { - if (_name == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - if (_message == null) { - failValidation("validation.missingRequiredAttribute", "message"); - } - } - - private Documentation _documentation; - private String _name; - private QName _message; - private String _action; - private ExtensibilityHelper _helper; - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return parent.getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - /* (non-Javadoc) - * @see TWSDLExtensible#addExtension(ExtensionImpl) - */ - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - - } - - /* (non-Javadoc) - * @see TWSDLExtensible#extensions() - */ - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; - - public String getAction() { - return _action; - } - - public void setAction(String _action) { - this._action = _action; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Import.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Import.java deleted file mode 100644 index c5b862e0829..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Import.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "import" WSDL element. - * - * @author WS Development Team - */ -public class Import extends Entity{ - - public Import(Locator locator) { - super(locator); - } - - public String getNamespace() { - return _namespace; - } - - public void setNamespace(String s) { - _namespace = s; - } - - public String getLocation() { - return _location; - } - - public void setLocation(String s) { - _location = s; - } - - public QName getElementName() { - return WSDLConstants.QNAME_IMPORT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.visit(this); - } - - public void validateThis() { - if (_location == null) { - failValidation("validation.missingRequiredAttribute", "location"); - } - if (_namespace == null) { - failValidation("validation.missingRequiredAttribute", "namespace"); - } - } - - private Documentation _documentation; - private String _location; - private String _namespace; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Input.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Input.java deleted file mode 100644 index 5e3324b3a82..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Input.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "input" child element of a port type operation. - * - * @author WS Development Team - */ -public class Input extends Entity implements TWSDLExtensible { - - public Input(Locator locator, ErrorReceiver errReceiver) { - super(locator); - this.errorReceiver = errReceiver; - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getMessage() { - return _message; - } - - public void setMessage(QName n) { - _message = n; - } - - public Message resolveMessage(AbstractDocument document) { - return (Message) document.find(Kinds.MESSAGE, _message); - } - - public QName getElementName() { - return WSDLConstants.QNAME_INPUT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllQNamesDo(QNameAction action) { - if (_message != null) { - action.perform(_message); - } - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - super.withAllEntityReferencesDo(action); - if (_message != null) { - action.perform(Kinds.MESSAGE, _message); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - visitor.postVisit(this); - } - - public void validateThis() { - if (_message == null) { - errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message")); - throw new AbortException(); - } - } - - private Documentation _documentation; - private String _name; - private QName _message; - private String _action; - private ExtensibilityHelper _helper; - private TWSDLExtensible parent; - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - public String getNamespaceURI() { - return getElementName().getNamespaceURI(); - } - - public String getNameValue() { - return null; - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public String getAction() { - return _action; - } - - public void setAction(String _action) { - this._action = _action; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Kinds.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Kinds.java deleted file mode 100644 index 78ec56f1b41..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Kinds.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.Kind; - -/** - * Enumeration of the kind of entities that can be defined in a WSDL "definitions" element. - * - * @author WS Development Team - */ -public class Kinds { - public static final Kind BINDING = new Kind("wsdl:binding"); - public static final Kind MESSAGE = new Kind("wsdl:message"); - public static final Kind PORT = new Kind("wsdl:port"); - public static final Kind PORT_TYPE = new Kind("wsdl:portType"); - public static final Kind SERVICE = new Kind("wsdl:service"); - - private Kinds() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Message.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Message.java deleted file mode 100644 index 11b11c23563..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Message.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * Entity corresponding to the "message" WSDL element. - * - * @author WS Development Team - */ -public class Message extends GlobalEntity { - - public Message(Defining defining, Locator locator, ErrorReceiver errReceiver) { - super(defining, locator, errReceiver); - _parts = new ArrayList(); - _partsByName = new HashMap(); - } - - public void add(MessagePart part) { - if (_partsByName.get(part.getName()) != null){ - errorReceiver.error(part.getLocator(), WsdlMessages.VALIDATION_DUPLICATE_PART_NAME(getName(), part.getName())); - throw new AbortException(); - } - - if(part.getDescriptor() != null && part.getDescriptorKind() != null) { - _partsByName.put(part.getName(), part); - _parts.add(part); - } else - errorReceiver.warning(part.getLocator(), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(part.getName())); - } - - public Iterator parts() { - return _parts.iterator(); - } - - public List getParts(){ - return _parts; - } - - public MessagePart getPart(String name) { - return _partsByName.get(name); - } - - public int numParts() { - return _parts.size(); - } - - public Kind getKind() { - return Kinds.MESSAGE; - } - - public QName getElementName() { - return WSDLConstants.QNAME_MESSAGE; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllSubEntitiesDo(EntityAction action) { - super.withAllSubEntitiesDo(action); - - for (Iterator iter = _parts.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - for (Iterator iter = _parts.iterator(); iter.hasNext();) { - iter.next().accept(visitor); - } - visitor.postVisit(this); - } - - public void validateThis() { - if (getName() == null) { - errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message")); - throw new AbortException(); - } - } - - private Documentation _documentation; - private List _parts; - private Map _partsByName; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/MessagePart.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/MessagePart.java deleted file mode 100644 index f7900511ec4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/MessagePart.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityReferenceAction; -import com.sun.tools.internal.ws.wsdl.framework.Kind; -import com.sun.tools.internal.ws.wsdl.framework.QNameAction; -import org.xml.sax.Locator; - -import javax.jws.WebParam.Mode; -import javax.xml.namespace.QName; - -/** - * Entity corresponding to a WSDL message part. - * - * @author WS Development Team - */ -public class MessagePart extends Entity { - - public static final int SOAP_BODY_BINDING = 1; - public static final int SOAP_HEADER_BINDING = 2; - public static final int SOAP_HEADERFAULT_BINDING = 3; - public static final int SOAP_FAULT_BINDING = 4; - public static final int WSDL_MIME_BINDING = 5; - public static final int PART_NOT_BOUNDED = -1; - - public MessagePart(Locator locator) { - super(locator); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getDescriptor() { - return _descriptor; - } - - public void setDescriptor(QName n) { - _descriptor = n; - } - - public Kind getDescriptorKind() { - return _descriptorKind; - } - - public void setDescriptorKind(Kind k) { - _descriptorKind = k; - } - - public QName getElementName() { - return WSDLConstants.QNAME_PART; - } - - public int getBindingExtensibilityElementKind(){ - return _bindingKind; - } - - public void setBindingExtensibilityElementKind(int kind) { - _bindingKind = kind; - } - - public void withAllQNamesDo(QNameAction action) { - if (_descriptor != null) { - action.perform(_descriptor); - } - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - super.withAllEntityReferencesDo(action); - if (_descriptor != null && _descriptorKind != null) { - action.perform(_descriptorKind, _descriptor); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.visit(this); - } - - public void validateThis() { - if(_descriptor != null && _descriptor.getLocalPart().equals("")){ - failValidation("validation.invalidElement", _descriptor.toString()); - } - } - - public void setMode(Mode mode){ - this.mode = mode; - } - - public Mode getMode(){ - return mode; - } - - public boolean isINOUT(){ - if(mode!=null) - return (mode == Mode.INOUT); - return false; - } - - public boolean isIN(){ - if(mode!=null) - return (mode == Mode.IN); - return false; - } - - public boolean isOUT(){ - if(mode!=null) - return (mode == Mode.OUT); - return false; - } - - public void setReturn(boolean ret){ - isRet=ret; - } - - public boolean isReturn(){ - return isRet; - } - - - private boolean isRet; - private String _name; - private QName _descriptor; - private Kind _descriptorKind; - private int _bindingKind; - - private Mode mode; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Operation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Operation.java deleted file mode 100644 index 51e1cd192ce..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Operation.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.codemodel.internal.JClass; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.api.wsdl.TWSDLOperation; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * Entity corresponding to the "operation" child element of a "portType" WSDL element. - * - * @author WS Development Team - */ -public class Operation extends Entity implements TWSDLOperation { - - public Operation(Locator locator) { - super(locator); - _faults = new ArrayList(); - _helper = new ExtensibilityHelper(); - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public String getUniqueKey() { - if (_uniqueKey == null) { - StringBuffer sb = new StringBuffer(); - sb.append(_name); - sb.append(' '); - if (_input != null) { - sb.append(_input.getName()); - } else { - sb.append(_name); - if (_style == OperationStyle.REQUEST_RESPONSE) { - sb.append("Request"); - } else if (_style == OperationStyle.SOLICIT_RESPONSE) { - sb.append("Response"); - } - } - sb.append(' '); - if (_output != null) { - sb.append(_output.getName()); - } else { - sb.append(_name); - if (_style == OperationStyle.SOLICIT_RESPONSE) { - sb.append("Solicit"); - } else if (_style == OperationStyle.REQUEST_RESPONSE) { - sb.append("Response"); - } - } - _uniqueKey = sb.toString(); - } - - return _uniqueKey; - } - - public OperationStyle getStyle() { - return _style; - } - - public void setStyle(OperationStyle s) { - _style = s; - } - - public Input getInput() { - return _input; - } - - public void setInput(Input i) { - _input = i; - } - - public Output getOutput() { - return _output; - } - - public void setOutput(Output o) { - _output = o; - } - - public void addFault(Fault f) { - _faults.add(f); - } - - public Iterable faults() { - return _faults; - } - - public String getParameterOrder() { - return _parameterOrder; - } - - public void setParameterOrder(String s) { - _parameterOrder = s; - } - - public QName getElementName() { - return WSDLConstants.QNAME_OPERATION; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllSubEntitiesDo(EntityAction action) { - super.withAllSubEntitiesDo(action); - - if (_input != null) { - action.perform(_input); - } - if (_output != null) { - action.perform(_output); - } - for (Fault _fault : _faults) { - action.perform(_fault); - } - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - if (_input != null) { - _input.accept(visitor); - } - if (_output != null) { - _output.accept(visitor); - } - for (Fault _fault : _faults) { - _fault.accept(visitor); - } - visitor.postVisit(this); - } - - public void validateThis() { - if (_name == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - if (_style == null) { - failValidation("validation.missingRequiredProperty", "style"); - } - - // verify operation style - if (_style == OperationStyle.ONE_WAY) { - if (_input == null) { - failValidation("validation.missingRequiredSubEntity", "input"); - } - if (_output != null) { - failValidation("validation.invalidSubEntity", "output"); - } - if (_faults != null && _faults.size() != 0) { - failValidation("validation.invalidSubEntity", "fault"); - } - } else if (_style == OperationStyle.NOTIFICATION) { - if (_parameterOrder != null) { - failValidation("validation.invalidAttribute", "parameterOrder"); - } - } - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return parent.getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - /* (non-Javadoc) - * @see TWSDLExtensible#addExtension(ExtensionImpl) - */ - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - - } - - /* (non-Javadoc) - * @see TWSDLExtensible#extensions() - */ - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - public Map getFaults() { - return unmodifiableFaultClassMap; - } - - public void putFault(String faultName, JClass exception){ - faultClassMap.put(faultName, exception); - } - - private TWSDLExtensible parent; - private Documentation _documentation; - private String _name; - private Input _input; - private Output _output; - private List _faults; - private OperationStyle _style; - private String _parameterOrder; - private String _uniqueKey; - private ExtensibilityHelper _helper; - private final Map faultClassMap = new HashMap(); - private final Map unmodifiableFaultClassMap = Collections.unmodifiableMap(faultClassMap); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/OperationStyle.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/OperationStyle.java deleted file mode 100644 index 897c1523c35..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/OperationStyle.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -/** - * Enumeration of the supported WSDL operation styles. - * - * @author WS Development Team - */ -public final class OperationStyle { - - public static final OperationStyle ONE_WAY = new OperationStyle(); - public static final OperationStyle REQUEST_RESPONSE = new OperationStyle(); - public static final OperationStyle SOLICIT_RESPONSE = new OperationStyle(); - public static final OperationStyle NOTIFICATION = new OperationStyle(); - - private OperationStyle() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Output.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Output.java deleted file mode 100644 index 22f09cbc838..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Output.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "output" child element of a port type operation. - * - * @author WS Development Team - */ -public class Output extends Entity implements TWSDLExtensible { - - public Output(Locator locator, ErrorReceiver errReceiver) { - super(locator); - this.errorReceiver = errReceiver; - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public QName getMessage() { - return _message; - } - - public void setMessage(QName n) { - _message = n; - } - - public Message resolveMessage(AbstractDocument document) { - return (Message) document.find(Kinds.MESSAGE, _message); - } - - public QName getElementName() { - return WSDLConstants.QNAME_OUTPUT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllQNamesDo(QNameAction action) { - if (_message != null) { - action.perform(_message); - } - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - super.withAllEntityReferencesDo(action); - if (_message != null) { - action.perform(Kinds.MESSAGE, _message); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - visitor.postVisit(this); - } - - public void validateThis() { - if (_message == null) { - errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message")); - throw new AbortException(); - } - } - - private Documentation _documentation; - private String _name; - private QName _message; - private String _action; - private ExtensibilityHelper _helper; - private TWSDLExtensible parent; - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - public String getNamespaceURI() { - return getElementName().getNamespaceURI(); - } - - public String getNameValue() { - return null; - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public String getAction() { - return _action; - } - - public void setAction(String _action) { - this._action = _action; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Port.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Port.java deleted file mode 100644 index ee6e52dc8e2..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Port.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "port" WSDL element. - * - * @author WS Development Team - */ -public class Port extends GlobalEntity implements TWSDLExtensible { - - public Port(Defining defining, Locator locator, ErrorReceiver errReceiver) { - super(defining, locator, errReceiver); - _helper = new ExtensibilityHelper(); - } - - public Service getService() { - return _service; - } - - public void setService(Service s) { - _service = s; - } - - public QName getBinding() { - return _binding; - } - - public void setBinding(QName n) { - _binding = n; - } - - public Binding resolveBinding(AbstractDocument document) { - try{ - return (Binding) document.find(Kinds.BINDING, _binding); - } catch (NoSuchEntityException e) { - errorReceiver.error(getLocator(), WsdlMessages.ENTITY_NOT_FOUND_BINDING(_binding, new QName(getNamespaceURI(), getName()))); - throw new AbortException(); - } - } - - public Kind getKind() { - return Kinds.PORT; - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getDefining().getTargetNamespaceURI(); - } - - public QName getWSDLElementName() { - return WSDLConstants.QNAME_PORT; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllQNamesDo(QNameAction action) { - super.withAllQNamesDo(action); - - if (_binding != null) { - action.perform(_binding); - } - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - super.withAllEntityReferencesDo(action); - if (_binding != null) { - action.perform(Kinds.BINDING, _binding); - } - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - if (getName() == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - if (_binding == null) { - failValidation("validation.missingRequiredAttribute", "binding"); - } - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - public void withAllSubEntitiesDo(EntityAction action) { - _helper.withAllSubEntitiesDo(action); - } - - private ExtensibilityHelper _helper; - private Documentation _documentation; - private Service _service; - private QName _binding; - - public QName getElementName() { - return getWSDLElementName(); - } - - private TWSDLExtensible parent; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/PortType.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/PortType.java deleted file mode 100644 index 31c46fc46a1..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/PortType.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.*; - -/** - * Entity corresponding to the "portType" WSDL element. - * - * @author WS Development Team - */ -public class PortType extends GlobalEntity implements TWSDLExtensible { - - public PortType(Defining defining, Locator locator, ErrorReceiver errReceiver) { - super(defining, locator, errReceiver); - _operations = new ArrayList(); - _operationKeys = new HashSet(); - _helper = new ExtensibilityHelper(); - } - - public void add(Operation operation) { - String key = operation.getUniqueKey(); - if (_operationKeys.contains(key)) - throw new ValidationException( - "validation.ambiguousName", - operation.getName()); - _operationKeys.add(key); - _operations.add(operation); - } - - public Iterator operations() { - return _operations.iterator(); - } - - public Set getOperationsNamed(String s) { - Set result = new HashSet(); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - Operation operation = (Operation) iter.next(); - if (operation.getName().equals(s)) { - result.add(operation); - } - } - return result; - } - - public Kind getKind() { - return Kinds.PORT_TYPE; - } - - public QName getElementName() { - return WSDLConstants.QNAME_PORT_TYPE; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllSubEntitiesDo(EntityAction action) { - super.withAllSubEntitiesDo(action); - - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - _helper.accept(visitor); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - ((Operation) iter.next()).accept(visitor); - } - visitor.postVisit(this); - } - - public void validateThis() { - if (getName() == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getDefining().getTargetNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - /* (non-Javadoc) - * @see TWSDLExtensible#addExtension(ExtensionImpl) - */ - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - - } - - /* (non-Javadoc) - * @see TWSDLExtensible#extensions() - */ - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - private TWSDLExtensible parent; - private Documentation _documentation; - private List _operations; - private Set _operationKeys; - private ExtensibilityHelper _helper; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Service.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Service.java deleted file mode 100644 index c866328581e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Service.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * Entity corresponding to the "service" WSDL element. - * - * @author WS Development Team - */ -public class Service extends GlobalEntity implements TWSDLExtensible { - - public Service(Defining defining, Locator locator, ErrorReceiver errReceiver) { - super(defining, locator, errReceiver); - _ports = new ArrayList(); - _helper = new ExtensibilityHelper(); - } - - public void add(Port port) { - port.setService(this); - _ports.add(port); - } - - public Iterator ports() { - return _ports.iterator(); - } - - public Kind getKind() { - return Kinds.SERVICE; - } - - public QName getElementName() { - return WSDLConstants.QNAME_SERVICE; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void withAllSubEntitiesDo(EntityAction action) { - for (Iterator iter = _ports.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - _helper.withAllSubEntitiesDo(action); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - for (Iterator iter = _ports.iterator(); iter.hasNext();) { - ((Port) iter.next()).accept(visitor); - } - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - if (getName() == null) { - failValidation("validation.missingRequiredAttribute", "name"); - } - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getDefining().getTargetNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - private ExtensibilityHelper _helper; - private Documentation _documentation; - private List _ports; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Types.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Types.java deleted file mode 100644 index 142ba1a674b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/Types.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Entity corresponding to the "types" WSDL element. - * - * @author WS Development Team - */ -public class Types extends Entity implements TWSDLExtensible { - - public Types(Locator locator) { - super(locator); - _helper = new ExtensibilityHelper(); - } - - public QName getElementName() { - return WSDLConstants.QNAME_TYPES; - } - - public Documentation getDocumentation() { - return _documentation; - } - - public void setDocumentation(Documentation d) { - _documentation = d; - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - visitor.preVisit(this); - _helper.accept(visitor); - visitor.postVisit(this); - } - - public void validateThis() { - } - - /** - * wsdl:type does not have any name attribute - */ - public String getNameValue() { - return null; - } - - public String getNamespaceURI() { - return parent.getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public TWSDLExtensible getParent() { - return parent; - } - - public void setParent(TWSDLExtensible parent) { - this.parent = parent; - } - - public void withAllSubEntitiesDo(EntityAction action) { - _helper.withAllSubEntitiesDo(action); - } - - public void accept(ExtensionVisitor visitor) throws Exception { - _helper.accept(visitor); - } - - private TWSDLExtensible parent; - private ExtensibilityHelper _helper; - private Documentation _documentation; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLConstants.java deleted file mode 100644 index 3974f2d9f49..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLConstants.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import javax.xml.namespace.QName; - -/** - * Interface defining WSDL-related constants. - * - * @author WS Development Team - */ -public interface WSDLConstants { - - // namespace URIs - public static String NS_XMLNS = "http://www.w3.org/2000/xmlns/"; - public static String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/"; - - // QNames - public static QName QNAME_BINDING = new QName(NS_WSDL, "binding"); - public static QName QNAME_DEFINITIONS = new QName(NS_WSDL, "definitions"); - public static QName QNAME_DOCUMENTATION = - new QName(NS_WSDL, "documentation"); - public static QName QNAME_FAULT = new QName(NS_WSDL, "fault"); - public static QName QNAME_IMPORT = new QName(NS_WSDL, "import"); - public static QName QNAME_INPUT = new QName(NS_WSDL, "input"); - public static QName QNAME_MESSAGE = new QName(NS_WSDL, "message"); - public static QName QNAME_OPERATION = new QName(NS_WSDL, "operation"); - public static QName QNAME_OUTPUT = new QName(NS_WSDL, "output"); - public static QName QNAME_PART = new QName(NS_WSDL, "part"); - public static QName QNAME_PORT = new QName(NS_WSDL, "port"); - public static QName QNAME_PORT_TYPE = new QName(NS_WSDL, "portType"); - public static QName QNAME_SERVICE = new QName(NS_WSDL, "service"); - public static QName QNAME_TYPES = new QName(NS_WSDL, "types"); - - public static QName QNAME_ATTR_ARRAY_TYPE = new QName(NS_WSDL, "arrayType"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocument.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocument.java deleted file mode 100644 index 4db0b5ec676..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocument.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.*; -import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Set; - -/** - * A WSDL document. - * - * @author WS Development Team - */ -public class WSDLDocument extends AbstractDocument{ - - public WSDLDocument(MetadataFinder forest, ErrorReceiver errReceiver) { - super(forest, errReceiver); - } - - public Definitions getDefinitions() { - return _definitions; - } - - public void setDefinitions(Definitions d) { - _definitions = d; - } - - public QName[] getAllServiceQNames() { - - ArrayList serviceQNames = new ArrayList(); - - for (Iterator iter = getDefinitions().services(); iter.hasNext();) { - Service next = (Service) iter.next(); - String targetNamespace = next.getDefining().getTargetNamespaceURI(); - String localName = next.getName(); - QName serviceQName = new QName(targetNamespace, localName); - serviceQNames.add(serviceQName); - } - return (QName[]) serviceQNames.toArray(new QName[serviceQNames.size()]); - } - - public QName[] getAllPortQNames() { - ArrayList portQNames = new ArrayList(); - - for (Iterator iter = getDefinitions().services(); iter.hasNext();) { - Service next = (Service) iter.next(); - //Iterator ports = next.ports(); - for (Iterator piter = next.ports(); piter.hasNext();) { - // If it's a relative import - Port pnext = (Port) piter.next(); - String targetNamespace = - pnext.getDefining().getTargetNamespaceURI(); - String localName = pnext.getName(); - QName portQName = new QName(targetNamespace, localName); - portQNames.add(portQName); - } - } - return (QName[]) portQNames.toArray(new QName[portQNames.size()]); - } - - public QName[] getPortQNames(String serviceNameLocalPart) { - - ArrayList portQNames = new ArrayList(); - - for (Iterator iter = getDefinitions().services(); iter.hasNext();) { - Service next = (Service) iter.next(); - if (next.getName().equals(serviceNameLocalPart)) { - for (Iterator piter = next.ports(); piter.hasNext();) { - Port pnext = (Port) piter.next(); - String targetNamespace = - pnext.getDefining().getTargetNamespaceURI(); - String localName = pnext.getName(); - QName portQName = new QName(targetNamespace, localName); - portQNames.add(portQName); - } - } - } - return (QName[]) portQNames.toArray(new QName[portQNames.size()]); - } - - public void accept(WSDLDocumentVisitor visitor) throws Exception { - _definitions.accept(visitor); - } - - public void validate(EntityReferenceValidator validator) { - GloballyValidatingAction action = - new GloballyValidatingAction(this, validator); - withAllSubEntitiesDo(action); - if (action.getException() != null) { - throw action.getException(); - } - } - - protected Entity getRoot() { - return _definitions; - } - - private Definitions _definitions; - - private class GloballyValidatingAction - implements EntityAction, EntityReferenceAction { - public GloballyValidatingAction( - AbstractDocument document, - EntityReferenceValidator validator) { - _document = document; - _validator = validator; - } - - public void perform(Entity entity) { - try { - entity.validateThis(); - entity.withAllEntityReferencesDo(this); - entity.withAllSubEntitiesDo(this); - } catch (ValidationException e) { - if (_exception == null) { - _exception = e; - } - } - } - - public void perform(Kind kind, QName name) { - try { - GloballyKnown entity = _document.find(kind, name); - } catch (NoSuchEntityException e) { - // failed to resolve, check with the validator - if (_exception == null) { - if (_validator == null - || !_validator.isValid(kind, name)) { - _exception = e; - } - } - } - } - - public ValidationException getException() { - return _exception; - } - - private ValidationException _exception; - private AbstractDocument _document; - private EntityReferenceValidator _validator; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocumentVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocumentVisitor.java deleted file mode 100644 index b5ebdb3531c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocumentVisitor.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor; - -/** - * A visitor for WSDL documents. - * - * @author WS Development Team - */ -public interface WSDLDocumentVisitor extends ExtensionVisitor { - - public void preVisit(Definitions definitions) throws Exception; - public void postVisit(Definitions definitions) throws Exception; - public void visit(Import i) throws Exception; - public void preVisit(Types types) throws Exception; - public void postVisit(Types types) throws Exception; - public void preVisit(Message message) throws Exception; - public void postVisit(Message message) throws Exception; - public void visit(MessagePart part) throws Exception; - public void preVisit(PortType portType) throws Exception; - public void postVisit(PortType portType) throws Exception; - public void preVisit(Operation operation) throws Exception; - public void postVisit(Operation operation) throws Exception; - public void preVisit(Input input) throws Exception; - public void postVisit(Input input) throws Exception; - public void preVisit(Output output) throws Exception; - public void postVisit(Output output) throws Exception; - public void preVisit(Fault fault) throws Exception; - public void postVisit(Fault fault) throws Exception; - public void preVisit(Binding binding) throws Exception; - public void postVisit(Binding binding) throws Exception; - public void preVisit(BindingOperation operation) throws Exception; - public void postVisit(BindingOperation operation) throws Exception; - public void preVisit(BindingInput input) throws Exception; - public void postVisit(BindingInput input) throws Exception; - public void preVisit(BindingOutput output) throws Exception; - public void postVisit(BindingOutput output) throws Exception; - public void preVisit(BindingFault fault) throws Exception; - public void postVisit(BindingFault fault) throws Exception; - public void preVisit(Service service) throws Exception; - public void postVisit(Service service) throws Exception; - public void preVisit(Port port) throws Exception; - public void postVisit(Port port) throws Exception; - public void visit(Documentation documentation) throws Exception; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocumentVisitorBase.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocumentVisitorBase.java deleted file mode 100644 index b7e3d8ae34e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/WSDLDocumentVisitorBase.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitorBase; - - -/** - * - * @author WS Development Team - */ -public class WSDLDocumentVisitorBase extends ExtensionVisitorBase { - public WSDLDocumentVisitorBase() { - } - - public void preVisit(Definitions definitions) throws Exception { - } - public void postVisit(Definitions definitions) throws Exception { - } - public void visit(Import i) throws Exception { - } - public void preVisit(Types types) throws Exception { - } - public void postVisit(Types types) throws Exception { - } - public void preVisit(Message message) throws Exception { - } - public void postVisit(Message message) throws Exception { - } - public void visit(MessagePart part) throws Exception { - } - public void preVisit(PortType portType) throws Exception { - } - public void postVisit(PortType portType) throws Exception { - } - public void preVisit(Operation operation) throws Exception { - } - public void postVisit(Operation operation) throws Exception { - } - public void preVisit(Input input) throws Exception { - } - public void postVisit(Input input) throws Exception { - } - public void preVisit(Output output) throws Exception { - } - public void postVisit(Output output) throws Exception { - } - public void preVisit(Fault fault) throws Exception { - } - public void postVisit(Fault fault) throws Exception { - } - public void preVisit(Binding binding) throws Exception { - } - public void postVisit(Binding binding) throws Exception { - } - public void preVisit(BindingOperation operation) throws Exception { - } - public void postVisit(BindingOperation operation) throws Exception { - } - public void preVisit(BindingInput input) throws Exception { - } - public void postVisit(BindingInput input) throws Exception { - } - public void preVisit(BindingOutput output) throws Exception { - } - public void postVisit(BindingOutput output) throws Exception { - } - public void preVisit(BindingFault fault) throws Exception { - } - public void postVisit(BindingFault fault) throws Exception { - } - public void preVisit(Service service) throws Exception { - } - public void postVisit(Service service) throws Exception { - } - public void preVisit(Port port) throws Exception { - } - public void postVisit(Port port) throws Exception { - } - public void visit(Documentation documentation) throws Exception { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPAddress.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPAddress.java deleted file mode 100644 index 3c072e7d4af..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPAddress.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.http; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A HTTP address extension. - * - * @author WS Development Team - */ -public class HTTPAddress extends ExtensionImpl { - - public HTTPAddress(Locator locator) { - super(locator); - } - - public QName getElementName() { - return HTTPConstants.QNAME_ADDRESS; - } - - public String getLocation() { - return _location; - } - - public void setLocation(String s) { - _location = s; - } - - public void validateThis() { - if (_location == null) { - failValidation("validation.missingRequiredAttribute", "location"); - } - } - - private String _location; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPBinding.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPBinding.java deleted file mode 100644 index 38aaae8b187..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPBinding.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.http; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A HTTP binding extension. - * - * @author WS Development Team - */ -public class HTTPBinding extends ExtensionImpl { - - public HTTPBinding(Locator locator) { - super(locator); - } - - public QName getElementName() { - return HTTPConstants.QNAME_BINDING; - } - - public String getVerb() { - return _verb; - } - - public void setVerb(String s) { - _verb = s; - } - - public void validateThis() { - if (_verb == null) { - failValidation("validation.missingRequiredAttribute", "verb"); - } - } - - private String _verb; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPConstants.java deleted file mode 100644 index a1c075329e7..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPConstants.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.http; - -import javax.xml.namespace.QName; - -/** - * Interface defining HTTP-extension-related constants. - * - * @author WS Development Team - */ -public interface HTTPConstants { - - // namespace URIs - public static String NS_WSDL_HTTP = "http://schemas.xmlsoap.org/wsdl/http/"; - - // QNames - public static QName QNAME_ADDRESS = new QName(NS_WSDL_HTTP, "address"); - public static QName QNAME_BINDING = new QName(NS_WSDL_HTTP, "binding"); - public static QName QNAME_OPERATION = new QName(NS_WSDL_HTTP, "operation"); - public static QName QNAME_URL_ENCODED = - new QName(NS_WSDL_HTTP, "urlEncoded"); - public static QName QNAME_URL_REPLACEMENT = - new QName(NS_WSDL_HTTP, "urlReplacement"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPOperation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPOperation.java deleted file mode 100644 index 076415ad9cb..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPOperation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.http; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A HTTP operation extension. - * - * @author WS Development Team - */ -public class HTTPOperation extends ExtensionImpl { - - public HTTPOperation(Locator locator) { - super(locator); - } - - public QName getElementName() { - return HTTPConstants.QNAME_OPERATION; - } - - public String getLocation() { - return _location; - } - - public void setLocation(String s) { - _location = s; - } - - public void validateThis() { - if (_location == null) { - failValidation("validation.missingRequiredAttribute", "location"); - } - } - - private String _location; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPUrlEncoded.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPUrlEncoded.java deleted file mode 100644 index 6f5226f65de..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPUrlEncoded.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.http; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A HTTP urlEncoded extension. - * - * @author WS Development Team - */ -public class HTTPUrlEncoded extends ExtensionImpl { - - public HTTPUrlEncoded(Locator locator) { - super(locator); - } - - public QName getElementName() { - return HTTPConstants.QNAME_URL_ENCODED; - } - - public void validateThis() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPUrlReplacement.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPUrlReplacement.java deleted file mode 100644 index e32541a2b80..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/http/HTTPUrlReplacement.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.http; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A HTTP urlReplacement extension. - * - * @author WS Development Team - */ -public class HTTPUrlReplacement extends ExtensionImpl { - - public HTTPUrlReplacement(Locator locator) { - super(locator); - } - - public QName getElementName() { - return HTTPConstants.QNAME_URL_REPLACEMENT; - } - - public void validateThis() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/CustomName.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/CustomName.java deleted file mode 100644 index e4fcca01d16..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/CustomName.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.document.jaxws; - - -/** - * @author Vivek Pandey - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class CustomName { - - - /** - * - */ - public CustomName() { - } - - /** - * - */ - public CustomName(String name, String javaDoc) { - this.name = name; - this.javaDoc = javaDoc; - } - - /** - * @return Returns the javaDoc. - */ - public String getJavaDoc() { - return javaDoc; - } - /** - * @param javaDoc The javaDoc to set. - */ - public void setJavaDoc(String javaDoc) { - this.javaDoc = javaDoc; - } - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } - - private String javaDoc; - private String name; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/Exception.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/Exception.java deleted file mode 100644 index 797e4192dd3..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/Exception.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.document.jaxws; - -/** - * @author Vivek Pandey - * - * class representing jaxws:exception - * - */ -public class Exception { - - public Exception(){} - - public Exception(CustomName name){ - this.className = name; - } - - private CustomName className; - /** - * @return Returns the className. - */ - public CustomName getClassName() { - return className; - } - /** - * @param className The className to set. - */ - public void setClassName(CustomName className) { - this.className = className; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/JAXWSBinding.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/JAXWSBinding.java deleted file mode 100644 index 06e81f56289..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/JAXWSBinding.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.document.jaxws; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.w3c.dom.Element; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.*; - - -/** - * @author Vivek Pandey - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class JAXWSBinding extends ExtensionImpl { - - /** - * - */ - public JAXWSBinding(Locator locator){ - super(locator); - jaxbBindings = new HashSet(); - // TODO Auto-generated constructor stub - } - - - /* (non-Javadoc) - * @see Entity#validateThis() - */ - public void validateThis(){ - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see Elemental#getElementName() - */ - public QName getElementName(){ - // TODO Auto-generated method stub - return JAXWSBindingsConstants.JAXWS_BINDINGS; - } - - public QName getWSDLElementName() { - return getElementName(); - } - - /* (non-Javadoc) - * @see TWSDLExtensible#addExtension(ExtensionImpl) - */ - public void addExtension(ExtensionImpl e) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see TWSDLExtensible#extensions() - */ - public Iterable extensions() { - // TODO Auto-generated method stub - return null; - } - - -// /** -// * @return Returns the enableAdditionalHeaderMapping. -// */ -// public Boolean isEnableAdditionalHeaderMapping() { -// return enableAdditionalHeaderMapping; -// } -// /** -// * @param enableAdditionalHeaderMapping The enableAdditionalHeaderMapping to set. -// */ -// public void setEnableAdditionalHeaderMapping( -// Boolean enableAdditionalHeaderMapping) { -// this.enableAdditionalHeaderMapping = enableAdditionalHeaderMapping; -// } - /** - * @return Returns the enableAsyncMapping. - */ - public Boolean isEnableAsyncMapping() { - return enableAsyncMapping; - } - /** - * @param enableAsyncMapping The enableAsyncMapping to set. - */ - public void setEnableAsyncMapping(Boolean enableAsyncMapping) { - this.enableAsyncMapping = enableAsyncMapping; - } - /** - * @return Returns the enableMimeContentMapping. - */ - public Boolean isEnableMimeContentMapping() { - return enableMimeContentMapping; - } - /** - * @param enableMimeContentMapping The enableMimeContentMapping to set. - */ - public void setEnableMimeContentMapping(Boolean enableMimeContentMapping) { - this.enableMimeContentMapping = enableMimeContentMapping; - } - /** - * @return Returns the enableWrapperStyle. - */ - public Boolean isEnableWrapperStyle() { - return enableWrapperStyle; - } - /** - * @param enableWrapperStyle The enableWrapperStyle to set. - */ - public void setEnableWrapperStyle(Boolean enableWrapperStyle) { - this.enableWrapperStyle = enableWrapperStyle; - } - /** - * @return Returns the jaxwsPackage. - */ - public CustomName getJaxwsPackage() { - return jaxwsPackage; - } - /** - * @param jaxwsPackage The jaxwsPackage to set. - */ - public void setJaxwsPackage(CustomName jaxwsPackage) { - this.jaxwsPackage = jaxwsPackage; - } - /** - * @return Returns the node. - */ - public String getNode() { - return node; - } - /** - * @param node The node to set. - */ - public void setNode(String node) { - this.node = node; - } - /** - * @return Returns the version. - */ - public String getVersion() { - return version; - } - /** - * @param version The version to set. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return Returns the wsdlLocation. - */ - public String getWsdlLocation() { - return wsdlLocation; - } - - /** - * @param wsdlLocation The wsdlLocation to set. - */ - public void setWsdlLocation(String wsdlLocation) { - this.wsdlLocation = wsdlLocation; - } - - /** - * @return Returns the wsdlNamespace. - */ - public String getWsdlNamespace() { - return wsdlNamespace; - } - - - /** - * @param wsdlNamespace The wsdlNamespace to set. - */ - public void setWsdlNamespace(String wsdlNamespace) { - this.wsdlNamespace = wsdlNamespace; - } - - /** - * @return Returns the jaxbBindings. - */ - public Set getJaxbBindings() { - return jaxbBindings; - } - - /** - * @param jaxbBinding The jaxbBindings to set. - */ - public void addJaxbBindings(Element jaxbBinding) { - if(jaxbBindings == null) - return; - this.jaxbBindings.add(jaxbBinding); - } - - - /** - * @return the isProvider. - */ - public Boolean isProvider() { - return isProvider; - } - /** - * @param isProvider The isProvider to set. - */ - public void setProvider(Boolean isProvider) { - this.isProvider = isProvider; - } - - /** - * @return Returns the methodName. - */ - public CustomName getMethodName() { - return methodName; - } - /** - * @param methodName The methodName to set. - */ - public void setMethodName(CustomName methodName) { - this.methodName = methodName; - } - - /** - * @return Returns the parameter. - */ - public Iterator parameters() { - return parameters.iterator(); - } - - /** - * @param parameter The parameter to set. - */ - public void addParameter(Parameter parameter) { - if(parameters == null) - parameters = new ArrayList(); - parameters.add(parameter); - } - - public String getParameterName(String msgName, String wsdlPartName, QName element, boolean wrapperStyle){ - if(msgName == null || wsdlPartName == null || element == null || parameters == null) - return null; - for(Parameter param : parameters){ - if(param.getMessageName().equals(msgName) && param.getPart().equals(wsdlPartName)){ - if(wrapperStyle && (param.getElement() != null)){ - if(param.getElement().equals(element)) - return param.getName(); - }else if(!wrapperStyle){ - return param.getName(); - } - } - } - return null; - } - - /** - * @return Returns the className. - */ - public CustomName getClassName() { - return className; - } - /** - * @param className The className to set. - */ - public void setClassName(CustomName className) { - this.className = className; - } - - /** - * @return Returns the exception. - */ - public Exception getException() { - return exception; - } - /** - * @param exception The exception to set. - */ - public void setException(Exception exception) { - this.exception = exception; - } - - private String wsdlNamespace; - private String wsdlLocation; - private String node; - private String version; - - private CustomName jaxwsPackage; - private List parameters; - private Boolean enableWrapperStyle; - private Boolean enableAsyncMapping; -// private Boolean enableAdditionalHeaderMapping; - private Boolean enableMimeContentMapping; - private Boolean isProvider; - private Exception exception; - - private Set jaxbBindings; - - // portType className - private CustomName className; - - //portType WSDLOperation - private CustomName methodName; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java deleted file mode 100644 index efcdd70e70a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.jaxws; - -import com.sun.tools.internal.ws.wsdl.parser.Constants; - -import javax.xml.namespace.QName; - -/** - * @author Vivek Pandey - * - */ -public interface JAXWSBindingsConstants { - - public static String NS_JAXWS_BINDINGS = "http://java.sun.com/xml/ns/jaxws"; - public static String NS_JAXB_BINDINGS = "http://java.sun.com/xml/ns/jaxb"; - public static String NS_XJC_BINDINGS = "http://java.sun.com/xml/ns/jaxb/xjc"; - - /** - * jaxws:bindings schema component - * - * binding declarations... - * - * - * wsdlLocation="xs:anyURI"? node="xs:string"? version="string"?> binding - * declarations... - * - * @wsdlLocation A URI pointing to a WSDL file establishing the scope of the - * contents of this binding declaration. It MUST NOT be - * present if the binding declaration is used as an extension - * inside a WSDL document or if there is an ancestor binding - * declaration that contains this attribute. - * - * @node An XPath expression pointing to the element in the WSDL file in - * scope that this binding declaration is attached to. - * - * @version A version identifier. It MAY only appear on jaxws:bindings - * elements that don't have any jaxws:bindings ancestors (i.e. on - * outermost binding declarations). - */ - public static QName JAXWS_BINDINGS = new QName(NS_JAXWS_BINDINGS, "bindings"); - public static String WSDL_LOCATION_ATTR = "wsdlLocation"; - public static String NODE_ATTR = "node"; - public static String VERSION_ATTR = "version"; - - /* - * ? xs:string - * - */ - public static QName PACKAGE = new QName(NS_JAXWS_BINDINGS, "package"); - public static String NAME_ATTR = "name"; - public static QName JAVADOC = new QName(NS_JAXWS_BINDINGS, "javadoc"); - - /* - * xs:boolean ? - */ - public static QName ENABLE_WRAPPER_STYLE = new QName(NS_JAXWS_BINDINGS, "enableWrapperStyle"); - - /* - * xs:boolean - * ? - */ - public static QName ENABLE_ASYNC_MAPPING = new QName(NS_JAXWS_BINDINGS, "enableAsyncMapping"); - - /* - * xs:boolean? - */ - public static QName ENABLE_ADDITIONAL_SOAPHEADER_MAPPING = new QName(NS_JAXWS_BINDINGS, "enableAdditionalSOAPHeaderMapping"); - - /* - * xs:boolean? - */ - public static QName ENABLE_MIME_CONTENT = new QName(NS_JAXWS_BINDINGS, "enableMIMEContent"); - - /* - * xs:boolean? - */ - public static QName PROVIDER = new QName(NS_JAXWS_BINDINGS, "provider"); - - /* - * PortType - * - * ? - * xs:string? - * - * - * - * xs:boolean - * ? - * - * - * xs:boolean - * ? - * - */ - - public static QName CLASS = new QName(NS_JAXWS_BINDINGS, "class"); - - /* - * PortType WSDLOperation - * - * ? - * xs:string? - * - * - * - * xs:boolean - * ? - * - * - * xs:boolean - * ? - * - * * - */ - - - - public static QName METHOD = new QName(NS_JAXWS_BINDINGS, "method"); - public static QName PARAMETER = new QName(NS_JAXWS_BINDINGS, "parameter"); - public static String PART_ATTR = "part"; - public static String ELEMENT_ATTR = "childElementName"; - - /* - * Binding - * - * - * xs:boolean - * ? - * - * - * xs:boolean - * ? - */ - - /* - * WSDLBoundOperation - * - * - * xs:boolean - * ? - * - * - * xs:boolean - * ? - * - * * - * - * * - * ? - * xs:string? - * - * - */ - - public static QName EXCEPTION = new QName(NS_JAXWS_BINDINGS, "exception"); - - - /* - * jaxb:bindgs QName - */ - public static QName JAXB_BINDINGS = new QName(NS_JAXB_BINDINGS, "bindings"); - public static String JAXB_BINDING_VERSION = "2.0"; - public static QName XSD_APPINFO = new QName(Constants.NS_XSD, "appinfo"); - public static QName XSD_ANNOTATION = new QName(Constants.NS_XSD, "annotation"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/Parameter.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/Parameter.java deleted file mode 100644 index 02a7b225df1..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/jaxws/Parameter.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.document.jaxws; - -import javax.xml.namespace.QName; - -/** - * @author Vivek Pandey - * - * class representing jaxws:parameter - * - */ -public class Parameter { - private String part; - private QName element; - private String name; - private String messageName; - - /** - * @param part - * @param element - * @param name - */ - public Parameter(String msgName, String part, QName element, String name) { - this.part = part; - this.element = element; - this.name = name; - this.messageName = msgName; - } - - public String getMessageName() { - return messageName; - } - - public void setMessageName(String messageName) { - this.messageName = messageName; - } - - /** - * @return Returns the element. - */ - public QName getElement() { - return element; - } - - /** - * @param element The element to set. - */ - public void setElement(QName element) { - this.element = element; - } - - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return Returns the part. - */ - public String getPart() { - return part; - } - - /** - * @param part The part to set. - */ - public void setPart(String part) { - this.part = part; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEConstants.java deleted file mode 100644 index 77d7607a7d4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEConstants.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.mime; - -import javax.xml.namespace.QName; - -/** - * Interface defining MIME-extension-related constants. - * - * @author WS Development Team - */ -public interface MIMEConstants { - - // namespace URIs - public static String NS_WSDL_MIME = "http://schemas.xmlsoap.org/wsdl/mime/"; - - // QNames - public static QName QNAME_CONTENT = new QName(NS_WSDL_MIME, "content"); - public static QName QNAME_MULTIPART_RELATED = - new QName(NS_WSDL_MIME, "multipartRelated"); - public static QName QNAME_PART = new QName(NS_WSDL_MIME, "part"); - public static QName QNAME_MIME_XML = new QName(NS_WSDL_MIME, "mimeXml"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEContent.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEContent.java deleted file mode 100644 index c13ba572622..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEContent.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.mime; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A MIME content extension. - * - * @author WS Development Team - */ -public class MIMEContent extends ExtensionImpl { - - public MIMEContent(Locator locator) { - super(locator); - } - - public QName getElementName() { - return MIMEConstants.QNAME_CONTENT; - } - - public String getPart() { - return _part; - } - - public void setPart(String s) { - _part = s; - } - - public String getType() { - return _type; - } - - public void setType(String s) { - _type = s; - } - - public void validateThis() { - } - - private String _part; - private String _type; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEMultipartRelated.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEMultipartRelated.java deleted file mode 100644 index 5e1246bb864..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEMultipartRelated.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.mime; - -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A MIME multipartRelated extension. - * - * @author WS Development Team - */ -public class MIMEMultipartRelated extends ExtensionImpl { - - public MIMEMultipartRelated(Locator locator) { - super(locator); - _parts = new ArrayList(); - } - - public QName getElementName() { - return MIMEConstants.QNAME_MULTIPART_RELATED; - } - - public void add(MIMEPart part) { - _parts.add(part); - } - - public Iterable getParts() { - return _parts; - } - - public void withAllSubEntitiesDo(EntityAction action) { - super.withAllSubEntitiesDo(action); - - for (Iterator iter = _parts.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - } - - public void accept(ExtensionVisitor visitor) throws Exception { - visitor.preVisit(this); - visitor.postVisit(this); - } - - public void validateThis() { - } - - private List _parts; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEPart.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEPart.java deleted file mode 100644 index a8bd08c04d8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEPart.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.mime; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.wsdl.framework.EntityAction; -import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper; -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A MIME part extension. - * - * @author WS Development Team - */ -public class MIMEPart extends ExtensionImpl implements TWSDLExtensible { - - public MIMEPart(Locator locator) { - super(locator); - _helper = new ExtensibilityHelper(); - } - - public QName getElementName() { - return MIMEConstants.QNAME_PART; - } - - public String getName() { - return _name; - } - - public void setName(String s) { - _name = s; - } - - public String getNameValue() { - return getName(); - } - - public String getNamespaceURI() { - return getParent().getNamespaceURI(); - } - - public QName getWSDLElementName() { - return getElementName(); - } - - public void addExtension(TWSDLExtension e) { - _helper.addExtension(e); - } - - public Iterable extensions() { - return _helper.extensions(); - } - - public void withAllSubEntitiesDo(EntityAction action) { - _helper.withAllSubEntitiesDo(action); - } - - public void validateThis() { - } - - private String _name; - private ExtensibilityHelper _helper; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEXml.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEXml.java deleted file mode 100644 index 7a444ba41ed..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/mime/MIMEXml.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.mime; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A MIME mimeXml extension. - * - * @author WS Development Team - */ -public class MIMEXml extends ExtensionImpl { - - public MIMEXml(Locator locator) { - super(locator); - } - - public QName getElementName() { - return MIMEConstants.QNAME_MIME_XML; - } - - public String getPart() { - return _part; - } - - public void setPart(String s) { - _part = s; - } - - public void validateThis() { - } - - private String _part; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/schema/SchemaConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/schema/SchemaConstants.java deleted file mode 100644 index 3d51906bf84..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/schema/SchemaConstants.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.schema; - -import javax.xml.namespace.QName; - -/** - * - * @author WS Development Team - */ -public interface SchemaConstants { - - // namespace URIs - public static String NS_XMLNS = "http://www.w3.org/2000/xmlns/"; - public static String NS_XSD = "http://www.w3.org/2001/XMLSchema"; - public static String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"; - - // QNames - public static QName QNAME_ALL = new QName(NS_XSD, "all"); - public static QName QNAME_ANNOTATION = new QName(NS_XSD, "annotation"); - public static QName QNAME_ANY = new QName(NS_XSD, "any"); - public static QName QNAME_ANY_ATTRIBUTE = new QName(NS_XSD, "anyAttribute"); - public static QName QNAME_ATTRIBUTE = new QName(NS_XSD, "attribute"); - public static QName QNAME_ATTRIBUTE_GROUP = - new QName(NS_XSD, "attributeGroup"); - public static QName QNAME_CHOICE = new QName(NS_XSD, "choice"); - public static QName QNAME_COMPLEX_CONTENT = - new QName(NS_XSD, "complexContent"); - public static QName QNAME_COMPLEX_TYPE = new QName(NS_XSD, "complexType"); - public static QName QNAME_ELEMENT = new QName(NS_XSD, "element"); - public static QName QNAME_ENUMERATION = new QName(NS_XSD, "enumeration"); - public static QName QNAME_EXTENSION = new QName(NS_XSD, "extension"); - public static QName QNAME_FIELD = new QName(NS_XSD, "field"); - public static QName QNAME_FRACTION_DIGITS = - new QName(NS_XSD, "fractionDigits"); - public static QName QNAME_GROUP = new QName(NS_XSD, "group"); - public static QName QNAME_IMPORT = new QName(NS_XSD, "import"); - public static QName QNAME_INCLUDE = new QName(NS_XSD, "include"); - public static QName QNAME_KEY = new QName(NS_XSD, "key"); - public static QName QNAME_KEYREF = new QName(NS_XSD, "keyref"); - public static QName QNAME_LENGTH = new QName(NS_XSD, "length"); - public static QName QNAME_LIST = new QName(NS_XSD, "list"); - public static QName QNAME_MAX_EXCLUSIVE = new QName(NS_XSD, "maxExclusive"); - public static QName QNAME_MAX_INCLUSIVE = new QName(NS_XSD, "maxInclusive"); - public static QName QNAME_MAX_LENGTH = new QName(NS_XSD, "maxLength"); - public static QName QNAME_MIN_EXCLUSIVE = new QName(NS_XSD, "minExclusive"); - public static QName QNAME_MIN_INCLUSIVE = new QName(NS_XSD, "minInclusive"); - public static QName QNAME_MIN_LENGTH = new QName(NS_XSD, "minLength"); - public static QName QNAME_NOTATION = new QName(NS_XSD, "notation"); - public static QName QNAME_RESTRICTION = new QName(NS_XSD, "restriction"); - public static QName QNAME_PATTERN = new QName(NS_XSD, "pattern"); - public static QName QNAME_PRECISION = new QName(NS_XSD, "precision"); - public static QName QNAME_REDEFINE = new QName(NS_XSD, "redefine"); - public static QName QNAME_SCALE = new QName(NS_XSD, "scale"); - public static QName QNAME_SCHEMA = new QName(NS_XSD, "schema"); - public static QName QNAME_SELECTOR = new QName(NS_XSD, "selector"); - public static QName QNAME_SEQUENCE = new QName(NS_XSD, "sequence"); - public static QName QNAME_SIMPLE_CONTENT = - new QName(NS_XSD, "simpleContent"); - public static QName QNAME_SIMPLE_TYPE = new QName(NS_XSD, "simpleType"); - public static QName QNAME_TOTAL_DIGITS = new QName(NS_XSD, "totalDigits"); - public static QName QNAME_UNIQUE = new QName(NS_XSD, "unique"); - public static QName QNAME_UNION = new QName(NS_XSD, "union"); - public static QName QNAME_WHITE_SPACE = new QName(NS_XSD, "whiteSpace"); - - // QNames for built-in XSD types - public static QName QNAME_TYPE_STRING = new QName(NS_XSD, "string"); - public static QName QNAME_TYPE_NORMALIZED_STRING = - new QName(NS_XSD, "normalizedString"); - public static QName QNAME_TYPE_TOKEN = new QName(NS_XSD, "token"); - public static QName QNAME_TYPE_BYTE = new QName(NS_XSD, "byte"); - public static QName QNAME_TYPE_UNSIGNED_BYTE = - new QName(NS_XSD, "unsignedByte"); - public static QName QNAME_TYPE_BASE64_BINARY = - new QName(NS_XSD, "base64Binary"); - public static QName QNAME_TYPE_HEX_BINARY = new QName(NS_XSD, "hexBinary"); - public static QName QNAME_TYPE_INTEGER = new QName(NS_XSD, "integer"); - public static QName QNAME_TYPE_POSITIVE_INTEGER = - new QName(NS_XSD, "positiveInteger"); - public static QName QNAME_TYPE_NEGATIVE_INTEGER = - new QName(NS_XSD, "negativeInteger"); - public static QName QNAME_TYPE_NON_NEGATIVE_INTEGER = - new QName(NS_XSD, "nonNegativeInteger"); - public static QName QNAME_TYPE_NON_POSITIVE_INTEGER = - new QName(NS_XSD, "nonPositiveInteger"); - public static QName QNAME_TYPE_INT = new QName(NS_XSD, "int"); - public static QName QNAME_TYPE_UNSIGNED_INT = - new QName(NS_XSD, "unsignedInt"); - public static QName QNAME_TYPE_LONG = new QName(NS_XSD, "long"); - public static QName QNAME_TYPE_UNSIGNED_LONG = - new QName(NS_XSD, "unsignedLong"); - public static QName QNAME_TYPE_SHORT = new QName(NS_XSD, "short"); - public static QName QNAME_TYPE_UNSIGNED_SHORT = - new QName(NS_XSD, "unsignedShort"); - public static QName QNAME_TYPE_DECIMAL = new QName(NS_XSD, "decimal"); - public static QName QNAME_TYPE_FLOAT = new QName(NS_XSD, "float"); - public static QName QNAME_TYPE_DOUBLE = new QName(NS_XSD, "double"); - public static QName QNAME_TYPE_BOOLEAN = new QName(NS_XSD, "boolean"); - public static QName QNAME_TYPE_TIME = new QName(NS_XSD, "time"); - public static QName QNAME_TYPE_DATE_TIME = new QName(NS_XSD, "dateTime"); - public static QName QNAME_TYPE_DURATION = new QName(NS_XSD, "duration"); - public static QName QNAME_TYPE_DATE = new QName(NS_XSD, "date"); - public static QName QNAME_TYPE_G_MONTH = new QName(NS_XSD, "gMonth"); - public static QName QNAME_TYPE_G_YEAR = new QName(NS_XSD, "gYear"); - public static QName QNAME_TYPE_G_YEAR_MONTH = - new QName(NS_XSD, "gYearMonth"); - public static QName QNAME_TYPE_G_DAY = new QName(NS_XSD, "gDay"); - public static QName QNAME_TYPE_G_MONTH_DAY = new QName(NS_XSD, "gMonthDay"); - public static QName QNAME_TYPE_NAME = new QName(NS_XSD, "Name"); - public static QName QNAME_TYPE_QNAME = new QName(NS_XSD, "QName"); - public static QName QNAME_TYPE_NCNAME = new QName(NS_XSD, "NCName"); - public static QName QNAME_TYPE_ANY_URI = new QName(NS_XSD, "anyURI"); - public static QName QNAME_TYPE_ID = new QName(NS_XSD, "ID"); - public static QName QNAME_TYPE_IDREF = new QName(NS_XSD, "IDREF"); - public static QName QNAME_TYPE_IDREFS = new QName(NS_XSD, "IDREFS"); - public static QName QNAME_TYPE_ENTITY = new QName(NS_XSD, "ENTITY"); - public static QName QNAME_TYPE_ENTITIES = new QName(NS_XSD, "ENTITIES"); - public static QName QNAME_TYPE_NOTATION = new QName(NS_XSD, "NOTATION"); - public static QName QNAME_TYPE_NMTOKEN = new QName(NS_XSD, "NMTOKEN"); - public static QName QNAME_TYPE_NMTOKENS = new QName(NS_XSD, "NMTOKENS"); - - public static QName QNAME_TYPE_LANGUAGE = new QName(NS_XSD, "language"); - - // QNames for special types - public static QName QNAME_TYPE_URTYPE = new QName(NS_XSD, "anyType"); - public static QName QNAME_TYPE_SIMPLE_URTYPE = - new QName(NS_XSD, "anySimpleType"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/schema/SchemaKinds.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/schema/SchemaKinds.java deleted file mode 100644 index 131aa266551..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/schema/SchemaKinds.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.schema; - -import com.sun.tools.internal.ws.wsdl.framework.Kind; - -/** - * - * @author WS Development Team - */ -public class SchemaKinds { - public static final Kind XSD_ATTRIBUTE = new Kind("xsd:attribute"); - public static final Kind XSD_ATTRIBUTE_GROUP = - new Kind("xsd:attributeGroup"); - public static final Kind XSD_CONSTRAINT = new Kind("xsd:constraint"); - public static final Kind XSD_ELEMENT = new Kind("xsd:element"); - public static final Kind XSD_GROUP = new Kind("xsd:group"); - public static final Kind XSD_IDENTITY_CONSTRAINT = - new Kind("xsd:identityConstraint"); - public static final Kind XSD_NOTATION = new Kind("xsd:notation"); - public static final Kind XSD_TYPE = new Kind("xsd:type"); - - private SchemaKinds() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAP12Binding.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAP12Binding.java deleted file mode 100644 index 36c982ff85a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAP12Binding.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.document.soap; - -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -public class SOAP12Binding extends SOAPBinding{ - public SOAP12Binding(Locator locator) { - super(locator); - } - - @Override public QName getElementName() { - return SOAP12Constants.QNAME_BINDING; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAP12Constants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAP12Constants.java deleted file mode 100644 index a5ba97fa9b7..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAP12Constants.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.document.soap; - -import javax.xml.namespace.QName; - -/** - * Interface defining SOAP1.2-related constants. - * - * @author WS Development Team - */ -public interface SOAP12Constants { - - // namespace URIs - public static String NS_WSDL_SOAP = "http://schemas.xmlsoap.org/wsdl/soap12/"; - public static String NS_SOAP_ENCODING = - "http://schemas.xmlsoap.org/soap/encoding/"; - - // other URIs - public static String URI_SOAP_TRANSPORT_HTTP = - "http://www.w3.org/2003/05/soap/bindings/HTTP/"; - ; - - // QNames - public static QName QNAME_ADDRESS = new QName(NS_WSDL_SOAP, "address"); - public static QName QNAME_BINDING = new QName(NS_WSDL_SOAP, "binding"); - public static QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body"); - public static QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault"); - public static QName QNAME_HEADER = new QName(NS_WSDL_SOAP, "header"); - public static QName QNAME_HEADERFAULT = - new QName(NS_WSDL_SOAP, "headerfault"); - public static QName QNAME_OPERATION = new QName(NS_WSDL_SOAP, "operation"); - - // SOAP encoding QNames - public static QName QNAME_TYPE_ARRAY = new QName(NS_SOAP_ENCODING, "Array"); - public static QName QNAME_ATTR_GROUP_COMMON_ATTRIBUTES = - new QName(NS_SOAP_ENCODING, "commonAttributes"); - public static QName QNAME_ATTR_ARRAY_TYPE = - new QName(NS_SOAP_ENCODING, "arrayType"); - public static QName QNAME_ATTR_ITEM_TYPE = - new QName(NS_SOAP_ENCODING, "itemType"); - public static QName QNAME_ATTR_ARRAY_SIZE = - new QName(NS_SOAP_ENCODING, "arraySize"); - public static QName QNAME_ATTR_OFFSET = - new QName(NS_SOAP_ENCODING, "offset"); - public static QName QNAME_ATTR_POSITION = - new QName(NS_SOAP_ENCODING, "position"); - - public static QName QNAME_TYPE_BASE64 = - new QName(NS_SOAP_ENCODING, "base64"); - - public static QName QNAME_ELEMENT_STRING = - new QName(NS_SOAP_ENCODING, "string"); - public static QName QNAME_ELEMENT_NORMALIZED_STRING = - new QName(NS_SOAP_ENCODING, "normalizedString"); - public static QName QNAME_ELEMENT_TOKEN = - new QName(NS_SOAP_ENCODING, "token"); - public static QName QNAME_ELEMENT_BYTE = - new QName(NS_SOAP_ENCODING, "byte"); - public static QName QNAME_ELEMENT_UNSIGNED_BYTE = - new QName(NS_SOAP_ENCODING, "unsignedByte"); - public static QName QNAME_ELEMENT_BASE64_BINARY = - new QName(NS_SOAP_ENCODING, "base64Binary"); - public static QName QNAME_ELEMENT_HEX_BINARY = - new QName(NS_SOAP_ENCODING, "hexBinary"); - public static QName QNAME_ELEMENT_INTEGER = - new QName(NS_SOAP_ENCODING, "integer"); - public static QName QNAME_ELEMENT_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "positiveInteger"); - public static QName QNAME_ELEMENT_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "negativeInteger"); - public static QName QNAME_ELEMENT_NON_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonNegativeInteger"); - public static QName QNAME_ELEMENT_NON_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonPositiveInteger"); - public static QName QNAME_ELEMENT_INT = new QName(NS_SOAP_ENCODING, "int"); - public static QName QNAME_ELEMENT_UNSIGNED_INT = - new QName(NS_SOAP_ENCODING, "unsignedInt"); - public static QName QNAME_ELEMENT_LONG = - new QName(NS_SOAP_ENCODING, "long"); - public static QName QNAME_ELEMENT_UNSIGNED_LONG = - new QName(NS_SOAP_ENCODING, "unsignedLong"); - public static QName QNAME_ELEMENT_SHORT = - new QName(NS_SOAP_ENCODING, "short"); - public static QName QNAME_ELEMENT_UNSIGNED_SHORT = - new QName(NS_SOAP_ENCODING, "unsignedShort"); - public static QName QNAME_ELEMENT_DECIMAL = - new QName(NS_SOAP_ENCODING, "decimal"); - public static QName QNAME_ELEMENT_FLOAT = - new QName(NS_SOAP_ENCODING, "float"); - public static QName QNAME_ELEMENT_DOUBLE = - new QName(NS_SOAP_ENCODING, "double"); - public static QName QNAME_ELEMENT_BOOLEAN = - new QName(NS_SOAP_ENCODING, "boolean"); - public static QName QNAME_ELEMENT_TIME = - new QName(NS_SOAP_ENCODING, "time"); - public static QName QNAME_ELEMENT_DATE_TIME = - new QName(NS_SOAP_ENCODING, "dateTime"); - public static QName QNAME_ELEMENT_DURATION = - new QName(NS_SOAP_ENCODING, "duration"); - public static QName QNAME_ELEMENT_DATE = - new QName(NS_SOAP_ENCODING, "date"); - public static QName QNAME_ELEMENT_G_MONTH = - new QName(NS_SOAP_ENCODING, "gMonth"); - public static QName QNAME_ELEMENT_G_YEAR = - new QName(NS_SOAP_ENCODING, "gYear"); - public static QName QNAME_ELEMENT_G_YEAR_MONTH = - new QName(NS_SOAP_ENCODING, "gYearMonth"); - public static QName QNAME_ELEMENT_G_DAY = - new QName(NS_SOAP_ENCODING, "gDay"); - public static QName QNAME_ELEMENT_G_MONTH_DAY = - new QName(NS_SOAP_ENCODING, "gMonthDay"); - public static QName QNAME_ELEMENT_NAME = - new QName(NS_SOAP_ENCODING, "Name"); - public static QName QNAME_ELEMENT_QNAME = - new QName(NS_SOAP_ENCODING, "QName"); - public static QName QNAME_ELEMENT_NCNAME = - new QName(NS_SOAP_ENCODING, "NCName"); - public static QName QNAME_ELEMENT_ANY_URI = - new QName(NS_SOAP_ENCODING, "anyURI"); - public static QName QNAME_ELEMENT_ID = new QName(NS_SOAP_ENCODING, "ID"); - public static QName QNAME_ELEMENT_IDREF = - new QName(NS_SOAP_ENCODING, "IDREF"); - public static QName QNAME_ELEMENT_IDREFS = - new QName(NS_SOAP_ENCODING, "IDREFS"); - public static QName QNAME_ELEMENT_ENTITY = - new QName(NS_SOAP_ENCODING, "ENTITY"); - public static QName QNAME_ELEMENT_ENTITIES = - new QName(NS_SOAP_ENCODING, "ENTITIES"); - public static QName QNAME_ELEMENT_NOTATION = - new QName(NS_SOAP_ENCODING, "NOTATION"); - public static QName QNAME_ELEMENT_NMTOKEN = - new QName(NS_SOAP_ENCODING, "NMTOKEN"); - public static QName QNAME_ELEMENT_NMTOKENS = - new QName(NS_SOAP_ENCODING, "NMTOKENS"); - - public static QName QNAME_TYPE_STRING = - new QName(NS_SOAP_ENCODING, "string"); - public static QName QNAME_TYPE_NORMALIZED_STRING = - new QName(NS_SOAP_ENCODING, "normalizedString"); - public static QName QNAME_TYPE_TOKEN = new QName(NS_SOAP_ENCODING, "token"); - public static QName QNAME_TYPE_BYTE = new QName(NS_SOAP_ENCODING, "byte"); - public static QName QNAME_TYPE_UNSIGNED_BYTE = - new QName(NS_SOAP_ENCODING, "unsignedByte"); - public static QName QNAME_TYPE_BASE64_BINARY = - new QName(NS_SOAP_ENCODING, "base64Binary"); - public static QName QNAME_TYPE_HEX_BINARY = - new QName(NS_SOAP_ENCODING, "hexBinary"); - public static QName QNAME_TYPE_INTEGER = - new QName(NS_SOAP_ENCODING, "integer"); - public static QName QNAME_TYPE_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "positiveInteger"); - public static QName QNAME_TYPE_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "negativeInteger"); - public static QName QNAME_TYPE_NON_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonNegativeInteger"); - public static QName QNAME_TYPE_NON_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonPositiveInteger"); - public static QName QNAME_TYPE_INT = new QName(NS_SOAP_ENCODING, "int"); - public static QName QNAME_TYPE_UNSIGNED_INT = - new QName(NS_SOAP_ENCODING, "unsignedInt"); - public static QName QNAME_TYPE_LONG = new QName(NS_SOAP_ENCODING, "long"); - public static QName QNAME_TYPE_UNSIGNED_LONG = - new QName(NS_SOAP_ENCODING, "unsignedLong"); - public static QName QNAME_TYPE_SHORT = new QName(NS_SOAP_ENCODING, "short"); - public static QName QNAME_TYPE_UNSIGNED_SHORT = - new QName(NS_SOAP_ENCODING, "unsignedShort"); - public static QName QNAME_TYPE_DECIMAL = - new QName(NS_SOAP_ENCODING, "decimal"); - public static QName QNAME_TYPE_FLOAT = new QName(NS_SOAP_ENCODING, "float"); - public static QName QNAME_TYPE_DOUBLE = - new QName(NS_SOAP_ENCODING, "double"); - public static QName QNAME_TYPE_BOOLEAN = - new QName(NS_SOAP_ENCODING, "boolean"); - public static QName QNAME_TYPE_TIME = new QName(NS_SOAP_ENCODING, "time"); - public static QName QNAME_TYPE_DATE_TIME = - new QName(NS_SOAP_ENCODING, "dateTime"); - public static QName QNAME_TYPE_DURATION = - new QName(NS_SOAP_ENCODING, "duration"); - public static QName QNAME_TYPE_DATE = new QName(NS_SOAP_ENCODING, "date"); - public static QName QNAME_TYPE_G_MONTH = - new QName(NS_SOAP_ENCODING, "gMonth"); - public static QName QNAME_TYPE_G_YEAR = - new QName(NS_SOAP_ENCODING, "gYear"); - public static QName QNAME_TYPE_G_YEAR_MONTH = - new QName(NS_SOAP_ENCODING, "gYearMonth"); - public static QName QNAME_TYPE_G_DAY = new QName(NS_SOAP_ENCODING, "gDay"); - public static QName QNAME_TYPE_G_MONTH_DAY = - new QName(NS_SOAP_ENCODING, "gMonthDay"); - public static QName QNAME_TYPE_NAME = new QName(NS_SOAP_ENCODING, "Name"); - public static QName QNAME_TYPE_QNAME = new QName(NS_SOAP_ENCODING, "QName"); - public static QName QNAME_TYPE_NCNAME = - new QName(NS_SOAP_ENCODING, "NCName"); - public static QName QNAME_TYPE_ANY_URI = - new QName(NS_SOAP_ENCODING, "anyURI"); - public static QName QNAME_TYPE_ID = new QName(NS_SOAP_ENCODING, "ID"); - public static QName QNAME_TYPE_IDREF = new QName(NS_SOAP_ENCODING, "IDREF"); - public static QName QNAME_TYPE_IDREFS = - new QName(NS_SOAP_ENCODING, "IDREFS"); - public static QName QNAME_TYPE_ENTITY = - new QName(NS_SOAP_ENCODING, "ENTITY"); - public static QName QNAME_TYPE_ENTITIES = - new QName(NS_SOAP_ENCODING, "ENTITIES"); - public static QName QNAME_TYPE_NOTATION = - new QName(NS_SOAP_ENCODING, "NOTATION"); - public static QName QNAME_TYPE_NMTOKEN = - new QName(NS_SOAP_ENCODING, "NMTOKEN"); - public static QName QNAME_TYPE_NMTOKENS = - new QName(NS_SOAP_ENCODING, "NMTOKENS"); - public static QName QNAME_TYPE_LANGUAGE = - new QName(NS_SOAP_ENCODING, "LANGUAGE"); - - // SOAP attributes with non-colonized names - public static QName QNAME_ATTR_ID = new QName("", "id"); - public static QName QNAME_ATTR_HREF = new QName("", "ref"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPAddress.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPAddress.java deleted file mode 100644 index 89808a85fa4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPAddress.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A SOAP address extension. - * - * @author WS Development Team - */ -public class SOAPAddress extends ExtensionImpl { - - public SOAPAddress(Locator locator) { - super(locator); - } - - public QName getElementName() { - return SOAPConstants.QNAME_ADDRESS; - } - - public String getLocation() { - return _location; - } - - public void setLocation(String s) { - _location = s; - } - - public void validateThis() { - if (_location == null) { - failValidation("validation.missingRequiredAttribute", "location"); - } - } - - private String _location; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPBinding.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPBinding.java deleted file mode 100644 index 41ee6a20723..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPBinding.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A SOAP binding extension. - * - * @author WS Development Team - */ -public class SOAPBinding extends ExtensionImpl { - - public SOAPBinding(Locator locator) { - super(locator); - _style = SOAPStyle.DOCUMENT; - } - - public QName getElementName() { - return SOAPConstants.QNAME_BINDING; - } - - public String getTransport() { - return _transport; - } - - public void setTransport(String s) { - _transport = s; - } - - public SOAPStyle getStyle() { - return _style; - } - - public void setStyle(SOAPStyle s) { - _style = s; - } - - public boolean isDocument() { - return _style == SOAPStyle.DOCUMENT; - } - - public boolean isRPC() { - return _style == SOAPStyle.RPC; - } - - public void validateThis() { - } - - private String _transport; - private SOAPStyle _style; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPBody.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPBody.java deleted file mode 100644 index 6f78fa4c96b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPBody.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A SOAP body extension. - * - * @author WS Development Team - */ -public class SOAPBody extends ExtensionImpl { - - public SOAPBody(Locator locator) { - super(locator); - } - - public QName getElementName() { - return SOAPConstants.QNAME_BODY; - } - - public String getNamespace() { - return _namespace; - } - - public void setNamespace(String s) { - _namespace = s; - } - - public SOAPUse getUse() { - return _use; - } - - public void setUse(SOAPUse u) { - _use = u; - } - - public boolean isEncoded() { - return _use == SOAPUse.ENCODED; - } - - public boolean isLiteral() { - return _use == SOAPUse.LITERAL; - } - - public String getEncodingStyle() { - return _encodingStyle; - } - - public void setEncodingStyle(String s) { - _encodingStyle = s; - } - - public String getParts() { - return _parts; - } - - public void setParts(String s) { - _parts = s; - } - - public void validateThis() { - } - - private String _encodingStyle; - private String _namespace; - private String _parts; - private SOAPUse _use=SOAPUse.LITERAL; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java deleted file mode 100644 index 11a179a8439..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants; - -import javax.xml.namespace.QName; - -/** - * Interface defining SOAP-related constants. - * - * @author WS Development Team - */ -public interface SOAPConstants { - - // namespace URIs - public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE; - public static final String NS_WSDL_SOAP = - "http://schemas.xmlsoap.org/wsdl/soap/"; - public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; - - // other URIs - public final String URI_SOAP_TRANSPORT_HTTP = - "http://schemas.xmlsoap.org/soap/http"; - - // QNames - public static final QName QNAME_ADDRESS = - new QName(NS_WSDL_SOAP, "address"); - public static final QName QNAME_BINDING = - new QName(NS_WSDL_SOAP, "binding"); - public static final QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body"); - public static final QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault"); - public static final QName QNAME_HEADER = new QName(NS_WSDL_SOAP, "header"); - public static final QName QNAME_HEADERFAULT = - new QName(NS_WSDL_SOAP, "headerfault"); - public static final QName QNAME_OPERATION = - new QName(NS_WSDL_SOAP, "operation"); - public static final QName QNAME_MUSTUNDERSTAND = - new QName(URI_ENVELOPE, "mustUnderstand"); - - - // SOAP encoding QNames - public static final QName QNAME_TYPE_ARRAY = - new QName(NS_SOAP_ENCODING, "Array"); - public static final QName QNAME_ATTR_GROUP_COMMON_ATTRIBUTES = - new QName(NS_SOAP_ENCODING, "commonAttributes"); - public static final QName QNAME_ATTR_ARRAY_TYPE = - new QName(NS_SOAP_ENCODING, "arrayType"); - public static final QName QNAME_ATTR_OFFSET = - new QName(NS_SOAP_ENCODING, "offset"); - public static final QName QNAME_ATTR_POSITION = - new QName(NS_SOAP_ENCODING, "position"); - - public static final QName QNAME_TYPE_BASE64 = - new QName(NS_SOAP_ENCODING, "base64"); - - public static final QName QNAME_ELEMENT_STRING = - new QName(NS_SOAP_ENCODING, "string"); - public static final QName QNAME_ELEMENT_NORMALIZED_STRING = - new QName(NS_SOAP_ENCODING, "normalizedString"); - public static final QName QNAME_ELEMENT_TOKEN = - new QName(NS_SOAP_ENCODING, "token"); - public static final QName QNAME_ELEMENT_BYTE = - new QName(NS_SOAP_ENCODING, "byte"); - public static final QName QNAME_ELEMENT_UNSIGNED_BYTE = - new QName(NS_SOAP_ENCODING, "unsignedByte"); - public static final QName QNAME_ELEMENT_BASE64_BINARY = - new QName(NS_SOAP_ENCODING, "base64Binary"); - public static final QName QNAME_ELEMENT_HEX_BINARY = - new QName(NS_SOAP_ENCODING, "hexBinary"); - public static final QName QNAME_ELEMENT_INTEGER = - new QName(NS_SOAP_ENCODING, "integer"); - public static final QName QNAME_ELEMENT_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "positiveInteger"); - public static final QName QNAME_ELEMENT_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "negativeInteger"); - public static final QName QNAME_ELEMENT_NON_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonNegativeInteger"); - public static final QName QNAME_ELEMENT_NON_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonPositiveInteger"); - public static final QName QNAME_ELEMENT_INT = - new QName(NS_SOAP_ENCODING, "int"); - public static final QName QNAME_ELEMENT_UNSIGNED_INT = - new QName(NS_SOAP_ENCODING, "unsignedInt"); - public static final QName QNAME_ELEMENT_LONG = - new QName(NS_SOAP_ENCODING, "long"); - public static final QName QNAME_ELEMENT_UNSIGNED_LONG = - new QName(NS_SOAP_ENCODING, "unsignedLong"); - public static final QName QNAME_ELEMENT_SHORT = - new QName(NS_SOAP_ENCODING, "short"); - public static final QName QNAME_ELEMENT_UNSIGNED_SHORT = - new QName(NS_SOAP_ENCODING, "unsignedShort"); - public static final QName QNAME_ELEMENT_DECIMAL = - new QName(NS_SOAP_ENCODING, "decimal"); - public static final QName QNAME_ELEMENT_FLOAT = - new QName(NS_SOAP_ENCODING, "float"); - public static final QName QNAME_ELEMENT_DOUBLE = - new QName(NS_SOAP_ENCODING, "double"); - public static final QName QNAME_ELEMENT_BOOLEAN = - new QName(NS_SOAP_ENCODING, "boolean"); - public static final QName QNAME_ELEMENT_TIME = - new QName(NS_SOAP_ENCODING, "time"); - public static final QName QNAME_ELEMENT_DATE_TIME = - new QName(NS_SOAP_ENCODING, "dateTime"); - public static final QName QNAME_ELEMENT_DURATION = - new QName(NS_SOAP_ENCODING, "duration"); - public static final QName QNAME_ELEMENT_DATE = - new QName(NS_SOAP_ENCODING, "date"); - public static final QName QNAME_ELEMENT_G_MONTH = - new QName(NS_SOAP_ENCODING, "gMonth"); - public static final QName QNAME_ELEMENT_G_YEAR = - new QName(NS_SOAP_ENCODING, "gYear"); - public static final QName QNAME_ELEMENT_G_YEAR_MONTH = - new QName(NS_SOAP_ENCODING, "gYearMonth"); - public static final QName QNAME_ELEMENT_G_DAY = - new QName(NS_SOAP_ENCODING, "gDay"); - public static final QName QNAME_ELEMENT_G_MONTH_DAY = - new QName(NS_SOAP_ENCODING, "gMonthDay"); - public static final QName QNAME_ELEMENT_NAME = - new QName(NS_SOAP_ENCODING, "Name"); - public static final QName QNAME_ELEMENT_QNAME = - new QName(NS_SOAP_ENCODING, "QName"); - public static final QName QNAME_ELEMENT_NCNAME = - new QName(NS_SOAP_ENCODING, "NCName"); - public static final QName QNAME_ELEMENT_ANY_URI = - new QName(NS_SOAP_ENCODING, "anyURI"); - public static final QName QNAME_ELEMENT_ID = - new QName(NS_SOAP_ENCODING, "ID"); - public static final QName QNAME_ELEMENT_IDREF = - new QName(NS_SOAP_ENCODING, "IDREF"); - public static final QName QNAME_ELEMENT_IDREFS = - new QName(NS_SOAP_ENCODING, "IDREFS"); - public static final QName QNAME_ELEMENT_ENTITY = - new QName(NS_SOAP_ENCODING, "ENTITY"); - public static final QName QNAME_ELEMENT_ENTITIES = - new QName(NS_SOAP_ENCODING, "ENTITIES"); - public static final QName QNAME_ELEMENT_NOTATION = - new QName(NS_SOAP_ENCODING, "NOTATION"); - public static final QName QNAME_ELEMENT_NMTOKEN = - new QName(NS_SOAP_ENCODING, "NMTOKEN"); - public static final QName QNAME_ELEMENT_NMTOKENS = - new QName(NS_SOAP_ENCODING, "NMTOKENS"); - - public static final QName QNAME_TYPE_STRING = - new QName(NS_SOAP_ENCODING, "string"); - public static final QName QNAME_TYPE_NORMALIZED_STRING = - new QName(NS_SOAP_ENCODING, "normalizedString"); - public static final QName QNAME_TYPE_TOKEN = - new QName(NS_SOAP_ENCODING, "token"); - public static final QName QNAME_TYPE_BYTE = - new QName(NS_SOAP_ENCODING, "byte"); - public static final QName QNAME_TYPE_UNSIGNED_BYTE = - new QName(NS_SOAP_ENCODING, "unsignedByte"); - public static final QName QNAME_TYPE_BASE64_BINARY = - new QName(NS_SOAP_ENCODING, "base64Binary"); - public static final QName QNAME_TYPE_HEX_BINARY = - new QName(NS_SOAP_ENCODING, "hexBinary"); - public static final QName QNAME_TYPE_INTEGER = - new QName(NS_SOAP_ENCODING, "integer"); - public static final QName QNAME_TYPE_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "positiveInteger"); - public static final QName QNAME_TYPE_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "negativeInteger"); - public static final QName QNAME_TYPE_NON_NEGATIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonNegativeInteger"); - public static final QName QNAME_TYPE_NON_POSITIVE_INTEGER = - new QName(NS_SOAP_ENCODING, "nonPositiveInteger"); - public static final QName QNAME_TYPE_INT = - new QName(NS_SOAP_ENCODING, "int"); - public static final QName QNAME_TYPE_UNSIGNED_INT = - new QName(NS_SOAP_ENCODING, "unsignedInt"); - public static final QName QNAME_TYPE_LONG = - new QName(NS_SOAP_ENCODING, "long"); - public static final QName QNAME_TYPE_UNSIGNED_LONG = - new QName(NS_SOAP_ENCODING, "unsignedLong"); - public static final QName QNAME_TYPE_SHORT = - new QName(NS_SOAP_ENCODING, "short"); - public static final QName QNAME_TYPE_UNSIGNED_SHORT = - new QName(NS_SOAP_ENCODING, "unsignedShort"); - public static final QName QNAME_TYPE_DECIMAL = - new QName(NS_SOAP_ENCODING, "decimal"); - public static final QName QNAME_TYPE_FLOAT = - new QName(NS_SOAP_ENCODING, "float"); - public static final QName QNAME_TYPE_DOUBLE = - new QName(NS_SOAP_ENCODING, "double"); - public static final QName QNAME_TYPE_BOOLEAN = - new QName(NS_SOAP_ENCODING, "boolean"); - public static final QName QNAME_TYPE_TIME = - new QName(NS_SOAP_ENCODING, "time"); - public static final QName QNAME_TYPE_DATE_TIME = - new QName(NS_SOAP_ENCODING, "dateTime"); - public static final QName QNAME_TYPE_DURATION = - new QName(NS_SOAP_ENCODING, "duration"); - public static final QName QNAME_TYPE_DATE = - new QName(NS_SOAP_ENCODING, "date"); - public static final QName QNAME_TYPE_G_MONTH = - new QName(NS_SOAP_ENCODING, "gMonth"); - public static final QName QNAME_TYPE_G_YEAR = - new QName(NS_SOAP_ENCODING, "gYear"); - public static final QName QNAME_TYPE_G_YEAR_MONTH = - new QName(NS_SOAP_ENCODING, "gYearMonth"); - public static final QName QNAME_TYPE_G_DAY = - new QName(NS_SOAP_ENCODING, "gDay"); - public static final QName QNAME_TYPE_G_MONTH_DAY = - new QName(NS_SOAP_ENCODING, "gMonthDay"); - public static final QName QNAME_TYPE_NAME = - new QName(NS_SOAP_ENCODING, "Name"); - public static final QName QNAME_TYPE_QNAME = - new QName(NS_SOAP_ENCODING, "QName"); - public static final QName QNAME_TYPE_NCNAME = - new QName(NS_SOAP_ENCODING, "NCName"); - public static final QName QNAME_TYPE_ANY_URI = - new QName(NS_SOAP_ENCODING, "anyURI"); - public static final QName QNAME_TYPE_ID = new QName(NS_SOAP_ENCODING, "ID"); - public static final QName QNAME_TYPE_IDREF = - new QName(NS_SOAP_ENCODING, "IDREF"); - public static final QName QNAME_TYPE_IDREFS = - new QName(NS_SOAP_ENCODING, "IDREFS"); - public static final QName QNAME_TYPE_ENTITY = - new QName(NS_SOAP_ENCODING, "ENTITY"); - public static final QName QNAME_TYPE_ENTITIES = - new QName(NS_SOAP_ENCODING, "ENTITIES"); - public static final QName QNAME_TYPE_NOTATION = - new QName(NS_SOAP_ENCODING, "NOTATION"); - public static final QName QNAME_TYPE_NMTOKEN = - new QName(NS_SOAP_ENCODING, "NMTOKEN"); - public static final QName QNAME_TYPE_NMTOKENS = - new QName(NS_SOAP_ENCODING, "NMTOKENS"); - public static final QName QNAME_TYPE_LANGUAGE = - new QName(NS_SOAP_ENCODING, "LANGUAGE"); - - // SOAP attributes with non-colonized names - public static final QName QNAME_ATTR_ID = new QName("", "id"); - public static final QName QNAME_ATTR_HREF = new QName("", "href"); - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPFault.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPFault.java deleted file mode 100644 index 452e00516f2..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPFault.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A SOAP fault extension. - * - * @author WS Development Team - */ -public class SOAPFault extends ExtensionImpl { - - public SOAPFault(Locator locator) { - super(locator); - _use = SOAPUse.LITERAL; - } - - public QName getElementName() { - return SOAPConstants.QNAME_FAULT; - } - - public String getName() { - return _name; - } - - public void setName(String s) { - _name = s; - } - - public String getNamespace() { - return _namespace; - } - - public void setNamespace(String s) { - _namespace = s; - } - - public SOAPUse getUse() { - return _use; - } - - public void setUse(SOAPUse u) { - _use = u; - } - - public boolean isEncoded() { - return _use == SOAPUse.ENCODED; - } - - public boolean isLiteral() { - return _use == SOAPUse.LITERAL; - } - - public String getEncodingStyle() { - return _encodingStyle; - } - - public void setEncodingStyle(String s) { - _encodingStyle = s; - } - - public void validateThis() { - } - - private String _name; - private String _encodingStyle; - private String _namespace; - private SOAPUse _use = SOAPUse.LITERAL; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPHeader.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPHeader.java deleted file mode 100644 index d8e586b8dbb..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPHeader.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.*; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A SOAP header extension. - * - * @author WS Development Team - */ -public class SOAPHeader extends ExtensionImpl { - - public SOAPHeader(Locator locator) { - super(locator); - _faults = new ArrayList(); - } - - public void add(SOAPHeaderFault fault) { - _faults.add(fault); - } - - public Iterator faults() { - return _faults.iterator(); - } - - public QName getElementName() { - return SOAPConstants.QNAME_HEADER; - } - - public String getNamespace() { - return _namespace; - } - - public void setNamespace(String s) { - _namespace = s; - } - - public SOAPUse getUse() { - return _use; - } - - public void setUse(SOAPUse u) { - _use = u; - } - - public boolean isEncoded() { - return _use == SOAPUse.ENCODED; - } - - public boolean isLiteral() { - return _use == SOAPUse.LITERAL; - } - - public String getEncodingStyle() { - return _encodingStyle; - } - - public void setEncodingStyle(String s) { - _encodingStyle = s; - } - - public String getPart() { - return _part; - } - - public void setMessage(QName message) { - _message = message; - } - - public QName getMessage() { - return _message; - } - - public void setPart(String s) { - _part = s; - } - - public void withAllSubEntitiesDo(EntityAction action) { - super.withAllSubEntitiesDo(action); - - for (Iterator iter = _faults.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - } - - public void withAllQNamesDo(QNameAction action) { - super.withAllQNamesDo(action); - - if (_message != null) { - action.perform(_message); - } - } - - public void accept(ExtensionVisitor visitor) throws Exception { - visitor.preVisit(this); - for (Iterator iter = _faults.iterator(); iter.hasNext();) { - ((SOAPHeaderFault) iter.next()).accept(visitor); - } - visitor.postVisit(this); - } - - public void validateThis() { - if (_message == null) { - failValidation("validation.missingRequiredAttribute", "message"); - } - if (_part == null) { - failValidation("validation.missingRequiredAttribute", "part"); - } - // Fix for bug 4851427 - // if (_use == null) { - // failValidation("validation.missingRequiredAttribute", "use"); - // } - } - - private String _encodingStyle; - private String _namespace; - private String _part; - private QName _message; - private SOAPUse _use=SOAPUse.LITERAL; - private List _faults; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPHeaderFault.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPHeaderFault.java deleted file mode 100644 index f30e94f4421..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPHeaderFault.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import com.sun.tools.internal.ws.wsdl.framework.QNameAction; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A SOAP header fault extension. - * - * @author WS Development Team - */ -public class SOAPHeaderFault extends ExtensionImpl { - - public SOAPHeaderFault(Locator locator) { - super(locator); - } - - public QName getElementName() { - return SOAPConstants.QNAME_HEADERFAULT; - } - - public String getNamespace() { - return _namespace; - } - - public void setNamespace(String s) { - _namespace = s; - } - - public SOAPUse getUse() { - return _use; - } - - public void setUse(SOAPUse u) { - _use = u; - } - - public boolean isEncoded() { - return _use == SOAPUse.ENCODED; - } - - public boolean isLiteral() { - return _use == SOAPUse.LITERAL; - } - - public String getEncodingStyle() { - return _encodingStyle; - } - - public void setEncodingStyle(String s) { - _encodingStyle = s; - } - - public String getPart() { - return _part; - } - - public void setMessage(QName message) { - _message = message; - } - - public QName getMessage() { - return _message; - } - - public void setPart(String s) { - _part = s; - } - - public void withAllQNamesDo(QNameAction action) { - super.withAllQNamesDo(action); - - if (_message != null) { - action.perform(_message); - } - } - - public void validateThis() { - if (_message == null) { - failValidation("validation.missingRequiredAttribute", "message"); - } - if (_part == null) { - failValidation("validation.missingRequiredAttribute", "part"); - } - if (_use == null) { - failValidation("validation.missingRequiredAttribute", "use"); - } - } - - private String _encodingStyle; - private String _namespace; - private String _part; - private QName _message; - private SOAPUse _use=SOAPUse.LITERAL; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPOperation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPOperation.java deleted file mode 100644 index f056317d129..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPOperation.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * A SOAP operation extension. - * - * @author WS Development Team - */ -public class SOAPOperation extends ExtensionImpl { - - public SOAPOperation(Locator locator) { - super(locator); - - } - - public QName getElementName() { - return SOAPConstants.QNAME_OPERATION; - } - - public String getSOAPAction() { - return _soapAction; - } - - public void setSOAPAction(String s) { - _soapAction = s; - } - - public SOAPStyle getStyle() { - return _style; - } - - public void setStyle(SOAPStyle s) { - _style = s; - } - - public boolean isDocument() { - return _style == SOAPStyle.DOCUMENT; - } - - public boolean isRPC() { - return _style == SOAPStyle.RPC; - } - - public void validateThis() { - } - - private String _soapAction; - private SOAPStyle _style; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPStyle.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPStyle.java deleted file mode 100644 index 4dc852eed8d..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPStyle.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -/** - * A SOAP "style" enumeration. - * - * @author WS Development Team - */ -public final class SOAPStyle { - - public static final SOAPStyle RPC = new SOAPStyle(); - public static final SOAPStyle DOCUMENT = new SOAPStyle(); - - private SOAPStyle() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPUse.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPUse.java deleted file mode 100644 index 793a0d43302..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPUse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.document.soap; - -/** - * A SOAP "use" enumeration. - * - * @author WS Development Team - */ -public final class SOAPUse { - - public static final SOAPUse LITERAL = new SOAPUse(); - public static final SOAPUse ENCODED = new SOAPUse(); - - private SOAPUse() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/AbstractDocument.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/AbstractDocument.java deleted file mode 100644 index 7809842184f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/AbstractDocument.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder; -import com.sun.tools.internal.ws.wsdl.parser.DOMForest; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.resources.WsdlMessages; - -import javax.xml.namespace.QName; -import java.util.*; - -import org.xml.sax.helpers.LocatorImpl; - -/** - * An abstract class for documents containing entities. - * - * @author WS Development Team - */ -public abstract class AbstractDocument { - - protected final DOMForest forest; - protected final ErrorReceiver errReceiver; - - protected AbstractDocument(MetadataFinder forest, ErrorReceiver errReceiver) { - this.forest = forest; - this.errReceiver = errReceiver; - kinds = new HashMap(); - importedEntities = new ArrayList(); - importedDocuments = new HashSet(); - includedEntities = new ArrayList(); - includedDocuments = new HashSet(); - } - - public String getSystemId() { - return _systemId; - } - - public void setSystemId(String s) { - if (_systemId != null && !_systemId.equals(s)) { - // avoid redefinition of a system identifier - throw new IllegalArgumentException(); - } - - _systemId = s; - if (s != null) { - importedDocuments.add(s); - } - } - - public void addIncludedDocument(String systemId) { - includedDocuments.add(systemId); - } - - public boolean isIncludedDocument(String systemId) { - return includedDocuments.contains(systemId); - } - - public void addIncludedEntity(Entity entity) { - includedEntities.add(entity); - } - - public void addImportedDocument(String systemId) { - importedDocuments.add(systemId); - } - - public boolean isImportedDocument(String systemId) { - return importedDocuments.contains(systemId); - } - - public void addImportedEntity(Entity entity) { - importedEntities.add(entity); - } - - public void withAllSubEntitiesDo(EntityAction action) { - if (getRoot() != null) { - action.perform(getRoot()); - } - - for (Iterator iter = importedEntities.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - - for (Iterator iter = includedEntities.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); - } - } - - public Map getMap(Kind k) { - Map m = (Map) kinds.get(k.getName()); - if (m == null) { - m = new HashMap(); - kinds.put(k.getName(), m); - } - return m; - } - - public void define(GloballyKnown e) { - Map map = getMap(e.getKind()); - if (e.getName() == null) - return; - QName name = - new QName(e.getDefining().getTargetNamespaceURI(), e.getName()); - - if (map.containsKey(name)){ - errReceiver.error(e.getLocator(), WsdlMessages.ENTITY_DUPLICATE_WITH_TYPE(e.getElementName().getLocalPart(), e.getName())); - throw new AbortException(); - }else{ - map.put(name, e); - } - } - - public GloballyKnown find(Kind k, QName name) { - Map map = getMap(k); - Object result = map.get(name); - if (result == null){ - errReceiver.error(null, WsdlMessages.ENTITY_NOT_FOUND_BY_Q_NAME(k.getName(), name, _systemId)); - throw new AbortException(); - } - return (GloballyKnown) result; - } - - public void validateLocally() { - LocallyValidatingAction action = new LocallyValidatingAction(); - withAllSubEntitiesDo(action); - if (action.getException() != null) { - throw action.getException(); - } - } - - public abstract void validate(EntityReferenceValidator validator); - - protected abstract Entity getRoot(); - - private final Map kinds; - private String _systemId; - private final Set importedDocuments; - private final List importedEntities; - private final Set includedDocuments; - private final List includedEntities; - - private class LocallyValidatingAction implements EntityAction { - public LocallyValidatingAction() { - } - - public void perform(Entity entity) { - try { - entity.validateThis(); - entity.withAllSubEntitiesDo(this); - } catch (ValidationException e) { - if (_exception == null) { - _exception = e; - } - } - } - - public ValidationException getException() { - return _exception; - } - - private ValidationException _exception; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Defining.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Defining.java deleted file mode 100644 index 11a9b9f6f03..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Defining.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * An interface implemented by entities that define target namespaces. - * - * @author WS Development Team - */ -public interface Defining extends Elemental { - public String getTargetNamespaceURI(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/DuplicateEntityException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/DuplicateEntityException.java deleted file mode 100644 index e9516a71cbf..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/DuplicateEntityException.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * An exception signalling that an entity with the given name/id has already been defined. - * - * @author WS Development Team - */ -public class DuplicateEntityException extends ValidationException { - - public DuplicateEntityException(GloballyKnown entity) { - super( - "entity.duplicateWithType", - entity.getElementName().getLocalPart(), - entity.getName()); - } - - public DuplicateEntityException(Identifiable entity) { - super( - "entity.duplicateWithType", - entity.getElementName().getLocalPart(), - entity.getID()); - } - - public DuplicateEntityException(Entity entity, String name) { - super( - "entity.duplicateWithType", - entity.getElementName().getLocalPart(), name); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.wsdl"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Elemental.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Elemental.java deleted file mode 100644 index 8dfe14c0413..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Elemental.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; - -/** - * Interface implemented by classes that are mappable to XML elements. - * - * @author WS Development Team - */ -public interface Elemental { - public QName getElementName(); - public Locator getLocator(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Entity.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Entity.java deleted file mode 100644 index dd3752a154c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Entity.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import org.xml.sax.Locator; - -import java.util.HashMap; -import java.util.Map; - -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; - -/** - * An entity, typically corresponding to an XML element. - * - * @author WS Development Team - */ -public abstract class Entity implements Elemental { - - private final Locator locator; - protected ErrorReceiver errorReceiver; - public Entity(Locator locator) { - this.locator = locator; - } - - public void setErrorReceiver(ErrorReceiver errorReceiver) { - this.errorReceiver = errorReceiver; - } - - public Locator getLocator() { - return locator; - } - - public Object getProperty(String key) { - if (_properties == null) - return null; - return _properties.get(key); - } - - public void setProperty(String key, Object value) { - if (value == null) { - removeProperty(key); - return; - } - - if (_properties == null) { - _properties = new HashMap(); - } - _properties.put(key, value); - } - - public void removeProperty(String key) { - if (_properties != null) { - _properties.remove(key); - } - } - - public void withAllSubEntitiesDo(EntityAction action) { - // no-op by default - } - - public void withAllQNamesDo(QNameAction action) { - action.perform(getElementName()); - } - - public void withAllEntityReferencesDo(EntityReferenceAction action) { - // no-op by default - } - - public abstract void validateThis(); - - protected void failValidation(String key) { - throw new ValidationException(key, getElementName().getLocalPart()); - } - - protected void failValidation(String key, String arg) { - throw new ValidationException( - key, - new Object[] { arg, getElementName().getLocalPart()}); - } - - private Map _properties; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityAction.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityAction.java deleted file mode 100644 index f81991d6da5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityAction.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * An action operating on an entity. - * - * @author WS Development Team - */ -public interface EntityAction { - public void perform(Entity entity); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityReferenceAction.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityReferenceAction.java deleted file mode 100644 index 43d5bd6c7b3..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityReferenceAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import javax.xml.namespace.QName; - -/** - * An action operating on an entity reference composed of a kind and a QName. - * - * @author WS Development Team - */ -public interface EntityReferenceAction { - public void perform(Kind kind, QName name); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityReferenceValidator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityReferenceValidator.java deleted file mode 100644 index cf1fbceeb99..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/EntityReferenceValidator.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import javax.xml.namespace.QName; - -/** - * An interface implemented by a class that is capable of validating - * a QName/Kind pair referring to an external entity. - * - * @author WS Development Team - */ -public interface EntityReferenceValidator { - public boolean isValid(Kind kind, QName name); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensibilityHelper.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensibilityHelper.java deleted file mode 100644 index 98c481df440..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensibilityHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A helper class for extensible entities. - * - * @author WS Development Team - */ -public class ExtensibilityHelper { - - public ExtensibilityHelper() { - } - - public void addExtension(TWSDLExtension e) { - if (_extensions == null) { - _extensions = new ArrayList(); - } - _extensions.add(e); - } - - public Iterable extensions() { - if (_extensions == null) { - return new ArrayList(); - } else { - return _extensions; - } - } - - public void withAllSubEntitiesDo(EntityAction action) { -// if (_extensions != null) { -// for (Iterator iter = _extensions.iterator(); iter.hasNext();) { -// action.perform((Entity) iter.next()); -// } -// } - } - - public void accept(ExtensionVisitor visitor) throws Exception { - if (_extensions != null) { - for (Iterator iter = _extensions.iterator(); iter.hasNext();) { - ((ExtensionImpl) iter.next()).accept(visitor); - } - } - } - - private List _extensions; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionImpl.java deleted file mode 100644 index 68447c700c4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import org.xml.sax.Locator; - -/** - * An entity extending another entity. - * - * @author WS Development Team - */ -public abstract class ExtensionImpl extends Entity implements TWSDLExtension { - - public ExtensionImpl(Locator locator) { - super(locator); - } - - public TWSDLExtensible getParent() { - return _parent; - } - - public void setParent(TWSDLExtensible parent) { - _parent = parent; - } - - public void accept(ExtensionVisitor visitor) throws Exception { - visitor.preVisit(this); - visitor.postVisit(this); - } - - private TWSDLExtensible _parent; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionVisitor.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionVisitor.java deleted file mode 100644 index 1663cc5b655..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionVisitor.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; - -/** - * A visitor working on extension entities. - * - * @author WS Development Team - */ -public interface ExtensionVisitor { - public void preVisit(TWSDLExtension extension) throws Exception; - public void postVisit(TWSDLExtension extension) throws Exception; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionVisitorBase.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionVisitorBase.java deleted file mode 100644 index 6a2f2109e5a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExtensionVisitorBase.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; - -/** - * A base class for extension visitors. - * - * @author WS Development Team - */ -public class ExtensionVisitorBase implements ExtensionVisitor { - public ExtensionVisitorBase() { - } - - public void preVisit(TWSDLExtension extension) throws Exception { - } - public void postVisit(TWSDLExtension extension) throws Exception { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExternalEntityReference.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExternalEntityReference.java deleted file mode 100644 index a77e3715af4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ExternalEntityReference.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import javax.xml.namespace.QName; - -/** - * A reference to a globally known entity in a document. - * - * @author WS Development Team - */ -public class ExternalEntityReference { - - public ExternalEntityReference( - AbstractDocument document, - Kind kind, - QName name) { - _document = document; - _kind = kind; - _name = name; - } - - public AbstractDocument getDocument() { - return _document; - } - - public Kind getKind() { - return _kind; - } - - public QName getName() { - return _name; - } - - public GloballyKnown resolve() { - return _document.find(_kind, _name); - } - - private AbstractDocument _document; - private Kind _kind; - private QName _name; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/GlobalEntity.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/GlobalEntity.java deleted file mode 100644 index 952c3a78445..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/GlobalEntity.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import org.xml.sax.Locator; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; - -/** - * An entity that can be defined in a target namespace. - * - * @author WS Development Team - */ -public abstract class GlobalEntity extends Entity implements GloballyKnown { - - public GlobalEntity(Defining defining, Locator locator, ErrorReceiver errorReceiver) { - super(locator); - _defining = defining; - this.errorReceiver = errorReceiver; - } - - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - public abstract Kind getKind(); - - public Defining getDefining() { - return _defining; - } - - private Defining _defining; - private String _name; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/GloballyKnown.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/GloballyKnown.java deleted file mode 100644 index 925d5fd6f3a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/GloballyKnown.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * An interface implemented by entities which can be defined in a target namespace. - * - * @author WS Development Team - */ -public interface GloballyKnown extends Elemental { - public String getName(); - public Kind getKind(); - public Defining getDefining(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Identifiable.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Identifiable.java deleted file mode 100644 index b46f3682ea6..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Identifiable.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * An interface implemented by entities which have an ID. - * - * @author WS Development Team - */ -public interface Identifiable extends Elemental { - public String getID(); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Kind.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Kind.java deleted file mode 100644 index 501b04c0423..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/Kind.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * A kind of entity. - * - * @author WS Development Team - */ -public final class Kind { - - public Kind(String s) { - _name = s; - } - - public String getName() { - return _name; - } - - private String _name; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/NoSuchEntityException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/NoSuchEntityException.java deleted file mode 100644 index 6ef81fa6fd4..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/NoSuchEntityException.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import javax.xml.namespace.QName; - -/** - * An exception signalling that an entity with the given name/id does not exist. - * - * @author WS Development Team - */ -public class NoSuchEntityException extends ValidationException { - - public NoSuchEntityException(QName name) { - super( - "entity.notFoundByQName", - name.getLocalPart(), name.getNamespaceURI()); - } - - public NoSuchEntityException(String id) { - super("entity.notFoundByID", id); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.wsdl"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ParseException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ParseException.java deleted file mode 100644 index 2aefe27c950..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ParseException.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.xml.internal.ws.util.exception.JAXWSExceptionBase; -import com.sun.xml.internal.ws.util.localization.Localizable; - -/** - * An exception signalling a parsing error. - * - * @author WS Development Team - */ -public class ParseException extends JAXWSExceptionBase { - - public ParseException(String key, Object... args) { - super(key, args); - } - - public ParseException(Localizable message){ - super("localized.error", message); - } - - public ParseException(Throwable throwable) { - super(throwable); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.wsdl"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ParserListener.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ParserListener.java deleted file mode 100644 index 87a1148801f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ParserListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import javax.xml.namespace.QName; - -/** - * A listener for parsing-related events. - * - * @author WS Development Team - */ -public interface ParserListener { - public void ignoringExtension(Entity entity, QName name, QName parent); - public void doneParsingEntity(QName element, Entity entity); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/QNameAction.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/QNameAction.java deleted file mode 100644 index 988cdab3f5a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/QNameAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import javax.xml.namespace.QName; - -/** - * An action operating on a QName. - * - * @author WS Development Team - */ -public interface QNameAction { - public void perform(QName name); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/TWSDLParserContextImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/TWSDLParserContextImpl.java deleted file mode 100644 index 87bbfeeb5d6..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/TWSDLParserContextImpl.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.wsdl.parser.DOMForest; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.xml.internal.ws.util.NamespaceSupport; -import com.sun.xml.internal.ws.util.xml.XmlUtil; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * The context used by parser classes. - * - * @author WS Development Team - */ -public class TWSDLParserContextImpl implements TWSDLParserContext { - - private final static String PREFIX_XMLNS = "xmlns"; - private boolean _followImports; - private final AbstractDocument _document; - private final NamespaceSupport _nsSupport; - private final ArrayList _listeners; - private final WSDLLocation _wsdlLocation; - private final DOMForest forest; - private final ErrorReceiver errorReceiver; - - public TWSDLParserContextImpl(DOMForest forest, AbstractDocument doc, ArrayList listeners, ErrorReceiver errReceiver) { - this._document = doc; - this._listeners = listeners; - this._nsSupport = new NamespaceSupport(); - this._wsdlLocation = new WSDLLocation(); - this.forest = forest; - this.errorReceiver = errReceiver; - } - - public AbstractDocument getDocument() { - return _document; - } - - public boolean getFollowImports() { - return _followImports; - } - - public void setFollowImports(boolean b) { - _followImports = b; - } - - public void push() { - _nsSupport.pushContext(); - } - - public void pop() { - _nsSupport.popContext(); - } - - public String getNamespaceURI(String prefix) { - return _nsSupport.getURI(prefix); - } - - public Iterable getPrefixes() { - return _nsSupport.getPrefixes(); - } - - public String getDefaultNamespaceURI() { - return getNamespaceURI(""); - } - - public void registerNamespaces(Element e) { - for (Iterator iter = XmlUtil.getAllAttributes(e); iter.hasNext();) { - Attr a = (Attr) iter.next(); - if (a.getName().equals(PREFIX_XMLNS)) { - // default namespace declaration - _nsSupport.declarePrefix("", a.getValue()); - } else { - String prefix = XmlUtil.getPrefix(a.getName()); - if (prefix != null && prefix.equals(PREFIX_XMLNS)) { - String nsPrefix = XmlUtil.getLocalPart(a.getName()); - String uri = a.getValue(); - _nsSupport.declarePrefix(nsPrefix, uri); - } - } - } - } - - public Locator getLocation(Element e) { - return forest.locatorTable.getStartLocation(e); - } - - public QName translateQualifiedName(Locator locator, String s) { - if (s == null) - return null; - - String prefix = XmlUtil.getPrefix(s); - String uri = null; - - if (prefix == null) { - uri = getDefaultNamespaceURI(); - } else { - uri = getNamespaceURI(prefix); - if (uri == null) { - errorReceiver.error(locator, WsdlMessages.PARSING_UNKNOWN_NAMESPACE_PREFIX(prefix)); - } - } - - return new QName(uri, XmlUtil.getLocalPart(s)); - } - - public void fireIgnoringExtension(Element e, Entity entity) { - QName name = new QName(e.getNamespaceURI(), e.getLocalName()); - QName parent = entity.getElementName(); - List _targets = null; - - synchronized (this) { - if (_listeners != null) { - _targets = (List) _listeners.clone(); - } - } - - if (_targets != null) { - for (Iterator iter = _targets.iterator(); iter.hasNext();) { - ParserListener l = (ParserListener) iter.next(); - l.ignoringExtension(entity, name, parent); - } - } - } - - public void fireDoneParsingEntity(QName element, Entity entity) { - List _targets = null; - - synchronized (this) { - if (_listeners != null) { - _targets = (List) _listeners.clone(); - } - } - - if (_targets != null) { - for (Iterator iter = _targets.iterator(); iter.hasNext();) { - ParserListener l = (ParserListener) iter.next(); - l.doneParsingEntity(element, entity); - } - } - } - - //bug fix: 4856674, WSDLLocation context maintainence - //and utility funcitons - public void pushWSDLLocation() { - _wsdlLocation.push(); - } - - public void popWSDLLocation() { - _wsdlLocation.pop(); - } - - public void setWSDLLocation(String loc) { - _wsdlLocation.setLocation(loc); - } - - public String getWSDLLocation() { - return _wsdlLocation.getLocation(); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ValidationException.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ValidationException.java deleted file mode 100644 index d4cd8fbad9f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/ValidationException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.framework; - -import com.sun.xml.internal.ws.util.exception.JAXWSExceptionBase; - -/** - * An exception signalling that validation of an entity failed. - * - * @author WS Development Team - */ -public class ValidationException extends JAXWSExceptionBase { - - public ValidationException(String key, Object... args) { - super(key, args); - } - - public ValidationException(Throwable throwable) { - super(throwable); - } - - public String getDefaultResourceBundleName() { - return "com.sun.tools.internal.ws.resources.wsdl"; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/WSDLLocation.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/WSDLLocation.java deleted file mode 100644 index 800a2a4b3f5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/framework/WSDLLocation.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.framework; - -/** - * - * Maintains wsdl:location context. This is used with - * TWSDLParserContextImpl, where one each WSDL being imported its location is pushed. - * - * @author WS Development Team - */ -public class WSDLLocation { - WSDLLocation() { - reset(); - } - - public void push() { - int max = contexts.length; - idPos++; - if (idPos >= max) { - LocationContext newContexts[] = new LocationContext[max * 2]; - System.arraycopy(contexts, 0, newContexts, 0, max); - max *= 2; - contexts = newContexts; - } - currentContext = contexts[idPos]; - if (currentContext == null) { - contexts[idPos] = currentContext = new LocationContext(); - } - if (idPos > 0) { - currentContext.setParent(contexts[idPos - 1]); - } - - } - - public void pop() { - idPos--; - if (idPos >= 0) { - currentContext = contexts[idPos]; - } - } - - public void reset() { - contexts = new LocationContext[32]; - idPos = 0; - contexts[idPos] = currentContext = new LocationContext(); - } - - public String getLocation() { - return currentContext.getLocation(); - } - - public void setLocation(String loc) { - currentContext.setLocation(loc); - } - - private LocationContext[] contexts; - private int idPos; - private LocationContext currentContext; - - // LocationContext - inner class - private static class LocationContext { - void setLocation(String loc) { - location = loc; - } - - String getLocation() { - return location; - } - - void setParent(LocationContext parent) { - parentLocation = parent; - } - - private String location; - private LocationContext parentLocation; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/AbstractExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/AbstractExtensionHandler.java deleted file mode 100644 index e7956d42a76..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/AbstractExtensionHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensionHandler; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.wsdl.document.mime.MIMEConstants; -import org.w3c.dom.Element; - -import java.util.Collections; -import java.util.Map; - -/** - * An abstract implementation class of {@link TWSDLExtensionHandler} - * - * @author Vivek Pandey - */ -public abstract class AbstractExtensionHandler extends TWSDLExtensionHandler { - private final Map extensionHandlers; - private final Map unmodExtenHandlers; - - public AbstractExtensionHandler(Map extensionHandlerMap) { - this.extensionHandlers = extensionHandlerMap; - this.unmodExtenHandlers = Collections.unmodifiableMap(extensionHandlers); - } - - public Map getExtensionHandlers(){ - return unmodExtenHandlers; - } - - /** - * Callback that gets called by the WSDL parser or any other extension handler on finding an extensibility element - * that it can't understand. - * - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - public boolean doHandleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if (parent.getWSDLElementName().equals(MIMEConstants.QNAME_PART)) { - return handleMIMEPartExtension(context, parent, e); - } else { - return super.doHandleExtension(context, parent, e); - } - } - - /** - * Callback for wsdl:mime - * - * @param context Parser context that will be passed on by the wsdl parser - * @param parent The Parent element within which the extensibility element is defined - * @param e The extensibility elemenet - * @return false if there was some error during the extension handling otherwise returns true. If returned false - * then the WSDL parser can abort if the wsdl extensibility element had required attribute set to true - */ - protected boolean handleMIMEPartExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e){ - return false; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/AbstractReferenceFinderImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/AbstractReferenceFinderImpl.java deleted file mode 100644 index 46108332cf8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/AbstractReferenceFinderImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.istack.internal.SAXParseException2; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import org.xml.sax.Attributes; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.XMLFilterImpl; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * XMLFilter that finds references to other schema files from - * SAX events. - * - * This implementation is a base implementation for typical case - * where we just need to look for a particular attribute which - * contains an URL to another schema file. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * Vivek Pandey - */ -public abstract class AbstractReferenceFinderImpl extends XMLFilterImpl { - protected final DOMForest parent; - - protected AbstractReferenceFinderImpl( DOMForest _parent ) { - this.parent = _parent; - } - - /** - * IF the given element contains a reference to an external resource, - * return its URL. - * - * @param nsURI - * Namespace URI of the current element - * @param localName - * Local name of the current element - * @return - * It's OK to return a relative URL. - */ - protected abstract String findExternalResource( String nsURI, String localName, Attributes atts); - - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) - throws SAXException { - super.startElement(namespaceURI, localName, qName, atts); - - String relativeRef = findExternalResource(namespaceURI,localName,atts); - if(relativeRef==null) return; // non found - - try { - // absolutize URL. - String ref = new URI(locator.getSystemId()).resolve(new URI(relativeRef)).toString(); - - // then parse this schema as well, - // but don't mark this document as a root. - parent.parse(ref,false); - } catch( URISyntaxException e ) { - SAXParseException spe = new SAXParseException2( - WsdlMessages.ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(relativeRef,e.getMessage()), - locator, e ); - - fatalError(spe); - throw spe; - } catch( IOException e ) { - SAXParseException spe = new SAXParseException2( - WsdlMessages.ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(relativeRef,e.getMessage()), - locator, e ); - - fatalError(spe); - throw spe; - } - } - - private Locator locator; - - public void setDocumentLocator(Locator locator) { - super.setDocumentLocator(locator); - this.locator = locator; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Constants.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Constants.java deleted file mode 100644 index 8cc8c5832a5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Constants.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -/** - * An interface defining constants needed to read and write WSDL documents. - * - * @author WS Development Team - */ -public interface Constants { - // WSDL element tags - public static String TAG_BINDING = "binding"; - public static String TAG_DEFINITIONS = "definitions"; - public static String TAG_DOCUMENTATION = "documentation"; - public static String TAG_MESSAGE = "message"; - public static String TAG_PART = "part"; - public static String TAG_PORT_TYPE = "portType"; - public static String TAG_TYPES = "types"; - public static String TAG_OPERATION = "operation"; - public static String TAG_INPUT = "input"; - public static String TAG_OUTPUT = "output"; - public static String TAG_FAULT = "fault"; - public static String TAG_SERVICE = "service"; - public static String TAG_PORT = "port"; - public static String TAG_ = ""; - - // WSDL attribute names - public static String ATTR_ELEMENT = "element"; - public static String ATTR_NAME = "name"; - public static String ATTR_REQUIRED = "required"; - public static String ATTR_TARGET_NAMESPACE = "targetNamespace"; - public static String ATTR_TYPE = "type"; - public static String ATTR_MESSAGE = "message"; - public static String ATTR_BINDING = "binding"; - public static String ATTR_LOCATION = "location"; - public static String ATTR_TRANSPORT = "transport"; - public static String ATTR_STYLE = "style"; - public static String ATTR_USE = "use"; - public static String ATTR_NAMESPACE = "namespace"; - public static String ATTR_ENCODING_STYLE = "encodingStyle"; - public static String ATTR_PART = "part"; - public static String ATTR_PARTS = "parts"; - public static String ATTR_SOAP_ACTION = "soapAction"; - public static String ATTR_PARAMETER_ORDER = "parameterOrder"; - public static String ATTR_VERB = "verb"; - - // schema attribute names - public static String ATTR_ID = "id"; - public static String ATTR_VERSION = "version"; - public static String ATTR_ATTRIBUTE_FORM_DEFAULT = "attributeFormDefault"; - public static String ATTR_BLOCK_DEFAULT = "blockDefault"; - public static String ATTR_ELEMENT_FORM_DEFAULT = "elementFormDefault"; - public static String ATTR_FINAL_DEFAULT = "finalDefault"; - public static String ATTR_ABSTRACT = "abstract"; - public static String ATTR_NILLABLE = "nillable"; - public static String ATTR_DEFAULT = "default"; - public static String ATTR_FIXED = "fixed"; - public static String ATTR_FORM = "form"; - public static String ATTR_BLOCK = "block"; - public static String ATTR_FINAL = "final"; - public static String ATTR_REF = "ref"; - public static String ATTR_SUBSTITUTION_GROUP = "substitutionGroup"; - public static String ATTR_MIN_OCCURS = "minOccurs"; - public static String ATTR_MAX_OCCURS = "maxOccurs"; - public static String ATTR_PROCESS_CONTENTS = "processContents"; - public static String ATTR_MIXED = "mixed"; - public static String ATTR_BASE = "base"; - public static String ATTR_VALUE = "value"; - public static String ATTR_XPATH = "xpath"; - public static String ATTR_SCHEMA_LOCATION = "schemaLocation"; - public static String ATTR_REFER = "refer"; - public static String ATTR_ITEM_TYPE = "itemType"; - public static String ATTR_PUBLIC = "public"; - public static String ATTR_SYSTEM = "system"; - public static String ATTR_MEMBER_TYPES = "memberTypes"; - public static String ATTR_ = ""; - - // WSDL attribute values - public static String ATTRVALUE_RPC = "rpc"; - public static String ATTRVALUE_DOCUMENT = "document"; - public static String ATTRVALUE_LITERAL = "literal"; - public static String ATTRVALUE_ENCODED = "encoded"; - - // schema attribute values - public static String ATTRVALUE_QUALIFIED = "qualified"; - public static String ATTRVALUE_UNQUALIFIED = "unqualified"; - public static String ATTRVALUE_ALL = "#all"; - public static String ATTRVALUE_SUBSTITUTION = "substitution"; - public static String ATTRVALUE_EXTENSION = "extension"; - public static String ATTRVALUE_RESTRICTION = "restriction"; - public static String ATTRVALUE_LIST = "list"; - public static String ATTRVALUE_UNION = "union"; - public static String ATTRVALUE_UNBOUNDED = "unbounded"; - public static String ATTRVALUE_PROHIBITED = "prohibited"; - public static String ATTRVALUE_OPTIONAL = "optional"; - public static String ATTRVALUE_REQUIRED = "required"; - public static String ATTRVALUE_LAX = "lax"; - public static String ATTRVALUE_SKIP = "skip"; - public static String ATTRVALUE_STRICT = "strict"; - public static String ATTRVALUE_ANY = "##any"; - public static String ATTRVALUE_LOCAL = "##local"; - public static String ATTRVALUE_OTHER = "##other"; - public static String ATTRVALUE_TARGET_NAMESPACE = "##targetNamespace"; - public static String ATTRVALUE_ = ""; - - // namespace URIs - public static String NS_XML = "http://www.w3.org/XML/1998/namespace"; - public static String NS_XMLNS = "http://www.w3.org/2000/xmlns/"; - public static String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/"; - public static String NS_WSDL_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/"; - public static String NS_WSDL_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/"; - public static String NS_WSDL_HTTP = "http://schemas.xmlsoap.org/wsdl/http/"; - public static String NS_WSDL_MIME = "http://schemas.xmlsoap.org/wsdl/mime/"; - public static String NS_XSD = "http://www.w3.org/2001/XMLSchema"; - public static String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"; - public static String NS_ = ""; - - // other constants - public static String XMLNS = "xmlns"; - public static String TRUE = "true"; - public static String FALSE = "false"; -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMBuilder.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMBuilder.java deleted file mode 100644 index 0cb4188bfb0..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMBuilder.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable; -import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.Attributes; -import org.xml.sax.Locator; - -import java.util.Set; - -/** - * Builds DOM while keeping the location information. - * - *

    - * This class also looks for outer most <jaxws:bindings> - * customizations. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * Vivek Pandey - */ -class DOMBuilder extends SAX2DOMEx { - /** - * Grows a DOM tree under the given document, and - * stores location information to the given table. - * - * @param outerMostBindings - * This set will receive newly found outermost - * jaxb:bindings customizations. - */ - public DOMBuilder( Document dom, LocatorTable ltable, Set outerMostBindings ) { - super( dom ); - this.locatorTable = ltable; - this.outerMostBindings = outerMostBindings; - } - - /** Location information will be stored into this object. */ - private final LocatorTable locatorTable; - - private final Set outerMostBindings; - - private Locator locator; - - public void setDocumentLocator(Locator locator) { - this.locator = locator; - super.setDocumentLocator(locator); - } - - - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { - super.startElement(namespaceURI, localName, qName, atts); - - Element e = getCurrentElement(); - locatorTable.storeStartLocation( e, locator ); - - // check if this element is an outer-most - if( JAXWSBindingsConstants.JAXWS_BINDINGS.getNamespaceURI().equals(e.getNamespaceURI()) - && "bindings".equals(e.getLocalName()) ) { - - // if this is the root node (meaning that this file is an - // external binding file) or if the parent is XML Schema element - // (meaning that this is an "inlined" external binding) - Node p = e.getParentNode(); - if( p instanceof Document) { - outerMostBindings.add(e); // remember this value - } - } - } - - public void endElement(String namespaceURI, String localName, String qName) { - locatorTable.storeEndLocation( getCurrentElement(), locator ); - super.endElement(namespaceURI, localName, qName); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java deleted file mode 100644 index 9a3a1ffd7e5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.istack.internal.NotNull; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.ws.wscompile.AbortException; -import com.sun.tools.internal.ws.wscompile.DefaultAuthenticator; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; -import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable; -import com.sun.xml.internal.bind.marshaller.DataWriter; -import com.sun.xml.internal.ws.util.JAXWSUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.ContentHandler; -import org.xml.sax.*; -import org.xml.sax.helpers.XMLFilterImpl; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXResult; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLSession; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.net.*; -import java.util.*; - -/** - * @author Vivek Pandey - */ -public class DOMForest { - /** - * To correctly feed documents to a schema parser, we need to remember - * which documents (of the forest) were given as the root - * documents, and which of them are read as included/imported - * documents. - *

    - *

    - * Set of system ids as strings. - */ - protected final Set rootDocuments = new HashSet(); - - /** - * Contains wsdl:import(s) - */ - protected final Set externalReferences = new HashSet(); - - /** - * actual data storage map<SystemId,Document>. - */ - protected final Map core = new HashMap(); - protected final WsimportOptions options; - protected final ErrorReceiver errorReceiver; - - private final DocumentBuilder documentBuilder; - private final SAXParserFactory parserFactory; - - /** - * inlined schema elements inside wsdl:type section - */ - protected final List inlinedSchemaElements = new ArrayList(); - - - /** - * Stores location information for all the trees in this forest. - */ - public final LocatorTable locatorTable = new LocatorTable(); - - /** - * Stores all the outer-most <jaxb:bindings> customizations. - */ - public final Set outerMostBindings = new HashSet(); - - /** - * Schema language dependent part of the processing. - */ - protected final InternalizationLogic logic; - - public DOMForest(InternalizationLogic logic, WsimportOptions options, ErrorReceiver errReceiver) { - this.options = options; - this.errorReceiver = errReceiver; - this.logic = logic; - try { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - this.documentBuilder = dbf.newDocumentBuilder(); - - this.parserFactory = SAXParserFactory.newInstance(); - this.parserFactory.setNamespaceAware(true); - } catch (ParserConfigurationException e) { - throw new AssertionError(e); - } - } - - public List getInlinedSchemaElement() { - return inlinedSchemaElements; - } - - public @NotNull Document parse(InputSource source, boolean root) throws SAXException, IOException { - if (source.getSystemId() == null) - throw new IllegalArgumentException(); - return parse(source.getSystemId(), source, root); - } - - /** - * Parses an XML at the given location ( - * and XMLs referenced by it) into DOM trees - * and stores them to this forest. - * - * @return the parsed DOM document object. - */ - public Document parse(String systemId, boolean root) throws SAXException, IOException{ - - systemId = normalizeSystemId(systemId); - - InputSource is = null; - - // allow entity resolver to find the actual byte stream. - if (options.entityResolver != null) - is = options.entityResolver.resolveEntity(null, systemId); - if (is == null) - is = new InputSource(systemId); - else - systemId=is.getSystemId(); - - if (core.containsKey(systemId)) { - // this document has already been parsed. Just ignore. - return core.get(systemId); - } - - if(!root) - addExternalReferences(systemId); - - // but we still use the original system Id as the key. - return parse(systemId, is, root); - } - - /** - * Parses the given document and add it to the DOM forest. - * - * @return null if there was a parse error. otherwise non-null. - */ - public @NotNull Document parse(String systemId, InputSource inputSource, boolean root) throws SAXException, IOException{ - Document dom = documentBuilder.newDocument(); - - systemId = normalizeSystemId(systemId); - - // put into the map before growing a tree, to - // prevent recursive reference from causing infinite loop. - core.put(systemId, dom); - - dom.setDocumentURI(systemId); - if (root) - rootDocuments.add(systemId); - - try { - XMLReader reader = parserFactory.newSAXParser().getXMLReader(); - reader.setContentHandler(getParserHandler(dom)); - if (errorReceiver != null) - reader.setErrorHandler(errorReceiver); - if (options.entityResolver != null) - reader.setEntityResolver(options.entityResolver); - - InputStream is = null; - if(inputSource.getByteStream() != null){ - is = inputSource.getByteStream(); - } - if(is == null){ - int redirects=0; - boolean redirect; - URL url = JAXWSUtils.getFileOrURL(inputSource.getSystemId()); - URLConnection conn = url.openConnection(); - if (conn instanceof HttpsURLConnection) { - if (options.disableSSLHostnameVerification) { - ((HttpsURLConnection) conn).setHostnameVerifier(new HttpClientVerifier()); - } - } - - do { - redirect = false; - try { - is = conn.getInputStream(); - //is = sun.net.www.protocol.http.HttpURLConnection.openConnectionCheckRedirects(conn); - } catch (IOException e) { - if (conn instanceof HttpURLConnection) { - HttpURLConnection httpConn = ((HttpURLConnection) conn); - int code = httpConn.getResponseCode(); - if (code == 401) { - errorReceiver.error(new SAXParseException(WscompileMessages.WSIMPORT_AUTH_INFO_NEEDED(e.getMessage(), systemId, DefaultAuthenticator.defaultAuthfile), null, e)); - throw new AbortException(); - } - //FOR other code we will retry with MEX - } - throw e; - } - - //handle 302 or 303, JDK does not seem to handle 302 very well. - //Need to redesign this a bit as we need to throw better error message for IOException in this case - if (conn instanceof HttpURLConnection) { - HttpURLConnection httpConn = ((HttpURLConnection) conn); - int code = httpConn.getResponseCode(); - if (code == 302 || code == 303) { - //retry with the value in Location header - List seeOther = httpConn.getHeaderFields().get("Location"); - if (seeOther != null && seeOther.size() > 0) { - URL newurl = new URL(url, seeOther.get(0)); - if (!newurl.equals(url)){ - errorReceiver.info(new SAXParseException(WscompileMessages.WSIMPORT_HTTP_REDIRECT(code, seeOther.get(0)), null)); - url = newurl; - httpConn.disconnect(); - if(redirects >= 5){ - errorReceiver.error(new SAXParseException(WscompileMessages.WSIMPORT_MAX_REDIRECT_ATTEMPT(), null)); - throw new AbortException(); - } - conn = url.openConnection(); - redirects++; - redirect = true; - } - } - } - } - } while (redirect); - } - inputSource.setByteStream(is); - reader.parse(inputSource); - Element doc = dom.getDocumentElement(); - if (doc == null) { - return null; - } - NodeList schemas = doc.getElementsByTagNameNS(SchemaConstants.NS_XSD, "schema"); - for (int i = 0; i < schemas.getLength(); i++) { - inlinedSchemaElements.add((Element) schemas.item(i)); - } - } catch (ParserConfigurationException e) { - errorReceiver.error(e); - throw new SAXException(e.getMessage()); - } - - return dom; - } - - public void addExternalReferences(String ref) { - if (!externalReferences.contains(ref)) - externalReferences.add(ref); - } - - - public Set getExternalReferences() { - return externalReferences; - } - - // overide default SSL HttpClientVerifier to always return true - // effectively overiding Hostname client verification when using SSL - private static class HttpClientVerifier implements HostnameVerifier { - public boolean verify(String s, SSLSession sslSession) { - return true; - } - } - - public interface Handler extends ContentHandler { - /** - * Gets the DOM that was built. - */ - public Document getDocument(); - } - - private static abstract class HandlerImpl extends XMLFilterImpl implements Handler { - } - - /** - * Returns a {@link ContentHandler} to feed SAX events into. - *

    - * The client of this class can feed SAX events into the handler - * to parse a document into this DOM forest. - */ - public Handler getParserHandler(String systemId, boolean root) { - final Document dom = documentBuilder.newDocument(); - core.put(systemId, dom); - if (root) - rootDocuments.add(systemId); - - ContentHandler handler = getParserHandler(dom); - - // we will register the DOM to the map once the system ID becomes available. - // but the SAX allows the event source to not to provide that information, - // so be prepared for such case. - HandlerImpl x = new HandlerImpl() { - public Document getDocument() { - return dom; - } - }; - x.setContentHandler(handler); - - return x; - } - - /** - * Returns a {@link org.xml.sax.ContentHandler} to feed SAX events into. - *

    - *

    - * The client of this class can feed SAX events into the handler - * to parse a document into this DOM forest. - *

    - * This version requires that the DOM object to be created and registered - * to the map beforehand. - */ - private ContentHandler getParserHandler(Document dom) { - ContentHandler handler = new DOMBuilder(dom, locatorTable, outerMostBindings); - handler = new WhitespaceStripper(handler, errorReceiver, options.entityResolver); - handler = new VersionChecker(handler, errorReceiver, options.entityResolver); - - // insert the reference finder so that - // included/imported schemas will be also parsed - XMLFilterImpl f = logic.createExternalReferenceFinder(this); - f.setContentHandler(handler); - - if (errorReceiver != null) - f.setErrorHandler(errorReceiver); - if (options.entityResolver != null) - f.setEntityResolver(options.entityResolver); - - return f; - } - - private String normalizeSystemId(String systemId) { - try { - systemId = new URI(systemId).normalize().toString(); - } catch (URISyntaxException e) { - // leave the system ID untouched. In my experience URI is often too strict - } - return systemId; - } - - boolean isExtensionMode() { - return options.isExtensionMode(); - } - - - /** - * Gets the DOM tree associated with the specified system ID, - * or null if none is found. - */ - public Document get(String systemId) { - Document doc = core.get(systemId); - - if (doc == null && systemId.startsWith("file:/") && !systemId.startsWith("file://")) { - // As of JDK1.4, java.net.URL.toExternal method returns URLs like - // "file:/abc/def/ghi" which is an incorrect file protocol URL according to RFC1738. - // Some other correctly functioning parts return the correct URLs ("file:///abc/def/ghi"), - // and this descripancy breaks DOM look up by system ID. - - // this extra check solves this problem. - doc = core.get("file://" + systemId.substring(5)); - } - - if (doc == null && systemId.startsWith("file:")) { - // on Windows, filenames are case insensitive. - // perform case-insensitive search for improved user experience - String systemPath = getPath(systemId); - for (String key : core.keySet()) { - if (key.startsWith("file:") && getPath(key).equalsIgnoreCase(systemPath)) { - doc = core.get(key); - break; - } - } - } - - return doc; - } - - /** - * Strips off the leading 'file:///' portion from an URL. - */ - private String getPath(String key) { - key = key.substring(5); // skip 'file:' - while (key.length() > 0 && key.charAt(0) == '/') - key = key.substring(1); - return key; - } - - /** - * Gets all the system IDs of the documents. - */ - public String[] listSystemIDs() { - return core.keySet().toArray(new String[core.keySet().size()]); - } - - /** - * Gets the system ID from which the given DOM is parsed. - *

    - * Poor-man's base URI. - */ - public String getSystemId(Document dom) { - for (Map.Entry e : core.entrySet()) { - if (e.getValue() == dom) - return e.getKey(); - } - return null; - } - - /** - * Gets the first one (which is more or less random) in {@link #rootDocuments}. - */ - public String getFirstRootDocument() { - if(rootDocuments.isEmpty()) return null; - return rootDocuments.iterator().next(); - } - - public Set getRootDocuments() { - return rootDocuments; - } - - /** - * Dumps the contents of the forest to the specified stream. - *

    - * This is a debug method. As such, error handling is sloppy. - */ - public void dump(OutputStream out) throws IOException { - try { - // create identity transformer - Transformer it = TransformerFactory.newInstance().newTransformer(); - - for (Map.Entry e : core.entrySet()) { - out.write(("---<< " + e.getKey() + '\n').getBytes()); - - DataWriter dw = new DataWriter(new OutputStreamWriter(out), null); - dw.setIndentStep(" "); - it.transform(new DOMSource(e.getValue()), - new SAXResult(dw)); - - out.write("\n\n\n".getBytes()); - } - } catch (TransformerException e) { - e.printStackTrace(); - } - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForestParser.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForestParser.java deleted file mode 100644 index bc589dc1d61..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForestParser.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.parser; - -import org.w3c.dom.Document; -import org.xml.sax.ContentHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import java.io.IOException; - -import com.sun.xml.internal.xsom.parser.XMLParser; - -/** - * {@link XMLParser} implementation that - * parses XML from a DOM forest instead of parsing it from - * its original location. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @author Vivek Pandey - */ -public class DOMForestParser implements XMLParser { - - /** - * DOM forest to be "parsed". - */ - private final DOMForest forest; - - /** - * Scanner object will do the actual SAX events generation. - */ - private final DOMForestScanner scanner; - - private final XMLParser fallbackParser; - - /** - * @param fallbackParser This parser will be used when DOMForestParser needs to parse - * documents that are not in the forest. - */ - public DOMForestParser(DOMForest forest, XMLParser fallbackParser) { - this.forest = forest; - this.scanner = new DOMForestScanner(forest); - this.fallbackParser = fallbackParser; - } - - - public void parse(InputSource source, ContentHandler handler, EntityResolver entityResolver, ErrorHandler errHandler) throws SAXException, IOException { - - } - - public void parse(InputSource source, ContentHandler handler, ErrorHandler errorHandler, EntityResolver entityResolver) - - throws SAXException, IOException { - String systemId = source.getSystemId(); - Document dom = forest.get(systemId); - - if (dom == null) { - // if no DOM tree is built for it, - // let the fall back parser parse the original document. - // - // for example, XSOM parses datatypes.xsd (XML Schema part 2) - // but this will never be built into the forest. - fallbackParser.parse(source, handler, errorHandler, entityResolver); - return; - } - - scanner.scan(dom, handler); - - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForestScanner.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForestScanner.java deleted file mode 100644 index e46945418bd..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/DOMForestScanner.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.xml.internal.bind.unmarshaller.DOMScanner; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.XMLFilterImpl; - -/** - * Produces a complete series of SAX events from any DOM node - * in the DOMForest. - * - *

    - * This class hides a logic of re-associating {@link org.xml.sax.Locator} - * to the generated SAX event stream. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class DOMForestScanner { - - private final DOMForest forest; - - /** - * Scans DOM nodes of the given forest. - * - * DOM node parameters to the scan method must be a part of - * this forest. - */ - public DOMForestScanner( DOMForest _forest ) { - this.forest = _forest; - } - - /** - * Generates the whole set of SAX events by treating - * element e as if it's a root element. - */ - public void scan( Element e, ContentHandler contentHandler ) throws SAXException { - DOMScanner scanner = new DOMScanner(); - - // insert the location resolver into the pipe line - LocationResolver resolver = new LocationResolver(scanner); - resolver.setContentHandler(contentHandler); - - // parse this DOM. - scanner.setContentHandler(resolver); - scanner.scan(e); - } - - /** - * Generates the whole set of SAX events from the given Document - * in the DOMForest. - */ - public void scan( Document d, ContentHandler contentHandler ) throws SAXException { - scan( d.getDocumentElement(), contentHandler ); - } - - /** - * Intercepts the invocation of the setDocumentLocator method - * and passes itself as the locator. - * - * If the client calls one of the methods on the Locator interface, - * use the LocatorTable to resolve the source location. - */ - private class LocationResolver extends XMLFilterImpl implements Locator { - LocationResolver( DOMScanner _parent ) { - this.parent = _parent; - } - - private final DOMScanner parent; - - /** - * Flag that tells us whether we are processing a start element event - * or an end element event. - * - * DOMScanner's getCurrentLocation method doesn't tell us which, but - * this information is necessary to return the correct source line information. - * - * Thus we set this flag appropriately before we pass an event to - * the next ContentHandler, thereby making it possible to figure - * out which location to return. - */ - private boolean inStart = false; - - public void setDocumentLocator(Locator locator) { - // ignore one set by the parent. - - super.setDocumentLocator(this); - } - - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - inStart = false; - super.endElement(namespaceURI, localName, qName); - } - - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) - throws SAXException { - inStart = true; - super.startElement(namespaceURI, localName, qName, atts); - } - - - - - private Locator findLocator() { - Node n = parent.getCurrentLocation(); - if( n instanceof Element ) { - Element e = (Element)n; - if( inStart ) - return forest.locatorTable.getStartLocation( e ); - else - return forest.locatorTable.getEndLocation( e ); - } - return null; - } - - // - // - // Locator methods - // - // - public int getColumnNumber() { - Locator l = findLocator(); - if(l!=null) return l.getColumnNumber(); - return -1; - } - - public int getLineNumber() { - Locator l = findLocator(); - if(l!=null) return l.getLineNumber(); - return -1; - } - - public String getPublicId() { - Locator l = findLocator(); - if(l!=null) return l.getPublicId(); - return null; - } - - public String getSystemId() { - Locator l = findLocator(); - if(l!=null) return l.getSystemId(); - return null; - } - - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/HTTPExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/HTTPExtensionHandler.java deleted file mode 100644 index 2bfa370403f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/HTTPExtensionHandler.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.util.xml.XmlUtil; -import com.sun.tools.internal.ws.wsdl.document.http.*; -import org.w3c.dom.Element; - -import java.util.Map; - -/** - * The HTTP extension handler for WSDL. - * - * @author WS Development Team - */ -public class HTTPExtensionHandler extends AbstractExtensionHandler { - - - public HTTPExtensionHandler(Map extensionHandlerMap) { - super(extensionHandlerMap); - } - - public String getNamespaceURI() { - return Constants.NS_WSDL_HTTP; - } - - public boolean handleDefinitionsExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - - public boolean handleTypesExtension( - com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - - public boolean handleBindingExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) { - context.push(); - context.registerNamespaces(e); - - HTTPBinding binding = new HTTPBinding(context.getLocation(e)); - - String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB); - binding.setVerb(verb); - - parent.addExtension(binding); - context.pop(); -// context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handleOperationExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_OPERATION)) { - context.push(); - context.registerNamespaces(e); - - HTTPOperation operation = new HTTPOperation(context.getLocation(e)); - - String location = - Util.getRequiredAttribute(e, Constants.ATTR_LOCATION); - operation.setLocation(location); - - parent.addExtension(operation); - context.pop(); -// context.fireDoneParsingEntity( -// HTTPConstants.QNAME_OPERATION, -// operation); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handleInputExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_ENCODED)) { - parent.addExtension(new HTTPUrlEncoded(context.getLocation(e))); - return true; - } else if ( - XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_REPLACEMENT)) { - parent.addExtension(new HTTPUrlReplacement(context.getLocation(e))); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handleOutputExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - - public boolean handleFaultExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - - public boolean handleServiceExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - - public boolean handlePortExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) { - context.push(); - context.registerNamespaces(e); - - HTTPAddress address = new HTTPAddress(context.getLocation(e)); - - String location = - Util.getRequiredAttribute(e, Constants.ATTR_LOCATION); - address.setLocation(location); - - parent.addExtension(address); - context.pop(); -// context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/InternalizationLogic.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/InternalizationLogic.java deleted file mode 100644 index db92dc2683f..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/InternalizationLogic.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import org.w3c.dom.Element; -import org.xml.sax.helpers.XMLFilterImpl; - -/** - * Encapsulates schema-language dependent internalization logic. - * - * {@link com.sun.tools.internal.xjc.reader.internalizer.Internalizer} and {@link DOMForest} are responsible for - * doing schema language independent part, and this object is responsible - * for schema language dependent part. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * Vivek Pandey - */ -public interface InternalizationLogic { - /** - * Creates a new instance of XMLFilter that can be used to - * find references to external schemas. - * - *

    - * Schemas that are included/imported need to be a part of - * {@link DOMForest}, and this filter will be expected to - * find such references. - * - *

    - * Once such a reference is found, the filter is expected to - * call the parse method of DOMForest. - * - *

    - * {@link DOMForest} will register ErrorHandler to the returned - * object, so any error should be sent to that error handler. - * - * @return - * This method returns {@link org.xml.sax.helpers.XMLFilterImpl} because - * the filter has to be usable for two directions - * (wrapping a reader and wrapping a ContentHandler) - */ - XMLFilterImpl createExternalReferenceFinder( DOMForest parent ); - - /** - * Checks if the specified element is a valid target node - * to attach a customization. - * - * @param parent - * The owner DOMForest object. Probably useful only - * to obtain context information, such as error handler. - * @param bindings - * <jaxb:bindings> element or a customization element. - * @return - * true if it's OK, false if not. - */ - boolean checkIfValidTargetNode( DOMForest parent, Element bindings, Element target ); - - /** - * Prepares an element that actually receives customizations. - * - *

    - * For example, in XML Schema, target nodes can be any schema - * element but it is always the <xsd:appinfo> element that - * receives customization. - * - * @param target - * The target node designated by the customization. - * @return - * Always return non-null valid object - */ - Element refineSchemaTarget( Element target ); - - /** - * Prepares a WSDL element that actually receives customizations. - * - * - * @param target - * The target node designated by the customization. - * @return - * Always return non-null valid object - */ - Element refineWSDLTarget( Element target ); - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java deleted file mode 100644 index a3343f17a06..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.istack.internal.SAXParseException2; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import com.sun.tools.internal.xjc.util.DOMUtils; -import com.sun.xml.internal.bind.v2.util.EditDistance; -import com.sun.xml.internal.ws.util.DOMUtil; -import com.sun.xml.internal.ws.util.JAXWSUtils; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXParseException; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - - -/** - * Internalizes external binding declarations. - * - * @author Vivek Pandey - */ -public class Internalizer { - private static final XPathFactory xpf = XPathFactory.newInstance(); - private final XPath xpath = xpf.newXPath(); - private final WsimportOptions options; - private final DOMForest forest; - private final ErrorReceiver errorReceiver; - - - public Internalizer(DOMForest forest, WsimportOptions options, ErrorReceiver errorReceiver) { - this.forest = forest; - this.options = options; - this.errorReceiver = errorReceiver; - } - - public void transform() { - Map targetNodes = new HashMap(); - for (Element jaxwsBinding : forest.outerMostBindings) { - buildTargetNodeMap(jaxwsBinding, jaxwsBinding, targetNodes); - } - for (Element jaxwsBinding : forest.outerMostBindings) { - move(jaxwsBinding, targetNodes); - } - } - - /** - * Validates attributes of a <JAXWS:bindings> element. - */ - private void validate(Element bindings) { - NamedNodeMap atts = bindings.getAttributes(); - for (int i = 0; i < atts.getLength(); i++) { - Attr a = (Attr) atts.item(i); - if (a.getNamespaceURI() != null) - continue; // all foreign namespace OK. - if (a.getLocalName().equals("node")) - continue; - if (a.getLocalName().equals("wsdlLocation")) - continue; - - // TODO: flag error for this undefined attribute - } - } - - /** - * Determines the target node of the "bindings" element - * by using the inherited target node, then put - * the result into the "result" map. - */ - private void buildTargetNodeMap(Element bindings, Node inheritedTarget, Map result) { - // start by the inherited target - Node target = inheritedTarget; - - validate(bindings); // validate this node - - // look for @wsdlLocation - if (isTopLevelBinding(bindings)) { - String wsdlLocation; - if (bindings.getAttributeNode("wsdlLocation") != null) { - wsdlLocation = bindings.getAttribute("wsdlLocation"); - - try { - // absolutize this URI. - // TODO: use the URI class - // TODO: honor xml:base - wsdlLocation = new URL(new URL(forest.getSystemId(bindings.getOwnerDocument())), - wsdlLocation).toExternalForm(); - } catch (MalformedURLException e) { - wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation)); - } - } else { - //the node does not have - wsdlLocation = forest.getFirstRootDocument(); - } - target = forest.get(wsdlLocation); - - if (target == null) { - reportError(bindings, WsdlMessages.INTERNALIZER_INCORRECT_SCHEMA_REFERENCE(wsdlLocation, EditDistance.findNearest(wsdlLocation, forest.listSystemIDs()))); - return; // abort processing this - } - } - - //if the target node is xs:schema, declare the jaxb version on it as latter on it will be - //required by the inlined schema bindings - - Element element = DOMUtil.getFirstElementChild(target); - if (element != null && element.getNamespaceURI().equals(Constants.NS_WSDL) && element.getLocalName().equals("definitions")) { - //get all schema elements - Element type = DOMUtils.getFirstChildElement(element, Constants.NS_WSDL, "types"); - if (type != null) { - for (Element schemaElement : DOMUtils.getChildElements(type, Constants.NS_XSD, "schema")) { - if (!schemaElement.hasAttributeNS(Constants.NS_XMLNS, "jaxb")) { - schemaElement.setAttributeNS(Constants.NS_XMLNS, "xmlns:jaxb", JAXWSBindingsConstants.NS_JAXB_BINDINGS); - } - - //add jaxb:bindings version info. Lets put it to 1.0, may need to change latter - if (!schemaElement.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "version")) { - schemaElement.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "jaxb:version", JAXWSBindingsConstants.JAXB_BINDING_VERSION); - } - } - } - } - - - boolean hasNode = true; - if ((isJAXWSBindings(bindings) || isJAXBBindings(bindings)) && bindings.getAttributeNode("node") != null) { - target = evaluateXPathNode(bindings, target, bindings.getAttribute("node"), new NamespaceContextImpl(bindings)); - } else - if (isJAXWSBindings(bindings) && (bindings.getAttributeNode("node") == null) && !isTopLevelBinding(bindings)) { - hasNode = false; - } else - if (isGlobalBinding(bindings) && !isWSDLDefinition(target) && isTopLevelBinding(bindings.getParentNode())) { - target = getWSDLDefintionNode(bindings, target); - } - - //if target is null it means the xpath evaluation has some problem, - // just return - if (target == null) - return; - - // update the result map - if (hasNode) - result.put(bindings, target); - - // look for child and process them recursively - Element[] children = getChildElements(bindings); - for (Element child : children) - buildTargetNodeMap(child, target, result); - } - - private Node getWSDLDefintionNode(Node bindings, Node target) { - return evaluateXPathNode(bindings, target, "wsdl:definitions", - new NamespaceContext() { - public String getNamespaceURI(String prefix) { - return "http://schemas.xmlsoap.org/wsdl/"; - } - - public String getPrefix(String nsURI) { - throw new UnsupportedOperationException(); - } - - public Iterator getPrefixes(String namespaceURI) { - throw new UnsupportedOperationException(); - } - }); - } - - private boolean isWSDLDefinition(Node target) { - if (target == null) - return false; - String localName = target.getLocalName(); - String nsURI = target.getNamespaceURI(); - return fixNull(localName).equals("definitions") && fixNull(nsURI).equals("http://schemas.xmlsoap.org/wsdl/"); - } - - private boolean isTopLevelBinding(Node node) { - return node.getOwnerDocument().getDocumentElement() == node; - } - - private boolean isJAXWSBindings(Node bindings) { - return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) && bindings.getLocalName().equals("bindings")); - } - - private boolean isJAXBBindings(Node bindings) { - return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXB_BINDINGS) && bindings.getLocalName().equals("bindings")); - } - - private boolean isGlobalBinding(Node bindings) { - if (bindings.getNamespaceURI() == null) { - errorReceiver.warning(forest.locatorTable.getStartLocation((Element) bindings), WsdlMessages.INVALID_CUSTOMIZATION_NAMESPACE(bindings.getLocalName())); - return false; - } - return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) && - (bindings.getLocalName().equals("package") || - bindings.getLocalName().equals("enableAsyncMapping") || - bindings.getLocalName().equals("enableAdditionalSOAPHeaderMapping") || - bindings.getLocalName().equals("enableWrapperStyle") || - bindings.getLocalName().equals("enableMIMEContent"))); - } - - private static Element[] getChildElements(Element parent) { - ArrayList a = new ArrayList(); - NodeList children = parent.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node item = children.item(i); - if (!(item instanceof Element)) continue; - - if (JAXWSBindingsConstants.NS_JAXWS_BINDINGS.equals(item.getNamespaceURI()) || - JAXWSBindingsConstants.NS_JAXB_BINDINGS.equals(item.getNamespaceURI())) - a.add((Element) item); - } - return a.toArray(new Element[a.size()]); - } - - private Node evaluateXPathNode(Node bindings, Node target, String expression, NamespaceContext namespaceContext) { - NodeList nlst; - try { - xpath.setNamespaceContext(namespaceContext); - nlst = (NodeList) xpath.evaluate(expression, target, XPathConstants.NODESET); - } catch (XPathExpressionException e) { - reportError((Element) bindings, WsdlMessages.INTERNALIZER_X_PATH_EVALUATION_ERROR(e.getMessage()), e); - return null; // abort processing this - } - - if (nlst.getLength() == 0) { - reportError((Element) bindings, WsdlMessages.INTERNALIZER_X_PATH_EVALUATES_TO_NO_TARGET(expression)); - return null; // abort - } - - if (nlst.getLength() != 1) { - reportError((Element) bindings, WsdlMessages.INTERNALIZER_X_PATH_EVAULATES_TO_TOO_MANY_TARGETS(expression, nlst.getLength())); - return null; // abort - } - - Node rnode = nlst.item(0); - if (!(rnode instanceof Element)) { - reportError((Element) bindings, WsdlMessages.INTERNALIZER_X_PATH_EVALUATES_TO_NON_ELEMENT(expression)); - return null; // abort - } - return rnode; - } - - /** - * Moves JAXWS customizations under their respective target nodes. - */ - private void move(Element bindings, Map targetNodes) { - Node target = targetNodes.get(bindings); - if (target == null) - // this must be the result of an error on the external binding. - // recover from the error by ignoring this node - return; - - Element[] children = DOMUtils.getChildElements(bindings); - - for (Element item : children) { - if ("bindings".equals(item.getLocalName())) { - // process child recursively - move(item, targetNodes); - } else if (isGlobalBinding(item)) { - target = targetNodes.get(item); - moveUnder(item, (Element) target); - } else { - if (!(target instanceof Element)) { - return; // abort - } - // move this node under the target - moveUnder(item, (Element) target); - } - } - } - - private boolean isJAXBBindingElement(Element e) { - return fixNull(e.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXB_BINDINGS); - } - - private boolean isJAXWSBindingElement(Element e) { - return fixNull(e.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS); - } - - /** - * Moves the "decl" node under the "target" node. - * - * @param decl A JAXWS customization element (e.g., <JAXWS:class>) - * @param target XML wsdl element under which the declaration should move. - * For example, <xs:element> - */ - private void moveUnder(Element decl, Element target) { - - //if there is @node on decl and has a child element jaxb:bindings, move it under the target - //Element jaxb = getJAXBBindingElement(decl); - if (isJAXBBindingElement(decl)) { - //add jaxb namespace declaration - if (!target.hasAttributeNS(Constants.NS_XMLNS, "jaxb")) { - target.setAttributeNS(Constants.NS_XMLNS, "xmlns:jaxb", JAXWSBindingsConstants.NS_JAXB_BINDINGS); - } - - //add jaxb:bindings version info. Lets put it to 1.0, may need to change latter - if (!target.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "version")) { - target.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "jaxb:version", JAXWSBindingsConstants.JAXB_BINDING_VERSION); - } - - // HACK: allow XJC extension all the time. This allows people to specify - // the in the external bindings. Otherwise users lack the ability - // to specify jaxb:extensionBindingPrefixes, so it won't work. - // - // the current workaround is still problematic in the sense that - // it can't support user-defined extensions. This needs more careful thought. - - //JAXB doesn't allow writing jaxb:extensionbindingPrefix anywhere other than root element so lets write only on - if (target.getLocalName().equals("schema") && target.getNamespaceURI().equals(Constants.NS_XSD) && !target.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "extensionBindingPrefixes")) { - target.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS, "jaxb:extensionBindingPrefixes", "xjc"); - target.setAttributeNS(Constants.NS_XMLNS, "xmlns:xjc", JAXWSBindingsConstants.NS_XJC_BINDINGS); - } - - //insert xs:annotation/xs:appinfo where in jaxb:binding will be put - target = refineSchemaTarget(target); - copyInscopeNSAttributes(decl); - } else if (isJAXWSBindingElement(decl)) { - //add jaxb namespace declaration - if (!target.hasAttributeNS(Constants.NS_XMLNS, "JAXWS")) { - target.setAttributeNS(Constants.NS_XMLNS, "xmlns:JAXWS", JAXWSBindingsConstants.NS_JAXWS_BINDINGS); - } - - //insert xs:annotation/xs:appinfo where in jaxb:binding will be put - target = refineWSDLTarget(target); - copyInscopeNSAttributes(decl); - } else { - return; - } - - // finally move the declaration to the target node. - if (target.getOwnerDocument() != decl.getOwnerDocument()) { - // if they belong to different DOM documents, we need to clone them - decl = (Element) target.getOwnerDocument().importNode(decl, true); - - } - - target.appendChild(decl); - } - - /** - * Copy in-scope namespace declarations of the decl node - * to the decl node itself so that this move won't change - * the in-scope namespace bindings. - */ - private void copyInscopeNSAttributes(Element e) { - Element p = e; - Set inscopes = new HashSet(); - while (true) { - NamedNodeMap atts = p.getAttributes(); - for (int i = 0; i < atts.getLength(); i++) { - Attr a = (Attr) atts.item(i); - if (Constants.NS_XMLNS.equals(a.getNamespaceURI())) { - String prefix; - if (a.getName().indexOf(':') == -1) prefix = ""; - else prefix = a.getLocalName(); - - if (inscopes.add(prefix) && p != e) { - // if this is the first time we see this namespace bindings, - // copy the declaration. - // if p==decl, there's no need to. Note that - // we want to add prefix to inscopes even if p==Decl - - e.setAttributeNodeNS((Attr) a.cloneNode(true)); - } - } - } - - if (p.getParentNode() instanceof Document) - break; - - p = (Element) p.getParentNode(); - } - - if (!inscopes.contains("")) { - // if the default namespace was undeclared in the context of decl, - // it must be explicitly set to "" since the new environment might - // have a different default namespace URI. - e.setAttributeNS(Constants.NS_XMLNS, "xmlns", ""); - } - } - - public Element refineSchemaTarget(Element target) { - // look for existing xs:annotation - Element annotation = DOMUtils.getFirstChildElement(target, Constants.NS_XSD, "annotation"); - if (annotation == null) - // none exists. need to make one - annotation = insertXMLSchemaElement(target, "annotation"); - - // then look for appinfo - Element appinfo = DOMUtils.getFirstChildElement(annotation, Constants.NS_XSD, "appinfo"); - if (appinfo == null) - // none exists. need to make one - appinfo = insertXMLSchemaElement(annotation, "appinfo"); - - return appinfo; - } - - public Element refineWSDLTarget(Element target) { - // look for existing xs:annotation - Element JAXWSBindings = DOMUtils.getFirstChildElement(target, JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings"); - if (JAXWSBindings == null) - // none exists. need to make one - JAXWSBindings = insertJAXWSBindingsElement(target, "bindings"); - return JAXWSBindings; - } - - /** - * Creates a new XML Schema element of the given local name - * and insert it as the first child of the given parent node. - * - * @return Newly create element. - */ - private Element insertXMLSchemaElement(Element parent, String localName) { - // use the same prefix as the parent node to avoid modifying - // the namespace binding. - String qname = parent.getTagName(); - int idx = qname.indexOf(':'); - if (idx == -1) qname = localName; - else qname = qname.substring(0, idx + 1) + localName; - - Element child = parent.getOwnerDocument().createElementNS(Constants.NS_XSD, qname); - - NodeList children = parent.getChildNodes(); - - if (children.getLength() == 0) - parent.appendChild(child); - else - parent.insertBefore(child, children.item(0)); - - return child; - } - - private Element insertJAXWSBindingsElement(Element parent, String localName) { - String qname = "JAXWS:" + localName; - - Element child = parent.getOwnerDocument().createElementNS(JAXWSBindingsConstants.NS_JAXWS_BINDINGS, qname); - - NodeList children = parent.getChildNodes(); - - if (children.getLength() == 0) - parent.appendChild(child); - else - parent.insertBefore(child, children.item(0)); - - return child; - } - - private static - @NotNull - String fixNull(@Nullable String s) { - if (s == null) return ""; - else return s; - } - - - private void reportError(Element errorSource, String formattedMsg) { - reportError(errorSource, formattedMsg, null); - } - - private void reportError(Element errorSource, - String formattedMsg, Exception nestedException) { - - SAXParseException e = new SAXParseException2(formattedMsg, - forest.locatorTable.getStartLocation(errorSource), - nestedException); - errorReceiver.error(e); - } - - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java deleted file mode 100644 index 58c605b7e55..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java +++ /dev/null @@ -1,665 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.util.xml.XmlUtil; -import com.sun.tools.internal.ws.wsdl.document.*; -import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import com.sun.tools.internal.ws.wsdl.document.jaxws.Parameter; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.namespace.QName; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import java.util.Iterator; -import java.util.Map; - - -/** - * @author Vivek Pandey - * - * jaxws:bindings exension handler. - * - */ -public class JAXWSBindingExtensionHandler extends AbstractExtensionHandler { - - private static final XPathFactory xpf = XPathFactory.newInstance(); - private final XPath xpath = xpf.newXPath(); - - public JAXWSBindingExtensionHandler(Map extensionHandlerMap) { - super(extensionHandlerMap); - } - - /* (non-Javadoc) - * @see AbstractExtensionHandler#getNamespaceURI() - */ - public String getNamespaceURI() { - return JAXWSBindingsConstants.NS_JAXWS_BINDINGS; - } - - /** - * @param context - * @param parent - * @param e - */ - private boolean parseGlobalJAXWSBindings(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - context.push(); - context.registerNamespaces(e); - - JAXWSBinding jaxwsBinding = getJAXWSExtension(parent); - if(jaxwsBinding == null) - jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - String attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.WSDL_LOCATION_ATTR); - if (attr != null) { - jaxwsBinding.setWsdlLocation(attr); - } - - attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NODE_ATTR); - if (attr != null) { - jaxwsBinding.setNode(attr); - } - - attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.VERSION_ATTR); - if (attr != null) { - jaxwsBinding.setVersion(attr); - } - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PACKAGE)){ - parsePackage(context, jaxwsBinding, e2); - if((jaxwsBinding.getJaxwsPackage() != null) && (jaxwsBinding.getJaxwsPackage().getJavaDoc() != null)){ - ((Definitions)parent).setDocumentation(new Documentation(jaxwsBinding.getJaxwsPackage().getJavaDoc())); - } - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){ - parseWrapperStyle(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){ - parseAsynMapping(context, jaxwsBinding, e2); - } -// else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){ -// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2); -// } - else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){ - parseMimeContent(context, jaxwsBinding, e2); - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - } - - private static JAXWSBinding getJAXWSExtension(TWSDLExtensible extensible) { - for (TWSDLExtension extension:extensible.extensions()) { - if (extension.getClass().equals(JAXWSBinding.class)) { - return (JAXWSBinding)extension; - } - } - - return null; - } - - /** - * @param context - * @param parent - * @param e - */ - private void parseProvider(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) { - String val = e.getTextContent(); - if(val == null) - return; - if(val.equals("false") || val.equals("0")){ - ((JAXWSBinding)parent).setProvider(Boolean.FALSE); - }else if(val.equals("true") || val.equals("1")){ - ((JAXWSBinding)parent).setProvider(Boolean.TRUE); - } - - } - - /** - * - * @param context - * @param parent - * @param e - */ - private void parseJAXBBindings(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, TWSDLExtensible parent, Element e) { - JAXWSBinding binding = (JAXWSBinding)parent; - binding.addJaxbBindings(e); - } - - /** - * @param context - * @param parent - * @param e - */ - private void parsePackage(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) { - //System.out.println("In handlePackageExtension: " + e.getNodeName()); - String packageName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR); - JAXWSBinding binding = (JAXWSBinding)parent; - binding.setJaxwsPackage(new CustomName(packageName, getJavaDoc(e))); - } - - /** - * @param context - * @param parent - * @param e - */ - private void parseWrapperStyle(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) { - //System.out.println("In handleWrapperStyleExtension: " + e.getNodeName()); - String val = e.getTextContent(); - if(val == null) - return; - if(val.equals("false") || val.equals("0")){ - ((JAXWSBinding)parent).setEnableWrapperStyle(Boolean.FALSE); - }else if(val.equals("true") || val.equals("1")){ - ((JAXWSBinding)parent).setEnableWrapperStyle(Boolean.TRUE); - } - } - - /** - * @param context - * @param parent - * @param e - */ -// private void parseAdditionalSOAPHeaderMapping(TWSDLParserContextImpl context, TWSDLExtensible parent, Element e) { -// //System.out.println("In handleAdditionalSOAPHeaderExtension: " + e.getNodeName()); -// String val = e.getTextContent(); -// if(val == null) -// return; -// if(val.equals("false") || val.equals("0")){ -// ((JAXWSBinding)parent).setEnableAdditionalHeaderMapping(Boolean.FALSE); -// }else if(val.equals("true") || val.equals("1")){ -// ((JAXWSBinding)parent).setEnableAdditionalHeaderMapping(Boolean.TRUE); -// } -// } - - /** - * @param context - * @param parent - * @param e - */ - private void parseAsynMapping(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) { - //System.out.println("In handleAsynMappingExtension: " + e.getNodeName()); - String val = e.getTextContent(); - if(val == null) - return; - if(val.equals("false") || val.equals("0")){ - ((JAXWSBinding)parent).setEnableAsyncMapping(Boolean.FALSE); - }else if(val.equals("true") || val.equals("1")){ - ((JAXWSBinding)parent).setEnableAsyncMapping(Boolean.TRUE); - } - } - - /** - * @param context - * @param parent - * @param e - */ - private void parseMimeContent(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) { - //System.out.println("In handleMimeContentExtension: " + e.getNodeName()); - String val = e.getTextContent(); - if(val == null) - return; - if(val.equals("false") || val.equals("0")){ - ((JAXWSBinding)parent).setEnableMimeContentMapping(Boolean.FALSE); - }else if(val.equals("true") || val.equals("1")){ - ((JAXWSBinding)parent).setEnableMimeContentMapping(Boolean.TRUE); - } - } - - /** - * @param context - * @param jaxwsBinding - * @param e - */ - private void parseMethod(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) { - String methodName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR); - String javaDoc = getJavaDoc(e); - CustomName name = new CustomName(methodName, javaDoc); - jaxwsBinding.setMethodName(name); - } - - /** - * @param context - * @param jaxwsBinding - * @param e - */ - private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) { - String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR); - Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e)); - Node msgElm = msgPartElm.getParentNode(); - //MessagePart msgPart = new MessagePart(); - - String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name"); - String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name"); - if((partName == null) || (msgName == null)) - return; - - String val = XmlUtil.getAttributeOrNull(msgPartElm, "element"); - - String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR); - String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR); - - QName elementName = null; - if(element != null){ - String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element)); - elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element)); - } - - jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name)); - } - - private Element evaluateXPathNode(Node target, String expression, NamespaceContext namespaceContext) { - NodeList nlst; - try { - xpath.setNamespaceContext(namespaceContext); - nlst = (NodeList)xpath.evaluate(expression, target, XPathConstants.NODESET); - } catch (XPathExpressionException e) { - Util.fail("internalizer.XPathEvaluationError", e.getMessage()); - return null; // abort processing this - } - - if( nlst.getLength()==0 ) { - Util.fail("internalizer.XPathEvaluatesToNoTarget", new Object[]{expression}); - return null; // abort - } - - if( nlst.getLength()!=1 ) { - Util.fail("internalizer.XPathEvaulatesToTooManyTargets", new Object[]{expression, nlst.getLength()}); - return null; // abort - } - - Node rnode = nlst.item(0); - if(!(rnode instanceof Element )) { - Util.fail("internalizer.XPathEvaluatesToNonElement", new Object[]{expression}); - return null; // abort - } - return (Element)rnode; - } - - /** - * @param context - * @param jaxwsBinding - * @param e - */ - private void parseClass(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) { - String className = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR); - String javaDoc = getJavaDoc(e); - jaxwsBinding.setClassName(new CustomName(className, javaDoc)); - } - - - /** - * @param context - * @param jaxwsBinding - * @param e - */ - private void parseException(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) { - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){ - String className = XmlUtil.getAttributeOrNull(e2, JAXWSBindingsConstants.NAME_ATTR); - String javaDoc = getJavaDoc(e2); - jaxwsBinding.setException(new com.sun.tools.internal.ws.wsdl.document.jaxws.Exception(new CustomName(className, javaDoc))); - } - } - } - - public boolean handleDefinitionsExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return parseGlobalJAXWSBindings(context, parent, e); - } - - public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){ - parseWrapperStyle(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){ - parseAsynMapping(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){ - parseClass(context, jaxwsBinding, e2); - if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){ - ((PortType)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc())); - } - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - if(parent instanceof Operation){ - return handlePortTypeOperation(context, (Operation)parent, e); - }else if(parent instanceof BindingOperation){ - return handleBindingOperation(context, (BindingOperation)parent, e); - } - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - return false; - } - - private boolean handleBindingOperation(TWSDLParserContext context, BindingOperation operation, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - -// if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){ -// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2); -// }else - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){ - parseMimeContent(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){ - parseParameter(context, jaxwsBinding, e2); - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - operation.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - private boolean handlePortTypeOperation(TWSDLParserContext context, Operation parent, Element e) { - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){ - parseWrapperStyle(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){ - parseAsynMapping(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){ - parseMethod(context, jaxwsBinding, e2); - if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){ - parent.setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc())); - } - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){ - parseParameter(context, jaxwsBinding, e2); - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - } - - public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - -// if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){ -// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2); -// }else - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){ - parseMimeContent(context, jaxwsBinding, e2); - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - /* (non-Javadoc) - * @see ExtensionHandlerBase#handleFaultExtension(TWSDLParserContextImpl, TWSDLExtensible, org.w3c.dom.Element) - */ - public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){ - parseClass(context, jaxwsBinding, e2); - if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){ - ((Fault)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc())); - } - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){ - parseClass(context, jaxwsBinding, e2); - if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){ - ((Service)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc())); - } - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){ - context.push(); - context.registerNamespaces(e); - JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e)); - - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PROVIDER)){ - parseProvider(context, jaxwsBinding, e2); - }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){ - parseMethod(context, jaxwsBinding, e2); - if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){ - ((Port)parent).setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc())); - } - }else{ - Util.fail( - "parsing.invalidExtensionElement", - e2.getTagName(), - e2.getNamespaceURI()); - return false; - } - } - parent.addExtension(jaxwsBinding); - context.pop(); -// context.fireDoneParsingEntity( -// JAXWSBindingsConstants.JAXWS_BINDINGS, -// jaxwsBinding); - return true; - }else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; - } - } - - private String getJavaDoc(Element e){ - for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){ - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){ - return XmlUtil.getTextForNode(e2); - } - } - return null; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MIMEExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MIMEExtensionHandler.java deleted file mode 100644 index 438e7439e7e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MIMEExtensionHandler.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.util.xml.XmlUtil; -import com.sun.tools.internal.ws.wsdl.document.WSDLConstants; -import com.sun.tools.internal.ws.wsdl.document.mime.*; -import org.w3c.dom.Element; - -import java.util.Iterator; -import java.util.Map; - -/** - * The MIME extension handler for WSDL. - * - * @author WS Development Team - */ -public class MIMEExtensionHandler extends AbstractExtensionHandler { - - public MIMEExtensionHandler(Map extensionHandlerMap) { - super(extensionHandlerMap); - } - - public String getNamespaceURI() { - return Constants.NS_WSDL_MIME; - } - - @Override - public boolean doHandleExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_OUTPUT)) { - return handleInputOutputExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_INPUT)) { - return handleInputOutputExtension(context, parent, e); - } else if (parent.getWSDLElementName().equals(MIMEConstants.QNAME_PART)) { - return handleMIMEPartExtension(context, parent, e); - } else { -// context.fireIgnoringExtension( -// new QName(e.getNamespaceURI(), e.getLocalName()), -// parent.getWSDLElementName()); - return false; - } - } - - protected boolean handleInputOutputExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MULTIPART_RELATED)) { - context.push(); - context.registerNamespaces(e); - - MIMEMultipartRelated mpr = new MIMEMultipartRelated(context.getLocation(e)); - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, MIMEConstants.QNAME_PART)) { - context.push(); - context.registerNamespaces(e2); - - MIMEPart part = new MIMEPart(context.getLocation(e2)); - - String name = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME); - if (name != null) { - part.setName(name); - } - - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - AbstractExtensionHandler h = getExtensionHandlers().get(e3.getNamespaceURI()); - boolean handled = false; - if (h != null) { - handled = h.doHandleExtension(context, part, e3); - } - - if (!handled) { - String required = - XmlUtil.getAttributeNSOrNull( - e3, - Constants.ATTR_REQUIRED, - Constants.NS_WSDL); - if (required != null - && required.equals(Constants.TRUE)) { - Util.fail( - "parsing.requiredExtensibilityElement", - e3.getTagName(), - e3.getNamespaceURI()); - } else { -// context.fireIgnoringExtension( -// new QName( -// e3.getNamespaceURI(), -// e3.getLocalName()), -// part.getElementName()); - } - } - } - - mpr.add(part); - context.pop(); -// context.fireDoneParsingEntity( -// MIMEConstants.QNAME_PART, -// part); - } else { - Util.fail( - "parsing.invalidElement", - e2.getTagName(), - e2.getNamespaceURI()); - } - } - - parent.addExtension(mpr); - context.pop(); -// context.fireDoneParsingEntity( -// MIMEConstants.QNAME_MULTIPART_RELATED, -// mpr); - return true; - } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) { - MIMEContent content = parseMIMEContent(context, e); - parent.addExtension(content); - return true; - } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) { - MIMEXml mimeXml = parseMIMEXml(context, e); - parent.addExtension(mimeXml); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - @Override - protected boolean handleMIMEPartExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) { - MIMEContent content = parseMIMEContent(context, e); - parent.addExtension(content); - return true; - } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) { - MIMEXml mimeXml = parseMIMEXml(context, e); - parent.addExtension(mimeXml); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - protected MIMEContent parseMIMEContent(TWSDLParserContext context, Element e) { - context.push(); - context.registerNamespaces(e); - - MIMEContent content = new MIMEContent(context.getLocation(e)); - - String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART); - if (part != null) { - content.setPart(part); - } - - String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE); - if (type != null) { - content.setType(type); - } - - context.pop(); -// context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content); - return content; - } - - protected MIMEXml parseMIMEXml(TWSDLParserContext context, Element e) { - context.push(); - context.registerNamespaces(e); - - MIMEXml mimeXml = new MIMEXml(context.getLocation(e)); - - String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART); - if (part != null) { - mimeXml.setPart(part); - } - - context.pop(); -// context.fireDoneParsingEntity(MIMEConstants.QNAME_MIME_XML, mimeXml); - return mimeXml; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java deleted file mode 100644 index 4306013a5b7..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.xml.internal.ws.api.addressing.AddressingVersion; -import org.w3c.dom.Element; - -import javax.xml.namespace.QName; -import java.util.Map; - -/** - * @author Arun Gupta - */ -public class MemberSubmissionAddressingExtensionHandler extends W3CAddressingExtensionHandler { - public MemberSubmissionAddressingExtensionHandler(Map extensionHandlerMap) { - super(extensionHandlerMap); - } - - public MemberSubmissionAddressingExtensionHandler(Map extensionHandlerMap, ErrorReceiver env) { - super(extensionHandlerMap, env); - } - - @Override - public String getNamespaceURI() { - return AddressingVersion.MEMBER.wsdlNsUri; - } - - protected QName getActionQName() { - return AddressingVersion.MEMBER.wsdlActionTag; - } - - protected QName getWSDLExtensionQName() { - return AddressingVersion.MEMBER.wsdlExtensionTag; - } - - @Override - public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - // ignore any extension elements - return false; - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MetadataFinder.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MetadataFinder.java deleted file mode 100644 index 2d1bd833805..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/MetadataFinder.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.tools.internal.ws.resources.WscompileMessages; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.document.WSDLConstants; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; -import com.sun.tools.internal.ws.wsdl.framework.ParseException; -import com.sun.xml.internal.ws.api.wsdl.parser.MetaDataResolver; -import com.sun.xml.internal.ws.api.wsdl.parser.MetadataResolverFactory; -import com.sun.xml.internal.ws.api.wsdl.parser.ServiceDescriptor; -import com.sun.xml.internal.ws.util.DOMUtil; -import com.sun.xml.internal.ws.util.ServiceFinder; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * @author Vivek Pandey - */ -public final class MetadataFinder extends DOMForest{ - - public boolean isMexMetadata; - private String rootWSDL; - private Set rootWsdls = new HashSet(); - - - public MetadataFinder(InternalizationLogic logic, WsimportOptions options, ErrorReceiver errReceiver) { - super(logic, options, errReceiver); - - } - - public void parseWSDL(){ - // parse source grammars - for (InputSource value : options.getWSDLs()) { - String systemID = value.getSystemId(); - errorReceiver.pollAbort(); - - Document dom ; - Element doc = null; - - try { - //if there is entity resolver use it - if (options.entityResolver != null) - value = options.entityResolver.resolveEntity(null, systemID); - if (value == null) - value = new InputSource(systemID); - dom = parse(value, true); - - doc = dom.getDocumentElement(); - if (doc == null) { - continue; - } - //if its not a WSDL document, retry with MEX - if (doc.getNamespaceURI() == null || !doc.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !doc.getLocalName().equals("definitions")) { - throw new SAXParseException(WsdlMessages.INVALID_WSDL(systemID, - com.sun.xml.internal.ws.wsdl.parser.WSDLConstants.QNAME_DEFINITIONS, doc.getNodeName(), locatorTable.getStartLocation(doc).getLineNumber()), locatorTable.getStartLocation(doc)); - } - } catch(FileNotFoundException e){ - errorReceiver.error(WsdlMessages.FILE_NOT_FOUND(systemID), e); - return; - } catch (IOException e) { - doc = getFromMetadataResolver(systemID, e); - } catch (SAXParseException e) { - doc = getFromMetadataResolver(systemID, e); - } catch (SAXException e) { - doc = getFromMetadataResolver(systemID, e); - } - - if (doc == null) { - continue; - } - - NodeList schemas = doc.getElementsByTagNameNS(SchemaConstants.NS_XSD, "schema"); - for (int i = 0; i < schemas.getLength(); i++) { - if(!inlinedSchemaElements.contains(schemas.item(i))) - inlinedSchemaElements.add((Element) schemas.item(i)); - } - } - identifyRootWslds(); - } - - /** - * Gives the root wsdl document systemId. A root wsdl document is the one which has wsdl:service. - * @return null if there is no root wsdl - */ - public @Nullable - String getRootWSDL(){ - return rootWSDL; - } - - /** - * Gives all the WSDL documents. - */ - public @NotNull - Set getRootWSDLs(){ - return rootWsdls; - } - - - /** - * Identifies WSDL documents from the {@link DOMForest}. Also identifies the root wsdl document. - */ - private void identifyRootWslds(){ - for(String location: rootDocuments){ - Document doc = get(location); - if(doc!=null){ - Element definition = doc.getDocumentElement(); - if(definition == null || definition.getLocalName() == null || definition.getNamespaceURI() == null) - continue; - if(definition.getNamespaceURI().equals(WSDLConstants.NS_WSDL) && definition.getLocalName().equals("definitions")){ - rootWsdls.add(location); - //set the root wsdl at this point. Root wsdl is one which has wsdl:service in it - NodeList nl = definition.getElementsByTagNameNS(WSDLConstants.NS_WSDL, "service"); - - //TODO:what if there are more than one wsdl with wsdl:service element. Probably such cases - //are rare and we will take any one of them, this logic should still work - if(nl.getLength() > 0) - rootWSDL = location; - } - } - } - //no wsdl with wsdl:service found, throw error - if(rootWSDL == null){ - StringBuffer strbuf = new StringBuffer(); - for(String str : rootWsdls){ - strbuf.append(str); - strbuf.append('\n'); - } - errorReceiver.error(null, WsdlMessages.FAILED_NOSERVICE(strbuf.toString())); - } - } - - /* - * If source and target namespace are also passed in, - * then if the mex resolver is found and it cannot get - * the data, wsimport attempts to add ?wsdl to the - * address and retrieve the data with a normal http get. - * This behavior should only happen when trying a - * mex request first. - */ - private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) { - //try MEX - MetaDataResolver resolver; - ServiceDescriptor serviceDescriptor = null; - for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) { - resolver = resolverFactory.metadataResolver(options.entityResolver); - try { - serviceDescriptor = resolver.resolve(new URI(systemId)); - //we got the ServiceDescriptor, now break - if (serviceDescriptor != null) - break; - } catch (URISyntaxException e) { - throw new ParseException(e); - } - } - - if (serviceDescriptor != null) { - errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex)); - return parseMetadata(systemId, serviceDescriptor); - } else { - errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex); - } - return null; - } - - private Element parseMetadata(@NotNull String systemId, @NotNull ServiceDescriptor serviceDescriptor) { - List mexWsdls = serviceDescriptor.getWSDLs(); - List mexSchemas = serviceDescriptor.getSchemas(); - Document root = null; - for (Source src : mexWsdls) { - if (src instanceof DOMSource) { - Node n = ((DOMSource) src).getNode(); - Document doc; - if (n.getNodeType() == Node.ELEMENT_NODE && n.getOwnerDocument() == null) { - doc = DOMUtil.createDom(); - doc.importNode(n, true); - } else { - doc = n.getOwnerDocument(); - } - -// Element e = (n.getNodeType() == Node.ELEMENT_NODE)?(Element)n: DOMUtil.getFirstElementChild(n); - if (root == null) { - //check if its main wsdl, then set it to root - NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(WSDLConstants.NS_WSDL, "service"); - if (nl.getLength() > 0) { - root = doc; - rootWSDL = src.getSystemId(); - } - } - NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(WSDLConstants.NS_WSDL, "import"); - for(int i = 0; i < nl.getLength(); i++){ - Element imp = (Element) nl.item(i); - String loc = imp.getAttribute("location"); - if (loc != null) { - if (!externalReferences.contains(loc)) - externalReferences.add(loc); - } - } - if (core.keySet().contains(systemId)) - core.remove(systemId); - core.put(src.getSystemId(), doc); - isMexMetadata = true; - } - - //TODO:handle SAXSource - //TODO:handler StreamSource - } - - for (Source src : mexSchemas) { - if (src instanceof DOMSource) { - Node n = ((DOMSource) src).getNode(); - Element e = (n.getNodeType() == Node.ELEMENT_NODE) ? (Element) n : DOMUtil.getFirstElementChild(n); - inlinedSchemaElements.add(e); - } - //TODO:handle SAXSource - //TODO:handler StreamSource - } - return root.getDocumentElement(); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/NamespaceContextImpl.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/NamespaceContextImpl.java deleted file mode 100644 index 3971e38011b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/NamespaceContextImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ - /* - * Portions Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * Copyright 1999-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -import javax.xml.namespace.NamespaceContext; -import java.util.Iterator; - -public class NamespaceContextImpl implements NamespaceContext { - - private final Element e; - - public NamespaceContextImpl(Element e) { - this.e = e; - } - - public String getNamespaceURI(String prefix) { - Node parent = e; - String namespace = null; - - if (prefix.equals("xml")) { - namespace = WellKnownNamespace.XML_NAMESPACE_URI; - } else { - int type; - - while ((null != parent) && (null == namespace) - && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) - || (type == Node.ENTITY_REFERENCE_NODE))) { - if (type == Node.ELEMENT_NODE) { - if (parent.getNodeName().indexOf(prefix + ':') == 0) - return parent.getNamespaceURI(); - NamedNodeMap nnm = parent.getAttributes(); - - for (int i = 0; i < nnm.getLength(); i++) { - Node attr = nnm.item(i); - String aname = attr.getNodeName(); - boolean isPrefix = aname.startsWith("xmlns:"); - - if (isPrefix || aname.equals("xmlns")) { - int index = aname.indexOf(':'); - String p = isPrefix ? aname.substring(index + 1) : ""; - - if (p.equals(prefix)) { - namespace = attr.getNodeValue(); - - break; - } - } - } - } - - parent = parent.getParentNode(); - } - } - - return namespace; - } - - public String getPrefix(String namespaceURI) { - throw new UnsupportedOperationException(); - } - - public Iterator getPrefixes(String namespaceURI) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAP12ExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAP12ExtensionHandler.java deleted file mode 100644 index 63e2068043b..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAP12ExtensionHandler.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.wsdl.document.soap.SOAP12Binding; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAP12Constants; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPBinding; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.Map; - - -public class SOAP12ExtensionHandler extends SOAPExtensionHandler { - public SOAP12ExtensionHandler(Map extensionHandlerMap) { - super(extensionHandlerMap); - } - - /* - * @see SOAPExtensionHandler#getNamespaceURI() - */ - @Override - public String getNamespaceURI() { - return Constants.NS_WSDL_SOAP12; - } - - /* - * @see SOAPExtensionHandler#getAddressQName() - */ - @Override - protected QName getAddressQName() { - return SOAP12Constants.QNAME_ADDRESS; - } - - /* - * @see SOAPExtensionHandler#getBindingQName() - */ - @Override - protected QName getBindingQName() { - return SOAP12Constants.QNAME_BINDING; - } - - @Override protected SOAPBinding getSOAPBinding(Locator location) { - return new SOAP12Binding(location); - } - - /* - * @see SOAPExtensionHandler#getBodyQName() - */ - @Override - protected QName getBodyQName() { - return SOAP12Constants.QNAME_BODY; - } - - /* - * @see SOAPExtensionHandler#getFaultQName() - */ - @Override - protected QName getFaultQName() { - return SOAP12Constants.QNAME_FAULT; - } - - /* - * @see SOAPExtensionHandler#getHeaderfaultQName() - */ - @Override - protected QName getHeaderfaultQName() { - return SOAP12Constants.QNAME_HEADERFAULT; - } - - /* - * @see SOAPExtensionHandler#getHeaderQName() - */ - @Override - protected QName getHeaderQName() { - return SOAP12Constants.QNAME_HEADER; - } - - /* - * @see SOAPExtensionHandler#getOperationQName() - */ - @Override - protected QName getOperationQName() { - return SOAP12Constants.QNAME_OPERATION; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAPEntityReferenceValidator.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAPEntityReferenceValidator.java deleted file mode 100644 index 1b818949b11..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAPEntityReferenceValidator.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds; -import com.sun.tools.internal.ws.wsdl.document.soap.SOAPConstants; -import com.sun.tools.internal.ws.wsdl.framework.EntityReferenceValidator; -import com.sun.tools.internal.ws.wsdl.framework.Kind; - -import javax.xml.namespace.QName; -import java.util.HashSet; -import java.util.Set; - -/** - * An interface implemented by a class that is capable of validating - * a QName/Kind pair referring to an external entity. - * - * @author WS Development Team - */ -public class SOAPEntityReferenceValidator implements EntityReferenceValidator { - public SOAPEntityReferenceValidator() { - } - - public boolean isValid(Kind kind, QName name) { - - // just let all "xml:" QNames through - if (name.getNamespaceURI().equals(Constants.NS_XML)) - return true; - - if (kind == SchemaKinds.XSD_TYPE) { - return _validTypes.contains(name); - } else if (kind == SchemaKinds.XSD_ELEMENT) { - return _validElements.contains(name); - } else if (kind == SchemaKinds.XSD_ATTRIBUTE) { - return _validAttributes.contains(name); - } else { - // no luck - return false; - } - } - - private static final Set _validTypes; - private static final Set _validElements; - private static final Set _validAttributes; - - static { - // add all XML Schema and SOAP types - _validTypes = new HashSet(); - _validTypes.add(SOAPConstants.QNAME_TYPE_ARRAY); - _validTypes.add(SchemaConstants.QNAME_TYPE_STRING); - _validTypes.add(SchemaConstants.QNAME_TYPE_NORMALIZED_STRING); - _validTypes.add(SchemaConstants.QNAME_TYPE_TOKEN); - _validTypes.add(SchemaConstants.QNAME_TYPE_BYTE); - _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_BYTE); - _validTypes.add(SchemaConstants.QNAME_TYPE_BASE64_BINARY); - _validTypes.add(SchemaConstants.QNAME_TYPE_HEX_BINARY); - _validTypes.add(SchemaConstants.QNAME_TYPE_INTEGER); - _validTypes.add(SchemaConstants.QNAME_TYPE_POSITIVE_INTEGER); - _validTypes.add(SchemaConstants.QNAME_TYPE_NEGATIVE_INTEGER); - _validTypes.add(SchemaConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER); - _validTypes.add(SchemaConstants.QNAME_TYPE_NON_POSITIVE_INTEGER); - _validTypes.add(SchemaConstants.QNAME_TYPE_INT); - _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_INT); - _validTypes.add(SchemaConstants.QNAME_TYPE_LONG); - _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_LONG); - _validTypes.add(SchemaConstants.QNAME_TYPE_SHORT); - _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_SHORT); - _validTypes.add(SchemaConstants.QNAME_TYPE_DECIMAL); - _validTypes.add(SchemaConstants.QNAME_TYPE_FLOAT); - _validTypes.add(SchemaConstants.QNAME_TYPE_DOUBLE); - _validTypes.add(SchemaConstants.QNAME_TYPE_BOOLEAN); - _validTypes.add(SchemaConstants.QNAME_TYPE_TIME); - _validTypes.add(SchemaConstants.QNAME_TYPE_DATE_TIME); - _validTypes.add(SchemaConstants.QNAME_TYPE_DURATION); - _validTypes.add(SchemaConstants.QNAME_TYPE_DATE); - _validTypes.add(SchemaConstants.QNAME_TYPE_G_MONTH); - _validTypes.add(SchemaConstants.QNAME_TYPE_G_YEAR); - _validTypes.add(SchemaConstants.QNAME_TYPE_G_YEAR_MONTH); - _validTypes.add(SchemaConstants.QNAME_TYPE_G_DAY); - _validTypes.add(SchemaConstants.QNAME_TYPE_G_MONTH_DAY); - _validTypes.add(SchemaConstants.QNAME_TYPE_NAME); - _validTypes.add(SchemaConstants.QNAME_TYPE_QNAME); - _validTypes.add(SchemaConstants.QNAME_TYPE_NCNAME); - _validTypes.add(SchemaConstants.QNAME_TYPE_ANY_URI); - _validTypes.add(SchemaConstants.QNAME_TYPE_ID); - _validTypes.add(SchemaConstants.QNAME_TYPE_IDREF); - _validTypes.add(SchemaConstants.QNAME_TYPE_IDREFS); - _validTypes.add(SchemaConstants.QNAME_TYPE_ENTITY); - _validTypes.add(SchemaConstants.QNAME_TYPE_ENTITIES); - _validTypes.add(SchemaConstants.QNAME_TYPE_NOTATION); - _validTypes.add(SchemaConstants.QNAME_TYPE_NMTOKEN); - _validTypes.add(SchemaConstants.QNAME_TYPE_NMTOKENS); - _validTypes.add(SchemaConstants.QNAME_TYPE_URTYPE); - _validTypes.add(SchemaConstants.QNAME_TYPE_SIMPLE_URTYPE); - _validTypes.add(SOAPConstants.QNAME_TYPE_STRING); - _validTypes.add(SOAPConstants.QNAME_TYPE_NORMALIZED_STRING); - _validTypes.add(SOAPConstants.QNAME_TYPE_TOKEN); - _validTypes.add(SOAPConstants.QNAME_TYPE_BYTE); - _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_BYTE); - _validTypes.add(SOAPConstants.QNAME_TYPE_BASE64_BINARY); - _validTypes.add(SOAPConstants.QNAME_TYPE_HEX_BINARY); - _validTypes.add(SOAPConstants.QNAME_TYPE_INTEGER); - _validTypes.add(SOAPConstants.QNAME_TYPE_POSITIVE_INTEGER); - _validTypes.add(SOAPConstants.QNAME_TYPE_NEGATIVE_INTEGER); - _validTypes.add(SOAPConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER); - _validTypes.add(SOAPConstants.QNAME_TYPE_NON_POSITIVE_INTEGER); - _validTypes.add(SOAPConstants.QNAME_TYPE_INT); - _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_INT); - _validTypes.add(SOAPConstants.QNAME_TYPE_LONG); - _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_LONG); - _validTypes.add(SOAPConstants.QNAME_TYPE_SHORT); - _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_SHORT); - _validTypes.add(SOAPConstants.QNAME_TYPE_DECIMAL); - _validTypes.add(SOAPConstants.QNAME_TYPE_FLOAT); - _validTypes.add(SOAPConstants.QNAME_TYPE_DOUBLE); - _validTypes.add(SOAPConstants.QNAME_TYPE_BOOLEAN); - _validTypes.add(SOAPConstants.QNAME_TYPE_TIME); - _validTypes.add(SOAPConstants.QNAME_TYPE_DATE_TIME); - _validTypes.add(SOAPConstants.QNAME_TYPE_DURATION); - _validTypes.add(SOAPConstants.QNAME_TYPE_DATE); - _validTypes.add(SOAPConstants.QNAME_TYPE_G_MONTH); - _validTypes.add(SOAPConstants.QNAME_TYPE_G_YEAR); - _validTypes.add(SOAPConstants.QNAME_TYPE_G_YEAR_MONTH); - _validTypes.add(SOAPConstants.QNAME_TYPE_G_DAY); - _validTypes.add(SOAPConstants.QNAME_TYPE_G_MONTH_DAY); - _validTypes.add(SOAPConstants.QNAME_TYPE_NAME); - _validTypes.add(SOAPConstants.QNAME_TYPE_QNAME); - _validTypes.add(SOAPConstants.QNAME_TYPE_NCNAME); - _validTypes.add(SOAPConstants.QNAME_TYPE_ANY_URI); - _validTypes.add(SOAPConstants.QNAME_TYPE_ID); - _validTypes.add(SOAPConstants.QNAME_TYPE_IDREF); - _validTypes.add(SOAPConstants.QNAME_TYPE_IDREFS); - _validTypes.add(SOAPConstants.QNAME_TYPE_ENTITY); - _validTypes.add(SOAPConstants.QNAME_TYPE_ENTITIES); - _validTypes.add(SOAPConstants.QNAME_TYPE_NOTATION); - _validTypes.add(SOAPConstants.QNAME_TYPE_NMTOKEN); - _validTypes.add(SOAPConstants.QNAME_TYPE_NMTOKENS); - _validTypes.add(SOAPConstants.QNAME_TYPE_BASE64); - // New types 12/3/02 - _validTypes.add(SchemaConstants.QNAME_TYPE_LANGUAGE); - - // add all SOAP encoding elements - _validElements = new HashSet(); - _validElements.add(SOAPConstants.QNAME_ELEMENT_STRING); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NORMALIZED_STRING); - _validElements.add(SOAPConstants.QNAME_ELEMENT_TOKEN); - _validElements.add(SOAPConstants.QNAME_ELEMENT_BYTE); - _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_BYTE); - _validElements.add(SOAPConstants.QNAME_ELEMENT_BASE64_BINARY); - _validElements.add(SOAPConstants.QNAME_ELEMENT_HEX_BINARY); - _validElements.add(SOAPConstants.QNAME_ELEMENT_INTEGER); - _validElements.add(SOAPConstants.QNAME_ELEMENT_POSITIVE_INTEGER); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NEGATIVE_INTEGER); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NON_NEGATIVE_INTEGER); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NON_POSITIVE_INTEGER); - _validElements.add(SOAPConstants.QNAME_ELEMENT_INT); - _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_INT); - _validElements.add(SOAPConstants.QNAME_ELEMENT_LONG); - _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_LONG); - _validElements.add(SOAPConstants.QNAME_ELEMENT_SHORT); - _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_SHORT); - _validElements.add(SOAPConstants.QNAME_ELEMENT_DECIMAL); - _validElements.add(SOAPConstants.QNAME_ELEMENT_FLOAT); - _validElements.add(SOAPConstants.QNAME_ELEMENT_DOUBLE); - _validElements.add(SOAPConstants.QNAME_ELEMENT_BOOLEAN); - _validElements.add(SOAPConstants.QNAME_ELEMENT_TIME); - _validElements.add(SOAPConstants.QNAME_ELEMENT_DATE_TIME); - _validElements.add(SOAPConstants.QNAME_ELEMENT_DURATION); - _validElements.add(SOAPConstants.QNAME_ELEMENT_DATE); - _validElements.add(SOAPConstants.QNAME_ELEMENT_G_MONTH); - _validElements.add(SOAPConstants.QNAME_ELEMENT_G_YEAR); - _validElements.add(SOAPConstants.QNAME_ELEMENT_G_YEAR_MONTH); - _validElements.add(SOAPConstants.QNAME_ELEMENT_G_DAY); - _validElements.add(SOAPConstants.QNAME_ELEMENT_G_MONTH_DAY); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NAME); - _validElements.add(SOAPConstants.QNAME_ELEMENT_QNAME); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NCNAME); - _validElements.add(SOAPConstants.QNAME_ELEMENT_ANY_URI); - _validElements.add(SOAPConstants.QNAME_ELEMENT_ID); - _validElements.add(SOAPConstants.QNAME_ELEMENT_IDREF); - _validElements.add(SOAPConstants.QNAME_ELEMENT_IDREFS); - _validElements.add(SOAPConstants.QNAME_ELEMENT_ENTITY); - _validElements.add(SOAPConstants.QNAME_ELEMENT_ENTITIES); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NOTATION); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NMTOKEN); - _validElements.add(SOAPConstants.QNAME_ELEMENT_NMTOKENS); - - _validAttributes = new HashSet(); - _validAttributes.add(SOAPConstants.QNAME_ATTR_ARRAY_TYPE); - _validAttributes.add(SOAPConstants.QNAME_ATTR_OFFSET); - _validAttributes.add(SOAPConstants.QNAME_ATTR_POSITION); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAPExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAPExtensionHandler.java deleted file mode 100644 index 2f39729c31c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/SOAPExtensionHandler.java +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.util.xml.XmlUtil; -import com.sun.tools.internal.ws.wsdl.document.soap.*; -import com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl; -import org.w3c.dom.Element; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.Iterator; -import java.util.Map; - -/** - * The SOAP extension handler for WSDL. - * - * @author WS Development Team - */ -public class SOAPExtensionHandler extends AbstractExtensionHandler { - - public SOAPExtensionHandler(Map extensionHandlerMap) { - super(extensionHandlerMap); - } - - public String getNamespaceURI() { - return Constants.NS_WSDL_SOAP; - } - - public boolean handleDefinitionsExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - - public boolean handleTypesExtension( - com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - - protected SOAPBinding getSOAPBinding(Locator location){ - return new SOAPBinding(location); - } - - public boolean handleBindingExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, getBindingQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPBinding binding = getSOAPBinding(context.getLocation(e)); - - // NOTE - the "transport" attribute is required according to section 3.3 of the WSDL 1.1 spec, - // but optional according to the schema in appendix A 4.2 of the same document! - String transport = - Util.getRequiredAttribute(e, Constants.ATTR_TRANSPORT); - binding.setTransport(transport); - - String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE); - if (style != null) { - if (style.equals(Constants.ATTRVALUE_RPC)) { - binding.setStyle(SOAPStyle.RPC); - } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) { - binding.setStyle(SOAPStyle.DOCUMENT); - } else { - Util.fail( - "parsing.invalidAttributeValue", - Constants.ATTR_STYLE, - style); - } - } - parent.addExtension(binding); - context.pop(); -// context.fireDoneParsingEntity(getBindingQName(), binding); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - public boolean handleOperationExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, getOperationQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPOperation operation = new SOAPOperation(context.getLocation(e)); - - String soapAction = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_SOAP_ACTION); - if (soapAction != null) { - operation.setSOAPAction(soapAction); - } - - String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE); - if (style != null) { - if (style.equals(Constants.ATTRVALUE_RPC)) { - operation.setStyle(SOAPStyle.RPC); - } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) { - operation.setStyle(SOAPStyle.DOCUMENT); - } else { - Util.fail( - "parsing.invalidAttributeValue", - Constants.ATTR_STYLE, - style); - } - } - parent.addExtension(operation); - context.pop(); -// context.fireDoneParsingEntity( -// getOperationQName(), -// operation); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - public boolean handleInputExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - return handleInputOutputExtension(context, parent, e); - } - public boolean handleOutputExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - return handleInputOutputExtension(context, parent, e); - } - - @Override - protected boolean handleMIMEPartExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - return handleInputOutputExtension(context, parent, e); - } - - protected boolean handleInputOutputExtension( - TWSDLParserContext contextif, - TWSDLExtensible parent, - Element e) { - TWSDLParserContextImpl context = (TWSDLParserContextImpl)contextif; - if (XmlUtil.matchesTagNS(e, getBodyQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPBody body = new SOAPBody(context.getLocation(e)); - - String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE); - if (use != null) { - if (use.equals(Constants.ATTRVALUE_LITERAL)) { - body.setUse(SOAPUse.LITERAL); - } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { - body.setUse(SOAPUse.ENCODED); - } else { - Util.fail( - "parsing.invalidAttributeValue", - Constants.ATTR_USE, - use); - } - } - - String namespace = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE); - if (namespace != null) { - body.setNamespace(namespace); - } - - String encodingStyle = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE); - if (encodingStyle != null) { - body.setEncodingStyle(encodingStyle); - } - - String parts = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARTS); - if (parts != null) { - body.setParts(parts); - } - - parent.addExtension(body); - context.pop(); -// context.fireDoneParsingEntity(getBodyQName(), body); - return true; - } else if (XmlUtil.matchesTagNS(e, getHeaderQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPHeader header = new SOAPHeader(context.getLocation(e)); - - String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE); - if (use != null) { - if (use.equals(Constants.ATTRVALUE_LITERAL)) { - header.setUse(SOAPUse.LITERAL); - } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { - header.setUse(SOAPUse.ENCODED); - } else { - Util.fail( - "parsing.invalidAttributeValue", - Constants.ATTR_USE, - use); - } - } - - String namespace = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE); - if (namespace != null) { - header.setNamespace(namespace); - } - - String encodingStyle = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE); - if (encodingStyle != null) { - header.setEncodingStyle(encodingStyle); - } - - String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART); - if (part != null) { - header.setPart(part); - } - - String messageAttr = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_MESSAGE); - if (messageAttr != null) { - header.setMessage(context.translateQualifiedName(context.getLocation(e), messageAttr)); - } - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil - .matchesTagNS(e2, getHeaderfaultQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPHeaderFault headerfault = new SOAPHeaderFault(context.getLocation(e)); - - String use2 = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_USE); - if (use2 != null) { - if (use2.equals(Constants.ATTRVALUE_LITERAL)) { - headerfault.setUse(SOAPUse.LITERAL); - } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { - headerfault.setUse(SOAPUse.ENCODED); - } else { - Util.fail( - "parsing.invalidAttributeValue", - Constants.ATTR_USE, - use2); - } - } - - String namespace2 = - XmlUtil.getAttributeOrNull( - e2, - Constants.ATTR_NAMESPACE); - if (namespace2 != null) { - headerfault.setNamespace(namespace2); - } - - String encodingStyle2 = - XmlUtil.getAttributeOrNull( - e2, - Constants.ATTR_ENCODING_STYLE); - if (encodingStyle2 != null) { - headerfault.setEncodingStyle(encodingStyle2); - } - - String part2 = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_PART); - if (part2 != null) { - headerfault.setPart(part2); - } - - String messageAttr2 = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_MESSAGE); - if (messageAttr2 != null) { - headerfault.setMessage( - context.translateQualifiedName(context.getLocation(e2), messageAttr2)); - } - - header.add(headerfault); - context.pop(); - } else { - Util.fail( - "parsing.invalidElement", - e2.getTagName(), - e2.getNamespaceURI()); - } - } - - parent.addExtension(header); - context.pop(); - context.fireDoneParsingEntity(getHeaderQName(), header); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - public boolean handleFaultExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, getFaultQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPFault fault = new SOAPFault(context.getLocation(e)); - - String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME); - if (name != null) { - fault.setName(name); - } - - String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE); - if (use != null) { - if (use.equals(Constants.ATTRVALUE_LITERAL)) { - fault.setUse(SOAPUse.LITERAL); - } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { - fault.setUse(SOAPUse.ENCODED); - } else { - Util.fail( - "parsing.invalidAttributeValue", - Constants.ATTR_USE, - use); - } - } - - String namespace = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE); - if (namespace != null) { - fault.setNamespace(namespace); - } - - String encodingStyle = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE); - if (encodingStyle != null) { - fault.setEncodingStyle(encodingStyle); - } - - parent.addExtension(fault); - context.pop(); -// context.fireDoneParsingEntity(getFaultQName(), fault); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - public boolean handleServiceExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - - @Override - public boolean handlePortExtension( - TWSDLParserContext context, - TWSDLExtensible parent, - Element e) { - if (XmlUtil.matchesTagNS(e, getAddressQName())) { - context.push(); - context.registerNamespaces(e); - - SOAPAddress address = new SOAPAddress(context.getLocation(e)); - - String location = - Util.getRequiredAttribute(e, Constants.ATTR_LOCATION); - address.setLocation(location); - - parent.addExtension(address); - context.pop(); -// context.fireDoneParsingEntity(getAddressQName(), address); - return true; - } else { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - } - - public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - Util.fail( - "parsing.invalidExtensionElement", - e.getTagName(), - e.getNamespaceURI()); - return false; // keep compiler happy - } - - protected QName getBodyQName(){ - return SOAPConstants.QNAME_BODY; - } - - protected QName getHeaderQName(){ - return SOAPConstants.QNAME_HEADER; - } - - protected QName getHeaderfaultQName(){ - return SOAPConstants.QNAME_HEADERFAULT; - } - - protected QName getOperationQName(){ - return SOAPConstants.QNAME_OPERATION; - } - - protected QName getFaultQName(){ - return SOAPConstants.QNAME_FAULT; - } - - protected QName getAddressQName(){ - return SOAPConstants.QNAME_ADDRESS; - } - - protected QName getBindingQName(){ - return SOAPConstants.QNAME_BINDING; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Util.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Util.java deleted file mode 100644 index 879cfbfeb2a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/Util.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.wsdl.framework.ParseException; -import com.sun.xml.internal.ws.util.xml.XmlUtil; -import org.w3c.dom.Comment; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.Text; - -import javax.xml.namespace.QName; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; - -/**2 - * Defines various utility methods. - * - * @author WS Development Team - */ -public class Util { - - public static String getRequiredAttribute(Element element, String name) { - String result = XmlUtil.getAttributeOrNull(element, name); - if (result == null) - fail( - "parsing.missingRequiredAttribute", - element.getTagName(), - name); - return result; - } - - public static void verifyTag(Element element, String tag) { - if (!element.getLocalName().equals(tag)) - fail("parsing.invalidTag", element.getTagName(), tag); - } - - public static void verifyTagNS(Element element, String tag, String nsURI) { - if (!element.getLocalName().equals(tag) - || (element.getNamespaceURI() != null - && !element.getNamespaceURI().equals(nsURI))) - fail( - "parsing.invalidTagNS", - new Object[] { - element.getTagName(), - element.getNamespaceURI(), - tag, - nsURI }); - } - - public static void verifyTagNS(Element element, QName name) { - if (!isTagName(element, name)) - fail( - "parsing.invalidTagNS", - new Object[] { - element.getTagName(), - element.getNamespaceURI(), - name.getLocalPart(), - name.getNamespaceURI()}); - } - - public static boolean isTagName(Element element, QName name){ - return (element.getLocalName().equals(name.getLocalPart()) - && (element.getNamespaceURI() != null - && element.getNamespaceURI().equals(name.getNamespaceURI()))); - - } - - public static void verifyTagNSRootElement(Element element, QName name) { - if (!element.getLocalName().equals(name.getLocalPart()) - || (element.getNamespaceURI() != null - && !element.getNamespaceURI().equals(name.getNamespaceURI()))) - fail( - "parsing.incorrectRootElement", - new Object[] { - element.getTagName(), - element.getNamespaceURI(), - name.getLocalPart(), - name.getNamespaceURI()}); - } - - public static Element nextElementIgnoringCharacterContent(Iterator iter) { - while (iter.hasNext()) { - Node n = (Node) iter.next(); - if (n instanceof Text) - continue; - if (n instanceof Comment) - continue; - if (!(n instanceof Element)) - fail("parsing.elementExpected"); - return (Element) n; - } - - return null; - } - - public static Element nextElement(Iterator iter) { - while (iter.hasNext()) { - Node n = (Node) iter.next(); - if (n instanceof Text) { - Text t = (Text) n; - if (t.getData().trim().length() == 0) - continue; - fail("parsing.nonWhitespaceTextFound", t.getData().trim()); - } - if (n instanceof Comment) - continue; - if (!(n instanceof Element)) - fail("parsing.elementExpected"); - return (Element) n; - } - - return null; - } - - public static String processSystemIdWithBase( - String baseSystemId, - String systemId) { - try { - URL base = null; - try { - base = new URL(baseSystemId); - } catch (MalformedURLException e) { - base = new File(baseSystemId).toURL(); - } - - try { - URL url = new URL(base, systemId); - return url.toString(); - } catch (MalformedURLException e) { - fail("parsing.invalidURI", systemId); - } - - } catch (MalformedURLException e) { - fail("parsing.invalidURI", baseSystemId); - } - - return null; // keep compiler happy - } - - public static void fail(String key) { - throw new ParseException(key); - } - - public static void fail(String key, String arg) { - throw new ParseException(key, arg); - } - - public static void fail(String key, String arg1, String arg2) { - throw new ParseException(key, new Object[] { arg1, arg2 }); - } - - public static void fail(String key, Object[] args) { - throw new ParseException(key, args); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/VersionChecker.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/VersionChecker.java deleted file mode 100644 index 09a2315d87e..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/VersionChecker.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import org.xml.sax.*; -import org.xml.sax.helpers.LocatorImpl; -import org.xml.sax.helpers.XMLFilterImpl; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Checks the jaxb:version attribute on a XML Schema document. - * - * jaxws:version is optional, if absent its value is assumed to be "2.0" and if present its value must be - * "2.0" or more. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * Vivek Pandey - */ -public class VersionChecker extends XMLFilterImpl { - - /** - * We store the value of the version attribute in this variable - * when we hit the root element. - */ - private String version = null ; - - /** Will be set to true once we hit the root element. */ - private boolean seenRoot = false; - - /** Will be set to true once we hit a binding declaration. */ - private boolean seenBindings = false; - - private Locator locator; - - /** - * Stores the location of the start tag of the root tag. - */ - private Locator rootTagStart; - - public VersionChecker( XMLReader parent ) { - setParent(parent); - } - - public VersionChecker( ContentHandler handler, ErrorHandler eh, EntityResolver er ) { - setContentHandler(handler); - if(eh!=null) setErrorHandler(eh); - if(er!=null) setEntityResolver(er); - } - - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) - throws SAXException { - - super.startElement(namespaceURI, localName, qName, atts); - - if(!seenRoot) { - // if this is the root element - seenRoot = true; - rootTagStart = new LocatorImpl(locator); - - version = atts.getValue(JAXWSBindingsConstants.NS_JAXWS_BINDINGS,"version"); - if( namespaceURI.equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) ) { - String version2 = atts.getValue("","version"); - if( version!=null && version2!=null ) { - // we have both @version and @jaxb:version. error. - SAXParseException e = new SAXParseException( - WsdlMessages.INTERNALIZER_TWO_VERSION_ATTRIBUTES(), locator); - getErrorHandler().error(e); - } - //According to JAXWS 2.0 spec, if version attribute is missing its assumed to be "2.0" - if( version==null) - version = (version2!=null)?version2:"2.0"; - } - - } - - if( JAXWSBindingsConstants.NS_JAXWS_BINDINGS.equals(namespaceURI)){ - seenBindings = true; - if(version == null) - version = "2.0"; - } - - } - - public void endDocument() throws SAXException { - super.endDocument(); - - if( seenBindings && version==null ) { - // if we see a binding declaration but not version attribute - SAXParseException e = new SAXParseException(WsdlMessages.INTERNALIZER_VERSION_NOT_PRESENT(), rootTagStart); - getErrorHandler().error(e); - } - - // if present, the value must be >= 2.0 - if( version!=null && !VERSIONS.contains(version) ) { - SAXParseException e = new SAXParseException(WsdlMessages.INTERNALIZER_INCORRECT_VERSION(), rootTagStart); - getErrorHandler().error(e); - } - } - - public void setDocumentLocator(Locator locator) { - super.setDocumentLocator(locator); - this.locator = locator; - } - - private static final Set VERSIONS = new HashSet(Arrays.asList("2.0","2.1")); - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/W3CAddressingExtensionHandler.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/W3CAddressingExtensionHandler.java deleted file mode 100644 index 7705d097ba5..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/W3CAddressingExtensionHandler.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.util.xml.XmlUtil; -import com.sun.tools.internal.ws.wscompile.ErrorReceiver; -import com.sun.tools.internal.ws.wsdl.document.Fault; -import com.sun.tools.internal.ws.wsdl.document.Input; -import com.sun.tools.internal.ws.wsdl.document.Output; -import com.sun.xml.internal.ws.api.addressing.AddressingVersion; -import org.w3c.dom.Element; -import org.xml.sax.Locator; - -import javax.xml.namespace.QName; -import java.util.Map; - -/** - * @author Arun Gupta - */ -public class W3CAddressingExtensionHandler extends AbstractExtensionHandler { - private ErrorReceiver errReceiver; - - public W3CAddressingExtensionHandler(Map extensionHandlerMap) { - this(extensionHandlerMap, null); - } - - public W3CAddressingExtensionHandler(Map extensionHandlerMap, ErrorReceiver errReceiver) { - super(extensionHandlerMap); - this.errReceiver = errReceiver; - } - - @Override - public String getNamespaceURI() { - return AddressingVersion.W3C.wsdlNsUri; - } - - protected QName getActionQName() { - return AddressingVersion.W3C.wsdlActionTag; - } - - protected QName getWSDLExtensionQName() { - return AddressingVersion.W3C.wsdlExtensionTag; - } - - @Override - public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - if (XmlUtil.matchesTagNS(e, getWSDLExtensionQName())) { - context.push(); - context.registerNamespaces(e); - - // TODO: read UsingAddressing extensibility element and store - // TODO: it as extension in "parent". It may be used to generate - // TODO: @Action/@FaultAction later. - - context.pop(); - return true; - } - return false; // keep compiler happy - } - - @Override - public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - String actionValue = XmlUtil.getAttributeNSOrNull(e, getActionQName()); - if (actionValue == null || actionValue.equals("")) { - return warnEmptyAction(parent, context.getLocation(e)); - } - - context.push(); - ((Input)parent).setAction(actionValue); - context.pop(); - - return true; - } - - @Override - public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - String actionValue = XmlUtil.getAttributeNSOrNull(e, getActionQName()); - if (actionValue == null || actionValue.equals("")) { - return warnEmptyAction(parent,context.getLocation(e)); - } - - context.push(); - ((Output)parent).setAction(actionValue); - context.pop(); - - return true; - } - - @Override - public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - String actionValue = XmlUtil.getAttributeNSOrNull(e, getActionQName()); - if (actionValue == null || actionValue.equals("")) { - errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue())); - return false; // keep compiler happy - } - - context.push(); - ((Fault)parent).setAction(actionValue); - context.pop(); - - return true; - } - - @Override - public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { - return handleBindingExtension(context, parent, e); - } - - private boolean warnEmptyAction(TWSDLExtensible parent, Locator pos) { - errReceiver.warning(pos, WsdlMessages.WARNING_INPUT_OUTPUT_EMPTY_ACTION(parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue())); - return false; // keep compiler happy - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WSDLInternalizationLogic.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WSDLInternalizationLogic.java deleted file mode 100644 index b0e4f0ac9b8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WSDLInternalizationLogic.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.wsdl.document.WSDLConstants; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; -import com.sun.tools.internal.xjc.util.DOMUtils; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.XMLFilterImpl; - -/** - * @author Vivek Pandey - */ -public class WSDLInternalizationLogic implements InternalizationLogic{ - - /** - * This filter looks for <xs:import> and <xs:include> - * and parses those documents referenced by them. - */ - private static final class ReferenceFinder extends AbstractReferenceFinderImpl { - ReferenceFinder( DOMForest parent ) { - super(parent); - } - - protected String findExternalResource( String nsURI, String localName, Attributes atts) { - if(WSDLConstants.NS_WSDL.equals(nsURI) && "import".equals(localName)){ - if(parent.isExtensionMode()){ - //TODO: add support for importing schema using wsdl:import - } - return atts.getValue("location"); - } - /* - We don't need to do this anymore, JAXB handles the schema imports, includes etc. - - else if(SchemaConstants.NS_XSD.equals(nsURI) && "import".equals(localName)){ - return atts.getValue("schemaLocation"); - } - */ - return null; - } - } - public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) { - return new ReferenceFinder(parent); - } - - public boolean checkIfValidTargetNode(DOMForest parent, Element bindings, Element target) { - return false; - } - - public Element refineSchemaTarget(Element target) { - // look for existing xs:annotation - Element annotation = DOMUtils.getFirstChildElement(target, Constants.NS_XSD, "annotation"); - if(annotation==null) - // none exists. need to make one - annotation = insertXMLSchemaElement( target, "annotation" ); - - // then look for appinfo - Element appinfo = DOMUtils.getFirstChildElement(annotation, Constants.NS_XSD, "appinfo" ); - if(appinfo==null) - // none exists. need to make one - appinfo = insertXMLSchemaElement( annotation, "appinfo" ); - - return appinfo; - - } - - public Element refineWSDLTarget(Element target){ - // look for existing xs:annotation - Element JAXWSBindings = DOMUtils.getFirstChildElement(target, JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings"); - if(JAXWSBindings==null) - // none exists. need to make one - JAXWSBindings = insertJAXWSBindingsElement(target, "bindings" ); - return JAXWSBindings; - } - - private Element insertJAXWSBindingsElement( Element parent, String localName ) { - String qname = "JAXWS:"+localName; - - Element child = parent.getOwnerDocument().createElementNS(JAXWSBindingsConstants.NS_JAXWS_BINDINGS, qname ); - - NodeList children = parent.getChildNodes(); - - if( children.getLength()==0 ) - parent.appendChild(child); - else - parent.insertBefore( child, children.item(0) ); - - return child; - } - - - /** - * Creates a new XML Schema element of the given local name - * and insert it as the first child of the given parent node. - * - * @return - * Newly create element. - */ - private Element insertXMLSchemaElement( Element parent, String localName ) { - // use the same prefix as the parent node to avoid modifying - // the namespace binding. - String qname = parent.getTagName(); - int idx = qname.indexOf(':'); - if(idx==-1) qname = localName; - else qname = qname.substring(0,idx+1)+localName; - - Element child = parent.getOwnerDocument().createElementNS( Constants.NS_XSD, qname ); - - NodeList children = parent.getChildNodes(); - - if( children.getLength()==0 ) - parent.appendChild(child); - else - parent.insertBefore( child, children.item(0) ); - - return child; - } - -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WSDLParser.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WSDLParser.java deleted file mode 100644 index 57e0dc36544..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WSDLParser.java +++ /dev/null @@ -1,1120 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; -import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensionHandler; -import com.sun.tools.internal.ws.resources.WsdlMessages; -import com.sun.tools.internal.ws.util.xml.XmlUtil; -import com.sun.tools.internal.ws.wscompile.ErrorReceiverFilter; -import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wsdl.document.Binding; -import com.sun.tools.internal.ws.wsdl.document.BindingFault; -import com.sun.tools.internal.ws.wsdl.document.BindingInput; -import com.sun.tools.internal.ws.wsdl.document.BindingOperation; -import com.sun.tools.internal.ws.wsdl.document.BindingOutput; -import com.sun.tools.internal.ws.wsdl.document.Definitions; -import com.sun.tools.internal.ws.wsdl.document.Documentation; -import com.sun.tools.internal.ws.wsdl.document.Fault; -import com.sun.tools.internal.ws.wsdl.document.Import; -import com.sun.tools.internal.ws.wsdl.document.Input; -import com.sun.tools.internal.ws.wsdl.document.Message; -import com.sun.tools.internal.ws.wsdl.document.MessagePart; -import com.sun.tools.internal.ws.wsdl.document.Operation; -import com.sun.tools.internal.ws.wsdl.document.OperationStyle; -import com.sun.tools.internal.ws.wsdl.document.Output; -import com.sun.tools.internal.ws.wsdl.document.Port; -import com.sun.tools.internal.ws.wsdl.document.PortType; -import com.sun.tools.internal.ws.wsdl.document.Service; -import com.sun.tools.internal.ws.wsdl.document.WSDLConstants; -import com.sun.tools.internal.ws.wsdl.document.WSDLDocument; -import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; -import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds; -import com.sun.tools.internal.ws.wsdl.framework.Entity; -import com.sun.tools.internal.ws.wsdl.framework.ParserListener; -import com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl; -import com.sun.xml.internal.ws.util.ServiceFinder; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * A parser for WSDL documents. This parser is used only at the tool time. - * Extensions should extend TWSDLExtensionHandler, so that it will be called during - * parsing wsdl to handle wsdl extenisbility elements. Generally these extensions - * will effect the artifacts generated during WSDL processing. - * - * @see com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser which will be used for WSDL parsing - * at runtime. - * - * @author WS Development Team - */ -public class WSDLParser { - private final ErrorReceiverFilter errReceiver; - private WsimportOptions options; - private MetadataFinder forest; - - //wsdl extension handlers - private final Map extensionHandlers; - - private ArrayList listeners; - - public WSDLParser(WsimportOptions options, ErrorReceiverFilter errReceiver) { - this.extensionHandlers = new HashMap(); - this.options = options; - this.errReceiver = errReceiver; - - // register handlers for default extensions - register(new SOAPExtensionHandler(extensionHandlers)); - register(new HTTPExtensionHandler(extensionHandlers)); - register(new MIMEExtensionHandler(extensionHandlers)); - register(new JAXWSBindingExtensionHandler(extensionHandlers)); - register(new SOAP12ExtensionHandler(extensionHandlers)); - register(new MemberSubmissionAddressingExtensionHandler(extensionHandlers, errReceiver)); - register(new W3CAddressingExtensionHandler(extensionHandlers, errReceiver)); - - for (TWSDLExtensionHandler te : ServiceFinder.find(TWSDLExtensionHandler.class)) { - register(te); - } - - } - - private void register(TWSDLExtensionHandler h) { - extensionHandlers.put(h.getNamespaceURI(), h); - } - - public void addParserListener(ParserListener l) { - if (listeners == null) { - listeners = new ArrayList(); - } - listeners.add(l); - } - - public WSDLDocument parse() throws SAXException, IOException { - forest = new MetadataFinder(new WSDLInternalizationLogic(), options, errReceiver); - forest.parseWSDL(); - if(forest.isMexMetadata) - errReceiver.reset(); - - // parse external binding files - for (InputSource value : options.getWSDLBindings()) { - errReceiver.pollAbort(); - Document root = forest.parse(value, false); - if(root==null) continue; // error must have been reported - Element binding = root.getDocumentElement(); - if (!fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) - || !binding.getLocalName().equals("bindings")){ - errReceiver.error(forest.locatorTable.getStartLocation(binding), WsdlMessages.PARSER_NOT_A_BINDING_FILE( - binding.getNamespaceURI(), - binding.getLocalName())); - continue; - } - - NodeList nl = binding.getElementsByTagNameNS( - "http://java.sun.com/xml/ns/javaee", "handler-chains"); - for(int i = 0; i < nl.getLength(); i++){ - options.addHandlerChainConfiguration((Element) nl.item(i)); - } - - } - return buildWSDLDocument(); - } - - private String fixNull(String s) { - if(s==null) return ""; - else return s; - } - - public MetadataFinder getDOMForest() { - return forest; - } - - private WSDLDocument buildWSDLDocument(){ - /** - * Currently we are working off first WSDL document - * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents - */ - - String location = forest.getRootWSDL(); - - //It means that WSDL is not found, an error might have been reported, lets try to recover - if(location == null) - return null; - - Document root = forest.get(location); - - if(root == null) - return null; - - WSDLDocument document = new WSDLDocument(forest, errReceiver); - document.setSystemId(location); - TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver); - - Definitions definitions = parseDefinitions(context, root); - document.setDefinitions(definitions); - return document; - } - - private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) { - context.pushWSDLLocation(); - context.setWSDLLocation(context.getDocument().getSystemId()); - - new Internalizer(forest, options, errReceiver).transform(); - - //print the wsdl -// try{ -// forest.dump(System.out); -// }catch(IOException e){ -// e.printStackTrace(); -// } - - Definitions definitions = parseDefinitionsNoImport(context, root); - if(definitions == null){ - Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement()); - errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId())); - - } - processImports(context); - context.popWSDLLocation(); - return definitions; - } - - private void processMexDocs(TWSDLParserContextImpl context){ - for(String location : forest.listSystemIDs()){ - if (!context.getDocument().isImportedDocument(location)){ - Document doc = forest.get(location); - if(doc == null) - continue; - Definitions importedDefinitions = parseDefinitionsNoImport(context, doc); - if(importedDefinitions == null) - continue; - context.getDocument().addImportedEntity(importedDefinitions); - context.getDocument().addImportedDocument(location); - } - } - } - private void processImports(TWSDLParserContextImpl context) { - for(String location : forest.getExternalReferences()){ - if (!context.getDocument().isImportedDocument(location)){ - Document doc = forest.get(location); - if(doc == null) - continue; - Definitions importedDefinitions = parseDefinitionsNoImport(context, doc); - if(importedDefinitions == null) - continue; - context.getDocument().addImportedEntity(importedDefinitions); - context.getDocument().addImportedDocument(location); - } - } - } - - private Definitions parseDefinitionsNoImport( - TWSDLParserContextImpl context, - Document doc) { - Element e = doc.getDocumentElement(); - //at this poinjt we expect a wsdl or schema document to be fully qualified - if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){ - return null; - } - context.push(); - context.registerNamespaces(e); - - Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e)); - String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME); - definitions.setName(name); - - String targetNamespaceURI = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE); - - definitions.setTargetNamespaceURI(targetNamespaceURI); - - boolean gotDocumentation = false; - boolean gotTypes = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - return null; - } - gotDocumentation = true; - if(definitions.getDocumentation() == null) - definitions.setDocumentation(getDocumentationFor(e2)); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) { - if (gotTypes && !options.isExtensionMode()) { - errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS)); - return null; - } - gotTypes = true; - //add all the wsdl:type elements to latter make a list of all the schema elements - // that will be needed to create jaxb model - if(!options.isExtensionMode()) - validateSchemaImports(e2); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) { - Message message = parseMessage(context, definitions, e2); - definitions.add(message); - } else if ( - XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) { - PortType portType = parsePortType(context, definitions, e2); - definitions.add(portType); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) { - Binding binding = parseBinding(context, definitions, e2); - definitions.add(binding); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) { - Service service = parseService(context, definitions, e2); - definitions.add(service); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) { - definitions.add(parseImport(context, definitions, e2)); - } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) { - errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003()); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, definitions, e2)) { - checkNotWsdlRequired(e2); - } - } - } - - context.pop(); - context.fireDoneParsingEntity( - WSDLConstants.QNAME_DEFINITIONS, - definitions); - return definitions; - } - - private Message parseMessage( - TWSDLParserContextImpl context, - Definitions definitions, - Element e) { - context.push(); - context.registerNamespaces(e); - Message message = new Message(definitions, forest.locatorTable.getStartLocation(e), errReceiver); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - message.setName(name); - - boolean gotDocumentation = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - Util.fail( - "parsing.onlyOneDocumentationAllowed", - e.getLocalName()); - } - gotDocumentation = true; - message.setDocumentation(getDocumentationFor(e2)); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PART)) { - MessagePart part = parseMessagePart(context, e2); - message.add(part); - } else { - Util.fail( - "parsing.invalidElement", - e2.getTagName(), - e2.getNamespaceURI()); - } - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_MESSAGE, message); - return message; - } - - private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) { - context.push(); - context.registerNamespaces(e); - MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e)); - String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - part.setName(partName); - - String elementAttr = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT); - String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE); - - if (elementAttr != null) { - if (typeAttr != null) { - errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName)); - - } - - part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr)); - part.setDescriptorKind(SchemaKinds.XSD_ELEMENT); - } else if (typeAttr != null) { - part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr)); - part.setDescriptorKind(SchemaKinds.XSD_TYPE); - } else { - // XXX-NOTE - this is wrong; for extensibility purposes, - // any attribute can be specified on a element, so - // we need to put an extensibility hook here - errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName)); - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part); - return part; - } - - private PortType parsePortType( - TWSDLParserContextImpl context, - Definitions definitions, - Element e) { - context.push(); - context.registerNamespaces(e); - PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - portType.setName(name); - - boolean gotDocumentation = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation = true; - if(portType.getDocumentation() == null) - portType.setDocumentation(getDocumentationFor(e2)); - } else if ( - XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) { - Operation op = parsePortTypeOperation(context, e2); - op.setParent(portType); - portType.add(op); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, portType, e2)) { - checkNotWsdlRequired(e2); - } - }/*else { - Util.fail( - "parsing.invalidElement", - e2.getTagName(), - e2.getNamespaceURI()); - }*/ - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType); - return portType; - } - - private Operation parsePortTypeOperation( - TWSDLParserContextImpl context, - Element e) { - context.push(); - context.registerNamespaces(e); - - Operation operation = new Operation(forest.locatorTable.getStartLocation(e)); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - operation.setName(name); - String parameterOrderAttr = - XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARAMETER_ORDER); - operation.setParameterOrder(parameterOrderAttr); - - boolean gotDocumentation = false; - - boolean gotInput = false; - boolean gotOutput = false; - boolean gotFault = false; - boolean inputBeforeOutput = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e2.getLocalName())); - } - gotDocumentation = true; - if(operation.getDocumentation() == null) - operation.setDocumentation(getDocumentationFor(e2)); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_INPUT)) { - if (gotInput) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_TOO_MANY_ELEMENTS(Constants.TAG_INPUT, - Constants.TAG_OPERATION, - name)); - } - - context.push(); - context.registerNamespaces(e2); - Input input = new Input(forest.locatorTable.getStartLocation(e2), errReceiver); - input.setParent(operation); - String messageAttr = - Util.getRequiredAttribute(e2, Constants.ATTR_MESSAGE); - input.setMessage(context.translateQualifiedName(context.getLocation(e2), messageAttr)); - String nameAttr = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME); - input.setName(nameAttr); - operation.setInput(input); - gotInput = true; - if (gotOutput) { - inputBeforeOutput = false; - } - - // check for extensiblity attributes - for (Iterator iter2 = XmlUtil.getAllAttributes(e2); - iter2.hasNext(); - ) { - Attr e3 = (Attr)iter2.next(); - if (e3.getLocalName().equals(Constants.ATTR_MESSAGE) || - e3.getLocalName().equals(Constants.ATTR_NAME)) - continue; - - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlAttribute(e3); - if (!handleExtension(context, input, e3, e2)) { - // ignore the extensiblity attribute - // TODO throw a WARNING - } - } - - // verify that there is at most one child element and it is a documentation element - boolean gotDocumentation2 = false; - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - if (XmlUtil - .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation2) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation2 = true; - input.setDocumentation(getDocumentationFor(e3)); - } else { - errReceiver.error(forest.locatorTable.getStartLocation(e3), WsdlMessages.PARSING_INVALID_ELEMENT(e3.getTagName(), - e3.getNamespaceURI())); - } - } - context.pop(); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OUTPUT)) { - if (gotOutput) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_TOO_MANY_ELEMENTS(Constants.TAG_INPUT, - Constants.TAG_OPERATION, - name)); - } - - context.push(); - context.registerNamespaces(e2); - Output output = new Output(forest.locatorTable.getStartLocation(e2), errReceiver); - output.setParent(operation); - String messageAttr = - Util.getRequiredAttribute(e2, Constants.ATTR_MESSAGE); - output.setMessage(context.translateQualifiedName(context.getLocation(e2), messageAttr)); - String nameAttr = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME); - output.setName(nameAttr); - operation.setOutput(output); - gotOutput = true; - if (gotInput) { - inputBeforeOutput = true; - } - - // check for extensiblity attributes - for (Iterator iter2 = XmlUtil.getAllAttributes(e2); - iter2.hasNext(); - ) { - Attr e3 = (Attr)iter2.next(); - if (e3.getLocalName().equals(Constants.ATTR_MESSAGE) || - e3.getLocalName().equals(Constants.ATTR_NAME)) - continue; - - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlAttribute(e3); - if (!handleExtension(context, output, e3, e2)) { - // ignore the extensiblity attribute - // TODO throw a WARNING - } - } - - // verify that there is at most one child element and it is a documentation element - boolean gotDocumentation2 = false; - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - if (XmlUtil - .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation2) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation2 = true; - output.setDocumentation(getDocumentationFor(e3)); - } else { - errReceiver.error(forest.locatorTable.getStartLocation(e3), WsdlMessages.PARSING_INVALID_ELEMENT(e3.getTagName(), - e3.getNamespaceURI())); - } - } - context.pop(); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_FAULT)) { - context.push(); - context.registerNamespaces(e2); - Fault fault = new Fault(forest.locatorTable.getStartLocation(e2)); - fault.setParent(operation); - String messageAttr = - Util.getRequiredAttribute(e2, Constants.ATTR_MESSAGE); - fault.setMessage(context.translateQualifiedName(context.getLocation(e2), messageAttr)); - String nameAttr = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME); - fault.setName(nameAttr); - operation.addFault(fault); - gotFault = true; - - // check for extensiblity attributes - for (Iterator iter2 = XmlUtil.getAllAttributes(e2); - iter2.hasNext(); - ) { - Attr e3 = (Attr)iter2.next(); - if (e3.getLocalName().equals(Constants.ATTR_MESSAGE) || - e3.getLocalName().equals(Constants.ATTR_NAME)) - continue; - - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlAttribute(e3); - if (!handleExtension(context, fault, e3, e2)) { - // ignore the extensiblity attribute - // TODO throw a WARNING - } - } - - // verify that there is at most one child element and it is a documentation element - boolean gotDocumentation2 = false; - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - if (XmlUtil - .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation2) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation2 = true; - if(fault.getDocumentation() == null) - fault.setDocumentation(getDocumentationFor(e3)); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e3); - if (!handleExtension(context, fault, e3)) { - checkNotWsdlRequired(e3); - } - }/*else { - Util.fail( - "parsing.invalidElement", - e3.getTagName(), - e3.getNamespaceURI()); - }*/ - } - context.pop(); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, operation, e2)) { - checkNotWsdlRequired(e2); - } - }/*else { - Util.fail( - "parsing.invalidElement", - e2.getTagName(), - e2.getNamespaceURI()); - }*/ - } - - if (gotInput && !gotOutput && !gotFault) { - operation.setStyle(OperationStyle.ONE_WAY); - } else if (gotInput && gotOutput && inputBeforeOutput) { - operation.setStyle(OperationStyle.REQUEST_RESPONSE); - } else if (gotInput && gotOutput && !inputBeforeOutput) { - operation.setStyle(OperationStyle.SOLICIT_RESPONSE); - } else if (gotOutput && !gotInput && !gotFault) { - operation.setStyle(OperationStyle.NOTIFICATION); - } else { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_INVALID_OPERATION_STYLE(name)); - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_OPERATION, operation); - return operation; - } - - private Binding parseBinding( - TWSDLParserContextImpl context, - Definitions definitions, - Element e) { - context.push(); - context.registerNamespaces(e); - Binding binding = new Binding(definitions, forest.locatorTable.getStartLocation(e), errReceiver); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - binding.setName(name); - String typeAttr = Util.getRequiredAttribute(e, Constants.ATTR_TYPE); - binding.setPortType(context.translateQualifiedName(context.getLocation(e), typeAttr)); - - boolean gotDocumentation = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation = true; - binding.setDocumentation(getDocumentationFor(e2)); - } else if ( - XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) { - BindingOperation op = parseBindingOperation(context, e2); - binding.add(op); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, binding, e2)) { - checkNotWsdlRequired(e2); - } - } - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_BINDING, binding); - return binding; - } - - private BindingOperation parseBindingOperation( - TWSDLParserContextImpl context, - Element e) { - context.push(); - context.registerNamespaces(e); - BindingOperation operation = new BindingOperation(forest.locatorTable.getStartLocation(e)); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - operation.setName(name); - - boolean gotDocumentation = false; - - boolean gotInput = false; - boolean gotOutput = false; - boolean gotFault = false; - boolean inputBeforeOutput = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation = true; - operation.setDocumentation(getDocumentationFor(e2)); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_INPUT)) { - if (gotInput) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_TOO_MANY_ELEMENTS(Constants.TAG_INPUT, - Constants.TAG_OPERATION, - name)); - } - - /* Here we check for the use scenario */ - Iterator itere2 = XmlUtil.getAllChildren(e2); - context.push(); - context.registerNamespaces(e2); - BindingInput input = new BindingInput(forest.locatorTable.getStartLocation(e2)); - String nameAttr = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME); - input.setName(nameAttr); - operation.setInput(input); - gotInput = true; - if (gotOutput) { - inputBeforeOutput = false; - } - - // verify that there is at most one child element and it is a documentation element - boolean gotDocumentation2 = false; - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - if (XmlUtil - .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation2) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation2 = true; - input.setDocumentation(getDocumentationFor(e3)); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e3); - if (!handleExtension(context, input, e3)) { - checkNotWsdlRequired(e3); - } - } - } - context.pop(); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OUTPUT)) { - if (gotOutput) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_TOO_MANY_ELEMENTS(Constants.TAG_INPUT, - Constants.TAG_OPERATION, - name)); - } - - context.push(); - context.registerNamespaces(e2); - BindingOutput output = new BindingOutput(forest.locatorTable.getStartLocation(e2)); - String nameAttr = - XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME); - output.setName(nameAttr); - operation.setOutput(output); - gotOutput = true; - if (gotInput) { - inputBeforeOutput = true; - } - - // verify that there is at most one child element and it is a documentation element - boolean gotDocumentation2 = false; - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - if (XmlUtil - .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation2) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation2 = true; - output.setDocumentation(getDocumentationFor(e3)); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e3); - if (!handleExtension(context, output, e3)) { - checkNotWsdlRequired(e3); - } - } - } - context.pop(); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_FAULT)) { - context.push(); - context.registerNamespaces(e2); - BindingFault fault = new BindingFault(forest.locatorTable.getStartLocation(e2)); - String nameAttr = - Util.getRequiredAttribute(e2, Constants.ATTR_NAME); - fault.setName(nameAttr); - operation.addFault(fault); - gotFault = true; - - // verify that there is at most one child element and it is a documentation element - boolean gotDocumentation2 = false; - for (Iterator iter2 = XmlUtil.getAllChildren(e2); - iter2.hasNext(); - ) { - Element e3 = Util.nextElement(iter2); - if (e3 == null) - break; - - if (XmlUtil - .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation2) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation2 = true; - if(fault.getDocumentation() == null) - fault.setDocumentation(getDocumentationFor(e3)); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e3); - if (!handleExtension(context, fault, e3)) { - checkNotWsdlRequired(e3); - } - } - } - context.pop(); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, operation, e2)) { - checkNotWsdlRequired(e2); - } - } - } - - if (gotInput && !gotOutput && !gotFault) { - operation.setStyle(OperationStyle.ONE_WAY); - } else if (gotInput && gotOutput && inputBeforeOutput) { - operation.setStyle(OperationStyle.REQUEST_RESPONSE); - } else if (gotInput && gotOutput && !inputBeforeOutput) { - operation.setStyle(OperationStyle.SOLICIT_RESPONSE); - } else if (gotOutput && !gotInput && !gotFault) { - operation.setStyle(OperationStyle.NOTIFICATION); - } else { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_INVALID_OPERATION_STYLE(name)); - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_OPERATION, operation); - return operation; - } - - private Import parseImport( - TWSDLParserContextImpl context, - Definitions definitions, - Element e) { - context.push(); - context.registerNamespaces(e); - Import anImport = new Import(forest.locatorTable.getStartLocation(e)); - String namespace = - Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE); - anImport.setNamespace(namespace); - String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION); - anImport.setLocation(location); - - // according to the schema in the WSDL 1.1 spec, an import can have a documentation element - boolean gotDocumentation = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation = true; - anImport.setDocumentation(getDocumentationFor(e2)); - } else { - errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(), - e2.getNamespaceURI())); - } - } - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport); - return anImport; - } - - private Service parseService( - TWSDLParserContextImpl context, - Definitions definitions, - Element e) { - context.push(); - context.registerNamespaces(e); - Service service = new Service(definitions, forest.locatorTable.getStartLocation(e), errReceiver); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - service.setName(name); - - boolean gotDocumentation = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation = true; - if(service.getDocumentation() == null) - service.setDocumentation(getDocumentationFor(e2)); - } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT)) { - Port port = parsePort(context, definitions, e2); - service.add(port); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, service, e2)) { - checkNotWsdlRequired(e2); - } - } - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_SERVICE, service); - return service; - } - - private Port parsePort( - TWSDLParserContextImpl context, - Definitions definitions, - Element e) { - context.push(); - context.registerNamespaces(e); - - Port port = new Port(definitions, forest.locatorTable.getStartLocation(e), errReceiver); - String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); - port.setName(name); - - String bindingAttr = - Util.getRequiredAttribute(e, Constants.ATTR_BINDING); - port.setBinding(context.translateQualifiedName(context.getLocation(e), bindingAttr)); - - boolean gotDocumentation = false; - - for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { - Element e2 = Util.nextElement(iter); - if (e2 == null) - break; - - if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { - if (gotDocumentation) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); - } - gotDocumentation = true; - if(port.getDocumentation() == null) - port.setDocumentation(getDocumentationFor(e2)); - } else { - // possible extensibility element -- must live outside the WSDL namespace - checkNotWsdlElement(e2); - if (!handleExtension(context, port, e2)) { - checkNotWsdlRequired(e2); - } - } - } - - context.pop(); - context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT, port); - return port; - } - - private void validateSchemaImports(Element typesElement){ - for (Iterator iter = XmlUtil.getAllChildren(typesElement); iter.hasNext();) { - Element e = Util.nextElement(iter); - if (e == null) - break; - if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_IMPORT)) { - errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.WARNING_WSI_R_2003()); - }else{ - checkNotWsdlElement(e); -// if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_SCHEMA)) { -// forest.getInlinedSchemaElement().add(e); -// } - - } - } - } - - - private boolean handleExtension( - TWSDLParserContextImpl context, - TWSDLExtensible entity, - Element e) { - TWSDLExtensionHandler h = - (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI()); - if (h == null) { - context.fireIgnoringExtension(e, (Entity) entity); - return false; - } else { - return h.doHandleExtension(context, entity, e); - } - } - - private boolean handleExtension( - TWSDLParserContextImpl context, - TWSDLExtensible entity, - Node n, - Element e) { - TWSDLExtensionHandler h = - (TWSDLExtensionHandler) extensionHandlers.get(n.getNamespaceURI()); - if (h == null) { - context.fireIgnoringExtension(e, (Entity) entity); - return false; - } else { - return h.doHandleExtension(context, entity, e); - } - } - - private void checkNotWsdlElement(Element e) { - // possible extensibility element -- must live outside the WSDL namespace - if (e.getNamespaceURI() != null && e.getNamespaceURI().equals(Constants.NS_WSDL)) - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_INVALID_WSDL_ELEMENT(e.getTagName())); - } - - private void checkNotWsdlAttribute(Attr a) { - // possible extensibility element -- must live outside the WSDL namespace - if (a.getNamespaceURI().equals(Constants.NS_WSDL)) - errReceiver.error(forest.locatorTable.getStartLocation(a.getOwnerElement()), WsdlMessages.PARSING_INVALID_WSDL_ELEMENT(a.getLocalName())); - } - - private void checkNotWsdlRequired(Element e) { - // check the wsdl:required attribute, fail if set to "true" - String required = - XmlUtil.getAttributeNSOrNull( - e, - Constants.ATTR_REQUIRED, - Constants.NS_WSDL); - if (required != null && required.equals(Constants.TRUE) && !options.isExtensionMode()) { - errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_REQUIRED_EXTENSIBILITY_ELEMENT(e.getTagName(), - e.getNamespaceURI())); - } - } - - private Documentation getDocumentationFor(Element e) { - String s = XmlUtil.getTextForNode(e); - if (s == null) { - return null; - } else { - return new Documentation(s); - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WhitespaceStripper.java b/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WhitespaceStripper.java deleted file mode 100644 index bbeed9c2fa8..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/ws/wsdl/parser/WhitespaceStripper.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package com.sun.tools.internal.ws.wsdl.parser; - -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import org.xml.sax.*; -import org.xml.sax.helpers.XMLFilterImpl; - -/** - * Strips ignorable whitespace from SAX event stream. - * - *

    - * This filter works only when the event stream doesn't - * contain any mixed content. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * Vivek Pandey - */ -class WhitespaceStripper extends XMLFilterImpl { - - private int state = 0; - - private char[] buf = new char[1024]; - private int bufLen = 0; - - private static final int AFTER_START_ELEMENT = 1; - private static final int AFTER_END_ELEMENT = 2; - - public WhitespaceStripper(XMLReader reader) { - setParent(reader); - } - - public WhitespaceStripper(ContentHandler handler, ErrorHandler eh, EntityResolver er) { - setContentHandler(handler); - if(eh!=null) setErrorHandler(eh); - if(er!=null) setEntityResolver(er); - } - - public void characters(char[] ch, int start, int length) throws SAXException { - switch(state) { - case AFTER_START_ELEMENT: - // we have to store the characters here, even if it consists entirely - // of whitespaces. This is because successive characters event might - // include non-whitespace char, in which case all the whitespaces in - // this event may suddenly become significant. - if( bufLen+length>buf.length ) { - // reallocate buffer - char[] newBuf = new char[Math.max(bufLen+length,buf.length*2)]; - System.arraycopy(buf,0,newBuf,0,bufLen); - buf = newBuf; - } - System.arraycopy(ch,start,buf,bufLen,length); - bufLen += length; - break; - case AFTER_END_ELEMENT: - // check if this is ignorable. - int len = start+length; - for( int i=start; i=0; i-- ) - if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) { - super.characters(buf, 0, bufLen); - return; - } - } - } - - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - // ignore completely. - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/AbortException.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/AbortException.java deleted file mode 100644 index e95f5b4b84c..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/AbortException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * Use is subject to the license terms. - */ -package com.sun.tools.internal.xjc; - - -/** - * Signals the abortion of the compilation. - *

    - * This exception should be only thrown from {@link ErrorReceiver} - * for the consistent error handling. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class AbortException extends RuntimeException { - public AbortException() { - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/BadCommandLineException.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/BadCommandLineException.java deleted file mode 100644 index 4be6b4f5f09..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/BadCommandLineException.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.xjc; - -import com.sun.istack.internal.Nullable; - -/** - * Signals a bad command line argument. - */ -public class BadCommandLineException extends Exception { - private Options options; - - public BadCommandLineException(String msg) { - super(msg); - } - - public BadCommandLineException(String message, Throwable cause) { - super(message, cause); - } - - public BadCommandLineException() { - this(null); - } - - public void initOptions(Options opt) { - assert this.options==null; - this.options = opt; - } - - /** - * Gets the partly parsed option object, if any. - */ - public @Nullable Options getOptions() { - return options; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/ClassLoaderBuilder.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/ClassLoaderBuilder.java deleted file mode 100644 index 97886bad4a9..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/ClassLoaderBuilder.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.xjc; - -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.bind.JAXBContext; - -import com.sun.istack.internal.tools.MaskingClassLoader; -import com.sun.istack.internal.tools.ParallelWorldClassLoader; - -/** - * Creates a class loader configured to run XJC 1.0/2.0 safely without - * interference with JAXB 2.0 API in Mustang. - * - * @author Kohsuke Kawaguchi - */ -class ClassLoaderBuilder { - - /** - * Creates a new class loader that eventually delegates to the given {@link ClassLoader} - * such that XJC can be loaded by using this classloader. - * - * @param v - * Either "1.0" or "2.0", indicating the version of the -source value. - */ - protected static ClassLoader createProtectiveClassLoader(ClassLoader cl, String v) throws ClassNotFoundException, MalformedURLException { - if(noHack) return cl; // provide an escape hatch - - boolean mustang = false; - - if(JAXBContext.class.getClassLoader()==null) { - // JAXB API is loaded from the bootstrap. We need to override one with ours - mustang = true; - - List mask = new ArrayList(Arrays.asList(maskedPackages)); - mask.add("javax.xml.bind."); - - cl = new MaskingClassLoader(cl,mask); - - URL apiUrl = cl.getResource("javax/xml/bind/annotation/XmlSeeAlso.class"); - if(apiUrl==null) - throw new ClassNotFoundException("There's no JAXB 2.1 API in the classpath"); - - cl = new URLClassLoader(new URL[]{ParallelWorldClassLoader.toJarUrl(apiUrl)},cl); - } - - //Leave XJC2 in the publicly visible place - // and then isolate XJC1 in a child class loader, - // then use a MaskingClassLoader - // so that the XJC2 classes in the parent class loader - // won't interfere with loading XJC1 classes in a child class loader - - if (v.equals("1.0")) { - if(!mustang) - // if we haven't used Masking ClassLoader, do so now. - cl = new MaskingClassLoader(cl,toolPackages); - cl = new ParallelWorldClassLoader(cl,"1.0/"); - } else { - if(mustang) - // the whole RI needs to be loaded in a separate class loader - cl = new ParallelWorldClassLoader(cl,""); - } - - return cl; - } - - - /** - * The list of package prefixes we want the - * {@link MaskingClassLoader} to prevent the parent - * classLoader from loading - */ - private static String[] maskedPackages = new String[]{ - // toolPackages + alpha - "com.sun.tools.", - "com.sun.codemodel.internal.", - "com.sun.relaxng.", - "com.sun.xml.internal.xsom.", - "com.sun.xml.internal.bind.", - }; - - private static String[] toolPackages = new String[]{ - "com.sun.tools.", - "com.sun.codemodel.internal.", - "com.sun.relaxng.", - "com.sun.xml.internal.xsom." - }; - - /** - * Escape hatch in case this class loader hack breaks. - */ - public static final boolean noHack = Boolean.getBoolean(XJCFacade.class.getName()+".nohack"); -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/ConsoleErrorReporter.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/ConsoleErrorReporter.java deleted file mode 100644 index a65f69c4424..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/ConsoleErrorReporter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.xjc; - -import java.io.OutputStream; -import java.io.PrintStream; - -import org.xml.sax.SAXParseException; - -/** - * {@link ErrorReceiver} that prints to a {@link PrintStream}. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class ConsoleErrorReporter extends ErrorReceiver { - - /** - * Errors, warnings are sent to this output. - */ - private PrintStream output; - - private boolean hadError = false; - - public ConsoleErrorReporter( PrintStream out) { - this.output = out; - } - public ConsoleErrorReporter( OutputStream out ) { - this(new PrintStream(out)); - } - public ConsoleErrorReporter() { this(System.out); } - - public void warning(SAXParseException e) { - print(Messages.WARNING_MSG,e); - } - - public void error(SAXParseException e) { - hadError = true; - print(Messages.ERROR_MSG,e); - } - - public void fatalError(SAXParseException e) { - hadError = true; - print(Messages.ERROR_MSG,e); - } - - public void info(SAXParseException e) { - print(Messages.INFO_MSG,e); - } - - public boolean hadError() { - return hadError; - } - - private void print( String resource, SAXParseException e ) { - output.println(Messages.format(resource,e.getMessage())); - output.println(getLocationString(e)); - output.println(); - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/Driver.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/Driver.java deleted file mode 100644 index b3c9c097c37..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/Driver.java +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package com.sun.tools.internal.xjc; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.util.Iterator; - -import com.sun.codemodel.internal.CodeWriter; -import com.sun.codemodel.internal.JCodeModel; -import com.sun.codemodel.internal.writer.ZipCodeWriter; -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.tools.internal.xjc.generator.bean.BeanGenerator; -import com.sun.tools.internal.xjc.model.Model; -import com.sun.tools.internal.xjc.outline.Outline; -import com.sun.tools.internal.xjc.reader.gbind.Expression; -import com.sun.tools.internal.xjc.reader.gbind.Graph; -import com.sun.tools.internal.xjc.reader.internalizer.DOMForest; -import com.sun.tools.internal.xjc.reader.xmlschema.ExpressionBuilder; -import com.sun.tools.internal.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic; -import com.sun.tools.internal.xjc.util.ErrorReceiverFilter; -import com.sun.tools.internal.xjc.util.NullStream; -import com.sun.tools.internal.xjc.util.Util; -import com.sun.tools.internal.xjc.writer.SignatureWriter; -import com.sun.xml.internal.xsom.XSComplexType; -import com.sun.xml.internal.xsom.XSParticle; -import com.sun.xml.internal.xsom.XSSchemaSet; - -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - - -/** - * CUI of XJC. - */ -public class Driver { - - public static void main(final String[] args) throws Exception { - // use the platform default proxy if available. - // see sun.net.spi.DefaultProxySelector for details. - try { - System.setProperty("java.net.useSystemProxies","true"); - } catch (SecurityException e) { - // failing to set this property isn't fatal - } - - if( Util.getSystemProperty(Driver.class,"noThreadSwap")!=null ) - _main(args); // for the ease of debugging - - // run all the work in another thread so that the -Xss option - // will take effect when compiling a large schema. See - // http://developer.java.sun.com/developer/bugParade/bugs/4362291.html - final Throwable[] ex = new Throwable[1]; - - Thread th = new Thread() { - public void run() { - try { - _main(args); - } catch( Throwable e ) { - ex[0]=e; - } - } - }; - th.start(); - th.join(); - - if(ex[0]!=null) { - // re-throw - if( ex[0] instanceof Exception ) - throw (Exception)ex[0]; - else - throw (Error)ex[0]; - } - } - - private static void _main( String[] args ) throws Exception { - try { - System.exit(run( args, System.out, System.out )); - } catch (BadCommandLineException e) { - // there was an error in the command line. - // print usage and abort. - if(e.getMessage()!=null) { - System.out.println(e.getMessage()); - System.out.println(); - } - - usage(e.getOptions(),false); - System.exit(-1); - } - } - - - - /** - * Performs schema compilation and prints the status/error into the - * specified PrintStream. - * - *

    - * This method could be used to trigger XJC from other tools, - * such as Ant or IDE. - * - * @param args - * specified command line parameters. If there is an error - * in the parameters, {@link BadCommandLineException} will - * be thrown. - * @param status - * Status report of the compilation will be sent to this object. - * Useful to update users so that they will know something is happening. - * Only ignorable messages should be sent to this stream. - * - * This parameter can be null to suppress messages. - * - * @param out - * Various non-ignorable output (error messages, etc) - * will go to this stream. - * - * @return - * If the compiler runs successfully, this method returns 0. - * All non-zero values indicate an error. The error message - * will be sent to the specified PrintStream. - */ - public static int run(String[] args, final PrintStream status, final PrintStream out) - throws Exception { - - class Listener extends XJCListener { - ConsoleErrorReporter cer = new ConsoleErrorReporter(out==null?new PrintStream(new NullStream()):out); - - public void generatedFile(String fileName, int count, int total) { - message(fileName); - } - public void message(String msg) { - if(status!=null) - status.println(msg); - } - - public void error(SAXParseException exception) { - cer.error(exception); - } - - public void fatalError(SAXParseException exception) { - cer.fatalError(exception); - } - - public void warning(SAXParseException exception) { - cer.warning(exception); - } - - public void info(SAXParseException exception) { - cer.info(exception); - } - } - - return run(args,new Listener()); - } - - /** - * Performs schema compilation and prints the status/error into the - * specified PrintStream. - * - *

    - * This method could be used to trigger XJC from other tools, - * such as Ant or IDE. - * - * @param args - * specified command line parameters. If there is an error - * in the parameters, {@link BadCommandLineException} will - * be thrown. - * @param listener - * Receives messages from XJC reporting progress/errors. - * - * @return - * If the compiler runs successfully, this method returns 0. - * All non-zero values indicate an error. The error message - * will be sent to the specified PrintStream. - */ - public static int run(String[] args, @NotNull final XJCListener listener) throws BadCommandLineException { - - // recognize those special options before we start parsing options. - for (String arg : args) { - if (arg.equals("-version")) { - listener.message(Messages.format(Messages.VERSION)); - return -1; - } - } - - final OptionsEx opt = new OptionsEx(); - opt.setSchemaLanguage(Language.XMLSCHEMA); // disable auto-guessing - try { - opt.parseArguments(args); - } catch (WeAreDone _) { - return -1; - } catch(BadCommandLineException e) { - e.initOptions(opt); - throw e; - } - - // display a warning if the user specified the default package - // this should work, but is generally a bad idea - if(opt.defaultPackage != null && opt.defaultPackage.length()==0) { - listener.message(Messages.format(Messages.WARNING_MSG, Messages.format(Messages.DEFAULT_PACKAGE_WARNING))); - } - - - // set up the context class loader so that the user-specified classes - // can be loaded from there - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader( - opt.getUserClassLoader(contextClassLoader)); - - // parse a grammar file - //----------------------------------------- - try { - if( !opt.quiet ) { - listener.message(Messages.format(Messages.PARSING_SCHEMA)); - } - - final boolean[] hadWarning = new boolean[1]; - - ErrorReceiver receiver = new ErrorReceiverFilter(listener) { - public void info(SAXParseException exception) { - if(opt.verbose) - super.info(exception); - } - public void warning(SAXParseException exception) { - hadWarning[0] = true; - if(!opt.quiet) - super.warning(exception); - } - @Override - public void pollAbort() throws AbortException { - if(listener.isCanceled()) - throw new AbortException(); - } - }; - - if( opt.mode==Mode.FOREST ) { - // dump DOM forest and quit - ModelLoader loader = new ModelLoader( opt, new JCodeModel(), receiver ); - try { - DOMForest forest = loader.buildDOMForest(new XMLSchemaInternalizationLogic()); - forest.dump(System.out); - return 0; - } catch (SAXException e) { - // the error should have already been reported - } catch (IOException e) { - receiver.error(e); - } - - return -1; - } - - if( opt.mode==Mode.GBIND ) { - try { - XSSchemaSet xss = new ModelLoader(opt, new JCodeModel(), receiver).loadXMLSchema(); - Iterator it = xss.iterateComplexTypes(); - while (it.hasNext()) { - XSComplexType ct = it.next(); - XSParticle p = ct.getContentType().asParticle(); - if(p==null) continue; - - Expression tree = ExpressionBuilder.createTree(p); - System.out.println("Graph for "+ct.getName()); - System.out.println(tree.toString()); - Graph g = new Graph(tree); - System.out.println(g.toString()); - System.out.println(); - } - return 0; - } catch (SAXException e) { - // the error should have already been reported - } - return -1; - } - - Model model = ModelLoader.load( opt, new JCodeModel(), receiver ); - - if (model == null) { - listener.message(Messages.format(Messages.PARSE_FAILED)); - return -1; - } - - if( !opt.quiet ) { - listener.message(Messages.format(Messages.COMPILING_SCHEMA)); - } - - switch (opt.mode) { - case SIGNATURE : - try { - SignatureWriter.write( - BeanGenerator.generate(model,receiver), - new OutputStreamWriter(System.out)); - return 0; - } catch (IOException e) { - receiver.error(e); - return -1; - } - - case CODE : - case DRYRUN : - case ZIP : - { - // generate actual code - receiver.debug("generating code"); - {// don't want to hold outline in memory for too long. - Outline outline = model.generateCode(opt,receiver); - if(outline==null) { - listener.message( - Messages.format(Messages.FAILED_TO_GENERATE_CODE)); - return -1; - } - - listener.compiled(outline); - } - - if( opt.mode == Mode.DRYRUN ) - break; // enough - - // then print them out - try { - CodeWriter cw; - if( opt.mode==Mode.ZIP ) { - OutputStream os; - if(opt.targetDir.getPath().equals(".")) - os = System.out; - else - os = new FileOutputStream(opt.targetDir); - - cw = opt.createCodeWriter(new ZipCodeWriter(os)); - } else - cw = opt.createCodeWriter(); - - if( !opt.quiet ) { - cw = new ProgressCodeWriter(cw,listener, model.codeModel.countArtifacts()); - } - model.codeModel.build(cw); - } catch (IOException e) { - receiver.error(e); - return -1; - } - - break; - } - default : - assert false; - } - - if(opt.debugMode) { - try { - new FileOutputStream(new File(opt.targetDir,hadWarning[0]?"hadWarning":"noWarning")).close(); - } catch (IOException e) { - receiver.error(e); - return -1; - } - } - - return 0; - } catch( StackOverflowError e ) { - if(opt.verbose) - // in the debug mode, propagate the error so that - // the full stack trace will be dumped to the screen. - throw e; - else { - // otherwise just print a suggested workaround and - // quit without filling the user's screen - listener.message(Messages.format(Messages.STACK_OVERFLOW)); - return -1; - } - } - } - - public static String getBuildID() { - return Messages.format(Messages.BUILD_ID); - } - - - /** - * Operation mode. - */ - private static enum Mode { - // normal mode. compile the code - CODE, - - // dump the signature of the generated code - SIGNATURE, - - // dump DOMForest - FOREST, - - // same as CODE but don't produce any Java source code - DRYRUN, - - // same as CODE but pack all the outputs into a zip and dumps to stdout - ZIP, - - // testing a new binding mode - GBIND - } - - - /** - * Command-line arguments processor. - * - *

    - * This class contains options that only make sense - * for the command line interface. - */ - static class OptionsEx extends Options - { - /** Operation mode. */ - protected Mode mode = Mode.CODE; - - /** A switch that determines the behavior in the BGM mode. */ - public boolean noNS = false; - - /** Parse XJC-specific options. */ - public int parseArgument(String[] args, int i) throws BadCommandLineException { - if (args[i].equals("-noNS")) { - noNS = true; - return 1; - } - if (args[i].equals("-mode")) { - i++; - if (i == args.length) - throw new BadCommandLineException( - Messages.format(Messages.MISSING_MODE_OPERAND)); - - String mstr = args[i].toLowerCase(); - - for( Mode m : Mode.values() ) { - if(m.name().toLowerCase().startsWith(mstr) && mstr.length()>2) { - mode = m; - return 2; - } - } - - throw new BadCommandLineException( - Messages.format(Messages.UNRECOGNIZED_MODE, args[i])); - } - if (args[i].equals("-help")) { - usage(this,false); - throw new WeAreDone(); - } - if (args[i].equals("-private")) { - usage(this,true); - throw new WeAreDone(); - } - - return super.parseArgument(args, i); - } - } - - /** - * Used to signal that we've finished processing. - */ - private static final class WeAreDone extends BadCommandLineException {} - - - /** - * Prints the usage screen and exits the process. - * - * @param opts - * If the parsing of options have started, set a partly populated - * {@link Options} object. - */ - public static void usage( @Nullable Options opts, boolean privateUsage ) { - if( privateUsage ) { - System.out.println(Messages.format(Messages.DRIVER_PRIVATE_USAGE)); - } else { - System.out.println(Messages.format(Messages.DRIVER_PUBLIC_USAGE)); - } - - if( opts!=null && opts.getAllPlugins().size()!=0 ) { - System.out.println(Messages.format(Messages.ADDON_USAGE)); - for (Plugin p : opts.getAllPlugins()) { - System.out.println(p.getUsage()); - } - } - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/ErrorReceiver.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/ErrorReceiver.java deleted file mode 100644 index 53100508410..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/ErrorReceiver.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * Use is subject to the license terms. - */ -package com.sun.tools.internal.xjc; - -import com.sun.istack.internal.SAXParseException2; -import com.sun.tools.internal.xjc.api.ErrorListener; - -import org.xml.sax.ErrorHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXParseException; - -/** - * Implemented by the driver of the compiler engine to handle - * errors found during the compiliation. - * - *

    - * This class implements {@link ErrorHandler} so it can be - * passed to anywhere where {@link ErrorHandler} is expected. - * - *

    - * However, to make the error handling easy (and make it work - * with visitor patterns nicely), - * none of the methods on thi class throws {@link org.xml.sax.SAXException}. - * Instead, when the compilation needs to be aborted, - * it throws {@link AbortException}, which is unchecked. - * - *

    - * This also implements the externally visible {@link ErrorListener} - * so that we can reuse our internal implementation for testing and such. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public abstract class ErrorReceiver implements ErrorHandler, ErrorListener { - -// -// -// convenience methods for callers -// -// - /** - * @param loc - * can be null if the location is unknown - */ - public final void error( Locator loc, String msg ) { - error( new SAXParseException2(msg,loc) ); - } - - public final void error( Locator loc, String msg, Exception e ) { - error( new SAXParseException2(msg,loc,e) ); - } - - public final void error( String msg, Exception e ) { - error( new SAXParseException2(msg,null,e) ); - } - - public void error(Exception e) { - error(e.getMessage(),e); - } - - /** - * @param loc - * can be null if the location is unknown - */ - public final void warning( Locator loc, String msg ) { - warning( new SAXParseException(msg,loc) ); - } - -// -// -// ErrorHandler implementation, but can't throw SAXException -// -// - public abstract void error(SAXParseException exception) throws AbortException; - public abstract void fatalError(SAXParseException exception) throws AbortException; - public abstract void warning(SAXParseException exception) throws AbortException; - - /** - * This method will be invoked periodically to allow {@link AbortException} - * to be thrown, especially when this is driven by some kind of GUI. - */ - public void pollAbort() throws AbortException { - } - - /** - * Reports verbose messages to users. - * - * This method can be used to report additional non-essential - * messages. The implementation usually discards them - * unless some specific debug option is turned on. - */ - public abstract void info(SAXParseException exception) /*REVISIT:throws AbortException*/; - - /** - * Reports a debug message to users. - * - * @see #info(SAXParseException) - */ - public final void debug( String msg ) { - info( new SAXParseException(msg,null) ); - } - -// -// -// convenience methods for derived classes -// -// - - /** - * Returns the human readable string representation of the - * {@link org.xml.sax.Locator} part of the specified - * {@link SAXParseException}. - * - * @return non-null valid object. - */ - protected final String getLocationString( SAXParseException e ) { - if(e.getLineNumber()!=-1 || e.getSystemId()!=null) { - int line = e.getLineNumber(); - return Messages.format( Messages.LINE_X_OF_Y, - line==-1?"?":Integer.toString( line ), - getShortName( e.getSystemId() ) ); - } else { - return Messages.format( Messages.UNKNOWN_LOCATION ); - } - } - - /** Computes a short name of a given URL for display. */ - private String getShortName( String url ) { - if(url==null) - return Messages.format( Messages.UNKNOWN_FILE ); - -// sometimes the user deals with a set of schems that reference each other -// in a complicated way, and end up importing two versions of the same schema. -// just printing the file name makes it very difficult to recognize of this problem. -// so I decided to change it back to print the full URL. - -// int idx; -// -// // system Id can be URL, so we can't use File.separator -// idx = url.lastIndexOf('/'); -// if(idx!=-1) return url.substring(idx+1); -// idx = url.lastIndexOf('\\'); -// if(idx!=-1) return url.substring(idx+1); - - return url; - } -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/Language.java b/jaxws/src/share/classes/com/sun/tools/internal/xjc/Language.java deleted file mode 100644 index 48e385ba417..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/Language.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.tools.internal.xjc; - -/** - * Type of the schema language. - */ -public enum Language { - DTD, - XMLSCHEMA, - RELAXNG, - RELAXNG_COMPACT, - WSDL -} diff --git a/jaxws/src/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties b/jaxws/src/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties deleted file mode 100644 index 216fdc0693a..00000000000 --- a/jaxws/src/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties +++ /dev/null @@ -1,249 +0,0 @@ -# -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -ConsoleErrorReporter.UnknownLocation = \ - unknown location - -ConsoleErrorReporter.LineXOfY = \ - \ \ line {0} of {1} - -ConsoleErrorReporter.UnknownFile = \ - unknown file - -Driver.Private.Usage = \ -Usage: xjc [-options ...] ... [-b ] ...\n\ -If dir is specified, all schema files in it will be compiled.\n\ -If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled.\n\ -Options:\n\ -\ \ -debug : run in debug mode (includes -verbose)\n\ -\ \ -nv : do not perform strict validation of the input schema(s)\n\ -\ \ -extension : allow vendor extensions - do not strictly follow the\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Compatibility Rules and App E.2 from the JAXB Spec\n\ -\ \ -mode : run XJC in other running mode\n\ -\ \ -b : specify external bindings files (each must have its own -b)\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ If a directory is given, **/*.xjb is searched\n\ -\ \ -d

    : generated files will go into this directory\n\ -\ \ -httpproxy : set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost:proxyPort\n\ -\ \ -httpproxyfile : Works like -httpproxy but takes the argument in a file to protect password \n\ -\ \ -classpath : specify where to find user class files\n\ -\ \ -catalog : specify catalog files to resolve external entity references\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ support TR9401, XCatalog, and OASIS XML Catalog format.\n\ -\ \ -readOnly : generated files will be in read-only mode\n\ -\ \ -npa : suppress generation of package level annotations (**/package-info.java)\n\ -\ \ -no-header : suppress generation of a file header with timestamp\n\ -\ \ -target 2.0 : behave like XJC 2.0 and generate code that doesn't use any 2.1 features.\n\ -\ \ -private : display this help message\n\ -\ \ -xmlschema : treat input as W3C XML Schema (default)\n\ -\ \ -relaxng : treat input as RELAX NG (experimental,unsupported)\n\ -\ \ -relaxng-compact : treat input as RELAX NG compact syntax (experimental,unsupported)\n\ -\ \ -dtd : treat input as XML DTD (experimental,unsupported)\n\ -\ \ -wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported)\n\ -\ \ -version : display version information\n\ -\ \ -verbose : be extra verbose\n\ -\ \ -quiet : suppress compiler output\n\ -Mode:\n\ -\ \ code : generate Java source code (default)\n\ -\ \ dryrun : compile the schema in memory, but don't generate the Java source\n\ -\ \ zip : generate Java source code into a zip file specified by the -d option\n\ -\ \ sig : dump the signatures of the generated code\n\ -\ \ forest : dump transformed DOM forest\n\ -Options in Code mode:\n\ -\ \ -p : specifies the target package\n - -Driver.Public.Usage = \ -Usage: xjc [-options ...] ... [-b ] ...\n\ -If dir is specified, all schema files in it will be compiled.\n\ -If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled.\n\ -Options:\n\ -\ \ -nv : do not perform strict validation of the input schema(s)\n\ -\ \ -extension : allow vendor extensions - do not strictly follow the\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Compatibility Rules and App E.2 from the JAXB Spec\n\ -\ \ -b : specify external bindings files (each must have its own -b)\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ If a directory is given, **/*.xjb is searched\n\ -\ \ -d : generated files will go into this directory\n\ -\ \ -p : specifies the target package\n\ -\ \ -httpproxy : set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost:proxyPort\n\ -\ \ -httpproxyfile : Works like -httpproxy but takes the argument in a file to protect password \n\ -\ \ -classpath : specify where to find user class files\n\ -\ \ -catalog : specify catalog files to resolve external entity references\n\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ support TR9401, XCatalog, and OASIS XML Catalog format.\n\ -\ \ -readOnly : generated files will be in read-only mode\n\ -\ \ -npa : suppress generation of package level annotations (**/package-info.java)\n\ -\ \ -no-header : suppress generation of a file header with timestamp\n\ -\ \ -target 2.0 : behave like XJC 2.0 and generate code that doesn't use any 2.1 features.\n\ -\ \ -xmlschema : treat input as W3C XML Schema (default)\n\ -\ \ -relaxng : treat input as RELAX NG (experimental,unsupported)\n\ -\ \ -relaxng-compact : treat input as RELAX NG compact syntax (experimental,unsupported)\n\ -\ \ -dtd : treat input as XML DTD (experimental,unsupported)\n\ -\ \ -wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported)\n\ -\ \ -verbose : be extra verbose\n\ -\ \ -quiet : suppress compiler output\n\ -\ \ -help : display this help message\n\ -\ \ -version : display version information\n\ - -Driver.AddonUsage = \nExtensions: - -Driver.ExperimentalLanguageWarning = \ - Are you trying to compile {0}? Support for {0} is experimental. \ - You may enable it by using the {1} option. - -Driver.NonExistentDir = \ - cowardly refuses to write to a non-existent directory "{0}" - -Driver.MissingRuntimePackageName = \ - the -use-runtime option is missing a package name - -Driver.MissingModeOperand = \ - the -mode option is missing an operand - -Driver.MissingCompatibilityOperand = \ - the -compatibility option is missing an operand - -Driver.MissingOperand = \ - an operand is missing - -Driver.MissingProxyHost = \ - either the -host option is missing an operand \n\ - or -port was specified but not -host - -Driver.MissingProxyPort = \ - either the -port option is missing an operand \n\ - or -host was specified but not -port - -Driver.ILLEGAL_PROXY = \ - "{0}" is not a valid proxy format. The format is [user[:password]@]proxyHost[:proxyPort] - -Driver.ILLEGAL_TARGET_VERSION = \ - "{0}" is not a valid target version. "2.0" and "2.1" are supported. - -Driver.MISSING_PROXYFILE = \ - the -httpproxyfile option is missing an operand - -Driver.NO_SUCH_FILE = \ - No such file: {0} - -Driver.ILLEGAL_PROXY = \ - "{0}" is not a valid proxy format. The format is [user[:password]@]proxyHost:proxyPort - -Driver.UnrecognizedMode = \ - unrecognized mode {0} - -Driver.UnrecognizedParameter = \ - unrecognized parameter {0} - -Driver.MissingGrammar = \ - grammar is not specified - -Driver.NotABindingFile = \ - not an external binding file. The root element must be '{'http://java.sun.com/xml/ns/jaxb'}'bindings but it is '{'{0}'}'{1} - -Driver.ParsingSchema = \ - parsing a schema... - -Driver.ParseFailed = \ - Failed to parse a schema. - -Driver.StackOverflow = \ - Stack overflow. Either you are compiling a large schema that requires more resources, or \ - XJC has a bug. First, please extend the stack size by using the -Xss JVM option. If this \ - doesn'''t solve the problem, please use the -debug option to obtain the stack trace and \ - contact Sun. - -Driver.CompilingSchema = \ - compiling a schema... - -Driver.FailedToGenerateCode = \ - Failed to produce code. - -# DO NOT localize the JAXB 2.1.10 string - it is a token for an ant -Driver.FilePrologComment = \ - This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 \n\ - See http://java.sun.com/xml/jaxb \n\ - Any modifications to this file will be lost upon recompilation of the source schema. \n\ - Generated on: {0} \n - -Driver.Version = \ - xjc version "JAXB 2.1.10" \n\ - JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build JAXB 2.1.10) - -Driver.BuildID = JAXB 2.1.10 - -# for JDK integration - include version in source zip -jaxb.jdk.version=2.1.10 - -# see java.text.SimpleDateFormat for format syntax -Driver.DateFormat = \ - yyyy.MM.dd - -# see java.text.SimpleDateFormat for format syntax -Driver.TimeFormat = \ - hh:mm:ss a z - -# as in: "generated on at