--- old/src/java.activation/share/classes/META-INF/mailcap.default 2018-01-30 20:15:51.000000000 -0500
+++ /dev/null 2018-01-30 20:15:51.000000000 -0500
@@ -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
--- old/src/java.activation/share/classes/META-INF/mimetypes.default 2018-01-30 20:15:51.000000000 -0500
+++ /dev/null 2018-01-30 20:15:52.000000000 -0500
@@ -1,25 +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/png png PNG
-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
--- old/src/java.activation/share/classes/com/sun/activation/registries/LogSupport.java 2018-01-30 20:15:52.000000000 -0500
+++ /dev/null 2018-01-30 20:15:52.000000000 -0500
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.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);
- }
-}
--- old/src/java.activation/share/classes/com/sun/activation/registries/MailcapFile.java 2018-01-30 20:15:53.000000000 -0500
+++ /dev/null 2018-01-30 20:15:53.000000000 -0500
@@ -1,563 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.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("");
- }
- }
- */
-}
--- old/src/java.activation/share/classes/com/sun/activation/registries/MailcapParseException.java 2018-01-30 20:15:53.000000000 -0500
+++ /dev/null 2018-01-30 20:15:54.000000000 -0500
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.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);
- }
-}
--- old/src/java.activation/share/classes/com/sun/activation/registries/MailcapTokenizer.java 2018-01-30 20:15:54.000000000 -0500
+++ /dev/null 2018-01-30 20:15:54.000000000 -0500
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.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
- *
- * @param 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.
- *
- * @return 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.
- *
- * @return A String containing the current token value
- */
- public String getCurrentTokenValue() {
- return currentTokenValue;
- }
- /*
- * Process the next token.
- *
- * @return 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("");
- }
- }
- */
-}
--- old/src/java.activation/share/classes/com/sun/activation/registries/MimeTypeEntry.java 2018-01-30 20:15:55.000000000 -0500
+++ /dev/null 2018-01-30 20:15:55.000000000 -0500
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.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;
- }
-}
--- old/src/java.activation/share/classes/com/sun/activation/registries/MimeTypeFile.java 2018-01-30 20:15:55.000000000 -0500
+++ /dev/null 2018-01-30 20:15:55.000000000 -0500
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.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);
- }
-}
--- old/src/java.activation/share/classes/javax/activation/ActivationDataFlavor.java 2018-01-30 20:15:56.000000000 -0500
+++ /dev/null 2018-01-30 20:15:56.000000000 -0500
@@ -1,249 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.awt.datatransfer.DataFlavor;
-import java.io.IOException;
-import javax.activation.MimeType;
-
-/**
- * The ActivationDataFlavor class is a special subclass of
- * {@code java.awt.datatransfer.DataFlavor}. It allows the JAF to
- * set all three values stored by the DataFlavor class via a new
- * constructor. It also contains improved MIME parsing in the {@code equals}
- * method. Except for the improved parsing, its semantics are
- * identical to that of the JDK's DataFlavor class.
- *
- * @since 1.6
- */
-
-public class ActivationDataFlavor extends DataFlavor {
-
- /*
- * Raison d'etre:
- *
- * The DataFlavor class included in JDK 1.1 has several limitations
- * including piss poor MIME type parsing, and the limitation of
- * only supporting serialized objects and InputStreams as
- * representation objects. This class 'fixes' that.
- */
-
- // I think for now I'll keep copies of all the variables and
- // then later I may choose try to better coexist with the base
- // class *sigh*
- private String mimeType = null;
- private MimeType mimeObject = null;
- private String humanPresentableName = null;
- private Class representationClass = null;
-
- /**
- * Construct a DataFlavor that represents an arbitrary
- * Java object. This constructor is an extension of the
- * JDK's DataFlavor in that it allows the explicit setting
- * of all three DataFlavor attributes.
- *
- * The returned DataFlavor will have the following characteristics:
- *
- * representationClass = representationClass
- * mimeType = mimeType
- * humanName = humanName
- *
- * @param representationClass the class used in this DataFlavor
- * @param mimeType the MIME type of the data represented by this class
- * @param humanPresentableName the human presentable name of the flavor
- */
- public ActivationDataFlavor(Class representationClass,
- String mimeType, String humanPresentableName) {
- super(mimeType, humanPresentableName); // need to call super
-
- // init private variables:
- this.mimeType = mimeType;
- this.humanPresentableName = humanPresentableName;
- this.representationClass = representationClass;
- }
-
- /**
- * Construct a DataFlavor that represents a MimeType.
- *
- * The returned DataFlavor will have the following characteristics:
- *
- * If the mimeType is "application/x-java-serialized-object;
- * class=", the result is the same as calling new
- * DataFlavor(Class.forName()) as above.
- *
- * otherwise:
- *
- * representationClass = InputStream
- * mimeType = mimeType
- *
- * @param representationClass the class used in this DataFlavor
- * @param humanPresentableName the human presentable name of the flavor
- */
- public ActivationDataFlavor(Class representationClass,
- String humanPresentableName) {
- super(representationClass, humanPresentableName);
- this.mimeType = super.getMimeType();
- this.representationClass = representationClass;
- this.humanPresentableName = humanPresentableName;
- }
-
- /**
- * Construct a DataFlavor that represents a MimeType.
- *
- * The returned DataFlavor will have the following characteristics:
- *
- * If the mimeType is "application/x-java-serialized-object; class=",
- * the result is the same as calling new DataFlavor(Class.forName()) as
- * above, otherwise:
- *
- * representationClass = InputStream
- * mimeType = mimeType
- *
- * @param mimeType the MIME type of the data represented by this class
- * @param humanPresentableName the human presentable name of the flavor
- */
- public ActivationDataFlavor(String mimeType, String humanPresentableName) {
- super(mimeType, humanPresentableName);
- this.mimeType = mimeType;
- try {
- this.representationClass = Class.forName("java.io.InputStream");
- } catch (ClassNotFoundException ex) {
- // XXX - should never happen, ignore it
- }
- this.humanPresentableName = humanPresentableName;
- }
-
- /**
- * Return the MIME type for this DataFlavor.
- *
- * @return the MIME type
- */
- public String getMimeType() {
- return mimeType;
- }
-
- /**
- * Return the representation class.
- *
- * @return the representation class
- */
- public Class getRepresentationClass() {
- return representationClass;
- }
-
- /**
- * Return the Human Presentable name.
- *
- * @return the human presentable name
- */
- public String getHumanPresentableName() {
- return humanPresentableName;
- }
-
- /**
- * Set the human presentable name.
- *
- * @param humanPresentableName the name to set
- */
- public void setHumanPresentableName(String humanPresentableName) {
- this.humanPresentableName = humanPresentableName;
- }
-
- /**
- * Compares the DataFlavor passed in with this DataFlavor; calls
- * the {@code isMimeTypeEqual} method.
- *
- * @param dataFlavor the DataFlavor to compare with
- * @return true if the MIME type and representation class
- * are the same
- */
- public boolean equals(DataFlavor dataFlavor) {
- return (isMimeTypeEqual(dataFlavor) &&
- dataFlavor.getRepresentationClass() == representationClass);
- }
-
- /**
- * Is the string representation of the MIME type passed in equivalent
- * to the MIME type of this DataFlavor.
- *
- * ActivationDataFlavor delegates the comparison of MIME types to
- * the MimeType class included as part of the JavaBeans Activation
- * Framework. This provides a more robust comparison than is normally
- * available in the DataFlavor class.
- *
- * @param mimeType the MIME type
- * @return true if the same MIME type
- */
- public boolean isMimeTypeEqual(String mimeType) {
- MimeType mt = null;
- try {
- if (mimeObject == null)
- mimeObject = new MimeType(this.mimeType);
- mt = new MimeType(mimeType);
- } catch (MimeTypeParseException e) {
- // something didn't parse, do a crude comparison
- return this.mimeType.equalsIgnoreCase(mimeType);
- }
-
- return mimeObject.match(mt);
- }
-
- /**
- * Called on DataFlavor for every MIME Type parameter to allow DataFlavor
- * subclasses to handle special parameters like the text/plain charset
- * parameters, whose values are case insensitive. (MIME type parameter
- * values are supposed to be case sensitive).
- *
- * This method is called for each parameter name/value pair and should
- * return the normalized representation of the parameterValue.
- * This method is never invoked by this implementation.
- *
- * @param parameterName the parameter name
- * @param parameterValue the parameter value
- * @return the normalized parameter value
- * @deprecated
- */
- protected String normalizeMimeTypeParameter(String parameterName,
- String parameterValue) {
- return parameterValue;
- }
-
- /**
- * Called for each MIME type string to give DataFlavor subtypes the
- * opportunity to change how the normalization of MIME types is
- * accomplished.
- * One possible use would be to add default parameter/value pairs in cases
- * where none are present in the MIME type string passed in.
- * This method is never invoked by this implementation.
- *
- * @param mimeType the MIME type
- * @return the normalized MIME type
- * @deprecated
- */
- protected String normalizeMimeType(String mimeType) {
- return mimeType;
- }
-}
--- old/src/java.activation/share/classes/javax/activation/CommandInfo.java 2018-01-30 20:15:57.000000000 -0500
+++ /dev/null 2018-01-30 20:15:57.000000000 -0500
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * The CommandInfo class is used by CommandMap implementations to
- * describe the results of command requests. It provides the requestor
- * with both the verb requested, as well as an instance of the
- * bean. There is also a method that will return the name of the
- * class that implements the command but it is not guaranteed to
- * return a valid value. The reason for this is to allow CommandMap
- * implmentations that subclass CommandInfo to provide special
- * behavior. For example a CommandMap could dynamically generate
- * JavaBeans. In this case, it might not be possible to create an
- * object with all the correct state information solely from the class
- * name.
- *
- * @since 1.6
- */
-
-public class CommandInfo {
- private String verb;
- private String className;
-
- /**
- * The Constructor for CommandInfo.
- * @param verb The command verb this CommandInfo decribes.
- * @param className The command's fully qualified class name.
- */
- public CommandInfo(String verb, String className) {
- this.verb = verb;
- this.className = className;
- }
-
- /**
- * Return the command verb.
- *
- * @return the command verb.
- */
- public String getCommandName() {
- return verb;
- }
-
- /**
- * Return the command's class name. This method MAY return null in
- * cases where a CommandMap subclassed CommandInfo for its
- * own purposes. In other words, it might not be possible to
- * create the correct state in the command by merely knowing
- * its class name. DO NOT DEPEND ON THIS METHOD RETURNING
- * A VALID VALUE!
- *
- * @return The class name of the command, or null
- */
- public String getCommandClass() {
- return className;
- }
-
- /**
- * Return the instantiated JavaBean component.
- *
- * If {@code java.beans.Beans} is visible then it's
- * {@code java.beans.Beans#instantiate} method is invoked to instantiate
- * the component as a JavaBeans component.
- * When {@code java.beans.Beans} is not visible (when {@code java.desktop}
- * module is not readable or when the runtime image does not contain the
- * {@code java.desktop} module) then the command's class is loaded and
- * instantiated with its public no-args constructor.
- *
- * The component class needs to be public.
- *
- * If the bean implements the {@code javax.activation.CommandObject}
- * interface, call its {@code setCommandContext} method.
- *
- * If the DataHandler parameter is null, then the bean is
- * instantiated with no data. NOTE: this may be useful
- * if for some reason the DataHandler that is passed in
- * throws IOExceptions when this method attempts to
- * access its InputStream. It will allow the caller to
- * retrieve a reference to the bean if it can be
- * instantiated.
- *
- * If the bean does NOT implement the CommandObject interface,
- * this method will check if it implements the
- * java.io.Externalizable interface. If it does, the bean's
- * readExternal method will be called if an InputStream
- * can be acquired from the DataHandler.
- *
- * @param dh The DataHandler that describes the data to be
- * passed to the command.
- * @param loader The ClassLoader to be used to instantiate the bean.
- * @return The bean
- * @exception IOException for failures reading data
- * @exception ClassNotFoundException if command object class can't
- * be found
- * @see java.beans.Beans#instantiate
- * @see javax.activation.CommandObject
- */
- public Object getCommandObject(DataHandler dh, ClassLoader loader)
- throws IOException, ClassNotFoundException {
- Object new_bean = null;
-
- // try to instantiate the bean
- new_bean = Beans.instantiate(loader, className);
-
- // if we got one and it is a CommandObject
- if (new_bean != null) {
- if (new_bean instanceof CommandObject) {
- ((CommandObject)new_bean).setCommandContext(verb, dh);
- } else if (new_bean instanceof Externalizable) {
- if (dh != null) {
- InputStream is = dh.getInputStream();
- if (is != null) {
- ((Externalizable)new_bean).readExternal(
- new ObjectInputStream(is));
- }
- }
- }
- }
-
- return new_bean;
- }
-
- /**
- * Helper class to invoke Beans.instantiate reflectively or the equivalent
- * with core reflection when module java.desktop is not readable.
- */
- private static final class Beans {
- static final Method instantiateMethod;
-
- static {
- Method m;
- try {
- Class> c = Class.forName("java.beans.Beans");
- m = c.getDeclaredMethod("instantiate", ClassLoader.class, String.class);
- } catch (ClassNotFoundException e) {
- m = null;
- } catch (NoSuchMethodException e) {
- m = null;
- }
- instantiateMethod = m;
- }
-
- /**
- * Equivalent to invoking java.beans.Beans.instantiate(loader, cn)
- */
- static Object instantiate(ClassLoader loader, String cn)
- throws IOException, ClassNotFoundException {
-
- Exception exception;
-
- if (instantiateMethod != null) {
-
- // invoke Beans.instantiate
- try {
- return instantiateMethod.invoke(null, loader, cn);
- } catch (InvocationTargetException e) {
- exception = e;
- } catch (IllegalAccessException e) {
- exception = e;
- }
-
- } else {
-
- SecurityManager security = System.getSecurityManager();
- if (security != null) {
- // if it's ok with the SecurityManager, it's ok with me.
- String cname = cn.replace('/', '.');
- if (cname.startsWith("[")) {
- int b = cname.lastIndexOf('[') + 2;
- if (b > 1 && b < cname.length()) {
- cname = cname.substring(b);
- }
- }
- int i = cname.lastIndexOf('.');
- if (i != -1) {
- security.checkPackageAccess(cname.substring(0, i));
- }
- }
-
- // Beans.instantiate specified to use SCL when loader is null
- if (loader == null) {
- loader = (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
- Class> beanClass = Class.forName(cn, false, loader);
- try {
- return beanClass.getDeclaredConstructor().newInstance();
- } catch (Exception ex) {
- throw new ClassNotFoundException(beanClass + ": " + ex, ex);
- }
-
- }
- return null;
- }
- }
-}
--- old/src/java.activation/share/classes/javax/activation/CommandMap.java 2018-01-30 20:15:57.000000000 -0500
+++ /dev/null 2018-01-30 20:15:57.000000000 -0500
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-
-/**
- * The CommandMap class provides an interface to a registry of
- * command objects available in the system.
- * Developers are expected to either use the CommandMap
- * implementation included with this package (MailcapCommandMap) or
- * develop their own. Note that some of the methods in this class are
- * abstract.
- *
- * @since 1.6
- */
-public abstract class CommandMap {
- private static CommandMap defaultCommandMap = null;
- private static Map map =
- new WeakHashMap();
-
- /**
- * Get the default CommandMap.
- *
- *
- * - In cases where a CommandMap instance has been previously set
- * to some value (via setDefaultCommandMap)
- * return the CommandMap.
- *
-
- * In cases where no CommandMap has been set, the CommandMap
- * creates an instance of {@code MailcapCommandMap} and
- * set that to the default, returning its value.
- *
- *
- *
- * @return the CommandMap
- */
- public static synchronized CommandMap getDefaultCommandMap() {
- if (defaultCommandMap != null)
- return defaultCommandMap;
-
- // fetch per-thread-context-class-loader default
- ClassLoader tccl = SecuritySupport.getContextClassLoader();
- CommandMap def = map.get(tccl);
- if (def == null) {
- def = new MailcapCommandMap();
- map.put(tccl, def);
- }
- return def;
- }
-
- /**
- * Set the default CommandMap. Reset the CommandMap to the default by
- * calling this method with {@code null}.
- *
- * @param commandMap The new default CommandMap.
- * @exception SecurityException if the caller doesn't have permission
- * to change the default
- */
- public static synchronized void setDefaultCommandMap(CommandMap commandMap) {
- SecurityManager security = System.getSecurityManager();
- if (security != null) {
- try {
- // if it's ok with the SecurityManager, it's ok with me...
- security.checkSetFactory();
- } catch (SecurityException ex) {
- // otherwise, we also allow it if this code and the
- // factory come from the same (non-system) class loader (e.g.,
- // the JAF classes were loaded with the applet classes).
- ClassLoader cl = CommandMap.class.getClassLoader();
- if (cl == null || cl.getParent() == null ||
- cl != commandMap.getClass().getClassLoader()) {
- throw ex;
- }
- }
- }
- // remove any per-thread-context-class-loader CommandMap
- map.remove(SecuritySupport.getContextClassLoader());
- defaultCommandMap = commandMap;
- }
-
- /**
- * Get the preferred command list from a MIME Type. The actual semantics
- * are determined by the implementation of the CommandMap.
- *
- * @param mimeType the MIME type
- * @return the CommandInfo classes that represent the command Beans.
- */
- abstract public CommandInfo[] getPreferredCommands(String mimeType);
-
- /**
- * Get the preferred command list from a MIME Type. The actual semantics
- * are determined by the implementation of the CommandMap.
- *
- * The {@code DataSource} provides extra information, such as
- * the file name, that a CommandMap implementation may use to further
- * refine the list of commands that are returned. The implementation
- * in this class simply calls the {@code getPreferredCommands}
- * method that ignores this argument.
- *
- * @param mimeType the MIME type
- * @param ds a DataSource for the data
- * @return the CommandInfo classes that represent the command Beans.
- * @since 1.6, JAF 1.1
- */
- public CommandInfo[] getPreferredCommands(String mimeType, DataSource ds) {
- return getPreferredCommands(mimeType);
- }
-
- /**
- * Get all the available commands for this type. This method
- * should return all the possible commands for this MIME type.
- *
- * @param mimeType the MIME type
- * @return the CommandInfo objects representing all the commands.
- */
- abstract public CommandInfo[] getAllCommands(String mimeType);
-
- /**
- * Get all the available commands for this type. This method
- * should return all the possible commands for this MIME type.
- *
- * The {@code DataSource} provides extra information, such as
- * the file name, that a CommandMap implementation may use to further
- * refine the list of commands that are returned. The implementation
- * in this class simply calls the {@code getAllCommands}
- * method that ignores this argument.
- *
- * @param mimeType the MIME type
- * @param ds a DataSource for the data
- * @return the CommandInfo objects representing all the commands.
- * @since 1.6, JAF 1.1
- */
- public CommandInfo[] getAllCommands(String mimeType, DataSource ds) {
- return getAllCommands(mimeType);
- }
-
- /**
- * Get the default command corresponding to the MIME type.
- *
- * @param mimeType the MIME type
- * @param cmdName the command name
- * @return the CommandInfo corresponding to the command.
- */
- abstract public CommandInfo getCommand(String mimeType, String cmdName);
-
- /**
- * Get the default command corresponding to the MIME type.
- *
- * The {@code DataSource} provides extra information, such as
- * the file name, that a CommandMap implementation may use to further
- * refine the command that is chosen. The implementation
- * in this class simply calls the {@code getCommand}
- * method that ignores this argument.
- *
- * @param mimeType the MIME type
- * @param cmdName the command name
- * @param ds a DataSource for the data
- * @return the CommandInfo corresponding to the command.
- * @since 1.6, JAF 1.1
- */
- public CommandInfo getCommand(String mimeType, String cmdName,
- DataSource ds) {
- return getCommand(mimeType, cmdName);
- }
-
- /**
- * Locate a DataContentHandler that corresponds to the MIME type.
- * The mechanism and semantics for determining this are determined
- * by the implementation of the particular CommandMap.
- *
- * @param mimeType the MIME type
- * @return the DataContentHandler for the MIME type
- */
- abstract public DataContentHandler createDataContentHandler(String
- mimeType);
-
- /**
- * Locate a DataContentHandler that corresponds to the MIME type.
- * The mechanism and semantics for determining this are determined
- * by the implementation of the particular CommandMap.
- *
- * The {@code DataSource} provides extra information, such as
- * the file name, that a CommandMap implementation may use to further
- * refine the choice of DataContentHandler. The implementation
- * in this class simply calls the {@code createDataContentHandler}
- * method that ignores this argument.
- *
- * @param mimeType the MIME type
- * @param ds a DataSource for the data
- * @return the DataContentHandler for the MIME type
- * @since 1.6, JAF 1.1
- */
- public DataContentHandler createDataContentHandler(String mimeType,
- DataSource ds) {
- return createDataContentHandler(mimeType);
- }
-
- /**
- * Get all the MIME types known to this command map.
- * If the command map doesn't support this operation,
- * null is returned.
- *
- * @return array of MIME types as strings, or null if not supported
- * @since 1.6, JAF 1.1
- */
- public String[] getMimeTypes() {
- return null;
- }
-}
--- old/src/java.activation/share/classes/javax/activation/CommandObject.java 2018-01-30 20:15:58.000000000 -0500
+++ /dev/null 2018-01-30 20:15:58.000000000 -0500
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.IOException;
-
-/**
- * JavaBeans components that are Activation Framework aware implement
- * this interface to find out which command verb they're being asked
- * to perform, and to obtain the DataHandler representing the
- * data they should operate on. JavaBeans that don't implement
- * this interface may be used as well. Such commands may obtain
- * the data using the Externalizable interface, or using an
- * application-specific method.
- *
- * @since 1.6
- */
-public interface CommandObject {
-
- /**
- * Initialize the Command with the verb it is requested to handle
- * and the DataHandler that describes the data it will
- * operate on. NOTE: it is acceptable for the caller
- * to pass null as the value for {@code DataHandler}.
- *
- * @param verb The Command Verb this object refers to.
- * @param dh The DataHandler.
- * @exception IOException for failures accessing data
- */
- public void setCommandContext(String verb, DataHandler dh)
- throws IOException;
-}
--- old/src/java.activation/share/classes/javax/activation/DataContentHandler.java 2018-01-30 20:15:59.000000000 -0500
+++ /dev/null 2018-01-30 20:15:59.000000000 -0500
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import javax.activation.DataSource;
-
-/**
- *
The DataContentHandler interface is implemented by objects that can
- * be used to extend the capabilities of the DataHandler's implementation
- * of the Transferable interface. Through DataContentHandlers
- * the framework can be extended to convert streams in to objects, and
- * to write objects to streams.
- *
- * An implementation of DataContentHandler should be a public class
- * with a public no-arg constructor. If the implementation class is in
- * a named module then it should be in an API package that is exported
- * to the module {@code java.activation}.
- *
- * Applications don't generally call the methods in DataContentHandlers
- * directly. Instead, an application calls the equivalent methods in
- * DataHandler. The DataHandler will attempt to find an appropriate
- * DataContentHandler that corresponds to its MIME type using the
- * current DataContentHandlerFactory. The DataHandler then calls
- * through to the methods in the DataContentHandler.
- *
- * @since 1.6
- */
-
-public interface DataContentHandler {
- /**
- * Returns an array of DataFlavor objects indicating the flavors the
- * data can be provided in. The array should be ordered according to
- * preference for providing the data (from most richly descriptive to
- * least descriptive).
- *
- * @return The DataFlavors.
- */
- public DataFlavor[] getTransferDataFlavors();
-
- /**
- * Returns an object which represents the data to be transferred.
- * The class of the object returned is defined by the representation class
- * of the flavor.
- *
- * @param df The DataFlavor representing the requested type.
- * @param ds The DataSource representing the data to be converted.
- * @return The constructed Object.
- * @exception UnsupportedFlavorException if the handler doesn't
- * support the requested flavor
- * @exception IOException if the data can't be accessed
- */
- public Object getTransferData(DataFlavor df, DataSource ds)
- throws UnsupportedFlavorException, IOException;
-
- /**
- * Return an object representing the data in its most preferred form.
- * Generally this will be the form described by the first DataFlavor
- * returned by the getTransferDataFlavors
method.
- *
- * @param ds The DataSource representing the data to be converted.
- * @return The constructed Object.
- * @exception IOException if the data can't be accessed
- */
- public Object getContent(DataSource ds) throws IOException;
-
- /**
- * Convert the object to a byte stream of the specified MIME type
- * and write it to the output stream.
- *
- * @param obj The object to be converted.
- * @param mimeType The requested MIME type of the resulting byte stream.
- * @param os The output stream into which to write the converted
- * byte stream.
- * @exception IOException errors writing to the stream
- */
- public void writeTo(Object obj, String mimeType, OutputStream os)
- throws IOException;
-}
--- old/src/java.activation/share/classes/javax/activation/DataContentHandlerFactory.java 2018-01-30 20:15:59.000000000 -0500
+++ /dev/null 2018-01-30 20:15:59.000000000 -0500
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-/**
- * This interface defines a factory for DataContentHandlers
. An
- * implementation of this interface should map a MIME type into an
- * instance of DataContentHandler. The design pattern for classes implementing
- * this interface is the same as for the ContentHandler mechanism used in
- * java.net.URL
.
- *
- * @since 1.6
- */
-
-public interface DataContentHandlerFactory {
-
- /**
- * Creates a new DataContentHandler object for the MIME type.
- *
- * @param mimeType the MIME type to create the DataContentHandler for.
- * @return The new DataContentHandler
, or null
- * if none are found.
- */
- public DataContentHandler createDataContentHandler(String mimeType);
-}
--- old/src/java.activation/share/classes/javax/activation/DataHandler.java 2018-01-30 20:16:00.000000000 -0500
+++ /dev/null 2018-01-30 20:16:00.000000000 -0500
@@ -1,900 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-
-/**
- * The DataHandler class provides a consistent interface to data
- * available in many different sources and formats.
- * It manages simple stream to string conversions and related operations
- * using DataContentHandlers.
- * It provides access to commands that can operate on the data.
- * The commands are found using a CommandMap.
- *
- * DataHandler and the Transferable Interface
- * DataHandler implements the Transferable interface so that data can
- * be used in AWT data transfer operations, such as cut and paste and
- * drag and drop. The implementation of the Transferable interface
- * relies on the availability of an installed DataContentHandler
- * object corresponding to the MIME type of the data represented in
- * the specific instance of the DataHandler.
- *
- * DataHandler and CommandMaps
- * The DataHandler keeps track of the current CommandMap that it uses to
- * service requests for commands ({@code getCommand, getAllCommands,
- * getPreferredCommands}).
- * Each instance of a DataHandler may have a CommandMap associated with
- * it using the {@code setCommandMap} method. If a CommandMap was
- * not set, DataHandler calls the {@code getDefaultCommandMap}
- * method in CommandMap and uses the value it returns. See
- * CommandMap for more information.
- *
- * DataHandler and URLs
- * The current DataHandler implementation creates a private
- * instance of URLDataSource when it is constructed with a URL.
- *
- * @see javax.activation.CommandMap
- * @see javax.activation.DataContentHandler
- * @see javax.activation.DataSource
- * @see javax.activation.URLDataSource
- *
- * @since 1.6
- */
-
-public class DataHandler implements Transferable {
-
- // Use the datasource to indicate whether we were started via the
- // DataSource constructor or the object constructor.
- private DataSource dataSource = null;
- private DataSource objDataSource = null;
-
- // The Object and mimetype from the constructor (if passed in).
- // object remains null if it was instantiated with a
- // DataSource.
- private Object object = null;
- private String objectMimeType = null;
-
- // Keep track of the CommandMap
- private CommandMap currentCommandMap = null;
-
- // our transfer flavors
- private static final DataFlavor emptyFlavors[] = new DataFlavor[0];
- private DataFlavor transferFlavors[] = emptyFlavors;
-
- // our DataContentHandler
- private DataContentHandler dataContentHandler = null;
- private DataContentHandler factoryDCH = null;
-
- // our DataContentHandlerFactory
- private static DataContentHandlerFactory factory = null;
- private DataContentHandlerFactory oldFactory = null;
- // the short representation of the ContentType (sans params)
- private String shortType = null;
-
- /**
- * Create a {@code DataHandler} instance referencing the
- * specified DataSource. The data exists in a byte stream form.
- * The DataSource will provide an InputStream to access the data.
- *
- * @param ds the DataSource
- */
- public DataHandler(DataSource ds) {
- // save a reference to the incoming DS
- dataSource = ds;
- oldFactory = factory; // keep track of the factory
- }
-
- /**
- * Create a {@code DataHandler} instance representing an object
- * of this MIME type. This constructor is
- * used when the application already has an in-memory representation
- * of the data in the form of a Java Object.
- *
- * @param obj the Java Object
- * @param mimeType the MIME type of the object
- */
- public DataHandler(Object obj, String mimeType) {
- object = obj;
- objectMimeType = mimeType;
- oldFactory = factory; // keep track of the factory
- }
-
- /**
- * Create a {@code DataHandler} instance referencing a URL.
- * The DataHandler internally creates a {@code URLDataSource}
- * instance to represent the URL.
- *
- * @param url a URL object
- */
- public DataHandler(URL url) {
- dataSource = new URLDataSource(url);
- oldFactory = factory; // keep track of the factory
- }
-
- /**
- * Return the CommandMap for this instance of DataHandler.
- */
- private synchronized CommandMap getCommandMap() {
- if (currentCommandMap != null)
- return currentCommandMap;
- else
- return CommandMap.getDefaultCommandMap();
- }
-
- /**
- * Return the DataSource associated with this instance
- * of DataHandler.
- *
- * For DataHandlers that have been instantiated with a DataSource,
- * this method returns the DataSource that was used to create the
- * DataHandler object. In other cases the DataHandler
- * constructs a DataSource from the data used to construct
- * the DataHandler. DataSources created for DataHandlers not
- * instantiated with a DataSource are cached for performance
- * reasons.
- *
- * @return a valid DataSource object for this DataHandler
- */
- public DataSource getDataSource() {
- if (dataSource == null) {
- // create one on the fly
- if (objDataSource == null)
- objDataSource = new DataHandlerDataSource(this);
- return objDataSource;
- }
- return dataSource;
- }
-
- /**
- * Return the name of the data object. If this DataHandler
- * was created with a DataSource, this method calls through
- * to the {@code DataSource.getName} method, otherwise it
- * returns null.
- *
- * @return the name of the object
- */
- public String getName() {
- if (dataSource != null)
- return dataSource.getName();
- else
- return null;
- }
-
- /**
- * Return the MIME type of this object as retrieved from
- * the source object. Note that this is the full
- * type with parameters.
- *
- * @return the MIME type
- */
- public String getContentType() {
- if (dataSource != null) // data source case
- return dataSource.getContentType();
- else
- return objectMimeType; // obj/type case
- }
-
- /**
- * Get the InputStream for this object.
- *
- * For DataHandlers instantiated with a DataSource, the DataHandler
- * calls the {@code DataSource.getInputStream} method and
- * returns the result to the caller.
- *
- * For DataHandlers instantiated with an Object, the DataHandler
- * first attempts to find a DataContentHandler for the Object. If
- * the DataHandler can not find a DataContentHandler for this MIME
- * type, it throws an UnsupportedDataTypeException. If it is
- * successful, it creates a pipe and a thread. The thread uses the
- * DataContentHandler's {@code writeTo} method to write the
- * stream data into one end of the pipe. The other end of the pipe
- * is returned to the caller. Because a thread is created to copy
- * the data, IOExceptions that may occur during the copy can not be
- * propagated back to the caller. The result is an empty stream.
- *
- * @return the InputStream representing this data
- * @exception IOException if an I/O error occurs
- *
- * @see javax.activation.DataContentHandler#writeTo
- * @see javax.activation.UnsupportedDataTypeException
- */
- public InputStream getInputStream() throws IOException {
- InputStream ins = null;
-
- if (dataSource != null) {
- ins = dataSource.getInputStream();
- } else {
- DataContentHandler dch = getDataContentHandler();
- // we won't even try if we can't get a dch
- if (dch == null)
- throw new UnsupportedDataTypeException(
- "no DCH for MIME type " + getBaseType());
-
- if (dch instanceof ObjectDataContentHandler) {
- if (((ObjectDataContentHandler)dch).getDCH() == null)
- throw new UnsupportedDataTypeException(
- "no object DCH for MIME type " + getBaseType());
- }
- // there is none but the default^^^^^^^^^^^^^^^^
- final DataContentHandler fdch = dch;
-
- // from bill s.
- // ce n'est pas une pipe!
- //
- // NOTE: This block of code needs to throw exceptions, but
- // can't because it is in another thread!!! ARG!
- //
- final PipedOutputStream pos = new PipedOutputStream();
- PipedInputStream pin = new PipedInputStream(pos);
- new Thread(
- new Runnable() {
- public void run() {
- try {
- fdch.writeTo(object, objectMimeType, pos);
- } catch (IOException e) {
-
- } finally {
- try {
- pos.close();
- } catch (IOException ie) { }
- }
- }
- },
- "DataHandler.getInputStream").start();
- ins = pin;
- }
-
- return ins;
- }
-
- /**
- * Write the data to an {@code OutputStream}.
- *
- * If the DataHandler was created with a DataSource, writeTo
- * retrieves the InputStream and copies the bytes from the
- * InputStream to the OutputStream passed in.
- *
- * If the DataHandler was created with an object, writeTo
- * retrieves the DataContentHandler for the object's type.
- * If the DataContentHandler was found, it calls the
- * {@code writeTo} method on the {@code DataContentHandler}.
- *
- * @param os the OutputStream to write to
- * @exception IOException if an I/O error occurs
- */
- public void writeTo(OutputStream os) throws IOException {
- // for the DataSource case
- if (dataSource != null) {
- InputStream is = null;
- byte data[] = new byte[8*1024];
- int bytes_read;
-
- is = dataSource.getInputStream();
-
- try {
- while ((bytes_read = is.read(data)) > 0) {
- os.write(data, 0, bytes_read);
- }
- } finally {
- is.close();
- is = null;
- }
- } else { // for the Object case
- DataContentHandler dch = getDataContentHandler();
- dch.writeTo(object, objectMimeType, os);
- }
- }
-
- /**
- * Get an OutputStream for this DataHandler to allow overwriting
- * the underlying data.
- * If the DataHandler was created with a DataSource, the
- * DataSource's {@code getOutputStream} method is called.
- * Otherwise, {@code null} is returned.
- *
- * @return the OutputStream
- * @exception IOException for failures creating the OutputStream
- *
- * @see javax.activation.DataSource#getOutputStream
- * @see javax.activation.URLDataSource
- */
- public OutputStream getOutputStream() throws IOException {
- if (dataSource != null)
- return dataSource.getOutputStream();
- else
- return null;
- }
-
- /**
- * Return the DataFlavors in which this data is available.
- *
- * Returns an array of DataFlavor objects indicating the flavors
- * the data can be provided in. The array is usually ordered
- * according to preference for providing the data, from most
- * richly descriptive to least richly descriptive.
- *
- * The DataHandler attempts to find a DataContentHandler that
- * corresponds to the MIME type of the data. If one is located,
- * the DataHandler calls the DataContentHandler's
- * {@code getTransferDataFlavors} method.
- *
- * If a DataContentHandler can not be located, and if the
- * DataHandler was created with a DataSource (or URL), one
- * DataFlavor is returned that represents this object's MIME type
- * and the {@code java.io.InputStream} class. If the
- * DataHandler was created with an object and a MIME type,
- * getTransferDataFlavors returns one DataFlavor that represents
- * this object's MIME type and the object's class.
- *
- * @return an array of data flavors in which this data can be transferred
- * @see javax.activation.DataContentHandler#getTransferDataFlavors
- */
- public synchronized DataFlavor[] getTransferDataFlavors() {
- if (factory != oldFactory) // if the factory has changed, clear cache
- transferFlavors = emptyFlavors;
-
- // if it's not set, set it...
- if (transferFlavors == emptyFlavors)
- transferFlavors = getDataContentHandler().getTransferDataFlavors();
-
- if (transferFlavors == emptyFlavors)
- return transferFlavors;
- else
- return transferFlavors.clone();
-
- }
-
- /**
- * Returns whether the specified data flavor is supported
- * for this object.
- *
- * This method iterates through the DataFlavors returned from
- * {@code getTransferDataFlavors}, comparing each with
- * the specified flavor.
- *
- * @param flavor the requested flavor for the data
- * @return true if the data flavor is supported
- * @see javax.activation.DataHandler#getTransferDataFlavors
- */
- public boolean isDataFlavorSupported(DataFlavor flavor) {
- DataFlavor[] lFlavors = getTransferDataFlavors();
-
- for (int i = 0; i < lFlavors.length; i++) {
- if (lFlavors[i].equals(flavor))
- return true;
- }
- return false;
- }
-
- /**
- * Returns an object that represents the data to be
- * transferred. The class of the object returned is defined by the
- * representation class of the data flavor.
- *
- * For DataHandler's created with DataSources or URLs:
- *
- * The DataHandler attempts to locate a DataContentHandler
- * for this MIME type. If one is found, the passed in DataFlavor
- * and the type of the data are passed to its {@code getTransferData}
- * method. If the DataHandler fails to locate a DataContentHandler
- * and the flavor specifies this object's MIME type and the
- * {@code java.io.InputStream} class, this object's InputStream
- * is returned.
- * Otherwise it throws an UnsupportedFlavorException.
- *
- * For DataHandler's created with Objects:
- *
- * The DataHandler attempts to locate a DataContentHandler
- * for this MIME type. If one is found, the passed in DataFlavor
- * and the type of the data are passed to its getTransferData
- * method. If the DataHandler fails to locate a DataContentHandler
- * and the flavor specifies this object's MIME type and its class,
- * this DataHandler's referenced object is returned.
- * Otherwise it throws an UnsupportedFlavorException.
- *
- * @param flavor the requested flavor for the data
- * @return the object
- * @exception UnsupportedFlavorException if the data could not be
- * converted to the requested flavor
- * @exception IOException if an I/O error occurs
- * @see javax.activation.ActivationDataFlavor
- */
- public Object getTransferData(DataFlavor flavor)
- throws UnsupportedFlavorException, IOException {
- return getDataContentHandler().getTransferData(flavor, dataSource);
- }
-
- /**
- * Set the CommandMap for use by this DataHandler.
- * Setting it to {@code null} causes the CommandMap to revert
- * to the CommandMap returned by the
- * {@code CommandMap.getDefaultCommandMap} method.
- * Changing the CommandMap, or setting it to {@code null},
- * clears out any data cached from the previous CommandMap.
- *
- * @param commandMap the CommandMap to use in this DataHandler
- *
- * @see javax.activation.CommandMap#setDefaultCommandMap
- */
- public synchronized void setCommandMap(CommandMap commandMap) {
- if (commandMap != currentCommandMap || commandMap == null) {
- // clear cached values...
- transferFlavors = emptyFlavors;
- dataContentHandler = null;
-
- currentCommandMap = commandMap;
- }
- }
-
- /**
- * Return the preferred commands for this type of data.
- * This method calls the {@code getPreferredCommands} method
- * in the CommandMap associated with this instance of DataHandler.
- * This method returns an array that represents a subset of
- * available commands. In cases where multiple commands for the
- * MIME type represented by this DataHandler are present, the
- * installed CommandMap chooses the appropriate commands.
- *
- * @return the CommandInfo objects representing the preferred commands
- *
- * @see javax.activation.CommandMap#getPreferredCommands
- */
- public CommandInfo[] getPreferredCommands() {
- if (dataSource != null)
- return getCommandMap().getPreferredCommands(getBaseType(),
- dataSource);
- else
- return getCommandMap().getPreferredCommands(getBaseType());
- }
-
- /**
- * Return all the commands for this type of data.
- * This method returns an array containing all commands
- * for the type of data represented by this DataHandler. The
- * MIME type for the underlying data represented by this DataHandler
- * is used to call through to the {@code getAllCommands} method
- * of the CommandMap associated with this DataHandler.
- *
- * @return the CommandInfo objects representing all the commands
- *
- * @see javax.activation.CommandMap#getAllCommands
- */
- public CommandInfo[] getAllCommands() {
- if (dataSource != null)
- return getCommandMap().getAllCommands(getBaseType(), dataSource);
- else
- return getCommandMap().getAllCommands(getBaseType());
- }
-
- /**
- * Get the command cmdName. Use the search semantics as
- * defined by the CommandMap installed in this DataHandler. The
- * MIME type for the underlying data represented by this DataHandler
- * is used to call through to the {@code getCommand} method
- * of the CommandMap associated with this DataHandler.
- *
- * @param cmdName the command name
- * @return the CommandInfo corresponding to the command
- *
- * @see javax.activation.CommandMap#getCommand
- */
- public CommandInfo getCommand(String cmdName) {
- if (dataSource != null)
- return getCommandMap().getCommand(getBaseType(), cmdName,
- dataSource);
- else
- return getCommandMap().getCommand(getBaseType(), cmdName);
- }
-
- /**
- * Return the data in its preferred Object form.
- *
- * If the DataHandler was instantiated with an object, return
- * the object.
- *
- * If the DataHandler was instantiated with a DataSource,
- * this method uses a DataContentHandler to return the content
- * object for the data represented by this DataHandler. If no
- * {@code DataContentHandler} can be found for the
- * the type of this data, the DataHandler returns an
- * InputStream for the data.
- *
- * @return the content.
- * @exception IOException if an IOException occurs during
- * this operation.
- */
- public Object getContent() throws IOException {
- if (object != null)
- return object;
- else
- return getDataContentHandler().getContent(getDataSource());
- }
-
- /**
- * A convenience method that takes a CommandInfo object
- * and instantiates the corresponding command, usually
- * a JavaBean component.
- *
- * This method calls the CommandInfo's {@code getCommandObject}
- * method with the {@code ClassLoader} used to load
- * the {@code javax.activation.DataHandler} class itself.
- *
- * @param cmdinfo the CommandInfo corresponding to a command
- * @return the instantiated command object
- */
- public Object getBean(CommandInfo cmdinfo) {
- Object bean = null;
-
- try {
- // make the bean
- ClassLoader cld = null;
- // First try the "application's" class loader.
- cld = SecuritySupport.getContextClassLoader();
- if (cld == null)
- cld = this.getClass().getClassLoader();
- bean = cmdinfo.getCommandObject(this, cld);
- } catch (IOException e) {
- } catch (ClassNotFoundException e) { }
-
- return bean;
- }
-
- /**
- * Get the DataContentHandler for this DataHandler:
- *
- * If a DataContentHandlerFactory is set, use it.
- * Otherwise look for an object to serve DCH in the
- * following order:
- *
- * 1) if a factory is set, use it
- * 2) if a CommandMap is set, use it
- * 3) use the default CommandMap
- *
- * In any case, wrap the real DataContentHandler with one of our own
- * to handle any missing cases, fill in defaults, and to ensure that
- * we always have a non-null DataContentHandler.
- *
- * @return the requested DataContentHandler
- */
- private synchronized DataContentHandler getDataContentHandler() {
-
- // make sure the factory didn't change
- if (factory != oldFactory) {
- oldFactory = factory;
- factoryDCH = null;
- dataContentHandler = null;
- transferFlavors = emptyFlavors;
- }
-
- if (dataContentHandler != null)
- return dataContentHandler;
-
- String simpleMT = getBaseType();
-
- if (factoryDCH == null && factory != null)
- factoryDCH = factory.createDataContentHandler(simpleMT);
-
- if (factoryDCH != null)
- dataContentHandler = factoryDCH;
-
- if (dataContentHandler == null) {
- if (dataSource != null)
- dataContentHandler = getCommandMap().
- createDataContentHandler(simpleMT, dataSource);
- else
- dataContentHandler = getCommandMap().
- createDataContentHandler(simpleMT);
- }
-
- // getDataContentHandler always uses these 'wrapper' handlers
- // to make sure it returns SOMETHING meaningful...
- if (dataSource != null)
- dataContentHandler = new DataSourceDataContentHandler(
- dataContentHandler,
- dataSource);
- else
- dataContentHandler = new ObjectDataContentHandler(
- dataContentHandler,
- object,
- objectMimeType);
- return dataContentHandler;
- }
-
- /**
- * Use the MimeType class to extract the MIME type/subtype,
- * ignoring the parameters. The type is cached.
- */
- private synchronized String getBaseType() {
- if (shortType == null) {
- String ct = getContentType();
- try {
- MimeType mt = new MimeType(ct);
- shortType = mt.getBaseType();
- } catch (MimeTypeParseException e) {
- shortType = ct;
- }
- }
- return shortType;
- }
-
- /**
- * Sets the DataContentHandlerFactory. The DataContentHandlerFactory
- * is called first to find DataContentHandlers.
- * The DataContentHandlerFactory can only be set once.
- *
- * If the DataContentHandlerFactory has already been set,
- * this method throws an Error.
- *
- * @param newFactory the DataContentHandlerFactory
- * @exception Error if the factory has already been defined.
- *
- * @see javax.activation.DataContentHandlerFactory
- */
- public static synchronized void setDataContentHandlerFactory(
- DataContentHandlerFactory newFactory) {
- if (factory != null)
- throw new Error("DataContentHandlerFactory already defined");
-
- SecurityManager security = System.getSecurityManager();
- if (security != null) {
- try {
- // if it's ok with the SecurityManager, it's ok with me...
- security.checkSetFactory();
- } catch (SecurityException ex) {
- // otherwise, we also allow it if this code and the
- // factory come from the same class loader (e.g.,
- // the JAF classes were loaded with the applet classes).
- if (DataHandler.class.getClassLoader() !=
- newFactory.getClass().getClassLoader())
- throw ex;
- }
- }
- factory = newFactory;
- }
-}
-
-/**
- * The DataHanderDataSource class implements the
- * DataSource interface when the DataHandler is constructed
- * with an Object and a mimeType string.
- */
-class DataHandlerDataSource implements DataSource {
- DataHandler dataHandler = null;
-
- /**
- * The constructor.
- */
- public DataHandlerDataSource(DataHandler dh) {
- this.dataHandler = dh;
- }
-
- /**
- * Returns an {@code InputStream} representing this object.
- * @return the {@code InputStream}
- */
- public InputStream getInputStream() throws IOException {
- return dataHandler.getInputStream();
- }
-
- /**
- * Returns the {@code OutputStream} for this object.
- * @return the {@code OutputStream}
- */
- public OutputStream getOutputStream() throws IOException {
- return dataHandler.getOutputStream();
- }
-
- /**
- * Returns the MIME type of the data represented by this object.
- * @return the MIME type
- */
- public String getContentType() {
- return dataHandler.getContentType();
- }
-
- /**
- * Returns the name of this object.
- * @return the name of this object
- */
- public String getName() {
- return dataHandler.getName(); // what else would it be?
- }
-}
-
-/*
- * DataSourceDataContentHandler
- *
- * This is a private DataContentHandler that wraps the real
- * DataContentHandler in the case where the DataHandler was instantiated
- * with a DataSource.
- */
-class DataSourceDataContentHandler implements DataContentHandler {
- private DataSource ds = null;
- private DataFlavor transferFlavors[] = null;
- private DataContentHandler dch = null;
-
- /**
- * The constructor.
- */
- public DataSourceDataContentHandler(DataContentHandler dch, DataSource ds) {
- this.ds = ds;
- this.dch = dch;
- }
-
- /**
- * Return the DataFlavors for this {@code DataContentHandler}.
- * @return the DataFlavors
- */
- public DataFlavor[] getTransferDataFlavors() {
-
- if (transferFlavors == null) {
- if (dch != null) { // is there a dch?
- transferFlavors = dch.getTransferDataFlavors();
- } else {
- transferFlavors = new DataFlavor[1];
- transferFlavors[0] =
- new ActivationDataFlavor(ds.getContentType(),
- ds.getContentType());
- }
- }
- return transferFlavors;
- }
-
- /**
- * Return the Transfer Data of type DataFlavor from InputStream.
- * @param df the DataFlavor
- * @param ds the DataSource
- * @return the constructed Object
- */
- public Object getTransferData(DataFlavor df, DataSource ds) throws
- UnsupportedFlavorException, IOException {
-
- if (dch != null)
- return dch.getTransferData(df, ds);
- else if (df.equals(getTransferDataFlavors()[0])) // only have one now
- return ds.getInputStream();
- else
- throw new UnsupportedFlavorException(df);
- }
-
- public Object getContent(DataSource ds) throws IOException {
-
- if (dch != null)
- return dch.getContent(ds);
- else
- return ds.getInputStream();
- }
-
- /**
- * Write the object to the output stream.
- */
- public void writeTo(Object obj, String mimeType, OutputStream os)
- throws IOException {
- if (dch != null)
- dch.writeTo(obj, mimeType, os);
- else
- throw new UnsupportedDataTypeException(
- "no DCH for content type " + ds.getContentType());
- }
-}
-
-/*
- * ObjectDataContentHandler
- *
- * This is a private DataContentHandler that wraps the real
- * DataContentHandler in the case where the DataHandler was instantiated
- * with an object.
- */
-class ObjectDataContentHandler implements DataContentHandler {
- private DataFlavor transferFlavors[] = null;
- private Object obj;
- private String mimeType;
- private DataContentHandler dch = null;
-
- /**
- * The constructor.
- */
- public ObjectDataContentHandler(DataContentHandler dch,
- Object obj, String mimeType) {
- this.obj = obj;
- this.mimeType = mimeType;
- this.dch = dch;
- }
-
- /**
- * Return the DataContentHandler for this object.
- * Used only by the DataHandler class.
- */
- public DataContentHandler getDCH() {
- return dch;
- }
-
- /**
- * Return the DataFlavors for this {@code DataContentHandler}.
- * @return the DataFlavors
- */
- public synchronized DataFlavor[] getTransferDataFlavors() {
- if (transferFlavors == null) {
- if (dch != null) {
- transferFlavors = dch.getTransferDataFlavors();
- } else {
- transferFlavors = new DataFlavor[1];
- transferFlavors[0] = new ActivationDataFlavor(obj.getClass(),
- mimeType, mimeType);
- }
- }
- return transferFlavors;
- }
-
- /**
- * Return the Transfer Data of type DataFlavor from InputStream.
- * @param df the DataFlavor
- * @param ds the DataSource
- * @return the constructed Object
- */
- public Object getTransferData(DataFlavor df, DataSource ds)
- throws UnsupportedFlavorException, IOException {
-
- if (dch != null)
- return dch.getTransferData(df, ds);
- else if (df.equals(getTransferDataFlavors()[0])) // only have one now
- return obj;
- else
- throw new UnsupportedFlavorException(df);
-
- }
-
- public Object getContent(DataSource ds) {
- return obj;
- }
-
- /**
- * Write the object to the output stream.
- */
- public void writeTo(Object obj, String mimeType, OutputStream os)
- throws IOException {
- if (dch != null)
- dch.writeTo(obj, mimeType, os);
- else if (obj instanceof byte[])
- os.write((byte[])obj);
- else if (obj instanceof String) {
- OutputStreamWriter osw = new OutputStreamWriter(os);
- osw.write((String)obj);
- osw.flush();
- } else throw new UnsupportedDataTypeException(
- "no object DCH for MIME type " + this.mimeType);
- }
-}
--- old/src/java.activation/share/classes/javax/activation/DataSource.java 2018-01-30 20:16:01.000000000 -0500
+++ /dev/null 2018-01-30 20:16:01.000000000 -0500
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * The DataSource interface provides the JavaBeans Activation Framework
- * with an abstraction of an arbitrary collection of data. It
- * provides a type for that data as well as access
- * to it in the form of InputStreams
and
- * OutputStreams
where appropriate.
- *
- * @since 1.6
- */
-
-public interface DataSource {
-
- /**
- * This method returns an InputStream
representing
- * the data and throws the appropriate exception if it can
- * not do so. Note that a new InputStream
object must be
- * returned each time this method is called, and the stream must be
- * positioned at the beginning of the data.
- *
- * @return an InputStream
- * @exception IOException for failures creating the InputStream
- */
- public InputStream getInputStream() throws IOException;
-
- /**
- * This method returns an OutputStream
where the
- * data can be written and throws the appropriate exception if it can
- * not do so. Note that a new OutputStream
object must
- * be returned each time this method is called, and the stream must
- * be positioned at the location the data is to be written.
- *
- * @return an OutputStream
- * @exception IOException for failures creating the OutputStream
- */
- public OutputStream getOutputStream() throws IOException;
-
- /**
- * This method returns the MIME type of the data in the form of a
- * string. It should always return a valid type. It is suggested
- * that getContentType return "application/octet-stream" if the
- * DataSource implementation can not determine the data type.
- *
- * @return the MIME Type
- */
- public String getContentType();
-
- /**
- * Return the name of this object where the name of the object
- * is dependant on the nature of the underlying objects. DataSources
- * encapsulating files may choose to return the filename of the object.
- * (Typically this would be the last component of the filename, not an
- * entire pathname.)
- *
- * @return the name of the object.
- */
- public String getName();
-}
--- old/src/java.activation/share/classes/javax/activation/FileDataSource.java 2018-01-30 20:16:01.000000000 -0500
+++ /dev/null 2018-01-30 20:16:01.000000000 -0500
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileNotFoundException;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import com.sun.activation.registries.MimeTypeFile;
-
-/**
- * The FileDataSource class implements a simple DataSource object
- * that encapsulates a file. It provides data typing services via
- * a FileTypeMap object.
- *
- * FileDataSource Typing Semantics
- *
- * The FileDataSource class delegates data typing of files
- * to an object subclassed from the FileTypeMap class.
- * The setFileTypeMap
method can be used to explicitly
- * set the FileTypeMap for an instance of FileDataSource. If no
- * FileTypeMap is set, the FileDataSource will call the FileTypeMap's
- * getDefaultFileTypeMap method to get the System's default FileTypeMap.
- *
- * @see javax.activation.DataSource
- * @see javax.activation.FileTypeMap
- * @see javax.activation.MimetypesFileTypeMap
- *
- * @since 1.6
- */
-public class FileDataSource implements DataSource {
-
- // keep track of original 'ref' passed in, non-null
- // one indicated which was passed in:
- private File _file = null;
- private FileTypeMap typeMap = null;
-
- /**
- * Creates a FileDataSource from a File object. Note:
- * The file will not actually be opened until a method is
- * called that requires the file to be opened.
- *
- * @param file the file
- */
- public FileDataSource(File file) {
- _file = file; // save the file Object...
- }
-
- /**
- * Creates a FileDataSource from
- * the specified path name. Note:
- * The file will not actually be opened until a method is
- * called that requires the file to be opened.
- *
- * @param name the system-dependent file name.
- */
- public FileDataSource(String name) {
- this(new File(name)); // use the file constructor
- }
-
- /**
- * This method will return an InputStream representing the
- * the data and will throw an IOException if it can
- * not do so. This method will return a new
- * instance of InputStream with each invocation.
- *
- * @return an InputStream
- */
- public InputStream getInputStream() throws IOException {
- return new FileInputStream(_file);
- }
-
- /**
- * This method will return an OutputStream representing the
- * the data and will throw an IOException if it can
- * not do so. This method will return a new instance of
- * OutputStream with each invocation.
- *
- * @return an OutputStream
- */
- public OutputStream getOutputStream() throws IOException {
- return new FileOutputStream(_file);
- }
-
- /**
- * This method returns the MIME type of the data in the form of a
- * string. This method uses the currently installed FileTypeMap. If
- * there is no FileTypeMap explictly set, the FileDataSource will
- * call the getDefaultFileTypeMap
method on
- * FileTypeMap to acquire a default FileTypeMap. Note: By
- * default, the FileTypeMap used will be a MimetypesFileTypeMap.
- *
- * @return the MIME Type
- * @see javax.activation.FileTypeMap#getDefaultFileTypeMap
- */
- public String getContentType() {
- // check to see if the type map is null?
- if (typeMap == null)
- return FileTypeMap.getDefaultFileTypeMap().getContentType(_file);
- else
- return typeMap.getContentType(_file);
- }
-
- /**
- * Return the name of this object. The FileDataSource
- * will return the file name of the object.
- *
- * @return the name of the object.
- * @see javax.activation.DataSource
- */
- public String getName() {
- return _file.getName();
- }
-
- /**
- * Return the File object that corresponds to this FileDataSource.
- * @return the File object for the file represented by this object.
- */
- public File getFile() {
- return _file;
- }
-
- /**
- * Set the FileTypeMap to use with this FileDataSource
- *
- * @param map The FileTypeMap for this object.
- */
- public void setFileTypeMap(FileTypeMap map) {
- typeMap = map;
- }
-}
--- old/src/java.activation/share/classes/javax/activation/FileTypeMap.java 2018-01-30 20:16:02.000000000 -0500
+++ /dev/null 2018-01-30 20:16:02.000000000 -0500
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.File;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * The FileTypeMap is an abstract class that provides a data typing
- * interface for files. Implementations of this class will
- * implement the getContentType methods which will derive a content
- * type from a file name or a File object. FileTypeMaps could use any
- * scheme to determine the data type, from examining the file extension
- * of a file (like the MimetypesFileTypeMap) to opening the file and
- * trying to derive its type from the contents of the file. The
- * FileDataSource class uses the default FileTypeMap (a MimetypesFileTypeMap
- * unless changed) to determine the content type of files.
- *
- * @see javax.activation.FileTypeMap
- * @see javax.activation.FileDataSource
- * @see javax.activation.MimetypesFileTypeMap
- *
- * @since 1.6
- */
-
-public abstract class FileTypeMap {
-
- private static FileTypeMap defaultMap = null;
- private static Map map =
- new WeakHashMap();
-
- /**
- * The default constructor.
- */
- public FileTypeMap() {
- super();
- }
-
- /**
- * Return the type of the file object. This method should
- * always return a valid MIME type.
- *
- * @param file A file to be typed.
- * @return The content type.
- */
- abstract public String getContentType(File file);
-
- /**
- * Return the type of the file passed in. This method should
- * always return a valid MIME type.
- *
- * @param filename the pathname of the file.
- * @return The content type.
- */
- abstract public String getContentType(String filename);
-
- /**
- * Sets the default FileTypeMap for the system. This instance
- * will be returned to callers of getDefaultFileTypeMap.
- *
- * @param fileTypeMap The FileTypeMap.
- * @exception SecurityException if the caller doesn't have permission
- * to change the default
- */
- public static synchronized void setDefaultFileTypeMap(FileTypeMap fileTypeMap) {
- SecurityManager security = System.getSecurityManager();
- if (security != null) {
- try {
- // if it's ok with the SecurityManager, it's ok with me...
- security.checkSetFactory();
- } catch (SecurityException ex) {
- // otherwise, we also allow it if this code and the
- // factory come from the same (non-system) class loader (e.g.,
- // the JAF classes were loaded with the applet classes).
- ClassLoader cl = FileTypeMap.class.getClassLoader();
- if (cl == null || cl.getParent() == null ||
- cl != fileTypeMap.getClass().getClassLoader())
- throw ex;
- }
- }
- // remove any per-thread-context-class-loader FileTypeMap
- map.remove(SecuritySupport.getContextClassLoader());
- defaultMap = fileTypeMap;
- }
-
- /**
- * Return the default FileTypeMap for the system.
- * If setDefaultFileTypeMap was called, return
- * that instance, otherwise return an instance of
- * MimetypesFileTypeMap
.
- *
- * @return The default FileTypeMap
- * @see javax.activation.FileTypeMap#setDefaultFileTypeMap
- */
- public static synchronized FileTypeMap getDefaultFileTypeMap() {
- if (defaultMap != null)
- return defaultMap;
-
- // fetch per-thread-context-class-loader default
- ClassLoader tccl = SecuritySupport.getContextClassLoader();
- FileTypeMap def = map.get(tccl);
- if (def == null) {
- def = new MimetypesFileTypeMap();
- map.put(tccl, def);
- }
- return def;
- }
-}
--- old/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java 2018-01-30 20:16:03.000000000 -0500
+++ /dev/null 2018-01-30 20:16:03.000000000 -0500
@@ -1,721 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package javax.activation;
-
-import java.util.*;
-import java.io.*;
-import java.net.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import com.sun.activation.registries.MailcapFile;
-import com.sun.activation.registries.LogSupport;
-
-/**
- * MailcapCommandMap extends the CommandMap
- * abstract class. It implements a CommandMap whose configuration
- * is based on mailcap files
- * (RFC 1524).
- * The MailcapCommandMap can be configured both programmatically
- * and via configuration files.
- *
- * Mailcap file search order:
- * The MailcapCommandMap looks in various places in the user's
- * system for mailcap file entries. When requests are made
- * to search for commands in the MailcapCommandMap, it searches
- * mailcap files in the following order:
- *
- * - Programatically added entries to the MailcapCommandMap instance.
- *
- The file {@code .mailcap} in the user's home directory.
- *
- The file {@code mailcap} in the Java runtime.
- *
- The file or resources named {@code META-INF/mailcap}.
- *
- The file or resource named {@code META-INF/mailcap.default}
- * (usually found only in the {@code activation.jar} file).
- *
- *
- * (The current implementation looks for the {@code mailcap} file
- * in the Java runtime in the directory java.home{@code /conf}
- * if it exists, and otherwise in the directory
- * java.home{@code /lib}, where java.home is the value
- * of the "java.home" System property. Note that the "conf" directory was
- * introduced in JDK 9.)
- *
- * Mailcap file format:
- *
- * Mailcap files must conform to the mailcap
- * file specification (RFC 1524, A User Agent Configuration Mechanism
- * For Multimedia Mail Format Information).
- * The file format consists of entries corresponding to
- * particular MIME types. In general, the specification
- * specifies applications for clients to use when they
- * themselves cannot operate on the specified MIME type. The
- * MailcapCommandMap extends this specification by using a parameter mechanism
- * in mailcap files that allows JavaBeans(tm) components to be specified as
- * corresponding to particular commands for a MIME type.
- *
- * When a mailcap file is
- * parsed, the MailcapCommandMap recognizes certain parameter signatures,
- * specifically those parameter names that begin with {@code x-java-}.
- * The MailcapCommandMap uses this signature to find
- * command entries for inclusion into its registries.
- * Parameter names with the form {@code x-java-}
- * are read by the MailcapCommandMap as identifying a command
- * with the name name. When the name is {@code
- * content-handler} the MailcapCommandMap recognizes the class
- * signified by this parameter as a DataContentHandler.
- * All other commands are handled generically regardless of command
- * name. The command implementation is specified by a fully qualified
- * class name of a JavaBean(tm) component. For example; a command for viewing
- * some data can be specified as: {@code x-java-view=com.foo.ViewBean}.
- *
- * When the command name is {@code fallback-entry}, the value of
- * the command may be {@code true} or {@code false}. An
- * entry for a MIME type that includes a parameter of
- * {@code x-java-fallback-entry=true} defines fallback commands
- * for that MIME type that will only be used if no non-fallback entry
- * can be found. For example, an entry of the form {@code text/*; ;
- * x-java-fallback-entry=true; x-java-view=com.sun.TextViewer}
- * specifies a view command to be used for any text MIME type. This
- * view command would only be used if a non-fallback view command for
- * the MIME type could not be found.
- *
- * MailcapCommandMap aware mailcap files have the
- * following general form:
- *
{@code
- * # Comments begin with a '#' and continue to the end of the line.
- * ; ;
- * # Where a parameter list consists of one or more parameters,
- * # where parameters look like: x-java-view=com.sun.TextViewer
- * # and a parameter list looks like:
- * text/plain; ; x-java-view=com.sun.TextViewer; x-java-edit=com.sun.TextEdit
- * # Note that mailcap entries that do not contain 'x-java' parameters
- * # and comply to RFC 1524 are simply ignored:
- * image/gif; /usr/dt/bin/sdtimage %s
- * }
- *
- * @author Bart Calder
- * @author Bill Shannon
- *
- * @since 1.6
- */
-
-public class MailcapCommandMap extends CommandMap {
- /*
- * We manage a collection of databases, searched in order.
- */
- private MailcapFile[] DB;
- private static final int PROG = 0; // programmatically added entries
-
- private static final String confDir;
-
- static {
- String dir = null;
- try {
- dir = (String)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- String home = System.getProperty("java.home");
- String newdir = home + File.separator + "conf";
- File conf = new File(newdir);
- if (conf.exists())
- return newdir + File.separator;
- else
- return home + File.separator + "lib" + File.separator;
- }
- });
- } catch (Exception ex) {
- // ignore any exceptions
- }
- confDir = dir;
- }
-
- /**
- * The default Constructor.
- */
- public MailcapCommandMap() {
- super();
- List dbv = new ArrayList(5); // usually 5 or less databases
- MailcapFile mf = null;
- dbv.add(null); // place holder for PROG entry
-
- LogSupport.log("MailcapCommandMap: load HOME");
- try {
- String user_home = System.getProperty("user.home");
-
- if (user_home != null) {
- String path = user_home + File.separator + ".mailcap";
- mf = loadFile(path);
- if (mf != null)
- dbv.add(mf);
- }
- } catch (SecurityException ex) {}
-
- LogSupport.log("MailcapCommandMap: load SYS");
- try {
- // check system's home
- if (confDir != null) {
- mf = loadFile(confDir + "mailcap");
- if (mf != null)
- dbv.add(mf);
- }
- } catch (SecurityException ex) {}
-
- LogSupport.log("MailcapCommandMap: load JAR");
- // load from the app's jar file
- loadAllResources(dbv, "META-INF/mailcap");
-
- LogSupport.log("MailcapCommandMap: load DEF");
- mf = loadResource("/META-INF/mailcap.default");
-
- if (mf != null)
- dbv.add(mf);
-
- DB = new MailcapFile[dbv.size()];
- DB = (MailcapFile[])dbv.toArray(DB);
- }
-
- /**
- * Load from the named resource.
- */
- private MailcapFile loadResource(String name) {
- InputStream clis = null;
- try {
- clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
- if (clis != null) {
- MailcapFile mf = new MailcapFile(clis);
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: successfully loaded " +
- "mailcap file: " + name);
- return mf;
- } else {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: not loading " +
- "mailcap file: " + name);
- }
- } catch (IOException e) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: can't load " + name, e);
- } catch (SecurityException sex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: can't load " + name, sex);
- } finally {
- try {
- if (clis != null)
- clis.close();
- } catch (IOException ex) { } // ignore it
- }
- return null;
- }
-
- /**
- * Load all of the named resource.
- */
- private void loadAllResources(List v, String name) {
- boolean anyLoaded = false;
- try {
- URL[] urls;
- ClassLoader cld = null;
- // First try the "application's" class loader.
- cld = SecuritySupport.getContextClassLoader();
- if (cld == null)
- cld = this.getClass().getClassLoader();
- if (cld != null)
- urls = SecuritySupport.getResources(cld, name);
- else
- urls = SecuritySupport.getSystemResources(name);
- if (urls != null) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: getResources");
- for (int i = 0; i < urls.length; i++) {
- URL url = urls[i];
- InputStream clis = null;
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: URL " + url);
- try {
- clis = SecuritySupport.openStream(url);
- if (clis != null) {
- v.add(new MailcapFile(clis));
- anyLoaded = true;
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: " +
- "successfully loaded " +
- "mailcap file from URL: " +
- url);
- } else {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: " +
- "not loading mailcap " +
- "file from URL: " + url);
- }
- } catch (IOException ioex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: can't load " +
- url, ioex);
- } catch (SecurityException sex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: can't load " +
- url, sex);
- } finally {
- try {
- if (clis != null)
- clis.close();
- } catch (IOException cex) { }
- }
- }
- }
- } catch (Exception ex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: can't load " + name, ex);
- }
-
- // if failed to load anything, fall back to old technique, just in case
- if (!anyLoaded) {
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: !anyLoaded");
- MailcapFile mf = loadResource("/" + name);
- if (mf != null)
- v.add(mf);
- }
- }
-
- /**
- * Load from the named file.
- */
- private MailcapFile loadFile(String name) {
- MailcapFile mtf = null;
-
- try {
- mtf = new MailcapFile(name);
- } catch (IOException e) {
- // e.printStackTrace();
- }
- return mtf;
- }
-
- /**
- * Constructor that allows the caller to specify the path
- * of a mailcap file.
- *
- * @param fileName The name of the mailcap file to open
- * @exception IOException if the file can't be accessed
- */
- public MailcapCommandMap(String fileName) throws IOException {
- this();
-
- if (LogSupport.isLoggable())
- LogSupport.log("MailcapCommandMap: load PROG from " + fileName);
- if (DB[PROG] == null) {
- DB[PROG] = new MailcapFile(fileName);
- }
- }
-
-
- /**
- * Constructor that allows the caller to specify an InputStream
- * containing a mailcap file.
- *
- * @param is InputStream of the mailcap file to open
- */
- public MailcapCommandMap(InputStream is) {
- this();
-
- LogSupport.log("MailcapCommandMap: load PROG");
- if (DB[PROG] == null) {
- try {
- DB[PROG] = new MailcapFile(is);
- } catch (IOException ex) {
- // XXX - should throw it
- }
- }
- }
-
- /**
- * Get the preferred command list for a MIME Type. The MailcapCommandMap
- * searches the mailcap files as described above under
- * Mailcap file search order.
- *
- * The result of the search is a proper subset of available
- * commands in all mailcap files known to this instance of
- * MailcapCommandMap. The first entry for a particular command
- * is considered the preferred command.
- *
- * @param mimeType the MIME type
- * @return the CommandInfo objects representing the preferred commands.
- */
- public synchronized CommandInfo[] getPreferredCommands(String mimeType) {
- List cmdList = new ArrayList();
- if (mimeType != null)
- mimeType = mimeType.toLowerCase(Locale.ENGLISH);
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- Map cmdMap = DB[i].getMailcapList(mimeType);
- if (cmdMap != null)
- appendPrefCmdsToList(cmdMap, cmdList);
- }
-
- // now add the fallback commands
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- Map cmdMap = DB[i].getMailcapFallbackList(mimeType);
- if (cmdMap != null)
- appendPrefCmdsToList(cmdMap, cmdList);
- }
-
- CommandInfo[] cmdInfos = new CommandInfo[cmdList.size()];
- cmdInfos = (CommandInfo[])cmdList.toArray(cmdInfos);
-
- return cmdInfos;
- }
-
- /**
- * Put the commands that are in the hash table, into the list.
- */
- private void appendPrefCmdsToList(Map cmdHash, List cmdList) {
- Iterator verb_enum = cmdHash.keySet().iterator();
-
- while (verb_enum.hasNext()) {
- String verb = (String)verb_enum.next();
- if (!checkForVerb(cmdList, verb)) {
- List cmdList2 = (List)cmdHash.get(verb); // get the list
- String className = (String)cmdList2.get(0);
- cmdList.add(new CommandInfo(verb, className));
- }
- }
- }
-
- /**
- * Check the cmdList to see if this command exists, return
- * true if the verb is there.
- */
- private boolean checkForVerb(List cmdList, String verb) {
- Iterator ee = cmdList.iterator();
- while (ee.hasNext()) {
- String enum_verb =
- (String)((CommandInfo)ee.next()).getCommandName();
- if (enum_verb.equals(verb))
- return true;
- }
- return false;
- }
-
- /**
- * Get all the available commands in all mailcap files known to
- * this instance of MailcapCommandMap for this MIME type.
- *
- * @param mimeType the MIME type
- * @return the CommandInfo objects representing all the commands.
- */
- public synchronized CommandInfo[] getAllCommands(String mimeType) {
- List cmdList = new ArrayList();
- if (mimeType != null)
- mimeType = mimeType.toLowerCase(Locale.ENGLISH);
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- Map cmdMap = DB[i].getMailcapList(mimeType);
- if (cmdMap != null)
- appendCmdsToList(cmdMap, cmdList);
- }
-
- // now add the fallback commands
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- Map cmdMap = DB[i].getMailcapFallbackList(mimeType);
- if (cmdMap != null)
- appendCmdsToList(cmdMap, cmdList);
- }
-
- CommandInfo[] cmdInfos = new CommandInfo[cmdList.size()];
- cmdInfos = (CommandInfo[])cmdList.toArray(cmdInfos);
-
- return cmdInfos;
- }
-
- /**
- * Put the commands that are in the hash table, into the list.
- */
- private void appendCmdsToList(Map typeHash, List cmdList) {
- Iterator verb_enum = typeHash.keySet().iterator();
-
- while (verb_enum.hasNext()) {
- String verb = (String)verb_enum.next();
- List cmdList2 = (List)typeHash.get(verb);
- Iterator cmd_enum = ((List)cmdList2).iterator();
-
- while (cmd_enum.hasNext()) {
- String cmd = (String)cmd_enum.next();
- cmdList.add(new CommandInfo(verb, cmd));
- // cmdList.add(0, new CommandInfo(verb, cmd));
- }
- }
- }
-
- /**
- * Get the command corresponding to {@code cmdName} for the MIME type.
- *
- * @param mimeType the MIME type
- * @param cmdName the command name
- * @return the CommandInfo object corresponding to the command.
- */
- public synchronized CommandInfo getCommand(String mimeType,
- String cmdName) {
- if (mimeType != null)
- mimeType = mimeType.toLowerCase(Locale.ENGLISH);
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- Map cmdMap = DB[i].getMailcapList(mimeType);
- if (cmdMap != null) {
- // get the cmd list for the cmd
- List v = (List)cmdMap.get(cmdName);
- if (v != null) {
- String cmdClassName = (String)v.get(0);
-
- if (cmdClassName != null)
- return new CommandInfo(cmdName, cmdClassName);
- }
- }
- }
-
- // now try the fallback list
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- Map cmdMap = DB[i].getMailcapFallbackList(mimeType);
- if (cmdMap != null) {
- // get the cmd list for the cmd
- List v = (List)cmdMap.get(cmdName);
- if (v != null) {
- String cmdClassName = (String)v.get(0);
-
- if (cmdClassName != null)
- return new CommandInfo(cmdName, cmdClassName);
- }
- }
- }
- return null;
- }
-
- /**
- * Add entries to the registry. Programmatically
- * added entries are searched before other entries.
- *
- * The string that is passed in should be in mailcap
- * format.
- *
- * @param mail_cap a correctly formatted mailcap string
- */
- public synchronized void addMailcap(String mail_cap) {
- // check to see if one exists
- LogSupport.log("MailcapCommandMap: add to PROG");
- if (DB[PROG] == null)
- DB[PROG] = new MailcapFile();
-
- DB[PROG].appendToMailcap(mail_cap);
- }
-
- /**
- * Return the DataContentHandler for the specified MIME type.
- *
- * @param mimeType the MIME type
- * @return the DataContentHandler
- */
- public synchronized DataContentHandler createDataContentHandler(
- String mimeType) {
- if (LogSupport.isLoggable())
- LogSupport.log(
- "MailcapCommandMap: createDataContentHandler for " + mimeType);
- if (mimeType != null)
- mimeType = mimeType.toLowerCase(Locale.ENGLISH);
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- if (LogSupport.isLoggable())
- LogSupport.log(" search DB #" + i);
- Map cmdMap = DB[i].getMailcapList(mimeType);
- if (cmdMap != null) {
- List v = (List)cmdMap.get("content-handler");
- if (v != null) {
- String name = (String)v.get(0);
- DataContentHandler dch = getDataContentHandler(name);
- if (dch != null)
- return dch;
- }
- }
- }
-
- // now try the fallback entries
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- if (LogSupport.isLoggable())
- LogSupport.log(" search fallback DB #" + i);
- Map cmdMap = DB[i].getMailcapFallbackList(mimeType);
- if (cmdMap != null) {
- List v = (List)cmdMap.get("content-handler");
- if (v != null) {
- String name = (String)v.get(0);
- DataContentHandler dch = getDataContentHandler(name);
- if (dch != null)
- return dch;
- }
- }
- }
- return null;
- }
-
- private DataContentHandler getDataContentHandler(String name) {
- if (LogSupport.isLoggable())
- LogSupport.log(" got content-handler");
- if (LogSupport.isLoggable())
- LogSupport.log(" class " + name);
- try {
- ClassLoader cld = null;
- // First try the "application's" class loader.
- cld = SecuritySupport.getContextClassLoader();
- if (cld == null)
- cld = this.getClass().getClassLoader();
- Class cl = null;
- try {
- cl = cld.loadClass(name);
- } catch (Exception ex) {
- // if anything goes wrong, do it the old way
- cl = Class.forName(name);
- }
- return (DataContentHandler) cl.newInstance();
- } catch (IllegalAccessException e) {
- if (LogSupport.isLoggable())
- LogSupport.log("Can't load DCH " + name, e);
- } catch (ClassNotFoundException e) {
- if (LogSupport.isLoggable())
- LogSupport.log("Can't load DCH " + name, e);
- } catch (InstantiationException e) {
- if (LogSupport.isLoggable())
- LogSupport.log("Can't load DCH " + name, e);
- }
- return null;
- }
-
- /**
- * Get all the MIME types known to this command map.
- *
- * @return array of MIME types as strings
- * @since 1.6, JAF 1.1
- */
- public synchronized String[] getMimeTypes() {
- List mtList = new ArrayList();
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- String[] ts = DB[i].getMimeTypes();
- if (ts != null) {
- for (int j = 0; j < ts.length; j++) {
- // eliminate duplicates
- if (!mtList.contains(ts[j]))
- mtList.add(ts[j]);
- }
- }
- }
-
- String[] mts = new String[mtList.size()];
- mts = (String[])mtList.toArray(mts);
-
- return mts;
- }
-
- /**
- * Get the native commands for the given MIME type.
- * Returns an array of strings where each string is
- * an entire mailcap file entry. The application
- * will need to parse the entry to extract the actual
- * command as well as any attributes it needs. See
- * RFC 1524
- * for details of the mailcap entry syntax. Only mailcap
- * entries that specify a view command for the specified
- * MIME type are returned.
- *
- * @param mimeType the MIME type
- * @return array of native command entries
- * @since 1.6, JAF 1.1
- */
- public synchronized String[] getNativeCommands(String mimeType) {
- List cmdList = new ArrayList();
- if (mimeType != null)
- mimeType = mimeType.toLowerCase(Locale.ENGLISH);
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- String[] cmds = DB[i].getNativeCommands(mimeType);
- if (cmds != null) {
- for (int j = 0; j < cmds.length; j++) {
- // eliminate duplicates
- if (!cmdList.contains(cmds[j]))
- cmdList.add(cmds[j]);
- }
- }
- }
-
- String[] cmds = new String[cmdList.size()];
- cmds = (String[])cmdList.toArray(cmds);
-
- return cmds;
- }
-
- /**
- * for debugging...
- *
- public static void main(String[] argv) throws Exception {
- MailcapCommandMap map = new MailcapCommandMap();
- CommandInfo[] cmdInfo;
-
- cmdInfo = map.getPreferredCommands(argv[0]);
- System.out.println("Preferred Commands:");
- for (int i = 0; i < cmdInfo.length; i++)
- System.out.println("Command " + cmdInfo[i].getCommandName() + " [" +
- cmdInfo[i].getCommandClass() + "]");
- cmdInfo = map.getAllCommands(argv[0]);
- System.out.println();
- System.out.println("All Commands:");
- for (int i = 0; i < cmdInfo.length; i++)
- System.out.println("Command " + cmdInfo[i].getCommandName() + " [" +
- cmdInfo[i].getCommandClass() + "]");
- DataContentHandler dch = map.createDataContentHandler(argv[0]);
- if (dch != null)
- System.out.println("DataContentHandler " +
- dch.getClass().toString());
- System.exit(0);
- }
- */
-}
--- old/src/java.activation/share/classes/javax/activation/MimeType.java 2018-01-30 20:16:03.000000000 -0500
+++ /dev/null 2018-01-30 20:16:03.000000000 -0500
@@ -1,346 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.*;
-import java.util.Locale;
-
-/**
- * A Multipurpose Internet Mail Extension (MIME) type, as defined
- * in RFC 2045 and 2046.
- *
- * @since 1.6
- */
-public class MimeType implements Externalizable {
-
- private String primaryType;
- private String subType;
- private MimeTypeParameterList parameters;
-
- /**
- * A string that holds all the special chars.
- */
- private static final String TSPECIALS = "()<>@,;:/[]?=\\\"";
-
- /**
- * Default constructor.
- */
- public MimeType() {
- primaryType = "application";
- subType = "*";
- parameters = new MimeTypeParameterList();
- }
-
- /**
- * Constructor that builds a MimeType from a String.
- *
- * @param rawdata the MIME type string
- * @exception MimeTypeParseException if the MIME type can't be parsed
- */
- public MimeType(String rawdata) throws MimeTypeParseException {
- parse(rawdata);
- }
-
- /**
- * Constructor that builds a MimeType with the given primary and sub type
- * but has an empty parameter list.
- *
- * @param primary the primary MIME type
- * @param sub the MIME sub-type
- * @exception MimeTypeParseException if the primary type or subtype
- * is not a valid token
- */
- public MimeType(String primary, String sub) throws MimeTypeParseException {
- // check to see if primary is valid
- if (isValidToken(primary)) {
- primaryType = primary.toLowerCase(Locale.ENGLISH);
- } else {
- throw new MimeTypeParseException("Primary type is invalid.");
- }
-
- // check to see if sub is valid
- if (isValidToken(sub)) {
- subType = sub.toLowerCase(Locale.ENGLISH);
- } else {
- throw new MimeTypeParseException("Sub type is invalid.");
- }
-
- parameters = new MimeTypeParameterList();
- }
-
- /**
- * A routine for parsing the MIME type out of a String.
- */
- private void parse(String rawdata) throws MimeTypeParseException {
- int slashIndex = rawdata.indexOf('/');
- int semIndex = rawdata.indexOf(';');
- if ((slashIndex < 0) && (semIndex < 0)) {
- // neither character is present, so treat it
- // as an error
- throw new MimeTypeParseException("Unable to find a sub type.");
- } else if ((slashIndex < 0) && (semIndex >= 0)) {
- // we have a ';' (and therefore a parameter list),
- // but no '/' indicating a sub type is present
- throw new MimeTypeParseException("Unable to find a sub type.");
- } else if ((slashIndex >= 0) && (semIndex < 0)) {
- // we have a primary and sub type but no parameter list
- primaryType = rawdata.substring(0, slashIndex).trim().
- toLowerCase(Locale.ENGLISH);
- subType = rawdata.substring(slashIndex + 1).trim().
- toLowerCase(Locale.ENGLISH);
- parameters = new MimeTypeParameterList();
- } else if (slashIndex < semIndex) {
- // we have all three items in the proper sequence
- primaryType = rawdata.substring(0, slashIndex).trim().
- toLowerCase(Locale.ENGLISH);
- subType = rawdata.substring(slashIndex + 1, semIndex).trim().
- toLowerCase(Locale.ENGLISH);
- parameters = new MimeTypeParameterList(rawdata.substring(semIndex));
- } else {
- // we have a ';' lexically before a '/' which means we
- // have a primary type and a parameter list but no sub type
- throw new MimeTypeParseException("Unable to find a sub type.");
- }
-
- // now validate the primary and sub types
-
- // check to see if primary is valid
- if (!isValidToken(primaryType))
- throw new MimeTypeParseException("Primary type is invalid.");
-
- // check to see if sub is valid
- if (!isValidToken(subType))
- throw new MimeTypeParseException("Sub type is invalid.");
- }
-
- /**
- * Retrieve the primary type of this object.
- *
- * @return the primary MIME type
- */
- public String getPrimaryType() {
- return primaryType;
- }
-
- /**
- * Set the primary type for this object to the given String.
- *
- * @param primary the primary MIME type
- * @exception MimeTypeParseException if the primary type
- * is not a valid token
- */
- public void setPrimaryType(String primary) throws MimeTypeParseException {
- // check to see if primary is valid
- if (!isValidToken(primaryType))
- throw new MimeTypeParseException("Primary type is invalid.");
- primaryType = primary.toLowerCase(Locale.ENGLISH);
- }
-
- /**
- * Retrieve the subtype of this object.
- *
- * @return the MIME subtype
- */
- public String getSubType() {
- return subType;
- }
-
- /**
- * Set the subtype for this object to the given String.
- *
- * @param sub the MIME subtype
- * @exception MimeTypeParseException if the subtype
- * is not a valid token
- */
- public void setSubType(String sub) throws MimeTypeParseException {
- // check to see if sub is valid
- if (!isValidToken(subType))
- throw new MimeTypeParseException("Sub type is invalid.");
- subType = sub.toLowerCase(Locale.ENGLISH);
- }
-
- /**
- * Retrieve this object's parameter list.
- *
- * @return a MimeTypeParameterList object representing the parameters
- */
- public MimeTypeParameterList getParameters() {
- return parameters;
- }
-
- /**
- * Retrieve the value associated with the given name, or null if there
- * is no current association.
- *
- * @param name the parameter name
- * @return the paramter's value
- */
- public String getParameter(String name) {
- return parameters.get(name);
- }
-
- /**
- * Set the value to be associated with the given name, replacing
- * any previous association.
- *
- * @param name the parameter name
- * @param value the paramter's value
- */
- public void setParameter(String name, String value) {
- parameters.set(name, value);
- }
-
- /**
- * Remove any value associated with the given name.
- *
- * @param name the parameter name
- */
- public void removeParameter(String name) {
- parameters.remove(name);
- }
-
- /**
- * Return the String representation of this object.
- */
- public String toString() {
- return getBaseType() + parameters.toString();
- }
-
- /**
- * Return a String representation of this object
- * without the parameter list.
- *
- * @return the MIME type and sub-type
- */
- public String getBaseType() {
- return primaryType + "/" + subType;
- }
-
- /**
- * Determine if the primary and sub type of this object is
- * the same as what is in the given type.
- *
- * @param type the MimeType object to compare with
- * @return true if they match
- */
- public boolean match(MimeType type) {
- return primaryType.equals(type.getPrimaryType())
- && (subType.equals("*")
- || type.getSubType().equals("*")
- || (subType.equals(type.getSubType())));
- }
-
- /**
- * Determine if the primary and sub type of this object is
- * the same as the content type described in rawdata.
- *
- * @param rawdata the MIME type string to compare with
- * @return true if they match
- * @exception MimeTypeParseException if the MIME type can't be parsed
- */
- public boolean match(String rawdata) throws MimeTypeParseException {
- return match(new MimeType(rawdata));
- }
-
- /**
- * The object implements the writeExternal method to save its contents
- * by calling the methods of DataOutput for its primitive values or
- * calling the writeObject method of ObjectOutput for objects, strings
- * and arrays.
- *
- * @param out the ObjectOutput object to write to
- * @exception IOException Includes any I/O exceptions that may occur
- */
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(toString());
- out.flush();
- }
-
- /**
- * The object implements the readExternal method to restore its
- * contents by calling the methods of DataInput for primitive
- * types and readObject for objects, strings and arrays. The
- * readExternal method must read the values in the same sequence
- * and with the same types as were written by writeExternal.
- *
- * @param in the ObjectInput object to read from
- * @exception ClassNotFoundException If the class for an object being
- * restored cannot be found.
- */
- public void readExternal(ObjectInput in)
- throws IOException, ClassNotFoundException {
- try {
- parse(in.readUTF());
- } catch (MimeTypeParseException e) {
- throw new IOException(e.toString());
- }
- }
-
- // below here be scary parsing related things
-
- /**
- * Determine whether or not a given character belongs to a legal token.
- */
- private static boolean isTokenChar(char c) {
- return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
- }
-
- /**
- * Determine whether or not a given string is a legal token.
- */
- private boolean isValidToken(String s) {
- int len = s.length();
- if (len > 0) {
- for (int i = 0; i < len; ++i) {
- char c = s.charAt(i);
- if (!isTokenChar(c)) {
- return false;
- }
- }
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * A simple parser test,
- * for debugging...
- *
- public static void main(String[] args)
- throws MimeTypeParseException, IOException {
- for (int i = 0; i < args.length; ++i) {
- System.out.println("Original: " + args[i]);
-
- MimeType type = new MimeType(args[i]);
-
- System.out.println("Short: " + type.getBaseType());
- System.out.println("Parsed: " + type.toString());
- System.out.println();
- }
- }
- */
-}
--- old/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java 2018-01-30 20:16:04.000000000 -0500
+++ /dev/null 2018-01-30 20:16:04.000000000 -0500
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Locale;
-
-/**
- * A parameter list of a MimeType
- * as defined in RFC 2045 and 2046. The Primary type of the
- * object must already be stripped off.
- *
- * @see javax.activation.MimeType
- *
- * @since 1.6
- */
-public class MimeTypeParameterList {
- private Hashtable parameters;
-
- /**
- * A string that holds all the special chars.
- */
- private static final String TSPECIALS = "()<>@,;:/[]?=\\\"";
-
-
- /**
- * Default constructor.
- */
- public MimeTypeParameterList() {
- parameters = new Hashtable();
- }
-
- /**
- * Constructs a new MimeTypeParameterList with the passed in data.
- *
- * @param parameterList an RFC 2045, 2046 compliant parameter list.
- * @exception MimeTypeParseException if the MIME type can't be parsed
- */
- public MimeTypeParameterList(String parameterList)
- throws MimeTypeParseException {
- parameters = new Hashtable();
-
- // now parse rawdata
- parse(parameterList);
- }
-
- /**
- * A routine for parsing the parameter list out of a String.
- *
- * @param parameterList an RFC 2045, 2046 compliant parameter list.
- * @exception MimeTypeParseException if the MIME type can't be parsed
- */
- protected void parse(String parameterList) throws MimeTypeParseException {
- if (parameterList == null)
- return;
-
- int length = parameterList.length();
- if (length <= 0)
- return;
-
- int i;
- char c;
- for (i = skipWhiteSpace(parameterList, 0);
- i < length && (c = parameterList.charAt(i)) == ';';
- i = skipWhiteSpace(parameterList, i)) {
- int lastIndex;
- String name;
- String value;
-
- // eat the ';'
- i++;
-
- // now parse the parameter name
-
- // skip whitespace
- i = skipWhiteSpace(parameterList, i);
-
- // tolerate trailing semicolon, even though it violates the spec
- if (i >= length)
- return;
-
- // find the end of the token char run
- lastIndex = i;
- while ((i < length) && isTokenChar(parameterList.charAt(i)))
- i++;
-
- name = parameterList.substring(lastIndex, i).
- toLowerCase(Locale.ENGLISH);
-
- // now parse the '=' that separates the name from the value
- i = skipWhiteSpace(parameterList, i);
-
- if (i >= length || parameterList.charAt(i) != '=')
- throw new MimeTypeParseException(
- "Couldn't find the '=' that separates a " +
- "parameter name from its value.");
-
- // eat it and parse the parameter value
- i++;
- i = skipWhiteSpace(parameterList, i);
-
- if (i >= length)
- throw new MimeTypeParseException(
- "Couldn't find a value for parameter named " + name);
-
- // now find out whether or not we have a quoted value
- c = parameterList.charAt(i);
- if (c == '"') {
- // yup it's quoted so eat it and capture the quoted string
- i++;
- if (i >= length)
- throw new MimeTypeParseException(
- "Encountered unterminated quoted parameter value.");
-
- lastIndex = i;
-
- // find the next unescaped quote
- while (i < length) {
- c = parameterList.charAt(i);
- if (c == '"')
- break;
- if (c == '\\') {
- // found an escape sequence
- // so skip this and the
- // next character
- i++;
- }
- i++;
- }
- if (c != '"')
- throw new MimeTypeParseException(
- "Encountered unterminated quoted parameter value.");
-
- value = unquote(parameterList.substring(lastIndex, i));
- // eat the quote
- i++;
- } else if (isTokenChar(c)) {
- // nope it's an ordinary token so it
- // ends with a non-token char
- lastIndex = i;
- while (i < length && isTokenChar(parameterList.charAt(i)))
- i++;
- value = parameterList.substring(lastIndex, i);
- } else {
- // it ain't a value
- throw new MimeTypeParseException(
- "Unexpected character encountered at index " + i);
- }
-
- // now put the data into the hashtable
- parameters.put(name, value);
- }
- if (i < length) {
- throw new MimeTypeParseException(
- "More characters encountered in input than expected.");
- }
- }
-
- /**
- * Return the number of name-value pairs in this list.
- *
- * @return the number of parameters
- */
- public int size() {
- return parameters.size();
- }
-
- /**
- * Determine whether or not this list is empty.
- *
- * @return true if there are no parameters
- */
- public boolean isEmpty() {
- return parameters.isEmpty();
- }
-
- /**
- * Retrieve the value associated with the given name, or null if there
- * is no current association.
- *
- * @param name the parameter name
- * @return the parameter's value
- */
- public String get(String name) {
- return (String)parameters.get(name.trim().toLowerCase(Locale.ENGLISH));
- }
-
- /**
- * Set the value to be associated with the given name, replacing
- * any previous association.
- *
- * @param name the parameter name
- * @param value the parameter's value
- */
- public void set(String name, String value) {
- parameters.put(name.trim().toLowerCase(Locale.ENGLISH), value);
- }
-
- /**
- * Remove any value associated with the given name.
- *
- * @param name the parameter name
- */
- public void remove(String name) {
- parameters.remove(name.trim().toLowerCase(Locale.ENGLISH));
- }
-
- /**
- * Retrieve an enumeration of all the names in this list.
- *
- * @return an enumeration of all parameter names
- */
- public Enumeration getNames() {
- return parameters.keys();
- }
-
- /**
- * Return a string representation of this object.
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.ensureCapacity(parameters.size() * 16);
- // heuristic: 8 characters per field
-
- Enumeration keys = parameters.keys();
- while (keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- buffer.append("; ");
- buffer.append(key);
- buffer.append('=');
- buffer.append(quote((String)parameters.get(key)));
- }
-
- return buffer.toString();
- }
-
- // below here be scary parsing related things
-
- /**
- * Determine whether or not a given character belongs to a legal token.
- */
- private static boolean isTokenChar(char c) {
- return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
- }
-
- /**
- * return the index of the first non white space character in
- * rawdata at or after index i.
- */
- private static int skipWhiteSpace(String rawdata, int i) {
- int length = rawdata.length();
- while ((i < length) && Character.isWhitespace(rawdata.charAt(i)))
- i++;
- return i;
- }
-
- /**
- * A routine that knows how and when to quote and escape the given value.
- */
- private static String quote(String value) {
- boolean needsQuotes = false;
-
- // check to see if we actually have to quote this thing
- int length = value.length();
- for (int i = 0; (i < length) && !needsQuotes; i++) {
- needsQuotes = !isTokenChar(value.charAt(i));
- }
-
- if (needsQuotes) {
- StringBuffer buffer = new StringBuffer();
- buffer.ensureCapacity((int)(length * 1.5));
-
- // add the initial quote
- buffer.append('"');
-
- // add the properly escaped text
- for (int i = 0; i < length; ++i) {
- char c = value.charAt(i);
- if ((c == '\\') || (c == '"'))
- buffer.append('\\');
- buffer.append(c);
- }
-
- // add the closing quote
- buffer.append('"');
-
- return buffer.toString();
- } else {
- return value;
- }
- }
-
- /**
- * A routine that knows how to strip the quotes and
- * escape sequences from the given value.
- */
- private static String unquote(String value) {
- int valueLength = value.length();
- StringBuffer buffer = new StringBuffer();
- buffer.ensureCapacity(valueLength);
-
- boolean escaped = false;
- for (int i = 0; i < valueLength; ++i) {
- char currentChar = value.charAt(i);
- if (!escaped && (currentChar != '\\')) {
- buffer.append(currentChar);
- } else if (escaped) {
- buffer.append(currentChar);
- escaped = false;
- } else {
- escaped = true;
- }
- }
-
- return buffer.toString();
- }
-}
--- old/src/java.activation/share/classes/javax/activation/MimeTypeParseException.java 2018-01-30 20:16:04.000000000 -0500
+++ /dev/null 2018-01-30 20:16:05.000000000 -0500
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-/**
- * A class to encapsulate MimeType parsing related exceptions.
- *
- * @since 1.6
- */
-public class MimeTypeParseException extends Exception {
-
- /**
- * Constructs a MimeTypeParseException with no specified detail message.
- */
- public MimeTypeParseException() {
- super();
- }
-
- /**
- * Constructs a MimeTypeParseException with the specified detail message.
- *
- * @param s the detail message.
- */
- public MimeTypeParseException(String s) {
- super(s);
- }
-}
--- old/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java 2018-01-30 20:16:05.000000000 -0500
+++ /dev/null 2018-01-30 20:16:05.000000000 -0500
@@ -1,360 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import com.sun.activation.registries.MimeTypeFile;
-import com.sun.activation.registries.LogSupport;
-
-/**
- * This class extends FileTypeMap and provides data typing of files
- * via their file extension. It uses the {@code .mime.types} format.
- *
- * MIME types file search order:
- * The MimetypesFileTypeMap looks in various places in the user's
- * system for MIME types file entries. When requests are made
- * to search for MIME types in the MimetypesFileTypeMap, it searches
- * MIME types files in the following order:
- *
- * - Programmatically added entries to the MimetypesFileTypeMap instance.
- *
- The file {@code .mime.types} in the user's home directory.
- *
- The file {@code mime.types} in the Java runtime.
- *
- The file or resources named {@code META-INF/mime.types}.
- *
- The file or resource named {@code META-INF/mimetypes.default}
- * (usually found only in the {@code activation.jar} file).
- *
- *
- * (The current implementation looks for the {@code mime.types} file
- * in the Java runtime in the directory java.home{@code /conf}
- * if it exists, and otherwise in the directory
- * java.home{@code /lib}, where java.home is the value
- * of the "java.home" System property. Note that the "conf" directory was
- * introduced in JDK 9.)
- *
- * MIME types file format:
- *
- *
{@code
- * # comments begin with a '#'
- * # the format is
- * # for example:
- * text/plain txt text TXT
- * # this would map file.txt, file.text, and file.TXT to
- * # the mime type "text/plain"
- * }
- *
- * @author Bart Calder
- * @author Bill Shannon
- *
- * @since 1.6
- */
-public class MimetypesFileTypeMap extends FileTypeMap {
- /*
- * We manage a collection of databases, searched in order.
- */
- private MimeTypeFile[] DB;
- private static final int PROG = 0; // programmatically added entries
-
- private static final String defaultType = "application/octet-stream";
-
- private static final String confDir;
-
- static {
- String dir = null;
- try {
- dir = (String)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- String home = System.getProperty("java.home");
- String newdir = home + File.separator + "conf";
- File conf = new File(newdir);
- if (conf.exists())
- return newdir + File.separator;
- else
- return home + File.separator + "lib" + File.separator;
- }
- });
- } catch (Exception ex) {
- // ignore any exceptions
- }
- confDir = dir;
- }
-
- /**
- * The default constructor.
- */
- public MimetypesFileTypeMap() {
- Vector dbv = new Vector(5); // usually 5 or less databases
- MimeTypeFile mf = null;
- dbv.addElement(null); // place holder for PROG entry
-
- LogSupport.log("MimetypesFileTypeMap: load HOME");
- try {
- String user_home = System.getProperty("user.home");
-
- if (user_home != null) {
- String path = user_home + File.separator + ".mime.types";
- mf = loadFile(path);
- if (mf != null)
- dbv.addElement(mf);
- }
- } catch (SecurityException ex) {}
-
- LogSupport.log("MimetypesFileTypeMap: load SYS");
- try {
- // check system's home
- if (confDir != null) {
- mf = loadFile(confDir + "mime.types");
- if (mf != null)
- dbv.addElement(mf);
- }
- } catch (SecurityException ex) {}
-
- LogSupport.log("MimetypesFileTypeMap: load JAR");
- // load from the app's jar file
- loadAllResources(dbv, "META-INF/mime.types");
-
- LogSupport.log("MimetypesFileTypeMap: load DEF");
- mf = loadResource("/META-INF/mimetypes.default");
-
- if (mf != null)
- dbv.addElement(mf);
-
- DB = new MimeTypeFile[dbv.size()];
- dbv.copyInto(DB);
- }
-
- /**
- * Load from the named resource.
- */
- private MimeTypeFile loadResource(String name) {
- InputStream clis = null;
- try {
- clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
- if (clis != null) {
- MimeTypeFile mf = new MimeTypeFile(clis);
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: successfully " +
- "loaded mime types file: " + name);
- return mf;
- } else {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: not loading " +
- "mime types file: " + name);
- }
- } catch (IOException e) {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
- } catch (SecurityException sex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
- } finally {
- try {
- if (clis != null)
- clis.close();
- } catch (IOException ex) { } // ignore it
- }
- return null;
- }
-
- /**
- * Load all of the named resource.
- */
- private void loadAllResources(Vector v, String name) {
- boolean anyLoaded = false;
- try {
- URL[] urls;
- ClassLoader cld = null;
- // First try the "application's" class loader.
- cld = SecuritySupport.getContextClassLoader();
- if (cld == null)
- cld = this.getClass().getClassLoader();
- if (cld != null)
- urls = SecuritySupport.getResources(cld, name);
- else
- urls = SecuritySupport.getSystemResources(name);
- if (urls != null) {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: getResources");
- for (int i = 0; i < urls.length; i++) {
- URL url = urls[i];
- InputStream clis = null;
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: URL " + url);
- try {
- clis = SecuritySupport.openStream(url);
- if (clis != null) {
- v.addElement(new MimeTypeFile(clis));
- anyLoaded = true;
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: " +
- "successfully loaded " +
- "mime types from URL: " + url);
- } else {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: " +
- "not loading " +
- "mime types from URL: " + url);
- }
- } catch (IOException ioex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: can't load " +
- url, ioex);
- } catch (SecurityException sex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: can't load " +
- url, sex);
- } finally {
- try {
- if (clis != null)
- clis.close();
- } catch (IOException cex) { }
- }
- }
- }
- } catch (Exception ex) {
- if (LogSupport.isLoggable())
- LogSupport.log("MimetypesFileTypeMap: can't load " + name, ex);
- }
-
- // if failed to load anything, fall back to old technique, just in case
- if (!anyLoaded) {
- LogSupport.log("MimetypesFileTypeMap: !anyLoaded");
- MimeTypeFile mf = loadResource("/" + name);
- if (mf != null)
- v.addElement(mf);
- }
- }
-
- /**
- * Load the named file.
- */
- private MimeTypeFile loadFile(String name) {
- MimeTypeFile mtf = null;
-
- try {
- mtf = new MimeTypeFile(name);
- } catch (IOException e) {
- // e.printStackTrace();
- }
- return mtf;
- }
-
- /**
- * Construct a MimetypesFileTypeMap with programmatic entries
- * added from the named file.
- *
- * @param mimeTypeFileName the file name
- * @exception IOException for errors reading the file
- */
- public MimetypesFileTypeMap(String mimeTypeFileName) throws IOException {
- this();
- DB[PROG] = new MimeTypeFile(mimeTypeFileName);
- }
-
- /**
- * Construct a MimetypesFileTypeMap with programmatic entries
- * added from the InputStream.
- *
- * @param is the input stream to read from
- */
- public MimetypesFileTypeMap(InputStream is) {
- this();
- try {
- DB[PROG] = new MimeTypeFile(is);
- } catch (IOException ex) {
- // XXX - really should throw it
- }
- }
-
- /**
- * Prepend the MIME type values to the registry.
- *
- * @param mime_types A .mime.types formatted string of entries.
- */
- public synchronized void addMimeTypes(String mime_types) {
- // check to see if we have created the registry
- if (DB[PROG] == null)
- DB[PROG] = new MimeTypeFile(); // make one
-
- DB[PROG].appendToRegistry(mime_types);
- }
-
- /**
- * Return the MIME type of the file object.
- * The implementation in this class calls
- * {@code getContentType(f.getName())}.
- *
- * @param f the file
- * @return the file's MIME type
- */
- public String getContentType(File f) {
- return this.getContentType(f.getName());
- }
-
- /**
- * Return the MIME type based on the specified file name.
- * The MIME type entries are searched as described above under
- * MIME types file search order.
- * If no entry is found, the type "application/octet-stream" is returned.
- *
- * @param filename the file name
- * @return the file's MIME type
- */
- public synchronized String getContentType(String filename) {
- int dot_pos = filename.lastIndexOf("."); // period index
-
- if (dot_pos < 0)
- return defaultType;
-
- String file_ext = filename.substring(dot_pos + 1);
- if (file_ext.length() == 0)
- return defaultType;
-
- for (int i = 0; i < DB.length; i++) {
- if (DB[i] == null)
- continue;
- String result = DB[i].getMIMETypeString(file_ext);
- if (result != null)
- return result;
- }
- return defaultType;
- }
-
- /**
- * for debugging...
- *
- public static void main(String[] argv) throws Exception {
- MimetypesFileTypeMap map = new MimetypesFileTypeMap();
- System.out.println("File " + argv[0] + " has MIME type " +
- map.getContentType(argv[0]));
- System.exit(0);
- }
- */
-}
--- old/src/java.activation/share/classes/javax/activation/SecuritySupport.java 2018-01-30 20:16:06.000000000 -0500
+++ /dev/null 2018-01-30 20:16:06.000000000 -0500
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.security.*;
-import java.net.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * Security related methods that only work on J2SE 1.2 and newer.
- *
- * @since 1.6
- */
-class SecuritySupport {
-
- private SecuritySupport() {
- // private constructor, can't create an instance
- }
-
- public static ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
-
- public static InputStream getResourceAsStream(final Class c,
- final String name) throws IOException {
- try {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- return c.getResourceAsStream(name);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- }
-
- public static URL[] getResources(final ClassLoader cl, final String name) {
- return (URL[])
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- URL[] ret = null;
- try {
- List v = new ArrayList();
- Enumeration e = cl.getResources(name);
- while (e != null && e.hasMoreElements()) {
- URL url = (URL)e.nextElement();
- if (url != null)
- v.add(url);
- }
- if (v.size() > 0) {
- ret = new URL[v.size()];
- ret = (URL[])v.toArray(ret);
- }
- } catch (IOException ioex) {
- } catch (SecurityException ex) { }
- return ret;
- }
- });
- }
-
- public static URL[] getSystemResources(final String name) {
- return (URL[])
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- URL[] ret = null;
- try {
- List v = new ArrayList();
- Enumeration e = ClassLoader.getSystemResources(name);
- while (e != null && e.hasMoreElements()) {
- URL url = (URL)e.nextElement();
- if (url != null)
- v.add(url);
- }
- if (v.size() > 0) {
- ret = new URL[v.size()];
- ret = (URL[])v.toArray(ret);
- }
- } catch (IOException ioex) {
- } catch (SecurityException ex) { }
- return ret;
- }
- });
- }
-
- public static InputStream openStream(final URL url) throws IOException {
- try {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- return url.openStream();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- }
-}
--- old/src/java.activation/share/classes/javax/activation/URLDataSource.java 2018-01-30 20:16:06.000000000 -0500
+++ /dev/null 2018-01-30 20:16:06.000000000 -0500
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * The URLDataSource class provides an object that wraps a URL
- * object in a DataSource interface. URLDataSource simplifies the handling
- * of data described by URLs within the JavaBeans Activation Framework
- * because this class can be used to create new DataHandlers. NOTE: The
- * DataHandler object creates a URLDataSource internally,
- * when it is constructed with a URL.
- *
- * @see javax.activation.DataSource
- * @see javax.activation.DataHandler
- *
- * @since 1.6
- */
-public class URLDataSource implements DataSource {
- private URL url = null;
- private URLConnection url_conn = null;
-
- /**
- * URLDataSource constructor. The URLDataSource class will
- * not open a connection to the URL until a method requiring it
- * to do so is called.
- *
- * @param url The URL to be encapsulated in this object.
- */
- public URLDataSource(URL url) {
- this.url = url;
- }
-
- /**
- * Returns the value of the URL content-type header field.
- * It calls the URL's URLConnection.getContentType
method
- * after retrieving a URLConnection object.
- * Note: this method attempts to call the openConnection
- * method on the URL. If this method fails, or if a content type is not
- * returned from the URLConnection, getContentType returns
- * "application/octet-stream" as the content type.
- *
- * @return the content type.
- */
- public String getContentType() {
- String type = null;
-
- try {
- if (url_conn == null)
- url_conn = url.openConnection();
- } catch (IOException e) { }
-
- if (url_conn != null)
- type = url_conn.getContentType();
-
- if (type == null)
- type = "application/octet-stream";
-
- return type;
- }
-
- /**
- * Calls the getFile
method on the URL used to
- * instantiate the object.
- *
- * @return the result of calling the URL's getFile method.
- */
- public String getName() {
- return url.getFile();
- }
-
- /**
- * The getInputStream method from the URL. Calls the
- * openStream
method on the URL.
- *
- * @return the InputStream.
- */
- public InputStream getInputStream() throws IOException {
- return url.openStream();
- }
-
- /**
- * The getOutputStream method from the URL. First an attempt is
- * made to get the URLConnection object for the URL. If that
- * succeeds, the getOutputStream method on the URLConnection
- * is returned.
- *
- * @return the OutputStream.
- */
- public OutputStream getOutputStream() throws IOException {
- // get the url connection if it is available
- url_conn = url.openConnection();
-
- if (url_conn != null) {
- url_conn.setDoOutput(true);
- return url_conn.getOutputStream();
- } else
- return null;
- }
-
- /**
- * Return the URL used to create this DataSource.
- *
- * @return The URL.
- */
- public URL getURL() {
- return url;
- }
-}
--- old/src/java.activation/share/classes/javax/activation/UnsupportedDataTypeException.java 2018-01-30 20:16:07.000000000 -0500
+++ /dev/null 2018-01-30 20:16:07.000000000 -0500
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.activation;
-
-import java.io.IOException;
-
-/**
- * Signals that the requested operation does not support the
- * requested data type.
- *
- * @see javax.activation.DataHandler
- *
- * @since 1.6
- */
-
-public class UnsupportedDataTypeException extends IOException {
- /**
- * Constructs an UnsupportedDataTypeException with no detail
- * message.
- */
- public UnsupportedDataTypeException() {
- super();
- }
-
- /**
- * Constructs an UnsupportedDataTypeException with the specified
- * message.
- *
- * @param s The detail message.
- */
- public UnsupportedDataTypeException(String s) {
- super(s);
- }
-}
--- old/src/java.activation/share/classes/module-info.java 2018-01-30 20:16:08.000000000 -0500
+++ /dev/null 2018-01-30 20:16:08.000000000 -0500
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Defines the JavaBeans Activation Framework (JAF) API.
- *
- * This module is upgradeable.
- *
- * @moduleGraph
- * @since 9
- */
-@Deprecated(since="9", forRemoval=true)
-module java.activation {
- requires java.logging;
-
- requires transitive java.datatransfer;
-
- exports javax.activation;
-}
-
--- old/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl 2018-01-30 20:16:08.000000000 -0500
+++ /dev/null 2018-01-30 20:16:08.000000000 -0500
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "IOP.idl"
-
-module GIOP { // IDL extended for version 1.1 and 1.2
-
- struct Version {
- octet major;
- octet minor;
- };
-
-
- // GIOP 1.0
-
- struct MessageHeader_1_0 { // Renamed from MessageHeader
- char magic [4];
- Version GIOP_version;
- boolean byte_order;
- octet message_type;
- unsigned long message_size;
- };
-
- // GIOP 1.1
-
- struct MessageHeader_1_1 {
- char magic [4];
- Version GIOP_version;
- octet flags; // GIOP 1.1 change
- octet message_type;
- unsigned long message_size;
- };
-
- // GIOP 1.2
- // Same Header contents for 1.1 and 1.2
- typedef MessageHeader_1_1 MessageHeader_1_2;
-
-
- // GIOP 1.0
- struct RequestHeader_1_0 { // Renamed from RequestHeader
- IOP::ServiceContextList service_context;
- unsigned long request_id;
- boolean response_expected;
- sequence object_key;
- string operation;
- sequence requesting_principal;
- };
-
- // GIOP 1.1
- struct RequestHeader_1_1 {
- IOP::ServiceContextList service_context;
- unsigned long request_id;
- boolean response_expected;
- octet reserved[3]; // Added in GIOP 1.1
- sequence object_key;
- string operation;
- sequence requesting_principal;
- };
-
- // GIOP 1.2
- typedef short AddressingDisposition;
- const short KeyAddr = 0;
- const short ProfileAddr = 1;
- const short ReferenceAddr = 2;
- struct IORAddressingInfo {
- unsigned long selected_profile_index;
- IOP::IOR ior;
- };
- union TargetAddress switch (AddressingDisposition) {
- case KeyAddr: sequence object_key;
- case ProfileAddr: IOP::TaggedProfile profile;
- case ReferenceAddr: IORAddressingInfo ior;
- };
- struct RequestHeader_1_2 {
- unsigned long request_id;
- octet response_flags;
- octet reserved[3];
- TargetAddress target;
- string operation;
- IOP::ServiceContextList service_context;
- // Principal not in GIOP 1.2
- };
-
-
- #ifndef GIOP_1_2 //We're supporting all versions
-
- // GIOP 1.0 and 1.1
- enum ReplyStatusType_1_0 { // Renamed from ReplyStatusType
- NO_EXCEPTION,
- USER_EXCEPTION,
- SYSTEM_EXCEPTION,
- LOCATION_FORWARD
- };
-
- // GIOP 1.0
- struct ReplyHeader_1_0 { // Renamed from ReplyHeader
- IOP::ServiceContextList service_context;
- unsigned long request_id;
- ReplyStatusType_1_0 reply_status;
- };
-
- // GIOP 1.1
- // Same Header contents for 1.0 and 1.1
- typedef ReplyHeader_1_0 ReplyHeader_1_1;
-
- #else
-
- // GIOP 1.2
- enum ReplyStatusType_1_2 {
- NO_EXCEPTION,
- USER_EXCEPTION,
- SYSTEM_EXCEPTION,
- LOCATION_FORWARD,
- LOCATION_FORWARD_PERM,// new value for 1.2
- NEEDS_ADDRESSING_MODE // new value for 1.2
- };
-
- struct ReplyHeader_1_2 {
- unsigned long request_id;
- ReplyStatusType_1_2 reply_status;
- IOP::ServiceContextList service_context;
- };
-
- #endif // GIOP_1_2
-
-
- struct SystemExceptionReplyBody {
- string exception_id;
- unsigned long minor_code_value;
- unsigned long completion_status;
- };
-
-
-
- struct CancelRequestHeader {
- unsigned long request_id;
- };
-
-
-
- // GIOP 1.0
- struct LocateRequestHeader_1_0 { // Renamed LocationRequestHeader
- unsigned long request_id;
- sequence object_key;
- };
-
- // GIOP 1.1
- // Same Header contents for 1.0 and 1.1
- typedef LocateRequestHeader_1_0 LocateRequestHeader_1_1;
-
- // GIOP 1.2
- struct LocateRequestHeader_1_2 {
- unsigned long request_id;
- TargetAddress target;
- };
-
-
- #ifndef GIOP_1_2 // We're supporting all versions
-
- // GIOP 1.0 and 1.1
- enum LocateStatusType_1_0 { // Renamed from LocateStatusType
- UNKNOWN_OBJECT,
- OBJECT_HERE,
- OBJECT_FORWARD
- };
-
-
- // GIOP 1.0
- struct LocateReplyHeader_1_0 { // Renamed from LocateReplyHeader
- unsigned long request_id;
- LocateStatusType_1_0 locate_status;
- };
-
- // GIOP 1.1
- // same Header contents for 1.0 and 1.1
- typedef LocateReplyHeader_1_0 LocateReplyHeader_1_1;
-
- #else
-
- // GIOP 1.2
- enum LocateStatusType_1_2 {
- UNKNOWN_OBJECT,
- OBJECT_HERE,
- OBJECT_FORWARD,
- OBJECT_FORWARD_PERM, // new value for GIOP 1.2
- LOC_SYSTEM_EXCEPTION, // new value for GIOP 1.2
- LOC_NEEDS_ADDRESSING_MODE // new value for GIOP 1.2
- };
-
- struct LocateReplyHeader_1_2 {
- unsigned long request_id;
- LocateStatusType_1_2 locate_status;
- };
-
- #endif // GIOP_1_2
-
-
- // GIOP 1.2
- struct FragmentHeader_1_2 {
- unsigned long request_id;
- };
-};
--- old/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/messages.idl 2018-01-30 20:16:09.000000000 -0500
+++ /dev/null 2018-01-30 20:16:09.000000000 -0500
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @(#)GIOP.idl 1.0 00/05/21
- *
- */
-
-#include "IOP.idl"
-
-module messages {
-
- typedef short AddressingDisposition;
- const short KeyAddr = 0;
- const short ProfileAddr = 1;
- const short ReferenceAddr = 2;
- struct IORAddressingInfo {
- unsigned long selected_profile_index;
- IOP::IOR ior;
- };
- union TargetAddress switch (AddressingDisposition) {
- case KeyAddr: sequence object_key;
- case ProfileAddr: IOP::TaggedProfile profile;
- case ReferenceAddr: IORAddressingInfo ior;
- };
-};
--- old/src/java.corba/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl 2018-01-30 20:16:10.000000000 -0500
+++ /dev/null 2018-01-30 20:16:10.000000000 -0500
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "Interceptors.idl"
-
-module PortableActivationIDL {
- /** Possible values for endpointType argument on Server.getEndpoint()
- * If you change the value of this constant then update
- * core.EndPoint accordingly. It has a duplicate definition
- * to avoid a compilation dependency.
- */
- const string IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT";
-
- /** Raised if getEndpoint is called on a server callback object for
- * an invalid endpoint type
- */
- exception NoSuchEndPoint {} ;
-
- /** Raised if an attempt is made to retrieve ports corresponding to
- * non-registered ORB
- */
- exception InvalidORBid {} ;
-
- /** Raised if an operation is attempted against an invalid server ID.
- */
- exception ServerNotRegistered {
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an operation is attempted for a server that is not running,
- * and the server is required to be running for the operation.
- */
- exception ServerNotActive {
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an operation is attempted against a server that is in a
- * hold down state. A server becomes held down if it fails to activate
- * within 10 seconds.
- */
- exception ServerHeldDown {
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an attempt is made to activate a server that is already
- * running.
- */
- exception ServerAlreadyActive{
- PortableInterceptor::ServerId serverId ;
- };
-
- /** Raised if an attempt is made to register a serverdef with the
- * same applicationName as an existing serverdef.
- */
- exception ServerAlreadyRegistered {
- PortableInterceptor::ServerId serverId;
- };
-
- /** Raised if an attempt is made to install a server that is currently
- * installed. Note that a newly created server starts out in an uninstalled
- * state.
- */
- exception ServerAlreadyInstalled {
- PortableInterceptor::ServerId serverId;
- } ;
-
- /** Raised if an attempt is made to uninstall a server that is currently
- * uninstalled. Note that a newly created server starts out in an
- * uninstalled
- * state.
- */
- exception ServerAlreadyUninstalled {
- PortableInterceptor::ServerId serverId;
- } ;
-
- /** Raised if an attempt is made to register an invalid serverdef.
- */
- exception BadServerDefinition {
- string reason;
- };
-
- /** Raised if an attempt is made to register endpoints for the
- * same ORB again
- */
- exception ORBAlreadyRegistered {
- PortableInterceptor::ORBId orbId;
- };
-
- /** Type of TCP port number, used in structures that describe
- * transport endpoints. The valid range is actually 0-65535, but
- * we use a long here to avoid signed/unsigned conversion headaches
- * in Java.
- */
- typedef long TCPPort ;
-
- /** Sequence of server Ids, used for queries about servers.
- */
- typedef sequence ServerIds;
-
- /** End point information for one particular kind of port associated with an
- * an ORB. This is only used in the
- * Activator interface, which must always run on the same host as the daemon,
- * therefore we do not need the host name here.
- */
- struct EndPointInfo {
- string endpointType;
- TCPPort port;
- };
-
- /** A list of endpoint information for a particular ORB.
- */
- typedef sequence EndpointInfoList;
-
- /** struct contain ORB and port info for a particular type of endpoint.
- * This is only used in the
- * Activator interface, which must always run on the same host as the daemon,
- * therefore we do not need the host name here.
- */
- struct ORBPortInfo {
- PortableInterceptor::ORBId orbId;
- TCPPort port;
- };
-
- /** A list of ORB and port information for a particular endpoint type.
- */
- typedef sequence ORBPortInfoList;
-
- /** A list of ORB IDs.
- */
- typedef sequence ORBidList;
-
- /** Server callback interface, passed to Activator in registerServer method.
- */
- interface ServerProxy {
- /** Shutdown this server. Returns after orb.shutdown() completes.
- */
- void shutdown();
-
- /** Install the server. Returns after the install hook completes
- * execution in the server.
- */
- void install();
-
- /** Uninstall the server. Returns after the uninstall hook
- * completes execution.
- */
- void uninstall();
- };
-
- /** ORB callback interface, passed to Activator in registerORB method.
- */
- interface ORBProxy {
- /** Method used to cause ORB to activate the named adapter, if possible.
- * This will cause the named POA to register itself with the activator as
- * a side effect. This should always happen before this call can complete.
- * This method returns true if adapter activation succeeded, otherwise it
- * returns false.
- */
- boolean activate_adapter( in PortableInterceptor::AdapterName name ) ;
- } ;
-
- interface Activator {
- /*******************************************************
- * Server State Change Methods
- ********************************************************/
-
- /** A new ORB started server registers itself with the Activator
- */
- void registerServer(in PortableInterceptor::ServerId serverId, in ServerProxy serverObj)
- raises (ServerNotRegistered);
-
- /** A server is shutting down that was started by this activator.
- * Complete termination of the server is detected by the death of the
- * process implementing the server.
- */
- void serverGoingDown( in PortableInterceptor::ServerId serverId ) ;
-
- /** Called whenever an ORB instance is created. This registers
- * the transport endpoints and the ORB proxy callback object.
- * Note that we cannot detect when an ORB shuts down, although
- * all of the POA shutdowns should still be reported.
- */
- void registerORB( in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in ORBProxy orb, in EndpointInfoList endPointInfo)
- raises (ServerNotRegistered,NoSuchEndPoint, ORBAlreadyRegistered) ;
-
- /** Construct or find an ORBD object template corresponding to the
- * server's object template and return it. Called whenever a
- * persistent POA is created.
- */
- PortableInterceptor::ObjectReferenceTemplate registerPOA(
- in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ;
-
- /** Called whenever a POA is destroyed.
- */
- void poaDestroyed(
- in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ;
-
- /*******************************************************
- * Server Control Methods
- ********************************************************/
-
- /** If the server is not running, start it up. This is allowed
- * whether or not the server has been installed.
- */
- void activate(in PortableInterceptor::ServerId serverId)
- raises (ServerAlreadyActive, ServerNotRegistered, ServerHeldDown);
-
- /** If the server is running, shut it down
- */
- void shutdown(in PortableInterceptor::ServerId serverId)
- raises (ServerNotActive, ServerNotRegistered);
-
- /** Invoke the server install hook. If the server is not
- * currently running, this method will activate it.
- */
- void install(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered, ServerHeldDown,
- ServerAlreadyInstalled);
-
- /** Invoke the server uninstall hook. If the server is not
- * currently running, this method will activate it.
- * After this hook completes, the server may still be running.
- */
- void uninstall(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered, ServerHeldDown,
- ServerAlreadyUninstalled);
-
- /*******************************************************
- * Accessors
- ********************************************************/
-
- /** list active servers
- */
- ServerIds getActiveServers();
-
- /** list all registered ORBs for a server
- */
- ORBidList getORBNames(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered);
-
- /** Find the server template that corresponds to the ORBD's
- * adapter id.
- */
- PortableInterceptor::ObjectReferenceTemplate lookupPOATemplate(
- in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
- in PortableInterceptor::AdapterName orbAdapterName ) ;
- };
-
- interface Locator {
- /** struct to return the list of endpoints for a server for a specific
- * endpoint type.
- */
- struct ServerLocationPerType {
- string hostname;
- ORBPortInfoList ports;
- };
-
- /** struct to return the list of endpoints for a server for a specific
- * ORB
- */
- struct ServerLocationPerORB {
- string hostname;
- EndpointInfoList ports;
- };
-
- /** locate server - returns the port with a specific type for all registered
- * ORBs of an active server.
- * Starts the server if it is not already running.
- */
- ServerLocationPerType locateServer(
- in PortableInterceptor::ServerId serverId,
- in string endPoint)
- raises(NoSuchEndPoint, ServerNotRegistered, ServerHeldDown);
-
- /** locate server - returns all ports registered with a specified ORB for
- * an active server
- * Starts the server if it is not already running.
- */
- ServerLocationPerORB locateServerForORB(
- in PortableInterceptor::ServerId serverId,
- in PortableInterceptor::ORBId orbId)
- raises(InvalidORBid, ServerNotRegistered, ServerHeldDown);
-
- /** get the port for the endpoint of the locator
- */
- TCPPort getEndpoint(in string endPointType)
- raises(NoSuchEndPoint);
-
- /** Useful from external BadServerIdHandlers which need
- * to pick a particular port type.
- */
- TCPPort getServerPortForType(
- in ServerLocationPerORB location,
- in string endPointType)
- raises(NoSuchEndPoint);
- };
-
- /** Interface used to combine the Activator and Locator when both are
- * implemented together in the same process, as is currently the case
- * for our implementation.
- */
- interface ServerManager : Activator, Locator { };
-
- /** Interface used to support binding references in the bootstrap name
- * service.
- */
- interface InitialNameService {
- exception NameAlreadyBound {};
-
- /** bind initial name
- */
- void bind (
- in string name,
- in Object obj,
- in boolean isPersistant) raises (NameAlreadyBound);
- };
-
- interface Repository {
- /** server program definition.
- */
- struct ServerDef {
- string applicationName; // alias used for servers with identical
- // serverName values.
- string serverName; // Class name of server's main class.
- string serverClassPath; // class path used to run the server.
- string serverArgs; // arguments passed to the server
- string serverVmArgs; // arguments passed to the server's Java VM1
- boolean isInstalled; // Whether or not the server has been installed
- };
-
- /** register server definition.
- * This returns the serverId of the server. A newly created server is
- * always uninstalled.
- */
- PortableInterceptor::ServerId registerServer (in ServerDef serverDef)
- raises (ServerAlreadyRegistered, BadServerDefinition);
-
- /** unregister server definition
- */
- void unregisterServer (in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered);
-
- /** get server definition
- */
- ServerDef getServer(in PortableInterceptor::ServerId serverId)
- raises (ServerNotRegistered);
-
- /** Return whether the server has been installed
- */
- boolean isInstalled( in PortableInterceptor::ServerId serverId )
- raises (ServerNotRegistered);
-
- /** Mark the server as being installed. Raises ServerAlreadyInstalled
- * if the server is currently marked as installed.
- */
- void install( in PortableInterceptor::ServerId serverId )
- raises (ServerNotRegistered, ServerAlreadyInstalled) ;
-
- /** Mark the server as being uninstalled. Raises ServerAlreadyUninstalled
- * if the server is currently marked as uninstalled.
- */
- void uninstall( in PortableInterceptor::ServerId serverId )
- raises (ServerNotRegistered, ServerAlreadyUninstalled) ;
-
- /** list registered servers
- */
- ServerIds listRegisteredServers ();
-
- /** Type used for a list of application names
- */
- typedef sequence AppNames ;
-
- /** Returns list of ALL applicationNames defined in ServerDefs of registered
- * servers.
- */
- AppNames getApplicationNames();
-
- /** Find the ServerID associated with the given application name.
- */
- PortableInterceptor::ServerId getServerID( in string applicationName )
- raises (ServerNotRegistered) ;
- };
-};
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java 2018-01-30 20:16:10.000000000 -0500
+++ /dev/null 2018-01-30 20:16:10.000000000 -0500
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.activation;
-
-import org.omg.CORBA.ORB;
-
-import java.io.PrintStream;
-
-/**
- * @author Rohit Garg
- * @since JDK1.2
- */
-
-public interface CommandHandler
-{
- String getCommandName();
-
- public final static boolean shortHelp = true;
- public final static boolean longHelp = false;
-
- void printCommandHelp(PrintStream out, boolean helpType);
-
- public final static boolean parseError = true;
- public final static boolean commandDone = false;
-
- boolean processCommand(String[] cmd, ORB orb, PrintStream out);
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java 2018-01-30 20:16:11.000000000 -0500
+++ /dev/null 2018-01-30 20:16:11.000000000 -0500
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.activation;
-
-
-import java.io.File;
-
-import org.omg.CosNaming.NamingContext;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.naming.pcosnaming.NameService;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-// REVISIT: After Merlin to see if we can get rid of this Thread and
-// make the registration of PNameService for INS and BootStrap neat.
-public class NameServiceStartThread extends java.lang.Thread
-{
- private ORB orb;
- private File dbDir;
-
- public NameServiceStartThread( ORB theOrb, File theDir )
- {
- orb = theOrb;
- dbDir = theDir;
- }
-
- public void run( )
- {
- try {
- // start Name Service
- NameService nameService = new NameService(orb, dbDir );
- NamingContext rootContext = nameService.initialNamingContext();
- orb.register_initial_reference(
- ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
- } catch( Exception e ) {
- System.err.println(
- "NameService did not start successfully" );
- e.printStackTrace( );
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ORBD.java 2018-01-30 20:16:12.000000000 -0500
+++ /dev/null 2018-01-30 20:16:12.000000000 -0500
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CosNaming.NamingContext;
-import org.omg.PortableServer.POA;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-
-import com.sun.corba.se.spi.activation.Repository;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation.Locator;
-import com.sun.corba.se.spi.activation.LocatorHelper;
-import com.sun.corba.se.spi.activation.Activator;
-import com.sun.corba.se.spi.activation.ActivatorHelper;
-import com.sun.corba.se.spi.activation.ServerAlreadyRegistered;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketInfo;
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
-import com.sun.corba.se.impl.naming.cosnaming.TransientNameService;
-import com.sun.corba.se.impl.naming.pcosnaming.NameService;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-
-/**
- *
- * @author Rohit Garg
- * @since JDK1.2
- */
-public class ORBD
-{
- private int initSvcPort;
-
- protected void initializeBootNaming(ORB orb)
- {
- // create a bootstrap server
- initSvcPort = orb.getORBData().getORBInitialPort();
-
- Acceptor acceptor;
- // REVISIT: see ORBConfigurator. use factory in TransportDefault.
- if (orb.getORBData().getLegacySocketFactory() == null) {
- acceptor =
- new SocketOrChannelAcceptorImpl(
- orb,
- initSvcPort,
- LegacyServerSocketEndPointInfo.BOOT_NAMING,
- SocketInfo.IIOP_CLEAR_TEXT);
- } else {
- acceptor =
- new SocketFactoryAcceptorImpl(
- orb,
- initSvcPort,
- LegacyServerSocketEndPointInfo.BOOT_NAMING,
- SocketInfo.IIOP_CLEAR_TEXT);
- }
- orb.getCorbaTransportManager().registerAcceptor(acceptor);
- }
-
- protected ORB createORB(String[] args)
- {
- Properties props = System.getProperties();
-
- // For debugging.
- //props.put( ORBConstants.DEBUG_PROPERTY, "naming" ) ;
- //props.put( ORBConstants.DEBUG_PROPERTY, "transport,giop,naming" ) ;
-
- props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
- props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
- props.getProperty( ORBConstants.ORBD_PORT_PROPERTY,
- Integer.toString(
- ORBConstants.DEFAULT_ACTIVATION_PORT ) ) ) ;
-
- // See Bug 4396928 for more information about why we are initializing
- // the ORBClass to PIORB (now ORBImpl, but should check the bugid).
- props.put("org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl");
-
- return (ORB) ORB.init(args, props);
- }
-
- private void run(String[] args)
- {
- try {
- // parse the args and try setting the values for these
- // properties
- processArgs(args);
-
- ORB orb = createORB(args);
-
- if (orb.orbdDebugFlag)
- System.out.println( "ORBD begins initialization." ) ;
-
- boolean firstRun = createSystemDirs( ORBConstants.DEFAULT_DB_DIR );
-
- startActivationObjects(orb);
-
- if (firstRun) // orbd is being run the first time
- installOrbServers(getRepository(), getActivator());
-
- if (orb.orbdDebugFlag) {
- System.out.println( "ORBD is ready." ) ;
- System.out.println("ORBD serverid: " +
- System.getProperty(ORBConstants.SERVER_ID_PROPERTY));
- System.out.println("activation dbdir: " +
- System.getProperty(ORBConstants.DB_DIR_PROPERTY));
- System.out.println("activation port: " +
- System.getProperty(ORBConstants.ORBD_PORT_PROPERTY));
-
- String pollingTime = System.getProperty(
- ORBConstants.SERVER_POLLING_TIME);
- if( pollingTime == null ) {
- pollingTime = Integer.toString(
- ORBConstants.DEFAULT_SERVER_POLLING_TIME );
- }
- System.out.println("activation Server Polling Time: " +
- pollingTime + " milli-seconds ");
-
- String startupDelay = System.getProperty(
- ORBConstants.SERVER_STARTUP_DELAY);
- if( startupDelay == null ) {
- startupDelay = Integer.toString(
- ORBConstants.DEFAULT_SERVER_STARTUP_DELAY );
- }
- System.out.println("activation Server Startup Delay: " +
- startupDelay + " milli-seconds " );
- }
-
- // The following two lines start the Persistent NameService
- NameServiceStartThread theThread =
- new NameServiceStartThread( orb, dbDir );
- theThread.start( );
-
- orb.run();
- } catch( org.omg.CORBA.COMM_FAILURE cex ) {
- System.out.println( CorbaResourceUtil.getText("orbd.commfailure"));
- System.out.println( cex );
- cex.printStackTrace();
- } catch( org.omg.CORBA.INTERNAL iex ) {
- System.out.println( CorbaResourceUtil.getText(
- "orbd.internalexception"));
- System.out.println( iex );
- iex.printStackTrace();
- } catch (Exception ex) {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- System.out.println( ex );
- ex.printStackTrace();
- }
- }
-
- private void processArgs(String[] args)
- {
- Properties props = System.getProperties();
- for (int i=0; i < args.length; i++) {
- if (args[i].equals("-port")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.ORBD_PORT_PROPERTY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-defaultdb")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.DB_DIR_PROPERTY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-serverid")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.SERVER_ID_PROPERTY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-serverPollingTime")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.SERVER_POLLING_TIME, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- } else if (args[i].equals("-serverStartupDelay")) {
- if ((i+1) < args.length) {
- props.put(ORBConstants.SERVER_STARTUP_DELAY, args[++i]);
- } else {
- System.out.println(CorbaResourceUtil.getText(
- "orbd.usage", "orbd"));
- }
- }
- }
- }
-
- /**
- * Ensure that the Db directory exists. If not, create the Db
- * and the log directory and return true. Otherwise return false.
- */
- protected boolean createSystemDirs(String defaultDbDir)
- {
- boolean dirCreated = false;
- Properties props = System.getProperties();
- String fileSep = props.getProperty("file.separator");
-
- // determine the ORB db directory
- dbDir = new File (props.getProperty( ORBConstants.DB_DIR_PROPERTY,
- props.getProperty("user.dir") + fileSep + defaultDbDir));
-
- // create the db and the logs directories
- dbDirName = dbDir.getAbsolutePath();
- props.put(ORBConstants.DB_DIR_PROPERTY, dbDirName);
- if (!dbDir.exists()) {
- dbDir.mkdir();
- dirCreated = true;
- }
-
- File logDir = new File (dbDir, ORBConstants.SERVER_LOG_DIR ) ;
- if (!logDir.exists()) logDir.mkdir();
-
- return dirCreated;
- }
-
- protected File dbDir;
- protected File getDbDir()
- {
- return dbDir;
- }
-
- private String dbDirName;
- protected String getDbDirName()
- {
- return dbDirName;
- }
-
- protected void startActivationObjects(ORB orb) throws Exception
- {
- // create Initial Name Service object
- initializeBootNaming(orb);
-
- // create Repository object
- repository = new RepositoryImpl(orb, dbDir, orb.orbdDebugFlag );
- orb.register_initial_reference( ORBConstants.SERVER_REPOSITORY_NAME, repository );
-
- // create Locator and Activator objects
- ServerManagerImpl serverMgr =
- new ServerManagerImpl( orb,
- orb.getCorbaTransportManager(),
- repository,
- getDbDirName(),
- orb.orbdDebugFlag );
-
- locator = LocatorHelper.narrow(serverMgr);
- orb.register_initial_reference( ORBConstants.SERVER_LOCATOR_NAME, locator );
-
- activator = ActivatorHelper.narrow(serverMgr);
- orb.register_initial_reference( ORBConstants.SERVER_ACTIVATOR_NAME, activator );
-
- // start Name Service
- TransientNameService nameService = new TransientNameService(orb,
- ORBConstants.TRANSIENT_NAME_SERVICE_NAME);
- }
-
- protected Locator locator;
- protected Locator getLocator()
- {
- return locator;
- }
-
- protected Activator activator;
- protected Activator getActivator()
- {
- return activator;
- }
-
- protected RepositoryImpl repository;
- protected RepositoryImpl getRepository()
- {
- return repository;
- }
-
- /**
- * Go through the list of ORB Servers and initialize and start
- * them up.
- */
- protected void installOrbServers(RepositoryImpl repository,
- Activator activator)
- {
- int serverId;
- String[] server;
- ServerDef serverDef;
-
- for (int i=0; i < orbServers.length; i++) {
- try {
- server = orbServers[i];
- serverDef = new ServerDef(server[1], server[2],
- server[3], server[4], server[5] );
-
- serverId = Integer.valueOf(orbServers[i][0]).intValue();
-
- repository.registerServer(serverDef, serverId);
-
- activator.activate(serverId);
-
- } catch (Exception ex) {}
- }
- }
-
- public static void main(String[] args) {
- ORBD orbd = new ORBD();
- orbd.run(args);
- }
-
- /**
- * List of servers to be auto registered and started by the ORBd.
- *
- * Each server entry is of the form {id, name, path, args, vmargs}.
- */
- private static String[][] orbServers = {
- {""}
- };
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java 2018-01-30 20:16:13.000000000 -0500
+++ /dev/null 2018-01-30 20:16:13.000000000 -0500
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.util.*;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-/** ProcessMonitorThread is started when ServerManager is instantiated. The
- * thread wakes up every minute (This can be changed by setting sleepTime) and
- * makes sure that all the processes (Servers) registered with the ServerTool
- * are healthy. If not the state in ServerTableEntry will be changed to
- * De-Activated.
- * Note: This thread can be killed from the main thread by calling
- * interrupThread()
- */
-public class ProcessMonitorThread extends java.lang.Thread {
- private HashMap serverTable;
- private int sleepTime;
- private static ProcessMonitorThread instance = null;
-
- private ProcessMonitorThread( HashMap ServerTable, int SleepTime ) {
- serverTable = ServerTable;
- sleepTime = SleepTime;
- }
-
- public void run( ) {
- while( true ) {
- try {
- // Sleep's for a specified time, before checking
- // the Servers health. This will repeat as long as
- // the ServerManager (ORBD) is up and running.
- Thread.sleep( sleepTime );
- } catch( java.lang.InterruptedException e ) {
- break;
- }
- Iterator serverList;
- synchronized ( serverTable ) {
- // Check each ServerTableEntry to make sure that they
- // are in the right state.
- serverList = serverTable.values().iterator();
- }
- try {
- checkServerHealth( serverList );
- } catch( ConcurrentModificationException e ) {
- break;
- }
- }
- }
-
- private void checkServerHealth( Iterator serverList ) {
- if( serverList == null ) return;
- while (serverList.hasNext( ) ) {
- ServerTableEntry entry = (ServerTableEntry) serverList.next();
- entry.checkProcessHealth( );
- }
- }
-
- static void start( HashMap serverTable ) {
- int sleepTime = ORBConstants.DEFAULT_SERVER_POLLING_TIME;
-
- String pollingTime = System.getProperties().getProperty(
- ORBConstants.SERVER_POLLING_TIME );
-
- if ( pollingTime != null ) {
- try {
- sleepTime = Integer.parseInt( pollingTime );
- } catch (Exception e ) {
- // Too late to complain, Just use the default
- // sleepTime
- }
- }
-
- instance = new ProcessMonitorThread( serverTable,
- sleepTime );
- instance.setDaemon( true );
- instance.start();
- }
-
- static void interruptThread( ) {
- instance.interrupt();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java 2018-01-30 20:16:13.000000000 -0500
+++ /dev/null 2018-01-30 20:16:13.000000000 -0500
@@ -1,474 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.activation;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Properties;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.spi.activation.BadServerDefinition;
-import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
-import com.sun.corba.se.spi.activation._RepositoryImplBase;
-import com.sun.corba.se.spi.activation.ServerAlreadyRegistered;
-import com.sun.corba.se.spi.activation.ServerAlreadyInstalled;
-import com.sun.corba.se.spi.activation.ServerAlreadyUninstalled;
-import com.sun.corba.se.spi.activation.ServerNotRegistered;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ActivationSystemException;
-
-/**
- *
- * @author Rohit Garg
- * @since JDK1.2
- */
-public class RepositoryImpl extends _RepositoryImplBase
- implements Serializable
-{
-
- // added serialver computed by the tool
- private static final long serialVersionUID = 8458417785209341858L;
-
- RepositoryImpl(ORB orb, File dbDir, boolean debug)
- {
- this.debug = debug ;
- this.orb = orb;
- wrapper = ActivationSystemException.get( orb, CORBALogDomains.ORBD_REPOSITORY ) ;
-
- // if databse does not exist, create it otherwise read it in
- File dbFile = new File(dbDir, "servers.db");
- if (!dbFile.exists()) {
- db = new RepositoryDB(dbFile);
- db.flush();
- } else {
- try {
- FileInputStream fis = new FileInputStream(dbFile);
- ObjectInputStream ois = new ObjectInputStream(fis);
- db = (RepositoryDB) ois.readObject();
- ois.close();
- } catch (Exception e) {
- throw wrapper.cannotReadRepositoryDb( e ) ;
- }
- }
-
- // export the repository
- orb.connect(this);
- }
-
- private String printServerDef( ServerDef sd )
- {
- return "ServerDef[applicationName=" + sd.applicationName +
- " serverName=" + sd.serverName +
- " serverClassPath=" + sd.serverClassPath +
- " serverArgs=" + sd. serverArgs +
- " serverVmArgs=" + sd.serverVmArgs +
- "]" ;
- }
-
- public int registerServer(ServerDef serverDef, int theServerId)
- throws ServerAlreadyRegistered
- {
- int serverId;
- DBServerDef server = null;
-
- synchronized (db) {
-
- // check if server already registered
- Enumeration enumeration = db.serverTable.elements();
- while (enumeration.hasMoreElements()) {
- server = (DBServerDef) enumeration.nextElement();
- if (serverDef.applicationName.equals(server.applicationName)) {
- if (debug)
- System.out.println(
- "RepositoryImpl: registerServer called " +
- "to register ServerDef " +
- printServerDef( serverDef ) +
- " with " + ((theServerId==illegalServerId) ?
- "a new server Id" : ("server Id " + theServerId)) +
- " FAILED because it is already registered." ) ;
-
- throw (new ServerAlreadyRegistered(server.id));
- }
- }
-
- // generate a new server id
- if (theServerId == illegalServerId)
- serverId = db.incrementServerIdCounter();
- else
- serverId = theServerId;
-
- // add server def to the database
- server = new DBServerDef(serverDef, serverId);
- db.serverTable.put(new Integer(serverId), server);
- db.flush();
-
- if (debug)
- if (theServerId==illegalServerId)
- System.out.println( "RepositoryImpl: registerServer called " +
- "to register ServerDef " + printServerDef( serverDef ) +
- " with new serverId " + serverId ) ;
- else
- System.out.println( "RepositoryImpl: registerServer called " +
- "to register ServerDef " + printServerDef( serverDef ) +
- " with assigned serverId " + serverId ) ;
-
- return serverId;
- }
- }
-
- public int registerServer(ServerDef serverDef)
- throws ServerAlreadyRegistered, BadServerDefinition
- {
- // verify that the entry is valid
- LegacyServerSocketEndPointInfo endpoint =
- orb.getLegacyServerSocketManager()
- .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
- int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
- .getServerSocket().getLocalPort();
- ServerTableEntry entry = new ServerTableEntry( wrapper,
- illegalServerId, serverDef, (int) initSvcPort, "", true, debug );
-
- switch (entry.verify()) {
- case ServerMain.OK:
- break;
- case ServerMain.MAIN_CLASS_NOT_FOUND:
- throw new BadServerDefinition("main class not found.");
- case ServerMain.NO_MAIN_METHOD:
- throw new BadServerDefinition("no main method found.");
- case ServerMain.APPLICATION_ERROR:
- throw new BadServerDefinition("server application error.");
- default:
- throw new BadServerDefinition("unknown Exception.");
- }
-
- return registerServer(serverDef, illegalServerId);
- }
-
- public void unregisterServer(int serverId) throws ServerNotRegistered {
-
- DBServerDef server = null;
- Integer id = new Integer(serverId);
-
- synchronized (db) {
-
- // check to see if the server is registered
- server = (DBServerDef) db.serverTable.get(id);
- if (server == null) {
- if (debug)
- System.out.println(
- "RepositoryImpl: unregisterServer for serverId " +
- serverId + " called: server not registered" ) ;
-
- throw (new ServerNotRegistered());
- }
-
- // remove server from the database
- db.serverTable.remove(id);
- db.flush();
- }
-
- if (debug)
- System.out.println(
- "RepositoryImpl: unregisterServer for serverId " + serverId +
- " called" ) ;
- }
-
- private DBServerDef getDBServerDef(int serverId) throws ServerNotRegistered
- {
- Integer id = new Integer(serverId);
- DBServerDef server = (DBServerDef) db.serverTable.get(id);
-
- if (server == null)
- throw new ServerNotRegistered( serverId );
-
- return server ;
- }
-
- public ServerDef getServer(int serverId) throws ServerNotRegistered
- {
- DBServerDef server = getDBServerDef( serverId ) ;
-
- ServerDef serverDef = new ServerDef(server.applicationName, server.name,
- server.classPath, server.args, server.vmArgs);
-
- if (debug)
- System.out.println(
- "RepositoryImpl: getServer for serverId " + serverId +
- " returns " + printServerDef( serverDef ) ) ;
-
- return serverDef;
- }
-
- public boolean isInstalled(int serverId) throws ServerNotRegistered {
- DBServerDef server = getDBServerDef( serverId ) ;
- return server.isInstalled ;
- }
-
- public void install( int serverId )
- throws ServerNotRegistered, ServerAlreadyInstalled
- {
- DBServerDef server = getDBServerDef( serverId ) ;
-
- if (server.isInstalled)
- throw new ServerAlreadyInstalled( serverId ) ;
- else {
- server.isInstalled = true ;
- db.flush() ;
- }
- }
-
- public void uninstall( int serverId )
- throws ServerNotRegistered, ServerAlreadyUninstalled
- {
- DBServerDef server = getDBServerDef( serverId ) ;
-
- if (!server.isInstalled)
- throw new ServerAlreadyUninstalled( serverId ) ;
- else {
- server.isInstalled = false ;
- db.flush() ;
- }
- }
-
- public int[] listRegisteredServers() {
- synchronized (db) {
- int i=0;
-
- int servers[] = new int[db.serverTable.size()];
-
- Enumeration enumeration = db.serverTable.elements();
-
- while (enumeration.hasMoreElements()) {
- DBServerDef server = (DBServerDef) enumeration.nextElement();
- servers[i++] = server.id;
- }
-
- if (debug) {
- StringBuffer sb = new StringBuffer() ;
- for (int ctr=0; ctr ");
-
- try {
- int i = 0;
- String cmd[] = null;
-
- String cmdLine = in.readLine();
-
- if (cmdLine != null) {
- StringTokenizer st = new StringTokenizer(cmdLine);
- if (st.countTokens() != 0) {
- cmd = new String[st.countTokens()];
- while (st.hasMoreTokens()) cmd[i++] = st.nextToken();
- }
- }
-
- return cmd;
- } catch (Exception ex) {
- System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
- System.out.println();
- ex.printStackTrace();
- }
-
- return null;
- }
-
- void printAvailableCommands()
- {
- CommandHandler handler;
-
- // print short help
- System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));
-
- for (int i=0; i < handlers.size(); i++) {
- handler = (CommandHandler) handlers.elementAt(i);
- System.out.print("\t" + handler.getCommandName());
- for (int j=handler.getCommandName().length();
- j < maxNameLen; j++) System.out.print(" ");
- System.out.print(" - ");
- handler.printCommandHelp(System.out,
- CommandHandler.shortHelp);
- }
-
- System.out.println();
- }
-
- void executeCommand(String[] cmd)
- {
- boolean result;
- CommandHandler handler;
-
- // handle the help command
- if (cmd[0].equals(helpCommand)) {
- if (cmd.length == 1) printAvailableCommands();
- else {
- // print long help for a specific command
- for (int i=0; i < handlers.size(); i++) {
- handler = (CommandHandler) handlers.elementAt(i);
- if (handler.getCommandName().equals(cmd[1])) {
- handler.printCommandHelp(System.out,
- CommandHandler.longHelp);
- }
- }
- }
-
- return;
- }
-
- // determine the subcommand and execute it
- for (int i=0; i < handlers.size(); i++) {
- handler = (CommandHandler) handlers.elementAt(i);
- if (handler.getCommandName().equals(cmd[0])) {
- String[] cmdArgs = new String[cmd.length - 1];
-
- // construct args to the command
- for (int j=0; j < cmdArgs.length; j++)
- cmdArgs[j] = cmd[j+1];
-
- // execute the command
- try {
- System.out.println();
-
- result = handler.processCommand(cmdArgs, orb, System.out);
-
- if (result == CommandHandler.parseError) {
- handler.printCommandHelp(System.out,
- CommandHandler.longHelp);
- }
-
- System.out.println();
-
- } catch (Exception ex) {}
-
- return;
- }
- }
-
- // unknown command - print available commands
- printAvailableCommands();
- }
-
- final private static boolean debug = false;
-
- ORB orb = null;
-
- static Vector handlers;
- static int maxNameLen;
-
- static {
- handlers = new Vector();
- handlers.addElement(new RegisterServer());
- handlers.addElement(new UnRegisterServer());
- handlers.addElement(new GetServerID());
- handlers.addElement(new ListServers());
- handlers.addElement(new ListAliases());
- handlers.addElement(new ListActiveServers());
- handlers.addElement(new LocateServer());
- handlers.addElement(new LocateServerForORB());
- handlers.addElement(new ListORBs());
- handlers.addElement(new ShutdownServer());
- handlers.addElement(new StartServer());
- handlers.addElement(new Help());
- handlers.addElement(new Quit());
-
- // determine longest command name
- maxNameLen = 0;
- int cmdNameLen;
- for (int i=0; i < handlers.size(); i++) {
- CommandHandler handler = (CommandHandler) handlers.elementAt(i);
- cmdNameLen = handler.getCommandName().length();
- if (cmdNameLen > maxNameLen) maxNameLen = cmdNameLen;
- }
- }
-}
-
-class RegisterServer implements CommandHandler
-{
- public String getCommandName() {return "register";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.register"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.register1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int i=0;
- String applicationName = "";
- String name = "";
- String classpath = "";
- String args = "";
- String vmargs = "";
- int serverId = 0;
-
- // parse register server command
- String arg;
- while (i < cmdArgs.length) {
-
- arg = cmdArgs[i++];
-
- if (arg.equals("-server")) {
- if (i < cmdArgs.length) name = cmdArgs[i++];
- else return parseError;
- } else if (arg.equals("-applicationName")) {
- if (i < cmdArgs.length) applicationName = cmdArgs[i++];
- else return parseError;
- } else if (arg.equals("-classpath")) {
- if (i < cmdArgs.length) classpath = cmdArgs[i++];
- else return parseError;
- } else if (arg.equals("-args")) {
- while ((i < cmdArgs.length) && !cmdArgs[i].equals("-vmargs")){
- args = args.equals("") ? cmdArgs[i] :
- args + " " + cmdArgs[i];
- i++;
- }
- if (args.equals("")) return parseError;
- } else if (arg.equals("-vmargs")) {
- while ((i < cmdArgs.length) && !cmdArgs[i].equals("-args")){
- vmargs = vmargs.equals("") ? cmdArgs[i] :
- vmargs + " " + cmdArgs[i];
- i++;
- }
- if (vmargs.equals("")) return parseError;
- } else return parseError;
- }
-
- // minimally the server class name has to be specified
- if (name.equals("")) return parseError;
-
- // register server and activate it
- try {
- // register the server with the repository
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- ServerDef server = new ServerDef(applicationName, name, classpath, args, vmargs);
- serverId = repository.registerServer(server);
-
- // activate the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.activate(serverId);
- activator.install(serverId);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.register2", serverId));
- } catch (ServerNotRegistered ex) {
- } catch (ServerAlreadyActive ex) {
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.register3", serverId));
- } catch (ServerAlreadyRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.register4", serverId));
- } catch (BadServerDefinition ex) {
- out.println(CorbaResourceUtil.getText("servertool.baddef", ex.reason));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class UnRegisterServer implements CommandHandler
-{
- public String getCommandName() {return "unregister";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.unregister"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.unregister1"));
- }
-}
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- try {
- if (cmdArgs.length == 2) {
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
-
- // deactivate server, hold it down and and unregister it
- // deactivate the server
- try {
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.uninstall(serverId);
- } catch (ServerHeldDown ex) {}
-
- // unregister the server from the repository
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
- repository.unregisterServer(serverId);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.unregister2"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class LocateServer implements CommandHandler
-{
- public String getCommandName() {return "locate";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.locate"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.locate1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- String endPointType = IIOP_CLEAR_TEXT.value;
- try {
-
- // parse command
- String arg;
- int i = 0;
- while (i < cmdArgs.length) {
-
- arg = cmdArgs[i++];
-
- if (arg.equals("-serverid")) {
- if (i < cmdArgs.length)
- serverId = (Integer.valueOf(cmdArgs[i++])).intValue();
- else
- return parseError;
- } else if (arg.equals("-applicationName")) {
- if (i < cmdArgs.length)
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ;
- else
- return parseError;
- } else if (arg.equals("-endpointType")) {
- if (i < cmdArgs.length)
- endPointType = cmdArgs[i++];
- }
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
-
- // locate the server
- // deactivate the server
- Locator locator = LocatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME ));
-
- ServerLocation location = locator.locateServer(serverId, endPointType);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.locate2", location.hostname));
- int numEntries = location.ports.length;
- for (i = 0; i < numEntries; i++) {
- ORBPortInfo orbPort = location.ports[i];
- out.println("\t\t"+ orbPort.port + "\t\t" + endPointType + "\t\t" + orbPort.orbId );
- }
- } catch (NoSuchEndPoint ex) {
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.helddown"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class LocateServerForORB implements CommandHandler
-{
- public String getCommandName() {return "locateperorb";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.locateorb"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.locateorb1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- String orbId = "";
- try {
-
- // parse command
- String arg;
- int i = 0;
- while (i < cmdArgs.length) {
-
- arg = cmdArgs[i++];
-
- if (arg.equals("-serverid")) {
- if (i < cmdArgs.length)
- serverId = (Integer.valueOf(cmdArgs[i++])).intValue();
- else
- return parseError;
- } else if (arg.equals("-applicationName")) {
- if (i < cmdArgs.length)
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ;
- else
- return parseError;
- } else if (arg.equals("-orbid")) {
- if (i < cmdArgs.length)
- orbId = cmdArgs[i++];
- }
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
-
- // locate the server
- // deactivate the server
- Locator locator = LocatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME ));
-
- ServerLocationPerORB location = locator.locateServerForORB(serverId,
- orbId);
-
- // print success message
- out.println(CorbaResourceUtil.getText("servertool.locateorb2", location.hostname));
- int numEntries = location.ports.length;
- for (i = 0; i < numEntries; i++) {
- EndPointInfo Port = location.ports[i];
- out.println("\t\t"+ Port.port + "\t\t" + Port.endpointType + "\t\t" + orbId );
- }
- } catch (InvalidORBid ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchorb"));
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.helddown"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class GetServerID implements CommandHandler
-{
- public String getCommandName() {return "getserverid" ; }
-
- public void printCommandHelp( PrintStream out, boolean helpType )
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.getserverid"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.getserverid1"));
- }
- }
-
- public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out )
- {
- if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) {
- String str = (String)cmdArgs[1] ;
-
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- try {
- int result = repository.getServerID( str ) ;
- out.println() ;
- out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
- out.println() ;
- } catch (ServerNotRegistered e) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- }
- } catch (Exception ex) {
- ex.printStackTrace() ;
- }
-
- return commandDone ;
- } else
- return parseError ;
- }
-}
-
-class ListServers implements CommandHandler
-{
- public String getCommandName() {return "list";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.list"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.list1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
- boolean listOneServer = false;
- ServerDef serverDef;
-
- // determine if list single server or all servers
- listOneServer = (cmdArgs.length!=0) ;
- if ((cmdArgs.length == 2) && cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
-
- if ((serverId == illegalServerId) && listOneServer)
- return parseError;
-
- // process the list server command
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- if (listOneServer) {
-
- try {
- serverDef = repository.getServer(serverId);
- out.println();
- printServerDef(serverDef, serverId, out);
- out.println();
- } catch (ServerNotRegistered e) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- }
-
- } else {
- int[] servers = repository.listRegisteredServers();
- out.println(CorbaResourceUtil.getText("servertool.list2"));
-
- sortServers(servers);
- for (int i=0; i < servers.length; i++) {
- try {
- serverDef = repository.getServer(servers[i]);
- out.println("\t " + servers[i] + "\t\t" +
- serverDef.serverName + "\t\t"
- + serverDef.applicationName);
- } catch (ServerNotRegistered e) {}
- }
-
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-
-static void printServerDef(ServerDef serverDef, int serverId,
- PrintStream out)
-{
- out.println(CorbaResourceUtil.getText("servertool.appname", serverDef.applicationName));
- out.println(CorbaResourceUtil.getText("servertool.name", serverDef.serverName));
- out.println(CorbaResourceUtil.getText("servertool.classpath", serverDef.serverClassPath));
- out.println(CorbaResourceUtil.getText("servertool.args", serverDef.serverArgs));
- out.println(CorbaResourceUtil.getText("servertool.vmargs", serverDef.serverVmArgs));
- out.println(CorbaResourceUtil.getText("servertool.serverid", serverId));
-}
-
-/**
- * Do a simple bubble sort to sort the server ids in ascending
- * order.
- */
-static void sortServers(int[] serverIds)
-{
- int size = serverIds.length;
- int lowest;
-
- for (int i=0; i < size; i++) {
-
- lowest = i;
-
- for (int j=i+1; j < size; j++) {
- if (serverIds[j] < serverIds[lowest]) lowest = j;
- }
-
- if (lowest != i) {
- int temp = serverIds[i];
- serverIds[i] = serverIds[lowest];
- serverIds[lowest] = temp;
- }
- }
-}
-}
-
-class ListActiveServers implements CommandHandler
-{
- public String getCommandName() {return "listactive";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.listactive"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.listactive1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- ServerDef serverDef;
-
- // process the list active servers command
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
-
- int[] servers = activator.getActiveServers();
-
- out.println(CorbaResourceUtil.getText("servertool.list2"));
-
- ListServers.sortServers(servers);
- for (int i=0; i < servers.length; i++) {
- try {
- serverDef = repository.getServer(servers[i]);
- out.println("\t " + servers[i] + "\t\t" +
- serverDef.serverName + "\t\t" +
- serverDef.applicationName);
- } catch (ServerNotRegistered e) {}
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class ListAliases implements CommandHandler
-{
- public String getCommandName() {return "listappnames";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.listappnames"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.listappnames1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- try {
- Repository repository = RepositoryHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
-
- String[] applicationNames = repository.getApplicationNames();
-
- out.println(CorbaResourceUtil.getText("servertool.listappnames2"));
- out.println();
- for (int i=0; i < applicationNames.length; i++)
- out.println( "\t" + applicationNames[i] ) ;
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class ShutdownServer implements CommandHandler
-{
- public String getCommandName() {return "shutdown";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.shutdown"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.shutdown1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- try {
- // determine the server id
- if (cmdArgs.length == 2)
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
-
- if (serverId == illegalServerId)
- return parseError;
-
- // shutdown the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.shutdown(serverId);
-
- out.println(CorbaResourceUtil.getText("servertool.shutdown2"));
- } catch (ServerNotActive ex) {
- out.println(CorbaResourceUtil.getText("servertool.servernotrunning"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
-
-class StartServer implements CommandHandler
-{
- public String getCommandName() {return "startup";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.startserver"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.startserver1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- int serverId = illegalServerId;
-
- try {
- // determine the server id
- if (cmdArgs.length == 2)
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
-
- if (serverId == illegalServerId)
- return parseError;
-
- // startup the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
- activator.activate(serverId);
-
- out.println(CorbaResourceUtil.getText("servertool.startserver2"));
- } catch (ServerNotRegistered ex) {
- out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
- } catch (ServerAlreadyActive ex) {
- out.println(CorbaResourceUtil.getText("servertool.serverup"));
- } catch (ServerHeldDown ex) {
- out.println(CorbaResourceUtil.getText("servertool.helddown"));
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return commandDone;
- }
-}
-
-class Quit implements CommandHandler
-{
- public String getCommandName() {return "quit";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.quit"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.quit1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- System.exit(0);
-
- return commandDone;
- }
-}
-
-class Help implements CommandHandler
-{
- public String getCommandName() {return "help";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.help"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.help1"));
- }
- }
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
- return commandDone;
- }
-}
-
-class ListORBs implements CommandHandler
-{
- public String getCommandName() {return "orblist";}
-
- public void printCommandHelp(PrintStream out, boolean helpType)
- {
- if (helpType == longHelp) {
- out.println(CorbaResourceUtil.getText("servertool.orbidmap"));
- } else {
- out.println(CorbaResourceUtil.getText("servertool.orbidmap1"));
- }
- }
-
- final static int illegalServerId = -1;
-
- public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
- {
-
- int serverId = illegalServerId;
-
- try {
- if (cmdArgs.length == 2) {
- if (cmdArgs[0].equals("-serverid"))
- serverId = (Integer.valueOf(cmdArgs[1])).intValue();
- else if (cmdArgs[0].equals("-applicationName"))
- serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
- }
-
- // the server id has to be specified
- if (serverId == illegalServerId)
- return parseError;
- // activate the server
- Activator activator = ActivatorHelper.narrow(
- orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
-
- String[] orbList = activator.getORBNames(serverId);
-
- out.println(CorbaResourceUtil.getText("servertool.orbidmap2"));
-
- for (int i = 0; i < orbList.length ; i++) {
- out.println("\t "+ orbList[i]);
- }
- } catch (ServerNotRegistered ex) {
- out.println("\tno such server found.");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return commandDone;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java 2018-01-30 20:16:17.000000000 -0500
+++ /dev/null 2018-01-30 20:16:17.000000000 -0500
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.orbutil.DenseIntMapImpl ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-
-public class CopierManagerImpl implements CopierManager
-{
- private int defaultId ;
- private DenseIntMapImpl map ;
- private ORB orb ;
-
- public CopierManagerImpl( ORB orb )
- {
- defaultId = 0 ;
- map = new DenseIntMapImpl() ;
- this.orb = orb ;
- }
-
- public void setDefaultId( int id )
- {
- defaultId = id ;
- }
-
- public int getDefaultId()
- {
- return defaultId ;
- }
-
- public ObjectCopierFactory getObjectCopierFactory( int id )
- {
- return (ObjectCopierFactory)(map.get( id )) ;
- }
-
- public ObjectCopierFactory getDefaultObjectCopierFactory()
- {
- return (ObjectCopierFactory)(map.get( defaultId )) ;
- }
-
- public void registerObjectCopierFactory( ObjectCopierFactory factory, int id )
- {
- map.set( id, factory ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java 2018-01-30 20:16:17.000000000 -0500
+++ /dev/null 2018-01-30 20:16:17.000000000 -0500
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
-
-/** Trys a first ObjectCopier. If the first throws a ReflectiveCopyException,
- * falls back and tries a second ObjectCopier.
- */
-public class FallbackObjectCopierImpl implements ObjectCopier
-{
- private ObjectCopier first ;
- private ObjectCopier second ;
-
- public FallbackObjectCopierImpl( ObjectCopier first,
- ObjectCopier second )
- {
- this.first = first ;
- this.second = second ;
- }
-
- public Object copy( Object src ) throws ReflectiveCopyException
- {
- try {
- return first.copy( src ) ;
- } catch (ReflectiveCopyException rce ) {
- // XXX log this fallback at a low level
- return second.copy( src ) ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java 2018-01-30 20:16:18.000000000 -0500
+++ /dev/null 2018-01-30 20:16:18.000000000 -0500
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import java.io.Serializable;
-import java.rmi.Remote;
-import java.rmi.MarshalException;
-
-import java.io.InputStream ;
-import java.io.OutputStream ;
-import java.io.ByteArrayInputStream ;
-import java.io.ByteArrayOutputStream ;
-import java.io.ObjectInputStream ;
-import java.io.ObjectOutputStream ;
-
-import org.omg.CORBA.ORB ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.impl.util.Utility;
-
-public class JavaStreamObjectCopierImpl implements ObjectCopier {
-
- public JavaStreamObjectCopierImpl( ORB orb )
- {
- this.orb = orb ;
- }
-
- public Object copy(Object obj) {
- if (obj instanceof Remote) {
- // Yes, so make sure it is connected and converted
- // to a stub (if needed)...
- return Utility.autoConnect(obj,orb,true);
- }
-
- try {
- ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
- ObjectOutputStream oos = new ObjectOutputStream( os ) ;
- oos.writeObject( obj ) ;
-
- byte[] arr = os.toByteArray() ;
- InputStream is = new ByteArrayInputStream( arr ) ;
- ObjectInputStream ois = new ObjectInputStream( is ) ;
-
- return ois.readObject();
- } catch (Exception exc) {
- System.out.println( "Failed with exception:" + exc ) ;
- return null ;
- }
- }
-
- private ORB orb;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java 2018-01-30 20:16:19.000000000 -0500
+++ /dev/null 2018-01-30 20:16:19.000000000 -0500
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import java.io.Serializable;
-import java.rmi.Remote;
-import java.rmi.MarshalException;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-import org.omg.CORBA.ORB ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.impl.util.Utility;
-
-public class ORBStreamObjectCopierImpl implements ObjectCopier {
-
- public ORBStreamObjectCopierImpl( ORB orb )
- {
- this.orb = orb ;
- }
-
- public Object copy(Object obj) {
- if (obj instanceof Remote) {
- // Yes, so make sure it is connected and converted
- // to a stub (if needed)...
- return Utility.autoConnect(obj,orb,true);
- }
-
- OutputStream out = (OutputStream)orb.create_output_stream();
- out.write_value((Serializable)obj);
- InputStream in = (InputStream)out.create_input_stream();
- return in.read_value();
- }
-
- private ORB orb;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java 2018-01-30 20:16:20.000000000 -0500
+++ /dev/null 2018-01-30 20:16:20.000000000 -0500
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.copyobject ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-
-public class ReferenceObjectCopierImpl implements ObjectCopier
-{
- public Object copy( Object obj )
- {
- return obj ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java 2018-01-30 20:16:20.000000000 -0500
+++ /dev/null 2018-01-30 20:16:20.000000000 -0500
@@ -1,1351 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.List ;
-import java.util.ArrayList ;
-
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.CompletionStatus ;
-import org.omg.CORBA.TCKind ;
-
-import org.omg.CORBA.portable.Streamable;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.EncapsInputStream;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.io.ValueUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
-import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-// subclasses must provide a matching helper class
-public class AnyImpl extends Any
-{
- private static final class AnyInputStream extends EncapsInputStream
- {
- public AnyInputStream(EncapsInputStream theStream )
- {
- super( theStream );
- }
- }
-
- private static final class AnyOutputStream extends EncapsOutputStream
- {
- public AnyOutputStream(ORB orb)
- {
- super((ORB)orb);
- }
-
- public org.omg.CORBA.portable.InputStream create_input_stream() {
- final org.omg.CORBA.portable.InputStream is = super
- .create_input_stream();
- AnyInputStream aIS = AccessController
- .doPrivileged(new PrivilegedAction() {
- @Override
- public AnyInputStream run() {
- return new AnyInputStream(
- (com.sun.corba.se.impl.encoding.EncapsInputStream) is);
- }
- });
- return aIS;
- }
- }
-
- //
- // Always valid.
- //
- private TypeCodeImpl typeCode;
- protected ORB orb;
- private ORBUtilSystemException wrapper ;
-
- //
- // Validity depends upon typecode. The 'value' and 'object' instance
- // members are used to hold immutable types as defined by the
- // isStreamed[] table below. Otherwise, 'stream' is non-null and
- // holds the value in CDR marshaled format. As an optimization, the
- // stream type is an Any extension of CDR stream that is used to
- // detect an optimization in read_value().
- //
- private CDRInputStream stream;
- private long value;
- private java.lang.Object object;
-
- // Setting the typecode via the type() accessor wipes out the value.
- // An attempt to extract before the value is set will result
- // in a BAD_OPERATION exception being raised.
- private boolean isInitialized = false;
-
- private static final int DEFAULT_BUFFER_SIZE = 32;
-
- /*
- * This boolean array tells us if a given typecode must be
- * streamed. Objects that are immutable don't have to be streamed.
- */
- static boolean isStreamed[] = {
- false, // null
- false, // void
- false, // short
- false, // long
- false, // ushort
- false, // ulong
- false, // float
- false, // double
- false, // boolean
- false, // char
- false, // octet
- false, // any
- false, // TypeCode
- true, // Principal
- false, // objref
- true, // struct
- true, // union
- false, // enum
- false, // string
- true, // sequence
- true, // array
- true, // alias
- true, // except
- false, // longlong
- false, // ulonglong
- false, // longdouble
- false, // wchar
- false, // wstring
- false, // fixed
- false, // value
- false, // value_box (used to be true)
- false, // native
- false // abstract interface
- };
-
- static AnyImpl convertToNative(ORB orb, Any any) {
- if (any instanceof AnyImpl) {
- return (AnyImpl)any;
- } else {
- AnyImpl anyImpl = new AnyImpl(orb, any);
- anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode);
- return anyImpl;
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Constructors
-
- /**
- * A constructor that sets the Any to contain a null. It also marks
- * the value as being invalid so that extractions throw an exception
- * until an insertion has been performed.
- */
- public AnyImpl(ORB orb)
- {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( (com.sun.corba.se.spi.orb.ORB)orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
-
- typeCode = orb.get_primitive_tc(TCKind._tk_null);
- stream = null;
- object = null;
- value = 0;
- // null is a valid value
- isInitialized = true;
- }
-
- //
- // Create a new AnyImpl which is a copy of obj.
- //
- public AnyImpl(ORB orb, Any obj) {
- this(orb);
-
- if ((obj instanceof AnyImpl)) {
- AnyImpl objImpl = (AnyImpl)obj;
- typeCode = objImpl.typeCode;
- value = objImpl.value;
- object = objImpl.object;
- isInitialized = objImpl.isInitialized;
-
- if (objImpl.stream != null)
- stream = objImpl.stream.dup();
-
- } else {
- read_value(obj.create_input_stream(), obj.type());
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // basic accessors
-
- /**
- * returns the type of the element contained in the Any.
- *
- * @return the TypeCode for the element in the Any
- */
- public TypeCode type() {
- return typeCode;
- }
-
- private TypeCode realType() {
- return realType(typeCode);
- }
-
- private TypeCode realType(TypeCode aType) {
- TypeCode realType = aType;
- try {
- // Note: Indirect types are handled in kind() method
- while (realType.kind().value() == TCKind._tk_alias) {
- realType = realType.content_type();
- }
- } catch (BadKind bad) { // impossible
- throw wrapper.badkindCannotOccur( bad ) ;
- }
- return realType;
- }
-
- /**
- * sets the type of the element to be contained in the Any.
- *
- * @param tc the TypeCode for the element in the Any
- */
- public void type(TypeCode tc)
- {
- //debug.log ("type2");
- // set the typecode
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
-
- stream = null;
- value = 0;
- object = null;
- // null is the only legal value this Any can have after resetting the type code
- isInitialized = (tc.kind().value() == TCKind._tk_null);
- }
-
- /**
- * checks for equality between Anys.
- *
- * @param otherAny the Any to be compared with.
- * @return true if the Anys are equal, false otherwise.
- */
- public boolean equal(Any otherAny)
- {
- //debug.log ("equal");
-
- if (otherAny == this)
- return true;
-
- // first check for typecode equality.
- // note that this will take aliases into account
- if (!typeCode.equal(otherAny.type()))
- return false;
-
- // Resolve aliases here
- TypeCode realType = realType();
-
- // _REVISIT_ Possible optimization for the case where
- // otherAny is a AnyImpl and the endianesses match.
- // Need implementation of CDRInputStream.equals()
- // For now we disable this to encourage testing the generic,
- // unoptimized code below.
- // Unfortunately this generic code needs to copy the whole stream
- // at least once.
- // if (AnyImpl.isStreamed[realType.kind().value()]) {
- // if (otherAny instanceof AnyImpl) {
- // return ((AnyImpl)otherAny).stream.equals(stream);
- // }
- // }
- switch (realType.kind().value()) {
- // handle primitive types
- case TCKind._tk_null:
- case TCKind._tk_void:
- return true;
- case TCKind._tk_short:
- return (extract_short() == otherAny.extract_short());
- case TCKind._tk_long:
- return (extract_long() == otherAny.extract_long());
- case TCKind._tk_ushort:
- return (extract_ushort() == otherAny.extract_ushort());
- case TCKind._tk_ulong:
- return (extract_ulong() == otherAny.extract_ulong());
- case TCKind._tk_float:
- return (extract_float() == otherAny.extract_float());
- case TCKind._tk_double:
- return (extract_double() == otherAny.extract_double());
- case TCKind._tk_boolean:
- return (extract_boolean() == otherAny.extract_boolean());
- case TCKind._tk_char:
- return (extract_char() == otherAny.extract_char());
- case TCKind._tk_wchar:
- return (extract_wchar() == otherAny.extract_wchar());
- case TCKind._tk_octet:
- return (extract_octet() == otherAny.extract_octet());
- case TCKind._tk_any:
- return extract_any().equal(otherAny.extract_any());
- case TCKind._tk_TypeCode:
- return extract_TypeCode().equal(otherAny.extract_TypeCode());
- case TCKind._tk_string:
- return extract_string().equals(otherAny.extract_string());
- case TCKind._tk_wstring:
- return (extract_wstring().equals(otherAny.extract_wstring()));
- case TCKind._tk_longlong:
- return (extract_longlong() == otherAny.extract_longlong());
- case TCKind._tk_ulonglong:
- return (extract_ulonglong() == otherAny.extract_ulonglong());
-
- case TCKind._tk_objref:
- return (extract_Object().equals(otherAny.extract_Object()));
- case TCKind._tk_Principal:
- return (extract_Principal().equals(otherAny.extract_Principal()));
-
- case TCKind._tk_enum:
- return (extract_long() == otherAny.extract_long());
- case TCKind._tk_fixed:
- return (extract_fixed().compareTo(otherAny.extract_fixed()) == 0);
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- InputStream copyOfMyStream = this.create_input_stream();
- InputStream copyOfOtherStream = otherAny.create_input_stream();
- return equalMember(realType, copyOfMyStream, copyOfOtherStream);
-
- // Too complicated to handle value types the way we handle
- // other complex types above. Don't try to decompose it here
- // for faster comparison, just use Object.equals().
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- return extract_Value().equals(otherAny.extract_Value());
-
- case TCKind._tk_alias:
- throw wrapper.errorResolvingAlias() ;
-
- case TCKind._tk_longdouble:
- // Unspecified for Java
- throw wrapper.tkLongDoubleNotSupported() ;
-
- default:
- throw wrapper.typecodeNotSupported() ;
- }
- }
-
- // Needed for equal() in order to achieve linear performance for complex types.
- // Uses up (recursively) copies of the InputStream in both Anys that got created in equal().
- private boolean equalMember(TypeCode memberType, InputStream myStream, InputStream otherStream) {
- // Resolve aliases here
- TypeCode realType = realType(memberType);
-
- try {
- switch (realType.kind().value()) {
- // handle primitive types
- case TCKind._tk_null:
- case TCKind._tk_void:
- return true;
- case TCKind._tk_short:
- return (myStream.read_short() == otherStream.read_short());
- case TCKind._tk_long:
- return (myStream.read_long() == otherStream.read_long());
- case TCKind._tk_ushort:
- return (myStream.read_ushort() == otherStream.read_ushort());
- case TCKind._tk_ulong:
- return (myStream.read_ulong() == otherStream.read_ulong());
- case TCKind._tk_float:
- return (myStream.read_float() == otherStream.read_float());
- case TCKind._tk_double:
- return (myStream.read_double() == otherStream.read_double());
- case TCKind._tk_boolean:
- return (myStream.read_boolean() == otherStream.read_boolean());
- case TCKind._tk_char:
- return (myStream.read_char() == otherStream.read_char());
- case TCKind._tk_wchar:
- return (myStream.read_wchar() == otherStream.read_wchar());
- case TCKind._tk_octet:
- return (myStream.read_octet() == otherStream.read_octet());
- case TCKind._tk_any:
- return myStream.read_any().equal(otherStream.read_any());
- case TCKind._tk_TypeCode:
- return myStream.read_TypeCode().equal(otherStream.read_TypeCode());
- case TCKind._tk_string:
- return myStream.read_string().equals(otherStream.read_string());
- case TCKind._tk_wstring:
- return (myStream.read_wstring().equals(otherStream.read_wstring()));
- case TCKind._tk_longlong:
- return (myStream.read_longlong() == otherStream.read_longlong());
- case TCKind._tk_ulonglong:
- return (myStream.read_ulonglong() == otherStream.read_ulonglong());
-
- case TCKind._tk_objref:
- return (myStream.read_Object().equals(otherStream.read_Object()));
- case TCKind._tk_Principal:
- return (myStream.read_Principal().equals(otherStream.read_Principal()));
-
- case TCKind._tk_enum:
- return (myStream.read_long() == otherStream.read_long());
- case TCKind._tk_fixed:
- return (myStream.read_fixed().compareTo(otherStream.read_fixed()) == 0);
- case TCKind._tk_except:
- case TCKind._tk_struct: {
- int length = realType.member_count();
- for (int i=0; i() {
- @Override
- public AnyOutputStream run() {
- return new AnyOutputStream(finalorb);
- }
- });
- }
-
- /**
- * returns an input stream that an Any value can be marshaled out of.
- *
- * @return the InputStream to marshal value of Any out of.
- */
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- //
- // We create a new InputStream so that multiple threads can call here
- // and read the streams in parallel without thread safety problems.
- //
- //debug.log ("create_input_stream");
- if (AnyImpl.isStreamed[realType().kind().value()]) {
- return stream.dup();
- } else {
- OutputStream os = (OutputStream)orb.create_output_stream();
- TCUtility.marshalIn(os, realType(), value, object);
-
- return os.create_input_stream();
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // marshaling/unmarshaling routines
-
- //
- // If the InputStream is a CDRInputStream then we can copy the bytes
- // since it is in our format and does not have alignment issues.
- //
- public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc)
- {
- //debug.log ("read_value");
- //
- // Assume that someone isn't going to think they can keep reading
- // from this stream after calling us. That would be likely for
- // an IIOPInputStream but if it is an AnyInputStream then they
- // presumably obtained it via our create_output_stream() so they could
- // write the contents of an IDL data type to it and then call
- // create_input_stream() for us to read it. This is how Helper classes
- // typically implement the insert() method.
- // We should probably document this behavior in the 1.1 revision
- // task force.
- //
-
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
- int kind = realType().kind().value();
- if (kind >= isStreamed.length) {
- throw wrapper.invalidIsstreamedTckind( CompletionStatus.COMPLETED_MAYBE,
- new Integer(kind)) ;
- }
-
- if (AnyImpl.isStreamed[kind]) {
- if ( in instanceof AnyInputStream ) {
- // could only have been created here
- stream = (CDRInputStream)in;
- } else {
- org.omg.CORBA_2_3.portable.OutputStream out =
- (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream();
- typeCode.copy((org.omg.CORBA_2_3.portable.InputStream)in, out);
- stream = (CDRInputStream)out.create_input_stream();
- }
- } else {
- java.lang.Object[] objholder = new java.lang.Object[1];
- objholder[0] = object;
- long[] longholder = new long[1];
- TCUtility.unmarshalIn(in, realType(), longholder, objholder);
- value = longholder[0];
- object = objholder[0];
- stream = null;
- }
- isInitialized = true;
- }
-
-
- //
- // We could optimize this by noticing whether the target stream
- // has ever had anything marshaled on it that required an
- // alignment of greater than 4 (was write_double() ever called on it).
- // If not, then we can just do a byte array copy without having to
- // drive the remarshaling through typecode interpretation.
- //
- public void write_value(OutputStream out)
- {
- //debug.log ("write_value");
- if (AnyImpl.isStreamed[realType().kind().value()]) {
- typeCode.copy(stream.dup(), out);
- } else {
- // _REVISIT_ check isInitialized whether all we write is TypeCode!
- TCUtility.marshalIn(out, realType(), value, object);
- }
- }
-
- /**
- * takes a streamable and inserts its reference into the any
- *
- * @param s the streamable to insert
- */
- public void insert_Streamable(Streamable s)
- {
- //debug.log ("insert_Streamable");
- typeCode = TypeCodeImpl.convertToNative(orb, s._type());
- object = s;
- isInitialized = true;
- }
-
- public Streamable extract_Streamable()
- {
- //debug.log( "extract_Streamable" ) ;
- return (Streamable)object;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // insertion/extraction/replacement for all basic types
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_short(short s)
- {
- //debug.log ("insert_short");
- typeCode = orb.get_primitive_tc(TCKind._tk_short);
- value = s;
- isInitialized = true;
- }
-
- private String getTCKindName( int tc )
- {
- if ((tc >= 0) && (tc < TypeCodeImpl.kindNames.length))
- return TypeCodeImpl.kindNames[tc] ;
- else
- return "UNKNOWN(" + tc + ")" ;
- }
-
- private void checkExtractBadOperation( int expected )
- {
- if (!isInitialized)
- throw wrapper.extractNotInitialized() ;
-
- int tc = realType().kind().value() ;
- if (tc != expected) {
- String tcName = getTCKindName( tc ) ;
- String expectedName = getTCKindName( expected ) ;
- throw wrapper.extractWrongType( expectedName, tcName ) ;
- }
- }
-
- private void checkExtractBadOperationList( int[] expected )
- {
- if (!isInitialized)
- throw wrapper.extractNotInitialized() ;
-
- int tc = realType().kind().value() ;
- for (int ctr=0; ctrgeneral Any operations.
- */
- public short extract_short()
- {
- //debug.log ("extract_short");
- checkExtractBadOperation( TCKind._tk_short ) ;
- return (short)value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_long(int l)
- {
- //debug.log ("insert_long");
- // A long value is applicable to enums as well, so don't erase the enum type code
- // in case it was initialized that way before.
- int kind = realType().kind().value();
- if (kind != TCKind._tk_long && kind != TCKind._tk_enum) {
- typeCode = orb.get_primitive_tc(TCKind._tk_long);
- }
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public int extract_long()
- {
- //debug.log ("extract_long");
- checkExtractBadOperationList( new int[] { TCKind._tk_long, TCKind._tk_enum } ) ;
- return (int)value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_ushort(short s)
- {
- //debug.log ("insert_ushort");
- typeCode = orb.get_primitive_tc(TCKind._tk_ushort);
- value = s;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public short extract_ushort()
- {
- //debug.log ("extract_ushort");
- checkExtractBadOperation( TCKind._tk_ushort ) ;
- return (short)value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_ulong(int l)
- {
- //debug.log ("insert_ulong");
- typeCode = orb.get_primitive_tc(TCKind._tk_ulong);
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public int extract_ulong()
- {
- //debug.log ("extract_ulong");
- checkExtractBadOperation( TCKind._tk_ulong ) ;
- return (int)value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_float(float f)
- {
- //debug.log ("insert_float");
- typeCode = orb.get_primitive_tc(TCKind._tk_float);
- value = Float.floatToIntBits(f);
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public float extract_float()
- {
- //debug.log ("extract_float");
- checkExtractBadOperation( TCKind._tk_float ) ;
- return Float.intBitsToFloat((int)value);
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_double(double d)
- {
- //debug.log ("insert_double");
- typeCode = orb.get_primitive_tc(TCKind._tk_double);
- value = Double.doubleToLongBits(d);
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public double extract_double()
- {
- //debug.log ("extract_double");
- checkExtractBadOperation( TCKind._tk_double ) ;
- return Double.longBitsToDouble(value);
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_longlong(long l)
- {
- //debug.log ("insert_longlong");
- typeCode = orb.get_primitive_tc(TCKind._tk_longlong);
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public long extract_longlong()
- {
- //debug.log ("extract_longlong");
- checkExtractBadOperation( TCKind._tk_longlong ) ;
- return value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_ulonglong(long l)
- {
- //debug.log ("insert_ulonglong");
- typeCode = orb.get_primitive_tc(TCKind._tk_ulonglong);
- value = l;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public long extract_ulonglong()
- {
- //debug.log ("extract_ulonglong");
- checkExtractBadOperation( TCKind._tk_ulonglong ) ;
- return value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_boolean(boolean b)
- {
- //debug.log ("insert_boolean");
- typeCode = orb.get_primitive_tc(TCKind._tk_boolean);
- value = (b)? 1:0;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public boolean extract_boolean()
- {
- //debug.log ("extract_boolean");
- checkExtractBadOperation( TCKind._tk_boolean ) ;
- return (value == 0)? false: true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_char(char c)
- {
- //debug.log ("insert_char");
- typeCode = orb.get_primitive_tc(TCKind._tk_char);
- value = c;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public char extract_char()
- {
- //debug.log ("extract_char");
- checkExtractBadOperation( TCKind._tk_char ) ;
- return (char)value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_wchar(char c)
- {
- //debug.log ("insert_wchar");
- typeCode = orb.get_primitive_tc(TCKind._tk_wchar);
- value = c;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public char extract_wchar()
- {
- //debug.log ("extract_wchar");
- checkExtractBadOperation( TCKind._tk_wchar ) ;
- return (char)value;
- }
-
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_octet(byte b)
- {
- //debug.log ("insert_octet");
- typeCode = orb.get_primitive_tc(TCKind._tk_octet);
- value = b;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public byte extract_octet()
- {
- //debug.log ("extract_octet");
- checkExtractBadOperation( TCKind._tk_octet ) ;
- return (byte)value;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_string(String s)
- {
- //debug.log ("insert_string");
- // Make sure type code information for bounded strings is not erased
- if (typeCode.kind() == TCKind.tk_string) {
- int length = 0;
- try {
- length = typeCode.length();
- } catch (BadKind bad) {
- throw wrapper.badkindCannotOccur() ;
- }
-
- // Check if bounded strings length is not exceeded
- if (length != 0 && s != null && s.length() > length) {
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(length) ) ;
- }
- } else {
- typeCode = orb.get_primitive_tc(TCKind._tk_string);
- }
- object = s;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public String extract_string()
- {
- //debug.log ("extract_string");
- checkExtractBadOperation( TCKind._tk_string ) ;
- return (String)object;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_wstring(String s)
- {
- //debug.log ("insert_wstring");
- // Make sure type code information for bounded strings is not erased
- if (typeCode.kind() == TCKind.tk_wstring) {
- int length = 0;
- try {
- length = typeCode.length();
- } catch (BadKind bad) {
- throw wrapper.badkindCannotOccur() ;
- }
-
- // Check if bounded strings length is not exceeded
- if (length != 0 && s != null && s.length() > length) {
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(length) ) ;
- }
- } else {
- typeCode = orb.get_primitive_tc(TCKind._tk_wstring);
- }
- object = s;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public String extract_wstring()
- {
- //debug.log ("extract_wstring");
- checkExtractBadOperation( TCKind._tk_wstring ) ;
- return (String)object;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_any(Any a)
- {
- //debug.log ("insert_any");
- typeCode = orb.get_primitive_tc(TCKind._tk_any);
- object = a;
- stream = null;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public Any extract_any()
- {
- //debug.log ("extract_any");
- checkExtractBadOperation( TCKind._tk_any ) ;
- return (Any)object;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_Object(org.omg.CORBA.Object o)
- {
- //debug.log ("insert_Object");
- if ( o == null ) {
- typeCode = orb.get_primitive_tc(TCKind._tk_objref);
- } else {
- if (StubAdapter.isStub(o)) {
- String[] ids = StubAdapter.getTypeIds( o ) ;
- typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
- } else {
- throw wrapper.badInsertobjParam(
- CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
- }
- }
-
- object = o;
- isInitialized = true;
- }
-
- /**
- * A variant of the insertion operation that takes a typecode
- * argument as well.
- */
- public void insert_Object(org.omg.CORBA.Object o, TypeCode tc)
- {
- //debug.log ("insert_Object2");
- try {
- if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) )
- {
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
- object = o;
- }
- else {
- throw wrapper.insertObjectIncompatible() ;
- }
- } catch ( Exception ex ) {
- throw wrapper.insertObjectFailed(ex) ;
- }
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public org.omg.CORBA.Object extract_Object()
- {
- //debug.log ("extract_Object");
- if (!isInitialized)
- throw wrapper.extractNotInitialized() ;
-
- // Check if the object contained here is of the type in typeCode
- org.omg.CORBA.Object obj = null;
- try {
- obj = (org.omg.CORBA.Object) object;
- if (typeCode.id().equals("IDL:omg.org/CORBA/Object:1.0") || obj._is_a(typeCode.id())) {
- return obj;
- } else {
- throw wrapper.extractObjectIncompatible() ;
- }
- } catch ( Exception ex ) {
- throw wrapper.extractObjectFailed(ex);
- }
- }
-
- /**
- * See the description of the general Any operations.
- */
- public void insert_TypeCode(TypeCode tc)
- {
- //debug.log ("insert_TypeCode");
- typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode);
- object = tc;
- isInitialized = true;
- }
-
- /**
- * See the description of the general Any operations.
- */
- public TypeCode extract_TypeCode()
- {
- //debug.log ("extract_TypeCode");
- checkExtractBadOperation( TCKind._tk_TypeCode ) ;
- return (TypeCode)object;
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public void insert_Principal(Principal p)
- {
- typeCode = orb.get_primitive_tc(TCKind._tk_Principal);
- object = p;
- isInitialized = true;
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public Principal extract_Principal()
- {
- checkExtractBadOperation( TCKind._tk_Principal ) ;
- return (Principal)object;
- }
-
- /**
- * Note that the Serializable really should be an IDLEntity of
- * some kind. It shouldn't just be an RMI-IIOP type. Currently,
- * we accept and will produce RMI repIds with the latest
- * calculations if given a non-IDLEntity Serializable.
- */
- public Serializable extract_Value()
- {
- //debug.log ("extract_Value");
- checkExtractBadOperationList( new int[] { TCKind._tk_value,
- TCKind._tk_value_box, TCKind._tk_abstract_interface } ) ;
- return (Serializable)object;
- }
-
- public void insert_Value(Serializable v)
- {
- //debug.log ("insert_Value");
- object = v;
-
- TypeCode tc;
-
- if ( v == null ) {
- tc = orb.get_primitive_tc (TCKind.tk_value);
- } else {
- // See note in getPrimitiveTypeCodeForClass. We
- // have to use the latest type code fixes in this
- // case since there is no way to know what ORB will
- // actually send this Any. In RMI-IIOP, when using
- // Util.writeAny, we can do the versioning correctly,
- // and use the insert_Value(Serializable, TypeCode)
- // method.
- //
- // The ORB singleton uses the latest version.
- tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
- }
-
- typeCode = TypeCodeImpl.convertToNative(orb, tc);
- isInitialized = true;
- }
-
- public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t)
- {
- //debug.log ("insert_Value2");
- object = v;
- typeCode = TypeCodeImpl.convertToNative(orb, t);
- isInitialized = true;
- }
-
- public void insert_fixed(java.math.BigDecimal value) {
- typeCode = TypeCodeImpl.convertToNative(orb,
- orb.create_fixed_tc(TypeCodeImpl.digits(value), TypeCodeImpl.scale(value)));
- object = value;
- isInitialized = true;
- }
-
- public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
- {
- try {
- if (TypeCodeImpl.digits(value) > type.fixed_digits() ||
- TypeCodeImpl.scale(value) > type.fixed_scale())
- {
- throw wrapper.fixedNotMatch() ;
- }
- } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
- // type isn't even of kind fixed
- throw wrapper.fixedBadTypecode( bk ) ;
- }
- typeCode = TypeCodeImpl.convertToNative(orb, type);
- object = value;
- isInitialized = true;
- }
-
- public java.math.BigDecimal extract_fixed() {
- checkExtractBadOperation( TCKind._tk_fixed ) ;
- return (BigDecimal)object;
- }
-
- /**
- * Utility method for insert_Value and Util.writeAny.
- *
- * The ORB passed in should have the desired ORBVersion. It
- * is used to generate the type codes.
- */
- public TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB)
- {
- // Look in the cache first
- TypeCodeImpl classTC = tcORB.getTypeCodeForClass(c);
- if (classTC != null)
- return classTC;
-
- // All cases need to be able to create repository IDs.
- //
- // See bug 4391648 for more info about the tcORB in this
- // case.
- RepositoryIdStrings repStrs
- = RepositoryIdFactory.getRepIdStringsFactory();
-
-
- // Assertion: c instanceof Serializable?
-
- if ( c.isArray() ) {
- // Arrays - may recurse for multi-dimensional arrays
- Class componentClass = c.getComponentType();
- TypeCode embeddedType;
- if ( componentClass.isPrimitive() ) {
- embeddedType = getPrimitiveTypeCodeForClass(componentClass,
- tcORB);
- } else {
- embeddedType = createTypeCodeForClass (componentClass,
- tcORB);
- }
- TypeCode t = tcORB.create_sequence_tc (0, embeddedType);
-
- String id = repStrs.createForJavaType(c);
-
- return tcORB.create_value_box_tc (id, "Sequence", t);
- } else if ( c == java.lang.String.class ) {
- // Strings
- TypeCode t = tcORB.create_string_tc (0);
-
- String id = repStrs.createForJavaType(c);
-
- return tcORB.create_value_box_tc (id, "StringValue", t);
- }
-
- // Anything else
- // We know that this is a TypeCodeImpl since it is our ORB
- classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass(
- tcORB, c, ORBUtility.createValueHandler());
- // Intruct classTC to store its buffer
- classTC.setCaching(true);
- // Update the cache
- tcORB.setTypeCodeForClass(c, classTC);
- return classTC;
- }
-
- /**
- * It looks like this was copied from io.ValueUtility at some
- * point.
- *
- * It's used by createTypeCodeForClass. The tcORB passed in
- * should have the desired ORB version, and is used to
- * create the type codes.
- */
- private TypeCode getPrimitiveTypeCodeForClass (Class c, ORB tcORB)
- {
- //debug.log ("getPrimitiveTypeCodeForClass");
-
- if (c == Integer.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_long);
- } else if (c == Byte.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_octet);
- } else if (c == Long.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_longlong);
- } else if (c == Float.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_float);
- } else if (c == Double.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_double);
- } else if (c == Short.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_short);
- } else if (c == Character.TYPE) {
- // For Merlin or later JDKs, or for foreign ORBs,
- // we correctly say that a Java char maps to a
- // CORBA wchar. For backwards compatibility
- // with our older ORBs, we say it maps to a
- // CORBA char. This is only used in RMI-IIOP
- // in our javax.rmi.CORBA.Util delegate's
- // writeAny method. In Java IDL, there's no way
- // to know the ORB version that the Any will be
- // sent out with -- it could be different than
- // the one used to create the Any -- so we use the
- // most recent version (see insert_Value).
- if (ORBVersionFactory.getFOREIGN().compareTo(tcORB.getORBVersion()) == 0 ||
- ORBVersionFactory.getNEWER().compareTo(tcORB.getORBVersion()) <= 0)
- return tcORB.get_primitive_tc(TCKind.tk_wchar);
- else
- return tcORB.get_primitive_tc(TCKind.tk_char);
- } else if (c == Boolean.TYPE) {
- return tcORB.get_primitive_tc (TCKind.tk_boolean);
- } else {
- // _REVISIT_ Not sure if this is right.
- return tcORB.get_primitive_tc (TCKind.tk_any);
- }
- }
-
- // Extracts a member value according to the given TypeCode from the given complex Any
- // (at the Anys current internal stream position, consuming the anys stream on the way)
- // and returns it wrapped into a new Any
- public Any extractAny(TypeCode memberType, ORB orb) {
- Any returnValue = orb.create_any();
- OutputStream out = returnValue.create_output_stream();
- TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
- returnValue.read_value(out.create_input_stream(), memberType);
- return returnValue;
- }
-
- // This method could very well be moved into TypeCodeImpl or a common utility class,
- // but is has to be in this package.
- static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
- Any returnValue = orb.create_any();
- OutputStream out = returnValue.create_output_stream();
- TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
- returnValue.read_value(out.create_input_stream(), memberType);
- return returnValue;
- }
-
- // There is no other way for DynAnys to find out whether the Any is initialized.
- public boolean isInitialized() {
- return isInitialized;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java 2018-01-30 20:16:21.000000000 -0500
+++ /dev/null 2018-01-30 20:16:21.000000000 -0500
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-abstract public class AnyImplHelper
-{
- private static String _id = "IDL:omg.org/CORBA/Any:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.omg.CORBA.Any extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.omg.CORBA.Any read (org.omg.CORBA.portable.InputStream istream)
- {
- return istream.read_any ();
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value)
- {
- ostream.write_any (value);
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java 2018-01-30 20:16:22.000000000 -0500
+++ /dev/null 2018-01-30 20:16:22.000000000 -0500
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-///////////////////////////////////////////////////////////////////////////
-// helper class for deferred invocations
-
-/*
- * The AsynchInvoke class allows for the support of asynchronous
- * invocations. Instances of these are created with a request object,
- * and when run, perform an invocation. The instance is also
- * responsible for waking up a client that might be waiting on the
- * 'get_response' method.
- */
-
-public class AsynchInvoke implements Runnable {
-
- private RequestImpl _req;
- private ORB _orb;
- private boolean _notifyORB;
-
- public AsynchInvoke (ORB o, RequestImpl reqToInvokeOn, boolean n)
- {
- _orb = o;
- _req = reqToInvokeOn;
- _notifyORB = n;
- };
-
-
- /*
- * The run operation calls the invocation on the request object,
- * updates the RequestImpl state to indicate that the asynchronous
- * invocation is complete, and wakes up any client that might be
- * waiting on a 'get_response' call.
- *
- */
-
- public void run()
- {
- // do the actual invocation
- _req.doInvocation();
-
- // for the asynchronous case, note that the response has been
- // received.
- synchronized (_req)
- {
- // update local boolean indicator
- _req.gotResponse = true;
-
- // notify any client waiting on a 'get_response'
- _req.notify();
- }
-
- if (_notifyORB == true) {
- _orb.notifyORB() ;
- }
- }
-
-};
-
-///////////////////////////////////////////////////////////////////////////
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java 2018-01-30 20:16:22.000000000 -0500
+++ /dev/null 2018-01-30 20:16:22.000000000 -0500
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-//
-// Bare implementation of CORBA Object.
-//
-public class CORBAObjectImpl extends org.omg.CORBA_2_3.portable.ObjectImpl {
- public String[] _ids() {
- String[] typeids = new String[1];
- typeids[0] = "IDL:omg.org/CORBA/Object:1.0";
- return typeids;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java 2018-01-30 20:16:23.000000000 -0500
+++ /dev/null 2018-01-30 20:16:23.000000000 -0500
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.NVList;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public final class ContextImpl extends Context {
-
- private org.omg.CORBA.ORB _orb;
- private ORBUtilSystemException wrapper ;
-
- public ContextImpl(org.omg.CORBA.ORB orb)
- {
- _orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb,
- CORBALogDomains.RPC_PRESENTATION ) ;
- }
-
- public ContextImpl(Context parent)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public String context_name()
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public Context parent()
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public Context create_child(String name)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public void set_one_value(String propName, Any propValue)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public void set_values(NVList values)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
-
- public void delete_values(String propName)
- {
- throw wrapper.contextNotImplemented() ;
- }
-
- public NVList get_values(String startScope,
- int opFlags,
- String propName)
- {
- throw wrapper.contextNotImplemented() ;
- }
-};
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java 2018-01-30 20:16:24.000000000 -0500
+++ /dev/null 2018-01-30 20:16:24.000000000 -0500
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.Vector;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.ORB;
-
-public class ContextListImpl extends ContextList
-{
- private final int INITIAL_CAPACITY = 2;
- private final int CAPACITY_INCREMENT = 2;
-
- private org.omg.CORBA.ORB _orb;
- private Vector _contexts;
-
- public ContextListImpl(org.omg.CORBA.ORB orb)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- _orb = orb;
- _contexts = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
- }
-
- public int count()
- {
- return _contexts.size();
- }
-
- public void add(String ctxt)
- {
- _contexts.addElement(ctxt);
- }
-
- public String item(int index)
- throws Bounds
- {
- try {
- return (String) _contexts.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
- public void remove(int index)
- throws Bounds
- {
- try {
- _contexts.removeElementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java 2018-01-30 20:16:24.000000000 -0500
+++ /dev/null 2018-01-30 20:16:24.000000000 -0500
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.ORB;
-
-public class EnvironmentImpl extends Environment {
-
- private Exception _exc;
-
- public EnvironmentImpl()
- {
- }
-
- public Exception exception()
- {
- return _exc;
- }
-
- public void exception(Exception exc)
- {
- _exc = exc;
- }
-
- public void clear()
- {
- _exc = null;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java 2018-01-30 20:16:25.000000000 -0500
+++ /dev/null 2018-01-30 20:16:25.000000000 -0500
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.Vector;
-
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.ORB;
-
-
-public class ExceptionListImpl extends ExceptionList {
-
- private final int INITIAL_CAPACITY = 2;
- private final int CAPACITY_INCREMENT = 2;
-
- private Vector _exceptions;
-
- public ExceptionListImpl() {
- _exceptions = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
- }
-
- public int count()
- {
- return _exceptions.size();
- }
-
- public void add(TypeCode tc)
- {
- _exceptions.addElement(tc);
- }
-
- public TypeCode item(int index)
- throws Bounds
- {
- try {
- return (TypeCode) _exceptions.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
- public void remove(int index)
- throws Bounds
- {
- try {
- _exceptions.removeElementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java 2018-01-30 20:16:26.000000000 -0500
+++ /dev/null 2018-01-30 20:16:26.000000000 -0500
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.Vector;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.NamedValue;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-public class NVListImpl extends NVList
-{
- private final int INITIAL_CAPACITY = 4;
- private final int CAPACITY_INCREMENT = 2;
-
- private Vector _namedValues;
- private ORB orb;
-
- public NVListImpl(ORB orb)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- this.orb = orb;
- _namedValues = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
- }
-
- public NVListImpl(ORB orb, int size)
- {
- this.orb = orb;
-
- // Note: the size arg is only a hint of the size of the NVList.
- _namedValues = new Vector(size);
- }
-
-
- public int count()
- {
- return _namedValues.size();
- }
-
- public NamedValue add(int flags)
- {
- NamedValue tmpVal = new NamedValueImpl(orb, "", new AnyImpl(orb), flags);
- _namedValues.addElement(tmpVal);
- return tmpVal;
- }
-
- public NamedValue add_item(String itemName, int flags)
- {
- NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb),
- flags);
- _namedValues.addElement(tmpVal);
- return tmpVal;
- }
-
- public NamedValue add_value(String itemName, Any val, int flags)
- {
- NamedValue tmpVal = new NamedValueImpl(orb, itemName, val, flags);
- _namedValues.addElement(tmpVal);
- return tmpVal;
- }
-
- public NamedValue item(int index)
- throws Bounds
- {
- try {
- return (NamedValue) _namedValues.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-
- public void remove(int index)
- throws Bounds
- {
- try {
- _namedValues.removeElementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new Bounds();
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java 2018-01-30 20:16:26.000000000 -0500
+++ /dev/null 2018-01-30 20:16:26.000000000 -0500
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-public class NamedValueImpl extends NamedValue
-{
- private String _name;
- private Any _value;
- private int _flags;
- private ORB _orb;
-
- public NamedValueImpl(ORB orb)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- _orb = orb;
- _value = new AnyImpl(_orb);
- }
-
- public NamedValueImpl(ORB orb,
- String name,
- Any value,
- int flags)
- {
- // Note: This orb could be an instanceof ORBSingleton or ORB
- _orb = orb;
- _name = name;
- _value = value;
- _flags = flags;
- }
-
- public String name()
- {
- return _name;
- }
-
- public Any value()
- {
- return _value;
- }
-
- public int flags()
- {
- return _flags;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java 2018-01-30 20:16:27.000000000 -0500
+++ /dev/null 2018-01-30 20:16:27.000000000 -0500
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-
-public class PrincipalImpl extends org.omg.CORBA.Principal
-{
- private byte[] value;
-
- public void name(byte[] value)
- {
- this.value = value;
- }
-
- public byte[] name()
- {
- return value;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java 2018-01-30 20:16:28.000000000 -0500
+++ /dev/null 2018-01-30 20:16:28.000000000 -0500
@@ -1,374 +0,0 @@
-/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.ARG_IN;
-import org.omg.CORBA.ARG_OUT;
-import org.omg.CORBA.ARG_INOUT;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.Request;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.UnknownUserException;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.WrongTransaction;
-
-import org.omg.CORBA.portable.ApplicationException ;
-import org.omg.CORBA.portable.RemarshalException ;
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.corba.AsynchInvoke;
-
-public class RequestImpl
- extends Request
-{
- ///////////////////////////////////////////////////////////////////////////
- // data members
-
- protected org.omg.CORBA.Object _target;
- protected String _opName;
- protected NVList _arguments;
- protected ExceptionList _exceptions;
- private NamedValue _result;
- protected Environment _env;
- private Context _ctx;
- private ContextList _ctxList;
- protected ORB _orb;
- private ORBUtilSystemException _wrapper;
-
- // invocation-specific stuff
- protected boolean _isOneWay = false;
- private int[] _paramCodes;
- private long[] _paramLongs;
- private java.lang.Object[] _paramObjects;
-
- // support for deferred invocations.
- // protected instead of private since it needs to be set by the
- // thread object doing the asynchronous invocation.
- protected boolean gotResponse = false;
-
- ///////////////////////////////////////////////////////////////////////////
- // constructor
-
- // REVISIT - used to be protected. Now public so it can be
- // accessed from xgiop.
- public RequestImpl (ORB orb,
- org.omg.CORBA.Object targetObject,
- Context ctx,
- String operationName,
- NVList argumentList,
- NamedValue resultContainer,
- ExceptionList exceptionList,
- ContextList ctxList)
- {
-
- // initialize the orb
- _orb = orb;
- _wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.OA_INVOCATION ) ;
-
- // initialize target, context and operation name
- _target = targetObject;
- _ctx = ctx;
- _opName = operationName;
-
- // initialize argument list if not passed in
- if (argumentList == null)
- _arguments = new NVListImpl(_orb);
- else
- _arguments = argumentList;
-
- // set result container.
- _result = resultContainer;
-
- // initialize exception list if not passed in
- if (exceptionList == null)
- _exceptions = new ExceptionListImpl();
- else
- _exceptions = exceptionList;
-
- // initialize context list if not passed in
- if (ctxList == null)
- _ctxList = new ContextListImpl(_orb);
- else
- _ctxList = ctxList;
-
- // initialize environment
- _env = new EnvironmentImpl();
-
- }
-
- public org.omg.CORBA.Object target()
- {
- return _target;
- }
-
- public String operation()
- {
- return _opName;
- }
-
- public NVList arguments()
- {
- return _arguments;
- }
-
- public NamedValue result()
- {
- return _result;
- }
-
- public Environment env()
- {
- return _env;
- }
-
- public ExceptionList exceptions()
- {
- return _exceptions;
- }
-
- public ContextList contexts()
- {
- return _ctxList;
- }
-
- public synchronized Context ctx()
- {
- if (_ctx == null)
- _ctx = new ContextImpl(_orb);
- return _ctx;
- }
-
- public synchronized void ctx(Context newCtx)
- {
- _ctx = newCtx;
- }
-
- public synchronized Any add_in_arg()
- {
- return _arguments.add(org.omg.CORBA.ARG_IN.value).value();
- }
-
- public synchronized Any add_named_in_arg(String name)
- {
- return _arguments.add_item(name, org.omg.CORBA.ARG_IN.value).value();
- }
-
- public synchronized Any add_inout_arg()
- {
- return _arguments.add(org.omg.CORBA.ARG_INOUT.value).value();
- }
-
- public synchronized Any add_named_inout_arg(String name)
- {
- return _arguments.add_item(name, org.omg.CORBA.ARG_INOUT.value).value();
- }
-
- public synchronized Any add_out_arg()
- {
- return _arguments.add(org.omg.CORBA.ARG_OUT.value).value();
- }
-
- public synchronized Any add_named_out_arg(String name)
- {
- return _arguments.add_item(name, org.omg.CORBA.ARG_OUT.value).value();
- }
-
- public synchronized void set_return_type(TypeCode tc)
- {
- if (_result == null)
- _result = new NamedValueImpl(_orb);
- _result.value().type(tc);
- }
-
- public synchronized Any return_value()
- {
- if (_result == null)
- _result = new NamedValueImpl(_orb);
- return _result.value();
- }
-
- public synchronized void add_exception(TypeCode exceptionType)
- {
- _exceptions.add(exceptionType);
- }
-
- public synchronized void invoke()
- {
- doInvocation();
- }
-
- public synchronized void send_oneway()
- {
- _isOneWay = true;
- doInvocation();
- }
-
- public synchronized void send_deferred()
- {
- AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false);
- new Thread(null, invokeObject, "Async-Request-Invoker-Thread", 0, false).start();
- }
-
- public synchronized boolean poll_response()
- {
- // this method has to be synchronized even though it seems
- // "readonly" since the thread object doing the asynchronous
- // invocation can potentially update this variable in parallel.
- // updates are currently simply synchronized againt the request
- // object.
- return gotResponse;
- }
-
- public synchronized void get_response()
- throws org.omg.CORBA.WrongTransaction
- {
- while (gotResponse == false) {
- // release the lock. wait to be notified by the thread that is
- // doing the asynchronous invocation.
- try {
- wait();
- }
- catch (InterruptedException e) {}
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // private helper methods
-
- /*
- * The doInvocation operation is where the real mechanics of
- * performing the request invocation is done.
- */
- protected void doInvocation()
- {
- org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(
- _target ) ;
-
- // Initiate Client Portable Interceptors. Inform the PIHandler that
- // this is a DII request so that it knows to ignore the second
- // inevitable call to initiateClientPIRequest in createRequest.
- // Also, save the RequestImpl object for later use.
- _orb.getPIHandler().initiateClientPIRequest( true );
- _orb.getPIHandler().setClientPIInfo( this );
-
- InputStream $in = null;
- try {
- OutputStream $out = delegate.request(null, _opName, !_isOneWay);
- // Marshal args
- try {
- for (int i=0; i<_arguments.count() ; i++) {
- NamedValue nv = _arguments.item(i);
- switch (nv.flags()) {
- case ARG_IN.value:
- nv.value().write_value($out);
- break;
- case ARG_OUT.value:
- break;
- case ARG_INOUT.value:
- nv.value().write_value($out);
- break;
- }
- }
- } catch ( org.omg.CORBA.Bounds ex ) {
- throw _wrapper.boundsErrorInDiiRequest( ex ) ;
- }
-
- $in = delegate.invoke(null, $out);
- } catch (ApplicationException e) {
- // REVISIT - minor code.
- // This is already handled in subcontract.
- // REVISIT - uncomment.
- //throw new INTERNAL();
- } catch (RemarshalException e) {
- doInvocation();
- } catch( SystemException ex ) {
- _env.exception(ex);
- // NOTE: The exception should not be thrown.
- // However, JDK 1.4 and earlier threw the exception,
- // so we keep the behavior to be compatible.
- throw ex;
- } finally {
- delegate.releaseReply(null, $in);
- }
- }
-
- // REVISIT - make protected after development - so xgiop can get it.
- public void unmarshalReply(InputStream is)
- {
- // First unmarshal the return value if it is not void
- if ( _result != null ) {
- Any returnAny = _result.value();
- TypeCode returnType = returnAny.type();
- if ( returnType.kind().value() != TCKind._tk_void )
- returnAny.read_value(is, returnType);
- }
-
- // Now unmarshal the out/inout args
- try {
- for ( int i=0; i<_arguments.count() ; i++) {
- NamedValue nv = _arguments.item(i);
- switch( nv.flags() ) {
- case ARG_IN.value:
- break;
- case ARG_OUT.value:
- case ARG_INOUT.value:
- Any any = nv.value();
- any.read_value(is, any.type());
- break;
- }
- }
- }
- catch ( org.omg.CORBA.Bounds ex ) {
- // Cannot happen since we only iterate till _arguments.count()
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java 2018-01-30 20:16:28.000000000 -0500
+++ /dev/null 2018-01-30 20:16:28.000000000 -0500
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.ServerRequest;
-import org.omg.CORBA.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class ServerRequestImpl extends ServerRequest {
-
- ///////////////////////////////////////////////////////////////////////////
- // data members
-
- private ORB _orb = null;
- private ORBUtilSystemException _wrapper = null;
- private String _opName = null;
- private NVList _arguments = null;
- private Context _ctx = null;
- private InputStream _ins = null;
-
- // booleans to check for various operation invocation restrictions
- private boolean _paramsCalled = false;
- private boolean _resultSet = false;
- private boolean _exceptionSet = false;
- private Any _resultAny = null;
- private Any _exception = null;
-
-
- public ServerRequestImpl (CorbaMessageMediator req, ORB orb) {
- _opName = req.getOperationName();
- _ins = (InputStream)req.getInputObject();
- _ctx = null; // if we support contexts, this would
- // presumably also be available on
- // the server invocation
- _orb = orb;
- _wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.OA_INVOCATION ) ;
- }
-
- public String operation() {
- return _opName;
- }
-
- public void arguments(NVList args)
- {
- if (_paramsCalled)
- throw _wrapper.argumentsCalledMultiple() ;
-
- if (_exceptionSet)
- throw _wrapper.argumentsCalledAfterException() ;
-
- if (args == null )
- throw _wrapper.argumentsCalledNullArgs() ;
-
- _paramsCalled = true;
-
- NamedValue arg = null;
- for (int i=0; i < args.count() ; i++) {
- try {
- arg = args.item(i);
- } catch (Bounds e) {
- throw _wrapper.boundsCannotOccur(e) ;
- }
-
- try {
- if ((arg.flags() == org.omg.CORBA.ARG_IN.value) ||
- (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
- // unmarshal the value into the Any
- arg.value().read_value(_ins, arg.value().type());
- }
- } catch ( Exception ex ) {
- throw _wrapper.badArgumentsNvlist( ex ) ;
- }
- }
-
- // hang on to the NVList for marshaling the result
- _arguments = args;
-
- _orb.getPIHandler().setServerPIInfo( _arguments );
- _orb.getPIHandler().invokeServerPIIntermediatePoint();
- }
-
- public void set_result(Any res) {
- // check for invocation restrictions
- if (!_paramsCalled)
- throw _wrapper.argumentsNotCalled() ;
- if (_resultSet)
- throw _wrapper.setResultCalledMultiple() ;
- if (_exceptionSet)
- throw _wrapper.setResultAfterException() ;
- if ( res == null )
- throw _wrapper.setResultCalledNullArgs() ;
-
- _resultAny = res;
- _resultSet = true;
-
- // Notify portable interceptors of the result so that
- // ServerRequestInfo.result() functions as desired.
- _orb.getPIHandler().setServerPIInfo( _resultAny );
-
- // actual marshaling of the reply msg header and params takes place
- // after the DSI returns control to the ORB.
- }
-
- public void set_exception(Any exc)
- {
- // except can be called by the DIR at any time (CORBA 2.2 section 6.3).
-
- if ( exc == null )
- throw _wrapper.setExceptionCalledNullArgs() ;
-
- // Ensure that the Any contains a SystemException or a
- // UserException. If the UserException is not a declared exception,
- // the client will get an UNKNOWN exception.
- TCKind kind = exc.type().kind();
- if ( kind != TCKind.tk_except )
- throw _wrapper.setExceptionCalledBadType() ;
-
- _exception = exc;
-
- // Inform Portable interceptors of the exception that was set
- // so sending_exception can return the right value.
- _orb.getPIHandler().setServerPIExceptionInfo( _exception );
-
- // The user can only call arguments once and not at all after
- // set_exception. (internal flags ensure this). However, the user
- // can call set_exception multiple times. Therefore, we only
- // invoke receive_request the first time set_exception is
- // called (if they haven't already called arguments).
- if( !_exceptionSet && !_paramsCalled ) {
- // We need to invoke intermediate points here.
- _orb.getPIHandler().invokeServerPIIntermediatePoint();
- }
-
- _exceptionSet = true;
-
- // actual marshaling of the reply msg header and exception takes place
- // after the DSI returns control to the ORB.
- }
-
-
- /** This is called from the ORB after the DynamicImplementation.invoke
- * returns. Here we set the result if result() has not already been called.
- * @return the exception if there is one (then ORB will not call
- * marshalReplyParams()) otherwise return null.
- */
- public Any checkResultCalled()
- {
- // Two things to be checked (CORBA 2.2 spec, section 6.3):
- // 1. Unless it calls set_exception(), the DIR must call arguments()
- // exactly once, even if the operation signature contains
- // no parameters.
- // 2. Unless set_exception() is called, if the invoked operation has a
- // non-void result type, set_result() must be called exactly once
- // before the DIR returns.
-
- if ( _paramsCalled && _resultSet ) // normal invocation return
- return null;
- else if ( _paramsCalled && !_resultSet && !_exceptionSet ) {
- try {
- // Neither a result nor an exception has been set.
- // Assume that the return type is void. If this is not so,
- // the client will throw a MARSHAL exception while
- // unmarshaling the return value.
- TypeCode result_tc = _orb.get_primitive_tc(
- org.omg.CORBA.TCKind.tk_void);
- _resultAny = _orb.create_any();
- _resultAny.type(result_tc);
- _resultSet = true;
-
- return null;
- } catch ( Exception ex ) {
- throw _wrapper.dsiResultException(
- CompletionStatus.COMPLETED_MAYBE, ex ) ;
- }
- } else if ( _exceptionSet )
- return _exception;
- else {
- throw _wrapper.dsimethodNotcalled(
- CompletionStatus.COMPLETED_MAYBE ) ;
- }
- }
-
- /** This is called from the ORB after the DynamicImplementation.invoke
- * returns. Here we marshal the return value and inout/out params.
- */
- public void marshalReplyParams(OutputStream os)
- {
- // marshal the operation return value
- _resultAny.write_value(os);
-
- // marshal the inouts/outs
- NamedValue arg = null;
-
- for (int i=0; i < _arguments.count() ; i++) {
- try {
- arg = _arguments.item(i);
- } catch (Bounds e) {}
-
- if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
- (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
- arg.value().write_value(os);
- }
- }
- }
-
- public Context ctx()
- {
- if ( !_paramsCalled || _resultSet || _exceptionSet )
- throw _wrapper.contextCalledOutOfOrder() ;
-
- throw _wrapper.contextNotImplemented() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TCUtility.java 2018-01-30 20:16:29.000000000 -0500
+++ /dev/null 2018-01-30 20:16:29.000000000 -0500
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.corba;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-import org.omg.CORBA.portable.Streamable;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-/**
- * Static functions for TypeCode interpretation.
- */
-public final class TCUtility {
-
- static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, long l, Object o) {
- switch (typeCode.kind().value()) {
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_native:
- // nothing to write
- break;
-
- case TCKind._tk_short:
- s.write_short((short)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_ushort:
- s.write_ushort((short)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_enum:
- case TCKind._tk_long:
- s.write_long((int)(l & 0xFFFFFFFFL));
- break;
-
- case TCKind._tk_ulong:
- s.write_ulong((int)(l & 0xFFFFFFFFL));
- break;
-
- case TCKind._tk_float:
- s.write_float(Float.intBitsToFloat((int)(l & 0xFFFFFFFFL)));
- break;
-
- case TCKind._tk_double:
- s.write_double(Double.longBitsToDouble(l));
- break;
-
- case TCKind._tk_boolean:
- if ( l == 0 )
- s.write_boolean(false);
- else
- s.write_boolean(true);
- break;
-
- case TCKind._tk_char:
- s.write_char((char)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_octet:
- s.write_octet((byte)(l & 0xFFL));
- break;
-
- case TCKind._tk_any:
- s.write_any((Any)o);
- break;
-
- case TCKind._tk_TypeCode:
- s.write_TypeCode((TypeCode)o);
- break;
-
- case TCKind._tk_Principal:
- s.write_Principal((Principal)o);
- break;
-
- case TCKind._tk_objref:
- s.write_Object((org.omg.CORBA.Object)o);
- break;
-
- case TCKind._tk_longlong:
- s.write_longlong(l);
- break;
-
- case TCKind._tk_ulonglong:
- s.write_ulonglong(l);
- break;
-
- case TCKind._tk_wchar:
- s.write_wchar((char)(l & 0xFFFFL));
- break;
-
- case TCKind._tk_string:
- s.write_string((String)o);
- break;
-
- case TCKind._tk_wstring:
- s.write_wstring((String)o);
- break;
-
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- ((org.omg.CORBA_2_3.portable.OutputStream)s).write_value((Serializable)o);
- break;
-
- case TCKind._tk_fixed:
- // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to
- // OutputStream, this check will be unnecessary
- if (s instanceof CDROutputStream) {
- try {
- ((CDROutputStream)s).write_fixed((BigDecimal)o,
- typeCode.fixed_digits(),
- typeCode.fixed_scale());
- } catch (BadKind badKind) { // impossible
- }
- } else {
- s.write_fixed((BigDecimal)o);
- }
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_except:
- ((Streamable)o)._write(s);
- break;
-
- case TCKind._tk_abstract_interface:
- ((org.omg.CORBA_2_3.portable.OutputStream)s).write_abstract_interface(o);
- break;
-
- case TCKind._tk_longdouble:
- // Unspecified for Java
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)s.orb(),
- CORBALogDomains.RPC_PRESENTATION ) ;
- throw wrapper.typecodeNotSupported() ;
- }
- }
-
- static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, long[] la, Object[] oa)
- {
- int type = typeCode.kind().value();
- long l=0;
- Object o=oa[0];
-
- switch (type) {
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_native:
- // Nothing to read
- break;
-
- case TCKind._tk_short:
- l = s.read_short() & 0xFFFFL;
- break;
-
- case TCKind._tk_ushort:
- l = s.read_ushort() & 0xFFFFL;
- break;
-
- case TCKind._tk_enum:
- case TCKind._tk_long:
- l = s.read_long() & 0xFFFFFFFFL;
- break;
-
- case TCKind._tk_ulong:
- l = s.read_ulong() & 0xFFFFFFFFL;
- break;
-
- case TCKind._tk_float:
- l = Float.floatToIntBits(s.read_float()) & 0xFFFFFFFFL;
- break;
-
- case TCKind._tk_double:
- l = Double.doubleToLongBits(s.read_double());
- break;
-
- case TCKind._tk_char:
- l = s.read_char() & 0xFFFFL;
- break;
-
- case TCKind._tk_octet:
- l = s.read_octet() & 0xFFL;
- break;
-
- case TCKind._tk_boolean:
- if ( s.read_boolean() )
- l = 1;
- else
- l = 0;
- break;
-
- case TCKind._tk_any:
- o = s.read_any();
- break;
-
- case TCKind._tk_TypeCode:
- o = s.read_TypeCode();
- break;
-
- case TCKind._tk_Principal:
- o = s.read_Principal();
- break;
-
- case TCKind._tk_objref:
- if (o instanceof Streamable)
- ((Streamable)o)._read(s);
- else
- o = s.read_Object();
- break;
-
- case TCKind._tk_longlong:
- l = s.read_longlong();
- break;
-
- case TCKind._tk_ulonglong:
- l = s.read_ulonglong();
- break;
-
- case TCKind._tk_wchar:
- l = s.read_wchar() & 0xFFFFL;
- break;
-
- case TCKind._tk_string:
- o = s.read_string();
- break;
-
- case TCKind._tk_wstring:
- o = s.read_wstring();
- break;
-
- case TCKind._tk_value:
- case TCKind._tk_value_box:
- o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_value ();
- break;
-
- case TCKind._tk_fixed:
- try {
- // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to
- // InputStream, this check will be unnecessary
- if (s instanceof CDRInputStream) {
- o = ((CDRInputStream)s).read_fixed(typeCode.fixed_digits(),
- typeCode.fixed_scale());
- } else {
- BigDecimal bigDecimal = s.read_fixed();
- o = bigDecimal.movePointLeft((int)typeCode.fixed_scale());
- }
- } catch (BadKind badKind) { // impossible
- }
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_union:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_except:
- ((Streamable)o)._read(s);
- break;
-
- case TCKind._tk_abstract_interface:
- o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_abstract_interface();
- break;
-
- case TCKind._tk_longdouble:
- // Unspecified for Java
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)s.orb(),
- CORBALogDomains.RPC_PRESENTATION ) ;
- throw wrapper.typecodeNotSupported() ;
- }
-
- oa[0] = o;
- la[0] = l;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java 2018-01-30 20:16:30.000000000 -0500
+++ /dev/null 2018-01-30 20:16:30.000000000 -0500
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.corba;
-
-public interface TypeCodeFactory {
- void setTypeCode(String id, TypeCodeImpl code);
-
- TypeCodeImpl getTypeCode(String id);
-
- void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) ;
-
- TypeCodeImpl getTypeCodeForClass( Class c ) ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java 2018-01-30 20:16:30.000000000 -0500
+++ /dev/null 2018-01-30 20:16:30.000000000 -0500
@@ -1,2413 +0,0 @@
-/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.corba;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.TypeCodeInputStream;
-import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
-import com.sun.corba.se.impl.encoding.TypeCodeReader;
-import com.sun.corba.se.impl.encoding.WrapperInputStream;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-// no chance of subclasses, so no problems with runtime helper lookup
-public final class TypeCodeImpl extends TypeCode
-{
- //static final boolean debug = false;
-
- // the indirection TCKind, needed for recursive typecodes.
- protected static final int tk_indirect = 0xFFFFFFFF;
-
- // typecode encodings have three different categories that determine
- // how the encoding should be done.
-
- private static final int EMPTY = 0; // no parameters
- private static final int SIMPLE = 1; // simple parameters.
- private static final int COMPLEX = 2; // complex parameters. need to
- // use CDR encapsulation for
- // parameters
-
- // a table storing the encoding category for the various typecodes.
-
- private static final int typeTable[] = {
- EMPTY, // tk_null
- EMPTY, // tk_void
- EMPTY, // tk_short
- EMPTY, // tk_long
- EMPTY, // tk_ushort
- EMPTY, // tk_ulong
- EMPTY, // tk_float
- EMPTY, // tk_double
- EMPTY, // tk_boolean
- EMPTY, // tk_char
- EMPTY, // tk_octet
- EMPTY, // tk_any
- EMPTY, // tk_typecode
- EMPTY, // tk_principal
- COMPLEX, // tk_objref
- COMPLEX, // tk_struct
- COMPLEX, // tk_union
- COMPLEX, // tk_enum
- SIMPLE, // tk_string
- COMPLEX, // tk_sequence
- COMPLEX, // tk_array
- COMPLEX, // tk_alias
- COMPLEX, // tk_except
- EMPTY, // tk_longlong
- EMPTY, // tk_ulonglong
- EMPTY, // tk_longdouble
- EMPTY, // tk_wchar
- SIMPLE, // tk_wstring
- SIMPLE, // tk_fixed
- COMPLEX, // tk_value
- COMPLEX, // tk_value_box
- COMPLEX, // tk_native
- COMPLEX // tk_abstract_interface
- };
-
- // Maps TCKind values to names
- // This is also used in AnyImpl.
- static final String[] kindNames = {
- "null",
- "void",
- "short",
- "long",
- "ushort",
- "ulong",
- "float",
- "double",
- "boolean",
- "char",
- "octet",
- "any",
- "typecode",
- "principal",
- "objref",
- "struct",
- "union",
- "enum",
- "string",
- "sequence",
- "array",
- "alias",
- "exception",
- "longlong",
- "ulonglong",
- "longdouble",
- "wchar",
- "wstring",
- "fixed",
- "value",
- "valueBox",
- "native",
- "abstractInterface"
- };
-
- private int _kind = 0; // the typecode kind
-
- // data members for representing the various kinds of typecodes.
- private String _id = ""; // the typecode repository id
- private String _name = ""; // the typecode name
- private int _memberCount = 0; // member count
- private String _memberNames[] = null; // names of members
- private TypeCodeImpl _memberTypes[] = null; // types of members
- private AnyImpl _unionLabels[] = null; // values of union labels
- private TypeCodeImpl _discriminator = null; // union discriminator type
- private int _defaultIndex = -1; // union default index
- private int _length = 0; // string/seq/array length
- private TypeCodeImpl _contentType = null; // seq/array/alias type
- // fixed
- private short _digits = 0;
- private short _scale = 0;
- // value type
- // _REVISIT_ We might want to keep references to the ValueMember classes
- // passed in at initialization instead of copying the relevant data.
- // Is the data immutable? What about StructMember, UnionMember etc.?
- private short _type_modifier = -1; // VM_NONE, VM_CUSTOM,
- // VM_ABSTRACT, VM_TRUNCATABLE
- private TypeCodeImpl _concrete_base = null; // concrete base type
- private short _memberAccess[] = null; // visibility of ValueMember
- // recursive sequence support
- private TypeCodeImpl _parent = null; // the enclosing type code
- private int _parentOffset = 0; // the level of enclosure
- // recursive type code support
- private TypeCodeImpl _indirectType = null;
-
- // caches the byte buffer written in write_value for quick remarshaling...
- private byte[] outBuffer = null;
- // ... but only if caching is enabled
- private boolean cachingEnabled = false;
-
- // the ORB instance: may be instanceof ORBSingleton or ORB
- private ORB _orb;
- private ORBUtilSystemException wrapper ;
-
- ///////////////////////////////////////////////////////////////////////////
- // Constructors...
-
- public TypeCodeImpl(ORB orb)
- {
- // initialized to tk_null
- _orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PRESENTATION ) ;
- }
-
- public TypeCodeImpl(ORB orb, TypeCode tc)
- // to handle conversion of "remote" typecodes into "native" style.
- // also see the 'convertToNative(ORB orb, TypeCode tc)' function
- {
- this(orb) ;
-
- // This is a protection against misuse of this constructor.
- // Should only be used if tc is not an instance of this class!
- // Otherwise we run into problems with recursive/indirect type codes.
- // _REVISIT_ We should make this constructor private
- if (tc instanceof TypeCodeImpl) {
- TypeCodeImpl tci = (TypeCodeImpl)tc;
- if (tci._kind == tk_indirect)
- throw wrapper.badRemoteTypecode() ;
- if (tci._kind == TCKind._tk_sequence && tci._contentType == null)
- throw wrapper.badRemoteTypecode() ;
- }
-
- // set up kind
- _kind = tc.kind().value();
-
- try {
- // set up parameters
- switch (_kind) {
- case TCKind._tk_value:
- _type_modifier = tc.type_modifier();
- // concrete base may be null
- TypeCode tccb = tc.concrete_base_type();
- if (tccb != null) {
- _concrete_base = convertToNative(_orb, tccb);
- } else {
- _concrete_base = null;
- }
- //_memberAccess = tc._memberAccess;
- // Need to reconstruct _memberAccess using member_count() and member_visibility()
- _memberAccess = new short[tc.member_count()];
- for (int i=0; i < tc.member_count(); i++) {
- _memberAccess[i] = tc.member_visibility(i);
- }
- case TCKind._tk_except:
- case TCKind._tk_struct:
- case TCKind._tk_union:
- // set up member types
- _memberTypes = new TypeCodeImpl[tc.member_count()];
- for (int i=0; i < tc.member_count(); i++) {
- _memberTypes[i] = convertToNative(_orb, tc.member_type(i));
- _memberTypes[i].setParent(this);
- }
- case TCKind._tk_enum:
- // set up member names
- _memberNames = new String[tc.member_count()];
- for (int i=0; i < tc.member_count(); i++) {
- _memberNames[i] = tc.member_name(i);
- }
- // set up member count
- _memberCount = tc.member_count();
- case TCKind._tk_objref:
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- setId(tc.id());
- _name = tc.name();
- break;
- }
-
- // set up stuff for unions
- switch (_kind) {
- case TCKind._tk_union:
- _discriminator = convertToNative(_orb, tc.discriminator_type());
- _defaultIndex = tc.default_index();
- _unionLabels = new AnyImpl[_memberCount];
- for (int i=0; i < _memberCount; i++)
- _unionLabels[i] = new AnyImpl(_orb, tc.member_label(i));
- break;
- }
-
- // set up length
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- _length = tc.length();
- }
-
- // set up content type
- switch (_kind) {
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- _contentType = convertToNative(_orb, tc.content_type());
- }
- } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {}
- // dont have to worry about these since code ensures we dont step
- // out of bounds.
- }
-
- public TypeCodeImpl(ORB orb, int creationKind)
- // for primitive types
- {
- this(orb);
-
- // private API. dont bother checking that
- // (creationKind < 0 || creationKind > typeTable.length)
-
- _kind = creationKind;
-
- // do initialization for special cases
- switch (_kind) {
- case TCKind._tk_objref:
- {
- // this is being used to create typecode for CORBA::Object
- setId("IDL:omg.org/CORBA/Object:1.0");
- _name = "Object";
- break;
- }
-
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- {
- _length =0;
- break;
- }
-
- case TCKind._tk_value:
- {
- _concrete_base = null;
- break;
- }
- }
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- StructMember[] members)
- // for structs and exceptions
- {
- this(orb);
-
- if ((creationKind == TCKind._tk_struct) || (creationKind == TCKind._tk_except)) {
- _kind = creationKind;
- setId(id);
- _name = name;
- _memberCount = members.length;
-
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++) {
- _memberNames[i] = members[i].name;
- _memberTypes[i] = convertToNative(_orb, members[i].type);
- _memberTypes[i].setParent(this);
- }
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- TypeCode discriminator_type,
- UnionMember[] members)
- // for unions
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_union) {
- _kind = creationKind;
- setId(id);
- _name = name;
- _memberCount = members.length;
- _discriminator = convertToNative(_orb, discriminator_type);
-
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
- _unionLabels = new AnyImpl[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++) {
- _memberNames[i] = members[i].name;
- _memberTypes[i] = convertToNative(_orb, members[i].type);
- _memberTypes[i].setParent(this);
- _unionLabels[i] = new AnyImpl(_orb, members[i].label);
- // check whether this is the default branch.
- if (_unionLabels[i].type().kind() == TCKind.tk_octet) {
- if (_unionLabels[i].extract_octet() == (byte)0) {
- _defaultIndex = i;
- }
- }
- }
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- short type_modifier,
- TypeCode concrete_base,
- ValueMember[] members)
- // for value types
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_value) {
- _kind = creationKind;
- setId(id);
- _name = name;
- _type_modifier = type_modifier;
- if (concrete_base != null) {
- _concrete_base = convertToNative(_orb, concrete_base);
- }
- _memberCount = members.length;
-
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
- _memberAccess = new short[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++) {
- _memberNames[i] = members[i].name;
- _memberTypes[i] = convertToNative(_orb, members[i].type);
- _memberTypes[i].setParent(this);
- _memberAccess[i] = members[i].access;
- }
- } // else initializes to null
- }
-
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- String[] members)
- // for enums
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_enum)
- {
- _kind = creationKind;
- setId(id);
- _name = name;
- _memberCount = members.length;
-
- _memberNames = new String[_memberCount];
-
- for (int i = 0 ; i < _memberCount ; i++)
- _memberNames[i] = members[i];
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name,
- TypeCode original_type)
- // for aliases and value boxes
- {
- this(orb) ;
-
- if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box )
- {
- _kind = creationKind;
- setId(id);
- _name = name;
- _contentType = convertToNative(_orb, original_type);
- }
- // else initializes to null
-
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- String id,
- String name)
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_objref ||
- creationKind == TCKind._tk_native ||
- creationKind == TCKind._tk_abstract_interface)
- {
- _kind = creationKind;
- setId(id);
- _name = name;
- } // else initializes to null
- }
-
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- int bound)
- // for strings
- {
- this(orb) ;
-
- if (bound < 0)
- throw wrapper.negativeBounds() ;
-
- if ((creationKind == TCKind._tk_string) || (creationKind == TCKind._tk_wstring)) {
- _kind = creationKind;
- _length = bound;
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- int bound,
- TypeCode element_type)
- // for sequences and arrays
- {
- this(orb) ;
-
- if ( creationKind == TCKind._tk_sequence || creationKind == TCKind._tk_array ) {
- _kind = creationKind;
- _length = bound;
- _contentType = convertToNative(_orb, element_type);
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- int bound,
- int offset)
- // for recursive sequences
- {
- this(orb) ;
-
- if (creationKind == TCKind._tk_sequence) {
- _kind = creationKind;
- _length = bound;
- _parentOffset = offset;
- } // else initializes to null
- }
-
- public TypeCodeImpl(ORB orb,
- String id)
- // for recursive type codes
- {
- this(orb) ;
-
- _kind = tk_indirect;
- // This is the type code of the type we stand in for, not our own.
- _id = id;
- // Try to resolve it now. May return null in which case
- // we try again later (see indirectType()).
- tryIndirectType();
- }
-
- public TypeCodeImpl(ORB orb,
- int creationKind,
- short digits,
- short scale)
- // for fixed
- {
- this(orb) ;
-
- //if (digits < 1 || digits > 31)
- //throw new BAD_TYPECODE();
-
- if (creationKind == TCKind._tk_fixed) {
- _kind = creationKind;
- _digits = digits;
- _scale = scale;
- } // else initializes to null
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Other creation functions...
-
- // Optimization:
- // If we checked for and returned constant primitive typecodes
- // here we could reduce object creation and also enable more
- // efficient typecode comparisons for primitive typecodes.
- //
- protected static TypeCodeImpl convertToNative(ORB orb,
- TypeCode tc)
- {
- if (tc instanceof TypeCodeImpl)
- return (TypeCodeImpl) tc;
- else
- return new TypeCodeImpl(orb, tc);
- }
-
- public static CDROutputStream newOutputStream(ORB orb) {
- TypeCodeOutputStream tcos =
- sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb);
- //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos +
- // " with no parent");
- return tcos;
- }
-
- // Support for indirect/recursive type codes
-
- private TypeCodeImpl indirectType() {
- _indirectType = tryIndirectType();
- if (_indirectType == null) {
- // Nothing we can do about that.
- throw wrapper.unresolvedRecursiveTypecode() ;
- }
- return _indirectType;
- }
-
- private TypeCodeImpl tryIndirectType() {
- // Assert that _kind == tk_indirect
- if (_indirectType != null)
- return _indirectType;
-
- setIndirectType(_orb.getTypeCode(_id));
-
- return _indirectType;
- }
-
- private void setIndirectType(TypeCodeImpl newType) {
- _indirectType = newType;
- if (_indirectType != null) {
- try {
- _id = _indirectType.id();
- } catch (BadKind e) {
- // can't happen
- throw wrapper.badkindCannotOccur() ;
- }
- }
- }
-
- private void setId(String newID) {
- _id = newID;
- if (_orb instanceof TypeCodeFactory) {
- ((TypeCodeFactory)_orb).setTypeCode(_id, this);
- }
- // check whether return value != this which would indicate that the
- // repository id isn't unique.
- }
-
- private void setParent(TypeCodeImpl parent) {
- _parent = parent;
- }
-
- private TypeCodeImpl getParentAtLevel(int level) {
- if (level == 0)
- return this;
-
- if (_parent == null)
- throw wrapper.unresolvedRecursiveTypecode() ;
-
- return _parent.getParentAtLevel(level - 1);
- }
-
- private TypeCodeImpl lazy_content_type() {
- if (_contentType == null) {
- if (_kind == TCKind._tk_sequence && _parentOffset > 0 && _parent != null) {
- // This is an unresolved recursive sequence tc.
- // Try to resolve it now if the hierarchy is complete.
- TypeCodeImpl realParent = getParentAtLevel(_parentOffset);
- if (realParent != null && realParent._id != null) {
- // Create a recursive type code object as the content type.
- // This is when the recursive sequence typecode morphes
- // into a sequence typecode containing a recursive typecode.
- _contentType = new TypeCodeImpl((ORB)_orb, realParent._id);
- }
- }
- }
- return _contentType;
- }
-
- // Other private functions
-
- private TypeCode realType(TypeCode aType) {
- TypeCode realType = aType;
- try {
- // Note: Indirect types are handled in kind() method
- while (realType.kind().value() == TCKind._tk_alias) {
- realType = realType.content_type();
- }
- } catch (BadKind bad) {
- // impossible
- throw wrapper.badkindCannotOccur() ;
- }
- return realType;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // TypeCode operations
-
- public final boolean equal(TypeCode tc)
- // _REVISIT_ for all optional names/ids, we might want to check that
- // they are equal in case both are non-nil.
- {
- if (tc == this)
- return true;
-
- try {
-
- if (_kind == tk_indirect) {
- //return indirectType().equal(tc);
- if (_id != null && tc.id() != null)
- return _id.equals(tc.id());
- return (_id == null && tc.id() == null);
- }
-
- // make sure kinds are identical.
- if (_kind != tc.kind().value()) {
- return false;
- }
-
- switch (typeTable[_kind]) {
- case EMPTY:
- // no parameters to check.
- return true;
-
- case SIMPLE:
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- // check for bound.
- return (_length == tc.length());
-
- case TCKind._tk_fixed:
- return (_digits == tc.fixed_digits() && _scale == tc.fixed_scale());
- default:
- return false;
- }
-
- case COMPLEX:
-
- switch(_kind) {
-
- case TCKind._tk_objref:
- {
- // check for logical id.
- if (_id.compareTo(tc.id()) == 0) {
- return true;
- }
-
- if (_id.compareTo(
- (_orb.get_primitive_tc(_kind)).id()) == 0)
- {
- return true;
- }
-
- if (tc.id().compareTo(
- (_orb.get_primitive_tc(_kind)).id()) == 0)
- {
- return true;
- }
-
- return false;
- }
-
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- {
- // check for logical id.
- if (_id.compareTo(tc.id()) != 0) {
- return false;
-
- }
- // ignore name since its optional.
- return true;
- }
-
- case TCKind._tk_struct:
- case TCKind._tk_except:
- {
- // check for member count
- if (_memberCount != tc.member_count())
- return false;
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check for member types.
- for (int i = 0 ; i < _memberCount ; i++)
- if (! _memberTypes[i].equal(tc.member_type(i)))
- return false;
- // ignore id and names since those are optional.
- return true;
- }
-
- case TCKind._tk_union:
- {
- // check for member count
- if (_memberCount != tc.member_count())
- return false;
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check for default index
- if (_defaultIndex != tc.default_index())
- return false;
- // check for discriminator type
- if (!_discriminator.equal(tc.discriminator_type()))
- return false;
- // check for label types and values
- for (int i = 0 ; i < _memberCount ; i++)
- if (! _unionLabels[i].equal(tc.member_label(i)))
- return false;
- // check for branch types
- for (int i = 0 ; i < _memberCount ; i++)
- if (! _memberTypes[i].equal(tc.member_type(i)))
- return false;
- // ignore id and names since those are optional.
- return true;
- }
-
- case TCKind._tk_enum:
- {
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check member count
- if (_memberCount != tc.member_count())
- return false;
- // ignore names since those are optional.
- return true;
- }
-
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- {
- // check bound/length
- if (_length != tc.length()) {
- return false;
- }
- // check content type
- if (! lazy_content_type().equal(tc.content_type())) {
- return false;
- }
- // ignore id and name since those are optional.
- return true;
- }
-
- case TCKind._tk_value:
- {
- // check for member count
- if (_memberCount != tc.member_count())
- return false;
- // check for repository id
- if (_id.compareTo(tc.id()) != 0)
- return false;
- // check for member types.
- for (int i = 0 ; i < _memberCount ; i++)
- if (_memberAccess[i] != tc.member_visibility(i) ||
- ! _memberTypes[i].equal(tc.member_type(i)))
- return false;
- if (_type_modifier == tc.type_modifier())
- return false;
- // concrete_base may be null
- TypeCode tccb = tc.concrete_base_type();
- if ((_concrete_base == null && tccb != null) ||
- (_concrete_base != null && tccb == null) ||
- ! _concrete_base.equal(tccb))
- {
- return false;
- }
- // ignore id and names since those are optional.
- return true;
- }
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- {
- // check for repository id
- if (_id.compareTo(tc.id()) != 0) {
- return false;
- }
- // check for equality with the true type
- return _contentType.equal(tc.content_type());
- }
- }
- }
- } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {}
- // dont have to worry about these since the code ensures these dont
- // arise.
- return false;
- }
-
- /**
- * The equivalent operation is used by the ORB when determining type equivalence
- * for values stored in an IDL any.
- */
- public boolean equivalent(TypeCode tc) {
- if (tc == this) {
- return true;
- }
-
- // If the result of the kind operation on either TypeCode is tk_alias, recursively
- // replace the TypeCode with the result of calling content_type, until the kind
- // is no longer tk_alias.
- // Note: Always resolve indirect types first!
- TypeCode myRealType = (_kind == tk_indirect ? indirectType() : this);
- myRealType = realType(myRealType);
- TypeCode otherRealType = realType(tc);
-
- // If results of the kind operation on each typecode differ,
- // equivalent returns false.
- if (myRealType.kind().value() != otherRealType.kind().value()) {
- return false;
- }
-
- String myID = null;
- String otherID = null;
- try {
- myID = this.id();
- otherID = tc.id();
- // At this point the id operation is valid for both TypeCodes.
-
- // Return true if the results of id for both TypeCodes are non-empty strings
- // and both strings are equal.
- // If both ids are non-empty but are not equal, then equivalent returns FALSE.
- if (myID != null && otherID != null) {
- return (myID.equals(otherID));
- }
- } catch (BadKind e) {
- // id operation is not valid for either or both TypeCodes
- }
-
- // If either or both id is an empty string, or the TypeCode kind does not support
- // the id operation, perform a structural comparison of the TypeCodes.
-
- int myKind = myRealType.kind().value();
- try {
- if (myKind == TCKind._tk_struct ||
- myKind == TCKind._tk_union ||
- myKind == TCKind._tk_enum ||
- myKind == TCKind._tk_except ||
- myKind == TCKind._tk_value)
- {
- if (myRealType.member_count() != otherRealType.member_count())
- return false;
- }
- if (myKind == TCKind._tk_union)
- {
- if (myRealType.default_index() != otherRealType.default_index())
- return false;
- }
- if (myKind == TCKind._tk_string ||
- myKind == TCKind._tk_wstring ||
- myKind == TCKind._tk_sequence ||
- myKind == TCKind._tk_array)
- {
- if (myRealType.length() != otherRealType.length())
- return false;
- }
- if (myKind == TCKind._tk_fixed)
- {
- if (myRealType.fixed_digits() != otherRealType.fixed_digits() ||
- myRealType.fixed_scale() != otherRealType.fixed_scale())
- return false;
- }
- if (myKind == TCKind._tk_union)
- {
- for (int i=0; i typeTable.length) && _kind != tk_indirect) {
- throw wrapper.cannotMarshalBadTckind() ;
- }
-
- // Don't do any work if this is native
- if (_kind == TCKind._tk_native)
- throw wrapper.cannotMarshalNative() ;
-
- // We have to remember the stream and position for EVERY type code
- // in case some recursive or indirect type code references it.
- TypeCodeReader topStream = tcis.getTopLevelStream();
-
- if (_kind == tk_indirect) {
- int streamOffset = tcis.read_long();
- if (streamOffset > -4)
- throw wrapper.invalidIndirection( new Integer(streamOffset) ) ;
-
- // The encoding used for indirection is the same as that used for recursive ,
- // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
- // (in units of octets) from the beginning of the long offset.
- int topPos = tcis.getTopLevelPosition();
- // substract 4 to get back to the beginning of the long offset.
- int indirectTypePosition = topPos - 4 + streamOffset;
-
- // Now we have to find the referenced type
- // by its indirectTypePosition within topStream.
- //if (debug) System.out.println(
- // "TypeCodeImpl looking up indirection at position topPos " +
- //topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition);
- TypeCodeImpl type = topStream.getTypeCodeAtPosition(indirectTypePosition);
- if (type == null)
- throw wrapper.indirectionNotFound( new Integer(indirectTypePosition) ) ;
- setIndirectType(type);
- return false;
- }
-
- topStream.addTypeCodeAtPosition(this, myPosition);
- return true;
- }
-
- void read_value_kind(InputStream is) {
- // unmarshal the kind
- _kind = is.read_long();
-
- // check validity of kind
- if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
- throw wrapper.cannotMarshalBadTckind() ;
- }
- // Don't do any work if this is native
- if (_kind == TCKind._tk_native)
- throw wrapper.cannotMarshalNative() ;
-
- if (_kind == tk_indirect) {
- throw wrapper.recursiveTypecodeError() ;
- }
- }
-
- void read_value_body(InputStream is) {
- // start unmarshaling the rest of the typecode, based on the
- // encoding (empty, simple or complex).
-
- switch (typeTable[_kind]) {
- case EMPTY:
- // nothing to unmarshal
- break;
-
- case SIMPLE:
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- _length = is.read_long();
- break;
- case TCKind._tk_fixed:
- _digits = is.read_ushort();
- _scale = is.read_short();
- break;
- default:
- throw wrapper.invalidSimpleTypecode() ;
- }
- break;
-
- case COMPLEX:
- {
- TypeCodeInputStream _encap = TypeCodeInputStream.readEncapsulation(is,
- is.orb());
-
- switch(_kind) {
-
- case TCKind._tk_objref:
- case TCKind._tk_abstract_interface:
- {
- // get the repository id
- setId(_encap.read_string());
- // get the name
- _name = _encap.read_string();
- }
- break;
-
- case TCKind._tk_union:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // discriminant typecode
- _discriminator = new TypeCodeImpl((ORB)is.orb());
- _discriminator.read_value_recursive(_encap);
-
- // default index
- _defaultIndex = _encap.read_long();
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the label values, names and types of members
- _unionLabels = new AnyImpl[_memberCount];
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
-
- // read off label values, names and types
- for (int i=0; i < _memberCount; i++) {
- _unionLabels[i] = new AnyImpl((ORB)is.orb());
- if (i == _defaultIndex)
- // for the default case, read off the zero octet
- _unionLabels[i].insert_octet(_encap.read_octet());
- else {
- switch (realType(_discriminator).kind().value()) {
- case TCKind._tk_short:
- _unionLabels[i].insert_short(_encap.read_short());
- break;
- case TCKind._tk_long:
- _unionLabels[i].insert_long(_encap.read_long());
- break;
- case TCKind._tk_ushort:
- _unionLabels[i].insert_ushort(_encap.read_short());
- break;
- case TCKind._tk_ulong:
- _unionLabels[i].insert_ulong(_encap.read_long());
- break;
- case TCKind._tk_float:
- _unionLabels[i].insert_float(_encap.read_float());
- break;
- case TCKind._tk_double:
- _unionLabels[i].insert_double(_encap.read_double());
- break;
- case TCKind._tk_boolean:
- _unionLabels[i].insert_boolean(_encap.read_boolean());
- break;
- case TCKind._tk_char:
- _unionLabels[i].insert_char(_encap.read_char());
- break;
- case TCKind._tk_enum:
- _unionLabels[i].type(_discriminator);
- _unionLabels[i].insert_long(_encap.read_long());
- break;
- case TCKind._tk_longlong:
- _unionLabels[i].insert_longlong(_encap.read_longlong());
- break;
- case TCKind._tk_ulonglong:
- _unionLabels[i].insert_ulonglong(_encap.read_longlong());
- break;
- // _REVISIT_ figure out long double mapping
- // case TCKind.tk_longdouble:
- // _unionLabels[i].insert_longdouble(_encap.getDouble());
- // break;
- case TCKind._tk_wchar:
- _unionLabels[i].insert_wchar(_encap.read_wchar());
- break;
- default:
- throw wrapper.invalidComplexTypecode() ;
- }
- }
- _memberNames[i] = _encap.read_string();
- _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
- _memberTypes[i].read_value_recursive(_encap);
- _memberTypes[i].setParent(this);
- }
- }
- break;
-
- case TCKind._tk_enum:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the identifier names
- _memberNames = new String[_memberCount];
-
- // read off identifier names
- for (int i=0; i < _memberCount; i++)
- _memberNames[i] = _encap.read_string();
- }
- break;
-
- case TCKind._tk_sequence:
- {
- // get the type of the sequence
- _contentType = new TypeCodeImpl((ORB)is.orb());
- _contentType.read_value_recursive(_encap);
-
- // get the bound on the length of the sequence
- _length = _encap.read_long();
- }
- break;
-
- case TCKind._tk_array:
- {
- // get the type of the array
- _contentType = new TypeCodeImpl((ORB)is.orb());
- _contentType.read_value_recursive(_encap);
-
- // get the length of the array
- _length = _encap.read_long();
- }
- break;
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the type aliased
- _contentType = new TypeCodeImpl((ORB)is.orb());
- _contentType.read_value_recursive(_encap);
- }
- break;
-
- case TCKind._tk_except:
- case TCKind._tk_struct:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the names and types of members
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
-
- // read off member names and types
- for (int i=0; i < _memberCount; i++) {
- _memberNames[i] = _encap.read_string();
- _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
- //if (debug) System.out.println("TypeCode " + _name +
- // " reading member " + _memberNames[i]);
- _memberTypes[i].read_value_recursive(_encap);
- _memberTypes[i].setParent(this);
- }
- }
- break;
-
- case TCKind._tk_value:
- {
- // get the repository id
- setId(_encap.read_string());
-
- // get the name
- _name = _encap.read_string();
-
- // get the type modifier
- _type_modifier = _encap.read_short();
-
- // get the type aliased
- _concrete_base = new TypeCodeImpl((ORB)is.orb());
- _concrete_base.read_value_recursive(_encap);
- if (_concrete_base.kind().value() == TCKind._tk_null) {
- _concrete_base = null;
- }
-
- // get the number of members
- _memberCount = _encap.read_long();
-
- // create arrays for the names, types and visibility of members
- _memberNames = new String[_memberCount];
- _memberTypes = new TypeCodeImpl[_memberCount];
- _memberAccess = new short[_memberCount];
-
- // read off value member visibilities
- for (int i=0; i < _memberCount; i++) {
- _memberNames[i] = _encap.read_string();
- _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
- //if (debug) System.out.println("TypeCode " + _name +
- // " reading member " + _memberNames[i]);
- _memberTypes[i].read_value_recursive(_encap);
- _memberTypes[i].setParent(this);
- _memberAccess[i] = _encap.read_short();
- }
- }
- break;
-
- default:
- throw wrapper.invalidTypecodeKindMarshal() ;
- }
- break;
- }
- }
- }
-
- public void write_value(OutputStream os) {
- // Wrap OutputStream into TypeCodeOutputStream.
- // This test shouldn't be necessary according to the Java language spec.
- if (os instanceof TypeCodeOutputStream) {
- this.write_value((TypeCodeOutputStream)os);
- } else {
- TypeCodeOutputStream wrapperOutStream = null;
-
- if (outBuffer == null) {
- wrapperOutStream = TypeCodeOutputStream.wrapOutputStream(os);
- this.write_value(wrapperOutStream);
- if (cachingEnabled) {
- // Cache the buffer for repeated writes
- outBuffer = wrapperOutStream.getTypeCodeBuffer();
- //if (outBuffer != null)
- //System.out.println("Caching outBuffer with length = " +
- //outBuffer.length + " for id = " + _id);
- }
- } else {
- //System.out.println("Using cached outBuffer: length = " + outBuffer.length +
- //", id = " + _id);
- }
- // Write the first 4 bytes first to trigger alignment.
- // We know that it is the kind.
- if (cachingEnabled && outBuffer != null) {
- os.write_long(_kind);
- os.write_octet_array(outBuffer, 0, outBuffer.length);
- } else {
- //System.out.println("Buffer is empty for " + _id);
- wrapperOutStream.writeRawBuffer(os, _kind);
- }
- }
- }
-
- public void write_value(TypeCodeOutputStream tcos) {
-
- // Don't do any work if this is native
- if (_kind == TCKind._tk_native)
- throw wrapper.cannotMarshalNative() ;
-
- TypeCodeOutputStream topStream = tcos.getTopLevelStream();
- //if (debug) tcos.printBuffer();
-
- if (_kind == tk_indirect) {
- //if (debug) System.out.println("Writing indirection " + _name + "to " + _id);
- // The encoding used for indirection is the same as that used for recursive ,
- // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
- // (in units of octets) from the beginning of the long offset.
- int pos = topStream.getPositionForID(_id);
- int topPos = tcos.getTopLevelPosition();
- //if (debug) System.out.println("TypeCodeImpl " + tcos +
- // " writing indirection " + _id +
- //" to position " + pos + " at position " + topPos);
- tcos.writeIndirection(tk_indirect, pos);
- // All that gets written is _kind and offset.
- return;
- }
-
- // The original approach changed for 5034649
- // topStream.addIDAtPosition(_id, tcos.getTopLevelPosition());
-
- // marshal the kind
- tcos.write_long(_kind);
-
- //if (debug) System.out.println("Writing " + _name + " with id " + _id);
- // We have to remember the stream and position for EVERY type code
- // in case some recursive or indirect type code references it.
- //
- // Bug fix 5034649:
- // Do this AFTER the write of the _kind in case the alignment
- // for the long changes the position.
- topStream.addIDAtPosition(_id, tcos.getTopLevelPosition()-4);
-
- switch (typeTable[_kind]) {
- case EMPTY:
- // nothing more to marshal
- break;
-
- case SIMPLE:
- switch (_kind) {
- case TCKind._tk_string:
- case TCKind._tk_wstring:
- // marshal the bound on string length
- tcos.write_long(_length);
- break;
- case TCKind._tk_fixed:
- tcos.write_ushort(_digits);
- tcos.write_short(_scale);
- break;
- default:
- // unknown typecode kind
- throw wrapper.invalidSimpleTypecode() ;
- }
- break;
-
- case COMPLEX:
- {
- // create an encapsulation
- TypeCodeOutputStream _encap = tcos.createEncapsulation(tcos.orb());
-
- switch(_kind) {
-
- case TCKind._tk_objref:
- case TCKind._tk_abstract_interface:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
- }
- break;
-
- case TCKind._tk_union:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // discriminant typecode
- _discriminator.write_value(_encap);
-
- // default index
- _encap.write_long(_defaultIndex);
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal label values, names and types
- for (int i=0; i < _memberCount; i++) {
-
- // for the default case, marshal the zero octet
- if (i == _defaultIndex)
- _encap.write_octet(_unionLabels[i].extract_octet());
-
- else {
- switch (realType(_discriminator).kind().value()) {
- case TCKind._tk_short:
- _encap.write_short(_unionLabels[i].extract_short());
- break;
- case TCKind._tk_long:
- _encap.write_long(_unionLabels[i].extract_long());
- break;
- case TCKind._tk_ushort:
- _encap.write_short(_unionLabels[i].extract_ushort());
- break;
- case TCKind._tk_ulong:
- _encap.write_long(_unionLabels[i].extract_ulong());
- break;
- case TCKind._tk_float:
- _encap.write_float(_unionLabels[i].extract_float());
- break;
- case TCKind._tk_double:
- _encap.write_double(_unionLabels[i].extract_double());
- break;
- case TCKind._tk_boolean:
- _encap.write_boolean(_unionLabels[i].extract_boolean());
- break;
- case TCKind._tk_char:
- _encap.write_char(_unionLabels[i].extract_char());
- break;
- case TCKind._tk_enum:
- _encap.write_long(_unionLabels[i].extract_long());
- break;
- case TCKind._tk_longlong:
- _encap.write_longlong(_unionLabels[i].extract_longlong());
- break;
- case TCKind._tk_ulonglong:
- _encap.write_longlong(_unionLabels[i].extract_ulonglong());
- break;
- // _REVISIT_ figure out long double mapping
- // case TCKind.tk_longdouble:
- // _encap.putDouble(_unionLabels[i].extract_longdouble());
- // break;
- case TCKind._tk_wchar:
- _encap.write_wchar(_unionLabels[i].extract_wchar());
- break;
- default:
- throw wrapper.invalidComplexTypecode() ;
- }
- }
- _encap.write_string(_memberNames[i]);
- _memberTypes[i].write_value(_encap);
- }
- }
- break;
-
- case TCKind._tk_enum:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal identifier names
- for (int i=0; i < _memberCount; i++)
- _encap.write_string(_memberNames[i]);
- }
- break;
-
- case TCKind._tk_sequence:
- {
- // put the type of the sequence
- lazy_content_type().write_value(_encap);
-
- // put the bound on the length of the sequence
- _encap.write_long(_length);
- }
- break;
-
- case TCKind._tk_array:
- {
- // put the type of the array
- _contentType.write_value(_encap);
-
- // put the length of the array
- _encap.write_long(_length);
- }
- break;
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the type aliased
- _contentType.write_value(_encap);
- }
- break;
-
- case TCKind._tk_struct:
- case TCKind._tk_except:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal member names and types
- for (int i=0; i < _memberCount; i++) {
- _encap.write_string(_memberNames[i]);
- //if (debug) System.out.println("TypeCode " + _name +
- // " writing member " + _memberNames[i]);
- _memberTypes[i].write_value(_encap);
- }
- }
- break;
-
- case TCKind._tk_value:
- {
- // put the repository id
- _encap.write_string(_id);
-
- // put the name
- _encap.write_string(_name);
-
- // put the type modifier
- _encap.write_short(_type_modifier);
-
- // put the type aliased
- if (_concrete_base == null) {
- _orb.get_primitive_tc(TCKind._tk_null).write_value(_encap);
- } else {
- _concrete_base.write_value(_encap);
- }
-
- // put the number of members
- _encap.write_long(_memberCount);
-
- // marshal member names and types
- for (int i=0; i < _memberCount; i++) {
- _encap.write_string(_memberNames[i]);
- //if (debug) System.out.println("TypeCode " + _name +
- // " writing member " + _memberNames[i]);
- _memberTypes[i].write_value(_encap);
- _encap.write_short(_memberAccess[i]);
- }
- }
- break;
-
- default:
- throw wrapper.invalidTypecodeKindMarshal() ;
- }
-
- // marshal the encapsulation
- _encap.writeOctetSequenceTo(tcos);
- break;
- }
- }
- }
-
- /**
- * This is not a copy of the TypeCodeImpl objects, but instead it
- * copies the value this type code is representing.
- * See AnyImpl read_value and write_value for usage.
- * The state of this TypeCodeImpl instance isn't changed, only used
- * by the Any to do the correct copy.
- */
- protected void copy(org.omg.CORBA.portable.InputStream src,
- org.omg.CORBA.portable.OutputStream dst)
- {
- switch (_kind) {
-
- case TCKind._tk_null:
- case TCKind._tk_void:
- case TCKind._tk_native:
- case TCKind._tk_abstract_interface:
- break;
-
- case TCKind._tk_short:
- case TCKind._tk_ushort:
- dst.write_short(src.read_short());
- break;
-
- case TCKind._tk_long:
- case TCKind._tk_ulong:
- dst.write_long(src.read_long());
- break;
-
- case TCKind._tk_float:
- dst.write_float(src.read_float());
- break;
-
- case TCKind._tk_double:
- dst.write_double(src.read_double());
- break;
-
- case TCKind._tk_longlong:
- case TCKind._tk_ulonglong:
- dst.write_longlong(src.read_longlong());
- break;
-
- case TCKind._tk_longdouble:
- throw wrapper.tkLongDoubleNotSupported() ;
-
- case TCKind._tk_boolean:
- dst.write_boolean(src.read_boolean());
- break;
-
- case TCKind._tk_char:
- dst.write_char(src.read_char());
- break;
-
- case TCKind._tk_wchar:
- dst.write_wchar(src.read_wchar());
- break;
-
- case TCKind._tk_octet:
- dst.write_octet(src.read_octet());
- break;
-
- case TCKind._tk_string:
- {
- String s;
- s = src.read_string();
- // make sure length bound in typecode is not violated
- if ((_length != 0) && (s.length() > _length))
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(_length) ) ;
- dst.write_string(s);
- }
- break;
-
- case TCKind._tk_wstring:
- {
- String s;
- s = src.read_wstring();
- // make sure length bound in typecode is not violated
- if ((_length != 0) && (s.length() > _length))
- throw wrapper.badStringBounds( new Integer(s.length()),
- new Integer(_length) ) ;
- dst.write_wstring(s);
- }
- break;
-
- case TCKind._tk_fixed:
- {
- dst.write_ushort(src.read_ushort());
- dst.write_short(src.read_short());
- }
- break;
-
- case TCKind._tk_any:
- {
- //Any tmp = new AnyImpl(_orb);
- Any tmp = ((CDRInputStream)src).orb().create_any();
- TypeCodeImpl t = new TypeCodeImpl((ORB)dst.orb());
- t.read_value((org.omg.CORBA_2_3.portable.InputStream)src);
- t.write_value((org.omg.CORBA_2_3.portable.OutputStream)dst);
- tmp.read_value(src, t);
- tmp.write_value(dst);
- break;
- }
-
- case TCKind._tk_TypeCode:
- {
- dst.write_TypeCode(src.read_TypeCode());
- break;
- }
-
- case TCKind._tk_Principal:
- {
- dst.write_Principal(src.read_Principal());
- break;
- }
-
- case TCKind._tk_objref:
- {
- dst.write_Object(src.read_Object());
- break;
- }
-
- case TCKind._tk_except:
- // Copy repositoryId
- dst.write_string(src.read_string());
-
- // Fall into ...
- // _REVISIT_ what about the inherited members of this values concrete base type?
- case TCKind._tk_value:
- case TCKind._tk_struct:
- {
- // copy each element, using the corresponding member type
- for (int i=0; i < _memberTypes.length; i++) {
- _memberTypes[i].copy(src, dst);
- }
- break;
- }
- case TCKind._tk_union:
- /* _REVISIT_ More generic code?
- {
- Any discriminator = new AnyImpl(_orb);
- discriminator.read_value(src, _discriminator);
- discriminator.write_value(dst);
- int labelIndex = currentUnionMemberIndex(discriminator);
- if (labelIndex == -1) {
- // check if label has not been found
- if (_defaultIndex == -1)
- // throw exception if default was not expected
- throw new MARSHAL();
- else
- // must be of the default branch type
- _memberTypes[_defaultIndex].copy(src, dst);
- } else {
- _memberTypes[labelIndex].copy(src, dst);
- }
- }
- */
- {
- Any tagValue = new AnyImpl( (ORB)src.orb());
-
- switch (realType(_discriminator).kind().value()) {
- case TCKind._tk_short:
- {
- short value = src.read_short();
- tagValue.insert_short(value);
- dst.write_short(value);
- break;
- }
- case TCKind._tk_long:
- {
- int value = src.read_long();
- tagValue.insert_long(value);
- dst.write_long(value);
- break;
- }
- case TCKind._tk_ushort:
- {
- short value = src.read_short();
- tagValue.insert_ushort(value);
- dst.write_short(value);
- break;
- }
- case TCKind._tk_ulong:
- {
- int value = src.read_long();
- tagValue.insert_ulong(value);
- dst.write_long(value);
- break;
- }
- case TCKind._tk_float:
- {
- float value = src.read_float();
- tagValue.insert_float(value);
- dst.write_float(value);
- break;
- }
- case TCKind._tk_double:
- {
- double value = src.read_double();
- tagValue.insert_double(value);
- dst.write_double(value);
- break;
- }
- case TCKind._tk_boolean:
- {
- boolean value = src.read_boolean();
- tagValue.insert_boolean(value);
- dst.write_boolean(value);
- break;
- }
- case TCKind._tk_char:
- {
- char value = src.read_char();
- tagValue.insert_char(value);
- dst.write_char(value);
- break;
- }
- case TCKind._tk_enum:
- {
- int value = src.read_long();
- tagValue.type(_discriminator);
- tagValue.insert_long(value);
- dst.write_long(value);
- break;
- }
- case TCKind._tk_longlong:
- {
- long value = src.read_longlong();
- tagValue.insert_longlong(value);
- dst.write_longlong(value);
- break;
- }
- case TCKind._tk_ulonglong:
- {
- long value = src.read_longlong();
- tagValue.insert_ulonglong(value);
- dst.write_longlong(value);
- break;
- }
- // _REVISIT_ figure out long double mapping
- // case TCKind.tk_longdouble:
- // {
- // double value = src.read_double();
- // tagValue.insert_longdouble(value);
- // dst.putDouble(value);
- // break;
- //}
- case TCKind._tk_wchar:
- {
- char value = src.read_wchar();
- tagValue.insert_wchar(value);
- dst.write_wchar(value);
- break;
- }
- default:
- throw wrapper.illegalUnionDiscriminatorType() ;
- }
-
- // using the value of the tag, find out the type of the value
- // following.
-
- int labelIndex;
- for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) {
- // use equality over anys
- if (tagValue.equal(_unionLabels[labelIndex])) {
- _memberTypes[labelIndex].copy(src, dst);
- break;
- }
- }
-
- if (labelIndex == _unionLabels.length) {
- // check if label has not been found
- if (_defaultIndex != -1)
- // must be of the default branch type
- _memberTypes[_defaultIndex].copy(src, dst);
- }
- break;
- }
-
- case TCKind._tk_enum:
- dst.write_long(src.read_long());
- break;
-
- case TCKind._tk_sequence:
- // get the length of the sequence
- int seqLength = src.read_long();
-
- // check for sequence bound violated
- if ((_length != 0) && (seqLength > _length))
- throw wrapper.badSequenceBounds( new Integer(seqLength),
- new Integer(_length) ) ;
-
- // write the length of the sequence
- dst.write_long(seqLength);
-
- // copy each element of the seq using content type
- lazy_content_type(); // make sure it's resolved
- for (int i=0; i < seqLength; i++)
- _contentType.copy(src, dst);
- break;
-
- case TCKind._tk_array:
- // copy each element of the array using content type
- for (int i=0; i < _length; i++)
- _contentType.copy(src, dst);
- break;
-
- case TCKind._tk_alias:
- case TCKind._tk_value_box:
- // follow the alias
- _contentType.copy(src, dst);
- break;
-
- case tk_indirect:
- // need to follow offset, get unmarshal typecode from that
- // offset, and use that to do the copy
- // Don't need to read type code before using it to do the copy.
- // It should be fully usable.
- indirectType().copy(src, dst);
- break;
-
- default:
- throw wrapper.invalidTypecodeKindMarshal() ;
- }
- }
-
-
- static protected short digits(java.math.BigDecimal value) {
- if (value == null)
- return 0;
- short length = (short)value.unscaledValue().toString().length();
- if (value.signum() == -1)
- length--;
- return length;
- }
-
- static protected short scale(java.math.BigDecimal value) {
- if (value == null)
- return 0;
- return (short)value.scale();
- }
-
- // Utility methods
-
- // Only for union type. Returns the index of the union member
- // corresponding to the discriminator. If not found returns the
- // default index or -1 if there is no default index.
- int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
- if (_kind != TCKind._tk_union)
- throw new BadKind();
-
- try {
- for (int i=0; i");
- s.println(" " + _memberNames[i] + ";");
- }
- s.print(indent(level) + "}");
- break;
-
- case TCKind._tk_union:
- s.print("union " + _name + "...");
- break;
-
- case TCKind._tk_enum:
- s.print("enum " + _name + "...");
- break;
-
- case TCKind._tk_string:
- if (_length == 0)
- s.print("unbounded string " + _name);
- else
- s.print("bounded string(" + _length + ") " + _name);
- break;
-
- case TCKind._tk_sequence:
- case TCKind._tk_array:
- s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
- s.print(indent(level + 1));
- if (lazy_content_type() != null) {
- lazy_content_type().printStream(s, level + 1);
- }
- s.println(indent(level) + "}");
- break;
-
- case TCKind._tk_alias:
- s.print("alias " + _name + " = " +
- (_contentType != null ? _contentType._name : ""));
- break;
-
- case TCKind._tk_wstring:
- s.print("wstring[" + _length + "] " + _name);
- break;
-
- case TCKind._tk_fixed:
- s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
- break;
-
- case TCKind._tk_value_box:
- s.print("valueBox " + _name + "...");
- break;
-
- case TCKind._tk_abstract_interface:
- s.print("abstractInterface " + _name + "...");
- break;
-
- default:
- s.print("");
- break;
- }
- }
-
- private String indent(int level) {
- String indent = "";
- for(int i=0; i create config data
- b. parse props -> create config data -> create components
-
- However, long-term bean persistence can be used in either model. Separation of
- concerns (and the large size of the ORB class) argues for separating data from
- components.
-
-2. get configuration out of ORB (except for finding config class)
- ORB responsibility:
- - gather all property, arg data together and make it available
- - load the ORB configurator and let it process the data, generate a config object
- - ORB is central registry, so ORB configurator store config data in ORB
-
-3. Extensibility is required
-
- The ORB will have large subsystems that are pluggable components (examples: aobject adaptors,
- transport plugins). Individual instances of these frameworks will have their own configuration
- data. To solve this, the ORB class will provide (read-only perhaps?) access to the collected
- properties.
-
- While the component config data is not needed in the ORB, it is needed in the ORB config data
- so that bean persistence can be used to create an XML version of the data.
-
- problem: properties vs. config data: same or not?
-
- properties: easier to use, also necessary to indicate where to get config data if not default
- config data: more powerful
-
-4. Basic principle: A parser performs an action A based on a value V when it matches a property P.
- Actions can be:
-
- configObject.setP( V )
- configObject.setP( A(V) )
- A(V)
-
-5. ParserActions are composable
-
- Basic action: Object parse( String arg, String value )
- which nicely handles prefix parsing and sharing of actions across multiple keys
-
- interface Operation {
- Object operate( String arg, String value )
- }
-
- interface OperationFactory {
- Operation booleanAction() ;
-
- Operation integerAction() ;
-
- Operation stringAction() ;
-
- Operation integerRangeAction( int min, int max ) ;
-
- Operation listAction( char sep, Operation act ) ;
- }
-
- interface ParserAction {
- void parse( String arg, String value ) ;
- }
-
- interface ParserActionFactory {
- ParserAction setFieldAction( String fieldName ) ;
-
- ParserAction setFieldAction( String fieldName, Operation op ) ;
-
- ParserAction operationAction( Operation op ) ;
- }
-
-6. Parsers are created incrementally:
-
- Constructor:
- new Parser( Class configurationDataClass )
- - has the parser class available for useful defaults
-
- interface PropertyParser {
- /** Option must look like a standard property name, which we require here to
- * be ( JavaIdent "." ) * JavaIdent. The last java ident we will call the tail.
- * If tail starts with "ORB", this option will be used in augmentWithArguments.
- * This match operates as follows:
- * Let name = tail stripped of its ORB prefix.
- * (e.g. if tail = ORBLowWaterMark, name = LowWaterMark).
- * Then if option is matched, a conversion to the result type of the method named
- * get is performed, and set is called on the data object to set the
- * result.
- */
- void addMatch( String option ) ;
-
- void addMatch( String option, ParserAction pa )
-
- void addPrefixMatch( String prefix, ParserAction pa )
-
- /** First constructs a new property object that has props as its default,
- * then enters args into new property object that correspond to property
- * names registered in match() calls.
- */
- Properties augmentWithArguments( Properties props, String[] args ) ;
-
- /** Parse all matched properties in props, updating data as required
- * by the actions.
- */
- void parse( Properties props, ORBConfigurationData data ) ;
- }
-
-7. A useful model:
-
- Provide
-
- abstract class ConfigDataBase {
- ConfigDataBase( Properties props )
- {
- ...
- }
- }
-
- and then a specific class
-
- public class ORBConfigData extends ConfigDataBase {
- ORBConfigData( Properties props )
- {
- super( props ) ;
- }
-
- private int foo1 = fooDefault ;
- private String foo2 = fooDefault2 ;
- private boolean foo3 = fooDefault3 ;
- private SomeObject foo4 = fooDefault4 ;
-
- public int getFoo1() { return foo1 ; }
- // and similarly
- }
-
- The constructor then uses reflection to automatically handle all of these variables with a number of
- assumptions:
- a. Standard names:
- private foo { = }
- public getFoo() { return foo ; }
- as argument: -ORBfoo
- as property: com.sun.CORBA.foo (problems here)
- b. type specific parsing
- int: from Integer
- String: no-op
- boolean: true/false (from Boolean)
- Class: must be able to load class
- class XXX: XXX must have a public XXX( String ) constructor
-
- Custom parsing?
-
- What are valid prefixes?
- 1. provide com.sun.corba.prefix.XXX where XXX defines a prefix to look for
- (some security implications)
- 2. Extend security model to ORB implementation (I like this approach best so far)
-
-8. ORB config
-
- public interface ORBConfigurator {
- /** This method is called from ORB.init after all ORB properties have been
- * collected. The corba.ORB constructor will make sure that all required
- * registries are initialized and empty. This constructor will also initialize
- * some data used in the corba ORB public API, such as support for deferred
- * asynchronous invocation. However, all regisitration including things like
- * the dyanmic any factory should take place in the configurator. This method
- * is resonsible for making PI ORBInitializer calls, if PI is configured.
- */
- void configure( com.sun.corba.se.impl.core.ORB orb ) ;
- }
-
- The ORB will have a default configurator named
-
- com.sun.corba.se.impl.core.ORBConfiguratorImpl
-
- and also a property
-
- com.sun.CORBA.ORBConfiguratorClass
-
- than can be set to the name of the ORB configurator class to use. Note that this
- implementation can either be a straight Java implementation, or something more
- interpretive, such as an XML-based config description.
-
-9. We need to construct a list of all properties, and then make sure that security is respected.
- The basic security check is just:
-
- SecurityManager sman = System.getSecurityManager() ;
- if (sman != null)
- sman.checkPropertyAccess( key )
-
- and also
-
- sman.checkPropertiesAccess()
-
- We can construct a list of all properties as we do now, which allows the ORB
- to call System.getProperties() inside a doPrivileged() block. Then we create
- a subclass of java.util.Properties that overrides getProperty to
- do the checkPropertyAccess( key ) call. We also need to overload the
- enumerate method, either to make it illegal, call sman.checkPropertiesAccess,
- or just filter it to include only the accessible properties.
- And we also need to overload store, because it does not call enumerate internally.
-
- This allows us to provide all properties to an ORBConfigurator, while still preserving
- the security model. Then anyone that needs security can set up property permissions
- like com.foo.corba.* to allow access to only the properties they care about.
-
-10. ORB APIs
-
- The ORB needs registry support including:
- getSubcontractRegistry
- getServiceContextRegistry
-
- The ORB needs to provide access to a basic (and extensible) ORB configuration object,
- which supports at a minimum all of the standard CORBA defined properties.
-
- Also need registries for:
- ObjectAdapter (actually already in SubcontractRegistry, but needs extensions to
- ObjectAdapterFactory to work fully)
- TaggedComponentFactory
- TaggedProfileFactory
-
- What does an empty ORB provide?
- - Registration of all ORB components
- - Request dispatching to object adapters
- - Access to ORB properties data (as secure Properties object)
- - Access to ORB arguments
- - Access to ORB configuration data (base class, plus collections of base config
- data for plugins such as OAs and transports)
- - shutdown support (separate tracking of invocations vs. OA tracking in POA case?
- How should this be designed?)
- - INS support? (perhaps this could be pluggable too?)
- - How does create_output_stream get plugged in?
- - Can we separate the current IIOP transport into a TransportPluging?
- - PI support
- - CORBA::ORB API
- - NVList, DII
- - object <-> string (which includes INS?)
- - (dis)connect API for TOA (move all impl to TOAImpl?)
- - typecode/any
- - FVD
- - initial services registry
- - value factory registry
- - logging, other M&M support as needed
-
-ORB classes:
-
- core.ORB: abstract class providing internal interface
- corba.ORBImpl: internal implementation of CORBA APIs
- corba.ORBSingleton: the singleton ORB (not much change needed)
- corba.ConfigurationDataCollector: collects all source of config data and canonicalizes it
- Interceptor.PIHandler: the interface for PI
- Interceptor.PIHandlerImpl: standard implementation of PIHandler
- corba.ORBConfigurationData: extensible bean containing all ORB config data
-
-11. RequestHandler and ORB
-
- The RH interface is currently implemented in the ORB class, but might better be a separate
- class. The API is currently almost the same as a ServerSubcontract. Should we regularize
- this? Also, the API would need to be extended to handle shutdown properly.
-
- Extended API:
- - void run(): does not return until shutdown(boolean) is called.
- - shutdown(boolean) needs to be here so that requests can be
- synchhronized with shutdown. This is also a point where OAs
- need to be included (currently in shutdownServants)
-
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java 2018-01-30 20:16:32.000000000 -0500
+++ /dev/null 2018-01-30 20:16:32.000000000 -0500
@@ -1,636 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TCKind;
-
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynAnyBasicImpl extends DynAnyImpl
-{
- //
- // Constructors
- //
-
- private DynAnyBasicImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynAnyBasicImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- // set the current position to 0 if any has components, otherwise to -1.
- index = NO_INDEX;
- }
-
- protected DynAnyBasicImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- // set the current position to 0 if any has components, otherwise to -1.
- index = NO_INDEX;
- }
-
- //
- // DynAny interface methods
- //
-
- public void assign (org.omg.DynamicAny.DynAny dyn_any)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- super.assign(dyn_any);
- index = NO_INDEX;
- }
-
- public void from_any (org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- super.from_any(value);
- index = NO_INDEX;
- }
-
- // Spec: Returns a copy of the internal Any
- public org.omg.CORBA.Any to_any() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return DynAnyUtil.copy(any, orb);
- }
-
- public boolean equal (org.omg.DynamicAny.DynAny dyn_any) {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (dyn_any == this) {
- return true;
- }
- // If the other DynAny is a constructed one we don't want it to have
- // to create its Any representation just for this test.
- if ( ! any.type().equal(dyn_any.type())) {
- return false;
- }
- //System.out.println("Comparing anys");
- return any.equal(getAny(dyn_any));
- }
-
- public void destroy() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (status == STATUS_DESTROYABLE) {
- status = STATUS_DESTROYED;
- }
- }
-
- public org.omg.DynamicAny.DynAny copy() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- // The flag "true" indicates copying the Any value
- try {
- return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
- } catch (InconsistentTypeCode ictc) {
- return null; // impossible
- }
- }
-
- public org.omg.DynamicAny.DynAny current_component()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
- {
- return null;
- }
-
- public int component_count() {
- return 0;
- }
-
- public boolean next() {
- return false;
- }
-
- public boolean seek(int index) {
- return false;
- }
-
- public void rewind() {
- }
-
- public void insert_boolean(boolean value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_boolean)
- throw new TypeMismatch();
- any.insert_boolean(value);
- }
-
- public void insert_octet(byte value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_octet)
- throw new TypeMismatch();
- any.insert_octet(value);
- }
-
- public void insert_char(char value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_char)
- throw new TypeMismatch();
- any.insert_char(value);
- }
-
- public void insert_short(short value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_short)
- throw new TypeMismatch();
- any.insert_short(value);
- }
-
- public void insert_ushort(short value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ushort)
- throw new TypeMismatch();
- any.insert_ushort(value);
- }
-
- public void insert_long(int value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_long)
- throw new TypeMismatch();
- any.insert_long(value);
- }
-
- public void insert_ulong(int value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulong)
- throw new TypeMismatch();
- any.insert_ulong(value);
- }
-
- public void insert_float(float value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_float)
- throw new TypeMismatch();
- any.insert_float(value);
- }
-
- public void insert_double(double value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_double)
- throw new TypeMismatch();
- any.insert_double(value);
- }
-
- public void insert_string(String value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_string)
- throw new TypeMismatch();
- if (value == null)
- throw new InvalidValue();
- // Throw InvalidValue if this is a bounded string and the length is exceeded
- try {
- if (any.type().length() > 0 && any.type().length() < value.length())
- throw new InvalidValue();
- } catch (BadKind bad) { // impossible
- }
- any.insert_string(value);
- }
-
- public void insert_reference(org.omg.CORBA.Object value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_objref)
- throw new TypeMismatch();
- any.insert_Object(value);
- }
-
- public void insert_typecode(org.omg.CORBA.TypeCode value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_TypeCode)
- throw new TypeMismatch();
- any.insert_TypeCode(value);
- }
-
- public void insert_longlong(long value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_longlong)
- throw new TypeMismatch();
- any.insert_longlong(value);
- }
-
- public void insert_ulonglong(long value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulonglong)
- throw new TypeMismatch();
- any.insert_ulonglong(value);
- }
-
- public void insert_wchar(char value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wchar)
- throw new TypeMismatch();
- any.insert_wchar(value);
- }
-
- public void insert_wstring(String value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wstring)
- throw new TypeMismatch();
- if (value == null)
- throw new InvalidValue();
- // Throw InvalidValue if this is a bounded string and the length is exceeded
- try {
- if (any.type().length() > 0 && any.type().length() < value.length())
- throw new InvalidValue();
- } catch (BadKind bad) { // impossible
- }
- any.insert_wstring(value);
- }
-
- public void insert_any(org.omg.CORBA.Any value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- any.insert_any(value);
- }
-
- public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- // _REVISIT_ Copy value here?
- any.insert_any(value.to_any());
- }
-
- public void insert_val(java.io.Serializable value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int kind = any.type().kind().value();
- if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
- throw new TypeMismatch();
- any.insert_Value(value);
- }
-
- public java.io.Serializable get_val()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int kind = any.type().kind().value();
- if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
- throw new TypeMismatch();
- return any.extract_Value();
- }
-
- public boolean get_boolean()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_boolean)
- throw new TypeMismatch();
- return any.extract_boolean();
- }
-
- public byte get_octet()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_octet)
- throw new TypeMismatch();
- return any.extract_octet();
- }
-
- public char get_char()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_char)
- throw new TypeMismatch();
- return any.extract_char();
- }
-
- public short get_short()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_short)
- throw new TypeMismatch();
- return any.extract_short();
- }
-
- public short get_ushort()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ushort)
- throw new TypeMismatch();
- return any.extract_ushort();
- }
-
- public int get_long()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_long)
- throw new TypeMismatch();
- return any.extract_long();
- }
-
- public int get_ulong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulong)
- throw new TypeMismatch();
- return any.extract_ulong();
- }
-
- public float get_float()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_float)
- throw new TypeMismatch();
- return any.extract_float();
- }
-
- public double get_double()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_double)
- throw new TypeMismatch();
- return any.extract_double();
- }
-
- public String get_string()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_string)
- throw new TypeMismatch();
- return any.extract_string();
- }
-
- public org.omg.CORBA.Object get_reference()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_objref)
- throw new TypeMismatch();
- return any.extract_Object();
- }
-
- public org.omg.CORBA.TypeCode get_typecode()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_TypeCode)
- throw new TypeMismatch();
- return any.extract_TypeCode();
- }
-
- public long get_longlong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_longlong)
- throw new TypeMismatch();
- return any.extract_longlong();
- }
-
- public long get_ulonglong()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_ulonglong)
- throw new TypeMismatch();
- return any.extract_ulonglong();
- }
-
- public char get_wchar()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wchar)
- throw new TypeMismatch();
- return any.extract_wchar();
- }
-
- public String get_wstring()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_wstring)
- throw new TypeMismatch();
- return any.extract_wstring();
- }
-
- public org.omg.CORBA.Any get_any()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- return any.extract_any();
- }
-
- public org.omg.DynamicAny.DynAny get_dyn_any()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (any.type().kind().value() != TCKind._tk_any)
- throw new TypeMismatch();
- // _REVISIT_ Copy value here?
- try {
- return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
- } catch (InconsistentTypeCode ictc) {
- // The spec doesn't allow us to throw back this exception
- // incase the anys any if of type Principal, native or abstract interface.
- return null;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java 2018-01-30 20:16:33.000000000 -0500
+++ /dev/null 2018-01-30 20:16:33.000000000 -0500
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-abstract class DynAnyCollectionImpl extends DynAnyConstructedImpl
-{
- //
- // Instance variables
- //
-
- // Keep in sync with DynAny[] components at all times.
- Any[] anys = null;
-
- //
- // Constructors
- //
-
- private DynAnyCollectionImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynAnyCollectionImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- protected DynAnyCollectionImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-
- //
- // Utility methods
- //
-
- protected void createDefaultComponentAt(int i, TypeCode contentType) {
- try {
- components[i] = DynAnyUtil.createMostDerivedDynAny(contentType, orb);
- } catch (InconsistentTypeCode itc) { // impossible
- }
- // get a hold of the default initialized Any without copying
- anys[i] = getAny(components[i]);
- }
-
- protected TypeCode getContentType() {
- try {
- return any.type().content_type();
- } catch (BadKind badKind) { // impossible
- return null;
- }
- }
-
- // This method has a different meaning for sequence and array:
- // For sequence value of 0 indicates an unbounded sequence,
- // values > 0 indicate a bounded sequence.
- // For array any value indicates the boundary.
- protected int getBound() {
- try {
- return any.type().length();
- } catch (BadKind badKind) { // impossible
- return 0;
- }
- }
-
- //
- // DynAny interface methods
- //
-
- // _REVISIT_ More efficient copy operation
-
- //
- // Collection methods
- //
-
- public org.omg.CORBA.Any[] get_elements () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return (checkInitComponents() ? anys : null);
- }
-
- protected abstract void checkValue(Object[] value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-
- // Initializes the elements of the ordered collection.
- // If value does not contain the same number of elements as the array dimension,
- // the operation raises InvalidValue.
- // If one or more elements have a type that is inconsistent with the collections TypeCode,
- // the operation raises TypeMismatch.
- // This operation does not change the current position.
- public void set_elements (org.omg.CORBA.Any[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkValue(value);
-
- components = new DynAny[value.length];
- anys = value;
-
- // We know that this is of kind tk_sequence or tk_array
- TypeCode expectedTypeCode = getContentType();
- for (int i=0; i= names.length) {
- throw new InvalidValue();
- }
- return names[index];
- }
-
- public TCKind current_member_kind ()
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if( ! checkInitComponents() || index < 0 || index >= components.length) {
- throw new InvalidValue();
- }
- return components[index].type().kind();
- }
-
- // Creates references to the parameter instead of copying it.
- public void set_members (org.omg.DynamicAny.NameValuePair[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (value == null || value.length == 0) {
- clearData();
- return;
- }
-
- Any memberAny;
- DynAny memberDynAny = null;
- String memberName;
- // We know that this is of kind tk_struct
- TypeCode expectedTypeCode = any.type();
-
- int expectedMemberCount = 0;
- try {
- expectedMemberCount = expectedTypeCode.member_count();
- } catch (BadKind badKind) { // impossible
- }
- if (expectedMemberCount != value.length) {
- clearData();
- throw new InvalidValue();
- }
-
- allocComponents(value);
-
- for (int i=0; i= 0 && index < components.length) {
- return true;
- } else {
- index = NO_INDEX;
- return false;
- }
- }
-
- public boolean seek(int newIndex) {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- if (newIndex < 0) {
- this.index = NO_INDEX;
- return false;
- }
- if (checkInitComponents() == false) {
- return false;
- }
- if (newIndex < components.length) {
- index = newIndex;
- return true;
- }
- return false;
- }
-
- public void rewind() {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- this.seek(0);
- }
-
- //
- // Utility methods
- //
-
- protected void clearData() {
- super.clearData();
- // _REVISIT_ What about status?
- components = emptyComponents;
- index = NO_INDEX;
- representations = REPRESENTATION_NONE;
- }
-
- protected void writeAny(OutputStream out) {
- // If all we got is TypeCode representation (no value)
- // then we don't want to force creating a default value
- //System.out.println(this + " checkInitAny before writeAny");
- checkInitAny();
- super.writeAny(out);
- }
-
- // Makes sure that the components representation is initialized
- protected boolean checkInitComponents() {
- if ((representations & REPRESENTATION_COMPONENTS) == 0) {
- if ((representations & REPRESENTATION_ANY) != 0) {
- if (initializeComponentsFromAny()) {
- representations |= REPRESENTATION_COMPONENTS;
- } else {
- return false;
- }
- } else if ((representations & REPRESENTATION_TYPECODE) != 0) {
- if (initializeComponentsFromTypeCode()) {
- representations |= REPRESENTATION_COMPONENTS;
- } else {
- return false;
- }
- }
- }
- return true;
- }
-
- // Makes sure that the Any representation is initialized
- protected void checkInitAny() {
- if ((representations & REPRESENTATION_ANY) == 0) {
- //System.out.println(this + " checkInitAny: reps does not have REPRESENTATION_ANY");
- if ((representations & REPRESENTATION_COMPONENTS) != 0) {
- //System.out.println(this + " checkInitAny: reps has REPRESENTATION_COMPONENTS");
- if (initializeAnyFromComponents()) {
- representations |= REPRESENTATION_ANY;
- }
- } else if ((representations & REPRESENTATION_TYPECODE) != 0) {
- //System.out.println(this + " checkInitAny: reps has REPRESENTATION_TYPECODE");
- if (representations == REPRESENTATION_TYPECODE && isRecursive())
- return;
- if (initializeComponentsFromTypeCode()) {
- representations |= REPRESENTATION_COMPONENTS;
- }
- if (initializeAnyFromComponents()) {
- representations |= REPRESENTATION_ANY;
- }
- }
- } else {
- //System.out.println(this + " checkInitAny: reps != REPRESENTATION_ANY");
- }
- return;
- }
-
- protected abstract boolean initializeComponentsFromAny();
- protected abstract boolean initializeComponentsFromTypeCode();
-
- // Collapses the whole DynAny hierarchys values into one single streamed Any
- protected boolean initializeAnyFromComponents() {
- //System.out.println(this + " initializeAnyFromComponents");
- OutputStream out = any.create_output_stream();
- for (int i=0; i= memberCount()) {
- throw new InvalidValue();
- }
- currentEnumeratorIndex = value;
- any.insert_long(value);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java 2018-01-30 20:16:38.000000000 -0500
+++ /dev/null 2018-01-30 20:16:39.000000000 -0500
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.*;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynFixedImpl extends DynAnyBasicImpl implements DynFixed
-{
- //
- // Constructors
- //
-
- private DynFixedImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynFixedImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- // Sets the current position to -1 and the value to zero.
- protected DynFixedImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- index = NO_INDEX;
- }
-
- //
- // DynAny interface methods
- //
-/*
- public int component_count() {
- return 0;
- }
-*/
- //
- // DynFixed interface methods
- //
-
- public String get_value () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- return any.extract_fixed().toString();
- }
-
- // Initializes the value of the DynFixed.
- // The val string must contain a fixed string constant in the same format
- // as used for IDL fixed-point literals.
- //
- // It may consist of an integer part, an optional decimal point,
- // a fraction part and an optional letter d or D.
- // The integer and fraction parts both must be sequences of decimal (base 10) digits.
- // Either the integer part or the fraction part, but not both, may be missing.
- //
- // If val contains a value whose scale exceeds that of the DynFixed or is not initialized,
- // the operation raises InvalidValue.
- // The return value is true if val can be represented as the DynFixed without loss of precision.
- // If val has more fractional digits than can be represented in the DynFixed,
- // fractional digits are truncated and the return value is false.
- // If val does not contain a valid fixed-point literal or contains extraneous characters
- // other than leading or trailing white space, the operation raises TypeMismatch.
- //
- public boolean set_value (String val)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- int digits = 0;
- int scale = 0;
- boolean preservedPrecision = true;
- try {
- digits = any.type().fixed_digits();
- scale = any.type().fixed_scale();
- } catch (BadKind ex) { // impossible
- }
- // First get rid of leading or trailing whitespace which is allowed
- String string = val.trim();
- if (string.length() == 0)
- throw new TypeMismatch();
- // Now scan for the sign
- String sign = "";
- if (string.charAt(0) == '-') {
- sign = "-";
- string = string.substring(1);
- } else if (string.charAt(0) == '+') {
- sign = "+";
- string = string.substring(1);
- }
- // Now get rid of the letter d or D.
- int dIndex = string.indexOf('d');
- if (dIndex == -1) {
- dIndex = string.indexOf('D');
- }
- if (dIndex != -1) {
- string = string.substring(0, dIndex);
- }
- // Just to be sure
- if (string.length() == 0)
- throw new TypeMismatch();
- // Now look for the dot to determine the integer part
- String integerPart;
- String fractionPart;
- int currentScale;
- int currentDigits;
- int dotIndex = string.indexOf('.');
- if (dotIndex == -1) {
- integerPart = string;
- fractionPart = null;
- currentScale = 0;
- currentDigits = integerPart.length();
- } else if (dotIndex == 0 ) {
- integerPart = null;
- fractionPart = string;
- currentScale = fractionPart.length();
- currentDigits = currentScale;
- } else {
- integerPart = string.substring(0, dotIndex);
- fractionPart = string.substring(dotIndex + 1);
- currentScale = fractionPart.length();
- currentDigits = integerPart.length() + currentScale;
- }
- // Let's see if we have to drop some precision
- if (currentDigits > digits) {
- preservedPrecision = false;
- // truncate the fraction part
- if (integerPart.length() < digits) {
- fractionPart = fractionPart.substring(0, digits - integerPart.length());
- } else if (integerPart.length() == digits) {
- // currentScale > 0
- // drop the fraction completely
- fractionPart = null;
- } else {
- // integerPart.length() > digits
- // unable to truncate fraction part
- throw new InvalidValue();
- }
- }
- // If val contains a value whose scale exceeds that of the DynFixed or is not initialized,
- // the operation raises InvalidValue.
- // Reinterpreted to mean raise InvalidValue only if the integer part exceeds precision,
- // which is handled above (integerPart.length() > digits)
-/*
- if (currentScale > scale) {
- throw new InvalidValue("Scale exceeds " + scale);
- }
-*/
- // Now check whether both parts are valid numbers
- BigDecimal result;
- try {
- new BigInteger(integerPart);
- if (fractionPart == null) {
- result = new BigDecimal(sign + integerPart);
- } else {
- new BigInteger(fractionPart);
- result = new BigDecimal(sign + integerPart + "." + fractionPart);
- }
- } catch (NumberFormatException nfe) {
- throw new TypeMismatch();
- }
- any.insert_fixed(result, any.type());
- return preservedPrecision;
- }
-
- public String toString() {
- int digits = 0;
- int scale = 0;
- try {
- digits = any.type().fixed_digits();
- scale = any.type().fixed_scale();
- } catch (BadKind ex) { // impossible
- }
- return "DynFixed with value=" + this.get_value() + ", digits=" + digits + ", scale=" + scale;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java 2018-01-30 20:16:39.000000000 -0500
+++ /dev/null 2018-01-30 20:16:39.000000000 -0500
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-// _REVIST_ Could make this a subclass of DynArrayImpl
-// But that would mean that an object that implements DynSequence also implements DynArray
-// which the spec doesn't mention (it also doesn't forbid it).
-public class DynSequenceImpl extends DynAnyCollectionImpl implements DynSequence
-{
- //
- // Constructors
- //
-
- private DynSequenceImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynSequenceImpl(ORB orb, Any any, boolean copyValue) {
- super(orb, any, copyValue);
- }
-
- // Sets the current position to -1 and creates an empty sequence.
- protected DynSequenceImpl(ORB orb, TypeCode typeCode) {
- super(orb, typeCode);
- }
-
- // Initializes components and anys representation
- // from the Any representation
- protected boolean initializeComponentsFromAny() {
- // This typeCode is of kind tk_sequence.
- TypeCode typeCode = any.type();
- int length;
- TypeCode contentType = getContentType();
- InputStream input;
-
- try {
- input = any.create_input_stream();
- } catch (BAD_OPERATION e) {
- return false;
- }
-
- length = input.read_long();
- components = new DynAny[length];
- anys = new Any[length];
-
- for (int i=0; i 0 && len > bound) {
- throw new InvalidValue();
- }
-
- checkInitComponents();
-
- int oldLength = components.length;
- if (len > oldLength) {
- // Increase length
- DynAny[] newComponents = new DynAny[len];
- Any[] newAnys = new Any[len];
- System.arraycopy(components, 0, newComponents, 0, oldLength);
- System.arraycopy(anys, 0, newAnys, 0, oldLength);
- components = newComponents;
- anys = newAnys;
-
- // Newly added elements are default-initialized
- TypeCode contentType = getContentType();
- for (int i=oldLength; i= len) {
- index = NO_INDEX;
- }
- } else {
- // Length unchanged
- // Maybe components is now default initialized from type code
- if (index == NO_INDEX && len > 0) {
- index = 0;
- }
- }
- }
-
- // Initializes the elements of the sequence.
- // The length of the DynSequence is set to the length of value.
- // The current position is set to zero if value has non-zero length
- // and to -1 if value is a zero-length sequence.
- // If the length of value exceeds the bound of a bounded sequence,
- // the operation raises InvalidValue.
- // If value contains one or more elements whose TypeCode is not equivalent
- // to the element TypeCode of the DynSequence, the operation raises TypeMismatch.
-/*
- public void set_elements(org.omg.CORBA.Any[] value)
- throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
- org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-*/
-
- //
- // Utility methods
- //
-
- protected void checkValue(Object[] value)
- throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
- {
- if (value == null || value.length == 0) {
- clearData();
- index = NO_INDEX;
- return;
- } else {
- index = 0;
- }
- int bound = getBound();
- if (bound > 0 && value.length > bound) {
- throw new InvalidValue();
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java 2018-01-30 20:16:40.000000000 -0500
+++ /dev/null 2018-01-30 20:16:40.000000000 -0500
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynStructImpl extends DynAnyComplexImpl implements DynStruct
-{
- //
- // Constructors
- //
-
- private DynStructImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynStructImpl(ORB orb, Any any, boolean copyValue) {
- // We can be sure that typeCode is of kind tk_struct
- super(orb, any, copyValue);
- // Initialize components lazily, on demand.
- // This is an optimization in case the user is only interested in storing Anys.
- }
-
- protected DynStructImpl(ORB orb, TypeCode typeCode) {
- // We can be sure that typeCode is of kind tk_struct
- super(orb, typeCode);
- // For DynStruct, the operation sets the current position to -1
- // for empty exceptions and to zero for all other TypeCodes.
- // The members (if any) are (recursively) initialized to their default values.
- index = 0;
- }
-
- //
- // Methods differing from DynValues
- //
-
- public org.omg.DynamicAny.NameValuePair[] get_members () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkInitComponents();
- return nameValuePairs;
- }
-
- public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any () {
- if (status == STATUS_DESTROYED) {
- throw wrapper.dynAnyDestroyed() ;
- }
- checkInitComponents();
- return nameDynAnyPairs;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java 2018-01-30 20:16:40.000000000 -0500
+++ /dev/null 2018-01-30 20:16:40.000000000 -0500
@@ -1,385 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.dynamicany;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.TypeCodePackage.Bounds;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.DynamicAny.*;
-import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion
-{
- //
- // Instance variables
- //
-
- DynAny discriminator = null;
- // index either points to the discriminator or the named member is it exists.
- // The currently active member, which is of the same type as the discriminator.
- DynAny currentMember = null;
- int currentMemberIndex = NO_INDEX;
-
- //
- // Constructors
- //
-
- private DynUnionImpl() {
- this(null, (Any)null, false);
- }
-
- protected DynUnionImpl(ORB orb, Any any, boolean copyValue) {
- // We can be sure that typeCode is of kind tk_union
- super(orb, any, copyValue);
- }
-
- protected DynUnionImpl(ORB orb, TypeCode typeCode) {
- // We can be sure that typeCode is of kind tk_union
- super(orb, typeCode);
- }
-
- protected boolean initializeComponentsFromAny() {
- try {
- InputStream input = any.create_input_stream();
- Any discriminatorAny = DynAnyUtil.extractAnyFromStream(discriminatorType(), input, orb);
- discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
- currentMemberIndex = currentUnionMemberIndex(discriminatorAny);
- Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb);
- currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
- components = new DynAny[] {discriminator, currentMember};
- } catch (InconsistentTypeCode ictc) { // impossible
- }
- return true;
- }
-
- // Sets the current position to zero.
- // The discriminator value is set to a value consistent with the first named member
- // of the union. That member is activated and (recursively) initialized to its default value.
- protected boolean initializeComponentsFromTypeCode() {
- //System.out.println(this + " initializeComponentsFromTypeCode");
- try {
- // We can be sure that memberCount() > 0 according to the IDL language spec
- discriminator = DynAnyUtil.createMostDerivedDynAny(memberLabel(0), orb, false);
- index = 0;
- currentMemberIndex = 0;
- currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(0), orb);
- components = new DynAny[] {discriminator, currentMember};
- } catch (InconsistentTypeCode ictc) { // impossible
- }
- return true;
- }
-
- //
- // Convenience methods
- //
-
- private TypeCode discriminatorType() {
- TypeCode discriminatorType = null;
- try {
- discriminatorType = any.type().discriminator_type();
- } catch (BadKind bad) {
- }
- return discriminatorType;
- }
-
- private int memberCount() {
- int memberCount = 0;
- try {
- memberCount = any.type().member_count();
- } catch (BadKind bad) {
- }
- return memberCount;
- }
-
- private Any memberLabel(int i) {
- Any memberLabel = null;
- try {
- memberLabel = any.type().member_label(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberLabel;
- }
-
- private TypeCode memberType(int i) {
- TypeCode memberType = null;
- try {
- memberType = any.type().member_type(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberType;
- }
-
- private String memberName(int i) {
- String memberName = null;
- try {
- memberName = any.type().member_name(i);
- } catch (BadKind bad) {
- } catch (Bounds bounds) {
- }
- return memberName;
- }
-
- private int defaultIndex() {
- int defaultIndex = -1;
- try {
- defaultIndex = any.type().default_index();
- } catch (BadKind bad) {
- }
- return defaultIndex;
- }
-
- private int currentUnionMemberIndex(Any discriminatorValue) {
- int memberCount = memberCount();
- Any memberLabel;
- for (int i=0; i 0;
- }
-
- /**
- * Returns the correct buffer size for this type of
- * buffer manager as set in the ORB.
- */
- public int getBufferSize() {
- return orb.getORBData().getGIOPFragmentSize();
- }
-
- public void overflow (ByteBufferWithInfo bbwi)
- {
- // Set the fragment's moreFragments field to true
- MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
-
- try {
- sendFragment(false);
- } catch(SystemException se){
- orb.getPIHandler().invokeClientPIEndingPoint(
- ReplyMessage.SYSTEM_EXCEPTION, se);
- throw se;
- }
-
- // Reuse the old buffer
-
- // REVISIT - need to account for case when needed > available
- // even after fragmenting. This is the large array case, so
- // the caller should retry when it runs out of space.
- bbwi.position(0);
- bbwi.buflen = bbwi.byteBuffer.limit();
- bbwi.fragmented = true;
-
- // Now we must marshal in the fragment header/GIOP header
-
- // REVISIT - we can optimize this by not creating the fragment message
- // each time.
-
- FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();
-
- header.write(((CDROutputObject)outputObject));
- }
-
- private void sendFragment(boolean isLastFragment)
- {
- Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();
-
- // REVISIT: need an ORB
- //System.out.println("sendFragment: last?: " + isLastFragment);
- conn.writeLock();
-
- try {
- // Send the fragment
- conn.sendWithoutLock(((OutputObject)outputObject));
-
- fragmentCount++;
-
- } finally {
-
- conn.writeUnlock();
- }
-
- }
-
- // Sends the last fragment
- public void sendMessage ()
- {
- sendFragment(true);
-
- sentFullMessage = true;
- }
-
- /**
- * Close the BufferManagerWrite and do any outstanding cleanup.
- *
- * No work to do for a BufferManagerWriteStream
- */
- public void close(){};
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java 2018-01-30 20:16:48.000000000 -0500
+++ /dev/null 2018-01-30 20:16:49.000000000 -0500
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.util.LinkedList;
-import java.util.NoSuchElementException;
-import java.util.LinkedList;
-
-/**
- * Simple unsynchronized queue implementation for ByteBufferWithInfos.
- */
-// XREVISIT - Should be in orbutil or package private
-public class BufferQueue
-{
- private LinkedList list = new LinkedList();
-
- public void enqueue(ByteBufferWithInfo item)
- {
- list.addLast(item);
- }
-
- public ByteBufferWithInfo dequeue() throws NoSuchElementException
- {
- return (ByteBufferWithInfo)list.removeFirst();
- }
-
- public int size()
- {
- return list.size();
- }
-
- // Adds the given ByteBufferWithInfo to the front
- // of the queue.
- public void push(ByteBufferWithInfo item)
- {
- list.addFirst(item);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java 2018-01-30 20:16:49.000000000 -0500
+++ /dev/null 2018-01-30 20:16:49.000000000 -0500
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-
-
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.spi.orb.ORB;
-
-
-// Notes about the class.
-// Assumptions, the ByteBuffer's position is set by the constructor's
-// index variable and the ByteBuffer's limit points to the end of the
-// data. Also, since the index variable tracks the current empty
-// position in the buffer, the ByteBuffer's position is updated
-// any time there's a call to this class's position().
-// Although, a ByteBuffer's length is it's capacity(), the context in
-// which length is used in this object, this.buflen is actually the
-// ByteBuffer limit().
-
-public class ByteBufferWithInfo
-{
- private ORB orb;
- private boolean debug;
- // REVISIT - index should eventually be replaced with byteBuffer.position()
- private int index; // Current empty position in buffer.
- // REVISIT - CHANGE THESE TO PRIVATE
- public ByteBuffer byteBuffer;// Marshal buffer.
- public int buflen; // Total length of buffer. // Unnecessary...
- public int needed; // How many more bytes are needed on overflow.
- public boolean fragmented; // Did the overflow operation fragment?
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int index)
- {
- this.orb = (com.sun.corba.se.spi.orb.ORB)orb;
- debug = this.orb.transportDebugFlag;
- this.byteBuffer = byteBuffer;
- if (byteBuffer != null)
- {
- this.buflen = byteBuffer.limit();
- }
- position(index);
- this.needed = 0;
- this.fragmented = false;
- }
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer)
- {
- this(orb, byteBuffer, 0);
- }
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
- BufferManagerWrite bufferManager)
- {
- this(orb, bufferManager, true);
- }
-
- // Right now, EncapsOutputStream's do not use pooled byte buffers.
- // EncapsOutputStream's is the only one that does not use pooled
- // byte buffers. Hence, the reason for the boolean 'usePooledByteBuffers'.
- // See EncapsOutputStream for additional information.
-
- public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
- BufferManagerWrite bufferManager,
- boolean usePooledByteBuffers)
- {
- this.orb = (com.sun.corba.se.spi.orb.ORB)orb;
- debug = this.orb.transportDebugFlag;
-
- int bufferSize = bufferManager.getBufferSize();
-
- if (usePooledByteBuffers)
- {
- ByteBufferPool byteBufferPool = this.orb.getByteBufferPool();
- this.byteBuffer = byteBufferPool.getByteBuffer(bufferSize);
-
- if (debug)
- {
- // print address of ByteBuffer gotten from pool
- int bbAddress = System.identityHashCode(byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("constructor (ORB, BufferManagerWrite) - got ")
- .append("ByteBuffer id (").append(bbAddress)
- .append(") from ByteBufferPool.");
- String msgStr = sb.toString();
- dprint(msgStr);
- }
- }
- else
- {
- // don't allocate from pool, allocate non-direct ByteBuffer
- this.byteBuffer = ByteBuffer.allocate(bufferSize);
- }
-
- position(0);
- this.buflen = bufferSize;
- this.byteBuffer.limit(this.buflen);
- this.needed = 0;
- this.fragmented = false;
- }
-
- // Shallow copy constructor
- public ByteBufferWithInfo (ByteBufferWithInfo bbwi)
- {
- this.orb = bbwi.orb;
- this.debug = bbwi.debug;
- this.byteBuffer = bbwi.byteBuffer;
- this.buflen = bbwi.buflen;
- this.byteBuffer.limit(this.buflen);
- position(bbwi.position());
- this.needed = bbwi.needed;
- this.fragmented = bbwi.fragmented;
- }
-
- // So IIOPOutputStream seems more intuitive
- public int getSize()
- {
- return position();
- }
-
- // accessor to buflen
- public int getLength()
- {
- return buflen;
- }
-
- // get position in this buffer
- public int position()
- {
- // REVISIT - This should be changed to return the
- // value of byteBuffer.position() rather
- // than this.index. But, byteBuffer.position
- // is manipulated via ByteBuffer writes, reads,
- // gets and puts. These locations need to be
- // investigated and updated before
- // byteBuffer.position() can be returned here.
- // return byteBuffer.position();
- return index;
- }
-
- // set position in this buffer
- public void position(int newPosition)
- {
- // REVISIT - This should be changed to set only the
- // value of byteBuffer.position rather
- // than this.index. This change should be made
- // in conjunction with the change to this.position().
- byteBuffer.position(newPosition);
- index = newPosition;
- }
-
- // mutator to buflen
- public void setLength(int theLength)
- {
- buflen = theLength;
- byteBuffer.limit(buflen);
- }
-
- // Grow byteBuffer to a size larger than position() + needed
- public void growBuffer(com.sun.corba.se.spi.orb.ORB orb)
- {
- // This code used to live directly in CDROutputStream.grow.
-
- // Recall that the byteBuffer size is 'really' the limit or
- // buflen.
-
- int newLength = byteBuffer.limit() * 2;
-
- while (position() + needed >= newLength)
- newLength = newLength * 2;
-
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
- ByteBuffer newBB = byteBufferPool.getByteBuffer(newLength);
-
- if (debug)
- {
- // print address of ByteBuffer just gotten
- int newbbAddress = System.identityHashCode(newBB);
- StringBuffer sb = new StringBuffer(80);
- sb.append("growBuffer() - got ByteBuffer id (");
- sb.append(newbbAddress).append(") from ByteBufferPool.");
- String msgStr = sb.toString();
- dprint(msgStr);
- }
-
- byteBuffer.position(0);
- newBB.put(byteBuffer);
-
- // return 'old' byteBuffer reference to the ByteBuffer pool
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append("growBuffer() - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msgStr2 = sb.toString();
- dprint(msgStr2);
- }
- byteBufferPool.releaseByteBuffer(byteBuffer);
-
- // update the byteBuffer with a larger ByteBuffer
- byteBuffer = newBB;
-
- // limit and buflen must be set to newLength.
- buflen = newLength;
- byteBuffer.limit(buflen);
- }
-
- public String toString()
- {
- StringBuffer str = new StringBuffer("ByteBufferWithInfo:");
-
- str.append(" buflen = " + buflen);
- str.append(" byteBuffer.limit = " + byteBuffer.limit());
- str.append(" index = " + index);
- str.append(" position = " + position());
- str.append(" needed = " + needed);
- str.append(" byteBuffer = " + (byteBuffer == null ? "null" : "not null"));
- str.append(" fragmented = " + fragmented);
-
- return str.toString();
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("ByteBufferWithInfo", msg);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java 2018-01-30 20:16:50.000000000 -0500
+++ /dev/null 2018-01-30 20:16:50.000000000 -0500
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import com.sun.corba.se.pept.encoding.InputObject;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.transport.CorbaConnection;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-/**
- * @author Harold Carr
- */
-public class CDRInputObject extends CDRInputStream
- implements
- InputObject
-{
- private CorbaConnection corbaConnection;
- private Message header;
- private boolean unmarshaledHeader;
- private ORB orb ;
- private ORBUtilSystemException wrapper ;
- private OMGSystemException omgWrapper ;
-
- public CDRInputObject(ORB orb,
- CorbaConnection corbaConnection,
- ByteBuffer byteBuffer,
- Message header)
- {
- super(orb, byteBuffer, header.getSize(), header.isLittleEndian(),
- header.getGIOPVersion(), header.getEncodingVersion(),
- BufferManagerFactory.newBufferManagerRead(
- header.getGIOPVersion(),
- header.getEncodingVersion(),
- orb));
-
- this.corbaConnection = corbaConnection;
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- this.omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
-
- if (orb.transportDebugFlag) {
- dprint(".CDRInputObject constructor:");
- }
-
- getBufferManager().init(header);
-
- this.header = header;
-
- unmarshaledHeader = false;
-
- setIndex(Message.GIOPMessageHeaderLength);
-
- setBufferLength(header.getSize());
- }
-
- // REVISIT - think about this some more.
- // This connection normally is accessed from the message mediator.
- // However, giop input needs to get code set info from the connetion
- // *before* the message mediator is available.
- public final CorbaConnection getConnection()
- {
- return corbaConnection;
- }
-
- // XREVISIT - Should the header be kept in the stream or the
- // message mediator? Or should we not have a header and
- // have the information stored in the message mediator
- // directly?
- public Message getMessageHeader()
- {
- return header;
- }
-
- /**
- * Unmarshal the extended GIOP header
- * NOTE: May be fragmented, so should not be called by the ReaderThread.
- * See CorbaResponseWaitingRoomImpl.waitForResponse. It is done
- * there in the client thread.
- */
- public void unmarshalHeader()
- {
- // Unmarshal the extended GIOP message from the buffer.
-
- if (!unmarshaledHeader) {
- try {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".unmarshalHeader->: " + getMessageHeader());
- }
- getMessageHeader().read(this);
- unmarshaledHeader= true;
- } catch (RuntimeException e) {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".unmarshalHeader: !!ERROR!!: "
- + getMessageHeader()
- + ": " + e);
- }
- throw e;
- } finally {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".unmarshalHeader<-: " + getMessageHeader());
- }
- }
- }
- }
-
- public final boolean unmarshaledHeader()
- {
- return unmarshaledHeader;
- }
-
- /**
- * Override the default CDR factory behavior to get the
- * negotiated code sets from the connection.
- *
- * These are only called once per message, the first time needed.
- *
- * In the local case, there is no Connection, so use the
- * local code sets.
- */
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, fall back on the defaults defined
- // in CDRInputStream.
- if (codesets == null)
- return super.createCharBTCConverter();
-
- OSFCodeSetRegistry.Entry charSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());
-
- if (charSet == null)
- throw wrapper.unknownCodeset( charSet ) ;
-
- return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
- }
-
- protected CodeSetConversion.BTCConverter createWCharBTCConverter() {
-
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, we have to throw an exception.
- // See CORBA formal 00-11-03 13.9.2.6.
- if (codesets == null) {
- if (getConnection().isServer())
- throw omgWrapper.noClientWcharCodesetCtx() ;
- else
- throw omgWrapper.noServerWcharCodesetCmp() ;
- }
-
- OSFCodeSetRegistry.Entry wcharSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());
-
- if (wcharSet == null)
- throw wrapper.unknownCodeset( wcharSet ) ;
-
- // For GIOP 1.2 and UTF-16, use big endian if there is no byte
- // order marker. (See issue 3405b)
- //
- // For GIOP 1.1 and UTF-16, use the byte order the stream if
- // there isn't (and there shouldn't be) a byte order marker.
- //
- // GIOP 1.0 doesn't have wchars. If we're talking to a legacy ORB,
- // we do what our old ORBs did.
- if (wcharSet == OSFCodeSetRegistry.UTF_16) {
- if (getGIOPVersion().equals(GIOPVersion.V1_2))
- return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
- }
-
- return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
- }
-
- // If we're local and don't have a Connection, use the
- // local code sets, otherwise get them from the connection.
- // If the connection doesn't have negotiated code sets
- // yet, then we use ISO8859-1 for char/string and wchar/wstring
- // are illegal.
- private CodeSetComponentInfo.CodeSetContext getCodeSets() {
- if (getConnection() == null)
- return CodeSetComponentInfo.LOCAL_CODE_SETS;
- else
- return getConnection().getCodeSetContext();
- }
-
- public final CodeBase getCodeBase() {
- if (getConnection() == null)
- return null;
- else
- return getConnection().getCodeBase();
- }
-
- // -----------------------------------------------------------
- // Below this point are commented out methods with features
- // from the old stream. We must find ways to address
- // these issues in the future.
- // -----------------------------------------------------------
-
- // XREVISIT
-// private XIIOPInputStream(XIIOPInputStream stream) {
-// super(stream);
-
-// this.conn = stream.conn;
-// this.msg = stream.msg;
-// this.unmarshaledHeader = stream.unmarshaledHeader;
-// }
-
- public CDRInputStream dup() {
- // XREVISIT
- return null;
- // return new XIIOPInputStream(this);
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("CDRInputObject", msg);
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java 2018-01-30 20:16:51.000000000 -0500
+++ /dev/null 2018-01-30 20:16:51.000000000 -0500
@@ -1,544 +0,0 @@
-/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-/**
- * This is delegates to the real implementation.
- *
- * NOTE:
- *
- * Before using the stream for valuetype unmarshaling, one must call
- * performORBVersionSpecificInit().
- */
-public abstract class CDRInputStream
- extends org.omg.CORBA_2_3.portable.InputStream
- implements com.sun.corba.se.impl.encoding.MarshalInputStream,
- org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream
-{
- protected CorbaMessageMediator messageMediator;
- private CDRInputStreamBase impl;
-
- // We can move this out somewhere later. For now, it serves its purpose
- // to create a concrete CDR delegate based on the GIOP version.
- private static class InputStreamFactory {
-
- public static CDRInputStreamBase newInputStream(
- ORB orb, GIOPVersion version, byte encodingVersion) {
- switch(version.intValue()) {
- case GIOPVersion.VERSION_1_0:
- return new CDRInputStream_1_0();
- case GIOPVersion.VERSION_1_1:
- return new CDRInputStream_1_1();
- case GIOPVersion.VERSION_1_2:
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- return
- new IDLJavaSerializationInputStream(encodingVersion);
- }
- return new CDRInputStream_1_2();
- // else fall through and report exception.
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- throw wrapper.unsupportedGiopVersion( version ) ;
- }
- }
- }
-
- // Required for the case when a ClientResponseImpl is
- // created with a SystemException due to a dead server/closed
- // connection with no warning. Note that the stream will
- // not be initialized in this case.
- //
- // Probably also required by ServerRequestImpl.
- //
- // REVISIT.
- public CDRInputStream() {
- }
-
- public CDRInputStream(CDRInputStream is) {
- impl = is.impl.dup();
- impl.setParent(this);
- }
-
- public CDRInputStream(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- GIOPVersion version,
- byte encodingVersion,
- BufferManagerRead bufMgr)
- {
- impl = InputStreamFactory.newInputStream((ORB)orb, version,
- encodingVersion);
-
- impl.init(orb, byteBuffer, size, littleEndian, bufMgr);
-
- impl.setParent(this);
- }
-
- // org.omg.CORBA.portable.InputStream
- public final boolean read_boolean() {
- return impl.read_boolean();
- }
-
- public final char read_char() {
- return impl.read_char();
- }
-
- public final char read_wchar() {
- return impl.read_wchar();
- }
-
- public final byte read_octet() {
- return impl.read_octet();
- }
-
- public final short read_short() {
- return impl.read_short();
- }
-
- public final short read_ushort() {
- return impl.read_ushort();
- }
-
- public final int read_long() {
- return impl.read_long();
- }
-
- public final int read_ulong() {
- return impl.read_ulong();
- }
-
- public final long read_longlong() {
- return impl.read_longlong();
- }
-
- public final long read_ulonglong() {
- return impl.read_ulonglong();
- }
-
- public final float read_float() {
- return impl.read_float();
- }
-
- public final double read_double() {
- return impl.read_double();
- }
-
- public final String read_string() {
- return impl.read_string();
- }
-
- public final String read_wstring() {
- return impl.read_wstring();
- }
-
- public final void read_boolean_array(boolean[] value, int offset, int length) {
- impl.read_boolean_array(value, offset, length);
- }
-
- public final void read_char_array(char[] value, int offset, int length) {
- impl.read_char_array(value, offset, length);
- }
-
- public final void read_wchar_array(char[] value, int offset, int length) {
- impl.read_wchar_array(value, offset, length);
- }
-
- public final void read_octet_array(byte[] value, int offset, int length) {
- impl.read_octet_array(value, offset, length);
- }
-
- public final void read_short_array(short[] value, int offset, int length) {
- impl.read_short_array(value, offset, length);
- }
-
- public final void read_ushort_array(short[] value, int offset, int length) {
- impl.read_ushort_array(value, offset, length);
- }
-
- public final void read_long_array(int[] value, int offset, int length) {
- impl.read_long_array(value, offset, length);
- }
-
- public final void read_ulong_array(int[] value, int offset, int length) {
- impl.read_ulong_array(value, offset, length);
- }
-
- public final void read_longlong_array(long[] value, int offset, int length) {
- impl.read_longlong_array(value, offset, length);
- }
-
- public final void read_ulonglong_array(long[] value, int offset, int length) {
- impl.read_ulonglong_array(value, offset, length);
- }
-
- public final void read_float_array(float[] value, int offset, int length) {
- impl.read_float_array(value, offset, length);
- }
-
- public final void read_double_array(double[] value, int offset, int length) {
- impl.read_double_array(value, offset, length);
- }
-
- public final org.omg.CORBA.Object read_Object() {
- return impl.read_Object();
- }
-
- public final TypeCode read_TypeCode() {
- return impl.read_TypeCode();
- }
- public final Any read_any() {
- return impl.read_any();
- }
-
- public final Principal read_Principal() {
- return impl.read_Principal();
- }
-
- public final int read() throws java.io.IOException {
- return impl.read();
- }
-
- public final java.math.BigDecimal read_fixed() {
- return impl.read_fixed();
- }
-
- public final org.omg.CORBA.Context read_Context() {
- return impl.read_Context();
- }
-
- public final org.omg.CORBA.Object read_Object(java.lang.Class clz) {
- return impl.read_Object(clz);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return impl.orb();
- }
-
- // org.omg.CORBA_2_3.portable.InputStream
- public final java.io.Serializable read_value() {
- return impl.read_value();
- }
-
- public final java.io.Serializable read_value(java.lang.Class clz) {
- return impl.read_value(clz);
- }
-
- public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
- return impl.read_value(factory);
- }
-
- public final java.io.Serializable read_value(java.lang.String rep_id) {
- return impl.read_value(rep_id);
- }
-
- public final java.io.Serializable read_value(java.io.Serializable value) {
- return impl.read_value(value);
- }
-
- public final java.lang.Object read_abstract_interface() {
- return impl.read_abstract_interface();
- }
-
- public final java.lang.Object read_abstract_interface(java.lang.Class clz) {
- return impl.read_abstract_interface(clz);
- }
- // com.sun.corba.se.impl.encoding.MarshalInputStream
-
- public final void consumeEndian() {
- impl.consumeEndian();
- }
-
- public final int getPosition() {
- return impl.getPosition();
- }
-
- // org.omg.CORBA.DataInputStream
-
- public final java.lang.Object read_Abstract () {
- return impl.read_Abstract();
- }
-
- public final java.io.Serializable read_Value () {
- return impl.read_Value();
- }
-
- public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
- impl.read_any_array(seq, offset, length);
- }
-
- public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
- impl.read_boolean_array(seq, offset, length);
- }
-
- public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
- impl.read_char_array(seq, offset, length);
- }
-
- public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
- impl.read_wchar_array(seq, offset, length);
- }
-
- public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
- impl.read_octet_array(seq, offset, length);
- }
-
- public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
- impl.read_short_array(seq, offset, length);
- }
-
- public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
- impl.read_ushort_array(seq, offset, length);
- }
-
- public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
- impl.read_long_array(seq, offset, length);
- }
-
- public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
- impl.read_ulong_array(seq, offset, length);
- }
-
- public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
- impl.read_ulonglong_array(seq, offset, length);
- }
-
- public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
- impl.read_longlong_array(seq, offset, length);
- }
-
- public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
- impl.read_float_array(seq, offset, length);
- }
-
- public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
- impl.read_double_array(seq, offset, length);
- }
-
- // org.omg.CORBA.portable.ValueBase
- public final String[] _truncatable_ids() {
- return impl._truncatable_ids();
- }
-
- // java.io.InputStream
- public final int read(byte b[]) throws IOException {
- return impl.read(b);
- }
-
- public final int read(byte b[], int off, int len) throws IOException {
- return impl.read(b, off, len);
- }
-
- public final long skip(long n) throws IOException {
- return impl.skip(n);
- }
-
- public final int available() throws IOException {
- return impl.available();
- }
-
- public final void close() throws IOException {
- impl.close();
- }
-
- public final void mark(int readlimit) {
- impl.mark(readlimit);
- }
-
- public final void reset() {
- impl.reset();
- }
-
- public final boolean markSupported() {
- return impl.markSupported();
- }
-
- public abstract CDRInputStream dup();
-
- // Needed by TCUtility
- public final java.math.BigDecimal read_fixed(short digits, short scale) {
- return impl.read_fixed(digits, scale);
- }
-
- public final boolean isLittleEndian() {
- return impl.isLittleEndian();
- }
-
- protected final ByteBuffer getByteBuffer() {
- return impl.getByteBuffer();
- }
-
- protected final void setByteBuffer(ByteBuffer byteBuffer) {
- impl.setByteBuffer(byteBuffer);
- }
-
- protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- impl.setByteBufferWithInfo(bbwi);
- }
-
- /**
- * return true if our ByteBuffer is sharing/equal to bb
- */
- protected final boolean isSharing(ByteBuffer bb) {
- return (getByteBuffer() == bb);
- }
-
- public final int getBufferLength() {
- return impl.getBufferLength();
- }
-
- protected final void setBufferLength(int value) {
- impl.setBufferLength(value);
- }
-
- protected final int getIndex() {
- return impl.getIndex();
- }
-
- protected final void setIndex(int value) {
- impl.setIndex(value);
- }
-
- public final void orb(org.omg.CORBA.ORB orb) {
- impl.orb(orb);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return impl.getGIOPVersion();
- }
-
- public final BufferManagerRead getBufferManager() {
- return impl.getBufferManager();
- }
-
- // This should be overridden by any stream (ex: IIOPInputStream)
- // which wants to read values. Thus, TypeCodeInputStream doesn't
- // have to do this.
- public CodeBase getCodeBase() {
- return null;
- }
-
- // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
- // performed.
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1,
- impl.isLittleEndian());
- }
-
- // Subclasses must decide what to do here. It's inconvenient to
- // make the class and this method abstract because of dup().
- protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter();
-
- // Prints the current buffer in a human readable form
- void printBuffer() {
- impl.printBuffer();
- }
-
- /**
- * Aligns the current position on the given octet boundary
- * if there are enough bytes available to do so. Otherwise,
- * it just returns. This is used for some (but not all)
- * GIOP 1.2 message headers.
- */
- public void alignOnBoundary(int octetBoundary) {
- impl.alignOnBoundary(octetBoundary);
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- impl.setHeaderPadding(headerPadding);
- }
-
- /**
- * This must be called after determining the proper ORB version,
- * and setting it on the stream's ORB instance. It can be called
- * after reading the service contexts, since that is the only place
- * we can get the ORB version info.
- *
- * Trying to unmarshal things requiring repository IDs before calling
- * this will result in NullPtrExceptions.
- */
- public void performORBVersionSpecificInit() {
- // In the case of SystemExceptions, a stream is created
- // with its default constructor (and thus no impl is set).
- if (impl != null)
- impl.performORBVersionSpecificInit();
- }
-
- /**
- * Resets any internal references to code set converters.
- * This is useful for forcing the CDR stream to reacquire
- * converters (probably from its subclasses) when state
- * has changed.
- */
- public void resetCodeSetConverters() {
- impl.resetCodeSetConverters();
- }
-
- public void setMessageMediator(MessageMediator messageMediator)
- {
- this.messageMediator = (CorbaMessageMediator) messageMediator;
- }
-
- public MessageMediator getMessageMediator()
- {
- return messageMediator;
- }
-
- // ValueInputStream -----------------------------
-
- public void start_value() {
- impl.start_value();
- }
-
- public void end_value() {
- impl.end_value();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java 2018-01-30 20:16:51.000000000 -0500
+++ /dev/null 2018-01-30 20:16:51.000000000 -0500
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.org.omg.SendingContext.CodeBase;
-
-/**
- * Describes CDRInputStream delegates and provides some
- * implementation. Non-default constructors are avoided in
- * the delegation to separate instantiation from initialization,
- * so we use init methods.
- */
-abstract class CDRInputStreamBase extends java.io.InputStream
-{
- protected CDRInputStream parent;
-
- public void setParent(CDRInputStream parent) {
- this.parent = parent;
- }
-
- public abstract void init(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- BufferManagerRead bufferManager);
-
- // org.omg.CORBA.portable.InputStream
- public abstract boolean read_boolean();
- public abstract char read_char();
- public abstract char read_wchar();
- public abstract byte read_octet();
- public abstract short read_short();
- public abstract short read_ushort();
- public abstract int read_long();
- public abstract int read_ulong();
- public abstract long read_longlong();
- public abstract long read_ulonglong();
- public abstract float read_float();
- public abstract double read_double();
- public abstract String read_string();
- public abstract String read_wstring();
- public abstract void read_boolean_array(boolean[] value, int offset, int length);
- public abstract void read_char_array(char[] value, int offset, int length);
- public abstract void read_wchar_array(char[] value, int offset, int length);
- public abstract void read_octet_array(byte[] value, int offset, int length);
- public abstract void read_short_array(short[] value, int offset, int length);
- public abstract void read_ushort_array(short[] value, int offset, int length);
- public abstract void read_long_array(int[] value, int offset, int length);
- public abstract void read_ulong_array(int[] value, int offset, int length);
- public abstract void read_longlong_array(long[] value, int offset, int length);
- public abstract void read_ulonglong_array(long[] value, int offset, int length);
- public abstract void read_float_array(float[] value, int offset, int length);
- public abstract void read_double_array(double[] value, int offset, int length);
- public abstract org.omg.CORBA.Object read_Object();
- public abstract TypeCode read_TypeCode();
- public abstract Any read_any();
- public abstract Principal read_Principal();
- public int read() throws java.io.IOException {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public abstract java.math.BigDecimal read_fixed();
- public org.omg.CORBA.Context read_Context() {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public abstract org.omg.CORBA.Object read_Object(java.lang.Class clz);
- public abstract org.omg.CORBA.ORB orb();
-
- // org.omg.CORBA_2_3.portable.InputStream
- public abstract java.io.Serializable read_value();
- public abstract java.io.Serializable read_value(java.lang.Class clz);
- public abstract java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory);
- public abstract java.io.Serializable read_value(java.lang.String rep_id);
- public abstract java.io.Serializable read_value(java.io.Serializable value);
- public abstract java.lang.Object read_abstract_interface();
- public abstract java.lang.Object read_abstract_interface(java.lang.Class clz);
-
- // com.sun.corba.se.impl.encoding.MarshalInputStream
- public abstract void consumeEndian();
- public abstract int getPosition();
-
- // org.omg.CORBA.DataInputStream
- public abstract java.lang.Object read_Abstract ();
- public abstract java.io.Serializable read_Value ();
- public abstract void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length);
- public abstract void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length);
- public abstract void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length);
- public abstract void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length);
- public abstract void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length);
- public abstract void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length);
- public abstract void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length);
- public abstract void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length);
- public abstract void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length);
- public abstract void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length);
- public abstract void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length);
- public abstract void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length);
- public abstract void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length);
-
- // org.omg.CORBA.portable.ValueBase
- public abstract String[] _truncatable_ids();
-
- // java.io.InputStream
- // REVISIT - should we make these throw UnsupportedOperationExceptions?
- // Right now, they'll go up to the java.io versions!
-
-// public abstract int read(byte b[]) throws IOException;
-// public abstract int read(byte b[], int off, int len) throws IOException
-// public abstract long skip(long n) throws IOException;
-// public abstract int available() throws IOException;
-// public abstract void close() throws IOException;
- public abstract void mark(int readlimit);
- public abstract void reset();
-
- // This should return false so that outside users (people using the JDK)
- // don't have any guarantees that mark/reset will work in their
- // custom marshaling code. This is necessary since they could do things
- // like expect obj1a == obj1b in the following code:
- //
- // is.mark(10000);
- // Object obj1a = is.readObject();
- // is.reset();
- // Object obj1b = is.readObject();
- //
- public boolean markSupported() { return false; }
-
- // Needed by AnyImpl and ServiceContexts
- public abstract CDRInputStreamBase dup();
-
- // Needed by TCUtility
- public abstract java.math.BigDecimal read_fixed(short digits, short scale);
-
- // Needed by TypeCodeImpl
- public abstract boolean isLittleEndian();
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- abstract void setHeaderPadding(boolean headerPadding);
-
- // Needed by IIOPInputStream and other subclasses
-
- public abstract ByteBuffer getByteBuffer();
- public abstract void setByteBuffer(ByteBuffer byteBuffer);
-
- public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
-
- public abstract int getBufferLength();
- public abstract void setBufferLength(int value);
-
- public abstract int getIndex();
- public abstract void setIndex(int value);
-
- public abstract void orb(org.omg.CORBA.ORB orb);
-
- public abstract BufferManagerRead getBufferManager();
- public abstract GIOPVersion getGIOPVersion();
-
- abstract CodeBase getCodeBase();
-
- abstract void printBuffer();
-
- abstract void alignOnBoundary(int octetBoundary);
-
- abstract void performORBVersionSpecificInit();
-
- public abstract void resetCodeSetConverters();
-
- // ValueInputStream -------------------------
- public abstract void start_value();
- public abstract void end_value();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java 2018-01-30 20:16:52.000000000 -0500
+++ /dev/null 2018-01-30 20:16:52.000000000 -0500
@@ -1,2399 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.OptionalDataException;
-import java.io.IOException;
-
-import java.util.Stack;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.nio.ByteBuffer;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import java.math.BigDecimal;
-
-import java.rmi.Remote;
-import java.rmi.StubNotFoundException;
-
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.ValueBase;
-import org.omg.CORBA.portable.IndirectionException;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.CustomMarshal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.ValueFactory;
-import org.omg.CORBA.portable.CustomValue;
-import org.omg.CORBA.portable.StreamableValue;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.IDLEntity;
-
-import javax.rmi.PortableRemoteObject;
-import javax.rmi.CORBA.Tie;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
-import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.orb.ORBVersion;
-
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-import com.sun.corba.se.impl.corba.PrincipalImpl;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.corba.CORBAObjectImpl;
-
-import com.sun.corba.se.impl.encoding.CDROutputObject;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
-import com.sun.corba.se.impl.orbutil.RepositoryIdInterface;
-import com.sun.corba.se.impl.orbutil.RepositoryIdUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.CacheTable;
-
-
-import com.sun.org.omg.CORBA.portable.ValueHelper;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-public class CDRInputStream_1_0 extends CDRInputStreamBase
- implements RestorableInputStream
-{
- private static final String kReadMethod = "read";
- private static final int maxBlockLength = 0x7fffff00;
-
- protected BufferManagerRead bufferManagerRead;
- protected ByteBufferWithInfo bbwi;
-
- // Set to the ORB's transportDebugFlag value. This value is
- // used if the ORB is null.
- private boolean debug = false;
-
- protected boolean littleEndian;
- protected ORB orb;
- protected ORBUtilSystemException wrapper ;
- protected OMGSystemException omgWrapper ;
- protected ValueHandler valueHandler = null;
-
- // Value cache
- private CacheTable valueCache = null;
-
- // Repository ID cache
- private CacheTable repositoryIdCache = null;
-
- // codebase cache
- private CacheTable codebaseCache = null;
-
- // Current Class Stack (repository Ids of current class being read)
- // private Stack currentStack = null;
-
- // Length of current chunk, or a large positive number if not in a chunk
- protected int blockLength = maxBlockLength;
-
- // Read end flag (value nesting depth)
- protected int end_flag = 0;
-
- // Beginning with the resolution to interop issue 3526 (4328?),
- // only enclosing chunked valuetypes are taken into account
- // when computing the nesting level. However, we still need
- // the old computation around for interoperability with our
- // older ORBs.
- private int chunkedValueNestingLevel = 0;
-
- // Flag used to determine whether blocksize was zero
- // private int checkForNullBlock = -1;
-
- // In block flag
- // private boolean inBlock = false;
-
- // Indicates whether we are inside a value
- // private boolean outerValueDone = true;
-
- // Int used by read_value(Serializable) that is set by this class
- // before calling ValueFactory.read_value
- protected int valueIndirection = 0;
-
- // Int set by readStringOrIndirection to communicate the actual
- // offset of the string length field back to the caller
- protected int stringIndirection = 0;
-
- // Flag indicating whether we are unmarshalling a chunked value
- protected boolean isChunked = false;
-
- // Repository ID handlers
- private RepositoryIdUtility repIdUtil;
- private RepositoryIdStrings repIdStrs;
-
- // Code set converters (created when first needed)
- private CodeSetConversion.BTCConverter charConverter;
- private CodeSetConversion.BTCConverter wcharConverter;
-
- // RMI-IIOP stream format version 2 case in which we know
- // that there is no more optional data available. If the
- // Serializable's readObject method tries to read anything,
- // we must throw a MARSHAL with the special minor code
- // so that the ValueHandler can give the correct exception
- // to readObject. The state is cleared when the ValueHandler
- // calls end_value after the readObject method exits.
- private boolean specialNoOptionalDataState = false;
-
- // Template method
- public CDRInputStreamBase dup()
- {
- CDRInputStreamBase result = null ;
-
- try {
- result = (CDRInputStreamBase)this.getClass().newInstance();
- } catch (Exception e) {
- throw wrapper.couldNotDuplicateCdrInputStream( e ) ;
- }
- result.init(this.orb,
- this.bbwi.byteBuffer,
- this.bbwi.buflen,
- this.littleEndian,
- this.bufferManagerRead);
-
- ((CDRInputStream_1_0)result).bbwi.position(this.bbwi.position());
- // To ensure we keep bbwi.byteBuffer.limit in sync with bbwi.buflen.
- ((CDRInputStream_1_0)result).bbwi.byteBuffer.limit(this.bbwi.buflen);
-
- return result;
- }
-
- /**
- * NOTE: size passed to init means buffer size
- */
- public void init(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- BufferManagerRead bufferManager)
- {
- this.orb = (ORB)orb;
- this.wrapper = ORBUtilSystemException.get( (ORB)orb,
- CORBALogDomains.RPC_ENCODING ) ;
- this.omgWrapper = OMGSystemException.get( (ORB)orb,
- CORBALogDomains.RPC_ENCODING ) ;
- this.littleEndian = littleEndian;
- this.bufferManagerRead = bufferManager;
- this.bbwi = new ByteBufferWithInfo(orb,byteBuffer,0);
- this.bbwi.buflen = size;
- this.bbwi.byteBuffer.limit(bbwi.buflen);
- this.markAndResetHandler = bufferManagerRead.getMarkAndResetHandler();
-
- debug = ((ORB)orb).transportDebugFlag;
- }
-
- // See description in CDRInputStream
- void performORBVersionSpecificInit() {
- createRepositoryIdHandlers();
- }
-
- private final void createRepositoryIdHandlers()
- {
- repIdUtil = RepositoryIdFactory.getRepIdUtility();
- repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_0;
- }
-
- // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only.
- // Illegal for GIOP versions < 1.2.
- void setHeaderPadding(boolean headerPadding) {
- throw wrapper.giopVersionError();
- }
-
- protected final int computeAlignment(int index, int align) {
- if (align > 1) {
- int incr = index & (align - 1);
- if (incr != 0)
- return align - incr;
- }
-
- return 0;
- }
-
- public int getSize()
- {
- return bbwi.position();
- }
-
- protected void checkBlockLength(int align, int dataSize) {
- // Since chunks can end at arbitrary points (though not within
- // primitive CDR types, arrays of primitives, strings, wstrings,
- // or indirections),
- // we must check here for termination of the current chunk.
- if (!isChunked)
- return;
-
- // RMI-IIOP stream format version 2 case in which we know
- // that there is no more optional data available. If the
- // Serializable's readObject method tries to read anything,
- // we must throw a MARSHAL exception with the special minor code
- // so that the ValueHandler can give the correct exception
- // to readObject. The state is cleared when the ValueHandler
- // calls end_value after the readObject method exits.
- if (specialNoOptionalDataState) {
- throw omgWrapper.rmiiiopOptionalDataIncompatible1() ;
- }
-
- boolean checkForEndTag = false;
-
- // Are we at the end of the current chunk? If so,
- // try to interpret the next long as a chunk length.
- // (It has to be either a chunk length, end tag,
- // or valuetag.)
- //
- // If it isn't a chunk length, blockLength will
- // remain set to maxBlockLength.
- if (blockLength == get_offset()) {
-
- blockLength = maxBlockLength;
- start_block();
-
- // What's next is either a valuetag or
- // an end tag. If it's a valuetag, we're
- // probably being called as part of the process
- // to read the valuetag. If it's an end tag,
- // then there isn't enough data left in
- // this valuetype to read!
- if (blockLength == maxBlockLength)
- checkForEndTag = true;
-
- } else
- if (blockLength < get_offset()) {
- // Are we already past the end of the current chunk?
- // This is always an error.
- throw wrapper.chunkOverflow() ;
- }
-
- // If what's next on the wire isn't a chunk length or
- // what we want to read (which can't be split across chunks)
- // won't fit in the current chunk, throw this exception.
- // This probably means that we're in an RMI-IIOP
- // Serializable's readObject method or a custom marshaled
- // IDL type is reading too much/in an incorrect order
- int requiredNumBytes =
- computeAlignment(bbwi.position(), align) + dataSize;
-
- if (blockLength != maxBlockLength &&
- blockLength < get_offset() + requiredNumBytes) {
- throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
- }
-
- // REVISIT - We should look at using the built in advancement
- // of using ByteBuffer.get() rather than explicitly
- // advancing the ByteBuffer's position.
- // This is true for anywhere we are incrementing
- // the ByteBuffer's position.
- if (checkForEndTag) {
- int nextLong = read_long();
- bbwi.position(bbwi.position() - 4);
-
- // It was an end tag, so there wasn't enough data
- // left in the valuetype's encoding on the wire
- // to read what we wanted
- if (nextLong < 0)
- throw omgWrapper.rmiiiopOptionalDataIncompatible3() ;
- }
- }
-
- protected void alignAndCheck(int align, int n) {
-
- checkBlockLength(align, n);
-
- // WARNING: Must compute real alignment after calling
- // checkBlockLength since it may move the position
- int alignResult = computeAlignment(bbwi.position(), align);
- bbwi.position(bbwi.position() + alignResult);
-
- if (bbwi.position() + n > bbwi.buflen)
- grow(align, n);
- }
-
- //
- // This can be overridden....
- //
- protected void grow(int align, int n) {
-
- bbwi.needed = n;
-
- bbwi = bufferManagerRead.underflow(bbwi);
-
- }
-
- //
- // Marshal primitives.
- //
-
- public final void consumeEndian() {
- littleEndian = read_boolean();
- }
-
- // No such type in java
- public final double read_longdouble() {
- throw wrapper.longDoubleNotImplemented( CompletionStatus.COMPLETED_MAYBE);
- }
-
- public final boolean read_boolean() {
- return (read_octet() != 0);
- }
-
- public final char read_char() {
- alignAndCheck(1, 1);
-
- return getConvertedChars(1, getCharConverter())[0];
- }
-
- public char read_wchar() {
-
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB((ORB)orb)) {
- throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
- }
-
- // If we're talking to one of our legacy ORBs, do what
- // they did:
- int b1, b2;
-
- alignAndCheck(2, 2);
-
- if (littleEndian) {
- b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- } else {
- b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
- bbwi.position(bbwi.position() + 1);
- }
-
- return (char)((b1 << 8) + (b2 << 0));
- }
-
- public final byte read_octet() {
-
- alignAndCheck(1, 1);
-
- byte b = bbwi.byteBuffer.get(bbwi.position());
- bbwi.position(bbwi.position() + 1);
-
- return b;
- }
-
- public final short read_short() {
- int b1, b2;
-
- alignAndCheck(2, 2);
-
- if (littleEndian) {
- b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF;
- bbwi.position(bbwi.position() + 1);
- b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00;
- bbwi.position(bbwi.position() + 1);
- } else {
- b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00;
- bbwi.position(bbwi.position() + 1);
- b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF;
- bbwi.position(bbwi.position() + 1);
- }
-
- return (short)(b1 | b2);
- }
-
- public final short read_ushort() {
- return read_short();
- }
-
- public final int read_long() {
- int b1, b2, b3, b4;
-
- alignAndCheck(4, 4);
-
- int bufPos = bbwi.position();
- if (littleEndian) {
- b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- } else {
- b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
- }
- bbwi.position(bufPos);
-
- return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
- }
-
- public final int read_ulong() {
- return read_long();
- }
-
- public final long read_longlong() {
- long i1, i2;
-
- alignAndCheck(8, 8);
-
- if (littleEndian) {
- i2 = read_long() & 0xFFFFFFFFL;
- i1 = (long)read_long() << 32;
- } else {
- i1 = (long)read_long() << 32;
- i2 = read_long() & 0xFFFFFFFFL;
- }
-
- return (i1 | i2);
- }
-
- public final long read_ulonglong() {
- return read_longlong();
- }
-
- public final float read_float() {
- return Float.intBitsToFloat(read_long());
- }
-
- public final double read_double() {
- return Double.longBitsToDouble(read_longlong());
- }
-
- protected final void checkForNegativeLength(int length) {
- if (length < 0)
- throw wrapper.negativeStringLength( CompletionStatus.COMPLETED_MAYBE,
- new Integer(length) ) ;
- }
-
- protected final String readStringOrIndirection(boolean allowIndirection) {
-
- int len = read_long();
-
- //
- // Check for indirection
- //
- if (allowIndirection) {
- if (len == 0xffffffff)
- return null;
- else
- stringIndirection = get_offset() - 4;
- }
-
- checkForNegativeLength(len);
-
- return internalReadString(len);
- }
-
- private final String internalReadString(int len) {
- // Workaround for ORBs which send string lengths of
- // zero to mean empty string.
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- char[] result = getConvertedChars(len - 1, getCharConverter());
-
- // Skip over the 1 byte null
- read_octet();
-
- return new String(result, 0, getCharConverter().getNumChars());
- }
-
- public final String read_string() {
- return readStringOrIndirection(false);
- }
-
- public String read_wstring() {
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB((ORB)orb)) {
- throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
- }
-
- int len = read_long();
-
- //
- // Workaround for ORBs which send string lengths of
- // zero to mean empty string.
- //
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- checkForNegativeLength(len);
-
- len--;
- char[] c = new char[len];
-
- for (int i = 0; i < len; i++)
- c[i] = read_wchar();
-
- // skip the two null terminator bytes
- read_wchar();
- // bbwi.position(bbwi.position() + 2);
-
- return new String(c);
- }
-
- public final void read_octet_array(byte[] b, int offset, int length) {
- if ( b == null )
- throw wrapper.nullParam() ;
-
- // Must call alignAndCheck at least once to ensure
- // we aren't at the end of a chunk. Of course, we
- // should only call it if we actually need to read
- // something, otherwise we might end up with an
- // exception at the end of the stream.
- if (length == 0)
- return;
-
- alignAndCheck(1, 1);
-
- int n = offset;
- while (n < length+offset) {
- int avail;
- int bytes;
- int wanted;
-
- avail = bbwi.buflen - bbwi.position();
- if (avail <= 0) {
- grow(1, 1);
- avail = bbwi.buflen - bbwi.position();
- }
- wanted = (length + offset) - n;
- bytes = (wanted < avail) ? wanted : avail;
- // Microbenchmarks are showing a loop of ByteBuffer.get(int) being
- // faster than ByteBuffer.get(byte[], int, int).
- for (int i = 0; i < bytes; i++) {
- b[n+i] = bbwi.byteBuffer.get(bbwi.position() + i);
- }
-
- bbwi.position(bbwi.position() + bytes);
-
- n += bytes;
- }
- }
-
- public Principal read_Principal() {
- int len = read_long();
- byte[] pvalue = new byte[len];
- read_octet_array(pvalue,0,len);
-
- Principal p = new PrincipalImpl();
- p.name(pvalue);
- return p;
- }
-
- public TypeCode read_TypeCode() {
- TypeCodeImpl tc = new TypeCodeImpl(orb);
- tc.read_value(parent);
- return tc;
- }
-
- public Any read_any() {
- Any any = orb.create_any();
- TypeCodeImpl tc = new TypeCodeImpl(orb);
-
- // read off the typecode
-
- // REVISIT We could avoid this try-catch if we could peek the typecode
- // kind off this stream and see if it is a tk_value. Looking at the
- // code we know that for tk_value the Any.read_value() below
- // ignores the tc argument anyway (except for the kind field).
- // But still we would need to make sure that the whole typecode,
- // including encapsulations, is read off.
- try {
- tc.read_value(parent);
- } catch (MARSHAL ex) {
- if (tc.kind().value() != TCKind._tk_value)
- throw ex;
- // We can be sure that the whole typecode encapsulation has been
- // read off.
- dprintThrowable(ex);
- }
- // read off the value of the any
- any.read_value(parent, tc);
-
- return any;
- }
-
- public org.omg.CORBA.Object read_Object() {
- return read_Object(null);
- }
-
- // ------------ RMI related methods --------------------------
-
- // IDL to Java ptc-00-01-08 1.21.4.1
- //
- // The clz argument to read_Object can be either a stub
- // Class or the "Class object for the RMI/IDL interface type
- // that is statically expected."
- // This functions as follows:
- // 1. If clz==null, just use the repository ID from the stub
- // 2. If clz is a stub class, just use it as a static factory.
- // clz is a stub class iff StubAdapter.isStubClass( clz ).
- // In addition, clz is a IDL stub class iff
- // IDLEntity.class.isAssignableFrom( clz ).
- // 3. If clz is an interface, use it to create the appropriate
- // stub factory.
-
- public org.omg.CORBA.Object read_Object(Class clz)
- {
- // In any case, we must first read the IOR.
- IOR ior = IORFactories.makeIOR(parent) ;
- if (ior.isNil()) {
- return null ;
- }
-
- PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
- String codeBase = ior.getProfile().getCodebase() ;
- PresentationManager.StubFactory stubFactory = null ;
-
- if (clz == null) {
- RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
- String className = rid.getClassName() ;
- orb.validateIORClass(className);
- boolean isIDLInterface = rid.isIDLType() ;
-
- if (className == null || className.equals( "" ))
- stubFactory = null ;
- else
- try {
- stubFactory = sff.createStubFactory( className,
- isIDLInterface, codeBase, (Class)null,
- (ClassLoader)null );
- } catch (Exception exc) {
- // Could not create stubFactory, so use null.
- // XXX stubFactory handling is still too complex:
- // Can we resolve the stubFactory question once in
- // a single place?
- stubFactory = null ;
- }
- } else if (StubAdapter.isStubClass( clz )) {
- stubFactory = PresentationDefaults.makeStaticStubFactory(
- clz ) ;
- } else {
- // clz is an interface class
- boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;
- stubFactory = sff.createStubFactory( clz.getName(),
- isIDL, codeBase, clz, clz.getClassLoader() ) ;
- }
- return internalIORToObject( ior, stubFactory, orb ) ;
- }
-
- /*
- * This is used as a general utility (e.g., the PortableInterceptor
- * implementation uses it. If stubFactory is null, the ior's
- * IIOPProfile must support getServant.
- */
- public static org.omg.CORBA.Object internalIORToObject(
- IOR ior, PresentationManager.StubFactory stubFactory, ORB orb)
- {
- ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- (ORB)orb, CORBALogDomains.RPC_ENCODING ) ;
-
- java.lang.Object servant = ior.getProfile().getServant() ;
- if (servant != null ) {
- if (servant instanceof Tie) {
- String codebase = ior.getProfile().getCodebase();
- org.omg.CORBA.Object objref = (org.omg.CORBA.Object)
- Utility.loadStub( (Tie)servant, stubFactory, codebase,
- false);
-
- // If we managed to load a stub, return it, otherwise we
- // must fail...
- if (objref != null) {
- return objref;
- } else {
- throw wrapper.readObjectException() ;
- }
- } else if (servant instanceof org.omg.CORBA.Object) {
- if (!(servant instanceof
- org.omg.CORBA.portable.InvokeHandler)) {
- return (org.omg.CORBA.Object) servant;
- }
- } else
- throw wrapper.badServantReadObject() ;
- }
-
- CorbaClientDelegate del = ORBUtility.makeClientDelegate( ior ) ;
- org.omg.CORBA.Object objref = null ;
- try {
- objref = stubFactory.makeStub() ;
- } catch (Throwable e) {
- wrapper.stubCreateError( e ) ;
-
- if (e instanceof ThreadDeath) {
- throw (ThreadDeath) e;
- }
-
- // Return the "default" stub...
- objref = new CORBAObjectImpl() ;
- }
-
- StubAdapter.setDelegate( objref, del ) ;
- return objref;
- }
-
- public java.lang.Object read_abstract_interface()
- {
- return read_abstract_interface(null);
- }
-
- public java.lang.Object read_abstract_interface(java.lang.Class clz)
- {
- boolean object = read_boolean();
-
- if (object) {
- return read_Object(clz);
- } else {
- return read_value();
- }
- }
-
- public Serializable read_value()
- {
- return read_value((Class)null);
- }
-
- private Serializable handleIndirection() {
- int indirection = read_long() + get_offset() - 4;
- if (valueCache != null && valueCache.containsVal(indirection)) {
-
- java.io.Serializable cachedValue
- = (java.io.Serializable)valueCache.getKey(indirection);
- return cachedValue;
- } else {
- // In RMI-IIOP the ValueHandler will recognize this
- // exception and use the provided indirection value
- // to lookup a possible indirection to an object
- // currently on the deserialization stack.
- throw new IndirectionException(indirection);
- }
- }
-
- private String readRepositoryIds(int valueTag,
- Class expectedType,
- String expectedTypeRepId) {
- return readRepositoryIds(valueTag, expectedType,
- expectedTypeRepId, null);
- }
-
- /**
- * Examines the valuetag to see how many (if any) repository IDs
- * are present on the wire. If no repository ID information
- * is on the wire but the expectedType or expectedTypeRepId
- * is known, it will return one of those (favoring the
- * expectedType's repId). Failing that, it uses the supplied
- * BoxedValueHelper to obtain the repository ID, as a last resort.
- */
- private String readRepositoryIds(int valueTag,
- Class expectedType,
- String expectedTypeRepId,
- BoxedValueHelper factory) {
- switch(repIdUtil.getTypeInfo(valueTag)) {
- case RepositoryIdUtility.NO_TYPE_INFO :
- // Throw an exception if we have no repository ID info and
- // no expectedType to work with. Otherwise, how would we
- // know what to unmarshal?
- if (expectedType == null) {
- if (expectedTypeRepId != null) {
- return expectedTypeRepId;
- } else if (factory != null) {
- return factory.get_id();
- } else {
- throw wrapper.expectedTypeNullAndNoRepId(
- CompletionStatus.COMPLETED_MAYBE);
- }
- }
- return repIdStrs.createForAnyType(expectedType);
- case RepositoryIdUtility.SINGLE_REP_TYPE_INFO :
- return read_repositoryId();
- case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO :
- return read_repositoryIds();
- default:
- throw wrapper.badValueTag( CompletionStatus.COMPLETED_MAYBE,
- Integer.toHexString(valueTag) ) ;
- }
- }
-
- public Serializable read_value(Class expectedType) {
-
- // Read value tag
- int vType = readValueTag();
-
- // Is value null?
- if (vType == 0)
- return null;
-
- // Is this an indirection to a previously
- // read valuetype?
- if (vType == 0xffffffff)
- return handleIndirection();
-
- // Save where this valuetype started so we
- // can put it in the indirection valueCache
- // later
- int indirection = get_offset() - 4;
-
- // Need to save this special marker variable
- // to restore its value during recursion
- boolean saveIsChunked = isChunked;
-
- isChunked = repIdUtil.isChunkedEncoding(vType);
-
- java.lang.Object value = null;
-
- String codebase_URL = null;
- if (repIdUtil.isCodeBasePresent(vType)) {
- codebase_URL = read_codebase_URL();
- }
-
- // Read repository id(s)
- String repositoryIDString
- = readRepositoryIds(vType, expectedType, null);
-
- // If isChunked was determined to be true based
- // on the valuetag, this will read a chunk length
- start_block();
-
- // Remember that end_flag keeps track of all nested
- // valuetypes and is used for older ORBs
- end_flag--;
- if (isChunked)
- chunkedValueNestingLevel--;
-
- if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) {
- value = read_wstring();
- } else
- if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) {
- // read in the class whether with the old ClassDesc or the
- // new one
- value = readClass();
- } else {
-
- Class valueClass = expectedType;
-
- // By this point, either the expectedType or repositoryIDString
- // is guaranteed to be non-null.
- if (expectedType == null ||
- !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType))) {
-
- valueClass = getClassFromString(repositoryIDString,
- codebase_URL,
- expectedType);
- }
-
- if (valueClass == null) {
- // No point attempting to use value handler below, since the
- // class information is not available.
- throw wrapper.couldNotFindClass(
- CompletionStatus.COMPLETED_MAYBE,
- new ClassNotFoundException());
- }
-
- if (valueClass != null &&
- org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) {
-
- value = readIDLValue(indirection,
- repositoryIDString,
- valueClass,
- codebase_URL);
-
- } else {
-
- // Must be some form of RMI-IIOP valuetype
-
- try {
- if (valueHandler == null)
- valueHandler = ORBUtility.createValueHandler();
-
- value = valueHandler.readValue(parent,
- indirection,
- valueClass,
- repositoryIDString,
- getCodeBase());
-
- } catch(SystemException sysEx) {
- // Just rethrow any CORBA system exceptions
- // that come out of the ValueHandler
- throw sysEx;
- } catch(Exception ex) {
- throw wrapper.valuehandlerReadException(
- CompletionStatus.COMPLETED_MAYBE, ex ) ;
- } catch(Error e) {
- throw wrapper.valuehandlerReadError(
- CompletionStatus.COMPLETED_MAYBE, e ) ;
- }
- }
- }
-
- // Skip any remaining chunks until we get to
- // an end tag or a valuetag. If we see a valuetag,
- // that means there was another valuetype in the sender's
- // version of this class that we need to skip over.
- handleEndOfValue();
-
- // Read and process the end tag if we're chunking.
- // Assumes that we're at the position of the end tag
- // (handleEndOfValue should assure this)
- readEndTag();
-
- // Cache the valuetype that we read
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, indirection);
-
- // Allow for possible continuation chunk.
- // If we're a nested valuetype inside of a chunked
- // valuetype, and that enclosing valuetype has
- // more data to write, it will need to have this
- // new chunk begin after we wrote our end tag.
- isChunked = saveIsChunked;
- start_block();
-
- return (java.io.Serializable)value;
- }
-
- public Serializable read_value(BoxedValueHelper factory) {
-
- // Read value tag
- int vType = readValueTag();
-
- if (vType == 0)
- return null; // value is null
- else if (vType == 0xffffffff) { // Indirection tag
- int indirection = read_long() + get_offset() - 4;
- if (valueCache != null && valueCache.containsVal(indirection))
- {
- java.io.Serializable cachedValue =
- (java.io.Serializable)valueCache.getKey(indirection);
- return cachedValue;
- }
- else {
- throw new IndirectionException(indirection);
- }
- }
- else {
- int indirection = get_offset() - 4;
-
- // end_block();
-
- boolean saveIsChunked = isChunked;
- isChunked = repIdUtil.isChunkedEncoding(vType);
-
- java.lang.Object value = null;
-
- String codebase_URL = null;
- if (repIdUtil.isCodeBasePresent(vType)){
- codebase_URL = read_codebase_URL();
- }
-
- // Read repository id
- String repositoryIDString
- = readRepositoryIds(vType, null, null, factory);
-
- // Compare rep. ids to see if we should use passed helper
- if (!repositoryIDString.equals(factory.get_id()))
- factory = Utility.getHelper(null, codebase_URL, repositoryIDString);
-
- start_block();
- end_flag--;
- if (isChunked)
- chunkedValueNestingLevel--;
-
- if (factory instanceof ValueHelper) {
- value = readIDLValueWithHelper((ValueHelper)factory, indirection);
- } else {
- valueIndirection = indirection; // for callback
- value = factory.read_value(parent);
- }
-
- handleEndOfValue();
- readEndTag();
-
- // Put into valueCache
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, indirection);
-
- // allow for possible continuation chunk
- isChunked = saveIsChunked;
- start_block();
-
- return (java.io.Serializable)value;
- }
- }
-
- private boolean isCustomType(ValueHelper helper) {
- try{
- TypeCode tc = helper.get_type();
- int kind = tc.kind().value();
- if (kind == TCKind._tk_value) {
- return (tc.type_modifier() == org.omg.CORBA.VM_CUSTOM.value);
- }
- } catch(BadKind ex) {
- throw wrapper.badKind(ex) ;
- }
-
- return false;
- }
-
- // This method is actually called indirectly by
- // read_value(String repositoryId).
- // Therefore, it is not a truly independent read call that handles
- // header information itself.
- public java.io.Serializable read_value(java.io.Serializable value) {
-
- // Put into valueCache using valueIndirection
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, valueIndirection);
-
- if (value instanceof StreamableValue)
- ((StreamableValue)value)._read(parent);
- else if (value instanceof CustomValue)
- ((CustomValue)value).unmarshal(parent);
-
- return value;
- }
-
- public java.io.Serializable read_value(java.lang.String repositoryId) {
-
- // if (inBlock)
- // end_block();
-
- // Read value tag
- int vType = readValueTag();
-
- if (vType == 0)
- return null; // value is null
- else if (vType == 0xffffffff) { // Indirection tag
- int indirection = read_long() + get_offset() - 4;
- if (valueCache != null && valueCache.containsVal(indirection))
- {
- java.io.Serializable cachedValue =
- (java.io.Serializable)valueCache.getKey(indirection);
- return cachedValue;
- }
- else {
- throw new IndirectionException(indirection);
- }
- }
- else {
- int indirection = get_offset() - 4;
-
- // end_block();
-
- boolean saveIsChunked = isChunked;
- isChunked = repIdUtil.isChunkedEncoding(vType);
-
- java.lang.Object value = null;
-
- String codebase_URL = null;
- if (repIdUtil.isCodeBasePresent(vType)){
- codebase_URL = read_codebase_URL();
- }
-
- // Read repository id
- String repositoryIDString
- = readRepositoryIds(vType, null, repositoryId);
-
- ValueFactory factory =
- Utility.getFactory(null, codebase_URL, orb, repositoryIDString);
-
- start_block();
- end_flag--;
- if (isChunked)
- chunkedValueNestingLevel--;
-
- valueIndirection = indirection; // for callback
- value = factory.read_value(parent);
-
- handleEndOfValue();
- readEndTag();
-
- // Put into valueCache
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(value, indirection);
-
- // allow for possible continuation chunk
- isChunked = saveIsChunked;
- start_block();
-
- return (java.io.Serializable)value;
- }
- }
-
- private Class readClass() {
-
- String codebases = null, classRepId = null;
-
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- codebases = (String)read_value(java.lang.String.class);
- classRepId = (String)read_value(java.lang.String.class);
- } else {
- // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
- // and codebase strings in the wrong order.
- classRepId = (String)read_value(java.lang.String.class);
- codebases = (String)read_value(java.lang.String.class);
- }
-
- if (debug) {
- dprint("readClass codebases: "
- + codebases
- + " rep Id: "
- + classRepId);
- }
-
- Class cl = null;
-
- RepositoryIdInterface repositoryID
- = repIdStrs.getFromString(classRepId);
-
- try {
- cl = repositoryID.getClassFromType(codebases);
- } catch(ClassNotFoundException cnfe) {
- throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
- cnfe, repositoryID.getClassName() ) ;
- } catch(MalformedURLException me) {
- throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
- me, repositoryID.getClassName(), codebases ) ;
- }
-
- return cl;
- }
-
- private java.lang.Object readIDLValueWithHelper(ValueHelper helper, int indirection)
- {
- // look for two-argument static read method
- Method readMethod;
- try {
- Class argTypes[] = {org.omg.CORBA.portable.InputStream.class, helper.get_class()};
- readMethod = helper.getClass().getDeclaredMethod(kReadMethod, argTypes);
- }
- catch(NoSuchMethodException nsme) { // must be boxed value helper
- java.lang.Object result = helper.read_value(parent);
- return result;
- }
-
- // found two-argument read method, so must be non-boxed value...
- // ...create a blank instance
- java.lang.Object val = null;
- try {
- val = helper.get_class().newInstance();
- } catch(java.lang.InstantiationException ie) {
- throw wrapper.couldNotInstantiateHelper( ie,
- helper.get_class() ) ;
- } catch(IllegalAccessException iae){
- // Value's constructor is protected or private
- //
- // So, use the helper to read the value.
- //
- // NOTE : This means that in this particular case a recursive ref.
- // would fail.
- return helper.read_value(parent);
- }
-
- // add blank instance to cache table
- if (valueCache == null)
- valueCache = new CacheTable(orb,false);
- valueCache.put(val, indirection);
-
- // if custom type, call unmarshal method
- if (val instanceof CustomMarshal && isCustomType(helper)) {
- ((CustomMarshal)val).unmarshal(parent);
- return val;
- }
-
- // call two-argument read method using reflection
- try {
- java.lang.Object args[] = {parent, val};
- readMethod.invoke(helper, args);
- return val;
- } catch(IllegalAccessException iae2) {
- throw wrapper.couldNotInvokeHelperReadMethod( iae2, helper.get_class() ) ;
- } catch(InvocationTargetException ite){
- throw wrapper.couldNotInvokeHelperReadMethod( ite, helper.get_class() ) ;
- }
- }
-
- private java.lang.Object readBoxedIDLEntity(Class clazz, String codebase)
- {
- Class cls = null ;
-
- try {
- ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
-
- cls = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
- clazzLoader, clazz, clazzLoader);
- final Class helperClass = cls ;
-
- final Class argTypes[] = {org.omg.CORBA.portable.InputStream.class};
-
- // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
- // if a different class loader is used (even though the javadoc says otherwise)
- Method readMethod = null;
- try {
- readMethod = (Method)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public java.lang.Object run() throws NoSuchMethodException {
- return helperClass.getDeclaredMethod(kReadMethod, argTypes);
- }
- }
- );
- } catch (PrivilegedActionException pae) {
- // this gets caught below
- throw (NoSuchMethodException)pae.getException();
- }
-
- java.lang.Object args[] = {parent};
- return readMethod.invoke(null, args);
-
- } catch (ClassNotFoundException cnfe) {
- throw wrapper.couldNotInvokeHelperReadMethod( cnfe, cls ) ;
- } catch(NoSuchMethodException nsme) {
- throw wrapper.couldNotInvokeHelperReadMethod( nsme, cls ) ;
- } catch(IllegalAccessException iae) {
- throw wrapper.couldNotInvokeHelperReadMethod( iae, cls ) ;
- } catch(InvocationTargetException ite) {
- throw wrapper.couldNotInvokeHelperReadMethod( ite, cls ) ;
- }
- }
-
- private java.lang.Object readIDLValue(int indirection, String repId,
- Class clazz, String codebase)
- {
- ValueFactory factory ;
-
- // Always try to find a ValueFactory first, as required by the spec.
- // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
- // but basically we must always be able to override the DefaultFactory
- // or Helper mappings that are also used. This appears to be the case
- // even in the boxed value cases. The original code only did the lookup
- // in the case of class implementing either StreamableValue or CustomValue,
- // but abstract valuetypes only implement ValueBase, and really require
- // the use of the repId to find a factory (including the DefaultFactory).
- try {
- // use new-style OBV support (factory object)
- factory = Utility.getFactory(clazz, codebase, orb, repId);
- } catch (MARSHAL marshal) {
- // XXX log marshal at one of the INFO levels
-
- // Could not get a factory, so try alternatives
- if (!StreamableValue.class.isAssignableFrom(clazz) &&
- !CustomValue.class.isAssignableFrom(clazz) &&
- ValueBase.class.isAssignableFrom(clazz)) {
- // use old-style OBV support (helper object)
- BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
- if (helper instanceof ValueHelper)
- return readIDLValueWithHelper((ValueHelper)helper, indirection);
- else
- return helper.read_value(parent);
- } else {
- // must be a boxed IDLEntity, so make a reflective call to the
- // helper's static read method...
- return readBoxedIDLEntity(clazz, codebase);
- }
- }
-
- // If there was no error in getting the factory, use it.
- valueIndirection = indirection; // for callback
- return factory.read_value(parent);
- }
-
- /**
- * End tags are only written for chunked valuetypes.
- *
- * Before Merlin, our ORBs wrote end tags which took into account
- * all enclosing valuetypes. This was changed by an interop resolution
- * (see details around chunkedValueNestingLevel) to only include
- * enclosing chunked types.
- *
- * ORB versioning and end tag compaction are handled here.
- */
- private void readEndTag() {
- if (isChunked) {
-
- // Read the end tag
- int anEndTag = read_long();
-
- // End tags should always be negative, and the outermost
- // enclosing chunked valuetype should have a -1 end tag.
- //
- // handleEndOfValue should have assured that we were
- // at the end tag position!
- if (anEndTag >= 0) {
- throw wrapper.positiveEndTag( CompletionStatus.COMPLETED_MAYBE,
- new Integer(anEndTag), new Integer( get_offset() - 4 ) ) ;
- }
-
- // If the ORB is null, or if we're sure we're talking to
- // a foreign ORB, Merlin, or something more recent, we
- // use the updated end tag computation, and are more strenuous
- // about the values.
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- // If the end tag we read was less than what we were expecting,
- // then the sender must think it's sent more enclosing
- // chunked valuetypes than we have. Throw an exception.
- if (anEndTag < chunkedValueNestingLevel)
- throw wrapper.unexpectedEnclosingValuetype(
- CompletionStatus.COMPLETED_MAYBE, new Integer( anEndTag ),
- new Integer( chunkedValueNestingLevel ) ) ;
-
- // If the end tag is bigger than what we expected, but
- // still negative, then the sender has done some end tag
- // compaction. We back up the stream 4 bytes so that the
- // next time readEndTag is called, it will get down here
- // again. Even with fragmentation, we'll always be able
- // to do this.
- if (anEndTag != chunkedValueNestingLevel) {
- bbwi.position(bbwi.position() - 4);
- }
-
- } else {
-
- // When talking to Kestrel or Ladybird, we use our old
- // end tag rules and are less strict. If the end tag
- // isn't what we expected, we back up, assuming
- // compaction.
- if (anEndTag != end_flag) {
- bbwi.position(bbwi.position() - 4);
- }
- }
-
- // This only keeps track of the enclosing chunked
- // valuetypes
- chunkedValueNestingLevel++;
- }
-
- // This keeps track of all enclosing valuetypes
- end_flag++;
- }
-
- protected int get_offset() {
- return bbwi.position();
- }
-
- private void start_block() {
-
- // if (outerValueDone)
- if (!isChunked)
- return;
-
- // if called from alignAndCheck, need to reset blockLength
- // to avoid an infinite recursion loop on read_long() call
- blockLength = maxBlockLength;
-
- blockLength = read_long();
-
- // Must remember where we began the chunk to calculate how far
- // along we are. See notes above about chunkBeginPos.
-
- if (blockLength > 0 && blockLength < maxBlockLength) {
- blockLength += get_offset(); // _REVISIT_ unsafe, should use a Java long
-
- // inBlock = true;
- } else {
-
- // System.out.println("start_block snooped a " + Integer.toHexString(blockLength));
-
- // not a chunk length field
- blockLength = maxBlockLength;
-
- bbwi.position(bbwi.position() - 4);
- }
- }
-
- // Makes sure that if we were reading a chunked value, we end up
- // at the right place in the stream, no matter how little the
- // unmarshalling code read.
- //
- // After calling this method, if we are chunking, we should be
- // in position to read the end tag.
- private void handleEndOfValue() {
-
- // If we're not chunking, we don't have to worry about
- // skipping remaining chunks or finding end tags
- if (!isChunked)
- return;
-
- // Skip any remaining chunks
- while (blockLength != maxBlockLength) {
- end_block();
- start_block();
- }
-
- // Now look for the end tag
-
- // This is a little wasteful since we're reading
- // this long up to 3 times in the worst cases (once
- // in start_block, once here, and once in readEndTag
- //
- // Peek next long
- int nextLong = read_long();
- bbwi.position(bbwi.position() - 4);
-
- // We did find an end tag, so we're done. readEndTag
- // should take care of making sure it's the correct
- // end tag, etc. Remember that since end tags,
- // chunk lengths, and valuetags have non overlapping
- // ranges, we can tell by the value what the longs are.
- if (nextLong < 0)
- return;
-
- if (nextLong == 0 || nextLong >= maxBlockLength) {
-
- // A custom marshaled valuetype left extra data
- // on the wire, and that data had another
- // nested value inside of it. We've just
- // read the value tag or null of that nested value.
- //
- // In an attempt to get by it, we'll try to call
- // read_value() to get the nested value off of
- // the wire. Afterwards, we must call handleEndOfValue
- // recursively to read any further chunks that the containing
- // valuetype might still have after the nested
- // value.
- read_value();
- handleEndOfValue();
- } else {
- // This probably means that the code to skip chunks has
- // an error, and ended up setting blockLength to something
- // other than maxBlockLength even though we weren't
- // starting a new chunk.
- throw wrapper.couldNotSkipBytes( CompletionStatus.COMPLETED_MAYBE,
- new Integer( nextLong ), new Integer( get_offset() ) ) ;
- }
- }
-
- private void end_block() {
-
- // if in a chunk, check for underflow or overflow
- if (blockLength != maxBlockLength) {
- if (blockLength == get_offset()) {
- // Chunk ended correctly
- blockLength = maxBlockLength;
- } else {
- // Skip over anything left by bad unmarshaling code (ex:
- // a buggy custom unmarshaler). See handleEndOfValue.
- if (blockLength > get_offset()) {
- skipToOffset(blockLength);
- } else {
- throw wrapper.badChunkLength( new Integer( blockLength ),
- new Integer( get_offset() ) ) ;
- }
- }
- }
- }
-
- private int readValueTag(){
- // outerValueDone = false;
- return read_long();
- }
-
- public org.omg.CORBA.ORB orb() {
- return orb;
- }
-
- // ------------ End RMI related methods --------------------------
-
- public final void read_boolean_array(boolean[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_boolean();
- }
- }
-
- public final void read_char_array(char[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_char();
- }
- }
-
- public final void read_wchar_array(char[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_wchar();
- }
- }
-
- public final void read_short_array(short[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_short();
- }
- }
-
- public final void read_ushort_array(short[] value, int offset, int length) {
- read_short_array(value, offset, length);
- }
-
- public final void read_long_array(int[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_long();
- }
- }
-
- public final void read_ulong_array(int[] value, int offset, int length) {
- read_long_array(value, offset, length);
- }
-
- public final void read_longlong_array(long[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_longlong();
- }
- }
-
- public final void read_ulonglong_array(long[] value, int offset, int length) {
- read_longlong_array(value, offset, length);
- }
-
- public final void read_float_array(float[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_float();
- }
- }
-
- public final void read_double_array(double[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_double();
- }
- }
-
- public final void read_any_array(org.omg.CORBA.Any[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_any();
- }
- }
-
- //--------------------------------------------------------------------//
- // CDRInputStream state management.
- //
-
- /**
- * Are we at the end of the input stream?
- */
-// public final boolean isAtEnd() {
-// return bbwi.position() == bbwi.buflen;
-// }
-
-// public int available() throws IOException {
-// return bbwi.buflen - bbwi.position();
-// }
-
- private String read_repositoryIds() {
-
- // Read # of repository ids
- int numRepIds = read_long();
- if (numRepIds == 0xffffffff) {
- int indirection = read_long() + get_offset() - 4;
- if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection))
- return (String)repositoryIdCache.getKey(indirection);
- else
- throw wrapper.unableToLocateRepIdArray( new Integer( indirection ) ) ;
- } else {
-
- // read first array element and store it as an indirection to the whole array
- int indirection = get_offset();
- String repID = read_repositoryId();
- if (repositoryIdCache == null)
- repositoryIdCache = new CacheTable(orb,false);
- repositoryIdCache.put(repID, indirection);
-
- // read and ignore the subsequent array elements, but put them in the
- // indirection table in case there are later indirections back to them
- for (int i = 1; i < numRepIds; i++) {
- read_repositoryId();
- }
-
- return repID;
- }
- }
-
- private final String read_repositoryId()
- {
- String result = readStringOrIndirection(true);
-
- if (result == null) { // Indirection
- int indirection = read_long() + get_offset() - 4;
-
- if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection))
- return (String)repositoryIdCache.getKey(indirection);
- else
- throw wrapper.badRepIdIndirection( CompletionStatus.COMPLETED_MAYBE,
- new Integer(bbwi.position()) ) ;
- } else {
- if (repositoryIdCache == null)
- repositoryIdCache = new CacheTable(orb,false);
- repositoryIdCache.put(result, stringIndirection);
- }
-
- return result ;
- }
-
- private final String read_codebase_URL()
- {
- String result = readStringOrIndirection(true);
-
- if (result == null) { // Indirection
- int indirection = read_long() + get_offset() - 4;
-
- if (codebaseCache != null && codebaseCache.containsVal(indirection))
- return (String)codebaseCache.getKey(indirection);
- else
- throw wrapper.badCodebaseIndirection(
- CompletionStatus.COMPLETED_MAYBE,
- new Integer(bbwi.position()) ) ;
- } else {
- if (codebaseCache == null)
- codebaseCache = new CacheTable(orb,false);
- codebaseCache.put(result, stringIndirection);
- }
-
- return result;
- }
-
- /* DataInputStream methods */
-
- public java.lang.Object read_Abstract () {
- return read_abstract_interface();
- }
-
- public java.io.Serializable read_Value () {
- return read_value();
- }
-
- public void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
- read_any_array(seq.value, offset, length);
- }
-
- public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
- read_boolean_array(seq.value, offset, length);
- }
-
- public void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
- read_char_array(seq.value, offset, length);
- }
-
- public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
- read_wchar_array(seq.value, offset, length);
- }
-
- public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
- read_octet_array(seq.value, offset, length);
- }
-
- public void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
- read_short_array(seq.value, offset, length);
- }
-
- public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
- read_ushort_array(seq.value, offset, length);
- }
-
- public void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
- read_long_array(seq.value, offset, length);
- }
-
- public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
- read_ulong_array(seq.value, offset, length);
- }
-
- public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
- read_ulonglong_array(seq.value, offset, length);
- }
-
- public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
- read_longlong_array(seq.value, offset, length);
- }
-
- public void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
- read_float_array(seq.value, offset, length);
- }
-
- public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
- read_double_array(seq.value, offset, length);
- }
-
- public java.math.BigDecimal read_fixed(short digits, short scale) {
- // digits isn't really needed here
- StringBuffer buffer = read_fixed_buffer();
- if (digits != buffer.length())
- throw wrapper.badFixed( new Integer(digits),
- new Integer(buffer.length()) ) ;
- buffer.insert(digits - scale, '.');
- return new BigDecimal(buffer.toString());
- }
-
- // This method is unable to yield the correct scale.
- public java.math.BigDecimal read_fixed() {
- return new BigDecimal(read_fixed_buffer().toString());
- }
-
- // Each octet contains (up to) two decimal digits.
- // If the fixed type has an odd number of decimal digits, then the representation
- // begins with the first (most significant) digit.
- // Otherwise, this first half-octet is all zero, and the first digit
- // is in the second half-octet.
- // The sign configuration, in the last half-octet of the representation,
- // is 0xD for negative numbers and 0xC for positive and zero values.
- private StringBuffer read_fixed_buffer() {
- StringBuffer buffer = new StringBuffer(64);
- byte doubleDigit;
- int firstDigit;
- int secondDigit;
- boolean wroteFirstDigit = false;
- boolean more = true;
- while (more) {
- doubleDigit = this.read_octet();
- firstDigit = (int)((doubleDigit & 0xf0) >> 4);
- secondDigit = (int)(doubleDigit & 0x0f);
- if (wroteFirstDigit || firstDigit != 0) {
- buffer.append(Character.forDigit(firstDigit, 10));
- wroteFirstDigit = true;
- }
- if (secondDigit == 12) {
- // positive number or zero
- if ( ! wroteFirstDigit) {
- // zero
- return new StringBuffer("0.0");
- } else {
- // positive number
- // done
- }
- more = false;
- } else if (secondDigit == 13) {
- // negative number
- buffer.insert(0, '-');
- more = false;
- } else {
- buffer.append(Character.forDigit(secondDigit, 10));
- wroteFirstDigit = true;
- }
- }
- return buffer;
- }
-
- private final static String _id = "IDL:omg.org/CORBA/DataInputStream:1.0";
- private final static String[] _ids = { _id };
-
- public String[] _truncatable_ids() {
- if (_ids == null)
- return null;
-
- return (String[])_ids.clone();
- }
-
- /* for debugging */
-
- public void printBuffer() {
- CDRInputStream_1_0.printBuffer(this.bbwi);
- }
-
- public static void printBuffer(ByteBufferWithInfo bbwi) {
-
- System.out.println("----- Input Buffer -----");
- System.out.println();
- System.out.println("Current position: " + bbwi.position());
- System.out.println("Total length : " + bbwi.buflen);
- System.out.println();
-
- try {
-
- char[] charBuf = new char[16];
-
- for (int i = 0; i < bbwi.buflen; i += 16) {
-
- int j = 0;
-
- // For every 16 bytes, there is one line
- // of output. First, the hex output of
- // the 16 bytes with each byte separated
- // by a space.
- while (j < 16 && j + i < bbwi.buflen) {
- int k = bbwi.byteBuffer.get(i + j);
- if (k < 0)
- k = 256 + k;
- String hex = Integer.toHexString(k);
- if (hex.length() == 1)
- hex = "0" + hex;
- System.out.print(hex + " ");
- j++;
- }
-
- // Add any extra spaces to align the
- // text column in case we didn't end
- // at 16
- while (j < 16) {
- System.out.print(" ");
- j++;
- }
-
- // Now output the ASCII equivalents. Non-ASCII
- // characters are shown as periods.
- int x = 0;
- while (x < 16 && x + i < bbwi.buflen) {
- if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x)))
- charBuf[x] = (char)bbwi.byteBuffer.get(i + x);
- else
- charBuf[x] = '.';
- x++;
- }
- System.out.println(new String(charBuf, 0, x));
- }
-
- } catch (Throwable t) {
- t.printStackTrace();
- }
-
- System.out.println("------------------------");
- }
-
- public ByteBuffer getByteBuffer() {
- ByteBuffer result = null;
- if (bbwi != null) {
- result = bbwi.byteBuffer;
- }
- return result;
- }
-
- public int getBufferLength() {
- return bbwi.buflen;
- }
-
- public void setBufferLength(int value) {
- bbwi.buflen = value;
- bbwi.byteBuffer.limit(bbwi.buflen);
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- this.bbwi = bbwi;
- }
-
- public void setByteBuffer(ByteBuffer byteBuffer) {
- bbwi.byteBuffer = byteBuffer;
- }
-
- public int getIndex() {
- return bbwi.position();
- }
-
- public void setIndex(int value) {
- bbwi.position(value);
- }
-
- public boolean isLittleEndian() {
- return littleEndian;
- }
-
- public void orb(org.omg.CORBA.ORB orb) {
- this.orb = (ORB)orb;
- }
-
- public BufferManagerRead getBufferManager() {
- return bufferManagerRead;
- }
-
- private void skipToOffset(int offset) {
-
- // Number of bytes to skip
- int len = offset - get_offset();
-
- int n = 0;
-
- while (n < len) {
- int avail;
- int bytes;
- int wanted;
-
- avail = bbwi.buflen - bbwi.position();
- if (avail <= 0) {
- grow(1, 1);
- avail = bbwi.buflen - bbwi.position();
- }
-
- wanted = len - n;
- bytes = (wanted < avail) ? wanted : avail;
- bbwi.position(bbwi.position() + bytes);
- n += bytes;
- }
- }
-
-
- // Mark and reset -------------------------------------------------
-
- protected MarkAndResetHandler markAndResetHandler = null;
-
- protected class StreamMemento
- {
- // These are the fields that may change after marking
- // the stream position, so we need to save them.
- private int blockLength_;
- private int end_flag_;
- private int chunkedValueNestingLevel_;
- private int valueIndirection_;
- private int stringIndirection_;
- private boolean isChunked_;
- private javax.rmi.CORBA.ValueHandler valueHandler_;
- private ByteBufferWithInfo bbwi_;
- private boolean specialNoOptionalDataState_;
-
- public StreamMemento()
- {
- blockLength_ = blockLength;
- end_flag_ = end_flag;
- chunkedValueNestingLevel_ = chunkedValueNestingLevel;
- valueIndirection_ = valueIndirection;
- stringIndirection_ = stringIndirection;
- isChunked_ = isChunked;
- valueHandler_ = valueHandler;
- specialNoOptionalDataState_ = specialNoOptionalDataState;
- bbwi_ = new ByteBufferWithInfo(bbwi);
- }
- }
-
- public java.lang.Object createStreamMemento() {
- return new StreamMemento();
- }
-
- public void restoreInternalState(java.lang.Object streamMemento) {
-
- StreamMemento mem = (StreamMemento)streamMemento;
-
- blockLength = mem.blockLength_;
- end_flag = mem.end_flag_;
- chunkedValueNestingLevel = mem.chunkedValueNestingLevel_;
- valueIndirection = mem.valueIndirection_;
- stringIndirection = mem.stringIndirection_;
- isChunked = mem.isChunked_;
- valueHandler = mem.valueHandler_;
- specialNoOptionalDataState = mem.specialNoOptionalDataState_;
- bbwi = mem.bbwi_;
- }
-
- public int getPosition() {
- return get_offset();
- }
-
- public void mark(int readlimit) {
- markAndResetHandler.mark(this);
- }
-
- public void reset() {
- markAndResetHandler.reset();
- }
-
- // ---------------------------------- end Mark and Reset
-
- // Provides a hook so subclasses of CDRInputStream can provide
- // a CodeBase. This ultimately allows us to grab a Connection
- // instance in IIOPInputStream, the only subclass where this
- // is actually used.
- CodeBase getCodeBase() {
- return parent.getCodeBase();
- }
-
- /**
- * Attempts to find the class described by the given
- * repository ID string and expected type. The first
- * attempt is to find the class locally, falling back
- * on the URL that came with the value. The second
- * attempt is to use a URL from the remote CodeBase.
- */
- private Class getClassFromString(String repositoryIDString,
- String codebaseURL,
- Class expectedType)
- {
- RepositoryIdInterface repositoryID
- = repIdStrs.getFromString(repositoryIDString);
-
- try {
- try {
- // First try to load the class locally, then use
- // the provided URL (if it isn't null)
- return repositoryID.getClassFromType(expectedType,
- codebaseURL);
- } catch (ClassNotFoundException cnfeOuter) {
-
- try {
-
- if (getCodeBase() == null) {
- return null; // class cannot be loaded remotely.
- }
-
- // Get a URL from the remote CodeBase and retry
- codebaseURL = getCodeBase().implementation(repositoryIDString);
-
- // Don't bother trying to find it locally again if
- // we got a null URL
- if (codebaseURL == null)
- return null;
-
- return repositoryID.getClassFromType(expectedType,
- codebaseURL);
- } catch (ClassNotFoundException cnfeInner) {
- dprintThrowable(cnfeInner);
- // Failed to load the class
- return null;
- }
- }
- } catch (MalformedURLException mue) {
- // Always report a bad URL
- throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
- mue, repositoryIDString, codebaseURL ) ;
- }
- }
-
- /**
- * Attempts to find the class described by the given
- * repository ID string. At most, three attempts are made:
- * Try to find it locally, through the provided URL, and
- * finally, via a URL from the remote CodeBase.
- */
- private Class getClassFromString(String repositoryIDString,
- String codebaseURL)
- {
- RepositoryIdInterface repositoryID
- = repIdStrs.getFromString(repositoryIDString);
-
- for (int i = 0; i < 3; i++) {
-
- try {
-
- switch (i)
- {
- case 0:
- // First try to load the class locally
- return repositoryID.getClassFromType();
- case 1:
- // Try to load the class using the provided
- // codebase URL (falls out below)
- break;
- case 2:
- // Try to load the class using a URL from the
- // remote CodeBase
- codebaseURL = getCodeBase().implementation(repositoryIDString);
- break;
- }
-
- // Don't bother if the codebaseURL is null
- if (codebaseURL == null)
- continue;
-
- return repositoryID.getClassFromType(codebaseURL);
-
- } catch(ClassNotFoundException cnfe) {
- // Will ultimately return null if all three
- // attempts fail, but don't do anything here.
- } catch (MalformedURLException mue) {
- throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
- mue, repositoryIDString, codebaseURL ) ;
- }
- }
-
- // If we get here, we have failed to load the class
- dprint("getClassFromString failed with rep id "
- + repositoryIDString
- + " and codebase "
- + codebaseURL);
-
- return null;
- }
-
- // Utility method used to get chars from bytes
- char[] getConvertedChars(int numBytes,
- CodeSetConversion.BTCConverter converter) {
-
- // REVISIT - Look at CodeSetConversion.BTCConverter to see
- // if it can work with an NIO ByteBuffer. We should
- // avoid getting the bytes into an array if possible.
-
- // To be honest, I doubt this saves much real time
- if (bbwi.buflen - bbwi.position() >= numBytes) {
- // If the entire string is in this buffer,
- // just convert directly from the bbwi rather than
- // allocating and copying.
- byte[] tmpBuf;
- if (bbwi.byteBuffer.hasArray())
- {
- tmpBuf = bbwi.byteBuffer.array();
- }
- else
- {
- tmpBuf = new byte[bbwi.buflen];
- // Microbenchmarks are showing a loop of ByteBuffer.get(int)
- // being faster than ByteBuffer.get(byte[], int, int).
- for (int i = 0; i < bbwi.buflen; i++)
- tmpBuf[i] = bbwi.byteBuffer.get(i);
- }
- char[] result = converter.getChars(tmpBuf,bbwi.position(),numBytes);
-
- bbwi.position(bbwi.position() + numBytes);
- return result;
- } else {
- // Stretches across buffers. Unless we provide an
- // incremental conversion interface, allocate and
- // copy the bytes.
- byte[] bytes = new byte[numBytes];
- read_octet_array(bytes, 0, bytes.length);
-
- return converter.getChars(bytes, 0, numBytes);
- }
- }
-
- protected CodeSetConversion.BTCConverter getCharConverter() {
- if (charConverter == null)
- charConverter = parent.createCharBTCConverter();
-
- return charConverter;
- }
-
- protected CodeSetConversion.BTCConverter getWCharConverter() {
- if (wcharConverter == null)
- wcharConverter = parent.createWCharBTCConverter();
-
- return wcharConverter;
- }
-
- protected void dprintThrowable(Throwable t) {
- if (debug && t != null)
- t.printStackTrace();
- }
-
- protected void dprint(String msg) {
- if (debug) {
- ORBUtility.dprint(this, msg);
- }
- }
-
- /**
- * Aligns the current position on the given octet boundary
- * if there are enough bytes available to do so. Otherwise,
- * it just returns. This is used for some (but not all)
- * GIOP 1.2 message headers.
- */
-
- void alignOnBoundary(int octetBoundary) {
- int needed = computeAlignment(bbwi.position(), octetBoundary);
-
- if (bbwi.position() + needed <= bbwi.buflen)
- {
- bbwi.position(bbwi.position() + needed);
- }
- }
-
- public void resetCodeSetConverters() {
- charConverter = null;
- wcharConverter = null;
- }
-
- public void start_value() {
- // Read value tag
- int vType = readValueTag();
-
- if (vType == 0) {
- // Stream needs to go into a state where it
- // throws standard exception until end_value
- // is called. This means the sender didn't
- // send any custom data. If the reader here
- // tries to read more, we need to throw an
- // exception before reading beyond where
- // we're supposed to
- specialNoOptionalDataState = true;
-
- return;
- }
-
- if (vType == 0xffffffff) {
- // One should never indirect to a custom wrapper
- throw wrapper.customWrapperIndirection(
- CompletionStatus.COMPLETED_MAYBE);
- }
-
- if (repIdUtil.isCodeBasePresent(vType)) {
- throw wrapper.customWrapperWithCodebase(
- CompletionStatus.COMPLETED_MAYBE);
- }
-
- if (repIdUtil.getTypeInfo(vType)
- != RepositoryIdUtility.SINGLE_REP_TYPE_INFO) {
- throw wrapper.customWrapperNotSingleRepid(
- CompletionStatus.COMPLETED_MAYBE);
- }
-
-
- // REVISIT - Could verify repository ID even though
- // it isn't used elsewhere
- read_repositoryId();
-
- // Note: isChunked should be true here. Should have
- // been set to true in the containing value's read_value
- // method.
-
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- }
-
- public void end_value() {
-
- if (specialNoOptionalDataState) {
- specialNoOptionalDataState = false;
- return;
- }
-
- handleEndOfValue();
- readEndTag();
-
- // Note that isChunked should still be true here.
- // If the containing valuetype is the highest
- // chunked value, it will get set to false
- // at the end of read_value.
-
- // allow for possible continuation chunk
- start_block();
- }
-
- public void close() throws IOException
- {
-
- // tell BufferManagerRead to release any ByteBuffers
- getBufferManager().close(bbwi);
-
- // It's possible bbwi.byteBuffer is shared between
- // this InputStream and an OutputStream. Thus, we check
- // if the Input/Output streams are using the same ByteBuffer.
- // If they sharing the same ByteBuffer we need to ensure only
- // one of those ByteBuffers are released to the ByteBufferPool.
-
- if (bbwi != null && getByteBuffer() != null)
- {
- MessageMediator messageMediator = parent.getMessageMediator();
- if (messageMediator != null)
- {
- CDROutputObject outputObj =
- (CDROutputObject)messageMediator.getOutputObject();
- if (outputObj != null)
- {
- if (outputObj.isSharing(getByteBuffer()))
- {
- // Set OutputStream's ByteBuffer and bbwi to null
- // so its ByteBuffer cannot be released to the pool
- outputObj.setByteBuffer(null);
- outputObj.setByteBufferWithInfo(null);
- }
- }
- }
-
- // release this stream's ByteBuffer to the pool
- ByteBufferPool byteBufferPool = orb.getByteBufferPool();
- if (debug)
- {
- // print address of ByteBuffer being released
- int bbAddress = System.identityHashCode(bbwi.byteBuffer);
- StringBuffer sb = new StringBuffer(80);
- sb.append(".close - releasing ByteBuffer id (");
- sb.append(bbAddress).append(") to ByteBufferPool.");
- String msg = sb.toString();
- dprint(msg);
- }
- byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
- bbwi.byteBuffer = null;
- bbwi = null;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java 2018-01-30 20:16:53.000000000 -0500
+++ /dev/null 2018-01-30 20:16:53.000000000 -0500
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-public class CDRInputStream_1_1 extends CDRInputStream_1_0
-{
- // See notes in CDROutputStream
- protected int fragmentOffset = 0;
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_1;
- }
-
- // Template method
- public CDRInputStreamBase dup() {
- CDRInputStreamBase result = super.dup();
-
- ((CDRInputStream_1_1)result).fragmentOffset = this.fragmentOffset;
-
- return result;
- }
-
- protected int get_offset() {
- return bbwi.position() + fragmentOffset;
- }
-
- protected void alignAndCheck(int align, int n) {
-
-
- checkBlockLength(align, n);
-
- // WARNING: Must compute real alignment after calling
- // checkBlockLength since it may move the position
- int alignment = computeAlignment(bbwi.position(), align);
-
- if (bbwi.position() + n + alignment > bbwi.buflen) {
-
- // Some other ORBs may have found a way to send 1.1
- // fragments which put alignment bytes at the end
- // of a fragment
- if (bbwi.position() + alignment == bbwi.buflen)
- {
- bbwi.position(bbwi.position() + alignment);
- }
-
- grow(align, n);
-
- // We must recalculate the alignment after a possible
- // fragmentation since the new bbwi.position() (after the header)
- // may require a different alignment.
-
- alignment = computeAlignment(bbwi.position(), align);
- }
-
- bbwi.position(bbwi.position() + alignment);
- }
-
- //
- // This can be overridden....
- //
- protected void grow(int align, int n) {
-
- bbwi.needed = n;
-
- // Save the size of the current buffer for
- // possible fragmentOffset calculation
- int oldSize = bbwi.position();
-
- bbwi = bufferManagerRead.underflow(bbwi);
-
- if (bbwi.fragmented) {
-
- // By this point we should be guaranteed to have
- // a new fragment whose header has already been
- // unmarshalled. bbwi.position() should point to the
- // end of the header.
- fragmentOffset += (oldSize - bbwi.position());
-
- markAndResetHandler.fragmentationOccured(bbwi);
-
- // Clear the flag
- bbwi.fragmented = false;
- }
- }
-
- // Mark/reset ---------------------------------------
-
- private class FragmentableStreamMemento extends StreamMemento
- {
- private int fragmentOffset_;
-
- public FragmentableStreamMemento()
- {
- super();
-
- fragmentOffset_ = fragmentOffset;
- }
- }
-
- public java.lang.Object createStreamMemento() {
- return new FragmentableStreamMemento();
- }
-
- public void restoreInternalState(java.lang.Object streamMemento)
- {
- super.restoreInternalState(streamMemento);
-
- fragmentOffset
- = ((FragmentableStreamMemento)streamMemento).fragmentOffset_;
- }
-
- // --------------------------------------------------
-
- public char read_wchar() {
- // In GIOP 1.1, interoperability with wchar is limited
- // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6.
- // WARNING: For UTF-16, this means that there can be no
- // byte order marker, so it must default to big endian!
- alignAndCheck(2, 2);
-
- // Because of the alignAndCheck, we should be guaranteed
- // 2 bytes of real data.
- char[] result = getConvertedChars(2, getWCharConverter());
-
- // Did the provided bytes convert to more than one
- // character? This may come up as more unicode values are
- // assigned, and a single 16 bit Java char isn't enough.
- // Better to use strings for i18n purposes.
- if (getWCharConverter().getNumChars() > 1)
- throw wrapper.btcResultMoreThanOneChar() ;
-
- return result[0];
- }
-
- public String read_wstring() {
- // In GIOP 1.1, interoperability with wchar is limited
- // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6.
- int len = read_long();
-
- // Workaround for ORBs which send string lengths of
- // zero to mean empty string.
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- checkForNegativeLength(len);
-
- // Don't include the two byte null for the
- // following computations. Remember that since we're limited
- // to a 2 byte fixed width code set, the "length" was the
- // number of such 2 byte code points plus a 2 byte null.
- len = len - 1;
-
- char[] result = getConvertedChars(len * 2, getWCharConverter());
-
- // Skip over the 2 byte null
- read_short();
-
- return new String(result, 0, getWCharConverter().getNumChars());
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java 2018-01-30 20:16:53.000000000 -0500
+++ /dev/null 2018-01-30 20:16:53.000000000 -0500
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-public class CDRInputStream_1_2 extends CDRInputStream_1_1
-{
- // Indicates whether the header is padded. In GIOP 1.2 and above,
- // the body must be aligned on an 8-octet boundary, and so the header is
- // padded appropriately. However, if there is no body to a request or reply
- // message, there is no header padding, in the unfragmented case.
- protected boolean headerPadding;
-
- // used to remember headerPadding flag when mark() and restore() are used.
- protected boolean restoreHeaderPadding;
-
- // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only.
- void setHeaderPadding(boolean headerPadding) {
- this.headerPadding = headerPadding;
- }
-
- // the mark and reset methods have been overridden to remember the
- // headerPadding flag.
-
- public void mark(int readlimit) {
- super.mark(readlimit);
- restoreHeaderPadding = headerPadding;
- }
-
- public void reset() {
- super.reset();
- headerPadding = restoreHeaderPadding;
- restoreHeaderPadding = false;
- }
-
- // Template method
- // This method has been overriden to ensure that the duplicated stream
- // inherits the headerPadding flag, in case of GIOP 1.2 and above, streams.
- public CDRInputStreamBase dup() {
- CDRInputStreamBase result = super.dup();
- ((CDRInputStream_1_2)result).headerPadding = this.headerPadding;
- return result;
- }
-
- protected void alignAndCheck(int align, int n) {
-
- // headerPadding bit is set by read method of the RequestMessage_1_2
- // or ReplyMessage_1_2 classes. When set, the very first body read
- // operation (from the stub code) would trigger an alignAndCheck
- // method call, that would in turn skip the header padding that was
- // inserted during the earlier write operation by the sender. The
- // padding ensures that the body is aligned on an 8-octet boundary,
- // for GIOP versions 1.2 and beyond.
- if (headerPadding == true) {
- headerPadding = false;
- alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
- }
-
- checkBlockLength(align, n);
-
- // WARNING: Must compute real alignment after calling
- // checkBlockLength since it may move the position
-
- // In GIOP 1.2, a fragment may end with some alignment
- // padding (which leads to all fragments ending perfectly
- // on evenly divisible 8 byte boundaries). A new fragment
- // never requires alignment with the header since it ends
- // on an 8 byte boundary.
-
- int alignIncr = computeAlignment(bbwi.position(),align);
- bbwi.position(bbwi.position() + alignIncr);
-
- if (bbwi.position() + n > bbwi.buflen) {
- grow(1, n);
- }
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- public char read_wchar() {
- // In GIOP 1.2, a wchar is encoded as an unsigned octet length
- // followed by the octets of the converted wchar.
- int numBytes = read_octet();
-
- char[] result = getConvertedChars(numBytes, getWCharConverter());
-
- // Did the provided bytes convert to more than one
- // character? This may come up as more unicode values are
- // assigned, and a single 16 bit Java char isn't enough.
- // Better to use strings for i18n purposes.
- if (getWCharConverter().getNumChars() > 1)
- throw wrapper.btcResultMoreThanOneChar() ;
-
- return result[0];
- }
-
- public String read_wstring() {
- // In GIOP 1.2, wstrings are not terminated by a null. The
- // length is the number of octets in the converted format.
- // A zero length string is represented with the 4 byte length
- // value of 0.
-
- int len = read_long();
-
- //
- // IMPORTANT: Do not replace 'new String("")' with "", it may result
- // in a Serialization bug (See serialization.zerolengthstring) and
- // bug id: 4728756 for details
- if (len == 0)
- return new String("");
-
- checkForNegativeLength(len);
-
- return new String(getConvertedChars(len, getWCharConverter()),
- 0,
- getWCharConverter().getNumChars());
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java 2018-01-30 20:16:54.000000000 -0500
+++ /dev/null 2018-01-30 20:16:54.000000000 -0500
@@ -1,323 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.InputStream;
-
-import com.sun.corba.se.pept.encoding.OutputObject;
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.encoding.CorbaOutputObject ;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream_1_0;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-/**
- * @author Harold Carr
- */
-public class CDROutputObject extends CorbaOutputObject
-{
- private Message header;
- private ORB orb;
- private ORBUtilSystemException wrapper;
- private OMGSystemException omgWrapper;
-
- // REVISIT - only used on sendCancelRequest.
- private CorbaConnection connection;
-
- private CDROutputObject(
- ORB orb, GIOPVersion giopVersion, Message header,
- BufferManagerWrite manager, byte streamFormatVersion,
- CorbaMessageMediator mediator)
- {
- super(orb, giopVersion, header.getEncodingVersion(),
- false, manager, streamFormatVersion,
- ((mediator != null && mediator.getConnection() != null) ?
- ((CorbaConnection)mediator.getConnection()).
- shouldUseDirectByteBuffers() : false));
-
- this.header = header;
- this.orb = orb;
- this.wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
- this.omgWrapper = OMGSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
-
- getBufferManager().setOutputObject(this);
- this.corbaMessageMediator = mediator;
- }
-
- public CDROutputObject(ORB orb,
- MessageMediator messageMediator,
- Message header,
- byte streamFormatVersion)
- {
- this(
- orb,
- ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
- header,
- BufferManagerFactory.newBufferManagerWrite(
- ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
- header.getEncodingVersion(),
- orb),
- streamFormatVersion,
- (CorbaMessageMediator)messageMediator);
- }
-
- // NOTE:
- // Used in SharedCDR (i.e., must be grow).
- // Used in msgtypes test.
- public CDROutputObject(ORB orb,
- MessageMediator messageMediator,
- Message header,
- byte streamFormatVersion,
- int strategy)
- {
- this(
- orb,
- ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
- header,
- BufferManagerFactory.
- newBufferManagerWrite(strategy,
- header.getEncodingVersion(),
- orb),
- streamFormatVersion,
- (CorbaMessageMediator)messageMediator);
- }
-
- // REVISIT
- // Used on sendCancelRequest.
- // Used for needs addressing mode.
- public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
- GIOPVersion giopVersion,
- CorbaConnection connection, Message header,
- byte streamFormatVersion)
- {
- this(
- orb,
- giopVersion,
- header,
- BufferManagerFactory.
- newBufferManagerWrite(giopVersion,
- header.getEncodingVersion(),
- orb),
- streamFormatVersion,
- mediator);
- this.connection = connection ;
- }
-
- // XREVISIT
- // Header should only be in message mediator.
- // Another possibility: merge header and message mediator.
- // REVISIT - make protected once all encoding together
- public Message getMessageHeader() {
- return header;
- }
-
- public final void finishSendingMessage() {
- getBufferManager().sendMessage();
- }
-
- /**
- * Write the contents of the CDROutputStream to the specified
- * output stream. Has the side-effect of pushing any current
- * Message onto the Message list.
- * @param connection The output stream to write to.
- */
- public void writeTo(CorbaConnection connection)
- throws java.io.IOException
- {
-
- //
- // Update the GIOP MessageHeader size field.
- //
-
- ByteBufferWithInfo bbwi = getByteBufferWithInfo();
-
- getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
-
- if (orb() != null) {
- if (((ORB)orb()).transportDebugFlag) {
- dprint(".writeTo: " + connection);
- }
- if (((ORB)orb()).giopDebugFlag) {
- CDROutputStream_1_0.printBuffer(bbwi);
- }
- }
- bbwi.byteBuffer.position(0).limit(bbwi.getSize());
- connection.write(bbwi.byteBuffer);
- }
-
- /** overrides create_input_stream from CDROutputStream */
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- // XREVISIT
- return null;
- //return new XIIOPInputStream(orb(), getByteBuffer(), getIndex(),
- //isLittleEndian(), getMessageHeader(), conn);
- }
-
- public CorbaConnection getConnection()
- {
- // REVISIT - only set when doing sendCancelRequest.
- if (connection != null) {
- return connection;
- }
- return (CorbaConnection) corbaMessageMediator.getConnection();
- }
-
- // XREVISIT - If CDROutputObject doesn't live in the iiop
- // package, it will need this, here, to give package access
- // to xgiop.
- // REVISIT - make protected once all encoding together
- public final ByteBufferWithInfo getByteBufferWithInfo() {
- return super.getByteBufferWithInfo();
- }
-
- // REVISIT - make protected once all encoding together
- public final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- super.setByteBufferWithInfo(bbwi);
- }
-
- /**
- * Override the default CDR factory behavior to get the
- * negotiated code sets from the connection.
- *
- * These are only called once per message, the first time needed.
- *
- * In the local case, there is no Connection, so use the
- * local code sets.
- */
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, fall back on the defaults defined
- // in CDRInputStream.
- if (codesets == null)
- return super.createCharCTBConverter();
-
- OSFCodeSetRegistry.Entry charSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());
-
- if (charSet == null)
- throw wrapper.unknownCodeset( charSet ) ;
-
- return CodeSetConversion.impl().getCTBConverter(charSet,
- isLittleEndian(),
- false);
- }
-
- protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
-
- CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
-
- // If the connection doesn't have its negotiated
- // code sets by now, we have to throw an exception.
- // See CORBA formal 00-11-03 13.9.2.6.
- if (codesets == null) {
- if (getConnection().isServer())
- throw omgWrapper.noClientWcharCodesetCtx() ;
- else
- throw omgWrapper.noServerWcharCodesetCmp() ;
- }
-
- OSFCodeSetRegistry.Entry wcharSet
- = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());
-
- if (wcharSet == null)
- throw wrapper.unknownCodeset( wcharSet ) ;
-
- boolean useByteOrderMarkers
- = ((ORB)orb()).getORBData().useByteOrderMarkers();
-
- // With UTF-16:
- //
- // For GIOP 1.2, we can put byte order markers if we want to, and
- // use the default of big endian otherwise. (See issue 3405b)
- //
- // For GIOP 1.1, we don't use BOMs and use the endianness of
- // the stream.
- if (wcharSet == OSFCodeSetRegistry.UTF_16) {
- if (getGIOPVersion().equals(GIOPVersion.V1_2)) {
- return CodeSetConversion.impl().getCTBConverter(wcharSet,
- false,
- useByteOrderMarkers);
- }
-
- if (getGIOPVersion().equals(GIOPVersion.V1_1)) {
- return CodeSetConversion.impl().getCTBConverter(wcharSet,
- isLittleEndian(),
- false);
- }
- }
-
- // In the normal case, let the converter system handle it
- return CodeSetConversion.impl().getCTBConverter(wcharSet,
- isLittleEndian(),
- useByteOrderMarkers);
- }
-
- // If we're local and don't have a Connection, use the
- // local code sets, otherwise get them from the connection.
- // If the connection doesn't have negotiated code sets
- // yet, then we use ISO8859-1 for char/string and wchar/wstring
- // are illegal.
- private CodeSetComponentInfo.CodeSetContext getCodeSets() {
- if (getConnection() == null)
- return CodeSetComponentInfo.LOCAL_CODE_SETS;
- else
- return getConnection().getCodeSetContext();
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("CDROutputObject", msg);
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java 2018-01-30 20:16:55.000000000 -0500
+++ /dev/null 2018-01-30 20:16:55.000000000 -0500
@@ -1,438 +0,0 @@
-/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-/**
- * This is delegates to the real implementation.
- */
-public abstract class CDROutputStream
- extends org.omg.CORBA_2_3.portable.OutputStream
- implements com.sun.corba.se.impl.encoding.MarshalOutputStream,
- org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream
-{
- private CDROutputStreamBase impl;
- protected ORB orb ;
- protected ORBUtilSystemException wrapper ;
- protected CorbaMessageMediator corbaMessageMediator;
-
-
- // We can move this out somewhere later. For now, it serves its purpose
- // to create a concrete CDR delegate based on the GIOP version.
- private static class OutputStreamFactory {
-
- public static CDROutputStreamBase newOutputStream(
- ORB orb, GIOPVersion version, byte encodingVersion) {
- switch(version.intValue()) {
- case GIOPVersion.VERSION_1_0:
- return new CDROutputStream_1_0();
- case GIOPVersion.VERSION_1_1:
- return new CDROutputStream_1_1();
- case GIOPVersion.VERSION_1_2:
- if (encodingVersion != Message.CDR_ENC_VERSION) {
- return
- new IDLJavaSerializationOutputStream(encodingVersion);
- }
- return new CDROutputStream_1_2();
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- // REVISIT - what is appropriate? INTERNAL exceptions
- // are really hard to track later.
- throw wrapper.unsupportedGiopVersion( version ) ;
- }
- }
- }
-
- // REVISIT - These two constructors should be re-factored to better hide
- // the fact that someone extending this class 'can' construct a CDROutputStream
- // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream
- // does _not_ use pooled ByteBuffers, see EncapsOutputStream.
-
- // NOTE: When a stream is constructed for non-channel-backed sockets
- // it notifies the constructor not to use pooled (i.e, direct)
- // ByteBuffers.
-
- public CDROutputStream(ORB orb,
- GIOPVersion version,
- byte encodingVersion,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers)
- {
- impl = OutputStreamFactory.newOutputStream(orb, version,
- encodingVersion);
- impl.init(orb, littleEndian, bufferManager,
- streamFormatVersion, usePooledByteBuffers);
-
- impl.setParent(this);
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- }
-
- public CDROutputStream(ORB orb,
- GIOPVersion version,
- byte encodingVersion,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion)
- {
- this(orb, version, encodingVersion, littleEndian,
- bufferManager, streamFormatVersion, true);
- }
-
- // org.omg.CORBA.portable.OutputStream
-
- // Provided by IIOPOutputStream and EncapsOutputStream
- public abstract org.omg.CORBA.portable.InputStream create_input_stream();
-
- public final void write_boolean(boolean value) {
- impl.write_boolean(value);
- }
- public final void write_char(char value) {
- impl.write_char(value);
- }
- public final void write_wchar(char value) {
- impl.write_wchar(value);
- }
- public final void write_octet(byte value) {
- impl.write_octet(value);
- }
- public final void write_short(short value) {
- impl.write_short(value);
- }
- public final void write_ushort(short value) {
- impl.write_ushort(value);
- }
- public final void write_long(int value) {
- impl.write_long(value);
- }
- public final void write_ulong(int value) {
- impl.write_ulong(value);
- }
- public final void write_longlong(long value) {
- impl.write_longlong(value);
- }
- public final void write_ulonglong(long value) {
- impl.write_ulonglong(value);
- }
- public final void write_float(float value) {
- impl.write_float(value);
- }
- public final void write_double(double value) {
- impl.write_double(value);
- }
- public final void write_string(String value) {
- impl.write_string(value);
- }
- public final void write_wstring(String value) {
- impl.write_wstring(value);
- }
-
- public final void write_boolean_array(boolean[] value, int offset, int length) {
- impl.write_boolean_array(value, offset, length);
- }
- public final void write_char_array(char[] value, int offset, int length) {
- impl.write_char_array(value, offset, length);
- }
- public final void write_wchar_array(char[] value, int offset, int length) {
- impl.write_wchar_array(value, offset, length);
- }
- public final void write_octet_array(byte[] value, int offset, int length) {
- impl.write_octet_array(value, offset, length);
- }
- public final void write_short_array(short[] value, int offset, int length) {
- impl.write_short_array(value, offset, length);
- }
- public final void write_ushort_array(short[] value, int offset, int length){
- impl.write_ushort_array(value, offset, length);
- }
- public final void write_long_array(int[] value, int offset, int length) {
- impl.write_long_array(value, offset, length);
- }
- public final void write_ulong_array(int[] value, int offset, int length) {
- impl.write_ulong_array(value, offset, length);
- }
- public final void write_longlong_array(long[] value, int offset, int length) {
- impl.write_longlong_array(value, offset, length);
- }
- public final void write_ulonglong_array(long[] value, int offset,int length) {
- impl.write_ulonglong_array(value, offset, length);
- }
- public final void write_float_array(float[] value, int offset, int length) {
- impl.write_float_array(value, offset, length);
- }
- public final void write_double_array(double[] value, int offset, int length) {
- impl.write_double_array(value, offset, length);
- }
- public final void write_Object(org.omg.CORBA.Object value) {
- impl.write_Object(value);
- }
- public final void write_TypeCode(TypeCode value) {
- impl.write_TypeCode(value);
- }
- public final void write_any(Any value) {
- impl.write_any(value);
- }
-
- public final void write_Principal(Principal value) {
- impl.write_Principal(value);
- }
-
- public final void write(int b) throws java.io.IOException {
- impl.write(b);
- }
-
- public final void write_fixed(java.math.BigDecimal value) {
- impl.write_fixed(value);
- }
-
- public final void write_Context(org.omg.CORBA.Context ctx,
- org.omg.CORBA.ContextList contexts) {
- impl.write_Context(ctx, contexts);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return impl.orb();
- }
-
- // org.omg.CORBA_2_3.portable.OutputStream
- public final void write_value(java.io.Serializable value) {
- impl.write_value(value);
- }
-
- public final void write_value(java.io.Serializable value, java.lang.Class clz) {
- impl.write_value(value, clz);
- }
-
- public final void write_value(java.io.Serializable value, String repository_id) {
- impl.write_value(value, repository_id);
- }
-
- public final void write_value(java.io.Serializable value,
- org.omg.CORBA.portable.BoxedValueHelper factory) {
- impl.write_value(value, factory);
- }
-
- public final void write_abstract_interface(java.lang.Object obj) {
- impl.write_abstract_interface(obj);
- }
-
- // java.io.OutputStream
- public final void write(byte b[]) throws IOException {
- impl.write(b);
- }
-
- public final void write(byte b[], int off, int len) throws IOException {
- impl.write(b, off, len);
- }
-
- public final void flush() throws IOException {
- impl.flush();
- }
-
- public final void close() throws IOException {
- impl.close();
- }
-
- // com.sun.corba.se.impl.encoding.MarshalOutputStream
- public final void start_block() {
- impl.start_block();
- }
-
- public final void end_block() {
- impl.end_block();
- }
-
- public final void putEndian() {
- impl.putEndian();
- }
-
- public void writeTo(java.io.OutputStream s)
- throws IOException
- {
- impl.writeTo(s);
- }
-
- public final byte[] toByteArray() {
- return impl.toByteArray();
- }
-
- // org.omg.CORBA.DataOutputStream
- public final void write_Abstract (java.lang.Object value) {
- impl.write_Abstract(value);
- }
-
- public final void write_Value (java.io.Serializable value) {
- impl.write_Value(value);
- }
-
- public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
- impl.write_any_array(seq, offset, length);
- }
-
- public void setMessageMediator(MessageMediator messageMediator)
- {
- this.corbaMessageMediator = (CorbaMessageMediator) messageMediator;
- }
-
- public MessageMediator getMessageMediator()
- {
- return corbaMessageMediator;
- }
-
- // org.omg.CORBA.portable.ValueBase
- public final String[] _truncatable_ids() {
- return impl._truncatable_ids();
- }
-
- // Other
- protected final int getSize() {
- return impl.getSize();
- }
-
- protected final int getIndex() {
- return impl.getIndex();
- }
-
- protected int getRealIndex(int index) {
- // Used in indirections. Overridden by TypeCodeOutputStream.
- return index;
- }
-
- protected final void setIndex(int value) {
- impl.setIndex(value);
- }
-
- protected final ByteBuffer getByteBuffer() {
- return impl.getByteBuffer();
- }
-
- protected final void setByteBuffer(ByteBuffer byteBuffer) {
- impl.setByteBuffer(byteBuffer);
- }
-
- /**
- * return true if our ByteBuffer is sharing/equal to bb
- */
- protected final boolean isSharing(ByteBuffer bb) {
- return (getByteBuffer() == bb);
- }
-
- public final boolean isLittleEndian() {
- return impl.isLittleEndian();
- }
-
- // XREVISIT - return to final if possible
- // REVISIT - was protected - need access from msgtypes test.
- public ByteBufferWithInfo getByteBufferWithInfo() {
- return impl.getByteBufferWithInfo();
- }
-
- protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- impl.setByteBufferWithInfo(bbwi);
- }
-
- // REVISIT: was protected - but need to access from xgiop.
- public final BufferManagerWrite getBufferManager() {
- return impl.getBufferManager();
- }
-
- public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
- impl.write_fixed(bigDecimal, digits, scale);
- }
-
- public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
- impl.writeOctetSequenceTo(s);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return impl.getGIOPVersion();
- }
-
- public final void writeIndirection(int tag, int posIndirectedTo) {
- impl.writeIndirection(tag, posIndirectedTo);
- }
-
- // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
- // performed.
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- // Subclasses must decide what to do here. It's inconvenient to
- // make the class and this method abstract because of dup().
- protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter();
-
- protected final void freeInternalCaches() {
- impl.freeInternalCaches();
- }
-
- void printBuffer() {
- impl.printBuffer();
- }
-
- public void alignOnBoundary(int octetBoundary) {
- impl.alignOnBoundary(octetBoundary);
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- impl.setHeaderPadding(headerPadding);
- }
-
- // ValueOutputStream -----------------------------
-
- public void start_value(String rep_id) {
- impl.start_value(rep_id);
- }
-
- public void end_value() {
- impl.end_value();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java 2018-01-30 20:16:55.000000000 -0500
+++ /dev/null 2018-01-30 20:16:55.000000000 -0500
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * Describes CDROutputStream delegates and provides some
- * implementation. Non-default constructors are avoided in
- * the delegation to separate instantiation from initialization,
- * so we use init methods.
- */
-abstract class CDROutputStreamBase extends java.io.OutputStream
-{
- protected CDROutputStream parent;
-
- // Required by parent CDROutputStream
- public void setParent(CDROutputStream parent) {
- this.parent = parent;
- }
-
- public void init(org.omg.CORBA.ORB orb,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion) {
- init(orb, false, bufferManager, streamFormatVersion, true);
- }
-
- // See EncapsOutputStream, the only one that uses the
- // non-pooled ByteBuffers, for additional info.
- protected abstract void init(org.omg.CORBA.ORB orb,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers);
-
- public abstract void write_boolean(boolean value);
- public abstract void write_char(char value);
- public abstract void write_wchar(char value);
- public abstract void write_octet(byte value);
- public abstract void write_short(short value);
- public abstract void write_ushort(short value);
- public abstract void write_long(int value);
- public abstract void write_ulong(int value);
- public abstract void write_longlong(long value);
- public abstract void write_ulonglong(long value);
- public abstract void write_float(float value);
- public abstract void write_double(double value);
- public abstract void write_string(String value);
- public abstract void write_wstring(String value);
- public abstract void write_boolean_array(boolean[] value, int offset, int length);
- public abstract void write_char_array(char[] value, int offset, int length);
- public abstract void write_wchar_array(char[] value, int offset, int length);
- public abstract void write_octet_array(byte[] value, int offset, int length);
- public abstract void write_short_array(short[] value, int offset, int length);
- public abstract void write_ushort_array(short[] value, int offset, int length);
- public abstract void write_long_array(int[] value, int offset, int length);
- public abstract void write_ulong_array(int[] value, int offset, int length);
- public abstract void write_longlong_array(long[] value, int offset, int length);
- public abstract void write_ulonglong_array(long[] value, int offset, int length);
- public abstract void write_float_array(float[] value, int offset, int length);
- public abstract void write_double_array(double[] value, int offset, int length);
- public abstract void write_Object(org.omg.CORBA.Object value);
- public abstract void write_TypeCode(TypeCode value);
- public abstract void write_any(Any value);
- public abstract void write_Principal(Principal value);
- public void write(int b) throws java.io.IOException {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public abstract void write_fixed(java.math.BigDecimal value);
- public void write_Context(org.omg.CORBA.Context ctx,
- org.omg.CORBA.ContextList contexts) {
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
-
- public abstract org.omg.CORBA.ORB orb();
-
- // org.omg.CORBA_2_3.portable.OutputStream
- public abstract void write_value(java.io.Serializable value);
- public abstract void write_value(java.io.Serializable value, java.lang.Class clz);
- public abstract void write_value(java.io.Serializable value, String repository_id);
- public abstract void write_value(java.io.Serializable value,
- org.omg.CORBA.portable.BoxedValueHelper factory);
- public abstract void write_abstract_interface(java.lang.Object obj);
-
- // java.io.OutputStream
-// public abstract void write(byte b[]) throws IOException;
-// public abstract void write(byte b[], int off, int len) throws IOException;
-// public abstract void flush() throws IOException;
-// public abstract void close() throws IOException;
-
- // com.sun.corba.se.impl.encoding.MarshalOutputStream
- public abstract void start_block();
- public abstract void end_block();
- public abstract void putEndian();
- public abstract void writeTo(java.io.OutputStream s)
- throws IOException;
- public abstract byte[] toByteArray();
-
- // org.omg.CORBA.DataOutputStream
- public abstract void write_Abstract (java.lang.Object value);
- public abstract void write_Value (java.io.Serializable value);
- public abstract void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length);
-
- // org.omg.CORBA.portable.ValueBase
- public abstract String[] _truncatable_ids();
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- abstract void setHeaderPadding(boolean headerPadding);
-
- // Required by IIOPOutputStream and other subclasses
- public abstract int getSize();
-
- public abstract int getIndex();
- public abstract void setIndex(int value);
-
- public abstract ByteBuffer getByteBuffer();
- public abstract void setByteBuffer(ByteBuffer byteBuffer);
-
- public abstract boolean isLittleEndian();
-
- public abstract ByteBufferWithInfo getByteBufferWithInfo();
- public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
-
- public abstract BufferManagerWrite getBufferManager();
-
- public abstract void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale);
- public abstract void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s);
-
- public abstract GIOPVersion getGIOPVersion();
-
- public abstract void writeIndirection(int tag, int posIndirectedTo);
-
- abstract void freeInternalCaches();
-
- abstract void printBuffer();
-
- abstract void alignOnBoundary(int octetBoundary);
-
- // org.omg.CORBA.portable.ValueOutputStream
-
- public abstract void start_value(String rep_id);
-
- public abstract void end_value();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java 2018-01-30 20:16:56.000000000 -0500
+++ /dev/null 2018-01-30 20:16:56.000000000 -0500
@@ -1,1929 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-import java.rmi.Remote;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.util.Hashtable;
-import java.util.Stack;
-
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.ValueHandlerMultiFormat;
-
-import org.omg.CORBA.CustomMarshal;
-import org.omg.CORBA.DataOutputStream;
-import org.omg.CORBA.TypeCodePackage.BadKind;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.VM_CUSTOM;
-import org.omg.CORBA.VM_TRUNCATABLE;
-import org.omg.CORBA.VM_NONE;
-import org.omg.CORBA.portable.IDLEntity;
-import org.omg.CORBA.portable.CustomValue;
-import org.omg.CORBA.portable.StreamableValue;
-import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.ValueBase;
-
-import com.sun.org.omg.CORBA.portable.ValueHelper;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.orb.ORBVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
-import com.sun.corba.se.impl.encoding.MarshalOutputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.orbutil.CacheTable;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
-import com.sun.corba.se.impl.orbutil.RepositoryIdUtility;
-import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public class CDROutputStream_1_0 extends CDROutputStreamBase
-{
- private static final int INDIRECTION_TAG = 0xffffffff;
-
- protected boolean littleEndian;
- protected BufferManagerWrite bufferManagerWrite;
- ByteBufferWithInfo bbwi;
-
- protected ORB orb;
- protected ORBUtilSystemException wrapper ;
-
- protected boolean debug = false;
-
- protected int blockSizeIndex = -1;
- protected int blockSizePosition = 0;
-
- protected byte streamFormatVersion;
-
- private static final int DEFAULT_BUFFER_SIZE = 1024;
- private static final String kWriteMethod = "write";
-
- // Codebase cache
- private CacheTable codebaseCache = null;
-
- // Value cache
- private CacheTable valueCache = null;
-
- // Repository ID cache
- private CacheTable repositoryIdCache = null;
-
- // Write end flag
- private int end_flag = 0;
-
- // Beginning with the resolution to interop issue 3526,
- // only enclosing chunked valuetypes are taken into account
- // when computing the nesting level. However, we still need
- // the old computation around for interoperability with our
- // older ORBs.
- private int chunkedValueNestingLevel = 0;
-
- private boolean mustChunk = false;
-
- // In block marker
- protected boolean inBlock = false;
-
- // Last end tag position
- private int end_flag_position = 0;
- private int end_flag_index = 0;
-
- // ValueHandler
- private ValueHandler valueHandler = null;
-
- // Repository ID handlers
- private RepositoryIdUtility repIdUtil;
- private RepositoryIdStrings repIdStrs;
-
- // Code set converters (created when first needed)
- private CodeSetConversion.CTBConverter charConverter;
- private CodeSetConversion.CTBConverter wcharConverter;
-
- // REVISIT - This should be re-factored so that including whether
- // to use pool byte buffers or not doesn't need to be known.
- public void init(org.omg.CORBA.ORB orb,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers)
- {
- // ORB must not be null. See CDROutputStream constructor.
- this.orb = (ORB)orb;
- this.wrapper = ORBUtilSystemException.get( this.orb,
- CORBALogDomains.RPC_ENCODING ) ;
- debug = this.orb.transportDebugFlag;
-
- this.littleEndian = littleEndian;
- this.bufferManagerWrite = bufferManager;
- this.bbwi = new ByteBufferWithInfo(orb, bufferManager, usePooledByteBuffers);
- this.streamFormatVersion = streamFormatVersion;
-
- createRepositoryIdHandlers();
- }
-
- public void init(org.omg.CORBA.ORB orb,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion)
- {
- init(orb, littleEndian, bufferManager, streamFormatVersion, true);
- }
-
- private final void createRepositoryIdHandlers()
- {
- repIdUtil = RepositoryIdFactory.getRepIdUtility();
- repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
- }
-
- public BufferManagerWrite getBufferManager()
- {
- return bufferManagerWrite;
- }
-
- public byte[] toByteArray() {
- byte[] it;
-
- it = new byte[bbwi.position()];
-
- // Micro-benchmarks show ByteBuffer.get(int) out perform the bulk
- // ByteBuffer.get(byte[], offset, length).
- for (int i = 0; i < bbwi.position(); i++)
- it[i] = bbwi.byteBuffer.get(i);
-
- return it;
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_0;
- }
-
- // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only.
- // Illegal for GIOP versions < 1.2.
- void setHeaderPadding(boolean headerPadding) {
- throw wrapper.giopVersionError();
- }
-
- protected void handleSpecialChunkBegin(int requiredSize)
- {
- // No-op for GIOP 1.0
- }
-
- protected void handleSpecialChunkEnd()
- {
- // No-op for GIOP 1.0
- }
-
- protected final int computeAlignment(int align) {
- if (align > 1) {
- int incr = bbwi.position() & (align - 1);
- if (incr != 0)
- return align - incr;
- }
-
- return 0;
- }
-
- protected void alignAndReserve(int align, int n) {
-
- bbwi.position(bbwi.position() + computeAlignment(align));
-
- if (bbwi.position() + n > bbwi.buflen)
- grow(align, n);
- }
-
- //
- // Default implementation of grow. Subclassers may override this.
- // Always grow the single buffer. This needs to delegate
- // fragmentation policy for IIOP 1.1.
- //
- protected void grow(int align, int n)
- {
- bbwi.needed = n;
-
- bufferManagerWrite.overflow(bbwi);
- }
-
- public final void putEndian() throws SystemException {
- write_boolean(littleEndian);
- }
-
- public final boolean littleEndian() {
- return littleEndian;
- }
-
- void freeInternalCaches() {
- if (codebaseCache != null)
- codebaseCache.done();
-
- if (valueCache != null)
- valueCache.done();
-
- if (repositoryIdCache != null)
- repositoryIdCache.done();
- }
-
- // No such type in java
- public final void write_longdouble(double x)
- {
- throw wrapper.longDoubleNotImplemented(
- CompletionStatus.COMPLETED_MAYBE ) ;
- }
-
- public void write_octet(byte x)
- {
- // The 'if' stmt is commented out since we need the alignAndReserve to
- // be called, particularly when the first body byte is written,
- // to induce header padding to align the body on a 8-octet boundary,
- // for GIOP versions 1.2 and above. Refer to internalWriteOctetArray()
- // method that also has a similar change.
- //if (bbwi.position() + 1 > bbwi.buflen)
- alignAndReserve(1, 1);
-
-// REVISIT - Should just use ByteBuffer.put(byte) and let it
-// increment the ByteBuffer position. This is true
-// for all write operations in this file.
-
- bbwi.byteBuffer.put(bbwi.position(), x);
- bbwi.position(bbwi.position() + 1);
-
- }
-
- public final void write_boolean(boolean x)
- {
- write_octet(x? (byte)1:(byte)0);
- }
-
- public void write_char(char x)
- {
- CodeSetConversion.CTBConverter converter = getCharConverter();
-
- converter.convert(x);
-
- // CORBA formal 99-10-07 15.3.1.6: "In the case of multi-byte encodings
- // of characters, a single instance of the char type may only
- // hold one octet of any multi-byte character encoding."
- if (converter.getNumBytes() > 1)
- throw wrapper.invalidSingleCharCtb(CompletionStatus.COMPLETED_MAYBE);
-
- write_octet(converter.getBytes()[0]);
- }
-
- // These wchar methods are only used when talking to
- // legacy ORBs, now.
- private final void writeLittleEndianWchar(char x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeBigEndianWchar(char x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeLittleEndianShort(short x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeBigEndianShort(short x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 2);
- }
-
- private final void writeLittleEndianLong(int x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF));
- bbwi.position(bbwi.position() + 4);
- }
-
- private final void writeBigEndianLong(int x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 24) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 4);
- }
-
- private final void writeLittleEndianLongLong(long x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 32) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 40) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 48) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 7, (byte)((x >>> 56) & 0xFF));
- bbwi.position(bbwi.position() + 8);
- }
-
- private final void writeBigEndianLongLong(long x) {
- bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 56) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 48) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 40) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 32) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 24) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 16) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 8) & 0xFF));
- bbwi.byteBuffer.put(bbwi.position() + 7, (byte)(x & 0xFF));
- bbwi.position(bbwi.position() + 8);
- }
-
- public void write_wchar(char x)
- {
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB(orb)) {
- throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // If it's one of our legacy ORBs, do what they did:
- alignAndReserve(2, 2);
-
- if (littleEndian) {
- writeLittleEndianWchar(x);
- } else {
- writeBigEndianWchar(x);
- }
- }
-
- public void write_short(short x)
- {
- alignAndReserve(2, 2);
-
- if (littleEndian) {
- writeLittleEndianShort(x);
- } else {
- writeBigEndianShort(x);
- }
- }
-
- public final void write_ushort(short x)
- {
- write_short(x);
- }
-
- public void write_long(int x)
- {
- alignAndReserve(4, 4);
-
- if (littleEndian) {
- writeLittleEndianLong(x);
- } else {
- writeBigEndianLong(x);
- }
- }
-
- public final void write_ulong(int x)
- {
- write_long(x);
- }
-
- public void write_longlong(long x)
- {
- alignAndReserve(8, 8);
-
- if (littleEndian) {
- writeLittleEndianLongLong(x);
- } else {
- writeBigEndianLongLong(x);
- }
- }
-
- public final void write_ulonglong(long x)
- {
- write_longlong(x);
- }
-
- public final void write_float(float x)
- {
- write_long(Float.floatToIntBits(x));
- }
-
- public final void write_double(double x)
- {
- write_longlong(Double.doubleToLongBits(x));
- }
-
- public void write_string(String value)
- {
- writeString(value);
- }
-
- protected int writeString(String value)
- {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- CodeSetConversion.CTBConverter converter = getCharConverter();
-
- converter.convert(value);
-
- // A string is encoded as an unsigned CORBA long for the
- // number of bytes to follow (including a terminating null).
- // There is only one octet per character in the string.
- int len = converter.getNumBytes() + 1;
-
- handleSpecialChunkBegin(computeAlignment(4) + 4 + len);
-
- write_long(len);
- int indirection = get_offset() - 4;
-
- internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
-
- // Write the null ending
- write_octet((byte)0);
-
- handleSpecialChunkEnd();
- return indirection;
- }
-
- public void write_wstring(String value)
- {
- if (value == null)
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // Don't allow transmission of wchar/wstring data with
- // foreign ORBs since it's against the spec.
- if (ORBUtility.isForeignORB(orb)) {
- throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // When talking to our legacy ORBs, do what they did:
- int len = value.length() + 1;
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(4 + (len * 2) + computeAlignment(4));
-
- write_long(len);
-
- for (int i = 0; i < len - 1; i++)
- write_wchar(value.charAt(i));
-
- // Write the null ending
- write_short((short)0);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- // Performs no checks and doesn't tamper with chunking
- void internalWriteOctetArray(byte[] value, int offset, int length)
- {
- int n = offset;
-
- // This flag forces the alignAndReserve method to be called the
- // first time an octet is written. This is necessary to ensure
- // that the body is aligned on an 8-octet boundary. Note the 'if'
- // condition inside the 'while' loop below. Also, refer to the
- // write_octet() method that has a similar change.
- boolean align = true;
-
- while (n < length+offset) {
- int avail;
- int bytes;
- int wanted;
-
- if ((bbwi.position() + 1 > bbwi.buflen) || align) {
- align = false;
- alignAndReserve(1, 1);
- }
- avail = bbwi.buflen - bbwi.position();
- wanted = (length + offset) - n;
- bytes = (wanted < avail) ? wanted : avail;
- for (int i = 0; i < bytes; i++)
- bbwi.byteBuffer.put(bbwi.position() + i, value[n+i]);
- bbwi.position(bbwi.position() + bytes);
- n += bytes;
- }
- }
-
- public final void write_octet_array(byte b[], int offset, int length)
- {
- if ( b == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(length);
-
- internalWriteOctetArray(b, offset, length);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public void write_Principal(Principal p)
- {
- write_long(p.name().length);
- write_octet_array(p.name(), 0, p.name().length);
- }
-
- public void write_any(Any any)
- {
- if ( any == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- write_TypeCode(any.type());
- any.write_value(parent);
- }
-
- public void write_TypeCode(TypeCode tc)
- {
- if ( tc == null ) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
- TypeCodeImpl tci;
- if (tc instanceof TypeCodeImpl) {
- tci = (TypeCodeImpl)tc;
- }
- else {
- tci = new TypeCodeImpl(orb, tc);
- }
-
- tci.write_value((org.omg.CORBA_2_3.portable.OutputStream)parent);
- }
-
- public void write_Object(org.omg.CORBA.Object ref)
- {
- if (ref == null) {
- IOR nullIOR = IORFactories.makeIOR( orb ) ;
- nullIOR.write(parent);
- return;
- }
-
- // IDL to Java formal 01-06-06 1.21.4.2
- if (ref instanceof org.omg.CORBA.LocalObject)
- throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
-
- IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ;
- ior.write(parent);
- return;
- }
-
- // ------------ RMI related methods --------------------------
-
- public void write_abstract_interface(java.lang.Object obj) {
- boolean corbaObject = false; // Assume value type.
- org.omg.CORBA.Object theObject = null;
-
- // Is it a CORBA.Object?
-
- if (obj != null && obj instanceof org.omg.CORBA.Object) {
-
- // Yes.
-
- theObject = (org.omg.CORBA.Object)obj;
- corbaObject = true;
- }
-
- // Write our flag...
-
- write_boolean(corbaObject);
-
- // Now write out the object...
-
- if (corbaObject) {
- write_Object(theObject);
- } else {
- try {
- write_value((java.io.Serializable)obj);
- } catch(ClassCastException cce) {
- if (obj instanceof java.io.Serializable)
- throw cce;
- else
- ORBUtility.throwNotSerializableForCorba(obj.getClass().getName());
- }
- }
- }
-
- public void write_value(Serializable object, Class clz) {
-
- write_value(object);
- }
-
- private void writeWStringValue(String string) {
-
- int indirection = writeValueTag(mustChunk, true, null);
-
- // Write WStringValue's repository ID
- write_repositoryId(repIdStrs.getWStringValueRepId());
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, string, string);
-
- // Write Value chunk
- if (mustChunk) {
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- } else
- end_flag--;
-
- write_wstring(string);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- private void writeArray(Serializable array, Class clazz) {
-
- if (valueHandler == null)
- valueHandler = ORBUtility.createValueHandler(); //d11638
-
- // Write value_tag
- int indirection = writeValueTag(mustChunk, true,
- Util.getCodebase(clazz));
-
- // Write repository ID
- write_repositoryId(repIdStrs.createSequenceRepID(clazz));
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, array, array);
-
- // Write Value chunk
- if (mustChunk) {
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- } else
- end_flag--;
-
- if (valueHandler instanceof ValueHandlerMultiFormat) {
- ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
- vh.writeValue(parent, array, streamFormatVersion);
- } else
- valueHandler.writeValue(parent, array);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- private void writeValueBase(org.omg.CORBA.portable.ValueBase object,
- Class clazz) {
- // _REVISIT_ could check to see whether chunking really needed
- mustChunk = true;
-
- // Write value_tag
- int indirection = writeValueTag(true, true, Util.getCodebase(clazz));
-
- // Get rep id
- String repId = ((ValueBase)object)._truncatable_ids()[0];
-
- // Write rep id
- write_repositoryId(repId);
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, object);
-
- // Write Value chunk
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- writeIDLValue(object, repId);
- end_block();
-
- // Write end tag
- writeEndTag(true);
- }
-
- private void writeRMIIIOPValueType(Serializable object, Class clazz) {
- if (valueHandler == null)
- valueHandler = ORBUtility.createValueHandler(); //d11638
-
- Serializable key = object;
-
- // Allow the ValueHandler to call writeReplace on
- // the Serializable (if the method is present)
- object = valueHandler.writeReplace(key);
-
- if (object == null) {
- // Write null tag and return
- write_long(0);
- return;
- }
-
- if (object != key) {
- if (valueCache != null && valueCache.containsKey(object)) {
- writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
- return;
- }
-
- clazz = object.getClass();
- }
-
- if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
- mustChunk = true;
- }
-
- // Write value_tag
- int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));
-
- // Write rep. id
- write_repositoryId(repIdStrs.createForJavaType(clazz));
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, key);
-
- if (mustChunk) {
- // Write Value chunk
- end_flag--;
- chunkedValueNestingLevel--;
- start_block();
- } else
- end_flag--;
-
- if (valueHandler instanceof ValueHandlerMultiFormat) {
- ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
- vh.writeValue(parent, object, streamFormatVersion);
- } else
- valueHandler.writeValue(parent, object);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- public void write_value(Serializable object, String repository_id) {
-
- // Handle null references
- if (object == null) {
- // Write null tag and return
- write_long(0);
- return;
- }
-
- // Handle shared references
- if (valueCache != null && valueCache.containsKey(object)) {
- writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
- return;
- }
-
- Class clazz = object.getClass();
- boolean oldMustChunk = mustChunk;
-
- if (mustChunk)
- mustChunk = true;
-
- if (inBlock)
- end_block();
-
- if (clazz.isArray()) {
- // Handle arrays
- writeArray(object, clazz);
- } else if (object instanceof org.omg.CORBA.portable.ValueBase) {
- // Handle IDL Value types
- writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz);
- } else if (shouldWriteAsIDLEntity(object)) {
- writeIDLEntity((IDLEntity)object);
- } else if (object instanceof java.lang.String) {
- writeWStringValue((String)object);
- } else if (object instanceof java.lang.Class) {
- writeClass(repository_id, (Class)object);
- } else {
- // RMI-IIOP value type
- writeRMIIIOPValueType(object, clazz);
- }
-
- mustChunk = oldMustChunk;
-
- // Check to see if we need to start another block for a
- // possible outer value
- if (mustChunk)
- start_block();
-
- }
-
- public void write_value(Serializable object)
- {
- write_value(object, (String)null);
- }
-
- public void write_value(Serializable object, org.omg.CORBA.portable.BoxedValueHelper factory)
- {
- // Handle null references
- if (object == null) {
- // Write null tag and return
- write_long(0);
- return;
- }
-
- // Handle shared references
- if ((valueCache != null) && valueCache.containsKey(object)) {
- writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
- return;
- }
-
- boolean oldMustChunk = mustChunk;
-
- boolean isCustom = false;
- if (factory instanceof ValueHelper) {
- short modifier;
- try {
- modifier = ((ValueHelper)factory).get_type().type_modifier();
- } catch(BadKind ex) { // tk_value_box
- modifier = VM_NONE.value;
- }
- if (object instanceof CustomMarshal &&
- modifier == VM_CUSTOM.value) {
- isCustom = true;
- mustChunk = true;
- }
- if (modifier == VM_TRUNCATABLE.value)
- mustChunk = true;
- }
-
- if (mustChunk) {
-
- if (inBlock)
- end_block();
-
- // Write value_tag
- int indirection = writeValueTag(true,
- orb.getORBData().useRepId(),
- Util.getCodebase(object.getClass())
- );
-
- if (orb.getORBData().useRepId()) {
- write_repositoryId(factory.get_id());
- }
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, object);
-
- // Write Value chunk
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- if (isCustom)
- ((CustomMarshal)object).marshal(parent);
- else
- factory.write_value(parent, object);
- end_block();
-
- // Write end tag
- writeEndTag(true);
- }
- else {
- // Write value_tag
- int indirection = writeValueTag(false,
- orb.getORBData().useRepId(),
- Util.getCodebase(object.getClass())
- );
-
- if (orb.getORBData().useRepId()) {
- write_repositoryId(factory.get_id());
- }
-
- // Add indirection for object to indirection table
- updateIndirectionTable(indirection, object, object);
-
- // Write Value chunk
- end_flag--;
- // no need to test for custom on the non-chunked path
- factory.write_value(parent, object);
-
- // Write end tag
- writeEndTag(false);
- }
-
- mustChunk = oldMustChunk;
-
- // Check to see if we need to start another block for a
- // possible outer value
- if (mustChunk)
- start_block();
-
- }
-
- public int get_offset() {
- return bbwi.position();
- }
-
- public void start_block() {
- if (debug) {
- dprint("CDROutputStream_1_0 start_block, position" + bbwi.position());
- }
-
- //Move inBlock=true to after write_long since write_long might
- //trigger grow which will lead to erroneous behavior with a
- //missing blockSizeIndex.
- //inBlock = true;
-
- // Save space in the buffer for block size
- write_long(0);
-
- //Has to happen after write_long since write_long could
- //trigger grow which is overridden by supper classes to
- //depend on inBlock.
- inBlock = true;
-
- blockSizePosition = get_offset();
-
- // Remember where to put the size of the endblock less 4
- blockSizeIndex = bbwi.position();
-
- if (debug) {
- dprint("CDROutputStream_1_0 start_block, blockSizeIndex "
- + blockSizeIndex);
- }
-
- }
-
- // Utility method which will hopefully decrease chunking complexity
- // by allowing us to end_block and update chunk lengths without
- // calling alignAndReserve. Otherwise, it's possible to get into
- // recursive scenarios which lose the chunking state.
- protected void writeLongWithoutAlign(int x) {
- if (littleEndian) {
- writeLittleEndianLong(x);
- } else {
- writeBigEndianLong(x);
- }
- }
-
- public void end_block() {
- if (debug) {
- dprint("CDROutputStream_1_0.java end_block");
- }
-
- if (!inBlock)
- return;
-
- if (debug) {
- dprint("CDROutputStream_1_0.java end_block, in a block");
- }
-
- inBlock = false;
-
- // Test to see if the block was of zero length
- // If so, remove the block instead of ending it
- // (This can happen if the last field written
- // in a value was another value)
- if (get_offset() == blockSizePosition) {
- // Need to assert that blockSizeIndex == bbwi.position()? REVISIT
-
- bbwi.position(bbwi.position() - 4);
- blockSizeIndex = -1;
- blockSizePosition = -1;
- return;
- }
-
- int oldSize = bbwi.position();
- bbwi.position(blockSizeIndex - 4);
-
- writeLongWithoutAlign(oldSize - blockSizeIndex);
-
- bbwi.position(oldSize);
- blockSizeIndex = -1;
- blockSizePosition = -1;
-
- // System.out.println(" post end_block: " + get_offset() + " " + bbwi.position());
- }
-
- public org.omg.CORBA.ORB orb()
- {
- return orb;
- }
-
- // ------------ End RMI related methods --------------------------
-
- public final void write_boolean_array(boolean[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(length);
-
- for (int i = 0; i < length; i++)
- write_boolean(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_char_array(char[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(length);
-
- for (int i = 0; i < length; i++)
- write_char(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public void write_wchar_array(char[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(2) + (length * 2));
-
- for (int i = 0; i < length; i++)
- write_wchar(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_short_array(short[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(2) + (length * 2));
-
- for (int i = 0; i < length; i++)
- write_short(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_ushort_array(short[]value, int offset, int length) {
- write_short_array(value, offset, length);
- }
-
- public final void write_long_array(int[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
-
- for (int i = 0; i < length; i++)
- write_long(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_ulong_array(int[]value, int offset, int length) {
- write_long_array(value, offset, length);
- }
-
- public final void write_longlong_array(long[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(8) + (length * 8));
-
- for (int i = 0; i < length; i++)
- write_longlong(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_ulonglong_array(long[]value, int offset, int length) {
- write_longlong_array(value, offset, length);
- }
-
- public final void write_float_array(float[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
-
- for (int i = 0; i < length; i++)
- write_float(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public final void write_double_array(double[]value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkBegin(computeAlignment(8) + (length * 8));
-
- for (int i = 0; i < length; i++)
- write_double(value[offset + i]);
-
- // This will only have an effect if we're already chunking
- handleSpecialChunkEnd();
- }
-
- public void write_string_array(String[] value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- for(int i = 0; i < length; i++)
- write_string(value[offset + i]);
- }
-
- public void write_wstring_array(String[] value, int offset, int length) {
- if ( value == null )
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
-
- for(int i = 0; i < length; i++)
- write_wstring(value[offset + i]);
- }
-
- public final void write_any_array(org.omg.CORBA.Any value[], int offset, int length)
- {
- for(int i = 0; i < length; i++)
- write_any(value[offset + i]);
- }
-
- //--------------------------------------------------------------------//
- // CDROutputStream state management.
- //
-
- public void writeTo(java.io.OutputStream s)
- throws java.io.IOException
- {
- byte[] tmpBuf = null;
-
- if (bbwi.byteBuffer.hasArray())
- {
- tmpBuf = bbwi.byteBuffer.array();
- }
- else
- {
- int size = bbwi.position();
- tmpBuf = new byte[size];
- // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
- // faster than ByteBuffer.get(byte[], offset, length)
- for (int i = 0; i < size; i++)
- tmpBuf[i] = bbwi.byteBuffer.get(i);
- }
-
- s.write(tmpBuf, 0, bbwi.position());
- }
-
- public void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
-
- byte[] buf = null;
-
- if (bbwi.byteBuffer.hasArray())
- {
- buf = bbwi.byteBuffer.array();
- }
- else
- {
- int size = bbwi.position();
- buf = new byte[size];
- // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
- // faster than ByteBuffer.get(byte[], offset, length)
- for (int i = 0; i < size; i++)
- buf[i] = bbwi.byteBuffer.get(i);
- }
-
- s.write_long(bbwi.position());
- s.write_octet_array(buf, 0, bbwi.position());
-
- }
-
- public final int getSize() {
- return bbwi.position();
- }
-
- public int getIndex() {
- return bbwi.position();
- }
-
- public boolean isLittleEndian() {
- return littleEndian;
- }
-
- public void setIndex(int value) {
- bbwi.position(value);
- }
-
- public ByteBufferWithInfo getByteBufferWithInfo() {
- return bbwi;
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- this.bbwi = bbwi;
- }
-
- public ByteBuffer getByteBuffer() {
- ByteBuffer result = null;;
- if (bbwi != null) {
- result = bbwi.byteBuffer;
- }
- return result;
- }
-
- public void setByteBuffer(ByteBuffer byteBuffer) {
- bbwi.byteBuffer = byteBuffer;
- }
-
- private final void updateIndirectionTable(int indirection, java.lang.Object object,
- java.lang.Object key) {
- // int indirection = get_offset();
- if (valueCache == null)
- valueCache = new CacheTable(orb,true);
- valueCache.put(object, indirection);
- if (key != object)
- valueCache.put(key, indirection);
- }
-
- private final void write_repositoryId(String id) {
- // Use an indirection if available
- if (repositoryIdCache != null && repositoryIdCache.containsKey(id)) {
- writeIndirection(INDIRECTION_TAG, repositoryIdCache.getVal(id));
- return;
- }
-
- // Write it as a string. Note that we have already done the
- // special case conversion of non-Latin-1 characters to escaped
- // Latin-1 sequences in RepositoryId.
-
- // It's not a good idea to cache them now that we can have
- // multiple code sets.
- int indirection = writeString(id);
-
- // Add indirection for id to indirection table
- if (repositoryIdCache == null)
- repositoryIdCache = new CacheTable(orb,true);
- repositoryIdCache.put(id, indirection);
- }
-
- private void write_codebase(String str, int pos) {
- if (codebaseCache != null && codebaseCache.containsKey(str)) {
- writeIndirection(INDIRECTION_TAG, codebaseCache.getVal(str));
- }
- else {
- write_string(str);
- if (codebaseCache == null)
- codebaseCache = new CacheTable(orb,true);
- codebaseCache.put(str, pos);
- }
- }
-
- private final int writeValueTag(boolean chunkIt, boolean useRepId,
- String codebase) {
- int indirection = 0;
- if (chunkIt && !useRepId){
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIChunkedNoRepStrId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIChunkedNoRepStrId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- } else if (chunkIt && useRepId){
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIChunkedId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIChunkedId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- } else if (!chunkIt && !useRepId) {
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIUnchunkedNoRepStrId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIUnchunkedNoRepStrId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- } else if (!chunkIt && useRepId) {
- if (codebase == null) {
- write_long(repIdUtil.getStandardRMIUnchunkedId());
- indirection = get_offset() - 4;
- } else {
- write_long(repIdUtil.getCodeBaseRMIUnchunkedId());
- indirection = get_offset() - 4;
- write_codebase(codebase, get_offset());
- }
- }
- return indirection;
- }
-
- private void writeIDLValue(Serializable object, String repID)
- {
- if (object instanceof StreamableValue) {
- ((StreamableValue)object)._write(parent);
-
- } else if (object instanceof CustomValue) {
- ((CustomValue)object).marshal(parent);
-
- } else {
- BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
- boolean isCustom = false;
- if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
- try {
- if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
- isCustom = true;
- } catch(BadKind ex) {
- throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
- ex ) ;
- }
- }
- if (isCustom)
- ((CustomMarshal)object).marshal(parent);
- else
- helper.write_value(parent, object);
- }
- }
-
- // Handles end tag compaction...
- private void writeEndTag(boolean chunked){
-
- if (chunked) {
- if (get_offset() == end_flag_position) {
-
- if (bbwi.position() == end_flag_index) {
-
- // We are exactly at the same position and index as the
- // end of the last end tag. Thus, we can back up over it
- // and compact the tags.
- bbwi.position(bbwi.position() - 4);
-
- } else {
-
- // Special case in which we're at the beginning of a new
- // fragment, but the position is the same. We can't back up,
- // so we just write the new end tag without compaction. This
- // occurs when a value ends and calls start_block to open a
- // continuation chunk, but it's called at the very end of
- // a fragment.
- }
- }
-
- writeNestingLevel();
-
- // Remember the last index and position. These are only used when chunking.
- end_flag_index = bbwi.position();
- end_flag_position = get_offset();
-
- chunkedValueNestingLevel++;
- }
-
- // Increment the nesting level
- end_flag++;
- }
-
- /**
- * Handles ORB versioning of the end tag. Should only
- * be called if chunking.
- *
- * If talking to our older ORBs (Standard Extension,
- * Kestrel, and Ladybird), write the end flag that takes
- * into account all enclosing valuetypes.
- *
- * If talking a newer or foreign ORB, or if the orb
- * instance is null, write the end flag that only takes
- * into account the enclosing chunked valuetypes.
- */
- private void writeNestingLevel() {
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- write_long(chunkedValueNestingLevel);
-
- } else {
- write_long(end_flag);
- }
- }
-
- private void writeClass(String repository_id, Class clz) {
-
- if (repository_id == null)
- repository_id = repIdStrs.getClassDescValueRepId();
-
- // Write value_tag
- int indirection = writeValueTag(mustChunk, true, null);
- updateIndirectionTable(indirection, clz, clz);
-
- write_repositoryId(repository_id);
-
- if (mustChunk) {
- // Write Value chunk
- start_block();
- end_flag--;
- chunkedValueNestingLevel--;
- } else
- end_flag--;
-
- writeClassBody(clz);
-
- if (mustChunk)
- end_block();
-
- // Write end tag
- writeEndTag(mustChunk);
- }
-
- // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
- // and codebase strings in the wrong order. This handles
- // backwards compatibility.
- private void writeClassBody(Class clz) {
- if (orb == null ||
- ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
- ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
-
- write_value(Util.getCodebase(clz));
- write_value(repIdStrs.createForAnyType(clz));
- } else {
-
- write_value(repIdStrs.createForAnyType(clz));
- write_value(Util.getCodebase(clz));
- }
- }
-
- // Casts and returns an Object as a Serializable
- // This is required for JDK 1.1 only to avoid VerifyErrors when
- // passing arrays as Serializable
- // private java.io.Serializable make_serializable(java.lang.Object object)
- // {
- // return (java.io.Serializable)object;
- // }
-
- private boolean shouldWriteAsIDLEntity(Serializable object)
- {
- return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) &&
- (!(object instanceof org.omg.CORBA.Object)));
-
- }
-
- private void writeIDLEntity(IDLEntity object) {
-
- // _REVISIT_ could check to see whether chunking really needed
- mustChunk = true;
-
- String repository_id = repIdStrs.createForJavaType(object);
- Class clazz = object.getClass();
- String codebase = Util.getCodebase(clazz);
-
- // Write value_tag
- int indirection = writeValueTag(true, true, codebase);
- updateIndirectionTable(indirection, object, object);
-
- // Write rep. id
- write_repositoryId(repository_id);
-
- // Write Value chunk
- end_flag--;
- chunkedValueNestingLevel--;
- start_block();
-
- // Write the IDLEntity using reflection
- try {
- ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
- final Class helperClass = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
- clazzLoader, clazz, clazzLoader);
- final Class argTypes[] = {org.omg.CORBA.portable.OutputStream.class, clazz};
- // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
- // if a different class loader is used (even though the javadoc says otherwise)
- Method writeMethod = null;
- try {
- writeMethod = (Method)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public java.lang.Object run() throws NoSuchMethodException {
- return helperClass.getDeclaredMethod(kWriteMethod, argTypes);
- }
- }
- );
- } catch (PrivilegedActionException pae) {
- // this gets caught below
- throw (NoSuchMethodException)pae.getException();
- }
- java.lang.Object args[] = {parent, object};
- writeMethod.invoke(null, args);
- } catch (ClassNotFoundException cnfe) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, cnfe ) ;
- } catch(NoSuchMethodException nsme) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, nsme ) ;
- } catch(IllegalAccessException iae) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, iae ) ;
- } catch(InvocationTargetException ite) {
- throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, ite ) ;
- }
- end_block();
-
- // Write end tag
- writeEndTag(true);
- }
-
- /* DataOutputStream methods */
-
- public void write_Abstract (java.lang.Object value) {
- write_abstract_interface(value);
- }
-
- public void write_Value (java.io.Serializable value) {
- write_value(value);
- }
-
- // This will stay a custom add-on until the java-rtf issue is resolved.
- // Then it should be declared in org.omg.CORBA.portable.OutputStream.
- //
- // Pads the string representation of bigDecimal with zeros to fit the given
- // digits and scale before it gets written to the stream.
- public void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
- String string = bigDecimal.toString();
- String integerPart;
- String fractionPart;
- StringBuffer stringBuffer;
-
- // Get rid of the sign
- if (string.charAt(0) == '-' || string.charAt(0) == '+') {
- string = string.substring(1);
- }
-
- // Determine integer and fraction parts
- int dotIndex = string.indexOf('.');
- if (dotIndex == -1) {
- integerPart = string;
- fractionPart = null;
- } else if (dotIndex == 0 ) {
- integerPart = null;
- fractionPart = string;
- } else {
- integerPart = string.substring(0, dotIndex);
- fractionPart = string.substring(dotIndex + 1);
- }
-
- // Pad both parts with zeros as necessary
- stringBuffer = new StringBuffer(digits);
- if (fractionPart != null) {
- stringBuffer.append(fractionPart);
- }
- while (stringBuffer.length() < scale) {
- stringBuffer.append('0');
- }
- if (integerPart != null) {
- stringBuffer.insert(0, integerPart);
- }
- while (stringBuffer.length() < digits) {
- stringBuffer.insert(0, '0');
- }
-
- // This string contains no sign or dot
- this.write_fixed(stringBuffer.toString(), bigDecimal.signum());
- }
-
- // This method should be remove by the java-rtf issue.
- // Right now the scale and digits information of the type code is lost.
- public void write_fixed(java.math.BigDecimal bigDecimal) {
- // This string might contain sign and/or dot
- this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
- }
-
- // The string may contain a sign and dot
- public void write_fixed(String string, int signum) {
- int stringLength = string.length();
- // Each octet contains (up to) two decimal digits
- byte doubleDigit = 0;
- char ch;
- byte digit;
-
- // First calculate the length of the string without optional sign and dot
- int numDigits = 0;
- for (int i=0; i 0, fragmentOffset
- // = sum i=[1,n] { bbwi_i-1_.size - buffer i header length }
- //
- protected int fragmentOffset = 0;
-
- protected void alignAndReserve(int align, int n) {
-
- // Notice that in 1.1, we won't end a fragment with
- // alignment padding. We also won't guarantee that
- // our fragments end on evenly divisible 8 byte
- // boundaries. There may be alignment
- // necessary with the header of the next fragment
- // since the header isn't aligned on an 8 byte
- // boundary, so we have to calculate it twice.
-
- int alignment = computeAlignment(align);
-
- if (bbwi.position() + n + alignment > bbwi.buflen) {
- grow(align, n);
-
- // Must recompute the alignment after a grow.
- // In the case of fragmentation, the alignment
- // calculation may no longer be correct.
-
- // People shouldn't be able to set their fragment
- // sizes so small that the fragment header plus
- // this alignment fills the entire buffer.
- alignment = computeAlignment(align);
- }
-
- bbwi.position(bbwi.position() + alignment);
- }
-
- protected void grow(int align, int n) {
- // Save the current size for possible post-fragmentation calculation
- int oldSize = bbwi.position();
-
- super.grow(align, n);
-
- // At this point, if we fragmented, we should have a ByteBufferWithInfo
- // with the fragment header already marshalled. The size and length fields
- // should be updated accordingly, and the fragmented flag should be set.
- if (bbwi.fragmented) {
-
- // Clear the flag
- bbwi.fragmented = false;
-
- // Update fragmentOffset so indirections work properly.
- // At this point, oldSize is the entire length of the
- // previous buffer. bbwi.position() is the length of the
- // fragment header of this buffer.
- fragmentOffset += (oldSize - bbwi.position());
- }
- }
-
- public int get_offset() {
- return bbwi.position() + fragmentOffset;
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_1;
- }
-
- public void write_wchar(char x)
- {
- // In GIOP 1.1, interoperability with wchar is limited
- // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6.
- // Note that the following code prohibits UTF-16 with a byte
- // order marker (which would result in 4 bytes).
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(x);
-
- if (converter.getNumBytes() != 2)
- throw wrapper.badGiop11Ctb(CompletionStatus.COMPLETED_MAYBE);
-
- alignAndReserve(converter.getAlignment(),
- converter.getNumBytes());
-
- parent.write_octet_array(converter.getBytes(),
- 0,
- converter.getNumBytes());
- }
-
- public void write_wstring(String value)
- {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // The length is the number of code points (which are 2 bytes each)
- // including the 2 byte null. See CORBA formal 99-10-07 15.3.2.7.
-
- int len = value.length() + 1;
-
- write_long(len);
-
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(value);
-
- internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
-
- // Write the 2 byte null ending
- write_short((short)0);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java 2018-01-30 20:16:57.000000000 -0500
+++ /dev/null 2018-01-30 20:16:57.000000000 -0500
@@ -1,359 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-public class CDROutputStream_1_2 extends CDROutputStream_1_1
-{
- // There's a situation with chunking with fragmentation
- // in which the alignment for a primitive value is needed
- // to fill fragment N, but the primitive won't fit so
- // must go into fragment N + 1. The behavior is the same
- // as that for specialChunks.
- //
- // Unfortunately, given the current code, we can't reuse
- // specialChunk. If you wrap each of the following
- // write calls with handleSpecialChunkBegin/End, you
- // will lose your state because the primitive calls will
- // change the variables, etc.
- //
- // All of the CDR code should be rewritten moving chunking
- // to a different level, perhaps in the buffer managers.
- // We want to move to a compositional model rather than
- // using inheritance.
- //
- // Note that in the grow case, chunks are _NOT_ closed
- // at grow points, now.
- //
- // **** NOTE ****
- // Since we will not support valuetypes with GIOP 1.1, that
- // also means we do not support chunking there.
- //
- protected boolean primitiveAcrossFragmentedChunk = false;
-
- // Used in chunking. Here's how this works:
- //
- // When chunking and writing an array of primitives, a string, or a
- // wstring, _AND_ it won't fit in the buffer do the following. (As
- // you can see, this is a very "special" chunk.)
- //
- // 1. Write the length of the chunk including the array length
- // 2. Set specialChunk to true
- // 3 applies to ALL chunking:
- // 3. In grow, if we need to fragment and specialChunk is false
- // a) call end_block
- // b) fragment
- // Now back to the array only case:
- // [write the data]
- // 4. if specialChunk is true
- // a) Close the chunk
- // b) Set specialChunk to false
-
- protected boolean specialChunk = false;
-
- // Indicates whether the header should be padded. In GIOP 1.2 and above, the
- // body must be aligned on a 8-octet boundary, and so the header needs to be
- // padded appropriately. However, if there is no body to a request or reply
- // message, there is no need to pad the header, in the unfragmented case.
- private boolean headerPadding;
-
- protected void handleSpecialChunkBegin(int requiredSize)
- {
- // If we're chunking and the item won't fit in the buffer
- if (inBlock && requiredSize + bbwi.position() > bbwi.buflen) {
-
- // Duplicating some code from end_block. Compute
- // and write the total chunk length.
-
- int oldSize = bbwi.position();
- bbwi.position(blockSizeIndex - 4);
-
- //write_long(oldSize - blockSizeIndex);
- writeLongWithoutAlign((oldSize - blockSizeIndex) + requiredSize);
- bbwi.position(oldSize);
-
- // Set the special flag so we don't end the chunk when
- // we fragment
- specialChunk = true;
- }
- }
-
- protected void handleSpecialChunkEnd()
- {
- // If we're in a chunk and the item spanned fragments
- if (inBlock && specialChunk) {
-
- // This is unnecessary, but I just want to show that
- // we're done with the current chunk. (the end_block
- // call is inappropriate here)
- inBlock = false;
- blockSizeIndex = -1;
- blockSizePosition = -1;
-
- // Start a new chunk since we fragmented during the item.
- // Thus, no one can go back to add more to the chunk length
- start_block();
-
- // Now turn off the flag so we go back to the normal
- // behavior of closing a chunk when we fragment and
- // reopening afterwards.
- specialChunk = false;
- }
- }
-
- // Called after writing primitives
- private void checkPrimitiveAcrossFragmentedChunk()
- {
- if (primitiveAcrossFragmentedChunk) {
- primitiveAcrossFragmentedChunk = false;
-
- inBlock = false;
-
- // It would be nice to have a StreamPosition
- // abstraction if we could avoid allocation
- // overhead.
- blockSizeIndex = -1;
- blockSizePosition = -1;
-
- // Start a new chunk
- start_block();
- }
- }
-
-
- public void write_octet(byte x) {
- super.write_octet(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- public void write_short(short x) {
- super.write_short(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- public void write_long(int x) {
- super.write_long(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- public void write_longlong(long x) {
- super.write_longlong(x);
- checkPrimitiveAcrossFragmentedChunk();
- }
-
- // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only.
- void setHeaderPadding(boolean headerPadding) {
- this.headerPadding = headerPadding;
- }
-
- protected void alignAndReserve(int align, int n) {
-
- // headerPadding bit is set by the write operation of RequestMessage_1_2
- // or ReplyMessage_1_2 classes. When set, the very first body write
- // operation (from the stub code) would trigger an alignAndReserve
- // method call, that would in turn add the appropriate header padding,
- // such that the body is aligned on a 8-octet boundary. The padding
- // is required for GIOP versions 1.2 and above, only if body is present.
- if (headerPadding == true) {
- headerPadding = false;
- alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
- }
-
- // In GIOP 1.2, we always end fragments at our
- // fragment size, which is an "evenly divisible
- // 8 byte boundary" (aka divisible by 16). A fragment can
- // end with appropriate alignment padding, but no padding
- // is needed with respect to the next GIOP fragment
- // header since it ends on an 8 byte boundary.
-
- bbwi.position(bbwi.position() + computeAlignment(align));
-
- if (bbwi.position() + n > bbwi.buflen)
- grow(align, n);
- }
-
- protected void grow(int align, int n) {
-
- // Save the current size for possible post-fragmentation calculation
- int oldSize = bbwi.position();
-
- // See notes where specialChunk is defined, as well as the
- // above notes for primitiveAcrossFragmentedChunk.
- //
- // If we're writing a primitive and chunking, we need to update
- // the chunk length to include the length of the primitive (unless
- // this complexity is handled by specialChunk).
- //
- // Note that this is wasted processing in the grow case, but that
- // we don't actually close the chunk in that case.
- boolean handleChunk = (inBlock && !specialChunk);
- if (handleChunk) {
- int oldIndex = bbwi.position();
-
- bbwi.position(blockSizeIndex - 4);
-
- writeLongWithoutAlign((oldIndex - blockSizeIndex) + n);
-
- bbwi.position(oldIndex);
- }
-
- bbwi.needed = n;
- bufferManagerWrite.overflow(bbwi);
-
- // At this point, if we fragmented, we should have a ByteBufferWithInfo
- // with the fragment header already marshalled. The buflen and position
- // should be updated accordingly, and the fragmented flag should be set.
-
- // Note that fragmented is only true in the streaming and collect cases.
- if (bbwi.fragmented) {
-
- // Clear the flag
- bbwi.fragmented = false;
-
- // Update fragmentOffset so indirections work properly.
- // At this point, oldSize is the entire length of the
- // previous buffer. bbwi.position() is the length of the
- // fragment header of this buffer.
- fragmentOffset += (oldSize - bbwi.position());
-
- // We just fragmented, and need to signal that we should
- // start a new chunk after writing the primitive.
- if (handleChunk)
- primitiveAcrossFragmentedChunk = true;
-
- }
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- public void write_wchar(char x)
- {
- // In GIOP 1.2, a wchar is encoded as an unsigned octet length
- // followed by the octets of the converted wchar. This is good,
- // but it causes problems with our chunking code. We don't
- // want that octet to get put in a different chunk at the end
- // of the previous fragment.
- //
- // Ensure that this won't happen by overriding write_wchar_array
- // and doing our own handleSpecialChunkBegin/End here.
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(x);
-
- handleSpecialChunkBegin(1 + converter.getNumBytes());
-
- write_octet((byte)converter.getNumBytes());
-
- byte[] result = converter.getBytes();
-
- // Write the bytes without messing with chunking
- // See CDROutputStream_1_0
- internalWriteOctetArray(result, 0, converter.getNumBytes());
-
- handleSpecialChunkEnd();
- }
-
- public void write_wchar_array(char[] value, int offset, int length)
- {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- // Unfortunately, because of chunking, we have to convert the
- // entire char[] to a byte[] array first so we can know how
- // many bytes we're writing ahead of time. You can't split
- // an array of primitives into multiple chunks.
- int totalNumBytes = 0;
-
- // Remember that every wchar starts with an octet telling
- // its length. The buffer size is an upper bound estimate.
- int maxLength = (int)Math.ceil(converter.getMaxBytesPerChar() * length);
- byte[] buffer = new byte[maxLength + length];
-
- for (int i = 0; i < length; i++) {
- // Convert one wchar
- converter.convert(value[offset + i]);
-
- // Make sure to add the octet length
- buffer[totalNumBytes++] = (byte)converter.getNumBytes();
-
- // Copy it into our buffer
- System.arraycopy(converter.getBytes(), 0,
- buffer, totalNumBytes,
- converter.getNumBytes());
-
- totalNumBytes += converter.getNumBytes();
- }
-
- // Now that we know the total length, we can deal with chunking.
- // Note that we don't have to worry about alignment since they're
- // just octets.
- handleSpecialChunkBegin(totalNumBytes);
-
- // Must use totalNumBytes rather than buffer.length since the
- // buffer.length is only the upper bound estimate.
- internalWriteOctetArray(buffer, 0, totalNumBytes);
-
- handleSpecialChunkEnd();
- }
-
- public void write_wstring(String value) {
- if (value == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
-
- // In GIOP 1.2, wstrings are not terminated by a null. The
- // length is the number of octets in the converted format.
- // A zero length string is represented with the 4 byte length
- // value of 0.
- if (value.length() == 0) {
- write_long(0);
- return;
- }
-
- CodeSetConversion.CTBConverter converter = getWCharConverter();
-
- converter.convert(value);
-
- handleSpecialChunkBegin(computeAlignment(4) + 4 + converter.getNumBytes());
-
- write_long(converter.getNumBytes());
-
- // Write the octet array without tampering with chunking
- internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
-
- handleSpecialChunkEnd();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java 2018-01-30 20:16:58.000000000 -0500
+++ /dev/null 2018-01-30 20:16:58.000000000 -0500
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.util.Hashtable;
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.org.omg.SendingContext.CodeBaseHelper;
-import com.sun.org.omg.SendingContext._CodeBaseImplBase;
-import com.sun.org.omg.SendingContext._CodeBaseStub;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.orb.ORB;
-/**
- * Provides the reading side with a per connection cache of
- * info obtained via calls to the remote CodeBase.
- *
- * Previously, most of this was in IIOPConnection.
- *
- * Features:
- * Delays cache creation unless used
- * Postpones remote calls until necessary
- * Handles creating obj ref from IOR
- * Maintains caches for the following maps:
- * CodeBase IOR to obj ref (global)
- * RepId to implementation URL(s)
- * RepId to remote FVD
- * RepId to superclass type list
- *
- * Needs cache management.
- */
-public class CachedCodeBase extends _CodeBaseImplBase
-{
- private Hashtable implementations, fvds, bases;
- private volatile CodeBase delegate;
- private CorbaConnection conn;
-
- private static Object iorMapLock = new Object();
- private static Hashtable iorMap = new Hashtable<>();
-
- public static synchronized void cleanCache( ORB orb ) {
- synchronized (iorMapLock) {
- for (IOR ior : iorMap.keySet()) {
- if (ior.getORB() == orb) {
- iorMap.remove(ior);
- }
- }
- }
- }
-
- public CachedCodeBase(CorbaConnection connection) {
- conn = connection;
- }
-
- public com.sun.org.omg.CORBA.Repository get_ir () {
- return null;
- }
-
- public synchronized String implementation (String repId) {
- String urlResult = null;
-
- if (implementations == null)
- implementations = new Hashtable();
- else
- urlResult = (String)implementations.get(repId);
-
- if (urlResult == null && connectedCodeBase()) {
- urlResult = delegate.implementation(repId);
-
- if (urlResult != null)
- implementations.put(repId, urlResult);
- }
-
- return urlResult;
- }
-
- public synchronized String[] implementations (String[] repIds) {
- String[] urlResults = new String[repIds.length];
-
- for (int i = 0; i < urlResults.length; i++)
- urlResults[i] = implementation(repIds[i]);
-
- return urlResults;
- }
-
- public synchronized FullValueDescription meta (String repId) {
- FullValueDescription result = null;
-
- if (fvds == null)
- fvds = new Hashtable();
- else
- result = (FullValueDescription)fvds.get(repId);
-
- if (result == null && connectedCodeBase()) {
- result = delegate.meta(repId);
-
- if (result != null)
- fvds.put(repId, result);
- }
-
- return result;
- }
-
- public synchronized FullValueDescription[] metas (String[] repIds) {
- FullValueDescription[] results
- = new FullValueDescription[repIds.length];
-
- for (int i = 0; i < results.length; i++)
- results[i] = meta(repIds[i]);
-
- return results;
- }
-
- public synchronized String[] bases (String repId) {
-
- String[] results = null;
-
- if (bases == null)
- bases = new Hashtable();
- else
- results = (String[])bases.get(repId);
-
- if (results == null && connectedCodeBase()) {
- results = delegate.bases(repId);
-
- if (results != null)
- bases.put(repId, results);
- }
-
- return results;
- }
-
- // Ensures that we've used the connection's IOR to create
- // a valid CodeBase delegate. If this returns false, then
- // it is not valid to access the delegate.
- private synchronized boolean connectedCodeBase() {
- if (delegate != null)
- return true;
-
- // The delegate was null, so see if the connection's
- // IOR was set. If so, then we just need to connect
- // it. Otherwise, there is no hope of checking the
- // remote code base. That could be bug if the
- // service context processing didn't occur, or it
- // could be that we're talking to a foreign ORB which
- // doesn't include this optional service context.
- if (conn.getCodeBaseIOR() == null) {
- // REVISIT. Use Merlin logging service to report that
- // codebase functionality was requested but unavailable.
- if (conn.getBroker().transportDebugFlag)
- conn.dprint("CodeBase unavailable on connection: " + conn);
-
- return false;
- }
-
- synchronized(iorMapLock) {
-
- // Recheck the condition to make sure another
- // thread didn't already do this while we waited
- if (delegate != null)
- return true;
-
- // Do we have a reference initialized by another connection?
- delegate = CachedCodeBase.iorMap.get(conn.getCodeBaseIOR());
-
- if (delegate != null)
- return true;
-
- // Connect the delegate and update the cache
- delegate = CodeBaseHelper.narrow(getObjectFromIOR());
-
- // Save it for the benefit of other connections
- CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(), delegate);
- }
-
- // It's now safe to use the delegate
- return true;
- }
-
- private final org.omg.CORBA.Object getObjectFromIOR() {
- return CDRInputStream_1_0.internalIORToObject(
- conn.getCodeBaseIOR(), null /*stubFactory*/, conn.getBroker());
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java 2018-01-30 20:16:59.000000000 -0500
+++ /dev/null 2018-01-30 20:16:59.000000000 -0500
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * Thread local cache of sun.io code set converters for performance.
- *
- * The thread local class contains a single reference to a Map[]
- * containing two WeakHashMaps. One for CharsetEncoders and
- * one for CharsetDecoders. Constants are defined for indexing.
- *
- * This is used internally by CodeSetConversion.
- */
-class CodeSetCache
-{
- /**
- * The ThreadLocal data is a 2 element Map array indexed
- * by BTC_CACHE_MAP and CTB_CACHE_MAP.
- */
- private ThreadLocal converterCaches = new ThreadLocal() {
- public java.lang.Object initialValue() {
- return new Map[] { new WeakHashMap(), new WeakHashMap() };
- }
- };
-
- /**
- * Index in the thread local converterCaches array for
- * the byte to char converter Map. A key is the Java
- * name corresponding to the desired code set.
- */
- private static final int BTC_CACHE_MAP = 0;
-
- /**
- * Index in the thread local converterCaches array for
- * the char to byte converter Map. A key is the Java
- * name corresponding to the desired code set.
- */
- private static final int CTB_CACHE_MAP = 1;
-
- /**
- * Retrieve a CharsetDecoder from the Map using the given key.
- */
- CharsetDecoder getByteToCharConverter(Object key) {
- Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP];
-
- return (CharsetDecoder)btcMap.get(key);
- }
-
- /**
- * Retrieve a CharsetEncoder from the Map using the given key.
- */
- CharsetEncoder getCharToByteConverter(Object key) {
- Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP];
-
- return (CharsetEncoder)ctbMap.get(key);
- }
-
- /**
- * Stores the given CharsetDecoder in the thread local cache,
- * and returns the same converter.
- */
- CharsetDecoder setConverter(Object key, CharsetDecoder converter) {
- Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP];
-
- btcMap.put(key, converter);
-
- return converter;
- }
-
- /**
- * Stores the given CharsetEncoder in the thread local cache,
- * and returns the same converter.
- */
- CharsetEncoder setConverter(Object key, CharsetEncoder converter) {
-
- Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP];
-
- ctbMap.put(key, converter);
-
- return converter;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java 2018-01-30 20:17:00.000000000 -0500
+++ /dev/null 2018-01-30 20:17:00.000000000 -0500
@@ -1,340 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.StringTokenizer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.NoSuchElementException;
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public final class CodeSetComponentInfo {
-
- /**
- * CodeSetComponent is part of an IOR multi-component profile. Two
- * instances constitute a CodeSetComponentInfo (one for char and one
- * for wchar data)
- */
- public static final class CodeSetComponent {
- int nativeCodeSet;
- int[] conversionCodeSets;
-
- public boolean equals( Object obj )
- {
- if (this == obj)
- return true ;
-
- if (!(obj instanceof CodeSetComponent))
- return false ;
-
- CodeSetComponent other = (CodeSetComponent)obj ;
-
- return (nativeCodeSet == other.nativeCodeSet) &&
- Arrays.equals( conversionCodeSets, other.conversionCodeSets ) ;
- }
-
- public int hashCode()
- {
- int result = nativeCodeSet ;
- for (int ctr=0; ctr= 4) {
-
- int b1 = array[offset] & 0x00FF;
- int b2 = array[offset + 1] & 0x00FF;
-
- char marker = (char)((b1 << 8) | (b2 << 0));
-
- return (marker == UTF16_BE_MARKER || marker == UTF16_LE_MARKER);
- } else
- return false;
- }
-
- /**
- * The current solution for dealing with UTF-16 in CORBA
- * is that if our sun.io converter requires byte order markers,
- * and then we see a CORBA wstring/wchar without them, we
- * switch to the sun.io converter that doesn't require them.
- */
- private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet) {
-
- // Use the getConverter method from our superclass.
- btc = super.getConverter(newCodeSet.getName());
- }
- }
-
- /**
- * CTB converter factory for single byte or variable length encodings.
- */
- public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset) {
- int alignment = (!codeset.isFixedWidth() ?
- 1 :
- codeset.getMaxBytesPerChar());
-
- return new JavaCTBConverter(codeset, alignment);
- }
-
- /**
- * CTB converter factory for multibyte (mainly fixed) encodings.
- *
- * Because of the awkwardness with byte order markers and the possibility of
- * using UCS-2, you must specify both the endianness of the stream as well as
- * whether or not to use byte order markers if applicable. UCS-2 has no byte
- * order markers. UTF-16 has optional markers.
- *
- * If you select useByteOrderMarkers, there is no guarantee that the encoding
- * will use the endianness specified.
- *
- */
- public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset,
- boolean littleEndian,
- boolean useByteOrderMarkers) {
-
- // UCS2 doesn't have byte order markers, and we're encoding it
- // as UTF-16 since UCS2 isn't available in all Java platforms.
- // They should be identical with only minor differences in
- // negative cases.
- if (codeset == OSFCodeSetRegistry.UCS_2)
- return new UTF16CTBConverter(littleEndian);
-
- // We can write UTF-16 with or without a byte order marker.
- if (codeset == OSFCodeSetRegistry.UTF_16) {
- if (useByteOrderMarkers)
- return new UTF16CTBConverter();
- else
- return new UTF16CTBConverter(littleEndian);
- }
-
- // Everything else uses the generic JavaCTBConverter.
- //
- // Variable width encodings are aligned on 1 byte boundaries.
- // A fixed width encoding with a max. of 4 bytes/char should
- // align on a 4 byte boundary. Note that UTF-16 is a special
- // case because of the optional byte order marker, so it's
- // handled above.
- //
- // This doesn't matter for GIOP 1.2 wchars and wstrings
- // since the encoded bytes are treated as an encapsulation.
- int alignment = (!codeset.isFixedWidth() ?
- 1 :
- codeset.getMaxBytesPerChar());
-
- return new JavaCTBConverter(codeset, alignment);
- }
-
- /**
- * BTCConverter factory for single byte or variable width encodings.
- */
- public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset) {
- return new JavaBTCConverter(codeset);
- }
-
- /**
- * BTCConverter factory for fixed width multibyte encodings.
- */
- public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset,
- boolean defaultToLittleEndian) {
-
- if (codeset == OSFCodeSetRegistry.UTF_16 ||
- codeset == OSFCodeSetRegistry.UCS_2) {
-
- return new UTF16BTCConverter(defaultToLittleEndian);
- } else {
- return new JavaBTCConverter(codeset);
- }
- }
-
- /**
- * Follows the code set negotiation algorithm in CORBA formal 99-10-07 13.7.2.
- *
- * Returns the proper negotiated OSF character encoding number or
- * CodeSetConversion.FALLBACK_CODESET.
- */
- private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client,
- CodeSetComponentInfo.CodeSetComponent server) {
-
- // A "null" value for the server's nativeCodeSet means that
- // the server desired not to indicate one. We'll take that
- // to mean that it wants the first thing in its conversion list.
- // If it's conversion list is empty, too, then use the fallback
- // codeset.
- int serverNative = server.nativeCodeSet;
-
- if (serverNative == 0) {
- if (server.conversionCodeSets.length > 0)
- serverNative = server.conversionCodeSets[0];
- else
- return CodeSetConversion.FALLBACK_CODESET;
- }
-
- if (client.nativeCodeSet == serverNative) {
- // Best case -- client and server don't have to convert
- return serverNative;
- }
-
- // Is this client capable of converting to the server's
- // native code set?
- for (int i = 0; i < client.conversionCodeSets.length; i++) {
- if (serverNative == client.conversionCodeSets[i]) {
- // The client will convert to the server's
- // native code set.
- return serverNative;
- }
- }
-
- // Is the server capable of converting to the client's
- // native code set?
- for (int i = 0; i < server.conversionCodeSets.length; i++) {
- if (client.nativeCodeSet == server.conversionCodeSets[i]) {
- // The server will convert to the client's
- // native code set.
- return client.nativeCodeSet;
- }
- }
-
- // See if there are any code sets that both the server and client
- // support (giving preference to the server). The order
- // of conversion sets is from most to least desired.
- for (int i = 0; i < server.conversionCodeSets.length; i++) {
- for (int y = 0; y < client.conversionCodeSets.length; y++) {
- if (server.conversionCodeSets[i] == client.conversionCodeSets[y]) {
- return server.conversionCodeSets[i];
- }
- }
- }
-
- // Before using the fallback codesets, the spec calls for a
- // compatibility check on the native code sets. It doesn't make
- // sense because loss free communication is always possible with
- // UTF8 and UTF16, the fall back code sets. It's also a lot
- // of work to implement. In the case of incompatibility, the
- // spec says to throw a CODESET_INCOMPATIBLE exception.
-
- // Use the fallback
- return CodeSetConversion.FALLBACK_CODESET;
- }
-
- /**
- * Perform the code set negotiation algorithm and come up with
- * the two encodings to use.
- */
- public CodeSetComponentInfo.CodeSetContext negotiate(CodeSetComponentInfo client,
- CodeSetComponentInfo server) {
- int charData
- = selectEncoding(client.getCharComponent(),
- server.getCharComponent());
-
- if (charData == CodeSetConversion.FALLBACK_CODESET) {
- charData = OSFCodeSetRegistry.UTF_8.getNumber();
- }
-
- int wcharData
- = selectEncoding(client.getWCharComponent(),
- server.getWCharComponent());
-
- if (wcharData == CodeSetConversion.FALLBACK_CODESET) {
- wcharData = OSFCodeSetRegistry.UTF_16.getNumber();
- }
-
- return new CodeSetComponentInfo.CodeSetContext(charData,
- wcharData);
- }
-
- // No one should instantiate a CodeSetConversion but the singleton
- // instance method
- private CodeSetConversion() {}
-
- // initialize-on-demand holder
- private static class CodeSetConversionHolder {
- static final CodeSetConversion csc = new CodeSetConversion() ;
- }
-
- /**
- * CodeSetConversion is a singleton, and this is the access point.
- */
- public final static CodeSetConversion impl() {
- return CodeSetConversionHolder.csc ;
- }
-
- // Singleton instance
- private static CodeSetConversion implementation;
-
- // Number used internally to indicate the fallback code
- // set.
- private static final int FALLBACK_CODESET = 0;
-
- // Provides a thread local cache for the sun.io
- // converters.
- private CodeSetCache cache = new CodeSetCache();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java 2018-01-30 20:17:01.000000000 -0500
+++ /dev/null 2018-01-30 20:17:01.000000000 -0500
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.nio.ByteBuffer;
-import org.omg.CORBA.CompletionStatus;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-import sun.corba.EncapsInputStreamFactory;
-/**
- * Encapsulations are supposed to explicitly define their
- * code sets and GIOP version. The original resolution to issue 2784
- * said that the defaults were UTF-8 and UTF-16, but that was not
- * agreed upon.
- *
- * These streams currently use CDR 1.2 with ISO8859-1 for char/string and
- * UTF16 for wchar/wstring. If no byte order marker is available,
- * the endianness of the encapsulation is used.
- *
- * When more encapsulations arise that have their own special code
- * sets defined, we can make all constructors take such parameters.
- */
-public class EncapsInputStream extends CDRInputStream
-{
- private ORBUtilSystemException wrapper ;
-
- // corba/EncapsOutputStream
- // corba/ORBSingleton
- // iiop/ORB
- public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf,
- int size, boolean littleEndian,
- GIOPVersion version) {
- super(orb, ByteBuffer.wrap(buf), size, littleEndian,
- version, Message.CDR_ENC_VERSION,
- BufferManagerFactory.newBufferManagerRead(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- (ORB)orb));
-
- wrapper = ORBUtilSystemException.get( (ORB)orb,
- CORBALogDomains.RPC_ENCODING ) ;
-
- performORBVersionSpecificInit();
- }
-
- public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer,
- int size, boolean littleEndian,
- GIOPVersion version) {
- super(orb, byteBuffer, size, littleEndian,
- version, Message.CDR_ENC_VERSION,
- BufferManagerFactory.newBufferManagerRead(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- (com.sun.corba.se.spi.orb.ORB)orb));
-
- performORBVersionSpecificInit();
- }
-
- // ior/IdentifiableBase
- // ior/IIOPProfile
- // corba/ORBSingleton
- // iiop/ORB
- public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size)
- {
- this(orb, data, size, GIOPVersion.V1_2);
- }
-
- // corba/AnyImpl
- public EncapsInputStream(EncapsInputStream eis)
- {
- super(eis);
-
- wrapper = ORBUtilSystemException.get( (ORB)(eis.orb()),
- CORBALogDomains.RPC_ENCODING ) ;
-
- performORBVersionSpecificInit();
- }
-
- // CDREncapsCodec
- // ServiceContext
- //
- // Assumes big endian (can use consumeEndian to read and set
- // the endianness if it is an encapsulation with a byte order
- // mark at the beginning)
- public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version)
- {
- this(orb, data, size, false, version);
- }
-
- /**
- * Full constructor with a CodeBase parameter useful for
- * unmarshaling RMI-IIOP valuetypes (technically against the
- * intention of an encapsulation, but necessary due to OMG
- * issue 4795. Used by ServiceContexts.
- */
- public EncapsInputStream(org.omg.CORBA.ORB orb,
- byte[] data,
- int size,
- GIOPVersion version,
- CodeBase codeBase) {
- super(orb,
- ByteBuffer.wrap(data),
- size,
- false,
- version, Message.CDR_ENC_VERSION,
- BufferManagerFactory.newBufferManagerRead(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- (ORB)orb));
-
- this.codeBase = codeBase;
-
- performORBVersionSpecificInit();
- }
-
- public CDRInputStream dup() {
- return EncapsInputStreamFactory.newEncapsInputStream(this);
- }
-
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- protected CodeSetConversion.BTCConverter createWCharBTCConverter() {
- // Wide characters don't exist in GIOP 1.0
- if (getGIOPVersion().equals(GIOPVersion.V1_0))
- throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
-
- // In GIOP 1.1, we shouldn't have byte order markers. Take the order
- // of the stream if we don't see them.
- if (getGIOPVersion().equals(GIOPVersion.V1_1))
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16,
- isLittleEndian());
-
- // Assume anything else adheres to GIOP 1.2 requirements.
- //
- // Our UTF_16 converter will work with byte order markers, and if
- // they aren't present, it will use the provided endianness.
- //
- // With no byte order marker, it's big endian in GIOP 1.2.
- // formal 00-11-03 15.3.16.
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16,
- false);
- }
-
- public CodeBase getCodeBase() {
- return codeBase;
- }
-
- private CodeBase codeBase;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java 2018-01-30 20:17:02.000000000 -0500
+++ /dev/null 2018-01-30 20:17:02.000000000 -0500
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.BufferManagerWrite;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-import sun.corba.EncapsInputStreamFactory;
-
-/**
- * Encapsulations are supposed to explicitly define their
- * code sets and GIOP version. The original resolution to issue 2784
- * said that the defaults were UTF-8 and UTF-16, but that was not
- * agreed upon.
- *
- * These streams currently use CDR 1.2 with ISO8859-1 for char/string and
- * UTF16 for wchar/wstring. If no byte order marker is available,
- * the endianness of the encapsulation is used.
- *
- * When more encapsulations arise that have their own special code
- * sets defined, we can make all constructors take such parameters.
- */
-public class EncapsOutputStream extends CDROutputStream
-{
-
- // REVISIT - Right now, EncapsOutputStream's do not use
- // pooled byte buffers. This is controlled by the following
- // static constant. This should be re-factored such that
- // the EncapsOutputStream doesn't know it's using pooled
- // byte buffers.
- final static boolean usePooledByteBuffers = false;
-
- // REVISIT - Right now, valuetypes in encapsulations will
- // only use stream format version 1, which may create problems
- // for service contexts or codecs (?).
-
- // corba/ORB
- // corba/ORBSingleton
- // iiop/ORB
- // iiop/GIOPImpl
- // corba/AnyImpl
- public EncapsOutputStream(ORB orb) {
- // GIOP version 1.2 with no fragmentation, big endian,
- // UTF8 for char data and UTF-16 for wide char data;
- this(orb, GIOPVersion.V1_2);
- }
-
- // CDREncapsCodec
- //
- // REVISIT. A UTF-16 encoding with GIOP 1.1 will not work
- // with byte order markers.
- public EncapsOutputStream(ORB orb, GIOPVersion version) {
- this(orb, version, false);
- }
-
- // Used by IIOPProfileTemplate
- //
- public EncapsOutputStream(ORB orb, boolean isLittleEndian) {
- this(orb, GIOPVersion.V1_2, isLittleEndian);
- }
-
- public EncapsOutputStream(ORB orb,
- GIOPVersion version,
- boolean isLittleEndian)
- {
- super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian,
- BufferManagerFactory.newBufferManagerWrite(
- BufferManagerFactory.GROW,
- Message.CDR_ENC_VERSION,
- orb),
- ORBConstants.STREAM_FORMAT_VERSION_1,
- usePooledByteBuffers);
- }
-
- public org.omg.CORBA.portable.InputStream create_input_stream() {
- freeInternalCaches();
-
- return EncapsInputStreamFactory.newEncapsInputStream(orb(),
- getByteBuffer(),
- getSize(),
- isLittleEndian(),
- getGIOPVersion());
- }
-
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
- if (getGIOPVersion().equals(GIOPVersion.V1_0))
- throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
-
- // In the case of GIOP 1.1, we take the byte order of the stream and don't
- // use byte order markers since we're limited to a 2 byte fixed width encoding.
- if (getGIOPVersion().equals(GIOPVersion.V1_1))
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
- isLittleEndian(),
- false);
-
- // Assume anything else meets GIOP 1.2 requirements
- //
- // Use byte order markers? If not, use big endian in GIOP 1.2.
- // (formal 00-11-03 15.3.16)
-
- boolean useBOM = ((ORB)orb()).getORBData().useByteOrderMarkersInEncapsulations();
-
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
- false,
- useBOM);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java 2018-01-30 20:17:03.000000000 -0500
+++ /dev/null 2018-01-30 20:17:03.000000000 -0500
@@ -1,1083 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.Serializable;
-import java.io.ObjectInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.math.BigDecimal;
-import java.util.LinkedList;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.util.RepositoryId;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.portable.IDLEntity;
-
-/**
- * Implementation class that uses Java serialization for input streams.
- * This assumes a GIOP version 1.2 message format.
- *
- * This class uses a ByteArrayInputStream as the underlying buffer. The
- * first 16 bytes are directly read out of the underlying buffer. This allows
- * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be read as bytes.
- * Subsequent write operations on this output stream object uses
- * ObjectInputStream class to read into the buffer. This allows unmarshaling
- * complex types and graphs using the ObjectInputStream implementation.
- *
- * Note, this class assumes a GIOP 1.2 style header. Further, the first
- * 12 bytes, that is, the GIOPHeader is read directly from the received
- * message, before this stream object is called. So, this class effectively
- * reads only the requestID (4 bytes) directly, and uses the
- * ObjectInputStream for further unmarshaling.
- *
- * @author Ram Jeyaraman
- */
-public class IDLJavaSerializationInputStream extends CDRInputStreamBase {
-
- private ORB orb;
- private int bufSize;
- private ByteBuffer buffer;
- private byte encodingVersion;
- private ObjectInputStream is;
- private _ByteArrayInputStream bis;
- private BufferManagerRead bufferManager;
-
- // [GIOPHeader(12) + requestID(4)] bytes
- private final int directReadLength = Message.GIOPMessageHeaderLength + 4;
-
- // Used for mark / reset operations.
- private boolean markOn;
- private int peekIndex, peekCount;
- private LinkedList markedItemQ = new LinkedList();
-
- protected ORBUtilSystemException wrapper;
-
- class _ByteArrayInputStream extends ByteArrayInputStream {
-
- _ByteArrayInputStream(byte[] buf) {
- super(buf);
- }
-
- int getPosition() {
- return this.pos;
- }
-
- void setPosition(int value) {
- if (value < 0 || value > count) {
- throw new IndexOutOfBoundsException();
- }
- this.pos = value;
- }
- }
-
- class MarshalObjectInputStream extends ObjectInputStream {
-
- ORB orb;
-
- MarshalObjectInputStream(java.io.InputStream out, ORB orb)
- throws IOException {
-
- super(out);
- this.orb = orb;
-
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- // needs SerializablePermission("enableSubstitution")
- enableResolveObject(true);
- return null;
- }
- }
- );
- }
-
- /**
- * Connect the Stub to the ORB.
- */
- protected final Object resolveObject(Object obj) throws IOException {
- try {
- if (StubAdapter.isStub(obj)) {
- StubAdapter.connect(obj, orb);
- }
- } catch (java.rmi.RemoteException re) {
- IOException ie = new IOException("resolveObject failed");
- ie.initCause(re);
- throw ie;
- }
- return obj;
- }
- }
-
- public IDLJavaSerializationInputStream(byte encodingVersion) {
- super();
- this.encodingVersion = encodingVersion;
- }
-
- public void init(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int bufSize,
- boolean littleEndian,
- BufferManagerRead bufferManager) {
- this.orb = (ORB) orb;
- this.bufSize = bufSize;
- this.bufferManager = bufferManager;
- buffer = byteBuffer;
- wrapper =
- ORBUtilSystemException.get((ORB)orb, CORBALogDomains.RPC_ENCODING);
-
- byte[] buf;
- if (buffer.hasArray()) {
- buf = buffer.array();
- } else {
- buf = new byte[bufSize];
- buffer.get(buf);
- }
- // Note: at this point, the buffer position is zero. The setIndex()
- // method call can be used to set a desired read index.
- bis = new _ByteArrayInputStream(buf);
- }
-
- // Called from read_octet or read_long or read_ulong method.
- private void initObjectInputStream() {
- //System.out.print(" is ");
- if (is != null) {
- throw wrapper.javaStreamInitFailed();
- }
- try {
- is = new MarshalObjectInputStream(bis, orb);
- } catch (Exception e) {
- throw wrapper.javaStreamInitFailed(e);
- }
- }
-
- // org.omg.CORBA.portable.InputStream
-
- // Primitive types.
-
- public boolean read_boolean() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Boolean)markedItemQ.removeFirst()).booleanValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Boolean)markedItemQ.get(peekIndex++)).booleanValue();
- }
- try {
- boolean value = is.readBoolean();
- if (markOn) { // enqueue
- markedItemQ.addLast(Boolean.valueOf(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_boolean");
- }
- }
-
- public char read_char() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Character)markedItemQ.removeFirst()).charValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Character)markedItemQ.get(peekIndex++)).charValue();
- }
- try {
- char value = is.readChar();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Character(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_char");
- }
- }
-
- public char read_wchar() {
- return this.read_char();
- }
-
- public byte read_octet() {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bis.getPosition() < directReadLength) {
- byte b = (byte) bis.read();
- if (bis.getPosition() == directReadLength) {
- initObjectInputStream();
- }
- return b;
- }
-
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Byte)markedItemQ.removeFirst()).byteValue();
- }
-
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Byte)markedItemQ.get(peekIndex++)).byteValue();
- }
-
- try {
- byte value = is.readByte();
- if (markOn) { // enqueue
- //markedItemQ.addLast(Byte.valueOf(value)); // only in JDK 1.5
- markedItemQ.addLast(new Byte(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_octet");
- }
- }
-
- public short read_short() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Short)markedItemQ.removeFirst()).shortValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Short)markedItemQ.get(peekIndex++)).shortValue();
- }
-
- try {
- short value = is.readShort();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Short(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_short");
- }
- }
-
- public short read_ushort() {
- return this.read_short();
- }
-
- public int read_long() {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bis.getPosition() < directReadLength) {
-
- // Use big endian (network byte order). This is fixed.
- // Both the writer and reader use the same byte order.
- int b1 = (bis.read() << 24) & 0xFF000000;
- int b2 = (bis.read() << 16) & 0x00FF0000;
- int b3 = (bis.read() << 8) & 0x0000FF00;
- int b4 = (bis.read() << 0) & 0x000000FF;
-
- if (bis.getPosition() == directReadLength) {
- initObjectInputStream();
- } else if (bis.getPosition() > directReadLength) {
- // Cannot happen. All direct reads are contained
- // within the first 16 bytes.
- wrapper.javaSerializationException("read_long");
- }
-
- return (b1 | b2 | b3 | b4);
- }
-
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Integer)markedItemQ.removeFirst()).intValue();
- }
-
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Integer)markedItemQ.get(peekIndex++)).intValue();
- }
-
- try {
- int value = is.readInt();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Integer(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_long");
- }
- }
-
- public int read_ulong() {
- return this.read_long();
- }
-
- public long read_longlong() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Long)markedItemQ.removeFirst()).longValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Long)markedItemQ.get(peekIndex++)).longValue();
- }
-
- try {
- long value = is.readLong();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Long(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_longlong");
- }
- }
-
- public long read_ulonglong() {
- return read_longlong();
- }
-
- public float read_float() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Float)markedItemQ.removeFirst()).floatValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Float)markedItemQ.get(peekIndex++)).floatValue();
- }
-
- try {
- float value = is.readFloat();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Float(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_float");
- }
- }
-
- public double read_double() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return ((Double)markedItemQ.removeFirst()).doubleValue();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return ((Double)markedItemQ.get(peekIndex++)).doubleValue();
- }
-
- try {
- double value = is.readDouble();
- if (markOn) { // enqueue
- markedItemQ.addLast(new Double(value));
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_double");
- }
- }
-
- // String types.
-
- public String read_string() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return (String) markedItemQ.removeFirst();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return (String) markedItemQ.get(peekIndex++);
- }
- try {
- String value = is.readUTF();
- if (markOn) { // enqueue
- markedItemQ.addLast(value);
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_string");
- }
- }
-
- public String read_wstring() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return (String) markedItemQ.removeFirst();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return (String) markedItemQ.get(peekIndex++);
- }
- try {
- String value = (String) is.readObject();
- if (markOn) { // enqueue
- markedItemQ.addLast(value);
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_wstring");
- }
- }
-
- // Array types.
-
- public void read_boolean_array(boolean[] value, int offset, int length){
- for(int i = 0; i < length; i++) {
- value[i+offset] = read_boolean();
- }
- }
-
- public void read_char_array(char[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_char();
- }
- }
-
- public void read_wchar_array(char[] value, int offset, int length) {
- read_char_array(value, offset, length);
- }
-
- public void read_octet_array(byte[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_octet();
- }
- /* // Cannot use this efficient read due to mark/reset support.
- try {
- while (length > 0) {
- int n = is.read(value, offset, length);
- offset += n;
- length -= n;
- }
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_octet_array");
- }
- */
- }
-
- public void read_short_array(short[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_short();
- }
- }
-
- public void read_ushort_array(short[] value, int offset, int length) {
- read_short_array(value, offset, length);
- }
-
- public void read_long_array(int[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_long();
- }
- }
-
- public void read_ulong_array(int[] value, int offset, int length) {
- read_long_array(value, offset, length);
- }
-
- public void read_longlong_array(long[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_longlong();
- }
- }
-
- public void read_ulonglong_array(long[] value, int offset, int length) {
- read_longlong_array(value, offset, length);
- }
-
- public void read_float_array(float[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_float();
- }
- }
-
- public void read_double_array(double[] value, int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_double();
- }
- }
-
- // Complex types.
-
- public org.omg.CORBA.Object read_Object() {
- return read_Object(null);
- }
-
- public TypeCode read_TypeCode() {
- TypeCodeImpl tc = new TypeCodeImpl(orb);
- tc.read_value(parent);
- return tc;
- }
-
- public Any read_any() {
-
- Any any = orb.create_any();
- TypeCodeImpl tc = new TypeCodeImpl(orb);
-
- // read off the typecode
-
- // REVISIT We could avoid this try-catch if we could peek the typecode
- // kind off this stream and see if it is a tk_value.
- // Looking at the code we know that for tk_value the Any.read_value()
- // below ignores the tc argument anyway (except for the kind field).
- // But still we would need to make sure that the whole typecode,
- // including encapsulations, is read off.
- try {
- tc.read_value(parent);
- } catch (org.omg.CORBA.MARSHAL ex) {
- if (tc.kind().value() != org.omg.CORBA.TCKind._tk_value) {
- throw ex;
- }
- // We can be sure that the whole typecode encapsulation has been
- // read off.
- ex.printStackTrace();
- }
-
- // read off the value of the any.
- any.read_value(parent, tc);
-
- return any;
- }
-
- public Principal read_Principal() {
- // We don't need an implementation for this method, since principal
- // is absent in GIOP version 1.2 or above.
- int len = read_long();
- byte[] pvalue = new byte[len];
- read_octet_array(pvalue,0,len);
- Principal p = new com.sun.corba.se.impl.corba.PrincipalImpl();
- p.name(pvalue);
- return p;
- }
-
- public BigDecimal read_fixed() {
- return new BigDecimal(read_fixed_buffer().toString());
- }
-
- // Each octet contains (up to) two decimal digits. If the fixed type has
- // an odd number of decimal digits, then the representation
- // begins with the first (most significant) digit.
- // Otherwise, this first half-octet is all zero, and the first digit
- // is in the second half-octet.
- // The sign configuration, in the last half-octet of the representation,
- // is 0xD for negative numbers and 0xC for positive and zero values.
- private StringBuffer read_fixed_buffer() {
- StringBuffer buffer = new StringBuffer(64);
- byte doubleDigit;
- int firstDigit;
- int secondDigit;
- boolean wroteFirstDigit = false;
- boolean more = true;
- while (more) {
- doubleDigit = read_octet();
- firstDigit = (int)((doubleDigit & 0xf0) >> 4);
- secondDigit = (int)(doubleDigit & 0x0f);
- if (wroteFirstDigit || firstDigit != 0) {
- buffer.append(Character.forDigit(firstDigit, 10));
- wroteFirstDigit = true;
- }
- if (secondDigit == 12) {
- // positive number or zero
- if ( ! wroteFirstDigit) {
- // zero
- return new StringBuffer("0.0");
- } else {
- // positive number
- // done
- }
- more = false;
- } else if (secondDigit == 13) {
- // negative number
- buffer.insert(0, '-');
- more = false;
- } else {
- buffer.append(Character.forDigit(secondDigit, 10));
- wroteFirstDigit = true;
- }
- }
- return buffer;
- }
-
- public org.omg.CORBA.Object read_Object(java.lang.Class clz) {
-
- // In any case, we must first read the IOR.
- IOR ior = IORFactories.makeIOR(parent) ;
- if (ior.isNil()) {
- return null;
- }
-
- PresentationManager.StubFactoryFactory sff =
- ORB.getStubFactoryFactory();
- String codeBase = ior.getProfile().getCodebase();
- PresentationManager.StubFactory stubFactory = null;
-
- if (clz == null) {
- RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId() );
- String className = rid.getClassName();
- boolean isIDLInterface = rid.isIDLType();
-
- if (className == null || className.equals( "" )) {
- stubFactory = null;
- } else {
- try {
- stubFactory = sff.createStubFactory(className,
- isIDLInterface, codeBase, (Class) null,
- (ClassLoader) null);
- } catch (Exception exc) {
- // Could not create stubFactory, so use null.
- // XXX stubFactory handling is still too complex:
- // Can we resolve the stubFactory question once in
- // a single place?
- stubFactory = null ;
- }
- }
- } else if (StubAdapter.isStubClass(clz)) {
- stubFactory = PresentationDefaults.makeStaticStubFactory(clz);
- } else {
- // clz is an interface class
- boolean isIDL = IDLEntity.class.isAssignableFrom(clz);
-
- stubFactory = sff.createStubFactory(
- clz.getName(), isIDL, codeBase, clz, clz.getClassLoader());
- }
-
- return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb);
- }
-
- public org.omg.CORBA.ORB orb() {
- return this.orb;
- }
-
- // org.omg.CORBA_2_3.portable.InputStream
-
- public java.io.Serializable read_value() {
- if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
- return (Serializable) markedItemQ.removeFirst();
- }
- if (markOn && !(markedItemQ.isEmpty()) &&
- (peekIndex < peekCount)) { // peek
- return (Serializable) markedItemQ.get(peekIndex++);
- }
- try {
- Serializable value = (java.io.Serializable) is.readObject();
- if (markOn) { // enqueue
- markedItemQ.addLast(value);
- }
- return value;
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "read_value");
- }
- }
-
- public java.io.Serializable read_value(java.lang.Class clz) {
- return read_value();
- }
-
- public java.io.Serializable read_value(
- org.omg.CORBA.portable.BoxedValueHelper factory) {
- return read_value();
- }
-
- public java.io.Serializable read_value(java.lang.String rep_id) {
- return read_value();
- }
-
- public java.io.Serializable read_value(java.io.Serializable value) {
- return read_value();
- }
-
- public java.lang.Object read_abstract_interface() {
- return read_abstract_interface(null);
- }
-
- public java.lang.Object read_abstract_interface(java.lang.Class clz) {
- boolean isObject = read_boolean();
- if (isObject) {
- return read_Object(clz);
- } else {
- return read_value();
- }
- }
-
- // com.sun.corba.se.impl.encoding.MarshalInputStream
- public void consumeEndian() {
- throw wrapper.giopVersionError();
- }
-
- public int getPosition() {
- try {
- return bis.getPosition();
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "getPosition");
- }
- }
-
- // org.omg.CORBA.DataInputStream
- public java.lang.Object read_Abstract() {
- return read_abstract_interface();
- }
-
- public java.io.Serializable read_Value() {
- return read_value();
- }
-
- public void read_any_array (org.omg.CORBA.AnySeqHolder seq,
- int offset, int length) {
- read_any_array(seq.value, offset, length);
- }
-
- private final void read_any_array(org.omg.CORBA.Any[] value,
- int offset, int length) {
- for(int i=0; i < length; i++) {
- value[i+offset] = read_any();
- }
- }
-
- public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq,
- int offset, int length){
- read_boolean_array(seq.value, offset, length);
- }
-
- public void read_char_array (org.omg.CORBA.CharSeqHolder seq,
- int offset, int length){
- read_char_array(seq.value, offset, length);
- }
-
- public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq,
- int offset, int length){
- read_wchar_array(seq.value, offset, length);
- }
-
- public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq,
- int offset, int length){
- read_octet_array(seq.value, offset, length);
- }
-
- public void read_short_array (org.omg.CORBA.ShortSeqHolder seq,
- int offset, int length){
- read_short_array(seq.value, offset, length);
- }
-
- public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq,
- int offset, int length){
- read_ushort_array(seq.value, offset, length);
- }
-
- public void read_long_array (org.omg.CORBA.LongSeqHolder seq,
- int offset, int length){
- read_long_array(seq.value, offset, length);
- }
-
- public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq,
- int offset, int length){
- read_ulong_array(seq.value, offset, length);
- }
-
- public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq,
- int offset, int length){
- read_ulonglong_array(seq.value, offset, length);
- }
-
- public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq,
- int offset, int length){
- read_longlong_array(seq.value, offset, length);
- }
-
- public void read_float_array (org.omg.CORBA.FloatSeqHolder seq,
- int offset, int length){
- read_float_array(seq.value, offset, length);
- }
-
- public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq,
- int offset, int length){
- read_double_array(seq.value, offset, length);
- }
-
- // org.omg.CORBA.portable.ValueBase
-
- public String[] _truncatable_ids() {
- throw wrapper.giopVersionError();
- }
-
- // java.io.InputStream
- // REVISIT - should we make these throw UnsupportedOperationExceptions?
- // Right now, they'll go up to the java.io versions!
-
- // public int read(byte b[]) throws IOException;
- // public int read(byte b[], int off, int len) throws IOException
- // public long skip(long n) throws IOException;
- // public int available() throws IOException;
- // public void close() throws IOException;
-
- public void mark(int readLimit) {
- // Nested mark disallowed.
- // Further, mark is not supported until first 16 bytes are read.
- if (markOn || is == null) {
- throw wrapper.javaSerializationException("mark");
- }
- markOn = true;
- if (!(markedItemQ.isEmpty())) {
- peekIndex = 0;
- peekCount = markedItemQ.size();
- }
- /*
- // Note: only ByteArrayInputStream supports mark/reset.
- if (is == null || is.markSupported() == false) {
- throw wrapper.javaSerializationException("mark");
- }
- is.mark(readLimit);
- */
- }
-
- public void reset() {
- markOn = false;
- peekIndex = 0;
- peekCount = 0;
- /*
- // Note: only ByteArrayInputStream supports mark/reset.
- if (is == null || is.markSupported() == false) {
- throw wrapper.javaSerializationException("mark");
- }
- try {
- is.reset();
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "reset");
- }
- */
- }
-
- // This should return false so that outside users (people using the JDK)
- // don't have any guarantees that mark/reset will work in their
- // custom marshaling code. This is necessary since they could do things
- // like expect obj1a == obj1b in the following code:
- //
- // is.mark(10000);
- // Object obj1a = is.readObject();
- // is.reset();
- // Object obj1b = is.readObject();
- //
- public boolean markSupported() {
- return true;
- }
-
- // Needed by AnyImpl and ServiceContexts
- public CDRInputStreamBase dup() {
-
- CDRInputStreamBase result = null ;
-
- try {
- result = (CDRInputStreamBase) this.getClass().newInstance();
- } catch (Exception e) {
- throw wrapper.couldNotDuplicateCdrInputStream(e);
- }
-
- result.init(this.orb, this.buffer, this.bufSize, false, null);
-
- // Set the buffer position.
- ((IDLJavaSerializationInputStream)result).skipBytes(getPosition());
-
- // Set mark related data.
- ((IDLJavaSerializationInputStream)result).
- setMarkData(markOn, peekIndex, peekCount,
- (LinkedList) markedItemQ.clone());
-
- return result;
- }
-
- // Used exclusively by the dup() method.
- void skipBytes(int len) {
- try {
- is.skipBytes(len);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "skipBytes");
- }
- }
-
- // Used exclusively by the dup() method.
- void setMarkData(boolean markOn, int peekIndex, int peekCount,
- LinkedList markedItemQ) {
- this.markOn = markOn;
- this.peekIndex = peekIndex;
- this.peekCount = peekCount;
- this.markedItemQ = markedItemQ;
- }
-
- // Needed by TCUtility
- public java.math.BigDecimal read_fixed(short digits, short scale) {
- // digits isn't really needed here
- StringBuffer buffer = read_fixed_buffer();
- if (digits != buffer.length())
- throw wrapper.badFixed( new Integer(digits),
- new Integer(buffer.length()) ) ;
- buffer.insert(digits - scale, '.');
- return new BigDecimal(buffer.toString());
- }
-
- // Needed by TypeCodeImpl
- public boolean isLittleEndian() {
- throw wrapper.giopVersionError();
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- void setHeaderPadding(boolean headerPadding) {
- // no-op. We don't care about body alignment while using
- // Java serialization. What the GIOP spec states does not apply here.
- }
-
- // Needed by IIOPInputStream and other subclasses
-
- public ByteBuffer getByteBuffer() {
- throw wrapper.giopVersionError();
- }
-
- public void setByteBuffer(ByteBuffer byteBuffer) {
- throw wrapper.giopVersionError();
- }
-
- public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- throw wrapper.giopVersionError();
- }
-
- public int getBufferLength() {
- return bufSize;
- }
-
- public void setBufferLength(int value) {
- // this is redundant, since buffer size was already specified
- // as part of the init call. So, ignore.
- }
-
- public int getIndex() {
- return bis.getPosition();
- }
-
- public void setIndex(int value) {
- try {
- bis.setPosition(value);
- } catch (IndexOutOfBoundsException e) {
- throw wrapper.javaSerializationException(e, "setIndex");
- }
- }
-
- public void orb(org.omg.CORBA.ORB orb) {
- this.orb = (ORB) orb;
- }
-
- public BufferManagerRead getBufferManager() {
- return bufferManager;
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- com.sun.org.omg.SendingContext.CodeBase getCodeBase() {
- return parent.getCodeBase();
- }
-
- void printBuffer() {
- byte[] buf = this.buffer.array();
-
- System.out.println("+++++++ Input Buffer ++++++++");
- System.out.println();
- System.out.println("Current position: " + getPosition());
- System.out.println("Total length : " + this.bufSize);
- System.out.println();
-
- char[] charBuf = new char[16];
-
- try {
-
- for (int i = 0; i < buf.length; i += 16) {
-
- int j = 0;
-
- // For every 16 bytes, there is one line
- // of output. First, the hex output of
- // the 16 bytes with each byte separated
- // by a space.
- while (j < 16 && j + i < buf.length) {
- int k = buf[i + j];
- if (k < 0)
- k = 256 + k;
- String hex = Integer.toHexString(k);
- if (hex.length() == 1)
- hex = "0" + hex;
- System.out.print(hex + " ");
- j++;
- }
-
- // Add any extra spaces to align the
- // text column in case we didn't end
- // at 16
- while (j < 16) {
- System.out.print(" ");
- j++;
- }
-
- // Now output the ASCII equivalents. Non-ASCII
- // characters are shown as periods.
- int x = 0;
-
- while (x < 16 && x + i < buf.length) {
- if (ORBUtility.isPrintable((char)buf[i + x])) {
- charBuf[x] = (char) buf[i + x];
- } else {
- charBuf[x] = '.';
- }
- x++;
- }
- System.out.println(new String(charBuf, 0, x));
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- System.out.println("++++++++++++++++++++++++++++++");
- }
-
- void alignOnBoundary(int octetBoundary) {
- throw wrapper.giopVersionError();
- }
-
- void performORBVersionSpecificInit() {
- // No-op.
- }
-
- public void resetCodeSetConverters() {
- // No-op.
- }
-
- // ValueInputStream -------------------------
-
- public void start_value() {
- throw wrapper.giopVersionError();
- }
-
- public void end_value() {
- throw wrapper.giopVersionError();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java 2018-01-30 20:17:04.000000000 -0500
+++ /dev/null 2018-01-30 20:17:04.000000000 -0500
@@ -1,798 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.ByteArrayOutputStream;
-
-import java.nio.ByteBuffer;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.CompletionStatus;
-
-/**
- * Implementation class that uses Java serialization for output streams.
- * This assumes a GIOP version 1.2 message format.
- *
- * This class uses a ByteArrayOutputStream as the underlying buffer. The
- * first 16 bytes are direct writes into the underlying buffer. This allows
- * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be written as bytes.
- * Subsequent write operations on this output stream object uses
- * ObjectOutputStream class to write into the buffer. This allows marshaling
- * complex types and graphs using the ObjectOutputStream implementation.
- *
- * Note, this class assumes a GIOP 1.2 style header. Note, we expect that the
- * first 16 bytes are written only using the write_octet, write_long or
- * write_ulong method calls.
- *
- * @author Ram Jeyaraman
- */
-final class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
-
- private ORB orb;
- private byte encodingVersion;
- private ObjectOutputStream os;
- private _ByteArrayOutputStream bos;
- private BufferManagerWrite bufferManager;
-
- // [GIOPHeader(12) + requestID(4)] bytes
- private final int directWriteLength = Message.GIOPMessageHeaderLength + 4;
-
- protected ORBUtilSystemException wrapper;
-
- class _ByteArrayOutputStream extends ByteArrayOutputStream {
-
- _ByteArrayOutputStream(int initialSize) {
- super(initialSize);
- }
-
- byte[] getByteArray() {
- return this.buf;
- }
- }
-
- class MarshalObjectOutputStream extends ObjectOutputStream {
-
- ORB orb;
-
- MarshalObjectOutputStream(java.io.OutputStream out, ORB orb)
- throws IOException {
-
- super(out);
- this.orb = orb;
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- // needs SerializablePermission("enableSubstitution")
- enableReplaceObject(true);
- return null;
- }
- }
- );
- }
-
- /**
- * Checks for objects that are instances of java.rmi.Remote
- * that need to be serialized as proxy (Stub) objects.
- */
- protected final Object replaceObject(Object obj) throws IOException {
- try {
- if ((obj instanceof java.rmi.Remote) &&
- !(StubAdapter.isStub(obj))) {
- return Utility.autoConnect(obj, orb, true);
- }
- } catch (Exception e) {
- IOException ie = new IOException("replaceObject failed");
- ie.initCause(e);
- throw ie;
- }
- return obj;
- }
- }
-
- public IDLJavaSerializationOutputStream(byte encodingVersion) {
- super();
- this.encodingVersion = encodingVersion;
- }
-
- public void init(org.omg.CORBA.ORB orb, boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers) {
- this.orb = (ORB) orb;
- this.bufferManager = bufferManager;
- wrapper = ORBUtilSystemException.get((ORB) orb,
- CORBALogDomains.RPC_ENCODING);
- bos =
- new _ByteArrayOutputStream(ORBConstants.GIOP_DEFAULT_BUFFER_SIZE);
- }
-
- // Called from read_octet or read_long or read_ulong method.
- private void initObjectOutputStream() {
- //System.out.print(" os ");
- if (os != null) {
- throw wrapper.javaStreamInitFailed();
- }
- try {
- os = new MarshalObjectOutputStream(bos, orb);
- } catch (Exception e) {
- throw wrapper.javaStreamInitFailed(e);
- }
- }
-
- // org.omg.CORBA.portable.OutputStream
-
- // Primitive types.
-
- public final void write_boolean(boolean value) {
- try {
- os.writeBoolean(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_boolean");
- }
- }
-
- public final void write_char(char value) {
- try {
- os.writeChar(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_char");
- }
- }
-
- public final void write_wchar(char value) {
- this.write_char(value);
- }
-
- public final void write_octet(byte value) {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bos.size() < directWriteLength) {
- bos.write(value); // direct write.
- if (bos.size() == directWriteLength) {
- initObjectOutputStream();
- }
- return;
- }
-
- try {
- os.writeByte(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_octet");
- }
- }
-
- public final void write_short(short value) {
- try {
- os.writeShort(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_short");
- }
- }
-
- public final void write_ushort(short value) {
- this.write_short(value);
- }
-
- public final void write_long(int value) {
-
- // check if size < [ GIOPHeader(12) + requestID(4)] bytes
- if (bos.size() < directWriteLength) {
-
- // Use big endian (network byte order). This is fixed.
- // Both the writer and reader use the same byte order.
- bos.write((byte)((value >>> 24) & 0xFF));
- bos.write((byte)((value >>> 16) & 0xFF));
- bos.write((byte)((value >>> 8) & 0xFF));
- bos.write((byte)((value >>> 0) & 0xFF));
-
- if (bos.size() == directWriteLength) {
- initObjectOutputStream();
- } else if (bos.size() > directWriteLength) {
- // Cannot happen. All direct writes are contained
- // within the first 16 bytes.
- wrapper.javaSerializationException("write_long");
- }
- return;
- }
-
- try {
- os.writeInt(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_long");
- }
- }
-
- public final void write_ulong(int value) {
- this.write_long(value);
- }
-
- public final void write_longlong(long value) {
- try {
- os.writeLong(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_longlong");
- }
- }
-
- public final void write_ulonglong(long value) {
- this.write_longlong(value);
- }
-
- public final void write_float(float value) {
- try {
- os.writeFloat(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_float");
- }
- }
-
- public final void write_double(double value) {
- try {
- os.writeDouble(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_double");
- }
- }
-
- // String types.
-
- public final void write_string(String value) {
- try {
- os.writeUTF(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_string");
- }
- }
-
- public final void write_wstring(String value) {
- try {
- os.writeObject(value);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_wstring");
- }
- }
-
- // Array types.
-
- public final void write_boolean_array(boolean[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_boolean(value[offset + i]);
- }
- }
-
- public final void write_char_array(char[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_char(value[offset + i]);
- }
- }
-
- public final void write_wchar_array(char[] value, int offset, int length) {
- write_char_array(value, offset, length);
- }
-
- public final void write_octet_array(byte[] value, int offset, int length) {
- try {
- os.write(value, offset, length);
- } catch (Exception e) {
- throw wrapper.javaSerializationException(e, "write_octet_array");
- }
- }
-
- public final void write_short_array(short[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_short(value[offset + i]);
- }
- }
-
- public final void write_ushort_array(short[] value,
- int offset, int length){
- write_short_array(value, offset, length);
- }
-
- public final void write_long_array(int[] value, int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_long(value[offset + i]);
- }
- }
-
- public final void write_ulong_array(int[] value, int offset, int length) {
- write_long_array(value, offset, length);
- }
-
- public final void write_longlong_array(long[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_longlong(value[offset + i]);
- }
- }
-
- public final void write_ulonglong_array(long[] value,
- int offset,int length) {
- write_longlong_array(value, offset, length);
- }
-
- public final void write_float_array(float[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_float(value[offset + i]);
- }
- }
-
- public final void write_double_array(double[] value,
- int offset, int length) {
- for (int i = 0; i < length; i++) {
- write_double(value[offset + i]);
- }
- }
-
- // Complex types (objects and graphs).
-
- public final void write_Object(org.omg.CORBA.Object value) {
- if (value == null) {
- IOR nullIOR = IORFactories.makeIOR(orb);
- nullIOR.write(parent);
- return;
- }
- // IDL to Java formal 01-06-06 1.21.4.2
- if (value instanceof org.omg.CORBA.LocalObject) {
- throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
- }
- IOR ior = ORBUtility.connectAndGetIOR(orb, value);
- ior.write(parent);
- return;
- }
-
- public final void write_TypeCode(TypeCode tc) {
- if (tc == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
- TypeCodeImpl tci;
- if (tc instanceof TypeCodeImpl) {
- tci = (TypeCodeImpl) tc;
- } else {
- tci = new TypeCodeImpl(orb, tc);
- }
- tci.write_value((org.omg.CORBA_2_3.portable.OutputStream) parent);
- }
-
- public final void write_any(Any any) {
- if (any == null) {
- throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
- }
- write_TypeCode(any.type());
- any.write_value(parent);
- }
-
- public final void write_Principal(Principal p) {
- // We don't need an implementation for this method, since principal
- // is absent in GIOP version 1.2 or above.
- write_long(p.name().length);
- write_octet_array(p.name(), 0, p.name().length);
- }
-
- public final void write_fixed(java.math.BigDecimal bigDecimal) {
- // This string might contain sign and/or dot
- this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
- }
-
- // The string may contain a sign and dot
- private void write_fixed(String string, int signum) {
-
- int stringLength = string.length();
-
- // Each octet contains (up to) two decimal digits.
- byte doubleDigit = 0;
- char ch;
- byte digit;
-
- // First calculate the string length without optional sign and dot.
- int numDigits = 0;
- for (int i=0; i= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- // no-op. We don't care about body alignment while using
- // Java serialization. What the GIOP spec states does not apply here.
- }
-
- // ValueOutputStream -----------------------------
-
- public void start_value(String rep_id) {
- throw wrapper.giopVersionError();
- }
-
- public void end_value() {
- throw wrapper.giopVersionError();
- }
-
- // java.io.OutputStream
-
- // Note: These methods are defined in the super class and accessible.
-
- //public abstract void write(byte b[]) throws IOException;
- //public abstract void write(byte b[], int off, int len)
- // throws IOException;
- //public abstract void flush() throws IOException;
- //public abstract void close() throws IOException;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java 2018-01-30 20:17:04.000000000 -0500
+++ /dev/null 2018-01-30 20:17:04.000000000 -0500
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-
-/**
- * Defines an abstraction for a RestorableInputStream to
- * implement mark/reset.
- */
-interface MarkAndResetHandler
-{
- void mark(RestorableInputStream inputStream);
-
- void fragmentationOccured(ByteBufferWithInfo newFragment);
-
- void reset();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java 2018-01-30 20:17:05.000000000 -0500
+++ /dev/null 2018-01-30 20:17:05.000000000 -0500
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-public interface MarshalInputStream {
- public boolean read_boolean();
- public char read_char();
- public char read_wchar();
- public byte read_octet();
- public short read_short();
- public short read_ushort();
- public int read_long();
- public int read_ulong();
- public long read_longlong();
- public long read_ulonglong();
- public float read_float();
- public double read_double();
- public String read_string();
- public String read_wstring();
-
- public void read_boolean_array(boolean[] value, int offset, int length);
- public void read_char_array(char[] value, int offset, int length);
- public void read_wchar_array(char[] value, int offset, int length);
- public void read_octet_array(byte[] value, int offset, int length);
- public void read_short_array(short[] value, int offset, int length);
- public void read_ushort_array(short[] value, int offset, int length);
- public void read_long_array(int[] value, int offset, int length);
- public void read_ulong_array(int[] value, int offset, int length);
- public void read_longlong_array(long[] value, int offset, int length);
- public void read_ulonglong_array(long[] value, int offset, int length);
- public void read_float_array(float[] value, int offset, int length);
- public void read_double_array(double[] value, int offset, int length);
-
- public org.omg.CORBA.Object read_Object();
- public TypeCode read_TypeCode();
- public Any read_any();
- public Principal read_Principal();
-
- /*
- * The methods necessary to support RMI
- */
- public org.omg.CORBA.Object read_Object(Class stubClass);
- public java.io.Serializable read_value() throws Exception;
-
- /*
- * Additional Methods
- */
- public void consumeEndian();
-
- // Determines the current byte stream position
- // (also handles fragmented streams)
- public int getPosition();
-
- // mark/reset from java.io.InputStream
- public void mark(int readAheadLimit);
- public void reset();
-
- /**
- * This must be called once before unmarshaling valuetypes or anything
- * that uses repository IDs. The ORB's version should be set
- * to the desired value prior to calling.
- */
- public void performORBVersionSpecificInit();
-
- /**
- * Tells the input stream to null any code set converter
- * references, forcing it to reacquire them if it needs
- * converters again. This is used when the server
- * input stream needs to switch the connection's char code set
- * converter to something different after reading the
- * code set service context for the first time. Initially,
- * we use ISO8859-1 to read the operation name (it can't
- * be more than ASCII).
- */
- public void resetCodeSetConverters();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java 2018-01-30 20:17:06.000000000 -0500
+++ /dev/null 2018-01-30 20:17:06.000000000 -0500
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import org.omg.CORBA.portable.InputStream;
-
-public interface MarshalOutputStream {
-
- public InputStream create_input_stream();
-
- public void write_boolean(boolean value);
- public void write_char(char value);
- public void write_wchar(char value);
- public void write_octet(byte value);
- public void write_short(short value);
- public void write_ushort(short value);
- public void write_long(int value);
- public void write_ulong(int value);
- public void write_longlong(long value);
- public void write_ulonglong(long value);
- public void write_float(float value);
- public void write_double(double value);
- public void write_string(String value);
- public void write_wstring(String value);
-
- public void write_boolean_array(boolean[] value, int offset, int length);
- public void write_char_array(char[] value, int offset, int length);
- public void write_wchar_array(char[] value, int offset, int length);
- public void write_octet_array(byte[] value, int offset, int length);
- public void write_short_array(short[] value, int offset, int length);
- public void write_ushort_array(short[] value, int offset, int length);
- public void write_long_array(int[] value, int offset, int length);
- public void write_ulong_array(int[] value, int offset, int length);
- public void write_longlong_array(long[] value, int offset, int length);
- public void write_ulonglong_array(long[] value, int offset, int length);
- public void write_float_array(float[] value, int offset, int length);
- public void write_double_array(double[] value, int offset, int length);
-
- public void write_Object(org.omg.CORBA.Object value);
- public void write_TypeCode(TypeCode value);
- public void write_any(Any value);
- public void write_Principal(Principal value);
-
-
- /*
- * The methods necessary to support RMI
- */
- public void write_value(java.io.Serializable value);
- public void start_block();
- public void end_block();
-
- /*
- * Additional Methods
- */
-
- public void putEndian();
- public void writeTo(java.io.OutputStream s)
- throws IOException;
-
- public byte[] toByteArray();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java 2018-01-30 20:17:06.000000000 -0500
+++ /dev/null 2018-01-30 20:17:06.000000000 -0500
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-/**
- *
- * Information from the OSF code set registry version 1.2g.
- *
- * Use the Entry corresponding to the desired code set.
- *
- * Consider rename to CodeSetRegistry since OSF is dead.
- */
-public final class OSFCodeSetRegistry
-{
- // Numbers from the OSF code set registry version 1.2g.
- //
- // Please see the individual Entry definitions for
- // more details.
- public static final int ISO_8859_1_VALUE = 0x00010001;
- public static final int UTF_16_VALUE = 0x00010109;
- public static final int UTF_8_VALUE = 0x05010001;
- public static final int UCS_2_VALUE = 0x00010100;
- public static final int ISO_646_VALUE = 0x00010020;
-
- private OSFCodeSetRegistry() {}
-
- /**
- * An entry in the OSF registry which allows users
- * to find out the equivalent Java character encoding
- * name as well as some other facts from the registry.
- */
- public final static class Entry
- {
- private String javaName;
- private int encodingNum;
- private boolean isFixedWidth;
- private int maxBytesPerChar;
-
- private Entry(String javaName,
- int encodingNum,
- boolean isFixedWidth,
- int maxBytesPerChar) {
- this.javaName = javaName;
- this.encodingNum = encodingNum;
- this.isFixedWidth = isFixedWidth;
- this.maxBytesPerChar = maxBytesPerChar;
- }
-
- /**
- * Returns the Java equivalent name. If the encoding has
- * an optional byte order marker, this name will map to the
- * Java encoding that includes the marker.
- */
- public String getName() {
- return javaName;
- }
-
- /**
- * Get the OSF registry number for this code set.
- */
- public int getNumber() {
- return encodingNum;
- }
-
- /**
- * Is this a fixed or variable width code set? (In CORBA
- * terms, "non-byte-oriented" or a "byte-oriented"
- * code set, respectively)
- */
- public boolean isFixedWidth() {
- return isFixedWidth;
- }
-
- public int getMaxBytesPerChar() {
- return maxBytesPerChar;
- }
-
- /**
- * First checks reference equality since it's expected
- * people will use the pre-defined constant Entries.
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
-
- if (!(obj instanceof OSFCodeSetRegistry.Entry))
- return false;
-
- OSFCodeSetRegistry.Entry other
- = (OSFCodeSetRegistry.Entry)obj;
-
- return (javaName.equals(other.javaName) &&
- encodingNum == other.encodingNum &&
- isFixedWidth == other.isFixedWidth &&
- maxBytesPerChar == other.maxBytesPerChar);
- }
-
- /**
- * Uses the registry number as the hash code.
- */
- public int hashCode() {
- return encodingNum;
- }
- }
-
- /**
- * 8-bit encoding required for GIOP 1.0, and used as the char set
- * when nothing else is specified.
- */
- public static final Entry ISO_8859_1
- = new Entry("ISO-8859-1",
- ISO_8859_1_VALUE,
- true,
- 1);
-
- /**
- * UTF-16 as specified in the OSF registry has an optional
- * byte order marker. UTF-16BE and UTF-16LE are not in the OSF
- * registry since it is no longer being developed. When the OMG
- * switches to the IANA registry, these can be public. Right
- * now, they're used internally by CodeSetConversion.
- */
- static final Entry UTF_16BE
- = new Entry("UTF-16BE",
- -1,
- true,
- 2);
-
- static final Entry UTF_16LE
- = new Entry("UTF-16LE",
- -2,
- true,
- 2);
-
- /**
- * Fallback wchar code set.
- *
- * In the resolution of issue 3405b, UTF-16 defaults to big endian, so
- * doesn't have to have a byte order marker. Unfortunately, this has to be
- * a special case for compatibility.
- */
- public static final Entry UTF_16
- = new Entry("UTF-16",
- UTF_16_VALUE,
- true,
- 4);
-
- /**
- * Fallback char code set. Also the code set for char data
- * in encapsulations. However, since CORBA says chars are
- * only one octet, it is really the same as Latin-1.
- */
- public static final Entry UTF_8
- = new Entry("UTF-8",
- UTF_8_VALUE,
- false,
- 6);
-
- /*
- * At least in JDK 1.3, UCS-2 isn't one of the mandatory Java character
- * encodings. However, our old ORBs require what they call UCS2, even
- * though they didn't necessarily do the correct encoding of it.
- *
- * This is a special case for our legacy ORBs, and put as the last thing
- * in our conversion list for wchar data.
- *
- * If a foreign ORB actually tries to speak UCS2 with us, it probably
- * won't work! Beware!
- */
- public static final Entry UCS_2
- = new Entry("UCS-2",
- UCS_2_VALUE,
- true,
- 2);
-
- /**
- * This is the encoding older JavaSoft ORBs advertised as their
- * CORBA char code set. Actually, they took the lower byte of
- * the Java char. This is a 7-bit encoding, so they
- * were really sending ISO8859-1.
- */
- public static final Entry ISO_646
- = new Entry("US-ASCII",
- ISO_646_VALUE,
- true,
- 1);
-
- /**
- * Given an OSF registry value, return the corresponding Entry.
- * Returns null if an Entry for that value is unavailable.
- */
- public static Entry lookupEntry(int encodingValue) {
- switch(encodingValue) {
- case ISO_8859_1_VALUE:
- return OSFCodeSetRegistry.ISO_8859_1;
- case UTF_16_VALUE:
- return OSFCodeSetRegistry.UTF_16;
- case UTF_8_VALUE:
- return OSFCodeSetRegistry.UTF_8;
- case ISO_646_VALUE:
- return OSFCodeSetRegistry.ISO_646;
- case UCS_2_VALUE:
- return OSFCodeSetRegistry.UCS_2;
- default:
- return null;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java 2018-01-30 20:17:07.000000000 -0500
+++ /dev/null 2018-01-30 20:17:07.000000000 -0500
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-/**
- * Defines the methods on an input stream which provide
- * a way to get and restore its internal state without
- * violating encapsulation.
- */
-interface RestorableInputStream
-{
- Object createStreamMemento();
-
- void restoreInternalState(Object streamMemento);
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java 2018-01-30 20:17:08.000000000 -0500
+++ /dev/null 2018-01-30 20:17:08.000000000 -0500
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-
-import sun.corba.EncapsInputStreamFactory;
-
-public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader
-{
- private Map typeMap = null;
- private InputStream enclosure = null;
- private boolean isEncapsulation = false;
-
- public TypeCodeInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) {
- super(orb, data, size);
- }
-
- public TypeCodeInputStream(org.omg.CORBA.ORB orb,
- byte[] data,
- int size,
- boolean littleEndian,
- GIOPVersion version) {
- super(orb, data, size, littleEndian, version);
- }
-
- public TypeCodeInputStream(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- GIOPVersion version) {
- super(orb, byteBuffer, size, littleEndian, version);
- }
-
- public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) {
- if (typeMap == null) {
- //if (TypeCodeImpl.debug) System.out.println("Creating typeMap");
- typeMap = new HashMap(16);
- }
- //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + tc + " at position " + position);
- typeMap.put(new Integer(position), tc);
- }
-
- public TypeCodeImpl getTypeCodeAtPosition(int position) {
- if (typeMap == null)
- return null;
- //if (TypeCodeImpl.debug) {
- //System.out.println("Getting tc " + (TypeCode)typeMap.get(new Integer(position)) +
- //" at position " + position);
- //}
- return (TypeCodeImpl)typeMap.get(new Integer(position));
- }
-
- public void setEnclosingInputStream(InputStream enclosure) {
- this.enclosure = enclosure;
- }
-
- public TypeCodeReader getTopLevelStream() {
- if (enclosure == null)
- return this;
- if (enclosure instanceof TypeCodeReader)
- return ((TypeCodeReader)enclosure).getTopLevelStream();
- return this;
- }
-
- public int getTopLevelPosition() {
- if (enclosure != null && enclosure instanceof TypeCodeReader) {
- // The enclosed stream has to consider if the enclosing stream
- // had to read the enclosed stream completely when creating it.
- // This is why the size of the enclosed stream needs to be substracted.
- int topPos = ((TypeCodeReader)enclosure).getTopLevelPosition();
- // Substract getBufferLength from the parents pos because it read this stream
- // from its own when creating it
- int pos = topPos - getBufferLength() + getPosition();
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeInputStream.getTopLevelPosition using getTopLevelPosition " + topPos +
- //(isEncapsulation ? " - encaps length 4" : "") +
- //" - getBufferLength() " + getBufferLength() +
- //" + getPosition() " + getPosition() + " = " + pos);
- //}
- return pos;
- }
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeInputStream.getTopLevelPosition returning getPosition() = " +
- //getPosition() + " because enclosure is " + enclosure);
- //}
- return getPosition();
- }
-
- public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORBA.ORB _orb) {
- // _REVISIT_ Would be nice if we didn't have to copy the buffer!
- TypeCodeInputStream encap;
-
- int encapLength = is.read_long();
-
- // read off part of the buffer corresponding to the encapsulation
- byte[] encapBuffer = new byte[encapLength];
- is.read_octet_array(encapBuffer, 0, encapBuffer.length);
-
- // create an encapsulation using the marshal buffer
- if (is instanceof CDRInputStream) {
- encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
- encapBuffer, encapBuffer.length,
- ((CDRInputStream) is).isLittleEndian(),
- ((CDRInputStream) is).getGIOPVersion());
- } else {
- encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
- encapBuffer, encapBuffer.length);
- }
- encap.setEnclosingInputStream(is);
- encap.makeEncapsulation();
- //if (TypeCodeImpl.debug) {
- //System.out.println("Created TypeCodeInputStream " + encap + " with parent " + is);
- //encap.printBuffer();
- //}
- return encap;
- }
-
- protected void makeEncapsulation() {
- // first entry in an encapsulation is the endianess
- consumeEndian();
- isEncapsulation = true;
- }
-
- public void printTypeMap() {
- System.out.println("typeMap = {");
- Iterator i = typeMap.keySet().iterator();
- while (i.hasNext()) {
- Integer pos = (Integer)i.next();
- TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos);
- System.out.println(" key = " + pos.intValue() + ", value = " + tci.description());
- }
- System.out.println("}");
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java 2018-01-30 20:17:09.000000000 -0500
+++ /dev/null 2018-01-30 20:17:09.000000000 -0500
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.CompletionStatus ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-
-import sun.corba.EncapsInputStreamFactory;
-
-public final class TypeCodeOutputStream extends EncapsOutputStream
-{
- private OutputStream enclosure = null;
- private Map typeMap = null;
- private boolean isEncapsulation = false;
-
- public TypeCodeOutputStream(ORB orb) {
- super(orb, false);
- }
-
- public TypeCodeOutputStream(ORB orb, boolean littleEndian) {
- super(orb, littleEndian);
- }
-
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- TypeCodeInputStream tcis = EncapsInputStreamFactory
- .newTypeCodeInputStream((ORB) orb(), getByteBuffer(),
- getIndex(), isLittleEndian(), getGIOPVersion());
- //if (TypeCodeImpl.debug) {
- //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent");
- //tcis.printBuffer();
- //}
- return tcis;
- }
-
- public void setEnclosingOutputStream(OutputStream enclosure) {
- this.enclosure = enclosure;
- }
-
- /*
- public boolean isEncapsulatedIn(TypeCodeOutputStream outerEnclosure) {
- if (outerEnclosure == this)
- return true;
- if (enclosure == null)
- return false;
- if (enclosure instanceof TypeCodeOutputStream)
- return ((TypeCodeOutputStream)enclosure).isEncapsulatedIn(outerEnclosure);
- // Last chance! Recursion ends with first non TypeCodeOutputStream.
- return (enclosure == outerEnclosure);
- }
- */
-
- public TypeCodeOutputStream getTopLevelStream() {
- if (enclosure == null)
- return this;
- if (enclosure instanceof TypeCodeOutputStream)
- return ((TypeCodeOutputStream)enclosure).getTopLevelStream();
- return this;
- }
-
- public int getTopLevelPosition() {
- if (enclosure != null && enclosure instanceof TypeCodeOutputStream) {
- int pos = ((TypeCodeOutputStream)enclosure).getTopLevelPosition() + getPosition();
- // Add four bytes for the encaps length, not another 4 for the byte order
- // which is included in getPosition().
- if (isEncapsulation) pos += 4;
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeOutputStream.getTopLevelPosition using getTopLevelPosition " +
- //((TypeCodeOutputStream)enclosure).getTopLevelPosition() +
- //" + getPosition() " + getPosition() +
- //(isEncapsulation ? " + encaps length 4" : "") +
- //" = " + pos);
- //}
- return pos;
- }
- //if (TypeCodeImpl.debug) {
- //System.out.println("TypeCodeOutputStream.getTopLevelPosition returning getPosition() = " +
- //getPosition() + ", enclosure is " + enclosure);
- //}
- return getPosition();
- }
-
- public void addIDAtPosition(String id, int position) {
- if (typeMap == null)
- typeMap = new HashMap(16);
- //if (TypeCodeImpl.debug) System.out.println(this + " adding id " + id + " at position " + position);
- typeMap.put(id, new Integer(position));
- }
-
- public int getPositionForID(String id) {
- if (typeMap == null)
- throw wrapper.refTypeIndirType( CompletionStatus.COMPLETED_NO ) ;
- //if (TypeCodeImpl.debug) System.out.println("Getting position " + ((Integer)typeMap.get(id)).intValue() +
- //" for id " + id);
- return ((Integer)typeMap.get(id)).intValue();
- }
-
- public void writeRawBuffer(org.omg.CORBA.portable.OutputStream s, int firstLong) {
- // Writes this streams buffer to the given OutputStream
- // without byte order flag and length as is the case for encapsulations.
-
- // Make sure to align s to 4 byte boundaries.
- // Unfortunately we can't do just this:
- // s.alignAndReserve(4, 4);
- // So we have to take the first four bytes given in firstLong and write them
- // with a call to write_long which will trigger the alignment.
- // Then write the rest of the byte array.
-
- //if (TypeCodeImpl.debug) {
- //System.out.println(this + ".writeRawBuffer(" + s + ", " + firstLong + ")");
- //if (s instanceof CDROutputStream) {
- //System.out.println("Parent position before writing kind = " + ((CDROutputStream)s).getIndex());
- //}
- //}
- s.write_long(firstLong);
- //if (TypeCodeImpl.debug) {
- //if (s instanceof CDROutputStream) {
- //System.out.println("Parent position after writing kind = " + ((CDROutputStream)s).getIndex());
- //}
- //}
- ByteBuffer byteBuffer = getByteBuffer();
- if (byteBuffer.hasArray())
- {
- s.write_octet_array(byteBuffer.array(), 4, getIndex() - 4);
- }
- else
- {
- // get bytes from DirectByteBuffer
- // NOTE: Microbenchmarks are showing it is faster to do
- // a loop of ByteBuffer.get(int) than it is to do
- // a bulk ByteBuffer.get(byte[], offset, length)
- byte[] buf = new byte[byteBuffer.limit()];
- for (int i = 0; i < buf.length; i++)
- buf[i] = byteBuffer.get(i);
- s.write_octet_array(buf, 4, getIndex() - 4);
- }
- //if (TypeCodeImpl.debug) {
- //if (s instanceof CDROutputStream) {
- //System.out.println("Parent position after writing all " + getIndex() + " bytes = " + ((CDROutputStream)s).getIndex());
- //}
- //}
- }
-
- public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) {
- TypeCodeOutputStream encap =
- sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian());
- encap.setEnclosingOutputStream(this);
- encap.makeEncapsulation();
- //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this);
- return encap;
- }
-
- protected void makeEncapsulation() {
- // first entry in an encapsulation is the endianess
- putEndian();
- isEncapsulation = true;
- }
-
- public static TypeCodeOutputStream wrapOutputStream(OutputStream os) {
- boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false);
- TypeCodeOutputStream tos =
- sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian);
- tos.setEnclosingOutputStream(os);
- //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os);
- return tos;
- }
-
- public int getPosition() {
- return getIndex();
- }
-
- public int getRealIndex(int index) {
- int topPos = getTopLevelPosition();
- //if (TypeCodeImpl.debug) System.out.println("TypeCodeOutputStream.getRealIndex using getTopLevelPosition " +
- //topPos + " instead of getPosition " + getPosition());
- return topPos;
- }
-/*
- protected void printBuffer() {
- super.printBuffer();
- }
-*/
- public byte[] getTypeCodeBuffer() {
- // Returns the buffer trimmed of the trailing zeros and without the
- // known _kind value at the beginning.
- ByteBuffer theBuffer = getByteBuffer();
- //System.out.println("outBuffer length = " + (getIndex() - 4));
- byte[] tcBuffer = new byte[getIndex() - 4];
- // Micro-benchmarks show that DirectByteBuffer.get(int) is faster
- // than DirectByteBuffer.get(byte[], offset, length).
- // REVISIT - May want to check if buffer is direct or non-direct
- // and use array copy if ByteBuffer is non-direct.
- for (int i = 0; i < tcBuffer.length; i++)
- tcBuffer[i] = theBuffer.get(i+4);
- return tcBuffer;
- }
-
- public void printTypeMap() {
- System.out.println("typeMap = {");
- Iterator i = typeMap.keySet().iterator();
- while (i.hasNext()) {
- String id = (String)i.next();
- Integer pos = (Integer)typeMap.get(id);
- System.out.println(" key = " + id + ", value = " + pos);
- }
- System.out.println("}");
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java 2018-01-30 20:17:10.000000000 -0500
+++ /dev/null 2018-01-30 20:17:10.000000000 -0500
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-
-public interface TypeCodeReader extends MarshalInputStream {
- public void addTypeCodeAtPosition(TypeCodeImpl tc, int position);
- public TypeCodeImpl getTypeCodeAtPosition(int position);
- public void setEnclosingInputStream(InputStream enclosure);
- public TypeCodeReader getTopLevelStream();
- public int getTopLevelPosition();
- // for debugging
- //public void printBuffer();
- public int getPosition();
- public void printTypeMap();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java 2018-01-30 20:17:11.000000000 -0500
+++ /dev/null 2018-01-30 20:17:11.000000000 -0500
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.encoding;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.UnionMember ;
-import org.omg.CORBA.ValueMember ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.Principal ;
-import org.omg.CORBA.BAD_TYPECODE ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.MARSHAL ;
-
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.CDRInputStream;
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-
-public class WrapperInputStream extends org.omg.CORBA_2_3.portable.InputStream implements TypeCodeReader
-{
- private CDRInputStream stream;
- private Map typeMap = null;
- private int startPos = 0;
-
- public WrapperInputStream(CDRInputStream s) {
- super();
- stream = s;
- startPos = stream.getPosition();
- }
-
- public int read() throws IOException { return stream.read(); }
- public int read(byte b[]) throws IOException { return stream.read(b); }
- public int read(byte b[], int off, int len) throws IOException {
- return stream.read(b, off, len);
- }
- public long skip(long n) throws IOException { return stream.skip(n); }
- public int available() throws IOException { return stream.available(); }
- public void close() throws IOException { stream.close(); }
- public void mark(int readlimit) { stream.mark(readlimit); }
- public void reset() { stream.reset(); }
- public boolean markSupported() { return stream.markSupported(); }
- public int getPosition() { return stream.getPosition(); }
- public void consumeEndian() { stream.consumeEndian(); }
- public boolean read_boolean() { return stream.read_boolean(); }
- public char read_char() { return stream.read_char(); }
- public char read_wchar() { return stream.read_wchar(); }
- public byte read_octet() { return stream.read_octet(); }
- public short read_short() { return stream.read_short(); }
- public short read_ushort() { return stream.read_ushort(); }
- public int read_long() { return stream.read_long(); }
- public int read_ulong() { return stream.read_ulong(); }
- public long read_longlong() { return stream.read_longlong(); }
- public long read_ulonglong() { return stream.read_ulonglong(); }
- public float read_float() { return stream.read_float(); }
- public double read_double() { return stream.read_double(); }
- public String read_string() { return stream.read_string(); }
- public String read_wstring() { return stream.read_wstring(); }
-
- public void read_boolean_array(boolean[] value, int offset, int length) {
- stream.read_boolean_array(value, offset, length);
- }
- public void read_char_array(char[] value, int offset, int length) {
- stream.read_char_array(value, offset, length);
- }
- public void read_wchar_array(char[] value, int offset, int length) {
- stream.read_wchar_array(value, offset, length);
- }
- public void read_octet_array(byte[] value, int offset, int length) {
- stream.read_octet_array(value, offset, length);
- }
- public void read_short_array(short[] value, int offset, int length) {
- stream.read_short_array(value, offset, length);
- }
- public void read_ushort_array(short[] value, int offset, int length) {
- stream.read_ushort_array(value, offset, length);
- }
- public void read_long_array(int[] value, int offset, int length) {
- stream.read_long_array(value, offset, length);
- }
- public void read_ulong_array(int[] value, int offset, int length) {
- stream.read_ulong_array(value, offset, length);
- }
- public void read_longlong_array(long[] value, int offset, int length) {
- stream.read_longlong_array(value, offset, length);
- }
- public void read_ulonglong_array(long[] value, int offset, int length) {
- stream.read_ulonglong_array(value, offset, length);
- }
- public void read_float_array(float[] value, int offset, int length) {
- stream.read_float_array(value, offset, length);
- }
- public void read_double_array(double[] value, int offset, int length) {
- stream.read_double_array(value, offset, length);
- }
-
- public org.omg.CORBA.Object read_Object() { return stream.read_Object(); }
- public java.io.Serializable read_value() {return stream.read_value();}
- public TypeCode read_TypeCode() { return stream.read_TypeCode(); }
- public Any read_any() { return stream.read_any(); }
- public Principal read_Principal() { return stream.read_Principal(); }
- public java.math.BigDecimal read_fixed() { return stream.read_fixed(); }
- public org.omg.CORBA.Context read_Context() { return stream.read_Context(); }
-
- public org.omg.CORBA.ORB orb() { return stream.orb(); }
-
- public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) {
- if (typeMap == null) {
- //if (TypeCodeImpl.debug) System.out.println("Creating typeMap");
- typeMap = new HashMap(16);
- }
- //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + tc + " at position " + position);
- typeMap.put(new Integer(position), tc);
- }
-
- public TypeCodeImpl getTypeCodeAtPosition(int position) {
- if (typeMap == null)
- return null;
- //if (TypeCodeImpl.debug) System.out.println("Getting tc " + (TypeCodeImpl)typeMap.get(new Integer(position)) +
- //" at position " + position);
- return (TypeCodeImpl)typeMap.get(new Integer(position));
- }
-
- public void setEnclosingInputStream(InputStream enclosure) {
- // WrapperInputStream has no enclosure
- }
-
- public TypeCodeReader getTopLevelStream() {
- // WrapperInputStream has no enclosure
- return this;
- }
-
- public int getTopLevelPosition() {
- //if (TypeCodeImpl.debug) System.out.println("WrapperInputStream.getTopLevelPosition " +
- //"returning getPosition " + getPosition() + " - startPos " + startPos +
- //" = " + (getPosition() - startPos));
- return getPosition() - startPos;
- }
-
- public void performORBVersionSpecificInit() {
- // This is never actually called on a WrapperInputStream, but
- // exists to satisfy the interface requirement.
- stream.performORBVersionSpecificInit();
- }
-
- public void resetCodeSetConverters() {
- stream.resetCodeSetConverters();
- }
-
- //public void printBuffer() { stream.printBuffer(); }
-
- public void printTypeMap() {
- System.out.println("typeMap = {");
- List sortedKeys = new ArrayList(typeMap.keySet());
- Collections.sort(sortedKeys);
- Iterator i = sortedKeys.iterator();
- while (i.hasNext()) {
- Integer pos = (Integer)i.next();
- TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos);
- System.out.println(" key = " + pos.intValue() + ", value = " + tci.description());
- }
- System.out.println("}");
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java 2018-01-30 20:17:11.000000000 -0500
+++ /dev/null 2018-01-30 20:17:11.000000000 -0500
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.LocalObject;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import sun.corba.EncapsInputStreamFactory;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-import com.sun.corba.se.impl.encoding.EncapsInputStream;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-import org.omg.IOP.Codec;
-import org.omg.IOP.CodecPackage.FormatMismatch;
-import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
-import org.omg.IOP.CodecPackage.TypeMismatch;
-
-/**
- * CDREncapsCodec is an implementation of Codec, as described
- * in orbos/99-12-02, that supports CDR encapsulation version 1.0, 1.1, and
- * 1.2.
- */
-public final class CDREncapsCodec
- extends org.omg.CORBA.LocalObject
- implements Codec
-{
- // The ORB that created the factory this codec was created from
- private ORB orb;
- ORBUtilSystemException wrapper;
-
- // The GIOP version we are encoding for
- private GIOPVersion giopVersion;
-
- /*
- *******************************************************************
- * NOTE: CDREncapsCodec must remain immutable! This is so that we
- * can pre-create CDREncapsCodecs for each version of GIOP in
- * CodecFactoryImpl.
- *******************************************************************/
-
- /**
- * Creates a new codec implementation. Uses the given ORB to create
- * CDRInputStreams when necessary.
- *
- * @param orb The ORB to use to create a CDRInputStream or CDROutputStream
- * @param major The major version of GIOP we are encoding for
- * @param minor The minor version of GIOP we are encoding for
- */
- public CDREncapsCodec( ORB orb, int major, int minor ) {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PROTOCOL ) ;
-
- giopVersion = GIOPVersion.getInstance( (byte)major, (byte)minor );
- }
-
- /**
- * Convert the given any into a CDR encapsulated octet sequence
- */
- public byte[] encode( Any data )
- throws InvalidTypeForEncoding
- {
- if ( data == null )
- throw wrapper.nullParam() ;
- return encodeImpl( data, true );
- }
-
- /**
- * Decode the given octet sequence into an any based on a CDR
- * encapsulated octet sequence.
- */
- public Any decode ( byte[] data )
- throws FormatMismatch
- {
- if( data == null )
- throw wrapper.nullParam() ;
- return decodeImpl( data, null );
- }
-
- /**
- * Convert the given any into a CDR encapsulated octet sequence. Only
- * the data is stored. The type code is not.
- */
- public byte[] encode_value( Any data )
- throws InvalidTypeForEncoding
- {
- if( data == null )
- throw wrapper.nullParam() ;
- return encodeImpl( data, false );
- }
-
- /**
- * Decode the given octet sequence into an any based on a CDR
- * encapsulated octet sequence. The type code is expected not to appear
- * in the octet sequence, and the given type code is used instead.
- */
- public Any decode_value( byte[] data, TypeCode tc )
- throws FormatMismatch, TypeMismatch
- {
- if( data == null )
- throw wrapper.nullParam() ;
- if( tc == null )
- throw wrapper.nullParam() ;
- return decodeImpl( data, tc );
- }
-
- /**
- * Convert the given any into a CDR encapsulated octet sequence.
- * If sendTypeCode is true, the type code is sent with the message, as in
- * a standard encapsulation. If it is false, only the data is sent.
- * Either way, the endian type is sent as the first part of the message.
- */
- private byte[] encodeImpl( Any data, boolean sendTypeCode )
- throws InvalidTypeForEncoding
- {
- if( data == null )
- throw wrapper.nullParam() ;
-
- // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
- // the body of this method. This is due to the fact that CDR*Stream
- // will never throw an exception if the encoding is invalid. To
- // fix this, the CDROutputStream must know the version of GIOP it
- // is encoding for and it must check to ensure that, for example,
- // wstring cannot be encoded in GIOP 1.0.
- //
- // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
- // be versioned. This can be handled once this work is complete.
-
- // Create output stream with default endianness.
- EncapsOutputStream cdrOut =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(
- (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );
-
- // This is an encapsulation, so put out the endian:
- cdrOut.putEndian();
-
- // Sometimes encode type code:
- if( sendTypeCode ) {
- cdrOut.write_TypeCode( data.type() );
- }
-
- // Encode value and return.
- data.write_value( cdrOut );
-
- return cdrOut.toByteArray();
- }
-
- /**
- * Decode the given octet sequence into an any based on a CDR
- * encapsulated octet sequence. If the type code is null, it is
- * expected to appear in the octet sequence. Otherwise, the given
- * type code is used.
- */
- private Any decodeImpl( byte[] data, TypeCode tc )
- throws FormatMismatch
- {
- if( data == null )
- throw wrapper.nullParam() ;
-
- AnyImpl any = null; // return value
-
- // _REVISIT_ Currently there is no way for us to distinguish between
- // a FormatMismatch and a TypeMismatch because we cannot get this
- // information from the CDRInputStream. If a RuntimeException occurs,
- // it is turned into a FormatMismatch exception.
-
- try {
- EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data,
- data.length, giopVersion );
-
-
- cdrIn.consumeEndian();
-
- // If type code not specified, read it from octet stream:
- if( tc == null ) {
- tc = cdrIn.read_TypeCode();
- }
-
- // Create a new Any object:
- any = new AnyImpl( (com.sun.corba.se.spi.orb.ORB)orb );
- any.read_value( cdrIn, tc );
- }
- catch( RuntimeException e ) {
- // See above note.
- throw new FormatMismatch();
- }
-
- return any;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java 2018-01-30 20:17:12.000000000 -0500
+++ /dev/null 2018-01-30 20:17:12.000000000 -0500
@@ -1,978 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import java.util.HashMap ;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.CTX_RESTRICT_SCOPE;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NO_RESOURCES;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.ParameterMode;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.InputStream;
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
-
-import org.omg.IOP.ServiceContext;
-import org.omg.IOP.ServiceContextHelper;
-import org.omg.IOP.TaggedProfile;
-import org.omg.IOP.TaggedProfileHelper;
-import org.omg.IOP.TaggedComponent;
-import org.omg.IOP.TaggedComponentHelper;
-import org.omg.IOP.TAG_INTERNET_IOP;
-import org.omg.Dynamic.Parameter;
-import org.omg.PortableInterceptor.ClientRequestInfo;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.protocol.RetryType;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator;
-
-import com.sun.corba.se.impl.encoding.CDROutputStream;
-import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-/**
- * Implementation of the ClientRequestInfo interface as specified in
- * orbos/99-12-02 section 5.4.2.
- */
-public final class ClientRequestInfoImpl
- extends RequestInfoImpl
- implements ClientRequestInfo
-{
-
- // The available constants for startingPointCall
- static final int CALL_SEND_REQUEST = 0;
- static final int CALL_SEND_POLL = 1;
-
- // The available constants for endingPointCall
- static final int CALL_RECEIVE_REPLY = 0;
- static final int CALL_RECEIVE_EXCEPTION = 1;
- static final int CALL_RECEIVE_OTHER = 2;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- // The current retry request status. True if this request is being
- // retried and this info object is to be reused, or false otherwise.
- private RetryType retryRequest;
-
- // The number of times this info object has been (re)used. This is
- // incremented every time a request is retried, and decremented every
- // time a request is complete. When this reaches zero, the info object
- // is popped from the ClientRequestInfoImpl ThreadLocal stack in the ORB.
- private int entryCount = 0;
-
- // The RequestImpl is set when the call is DII based.
- // The DII query calls like ParameterList, ExceptionList,
- // ContextList will be delegated to RequestImpl.
- private org.omg.CORBA.Request request;
-
- // Sources of client request information
- private boolean diiInitiate;
- private CorbaMessageMediator messageMediator;
-
- // Cached information:
- private org.omg.CORBA.Object cachedTargetObject;
- private org.omg.CORBA.Object cachedEffectiveTargetObject;
- private Parameter[] cachedArguments;
- private TypeCode[] cachedExceptions;
- private String[] cachedContexts;
- private String[] cachedOperationContext;
- private String cachedReceivedExceptionId;
- private Any cachedResult;
- private Any cachedReceivedException;
- private TaggedProfile cachedEffectiveProfile;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedRequestServiceContexts;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedReplyServiceContexts;
- // key = Integer, value = TaggedComponent
- private HashMap cachedEffectiveComponents;
-
-
- protected boolean piCurrentPushed;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Reset the info object so that it can be reused for a retry,
- * for example.
- */
- void reset() {
- super.reset();
-
- // Please keep these in the same order that they're declared above.
-
- // 6763340
- retryRequest = RetryType.NONE;
-
- // Do not reset entryCount because we need to know when to pop this
- // from the stack.
-
- request = null;
- diiInitiate = false;
- messageMediator = null;
-
- // Clear cached attributes:
- cachedTargetObject = null;
- cachedEffectiveTargetObject = null;
- cachedArguments = null;
- cachedExceptions = null;
- cachedContexts = null;
- cachedOperationContext = null;
- cachedReceivedExceptionId = null;
- cachedResult = null;
- cachedReceivedException = null;
- cachedEffectiveProfile = null;
- cachedRequestServiceContexts = null;
- cachedReplyServiceContexts = null;
- cachedEffectiveComponents = null;
-
- piCurrentPushed = false;
-
- startingPointCall = CALL_SEND_REQUEST;
- endingPointCall = CALL_RECEIVE_REPLY;
-
- }
-
- /*
- **********************************************************************
- * Access protection
- **********************************************************************/
-
- // Method IDs for all methods in ClientRequestInfo. This allows for a
- // convenient O(1) lookup for checkAccess().
- protected static final int MID_TARGET = MID_RI_LAST + 1;
- protected static final int MID_EFFECTIVE_TARGET = MID_RI_LAST + 2;
- protected static final int MID_EFFECTIVE_PROFILE = MID_RI_LAST + 3;
- protected static final int MID_RECEIVED_EXCEPTION = MID_RI_LAST + 4;
- protected static final int MID_RECEIVED_EXCEPTION_ID = MID_RI_LAST + 5;
- protected static final int MID_GET_EFFECTIVE_COMPONENT = MID_RI_LAST + 6;
- protected static final int MID_GET_EFFECTIVE_COMPONENTS
- = MID_RI_LAST + 7;
- protected static final int MID_GET_REQUEST_POLICY = MID_RI_LAST + 8;
- protected static final int MID_ADD_REQUEST_SERVICE_CONTEXT
- = MID_RI_LAST + 9;
-
- // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1).
- // Note: These must be in the same order as specified in contants.
- private static final boolean validCall[][] = {
- // LEGEND:
- // s_req = send_request r_rep = receive_reply
- // s_pol = send_poll r_exc = receive_exception
- // r_oth = receive_other
- //
- // A true value indicates call is valid at specified point.
- // A false value indicates the call is invalid.
- //
- //
- // NOTE: If the order or number of columns change, update
- // checkAccess() accordingly.
- //
- // { s_req, s_pol, r_rep, r_exc, r_oth }
- // RequestInfo methods:
- /*request_id*/ { true , true , true , true , true },
- /*operation*/ { true , true , true , true , true },
- /*arguments*/ { true , false, true , false, false },
- /*exceptions*/ { true , false, true , true , true },
- /*contexts*/ { true , false, true , true , true },
- /*operation_context*/ { true , false, true , true , true },
- /*result*/ { false, false, true , false, false },
- /*response_expected*/ { true , true , true , true , true },
- /*sync_scope*/ { true , false, true , true , true },
- /*reply_status*/ { false, false, true , true , true },
- /*forward_reference*/ { false, false, false, false, true },
- /*get_slot*/ { true , true , true , true , true },
- /*get_request_service_context*/ { true , false, true , true , true },
- /*get_reply_service_context*/ { false, false, true , true , true },
- //
- // ClientRequestInfo methods::
- /*target*/ { true , true , true , true , true },
- /*effective_target*/ { true , true , true , true , true },
- /*effective_profile*/ { true , true , true , true , true },
- /*received_exception*/ { false, false, false, true , false },
- /*received_exception_id*/ { false, false, false, true , false },
- /*get_effective_component*/ { true , false, true , true , true },
- /*get_effective_components*/ { true , false, true , true , true },
- /*get_request_policy*/ { true , false, true , true , true },
- /*add_request_service_context*/ { true , false, false, false, false }
- };
-
-
- /*
- **********************************************************************
- * Public ClientRequestInfo interfaces
- **********************************************************************/
-
- /**
- * Creates a new ClientRequestInfo implementation.
- * The constructor is package scope since no other package need create
- * an instance of this class.
- */
- protected ClientRequestInfoImpl( ORB myORB ) {
- super( myORB );
- startingPointCall = CALL_SEND_REQUEST;
- endingPointCall = CALL_RECEIVE_REPLY;
- }
-
- /**
- * The object which the client called to perform the operation.
- */
- public org.omg.CORBA.Object target (){
- // access is currently valid for all states:
- //checkAccess( MID_TARGET );
- if (cachedTargetObject == null) {
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- cachedTargetObject =
- iorToObject(corbaContactInfo.getTargetIOR());
- }
- return cachedTargetObject;
- }
-
- /**
- * The actual object on which the operation will be invoked. If the
- * reply_status is LOCATION_FORWARD, then on subsequent requests,
- * effective_target will contain the forwarded IOR while target will
- * remain unchanged.
- */
- public org.omg.CORBA.Object effective_target() {
- // access is currently valid for all states:
- //checkAccess( MID_EFFECTIVE_TARGET );
-
- // Note: This is not necessarily the same as locatedIOR.
- // Reason: See the way we handle COMM_FAILURES in
- // ClientRequestDispatcher.createRequest, v1.32
-
- if (cachedEffectiveTargetObject == null) {
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- // REVISIT - get through chain like getLocatedIOR helper below.
- cachedEffectiveTargetObject =
- iorToObject(corbaContactInfo.getEffectiveTargetIOR());
- }
- return cachedEffectiveTargetObject;
- }
-
- /**
- * The profile that will be used to send the request. If a location
- * forward has occurred for this operation's object and that object's
- * profile change accordingly, then this profile will be that located
- * profile.
- */
- public TaggedProfile effective_profile (){
- // access is currently valid for all states:
- //checkAccess( MID_EFFECTIVE_PROFILE );
-
- if( cachedEffectiveProfile == null ) {
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- cachedEffectiveProfile =
- corbaContactInfo.getEffectiveProfile().getIOPProfile();
- }
-
- // Good citizen: In the interest of efficiency, we assume interceptors
- // will not modify the returned TaggedProfile in any way so we need
- // not make a deep copy of it.
-
- return cachedEffectiveProfile;
- }
-
- /**
- * Contains the exception to be returned to the client.
- */
- public Any received_exception (){
- checkAccess( MID_RECEIVED_EXCEPTION );
-
- if( cachedReceivedException == null ) {
- cachedReceivedException = exceptionToAny( exception );
- }
-
- // Good citizen: In the interest of efficiency, we assume interceptors
- // will not modify the returned Any in any way so we need
- // not make a deep copy of it.
-
- return cachedReceivedException;
- }
-
- /**
- * The CORBA::RepositoryId of the exception to be returned to the client.
- */
- public String received_exception_id (){
- checkAccess( MID_RECEIVED_EXCEPTION_ID );
-
- if( cachedReceivedExceptionId == null ) {
- String result = null;
-
- if( exception == null ) {
- // Note: exception should never be null here since we will
- // throw a BAD_INV_ORDER if this is not called from
- // receive_exception.
- throw wrapper.exceptionWasNull() ;
- } else if( exception instanceof SystemException ) {
- String name = exception.getClass().getName();
- result = ORBUtility.repositoryIdOf(name);
- } else if( exception instanceof ApplicationException ) {
- result = ((ApplicationException)exception).getId();
- }
-
- // _REVISIT_ We need to be able to handle a UserException in the
- // DII case. How do we extract the ID from a UserException?
-
- cachedReceivedExceptionId = result;
- }
-
- return cachedReceivedExceptionId;
- }
-
- /**
- * Returns the IOP::TaggedComponent with the given ID from the profile
- * selected for this request. IF there is more than one component for a
- * given component ID, it is undefined which component this operation
- * returns (get_effective_component should be called instead).
- */
- public TaggedComponent get_effective_component (int id){
- checkAccess( MID_GET_EFFECTIVE_COMPONENT );
-
- return get_effective_components( id )[0];
- }
-
- /**
- * Returns all the tagged components with the given ID from the profile
- * selected for this request.
- */
- public TaggedComponent[] get_effective_components (int id){
- checkAccess( MID_GET_EFFECTIVE_COMPONENTS );
- Integer integerId = new Integer( id );
- TaggedComponent[] result = null;
- boolean justCreatedCache = false;
-
- if( cachedEffectiveComponents == null ) {
- cachedEffectiveComponents = new HashMap();
- justCreatedCache = true;
- }
- else {
- // Look in cache:
- result = (TaggedComponent[])cachedEffectiveComponents.get(
- integerId );
- }
-
- // null could mean we cached null or not in cache.
- if( (result == null) &&
- (justCreatedCache ||
- !cachedEffectiveComponents.containsKey( integerId ) ) )
- {
- // Not in cache. Get it from the profile:
- CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
- messageMediator.getContactInfo();
- IIOPProfileTemplate ptemp =
- (IIOPProfileTemplate)corbaContactInfo.getEffectiveProfile().
- getTaggedProfileTemplate();
- result = ptemp.getIOPComponents(myORB, id);
- cachedEffectiveComponents.put( integerId, result );
- }
-
- // As per ptc/00-08-06, section 21.3.13.6., If not found, raise
- // BAD_PARAM with minor code INVALID_COMPONENT_ID.
- if( (result == null) || (result.length == 0) ) {
- throw stdWrapper.invalidComponentId( integerId ) ;
- }
-
- // Good citizen: In the interest of efficiency, we will assume
- // interceptors will not modify the returned TaggedCompoent[], or
- // the TaggedComponents inside of it. Otherwise, we would need to
- // clone the array and make a deep copy of its contents.
-
- return result;
- }
-
- /**
- * Returns the given policy in effect for this operation.
- */
- public Policy get_request_policy (int type){
- checkAccess( MID_GET_REQUEST_POLICY );
- // _REVISIT_ Our ORB is not policy-based at this time.
- throw wrapper.piOrbNotPolicyBased() ;
- }
-
- /**
- * Allows interceptors to add service contexts to the request.
- *
- * There is no declaration of the order of the service contexts. They
- * may or may not appear in the order they are added.
- */
- public void add_request_service_context (ServiceContext service_context,
- boolean replace)
- {
- checkAccess( MID_ADD_REQUEST_SERVICE_CONTEXT );
-
- if( cachedRequestServiceContexts == null ) {
- cachedRequestServiceContexts = new HashMap();
- }
-
- addServiceContext( cachedRequestServiceContexts,
- messageMediator.getRequestServiceContexts(),
- service_context, replace );
- }
-
- // NOTE: When adding a method, be sure to:
- // 1. Add a MID_* constant for that method
- // 2. Call checkAccess at the start of the method
- // 3. Define entries in the validCall[][] table for interception points.
-
- /*
- **********************************************************************
- * Public RequestInfo interfaces
- *
- * These are implemented here because they have differing
- * implementations depending on whether this is a client or a server
- * request info object.
- **********************************************************************/
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public int request_id (){
- // access is currently valid for all states:
- //checkAccess( MID_REQUEST_ID );
- /*
- * NOTE: The requestId in client interceptors is the same as the
- * GIOP request id. This works because both interceptors and
- * request ids are scoped by the ORB on the client side.
- */
- return messageMediator.getRequestId();
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public String operation (){
- // access is currently valid for all states:
- //checkAccess( MID_OPERATION );
- return messageMediator.getOperationName();
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public Parameter[] arguments (){
- checkAccess( MID_ARGUMENTS );
-
- if( cachedArguments == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported1() ;
- }
-
- // If it is DII request then get the arguments from the DII req
- // and convert that into parameters.
- cachedArguments = nvListToParameterArray( request.arguments() );
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the Parameter[] array. We also assume
- // they will not change the values of the containing Anys.
-
- return cachedArguments;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public TypeCode[] exceptions (){
- checkAccess( MID_EXCEPTIONS );
-
- if( cachedExceptions == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported2() ;
- }
-
- // Get the list of exceptions from DII request data, If there are
- // no exceptions raised then this method will return null.
- ExceptionList excList = request.exceptions( );
- int count = excList.count();
- TypeCode[] excTCList = new TypeCode[count];
- try {
- for( int i = 0; i < count; i++ ) {
- excTCList[i] = excList.item( i );
- }
- } catch( Exception e ) {
- throw wrapper.exceptionInExceptions( e ) ;
- }
-
- cachedExceptions = excTCList;
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the TypeCode[] array. We also assume
- // they will not change the values of the containing TypeCodes.
-
- return cachedExceptions;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public String[] contexts (){
- checkAccess( MID_CONTEXTS );
-
- if( cachedContexts == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported3() ;
- }
-
- // Get the list of contexts from DII request data, If there are
- // no contexts then this method will return null.
- ContextList ctxList = request.contexts( );
- int count = ctxList.count();
- String[] ctxListToReturn = new String[count];
- try {
- for( int i = 0; i < count; i++ ) {
- ctxListToReturn[i] = ctxList.item( i );
- }
- } catch( Exception e ) {
- throw wrapper.exceptionInContexts( e ) ;
- }
-
- cachedContexts = ctxListToReturn;
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the String[] array.
-
- return cachedContexts;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public String[] operation_context (){
- checkAccess( MID_OPERATION_CONTEXT );
-
- if( cachedOperationContext == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported4() ;
- }
-
- // Get the list of contexts from DII request data, If there are
- // no contexts then this method will return null.
- Context ctx = request.ctx( );
- // _REVISIT_ The API for get_values is not compliant with the spec,
- // Revisit this code once it's fixed.
- // _REVISIT_ Our ORB doesn't support Operation Context, This code
- // will not be excerscised until it's supported.
- // The first parameter in get_values is the start_scope which
- // if blank makes it as a global scope.
- // The second parameter is op_flags which is set to RESTRICT_SCOPE
- // As there is only one defined in the spec.
- // The Third param is the pattern which is '*' requiring it to
- // get all the contexts.
- NVList nvList = ctx.get_values( "", CTX_RESTRICT_SCOPE.value,"*" );
- String[] context = new String[(nvList.count() * 2) ];
- if( ( nvList != null ) &&( nvList.count() != 0 ) ) {
- // The String[] array will contain Name and Value for each
- // context and hence double the size in the array.
- int index = 0;
- for( int i = 0; i < nvList.count(); i++ ) {
- NamedValue nv;
- try {
- nv = nvList.item( i );
- }
- catch (Exception e ) {
- return (String[]) null;
- }
- context[index] = nv.name();
- index++;
- context[index] = nv.value().extract_string();
- index++;
- }
- }
-
- cachedOperationContext = context;
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the String[] array.
-
- return cachedOperationContext;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public Any result (){
- checkAccess( MID_RESULT );
-
- if( cachedResult == null ) {
- if( request == null ) {
- throw stdWrapper.piOperationNotSupported5() ;
- }
- // Get the result from the DII request data.
- NamedValue nvResult = request.result( );
-
- if( nvResult == null ) {
- throw wrapper.piDiiResultIsNull() ;
- }
-
- cachedResult = nvResult.value();
- }
-
- // Good citizen: In the interest of efficiency, we assume that
- // interceptors will not modify the contents of the result Any.
- // Otherwise, we would need to create a deep copy of the Any.
-
- return cachedResult;
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public boolean response_expected (){
- // access is currently valid for all states:
- //checkAccess( MID_RESPONSE_EXPECTED );
- return ! messageMediator.isOneWay();
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public Object forward_reference (){
- checkAccess( MID_FORWARD_REFERENCE );
- // Check to make sure we are in LOCATION_FORWARD
- // state as per ptc/00-08-06, table 21-1
- // footnote 2.
- if( replyStatus != LOCATION_FORWARD.value ) {
- throw stdWrapper.invalidPiCall1() ;
- }
-
- // Do not cache this value since if an interceptor raises
- // forward request then the next interceptor in the
- // list should see the new value.
- IOR ior = getLocatedIOR();
- return iorToObject(ior);
- }
-
- private IOR getLocatedIOR()
- {
- IOR ior;
- CorbaContactInfoList contactInfoList = (CorbaContactInfoList)
- messageMediator.getContactInfo().getContactInfoList();
- ior = contactInfoList.getEffectiveTargetIOR();
- return ior;
- }
-
- protected void setLocatedIOR(IOR ior)
- {
- ORB orb = (ORB) messageMediator.getBroker();
-
- CorbaContactInfoListIterator iterator = (CorbaContactInfoListIterator)
- ((CorbaInvocationInfo)orb.getInvocationInfo())
- .getContactInfoListIterator();
-
- // REVISIT - this most likely causes reportRedirect to happen twice.
- // Once here and once inside the request dispatcher.
- iterator.reportRedirect(
- (CorbaContactInfo)messageMediator.getContactInfo(),
- ior);
- }
-
- /**
- * See RequestInfoImpl for javadoc.
- */
- public org.omg.IOP.ServiceContext get_request_service_context( int id ) {
- checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );
-
- if( cachedRequestServiceContexts == null ) {
- cachedRequestServiceContexts = new HashMap();
- }
-
- return getServiceContext(cachedRequestServiceContexts,
- messageMediator.getRequestServiceContexts(),
- id);
- }
-
- /**
- * does not contain an etry for that ID, BAD_PARAM with a minor code of
- * TBD_BP is raised.
- */
- public org.omg.IOP.ServiceContext get_reply_service_context( int id ) {
- checkAccess( MID_GET_REPLY_SERVICE_CONTEXT );
-
- if( cachedReplyServiceContexts == null ) {
- cachedReplyServiceContexts = new HashMap();
- }
-
- // In the event this is called from a oneway, we will have no
- // response object.
- //
- // In the event this is called after a IIOPConnection.purgeCalls,
- // we will have a response object, but that object will
- // not contain a header (which would hold the service context
- // container). See bug 4624102.
- //
- // REVISIT: this is the only thing used
- // from response at this time. However, a more general solution
- // would avoid accessing other parts of response's header.
- //
- // Instead of throwing a NullPointer, we will
- // "gracefully" handle these with a BAD_PARAM with minor code 25.
-
- try {
- ServiceContexts serviceContexts =
- messageMediator.getReplyServiceContexts();
- if (serviceContexts == null) {
- throw new NullPointerException();
- }
- return getServiceContext(cachedReplyServiceContexts,
- serviceContexts, id);
- } catch (NullPointerException e) {
- // REVISIT how this is programmed - not what it does.
- // See purge calls test. The waiter is woken up by the
- // call to purge calls - but there is no reply containing
- // service contexts.
- throw stdWrapper.invalidServiceContextId( e ) ;
- }
- }
-
- //
- // REVISIT
- // Override RequestInfoImpl connection to work in framework.
- //
-
- public com.sun.corba.se.spi.legacy.connection.Connection connection()
- {
- return (com.sun.corba.se.spi.legacy.connection.Connection)
- messageMediator.getConnection();
- }
-
-
-
- /*
- **********************************************************************
- * Package-scope interfaces
- **********************************************************************/
-
- protected void setInfo(MessageMediator messageMediator)
- {
- this.messageMediator = (CorbaMessageMediator)messageMediator;
- // REVISIT - so mediator can handle DII in subcontract.
- this.messageMediator.setDIIInfo(request);
- }
-
- /**
- * Set or reset the retry request flag.
- */
- void setRetryRequest( RetryType retryRequest ) {
- this.retryRequest = retryRequest;
- }
-
- /**
- * Retrieve the current retry request status.
- */
- RetryType getRetryRequest() {
- // 6763340
- return this.retryRequest;
- }
-
- /**
- * Increases the entry count by 1.
- */
- void incrementEntryCount() {
- this.entryCount++;
- }
-
- /**
- * Decreases the entry count by 1.
- */
- void decrementEntryCount() {
- this.entryCount--;
- }
-
- /**
- * Retrieve the current entry count
- */
- int getEntryCount() {
- return this.entryCount;
- }
-
- /**
- * Overridden from RequestInfoImpl. Calls the super class, then
- * sets the ending point call depending on the reply status.
- */
- protected void setReplyStatus( short replyStatus ) {
- super.setReplyStatus( replyStatus );
- switch( replyStatus ) {
- case SUCCESSFUL.value:
- endingPointCall = CALL_RECEIVE_REPLY;
- break;
- case SYSTEM_EXCEPTION.value:
- case USER_EXCEPTION.value:
- endingPointCall = CALL_RECEIVE_EXCEPTION;
- break;
- case LOCATION_FORWARD.value:
- case TRANSPORT_RETRY.value:
- endingPointCall = CALL_RECEIVE_OTHER;
- break;
- }
- }
-
- /**
- * Sets DII request object in the RequestInfoObject.
- */
- protected void setDIIRequest(org.omg.CORBA.Request req) {
- request = req;
- }
-
- /**
- * Keeps track of whether initiate was called for a DII request. The ORB
- * needs to know this so it knows whether to ignore a second call to
- * initiateClientPIRequest or not.
- */
- protected void setDIIInitiate( boolean diiInitiate ) {
- this.diiInitiate = diiInitiate;
- }
-
- /**
- * See comment for setDIIInitiate
- */
- protected boolean isDIIInitiate() {
- return this.diiInitiate;
- }
-
- /**
- * The PICurrent stack should only be popped if it was pushed.
- * This is generally the case. But exceptions which occur
- * after the stub's entry to _request but before the push
- * end up in _releaseReply which will try to pop unless told not to.
- */
- protected void setPICurrentPushed( boolean piCurrentPushed ) {
- this.piCurrentPushed = piCurrentPushed;
- }
-
- protected boolean isPICurrentPushed() {
- return this.piCurrentPushed;
- }
-
- /**
- * Overridden from RequestInfoImpl.
- */
- protected void setException( Exception exception ) {
- super.setException( exception );
-
- // Clear cached values:
- cachedReceivedException = null;
- cachedReceivedExceptionId = null;
- }
-
- protected boolean getIsOneWay() {
- return ! response_expected();
- }
-
- /**
- * See description for RequestInfoImpl.checkAccess
- */
- protected void checkAccess( int methodID )
- throws BAD_INV_ORDER
- {
- // Make sure currentPoint matches the appropriate index in the
- // validCall table:
- int validCallIndex = 0;
- switch( currentExecutionPoint ) {
- case EXECUTION_POINT_STARTING:
- switch( startingPointCall ) {
- case CALL_SEND_REQUEST:
- validCallIndex = 0;
- break;
- case CALL_SEND_POLL:
- validCallIndex = 1;
- break;
- }
- break;
- case EXECUTION_POINT_ENDING:
- switch( endingPointCall ) {
- case CALL_RECEIVE_REPLY:
- validCallIndex = 2;
- break;
- case CALL_RECEIVE_EXCEPTION:
- validCallIndex = 3;
- break;
- case CALL_RECEIVE_OTHER:
- validCallIndex = 4;
- break;
- }
- break;
- }
-
- // Check the validCall table:
- if( !validCall[methodID][validCallIndex] ) {
- throw stdWrapper.invalidPiCall2() ;
- }
- }
-
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java 2018-01-30 20:17:13.000000000 -0500
+++ /dev/null 2018-01-30 20:17:13.000000000 -0500
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.IOP.Codec;
-import org.omg.IOP.CodecFactory;
-import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
-import org.omg.IOP.Encoding;
-import org.omg.IOP.ENCODING_CDR_ENCAPS;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.LocalObject;
-
-/**
- * CodecFactoryImpl is the implementation of the Codec Factory, as described
- * in orbos/99-12-02.
- */
-public final class CodecFactoryImpl
- extends org.omg.CORBA.LocalObject
- implements CodecFactory
-{
- // The ORB that created this Codec Factory
- private ORB orb;
- private ORBUtilSystemException wrapper ;
-
- // The maximum minor version of GIOP supported by this codec factory.
- // Currently, this is 1.2.
- private static final int MAX_MINOR_VERSION_SUPPORTED = 2;
-
- // The pre-created minor versions of Codec version 1.0, 1.1, ...,
- // 1.(MAX_MINOR_VERSION_SUPPORTED)
- private Codec codecs[] = new Codec[MAX_MINOR_VERSION_SUPPORTED + 1];
-
- /**
- * Creates a new CodecFactory implementation. Stores the ORB that
- * created this factory, for later use by the Codec.
- */
- public CodecFactoryImpl( ORB orb ) {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get(
- (com.sun.corba.se.spi.orb.ORB)orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- // Precreate a codec for version 1.0 through
- // 1.(MAX_MINOR_VERSION_SUPPORTED). This can be
- // done since Codecs are immutable in their current implementation.
- // This is an optimization that eliminates the overhead of creating
- // a new Codec each time create_codec is called.
- for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) {
- codecs[minor] = new CDREncapsCodec( orb, 1, minor );
- }
- }
-
- /**
- * Creates a codec of the given encoding. The only format recognized
- * by this factory is ENCODING_CDR_ENCAPS, versions 1.0 through
- * 1.(MAX_MINOR_VERSION_SUPPORTED).
- *
- * @exception UnknownEncoding Thrown if this factory cannot create a
- * Codec of the given encoding.
- */
- public Codec create_codec ( Encoding enc )
- throws UnknownEncoding
- {
- if( enc == null ) nullParam();
-
- Codec result = null;
-
- // This is the only format we can currently create codecs for:
- if( (enc.format == ENCODING_CDR_ENCAPS.value) &&
- (enc.major_version == 1) )
- {
- if( (enc.minor_version >= 0) &&
- (enc.minor_version <= MAX_MINOR_VERSION_SUPPORTED) )
- {
- result = codecs[enc.minor_version];
- }
- }
-
- if( result == null ) {
- throw new UnknownEncoding();
- }
-
- return result;
- }
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- {
- throw wrapper.nullParam() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java 2018-01-30 20:17:14.000000000 -0500
+++ /dev/null 2018-01-30 20:17:14.000000000 -0500
@@ -1,318 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import java.util.Iterator ;
-
-import org.omg.IOP.TaggedComponent;
-
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INV_POLICY;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.LocalObject;
-
-import org.omg.PortableInterceptor.IORInfo;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
-import org.omg.PortableInterceptor.ObjectReferenceFactory;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-
-import com.sun.corba.se.spi.legacy.interceptor.IORInfoExt;
-import com.sun.corba.se.spi.legacy.interceptor.UnknownType;
-
-import com.sun.corba.se.spi.ior.IORTemplate;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate;
-import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-/**
- * IORInfoImpl is the implementation of the IORInfo class, as described
- * in orbos/99-12-02, section 7.
- */
-public final class IORInfoImpl
- extends LocalObject
- implements IORInfo, IORInfoExt
-{
- // State values that determine which methods are allowed.
- // get_effective_policy, manager_id, and adapter_state are valid unless STATE_DONE
-
- // add_component, and add_component_to_profile are valid.
- private static final int STATE_INITIAL = 0 ;
-
- // adapter_template, and R/W to current_factory are valid
- private static final int STATE_ESTABLISHED = 1 ;
-
- // No methods are valid in this state
- private static final int STATE_DONE = 2 ;
-
- // The current state of this object
- private int state = STATE_INITIAL ;
-
- // The ObjectAdapter associated with this IORInfo object.
- private ObjectAdapter adapter;
-
- private ORB orb ;
-
- private ORBUtilSystemException orbutilWrapper ;
- private InterceptorsSystemException wrapper ;
- private OMGSystemException omgWrapper ;
-
- /**
- * Creates a new IORInfo implementation. This info object will establish
- * tagged components with the template for the provided IOR Template.
- */
- IORInfoImpl( ObjectAdapter adapter ) {
- this.orb = adapter.getORB() ;
-
- orbutilWrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- wrapper = InterceptorsSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- this.adapter = adapter;
- }
-
- /**
- * An ORB service implementation may determine what server side policy
- * of a particular type is in effect for an IOR being constructed by
- * calling the get_effective_policy operation. When the IOR being
- * constructed is for an object implemented using a POA, all Policy
- * objects passed to the PortableServer::POA::create_POA call that
- * created that POA are accessible via get_effective_policy.
- *
- * If a policy for the given type is not known to the ORB, then this
- * operation will raise INV_POLICY with a standard minor code of 2.
- *
- * @param type The CORBA::PolicyType specifying the type of policy to
- * return.
- * @return The effective CORBA::Policy object of the requested type.
- * If the given policy type is known, but no policy of that tpye is
- * in effect, then this operation will return a nil object reference.
- */
- public Policy get_effective_policy (int type) {
- checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;
-
- return adapter.getEffectivePolicy( type );
- }
-
- /**
- * A portable ORB service implementation calls this method from its
- * implementation of establish_components to add a tagged component to
- * the set which will be included when constructing IORs. The
- * components in this set will be included in all profiles.
- *
- * Any number of components may exist with the same component ID.
- *
- * @param tagged_component The IOP::TaggedComponent to add
- */
- public void add_ior_component (TaggedComponent tagged_component) {
- checkState( STATE_INITIAL ) ;
-
- if( tagged_component == null ) nullParam();
- addIORComponentToProfileInternal( tagged_component,
- adapter.getIORTemplate().iterator());
- }
-
- /**
- * A portable ORB service implementation calls this method from its
- * implementation of establish_components to add a tagged component to
- * the set which will be included when constructing IORs. The
- * components in this set will be included in the specified profile.
- *
- * Any number of components may exist with the same component ID.
- *
- * If the given profile ID does not define a known profile or it is
- * impossible to add components to thgat profile, BAD_PARAM is raised
- * with a minor code of TBD_BP + 3.
- *
- * @param tagged_component The IOP::TaggedComponent to add.
- * @param profile_id The IOP::ProfileId tof the profile to which this
- * component will be added.
- */
- public void add_ior_component_to_profile (
- TaggedComponent tagged_component, int profile_id )
- {
- checkState( STATE_INITIAL ) ;
-
- if( tagged_component == null ) nullParam();
- addIORComponentToProfileInternal(
- tagged_component, adapter.getIORTemplate().iteratorById(
- profile_id ) );
- }
-
- /**
- * @param type The type of the server port
- * (see connection.ORBSocketFactory for discussion).
- * @return The listen port number for that type.
- * @throws UnknownType if no port of the given type is found.
- */
- public int getServerPort(String type)
- throws UnknownType
- {
- checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;
-
- int port =
- orb.getLegacyServerSocketManager()
- .legacyGetTransientOrPersistentServerPort(type);
- if (port == -1) {
- throw new UnknownType();
- }
- return port;
- }
-
- public ObjectAdapter getObjectAdapter()
- {
- return adapter;
- }
-
- public int manager_id()
- {
- checkState( STATE_INITIAL, STATE_ESTABLISHED) ;
-
- return adapter.getManagerId() ;
- }
-
- public short state()
- {
- checkState( STATE_INITIAL, STATE_ESTABLISHED) ;
-
- return adapter.getState() ;
- }
-
- public ObjectReferenceTemplate adapter_template()
- {
- checkState( STATE_ESTABLISHED) ;
-
- // At this point, the iortemp must contain only a single
- // IIOPProfileTemplate. This is a restriction of our
- // implementation. Also, note the the ObjectReferenceTemplate
- // is called when a certain POA is created in a certain ORB
- // in a certain server, so the server_id, orb_id, and
- // poa_id operations must be well-defined no matter what
- // kind of implementation is used: e.g., if a POA creates
- // IORs with multiple profiles, they must still all agree
- // about this information. Thus, we are justified in
- // extracting the single IIOPProfileTemplate to create
- // an ObjectReferenceTemplate here.
-
- return adapter.getAdapterTemplate() ;
- }
-
- public ObjectReferenceFactory current_factory()
- {
- checkState( STATE_ESTABLISHED) ;
-
- return adapter.getCurrentFactory() ;
- }
-
- public void current_factory( ObjectReferenceFactory factory )
- {
- checkState( STATE_ESTABLISHED) ;
-
- adapter.setCurrentFactory( factory ) ;
- }
-
- /**
- * Internal utility method to add an IOR component to the set of profiles
- * present in the iterator.
- */
- private void addIORComponentToProfileInternal(
- TaggedComponent tagged_component, Iterator iterator )
- {
- // Convert the given IOP::TaggedComponent into the appropriate
- // type for the TaggedProfileTemplate
- TaggedComponentFactoryFinder finder =
- orb.getTaggedComponentFactoryFinder();
- Object newTaggedComponent = finder.create( orb, tagged_component );
-
- // Iterate through TaggedProfileTemplates and add the given tagged
- // component to the appropriate one(s).
- boolean found = false;
- while( iterator.hasNext() ) {
- found = true;
- TaggedProfileTemplate taggedProfileTemplate =
- (TaggedProfileTemplate)iterator.next();
- taggedProfileTemplate.add( newTaggedComponent );
- }
-
- // If no profile was found with the given id, throw a BAD_PARAM:
- // (See orbos/00-08-06, section 21.5.3.3.)
- if( !found ) {
- throw omgWrapper.invalidProfileId() ;
- }
- }
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- {
- throw orbutilWrapper.nullParam() ;
- }
-
- // REVISIT: add minor codes!
-
- private void checkState( int expectedState )
- {
- if (expectedState != state)
- throw wrapper.badState1( new Integer(expectedState), new Integer(state) ) ;
- }
-
- private void checkState( int expectedState1, int expectedState2 )
- {
- if ((expectedState1 != state) && (expectedState2 != state))
- throw wrapper.badState2( new Integer(expectedState1),
- new Integer(expectedState2), new Integer(state) ) ;
- }
-
- void makeStateEstablished()
- {
- checkState( STATE_INITIAL ) ;
-
- state = STATE_ESTABLISHED ;
- }
-
- void makeStateDone()
- {
- checkState( STATE_ESTABLISHED ) ;
-
- state = STATE_DONE ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java 2018-01-30 20:17:14.000000000 -0500
+++ /dev/null 2018-01-30 20:17:14.000000000 -0500
@@ -1,662 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-import org.omg.PortableInterceptor.ClientRequestInfo;
-import org.omg.PortableInterceptor.ClientRequestInterceptor;
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.IORInterceptor;
-import org.omg.PortableInterceptor.IORInterceptor_3_0;
-import org.omg.PortableInterceptor.ServerRequestInfo;
-import org.omg.PortableInterceptor.ServerRequestInterceptor;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-/**
- * Handles invocation of interceptors. Has specific knowledge of how to
- * invoke IOR, ClientRequest, and ServerRequest interceptors.
- * Makes use of the InterceptorList to retrieve the list of interceptors to
- * be invoked. Most methods in this class are package scope so that they
- * may only be called from the PIHandlerImpl.
- */
-public class InterceptorInvoker {
-
- // The ORB
- private ORB orb;
-
- // The list of interceptors to be invoked
- private InterceptorList interceptorList;
-
- // True if interceptors are to be invoked, or false if not
- // Note: This is a global enable/disable flag, whereas the enable flag
- // in the RequestInfoStack in PIHandlerImpl is only for a particular Thread.
- private boolean enabled = false;
-
- // PICurrent variable.
- private PICurrent current;
-
- // NOTE: Be careful about adding additional attributes to this class.
- // Multiple threads may be calling methods on this invoker at the same
- // time.
-
- /**
- * Creates a new Interceptor Invoker. Constructor is package scope so
- * only the ORB can create it. The invoker is initially disabled, and
- * must be explicitly enabled using setEnabled().
- */
- InterceptorInvoker( ORB orb, InterceptorList interceptorList,
- PICurrent piCurrent )
- {
- this.orb = orb;
- this.interceptorList = interceptorList;
- this.enabled = false;
- this.current = piCurrent;
- }
-
- /**
- * Enables or disables the interceptor invoker
- */
- void setEnabled( boolean enabled ) {
- this.enabled = enabled;
- }
-
- /*
- **********************************************************************
- * IOR Interceptor invocation
- **********************************************************************/
-
- /**
- * Called when a new POA is created.
- *
- * @param oa The Object Adapter associated with the IOR interceptor.
- */
- void objectAdapterCreated( ObjectAdapter oa ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- // Create IORInfo object to pass to IORInterceptors:
- IORInfoImpl info = new IORInfoImpl( oa );
-
- // Call each IORInterceptor:
- IORInterceptor[] iorInterceptors =
- (IORInterceptor[])interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- int size = iorInterceptors.length;
-
- // Implementation note:
- // This loop counts backwards for greater efficiency.
- // Benchmarks have shown that counting down is more efficient
- // than counting up in Java for loops, as a compare to zero is
- // faster than a subtract and compare to zero. In this case,
- // it doesn't really matter much, but it's simply a force of habit.
-
- for( int i = (size - 1); i >= 0; i-- ) {
- IORInterceptor interceptor = iorInterceptors[i];
- try {
- interceptor.establish_components( info );
- }
- catch( Exception e ) {
- // as per PI spec (orbos/99-12-02 sec 7.2.1), if
- // establish_components throws an exception, ignore it.
- }
- }
-
- // Change the state so that only template operations are valid
- info.makeStateEstablished() ;
-
- for( int i = (size - 1); i >= 0; i-- ) {
- IORInterceptor interceptor = iorInterceptors[i];
- if (interceptor instanceof IORInterceptor_3_0) {
- IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ;
- // Note that exceptions here are NOT ignored, as per the
- // ORT spec (orbos/01-01-04)
- interceptor30.components_established( info );
- }
- }
-
- // Change the state so that no operations are valid,
- // in case a reference to info escapes this scope.
- // This also completes the actions associated with the
- // template interceptors on this POA.
- info.makeStateDone() ;
- }
- }
-
- void adapterManagerStateChanged( int managerId, short newState )
- {
- if (enabled) {
- IORInterceptor[] interceptors =
- (IORInterceptor[])interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- int size = interceptors.length;
-
- for( int i = (size - 1); i >= 0; i-- ) {
- try {
- IORInterceptor interceptor = interceptors[i];
- if (interceptor instanceof IORInterceptor_3_0) {
- IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ;
- interceptor30.adapter_manager_state_changed( managerId,
- newState );
- }
- } catch (Exception exc) {
- // No-op: ignore exception in this case
- }
- }
- }
- }
-
- void adapterStateChanged( ObjectReferenceTemplate[] templates,
- short newState )
- {
- if (enabled) {
- IORInterceptor[] interceptors =
- (IORInterceptor[])interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- int size = interceptors.length;
-
- for( int i = (size - 1); i >= 0; i-- ) {
- try {
- IORInterceptor interceptor = interceptors[i];
- if (interceptor instanceof IORInterceptor_3_0) {
- IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ;
- interceptor30.adapter_state_changed( templates, newState );
- }
- } catch (Exception exc) {
- // No-op: ignore exception in this case
- }
- }
- }
- }
-
- /*
- **********************************************************************
- * Client Interceptor invocation
- **********************************************************************/
-
- /**
- * Invokes either send_request, or send_poll, depending on the value
- * of info.getStartingPointCall()
- */
- void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // Make a a fresh slot table available to TSC in case
- // interceptors need to make out calls.
- // Client's TSC is now RSC via RequestInfo.
- current.pushSlotTable( );
- info.setPICurrentPushed( true );
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING );
-
- // Get all ClientRequestInterceptors:
- ClientRequestInterceptor[] clientInterceptors =
- (ClientRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- int size = clientInterceptors.length;
-
- // We will assume that all interceptors returned successfully,
- // and adjust the flowStackIndex to the appropriate value if
- // we later discover otherwise.
- int flowStackIndex = size;
- boolean continueProcessing = true;
-
- // Determine whether we are calling send_request or send_poll:
- // (This is currently commented out because our ORB does not
- // yet support the Messaging specification, so send_poll will
- // never occur. Once we have implemented messaging, this may
- // be uncommented.)
- // int startingPointCall = info.getStartingPointCall();
- for( int i = 0; continueProcessing && (i < size); i++ ) {
- try {
- clientInterceptors[i].send_request( info );
-
- // Again, it is not necessary for a switch here, since
- // there is only one starting point call type (see
- // above comment).
-
- //switch( startingPointCall ) {
- //case ClientRequestInfoImpl.CALL_SEND_REQUEST:
- //clientInterceptors[i].send_request( info );
- //break;
- //case ClientRequestInfoImpl.CALL_SEND_POLL:
- //clientInterceptors[i].send_poll( info );
- //break;
- //}
-
- }
- catch( ForwardRequest e ) {
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a ForwardRequest,
- // no other Interceptors' send_request operations are
- // called.
- flowStackIndex = i;
- info.setForwardRequest( e );
- info.setEndingPointCall(
- ClientRequestInfoImpl.CALL_RECEIVE_OTHER );
- info.setReplyStatus( LOCATION_FORWARD.value );
-
- updateClientRequestDispatcherForward( info );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to work
- // fine.
- continueProcessing = false;
- }
- catch( SystemException e ) {
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a SystemException,
- // no other Interceptors' send_request operations are
- // called.
- flowStackIndex = i;
- info.setEndingPointCall(
- ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- info.setException( e );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to
- // work fine.
- continueProcessing = false;
- }
- }
-
- // Remember where we left off in the flow stack:
- info.setFlowStackIndex( flowStackIndex );
- }
- finally {
- // Make the SlotTable fresh for the next interception point.
- current.resetSlotTable( );
- }
- } // end enabled check
- }
-
- /**
- * Invokes either receive_reply, receive_exception, or receive_other,
- * depending on the value of info.getEndingPointCall()
- */
- void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // NOTE: It is assumed someplace else prepared a
- // fresh TSC slot table.
-
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
-
- // Get all ClientRequestInterceptors:
- ClientRequestInterceptor[] clientInterceptors =
- (ClientRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- int flowStackIndex = info.getFlowStackIndex();
-
- // Determine whether we are calling receive_reply,
- // receive_exception, or receive_other:
- int endingPointCall = info.getEndingPointCall();
-
- // If we would be calling RECEIVE_REPLY, but this is a
- // one-way call, override this and call receive_other:
- if( ( endingPointCall ==
- ClientRequestInfoImpl.CALL_RECEIVE_REPLY ) &&
- info.getIsOneWay() )
- {
- endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_OTHER;
- info.setEndingPointCall( endingPointCall );
- }
-
- // Only step through the interceptors whose starting points
- // have successfully returned.
- // Unlike the previous loop, this one counts backwards for a
- // reason - we must execute these in the reverse order of the
- // starting points.
- for( int i = (flowStackIndex - 1); i >= 0; i-- ) {
-
- try {
- switch( endingPointCall ) {
- case ClientRequestInfoImpl.CALL_RECEIVE_REPLY:
- clientInterceptors[i].receive_reply( info );
- break;
- case ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION:
- clientInterceptors[i].receive_exception( info );
- break;
- case ClientRequestInfoImpl.CALL_RECEIVE_OTHER:
- clientInterceptors[i].receive_other( info );
- break;
- }
- }
- catch( ForwardRequest e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a ForwardException,
- // ending point call changes to receive_other.
- endingPointCall =
- ClientRequestInfoImpl.CALL_RECEIVE_OTHER;
- info.setEndingPointCall( endingPointCall );
- info.setReplyStatus( LOCATION_FORWARD.value );
- info.setForwardRequest( e );
- updateClientRequestDispatcherForward( info );
- }
- catch( SystemException e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.2.1.), if
- // interception point throws a SystemException,
- // ending point call changes to receive_exception.
- endingPointCall =
- ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION;
- info.setEndingPointCall( endingPointCall );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- info.setException( e );
- }
- }
- }
- finally {
- // See doc for setPICurrentPushed as to why this is necessary.
- // Check info for null in case errors happen before initiate.
- if (info != null && info.isPICurrentPushed()) {
- current.popSlotTable( );
- // After the pop, original client's TSC slot table
- // remains avaiable via PICurrent.
- }
- }
- } // end enabled check
- }
-
- /*
- **********************************************************************
- * Server Interceptor invocation
- **********************************************************************/
-
- /**
- * Invokes receive_request_service_context interception points.
- */
- void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // Make a fresh slot table for RSC.
- current.pushSlotTable();
- info.setSlotTable(current.getSlotTable());
-
- // Make a fresh slot table for TSC in case
- // interceptors need to make out calls.
- current.pushSlotTable( );
-
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING );
-
- // Get all ServerRequestInterceptors:
- ServerRequestInterceptor[] serverInterceptors =
- (ServerRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER );
- int size = serverInterceptors.length;
-
- // We will assume that all interceptors returned successfully,
- // and adjust the flowStackIndex to the appropriate value if
- // we later discover otherwise.
- int flowStackIndex = size;
- boolean continueProcessing = true;
-
- // Currently, there is only one server-side starting point
- // interceptor called receive_request_service_contexts.
- for( int i = 0; continueProcessing && (i < size); i++ ) {
-
- try {
- serverInterceptors[i].
- receive_request_service_contexts( info );
- }
- catch( ForwardRequest e ) {
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a ForwardRequest,
- // no other Interceptors' starting points are
- // called and send_other is called.
- flowStackIndex = i;
- info.setForwardRequest( e );
- info.setIntermediatePointCall(
- ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_OTHER );
- info.setReplyStatus( LOCATION_FORWARD.value );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to work
- // fine.
- continueProcessing = false;
- }
- catch( SystemException e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a SystemException,
- // no other Interceptors' starting points are
- // called.
- flowStackIndex = i;
- info.setException( e );
- info.setIntermediatePointCall(
- ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_EXCEPTION );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
-
- // For some reason, using break here causes the VM on
- // NT to lose track of the value of flowStackIndex
- // after exiting the for loop. I changed this to
- // check a boolean value instead and it seems to
- // work fine.
- continueProcessing = false;
- }
-
- }
-
- // Remember where we left off in the flow stack:
- info.setFlowStackIndex( flowStackIndex );
- }
- finally {
- // The remaining points, ServantManager and Servant
- // all run in the same logical thread.
- current.popSlotTable( );
- // Now TSC and RSC are equivalent.
- }
- } // end enabled check
- }
-
- /**
- * Invokes receive_request interception points
- */
- void invokeServerInterceptorIntermediatePoint(
- ServerRequestInfoImpl info )
- {
- int intermediatePointCall = info.getIntermediatePointCall();
- // If invocation is not yet enabled, don't do anything.
- if( enabled && ( intermediatePointCall !=
- ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ) )
- {
- // NOTE: do not touch the slotStack. The RSC and TSC are
- // equivalent at this point.
-
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_INTERMEDIATE );
-
- // Get all ServerRequestInterceptors:
- ServerRequestInterceptor[] serverInterceptors =
- (ServerRequestInterceptor[])
- interceptorList.getInterceptors(
- InterceptorList.INTERCEPTOR_TYPE_SERVER );
- int size = serverInterceptors.length;
-
- // Currently, there is only one server-side intermediate point
- // interceptor called receive_request.
- for( int i = 0; i < size; i++ ) {
-
- try {
- serverInterceptors[i].receive_request( info );
- }
- catch( ForwardRequest e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a ForwardRequest,
- // no other Interceptors' intermediate points are
- // called and send_other is called.
- info.setForwardRequest( e );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_OTHER );
- info.setReplyStatus( LOCATION_FORWARD.value );
- break;
- }
- catch( SystemException e ) {
-
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a SystemException,
- // no other Interceptors' starting points are
- // called.
- info.setException( e );
- info.setEndingPointCall(
- ServerRequestInfoImpl.CALL_SEND_EXCEPTION );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- break;
- }
- }
- } // end enabled check
- }
-
- /**
- * Invokes either send_reply, send_exception, or send_other,
- * depending on the value of info.getEndingPointCall()
- */
- void invokeServerInterceptorEndingPoint( ServerRequestInfoImpl info ) {
- // If invocation is not yet enabled, don't do anything.
- if( enabled ) {
- try {
- // NOTE: do not touch the slotStack. The RSC and TSC are
- // equivalent at this point.
-
- // REVISIT: This is moved out to PIHandlerImpl until dispatch
- // path is rearchitected. It must be there so that
- // it always gets executed so if an interceptor raises
- // an exception any service contexts added in earlier points
- // this point get put in the exception reply (via the SC Q).
- //info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
-
- // Get all ServerRequestInterceptors:
- ServerRequestInterceptor[] serverInterceptors =
- (ServerRequestInterceptor[])interceptorList.
- getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER );
- int flowStackIndex = info.getFlowStackIndex();
-
- // Determine whether we are calling
- // send_exception, or send_other:
- int endingPointCall = info.getEndingPointCall();
-
- // Only step through the interceptors whose starting points
- // have successfully returned.
- for( int i = (flowStackIndex - 1); i >= 0; i-- ) {
- try {
- switch( endingPointCall ) {
- case ServerRequestInfoImpl.CALL_SEND_REPLY:
- serverInterceptors[i].send_reply( info );
- break;
- case ServerRequestInfoImpl.CALL_SEND_EXCEPTION:
- serverInterceptors[i].send_exception( info );
- break;
- case ServerRequestInfoImpl.CALL_SEND_OTHER:
- serverInterceptors[i].send_other( info );
- break;
- }
- }
- catch( ForwardRequest e ) {
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a ForwardException,
- // ending point call changes to receive_other.
- endingPointCall =
- ServerRequestInfoImpl.CALL_SEND_OTHER;
- info.setEndingPointCall( endingPointCall );
- info.setForwardRequest( e );
- info.setReplyStatus( LOCATION_FORWARD.value );
- info.setForwardRequestRaisedInEnding();
- }
- catch( SystemException e ) {
- // as per PI spec (orbos/99-12-02 sec 5.3.1.), if
- // interception point throws a SystemException,
- // ending point call changes to send_exception.
- endingPointCall =
- ServerRequestInfoImpl.CALL_SEND_EXCEPTION;
- info.setEndingPointCall( endingPointCall );
- info.setException( e );
- info.setReplyStatus( SYSTEM_EXCEPTION.value );
- }
- }
-
- // Remember that all interceptors' starting and ending points
- // have already been executed so we need not do anything.
- info.setAlreadyExecuted( true );
- }
- finally {
- // Get rid of the Server side RSC.
- current.popSlotTable();
- }
- } // end enabled check
- }
-
- /*
- **********************************************************************
- * Private utility methods
- **********************************************************************/
-
- /**
- * Update the client delegate in the event of a ForwardRequest, given the
- * information in the passed-in info object.
- */
- private void updateClientRequestDispatcherForward(
- ClientRequestInfoImpl info )
- {
- ForwardRequest forwardRequest = info.getForwardRequestException();
-
- // ForwardRequest may be null if the forwarded IOR is set internal
- // to the ClientRequestDispatcher rather than explicitly through Portable
- // Interceptors. In this case, we need not update the client
- // delegate ForwardRequest object.
- if( forwardRequest != null ) {
- org.omg.CORBA.Object object = forwardRequest.forward;
-
- // Convert the forward object into an IOR:
- IOR ior = ORBUtility.getIOR( object ) ;
- info.setLocatedIOR( ior );
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java 2018-01-30 20:17:15.000000000 -0500
+++ /dev/null 2018-01-30 20:17:15.000000000 -0500
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.PortableInterceptor.Interceptor;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-
-import org.omg.CORBA.INTERNAL;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.lang.reflect.Array;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException ;
-
-/**
- * Provides a repository of registered Portable Interceptors, organized
- * by type. This list is designed to be accessed as efficiently as
- * possible during runtime, with the expense of added complexity during
- * initialization and interceptor registration. The class is designed
- * to easily allow for the addition of new interceptor types.
- */
-public class InterceptorList {
-
- // Interceptor type list. If additional interceptors are needed,
- // add additional types in numerical order (do not skip numbers),
- // and update NUM_INTERCEPTOR_TYPES and classTypes accordingly.
- // NUM_INTERCEPTOR_TYPES represents the number of interceptor
- // types, so we know how many lists to maintain.
- static final int INTERCEPTOR_TYPE_CLIENT = 0;
- static final int INTERCEPTOR_TYPE_SERVER = 1;
- static final int INTERCEPTOR_TYPE_IOR = 2;
-
- static final int NUM_INTERCEPTOR_TYPES = 3;
-
- // Array of class types for interceptors. This is used to create the
- // appropriate array type for each interceptor type. These must
- // match the indices of the constants declared above.
- static final Class[] classTypes = {
- org.omg.PortableInterceptor.ClientRequestInterceptor.class,
- org.omg.PortableInterceptor.ServerRequestInterceptor.class,
- org.omg.PortableInterceptor.IORInterceptor.class
- };
-
- // True if no further interceptors may be registered with this list.
- private boolean locked = false;
- private InterceptorsSystemException wrapper ;
-
- // List of interceptors currently registered. There are
- // NUM_INTERCEPTOR_TYPES lists of registered interceptors.
- // For example, interceptors[INTERCEPTOR_TYPE_CLIENT] contains an array
- // of objects of type ClientRequestInterceptor.
- private Interceptor[][] interceptors =
- new Interceptor[NUM_INTERCEPTOR_TYPES][];
-
- /**
- * Creates a new Interceptor List. Constructor is package scope so
- * only the ORB can create it.
- */
- InterceptorList( InterceptorsSystemException wrapper ) {
- this.wrapper = wrapper ;
- // Create empty interceptors arrays for each type:
- initInterceptorArrays();
- }
-
- /**
- * Registers an interceptor of the given type into the interceptor list.
- * The type is one of:
- *
- * - INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
- *
- INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
- *
- INTERCEPTOR_TYPE_IOR - IORInterceptor
- *
- *
- * @exception DuplicateName Thrown if an interceptor of the given
- * name already exists for the given type.
- */
- void register_interceptor( Interceptor interceptor, int type )
- throws DuplicateName
- {
- // If locked, deny any further addition of interceptors.
- if( locked ) {
- throw wrapper.interceptorListLocked() ;
- }
-
- // Cache interceptor name:
- String interceptorName = interceptor.name();
- boolean anonymous = interceptorName.equals( "" );
- boolean foundDuplicate = false;
- Interceptor[] interceptorList = interceptors[type];
-
- // If this is not an anonymous interceptor,
- // search for an interceptor of the same name in this category:
- if( !anonymous ) {
- int size = interceptorList.length;
-
- // An O(n) search will suffice because register_interceptor is not
- // likely to be called often.
- for( int i = 0; i < size; i++ ) {
- Interceptor in = (Interceptor)interceptorList[i];
- if( in.name().equals( interceptorName ) ) {
- foundDuplicate = true;
- break;
- }
- }
- }
-
- if( !foundDuplicate ) {
- growInterceptorArray( type );
- interceptors[type][interceptors[type].length-1] = interceptor;
- }
- else {
- throw new DuplicateName( interceptorName );
- }
- }
-
- /**
- * Locks this interceptor list so that no more interceptors may be
- * registered. This method is called after all interceptors are
- * registered for security reasons.
- */
- void lock() {
- locked = true;
- }
-
- /**
- * Retrieves an array of interceptors of the given type. For efficiency,
- * the type parameter is assumed to be valid.
- */
- Interceptor[] getInterceptors( int type ) {
- return interceptors[type];
- }
-
- /**
- * Returns true if there is at least one interceptor of the given type,
- * or false if not.
- */
- boolean hasInterceptorsOfType( int type ) {
- return interceptors[type].length > 0;
- }
-
- /**
- * Initializes all interceptors arrays to zero-length arrays of the
- * correct type, based on the classTypes list.
- */
- private void initInterceptorArrays() {
- for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
- Class classType = classTypes[type];
-
- // Create a zero-length array for each type:
- interceptors[type] =
- (Interceptor[])Array.newInstance( classType, 0 );
- }
- }
-
- /**
- * Grows the given interceptor array by one:
- */
- private void growInterceptorArray( int type ) {
- Class classType = classTypes[type];
- int currentLength = interceptors[type].length;
- Interceptor[] replacementArray;
-
- // Create new array to replace the old one. The new array will be
- // one element larger but have the same type as the old one.
- replacementArray = (Interceptor[])
- Array.newInstance( classType, currentLength + 1 );
- System.arraycopy( interceptors[type], 0,
- replacementArray, 0, currentLength );
- interceptors[type] = replacementArray;
- }
-
- /**
- * Destroys all interceptors in this list by invoking their destroy()
- * method.
- */
- void destroyAll() {
- int numTypes = interceptors.length;
-
- for( int i = 0; i < numTypes; i++ ) {
- int numInterceptors = interceptors[i].length;
- for( int j = 0; j < numInterceptors; j++ ) {
- interceptors[i][j].destroy();
- }
- }
- }
-
- /**
- * Sort interceptors.
- */
- void sortInterceptors() {
- List sorted = null;
- List unsorted = null;
-
- int numTypes = interceptors.length;
-
- for( int i = 0; i < numTypes; i++ ) {
- int numInterceptors = interceptors[i].length;
- if (numInterceptors > 0) {
- // Get fresh sorting bins for each non empty type.
- sorted = new ArrayList(); // not synchronized like we want.
- unsorted = new ArrayList();
- }
- for( int j = 0; j < numInterceptors; j++ ) {
- Interceptor interceptor = interceptors[i][j];
- if (interceptor instanceof Comparable) {
- sorted.add(interceptor);
- } else {
- unsorted.add(interceptor);
- }
- }
- if (numInterceptors > 0 && sorted.size() > 0) {
- // Let the RuntimeExceptions thrown by sort
- // (i.e., ClassCastException and UnsupportedOperationException)
- // flow back to the user.
- Collections.sort(sorted);
- Iterator sortedIterator = sorted.iterator();
- Iterator unsortedIterator = unsorted.iterator();
- for( int j = 0; j < numInterceptors; j++ ) {
- if (sortedIterator.hasNext()) {
- interceptors[i][j] =
- (Interceptor) sortedIterator.next();
- } else if (unsortedIterator.hasNext()) {
- interceptors[i][j] =
- (Interceptor) unsortedIterator.next();
- } else {
- throw wrapper.sortSizeMismatch() ;
- }
- }
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java 2018-01-30 20:17:16.000000000 -0500
+++ /dev/null 2018-01-30 20:17:16.000000000 -0500
@@ -1,381 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.PolicyError;
-import org.omg.IOP.CodecFactory;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ClientRequestInterceptor;
-import org.omg.PortableInterceptor.IORInterceptor;
-import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableInterceptor.ServerRequestInterceptor;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.legacy.interceptor.ORBInitInfoExt ;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-/**
- * ORBInitInfoImpl is the implementation of the ORBInitInfo class to be
- * passed to ORBInitializers, as described in orbos/99-12-02.
- */
-public final class ORBInitInfoImpl
- extends org.omg.CORBA.LocalObject
- implements ORBInitInfo, ORBInitInfoExt
-{
- // The ORB we are initializing
- private ORB orb;
-
- private InterceptorsSystemException wrapper ;
- private ORBUtilSystemException orbutilWrapper ;
- private OMGSystemException omgWrapper ;
-
- // The arguments passed to ORB_init
- private String[] args;
-
- // The ID of the ORB being initialized
- private String orbId;
-
- // The CodecFactory
- private CodecFactory codecFactory;
-
- // The current stage of initialization
- private int stage = STAGE_PRE_INIT;
-
- // The pre-initialization stage (pre_init() being called)
- public static final int STAGE_PRE_INIT = 0;
-
- // The post-initialization stage (post_init() being called)
- public static final int STAGE_POST_INIT = 1;
-
- // Reject all calls - this object should no longer be around.
- public static final int STAGE_CLOSED = 2;
-
- // The description for the OBJECT_NOT_EXIST exception in STAGE_CLOSED
- private static final String MESSAGE_ORBINITINFO_INVALID =
- "ORBInitInfo object is only valid during ORB_init";
-
- /**
- * Creates a new ORBInitInfoImpl object (scoped to package)
- *
- * @param args The arguments passed to ORB_init.
- */
- ORBInitInfoImpl( ORB orb, String[] args,
- String orbId, CodecFactory codecFactory )
- {
- this.orb = orb;
-
- wrapper = InterceptorsSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- orbutilWrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- this.args = args;
- this.orbId = orbId;
- this.codecFactory = codecFactory;
- }
-
- /** Return the ORB behind this ORBInitInfo. This is defined in the
- * ORBInitInfoExt interface.
- */
- public ORB getORB()
- {
- return orb ;
- }
-
- /**
- * Sets the current stage we are in. This limits access to certain
- * functionality.
- */
- void setStage( int stage ) {
- this.stage = stage;
- }
-
- /**
- * Throws an exception if the current stage is STAGE_CLOSED.
- * This is called before any method is invoked to ensure that
- * no method invocations are attempted after all calls to post_init()
- * are completed.
- */
- private void checkStage() {
- if( stage == STAGE_CLOSED ) {
- throw wrapper.orbinitinfoInvalid() ;
- }
- }
-
- /*
- *******************************************************************
- * The following are implementations of the ORBInitInfo operations.
- *******************************************************************/
-
- /**
- * This attribute contains the arguments passed to ORB_init. They may
- * or may not contain the ORB's arguments
- */
- public String[] arguments () {
- checkStage();
- return args;
- }
-
- /**
- * This attribute is the ID of the ORB being initialized
- */
- public String orb_id () {
- checkStage();
- return orbId;
- }
-
- /**
- * This attribute is the IOP::CodecFactory. The CodecFactory is normally
- * obtained via a call to ORB::resolve_initial_references( "CodecFactory" )
- * but since the ORB is not yet available and Interceptors, particularly
- * when processing service contexts, will require a Codec, a means of
- * obtaining a Codec is necessary during ORB intialization.
- */
- public CodecFactory codec_factory () {
- checkStage();
- return codecFactory;
- }
-
- /**
- * See orbos/99-12-02, Chapter 11, Dynamic Initial References on page
- * 11-81. This operation is identical to ORB::register_initial_reference
- * described there. This same functionality exists here because the ORB,
- * not yet fully initialized, is not yet available but initial references
- * may need to be registered as part of Interceptor registration.
- *
- * This method may not be called during post_init.
- */
- public void register_initial_reference( String id,
- org.omg.CORBA.Object obj )
- throws InvalidName
- {
- checkStage();
- if( id == null ) nullParam();
-
- // As per CORBA 3.0 section 21.8.1,
- // if null is passed as the obj parameter,
- // throw BAD_PARAM with minor code OMGSystemException.RIR_WITH_NULL_OBJECT.
- // Though the spec is talking about IDL null, we will address both
- // Java null and IDL null:
- // Note: Local Objects can never be nil!
- if( obj == null ) {
- throw omgWrapper.rirWithNullObject() ;
- }
-
- // This check was made to determine that the objref is a
- // non-local objref that is fully
- // initialized: this was called only for its side-effects of
- // possibly throwing exceptions. However, registering
- // local objects should be permitted!
- // XXX/Revisit?
- // IOR ior = ORBUtility.getIOR( obj ) ;
-
- // Delegate to ORB. If ORB version throws InvalidName, convert to
- // equivalent Portable Interceptors InvalidName.
- try {
- orb.register_initial_reference( id, obj );
- } catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
- InvalidName exc = new InvalidName( e.getMessage() );
- exc.initCause( e ) ;
- throw exc ;
- }
- }
-
- /**
- * This operation is only valid during post_init. It is identical to
- * ORB::resolve_initial_references. This same functionality exists here
- * because the ORB, not yet fully initialized, is not yet available,
- * but initial references may be required from the ORB as part
- * of Interceptor registration.
- *
- * (incorporates changes from errata in orbos/00-01-01)
- *
- * This method may not be called during pre_init.
- */
- public org.omg.CORBA.Object resolve_initial_references (String id)
- throws InvalidName
- {
- checkStage();
- if( id == null ) nullParam();
-
- if( stage == STAGE_PRE_INIT ) {
- // Initializer is not allowed to invoke this method during
- // this stage.
-
- // _REVISIT_ Spec issue: What exception should really be
- // thrown here?
- throw wrapper.rirInvalidPreInit() ;
- }
-
- org.omg.CORBA.Object objRef = null;
-
- try {
- objRef = orb.resolve_initial_references( id );
- }
- catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
- // Convert PIDL to IDL exception:
- throw new InvalidName();
- }
-
- return objRef;
- }
-
- // New method from CORBA 3.1
- public void add_client_request_interceptor_with_policy (
- ClientRequestInterceptor interceptor, Policy[] policies )
- throws DuplicateName
- {
- // XXX ignore policies for now
- add_client_request_interceptor( interceptor ) ;
- }
-
- /**
- * This operation is used to add a client-side request Interceptor to
- * the list of client-side request Interceptors.
- *
- * If a client-side request Interceptor has already been registered
- * with this Interceptor's name, DuplicateName is raised.
- */
- public void add_client_request_interceptor (
- ClientRequestInterceptor interceptor)
- throws DuplicateName
- {
- checkStage();
- if( interceptor == null ) nullParam();
-
- orb.getPIHandler().register_interceptor( interceptor,
- InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- }
-
- // New method from CORBA 3.1
- public void add_server_request_interceptor_with_policy (
- ServerRequestInterceptor interceptor, Policy[] policies )
- throws DuplicateName, PolicyError
- {
- // XXX ignore policies for now
- add_server_request_interceptor( interceptor ) ;
- }
-
- /**
- * This operation is used to add a server-side request Interceptor to
- * the list of server-side request Interceptors.
- *
- * If a server-side request Interceptor has already been registered
- * with this Interceptor's name, DuplicateName is raised.
- */
- public void add_server_request_interceptor (
- ServerRequestInterceptor interceptor)
- throws DuplicateName
- {
- checkStage();
- if( interceptor == null ) nullParam();
-
- orb.getPIHandler().register_interceptor( interceptor,
- InterceptorList.INTERCEPTOR_TYPE_SERVER );
- }
-
- // New method from CORBA 3.1
- public void add_ior_interceptor_with_policy (
- IORInterceptor interceptor, Policy[] policies )
- throws DuplicateName, PolicyError
- {
- // XXX ignore policies for now
- add_ior_interceptor( interceptor ) ;
- }
-
- /**
- * This operation is used to add an IOR Interceptor to
- * the list of IOR Interceptors.
- *
- * If an IOR Interceptor has already been registered
- * with this Interceptor's name, DuplicateName is raised.
- */
- public void add_ior_interceptor (
- IORInterceptor interceptor )
- throws DuplicateName
- {
- checkStage();
- if( interceptor == null ) nullParam();
-
- orb.getPIHandler().register_interceptor( interceptor,
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- }
-
- /**
- * A service calls allocate_slot_id to allocate a slot on
- * PortableInterceptor::Current.
- *
- * @return The index to the slot which has been allocated.
- */
- public int allocate_slot_id () {
- checkStage();
-
- return ((PICurrent)orb.getPIHandler().getPICurrent()).allocateSlotId( );
-
- }
-
- /**
- * Register a PolicyFactory for the given PolicyType.
- *
- * If a PolicyFactory already exists for the given PolicyType,
- * BAD_INV_ORDER is raised with a minor code of TBD_BIO+2.
- */
- public void register_policy_factory( int type,
- PolicyFactory policy_factory )
- {
- checkStage();
- if( policy_factory == null ) nullParam();
- orb.getPIHandler().registerPolicyFactory( type, policy_factory );
- }
-
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- throws BAD_PARAM
- {
- throw orbutilWrapper.nullParam() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java 2018-01-30 20:17:17.000000000 -0500
+++ /dev/null 2018-01-30 20:17:17.000000000 -0500
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import com.sun.corba.se.spi.orb.ORB;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-
-/**
- * PICurrent is the implementation of Current as specified in the Portable
- * Interceptors Spec orbos/99-12-02.
- * IMPORTANT: PICurrent is implemented with the assumption that get_slot()
- * or set_slot() will not be called in ORBInitializer.pre_init() and
- * post_init().
- */
-public class PICurrent extends org.omg.CORBA.LocalObject
- implements Current
-{
- // slotCounter is used to keep track of ORBInitInfo.allocate_slot_id()
- private int slotCounter;
-
- // The ORB associated with this PICurrent object.
- private ORB myORB;
-
- private OMGSystemException wrapper ;
-
- // True if the orb is still initialzing and get_slot and set_slot are not
- // to be called.
- private boolean orbInitializing;
-
- // ThreadLocal contains a stack of SlotTable which are used
- // for resolve_initial_references( "PICurrent" );
- private ThreadLocal threadLocalSlotTable
- = new ThreadLocal( ) {
- protected Object initialValue( ) {
- SlotTable table = new SlotTable( myORB, slotCounter );
- return new SlotTableStack( myORB, table );
- }
- };
-
- /**
- * PICurrent constructor which will be called for every ORB
- * initialization.
- */
- PICurrent( ORB myORB ) {
- this.myORB = myORB;
- wrapper = OMGSystemException.get( myORB,
- CORBALogDomains.RPC_PROTOCOL ) ;
- this.orbInitializing = true;
- slotCounter = 0;
- }
-
-
- /**
- * This method will be called from ORBInitInfo.allocate_slot_id( ).
- * simply returns a slot id by incrementing slotCounter.
- */
- int allocateSlotId( ) {
- int slotId = slotCounter;
- slotCounter = slotCounter + 1;
- return slotId;
- }
-
-
- /**
- * This method gets the SlotTable which is on the top of the
- * ThreadLocalStack.
- */
- SlotTable getSlotTable( ) {
- SlotTable table = (SlotTable)
- ((SlotTableStack)threadLocalSlotTable.get()).peekSlotTable();
- return table;
- }
-
- /**
- * This method pushes a SlotTable on the SlotTableStack. When there is
- * a resolve_initial_references("PICurrent") after this call. The new
- * PICurrent will be returned.
- */
- void pushSlotTable( ) {
- SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
- st.pushSlotTable( );
- }
-
-
- /**
- * This method pops a SlotTable on the SlotTableStack.
- */
- void popSlotTable( ) {
- SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
- st.popSlotTable( );
- }
-
- /**
- * This method sets the slot data at the given slot id (index) in the
- * Slot Table which is on the top of the SlotTableStack.
- */
- public void set_slot( int id, Any data ) throws InvalidSlot
- {
- if( orbInitializing ) {
- // As per ptc/00-08-06 if the ORB is still initializing, disallow
- // calls to get_slot and set_slot. If an attempt is made to call,
- // throw a BAD_INV_ORDER.
- throw wrapper.invalidPiCall3() ;
- }
-
- getSlotTable().set_slot( id, data );
- }
-
- /**
- * This method gets the slot data at the given slot id (index) from the
- * Slot Table which is on the top of the SlotTableStack.
- */
- public Any get_slot( int id ) throws InvalidSlot
- {
- if( orbInitializing ) {
- // As per ptc/00-08-06 if the ORB is still initializing, disallow
- // calls to get_slot and set_slot. If an attempt is made to call,
- // throw a BAD_INV_ORDER.
- throw wrapper.invalidPiCall4() ;
- }
-
- return getSlotTable().get_slot( id );
- }
-
- /**
- * This method resets all the slot data to null in the
- * Slot Table which is on the top of SlotTableStack.
- */
- void resetSlotTable( ) {
- getSlotTable().resetSlots();
- }
-
- /**
- * Called from ORB when the ORBInitializers are about to start
- * initializing.
- */
- void setORBInitializing( boolean init ) {
- this.orbInitializing = init;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java 2018-01-30 20:17:18.000000000 -0500
+++ /dev/null 2018-01-30 20:17:18.000000000 -0500
@@ -1,992 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import java.util.*;
-import java.io.IOException;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.BAD_POLICY;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.ORBPackage.InvalidName;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.UNKNOWN;
-
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.RemarshalException;
-
-import org.omg.IOP.CodecFactory;
-
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.Interceptor;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.ORBInitializer;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
-
-import com.sun.corba.se.pept.encoding.OutputObject;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orbutil.closure.ClosureFactory;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.protocol.ForwardException;
-import com.sun.corba.se.spi.protocol.PIHandler;
-import com.sun.corba.se.spi.protocol.RetryType;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.impl.corba.RequestImpl;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.StackImpl;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-/**
- * Provides portable interceptor functionality.
- */
-public class PIHandlerImpl implements PIHandler
-{
- // REVISIT - delete these after framework merging.
- boolean printPushPopEnabled = false;
- int pushLevel = 0;
- private void printPush()
- {
- if (! printPushPopEnabled) return;
- printSpaces(pushLevel);
- pushLevel++;
- System.out.println("PUSH");
- }
- private void printPop()
- {
- if (! printPushPopEnabled) return;
- pushLevel--;
- printSpaces(pushLevel);
- System.out.println("POP");
- }
- private void printSpaces(int n)
- {
- for (int i = 0; i < n; i++) {
- System.out.print(" ");
- }
- }
-
- private ORB orb;
- InterceptorsSystemException wrapper;
- ORBUtilSystemException orbutilWrapper;
- OMGSystemException omgWrapper;
-
- // A unique id used in ServerRequestInfo.
- // This does not correspond to the GIOP request id.
- private int serverRequestIdCounter = 0;
-
- // Stores the codec factory for producing codecs
- CodecFactory codecFactory = null;
-
- // The arguments passed to the application's main method. May be null.
- // This is used for ORBInitializers and set from set_parameters.
- String[] arguments = null;
-
- // The list of portable interceptors, organized by type:
- private InterceptorList interceptorList;
-
- // Cached information for optimization - do we have any interceptors
- // registered of the given types? Set during ORB initialization.
- private boolean hasIORInterceptors;
- private boolean hasClientInterceptors; // temp always true
- private boolean hasServerInterceptors;
-
- // The class responsible for invoking interceptors
- private InterceptorInvoker interceptorInvoker;
-
- // There will be one PICurrent instantiated for every ORB.
- private PICurrent current;
-
- // This table contains a list of PolicyFactories registered using
- // ORBInitInfo.registerPolicyFactory() method.
- // Key for the table is PolicyType which is an Integer
- // Value is PolicyFactory.
- private HashMap policyFactoryTable;
-
- // Table to convert from a ReplyMessage.? to a PI replyStatus short.
- // Note that this table relies on the order and constants of
- // ReplyMessage not to change.
- private final static short REPLY_MESSAGE_TO_PI_REPLY_STATUS[] = {
- SUCCESSFUL.value, // = ReplyMessage.NO_EXCEPTION
- USER_EXCEPTION.value, // = ReplyMessage.USER_EXCEPTION
- SYSTEM_EXCEPTION.value, // = ReplyMessage.SYSTEM_EXCEPTION
- LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD
- LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD_PERM
- TRANSPORT_RETRY.value // = ReplyMessage.NEEDS_ADDRESSING_MODE
- };
-
- // ThreadLocal containing a stack to store client request info objects
- // and a disable count.
- private ThreadLocal threadLocalClientRequestInfoStack =
- new ThreadLocal() {
- protected Object initialValue() {
- return new RequestInfoStack();
- }
- };
-
- // ThreadLocal containing the current server request info object.
- private ThreadLocal threadLocalServerRequestInfoStack =
- new ThreadLocal() {
- protected Object initialValue() {
- return new RequestInfoStack();
- }
- };
-
- public void close() {
- orb = null;
- wrapper = null;
- orbutilWrapper = null;
- omgWrapper = null;
- codecFactory = null;
- arguments = null;
- interceptorList = null;
- interceptorInvoker = null;
- current = null;
- policyFactoryTable = null;
- threadLocalClientRequestInfoStack = null;
- threadLocalServerRequestInfoStack = null;
- }
-
- // Class to contain all ThreadLocal data for ClientRequestInfo
- // maintenance.
- //
- // We use an ArrayList instead since it is not thread-safe.
- // RequestInfoStack is used quite frequently.
- private final class RequestInfoStack extends Stack {
- // Number of times a request has been made to disable interceptors.
- // When this reaches 0, interception hooks are disabled. Any higher
- // value indicates they are enabled.
- // NOTE: The is only currently used on the client side.
- public int disableCount = 0;
- }
-
- public PIHandlerImpl( ORB orb, String[] args ) {
- this.orb = orb ;
- wrapper = InterceptorsSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- orbutilWrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- omgWrapper = OMGSystemException.get( orb,
- CORBALogDomains.RPC_PROTOCOL ) ;
- arguments = args ;
-
- // Create codec factory:
- codecFactory = new CodecFactoryImpl( orb );
-
- // Create new interceptor list:
- interceptorList = new InterceptorList( wrapper );
-
- // Create a new PICurrent.
- current = new PICurrent( orb );
-
- // Create new interceptor invoker, initially disabled:
- interceptorInvoker = new InterceptorInvoker( orb, interceptorList,
- current );
-
- // Register the PI current and Codec factory objects
- orb.getLocalResolver().register( ORBConstants.PI_CURRENT_NAME,
- ClosureFactory.makeConstant( current ) ) ;
- orb.getLocalResolver().register( ORBConstants.CODEC_FACTORY_NAME,
- ClosureFactory.makeConstant( codecFactory ) ) ;
- }
-
- public void initialize() {
- // If we have any orb initializers, make use of them:
- if( orb.getORBData().getORBInitializers() != null ) {
- // Create the ORBInitInfo object to pass to ORB intializers:
- ORBInitInfoImpl orbInitInfo = createORBInitInfo();
-
- // Make sure get_slot and set_slot are not called from within
- // ORB initializers:
- current.setORBInitializing( true );
-
- // Call pre_init on all ORB initializers:
- preInitORBInitializers( orbInitInfo );
-
- // Call post_init on all ORB initializers:
- postInitORBInitializers( orbInitInfo );
-
- // Proprietary: sort interceptors:
- interceptorList.sortInterceptors();
-
- // Re-enable get_slot and set_slot to be called from within
- // ORB initializers:
- current.setORBInitializing( false );
-
- // Ensure nobody makes any more calls on this object.
- orbInitInfo.setStage( ORBInitInfoImpl.STAGE_CLOSED );
-
- // Set cached flags indicating whether we have interceptors
- // registered of a given type.
- hasIORInterceptors = interceptorList.hasInterceptorsOfType(
- InterceptorList.INTERCEPTOR_TYPE_IOR );
- // XXX This must always be true, so that using the new generic
- // RPC framework can pass info between the PI stack and the
- // framework invocation stack. Temporary until Harold fixes
- // this. Note that this must never be true until after the
- // ORBInitializer instances complete executing.
- //hasClientInterceptors = interceptorList.hasInterceptorsOfType(
- //InterceptorList.INTERCEPTOR_TYPE_CLIENT );
- hasClientInterceptors = true;
- hasServerInterceptors = interceptorList.hasInterceptorsOfType(
- InterceptorList.INTERCEPTOR_TYPE_SERVER );
-
- // Enable interceptor invoker (not necessary if no interceptors
- // are registered). This should be the last stage of ORB
- // initialization.
- interceptorInvoker.setEnabled( true );
- }
- }
-
- /**
- * ptc/00-08-06 p 205: "When an application calls ORB::destroy, the ORB
- * 1) waits for all requests in progress to complete
- * 2) calls the Interceptor::destroy operation for each interceptor
- * 3) completes destruction of the ORB"
- *
- * This must be called at the end of ORB.destroy. Note that this is not
- * part of the PIHandler interface, since ORBImpl implements the ORB interface.
- */
- public void destroyInterceptors() {
- interceptorList.destroyAll();
- }
-
- public void objectAdapterCreated( ObjectAdapter oa )
- {
- if (!hasIORInterceptors)
- return ;
-
- interceptorInvoker.objectAdapterCreated( oa ) ;
- }
-
- public void adapterManagerStateChanged( int managerId,
- short newState )
- {
- if (!hasIORInterceptors)
- return ;
-
- interceptorInvoker.adapterManagerStateChanged( managerId, newState ) ;
- }
-
- public void adapterStateChanged( ObjectReferenceTemplate[]
- templates, short newState )
- {
- if (!hasIORInterceptors)
- return ;
-
- interceptorInvoker.adapterStateChanged( templates, newState ) ;
- }
-
- /*
- *****************
- * Client PI hooks
- *****************/
-
- public void disableInterceptorsThisThread() {
- if( !hasClientInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- infoStack.disableCount++;
- }
-
- public void enableInterceptorsThisThread() {
- if( !hasClientInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- infoStack.disableCount--;
- }
-
- public void invokeClientPIStartingPoint()
- throws RemarshalException
- {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- // Invoke the starting interception points and record exception
- // and reply status info in the info object:
- ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
- interceptorInvoker.invokeClientInterceptorStartingPoint( info );
-
- // Check reply status. If we will not have another chance later
- // to invoke the client ending points, do it now.
- short replyStatus = info.getReplyStatus();
- if( (replyStatus == SYSTEM_EXCEPTION.value) ||
- (replyStatus == LOCATION_FORWARD.value) )
- {
- // Note: Transport retry cannot happen here since this happens
- // before the request hits the wire.
-
- Exception exception = invokeClientPIEndingPoint(
- convertPIReplyStatusToReplyMessage( replyStatus ),
- info.getException() );
- if( exception == null ) {
- // Do not throw anything. Otherwise, it must be a
- // SystemException, UserException or RemarshalException.
- } if( exception instanceof SystemException ) {
- throw (SystemException)exception;
- } else if( exception instanceof RemarshalException ) {
- throw (RemarshalException)exception;
- } else if( (exception instanceof UserException) ||
- (exception instanceof ApplicationException) ) {
- // It should not be possible for an interceptor to throw
- // a UserException. By asserting instead of throwing the
- // UserException, we need not declare anything but
- // RemarshalException in the throws clause.
- throw wrapper.exceptionInvalid() ;
- }
- }
- else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
- throw wrapper.replyStatusNotInit() ;
- }
- }
-
- // Needed when an error forces a retry AFTER initiateClientPIRequest
- // but BEFORE invokeClientPIStartingPoint.
- public Exception makeCompletedClientRequest( int replyStatus,
- Exception exception ) {
-
- // 6763340
- return handleClientPIEndingPoint( replyStatus, exception, false ) ;
- }
-
- public Exception invokeClientPIEndingPoint( int replyStatus,
- Exception exception ) {
-
- // 6763340
- return handleClientPIEndingPoint( replyStatus, exception, true ) ;
- }
-
- public Exception handleClientPIEndingPoint(
- int replyStatus, Exception exception, boolean invokeEndingPoint ) {
- if( !hasClientInterceptors ) return exception;
- if( !isClientPIEnabledForThisThread() ) return exception;
-
- // Translate ReplyMessage.replyStatus into PI replyStatus:
- // Note: this is also an assertion to make sure a valid replyStatus
- // is passed in (IndexOutOfBoundsException will be thrown otherwise)
- short piReplyStatus = REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];
-
- // Invoke the ending interception points and record exception
- // and reply status info in the info object:
- ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
- info.setReplyStatus( piReplyStatus );
- info.setException( exception );
-
- if (invokeEndingPoint) {
- // 6763340
- interceptorInvoker.invokeClientInterceptorEndingPoint( info );
- piReplyStatus = info.getReplyStatus();
- }
-
- // Check reply status:
- if( (piReplyStatus == LOCATION_FORWARD.value) ||
- (piReplyStatus == TRANSPORT_RETRY.value) ) {
- // If this is a forward or a retry, reset and reuse
- // info object:
- info.reset();
-
- // fix for 6763340:
- if (invokeEndingPoint) {
- info.setRetryRequest( RetryType.AFTER_RESPONSE ) ;
- } else {
- info.setRetryRequest( RetryType.BEFORE_RESPONSE ) ;
- }
-
- // ... and return a RemarshalException so the orb internals know
- exception = new RemarshalException();
- } else if( (piReplyStatus == SYSTEM_EXCEPTION.value) ||
- (piReplyStatus == USER_EXCEPTION.value) ) {
- exception = info.getException();
- }
-
- return exception;
- }
-
- public void initiateClientPIRequest( boolean diiRequest ) {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- // Get the most recent info object from the thread local
- // ClientRequestInfoImpl stack:
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- ClientRequestInfoImpl info = null;
-
- if (!infoStack.empty() ) {
- info = (ClientRequestInfoImpl)infoStack.peek();
- }
-
- if (!diiRequest && (info != null) && info.isDIIInitiate() ) {
- // In RequestImpl.doInvocation we already called
- // initiateClientPIRequest( true ), so ignore this initiate.
- info.setDIIInitiate( false );
- } else {
- // If there is no info object or if we are not retrying a request,
- // push a new ClientRequestInfoImpl on the stack:
-
- // 6763340: don't push unless this is not a retry
- if( (info == null) || !info.getRetryRequest().isRetry() ) {
- info = new ClientRequestInfoImpl( orb );
- infoStack.push( info );
- printPush();
- // Note: the entry count is automatically initialized to 0.
- }
-
- // Reset the retry request flag so that recursive calls will
- // push a new info object, and bump up entry count so we know
- // when to pop this info object:
- info.setRetryRequest( RetryType.NONE );
- info.incrementEntryCount();
-
- // KMC 6763340: I don't know why this wasn't set earlier,
- // but we do not want a retry to pick up the previous
- // reply status, so clear it here. Most likely a new
- // info was pushed before, so that this was not a problem.
- info.setReplyStatus( RequestInfoImpl.UNINITIALIZED ) ;
-
- // If this is a DII request, make sure we ignore the next initiate.
- if( diiRequest ) {
- info.setDIIInitiate( true );
- }
- }
- }
-
- public void cleanupClientPIRequest() {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
- RetryType rt = info.getRetryRequest() ;
-
- // fix for 6763340
- if (!rt.equals( RetryType.BEFORE_RESPONSE )) {
-
- // If the replyStatus has not yet been set, this is an indication
- // that the ORB threw an exception before we had a chance to
- // invoke the client interceptor ending points.
- //
- // _REVISIT_ We cannot handle any exceptions or ForwardRequests
- // flagged by the ending points here because there is no way
- // to gracefully handle this in any of the calling code.
- // This is a rare corner case, so we will ignore this for now.
- short replyStatus = info.getReplyStatus();
- if (replyStatus == info.UNINITIALIZED ) {
- invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
- wrapper.unknownRequestInvoke(
- CompletionStatus.COMPLETED_MAYBE ) ) ;
- }
- }
-
- // Decrement entry count, and if it is zero, pop it from the stack.
- info.decrementEntryCount();
-
- // fix for 6763340, and probably other cases (non-recursive retry)
- if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) {
- // RequestInfoStack infoStack =
- // threadLocalClientRequestInfoStack.get();
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- infoStack.pop();
- printPop();
- }
- }
-
- public void setClientPIInfo(CorbaMessageMediator messageMediator)
- {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- peekClientRequestInfoImplStack().setInfo(messageMediator);
- }
-
- public void setClientPIInfo( RequestImpl requestImpl ) {
- if( !hasClientInterceptors ) return;
- if( !isClientPIEnabledForThisThread() ) return;
-
- peekClientRequestInfoImplStack().setDIIRequest( requestImpl );
- }
-
- /*
- *****************
- * Server PI hooks
- *****************/
-
- public void invokeServerPIStartingPoint()
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- interceptorInvoker.invokeServerInterceptorStartingPoint( info );
-
- // Handle SystemException or ForwardRequest:
- serverPIHandleExceptions( info );
- }
-
- public void invokeServerPIIntermediatePoint()
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- interceptorInvoker.invokeServerInterceptorIntermediatePoint( info );
-
- // Clear servant from info object so that the user has control over
- // its lifetime:
- info.releaseServant();
-
- // Handle SystemException or ForwardRequest:
- serverPIHandleExceptions( info );
- }
-
- public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
- {
- if( !hasServerInterceptors ) return;
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
-
- // REVISIT: This needs to be done "early" for the following workaround.
- info.setReplyMessage( replyMessage );
-
- // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
- // but needs to be here for now. See comment in that method for why.
- info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
-
- // It is possible we might have entered this method more than
- // once (e.g. if an ending point threw a SystemException, then
- // a new ServerResponseImpl is created).
- if( !info.getAlreadyExecuted() ) {
- int replyStatus = replyMessage.getReplyStatus();
-
- // Translate ReplyMessage.replyStatus into PI replyStatus:
- // Note: this is also an assertion to make sure a valid
- // replyStatus is passed in (IndexOutOfBoundsException will be
- // thrown otherwise)
- short piReplyStatus =
- REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];
-
- // Make forwarded IOR available to interceptors, if applicable:
- if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
- ( piReplyStatus == TRANSPORT_RETRY.value ) )
- {
- info.setForwardRequest( replyMessage.getIOR() );
- }
-
- // REVISIT: Do early above for now.
- // Make reply message available to interceptors:
- //info.setReplyMessage( replyMessage );
-
- // Remember exception so we can tell if an interceptor changed it.
- Exception prevException = info.getException();
-
- // _REVISIT_ We do not have access to the User Exception at
- // this point, so treat it as an UNKNOWN for now.
- // Note that if this is a DSI call, we do have the user exception.
- if( !info.isDynamic() &&
- (piReplyStatus == USER_EXCEPTION.value) )
- {
- info.setException( omgWrapper.unknownUserException(
- CompletionStatus.COMPLETED_MAYBE ) ) ;
- }
-
- // Invoke the ending interception points:
- info.setReplyStatus( piReplyStatus );
- interceptorInvoker.invokeServerInterceptorEndingPoint( info );
- short newPIReplyStatus = info.getReplyStatus();
- Exception newException = info.getException();
-
- // Check reply status. If an interceptor threw a SystemException
- // and it is different than the one that we came in with,
- // rethrow it so the proper response can be constructed:
- if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
- ( newException != prevException ) )
- {
- throw (SystemException)newException;
- }
-
- // If we are to forward the location:
- if( newPIReplyStatus == LOCATION_FORWARD.value ) {
- if( piReplyStatus != LOCATION_FORWARD.value ) {
- // Treat a ForwardRequest as a ForwardException.
- IOR ior = info.getForwardRequestIOR();
- throw new ForwardException( orb, ior ) ;
- }
- else if( info.isForwardRequestRaisedInEnding() ) {
- // Treat a ForwardRequest by changing the IOR.
- replyMessage.setIOR( info.getForwardRequestIOR() );
- }
- }
- }
- }
-
- public void setServerPIInfo( Exception exception ) {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setException( exception );
- }
-
- public void setServerPIInfo( NVList arguments )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setDSIArguments( arguments );
- }
-
- public void setServerPIExceptionInfo( Any exception )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setDSIException( exception );
- }
-
- public void setServerPIInfo( Any result )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setDSIResult( result );
- }
-
- public void initializeServerPIInfo( CorbaMessageMediator request,
- ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
- {
- if( !hasServerInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalServerRequestInfoStack.get();
- ServerRequestInfoImpl info = new ServerRequestInfoImpl( orb );
- infoStack.push( info );
- printPush();
-
- // Notify request object that once response is constructed, make
- // sure we execute ending points.
- request.setExecutePIInResponseConstructor( true );
-
- info.setInfo( request, oa, objectId, oktemp );
- }
-
- public void setServerPIInfo( java.lang.Object servant,
- String targetMostDerivedInterface )
- {
- if( !hasServerInterceptors ) return;
-
- ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
- info.setInfo( servant, targetMostDerivedInterface );
- }
-
- public void cleanupServerPIRequest() {
- if( !hasServerInterceptors ) return;
-
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalServerRequestInfoStack.get();
- infoStack.pop();
- printPop();
- }
-
- /*
- **********************************************************************
- * The following methods are private utility methods.
- ************************************************************************/
-
- /**
- * Handles exceptions for the starting and intermediate points for
- * server request interceptors. This is common code that has been
- * factored out into this utility method.
- *
- * This method will NOT work for ending points.
- */
- private void serverPIHandleExceptions( ServerRequestInfoImpl info )
- {
- int endingPointCall = info.getEndingPointCall();
- if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) {
- // If a system exception was thrown, throw it to caller:
- throw (SystemException)info.getException();
- }
- else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) &&
- (info.getForwardRequestException() != null) )
- {
- // If an interceptor throws a forward request, convert it
- // into a ForwardException for easier handling:
- IOR ior = info.getForwardRequestIOR();
- throw new ForwardException( orb, ior );
- }
- }
-
- /**
- * Utility method to convert a PI reply status short to a ReplyMessage
- * constant. This is a reverse lookup on the table defined in
- * REPLY_MESSAGE_TO_PI_REPLY_STATUS. The reverse lookup need not be
- * performed as quickly since it is only executed in exception
- * conditions.
- */
- private int convertPIReplyStatusToReplyMessage( short replyStatus ) {
- int result = 0;
- for( int i = 0; i < REPLY_MESSAGE_TO_PI_REPLY_STATUS.length; i++ ) {
- if( REPLY_MESSAGE_TO_PI_REPLY_STATUS[i] == replyStatus ) {
- result = i;
- break;
- }
- }
- return result;
- }
-
- /**
- * Convenience method to get the ClientRequestInfoImpl object off the
- * top of the ThreadLocal stack. Throws an INTERNAL exception if
- * the Info stack is empty.
- */
- private ClientRequestInfoImpl peekClientRequestInfoImplStack() {
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- ClientRequestInfoImpl info = null;
- if( !infoStack.empty() ) {
- info = (ClientRequestInfoImpl)infoStack.peek();
- } else {
- throw wrapper.clientInfoStackNull() ;
- }
-
- return info;
- }
-
- /**
- * Convenience method to get the ServerRequestInfoImpl object off the
- * top of the ThreadLocal stack. Returns null if there are none.
- */
- private ServerRequestInfoImpl peekServerRequestInfoImplStack() {
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalServerRequestInfoStack.get();
- ServerRequestInfoImpl info = null;
-
- if( !infoStack.empty() ) {
- info = (ServerRequestInfoImpl)infoStack.peek();
- } else {
- throw wrapper.serverInfoStackNull() ;
- }
-
- return info;
- }
-
- /**
- * Convenience method to determine whether Client PI is enabled
- * for requests on this thread.
- */
- private boolean isClientPIEnabledForThisThread() {
- RequestInfoStack infoStack =
- (RequestInfoStack)threadLocalClientRequestInfoStack.get();
- return (infoStack.disableCount == 0);
- }
-
- /**
- * Call pre_init on all ORB initializers
- */
- private void preInitORBInitializers( ORBInitInfoImpl info ) {
-
- // Inform ORBInitInfo we are in pre_init stage
- info.setStage( ORBInitInfoImpl.STAGE_PRE_INIT );
-
- // Step through each initializer instantiation and call its
- // pre_init. Ignore any exceptions.
- for( int i = 0; i < orb.getORBData().getORBInitializers().length;
- i++ ) {
- ORBInitializer init = orb.getORBData().getORBInitializers()[i];
- if( init != null ) {
- try {
- init.pre_init( info );
- }
- catch( Exception e ) {
- // As per orbos/99-12-02, section 9.3.1.2, "If there are
- // any exceptions, the ORB shall ignore them and proceed."
- }
- }
- }
- }
-
- /**
- * Call post_init on all ORB initializers
- */
- private void postInitORBInitializers( ORBInitInfoImpl info ) {
-
- // Inform ORBInitInfo we are in post_init stage
- info.setStage( ORBInitInfoImpl.STAGE_POST_INIT );
-
- // Step through each initializer instantiation and call its post_init.
- // Ignore any exceptions.
- for( int i = 0; i < orb.getORBData().getORBInitializers().length;
- i++ ) {
- ORBInitializer init = orb.getORBData().getORBInitializers()[i];
- if( init != null ) {
- try {
- init.post_init( info );
- }
- catch( Exception e ) {
- // As per orbos/99-12-02, section 9.3.1.2, "If there are
- // any exceptions, the ORB shall ignore them and proceed."
- }
- }
- }
- }
-
- /**
- * Creates the ORBInitInfo object to be passed to ORB intializers'
- * pre_init and post_init methods
- */
- private ORBInitInfoImpl createORBInitInfo() {
- ORBInitInfoImpl result = null;
-
- // arguments comes from set_parameters. May be null.
-
- // _REVISIT_ The spec does not specify which ID this is to be.
- // We currently get this from the corba.ORB, which reads it from
- // the ORB_ID_PROPERTY property.
- String orbId = orb.getORBData().getORBId() ;
-
- result = new ORBInitInfoImpl( orb, arguments, orbId, codecFactory );
-
- return result;
- }
-
- /**
- * Called by ORBInitInfo when an interceptor needs to be registered.
- * The type is one of:
- *
- * - INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
- *
- INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
- *
- INTERCEPTOR_TYPE_IOR - IORInterceptor
- *
- *
- * @exception DuplicateName Thrown if an interceptor of the given
- * name already exists for the given type.
- */
- public void register_interceptor( Interceptor interceptor, int type )
- throws DuplicateName
- {
- // We will assume interceptor is not null, since it is called
- // internally.
- if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
- throw wrapper.typeOutOfRange( new Integer( type ) ) ;
- }
-
- String interceptorName = interceptor.name();
-
- if( interceptorName == null ) {
- throw wrapper.nameNull() ;
- }
-
- // Register with interceptor list:
- interceptorList.register_interceptor( interceptor, type );
- }
-
- public Current getPICurrent( ) {
- return current;
- }
-
- /**
- * Called when an invalid null parameter was passed. Throws a
- * BAD_PARAM with a minor code of 1
- */
- private void nullParam()
- throws BAD_PARAM
- {
- throw orbutilWrapper.nullParam() ;
- }
-
- /** This is the implementation of standard API defined in org.omg.CORBA.ORB
- * class. This method finds the Policy Factory for the given Policy Type
- * and instantiates the Policy object from the Factory. It will throw
- * PolicyError exception, If the PolicyFactory for the given type is
- * not registered.
- * _REVISIT_, Once Policy Framework work is completed, Reorganize
- * this method to com.sun.corba.se.spi.orb.ORB.
- */
- public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)
- throws org.omg.CORBA.PolicyError
- {
- if( val == null ) {
- nullParam( );
- }
- if( policyFactoryTable == null ) {
- throw new org.omg.CORBA.PolicyError(
- "There is no PolicyFactory Registered for type " + type,
- BAD_POLICY.value );
- }
- PolicyFactory factory = (PolicyFactory)policyFactoryTable.get(
- new Integer(type) );
- if( factory == null ) {
- throw new org.omg.CORBA.PolicyError(
- " Could Not Find PolicyFactory for the Type " + type,
- BAD_POLICY.value);
- }
- org.omg.CORBA.Policy policy = factory.create_policy( type, val );
- return policy;
- }
-
- /** This method registers the Policy Factory in the policyFactoryTable,
- * which is a HashMap. This method is made package private, because
- * it is used internally by the Interceptors.
- */
- public void registerPolicyFactory( int type, PolicyFactory factory ) {
- if( policyFactoryTable == null ) {
- policyFactoryTable = new HashMap();
- }
- Integer key = new Integer( type );
- java.lang.Object val = policyFactoryTable.get( key );
- if( val == null ) {
- policyFactoryTable.put( key, factory );
- }
- else {
- throw omgWrapper.policyFactoryRegFailed( new Integer( type ) ) ;
- }
- }
-
- public synchronized int allocateServerRequestId ()
- {
- return serverRequestIdCounter++;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java 2018-01-30 20:17:19.000000000 -0500
+++ /dev/null 2018-01-30 20:17:19.000000000 -0500
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import java.io.IOException;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.NVList;
-
-import org.omg.IOP.CodecFactory;
-
-import org.omg.CORBA.portable.RemarshalException;
-
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.Interceptor;
-import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableInterceptor.Current;
-
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ;
-
-import com.sun.corba.se.pept.encoding.OutputObject;
-
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.protocol.PIHandler;
-import com.sun.corba.se.spi.protocol.ForwardException;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.corba.RequestImpl;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-/**
- * This is No-Op implementation of PIHandler. It is used in ORBConfigurator
- * to initialize a piHandler before the Persistent Server Activation. This
- * PIHandler implementation will be replaced by the real PIHandler in
- * ORB.postInit( ) call.
- */
-public class PINoOpHandlerImpl implements PIHandler
-{
- public PINoOpHandlerImpl( ) {
- }
-
- public void close() {
- }
-
- public void initialize() {
- }
-
- public void destroyInterceptors() {
- }
-
- public void objectAdapterCreated( ObjectAdapter oa )
- {
- }
-
- public void adapterManagerStateChanged( int managerId,
- short newState )
- {
- }
-
- public void adapterStateChanged( ObjectReferenceTemplate[]
- templates, short newState )
- {
- }
-
-
- public void disableInterceptorsThisThread() {
- }
-
- public void enableInterceptorsThisThread() {
- }
-
- public void invokeClientPIStartingPoint()
- throws RemarshalException
- {
- }
-
- public Exception invokeClientPIEndingPoint(
- int replyStatus, Exception exception )
- {
- return null;
- }
-
- public Exception makeCompletedClientRequest(
- int replyStatus, Exception exception ) {
- return null;
- }
-
- public void initiateClientPIRequest( boolean diiRequest ) {
- }
-
- public void cleanupClientPIRequest() {
- }
-
- public void setClientPIInfo(CorbaMessageMediator messageMediator)
- {
- }
-
- public void setClientPIInfo( RequestImpl requestImpl )
- {
- }
-
- final public void sendCancelRequestIfFinalFragmentNotSent()
- {
- }
-
-
- public void invokeServerPIStartingPoint()
- {
- }
-
- public void invokeServerPIIntermediatePoint()
- {
- }
-
- public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
- {
- }
-
- public void setServerPIInfo( Exception exception ) {
- }
-
- public void setServerPIInfo( NVList arguments )
- {
- }
-
- public void setServerPIExceptionInfo( Any exception )
- {
- }
-
- public void setServerPIInfo( Any result )
- {
- }
-
- public void initializeServerPIInfo( CorbaMessageMediator request,
- ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
- {
- }
-
- public void setServerPIInfo( java.lang.Object servant,
- String targetMostDerivedInterface )
- {
- }
-
- public void cleanupServerPIRequest() {
- }
-
- public void register_interceptor( Interceptor interceptor, int type )
- throws DuplicateName
- {
- }
-
- public Current getPICurrent( ) {
- return null;
- }
-
- public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)
- throws org.omg.CORBA.PolicyError
- {
- return null;
- }
-
- public void registerPolicyFactory( int type, PolicyFactory factory ) {
- }
-
- public int allocateServerRequestId ()
- {
- return 0;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java 2018-01-30 20:17:20.000000000 -0500
+++ /dev/null 2018-01-30 20:17:20.000000000 -0500
@@ -1,929 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import java.io.IOException ;
-
-import java.lang.reflect.Method ;
-import java.lang.reflect.InvocationTargetException ;
-
-import java.util.HashMap ;
-
-import org.omg.PortableInterceptor.ForwardRequest;
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.PortableInterceptor.RequestInfo;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.IOP.TaggedProfile;
-import org.omg.IOP.TaggedComponent;
-import org.omg.IOP.ServiceContextHelper;
-import org.omg.Messaging.SYNC_WITH_TRANSPORT;
-import org.omg.CORBA.ParameterMode;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.CTX_RESTRICT_SCOPE;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NO_RESOURCES;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.InputStream;
-
-import org.omg.Dynamic.Parameter;
-
-import com.sun.corba.se.spi.legacy.connection.Connection;
-
-import com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt;
-
-import com.sun.corba.se.spi.ior.IOR;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-import sun.corba.SharedSecrets;
-
-/**
- * Implementation of the RequestInfo interface as specified in
- * orbos/99-12-02 section 5.4.1.
- */
-public abstract class RequestInfoImpl
- extends LocalObject
- implements RequestInfo, RequestInfoExt
-{
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- // The ORB from which to get PICurrent and other info
- protected ORB myORB;
- protected InterceptorsSystemException wrapper ;
- protected OMGSystemException stdWrapper ;
-
- // The number of interceptors actually invoked for this client request.
- // See setFlowStackIndex for a detailed description.
- protected int flowStackIndex = 0;
-
- // The type of starting point call to make to the interceptors
- // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of
- // appropriate constants.
- protected int startingPointCall;
-
- // The type of intermediate point call to make to the interceptors
- // See ServerRequestInfoImpl for a list of appropriate constants.
- // This does not currently apply to client request interceptors but is
- // here in case intermediate points are introduced in the future.
- protected int intermediatePointCall;
-
- // The type of ending point call to make to the interceptors
- // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of
- // appropriate constants.
- protected int endingPointCall;
-
- // The reply status to return in reply_status. This is initialized
- // to UNINITIALIZED so that we can tell if this has been set or not.
- protected short replyStatus = UNINITIALIZED;
-
- // Constant for an uninitizlied reply status.
- protected static final short UNINITIALIZED = -1;
-
- // Which points we are currently executing (so we can implement the
- // validity table).
- protected int currentExecutionPoint;
- protected static final int EXECUTION_POINT_STARTING = 0;
- protected static final int EXECUTION_POINT_INTERMEDIATE = 1;
- protected static final int EXECUTION_POINT_ENDING = 2;
-
- // Set to true if all interceptors have had all their points
- // executed.
- protected boolean alreadyExecuted;
-
- // Sources of request information
- protected Connection connection;
- protected ServiceContexts serviceContexts;
-
- // The ForwardRequest object if this request is being forwarded.
- // Either the forwardRequest or the forwardRequestIOR field is set.
- // When set, the other field is set to null initially. If the other
- // field is queried, it is lazily calculated and cached. These
- // two attributes are always kept in sync.
- protected ForwardRequest forwardRequest;
- protected IOR forwardRequestIOR;
-
- // PICurrent's SlotTable
- protected SlotTable slotTable;
-
- // The exception to be returned by received_exception and
- // received_exception_id
- protected Exception exception;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Reset the info object so that it can be reused for a retry,
- * for example.
- */
- void reset() {
-
- // Please keep these in the same order as declared above.
-
- flowStackIndex = 0;
- startingPointCall = 0;
- intermediatePointCall = 0;
- endingPointCall = 0;
- // 6763340
- setReplyStatus( UNINITIALIZED ) ;
- currentExecutionPoint = EXECUTION_POINT_STARTING;
- alreadyExecuted = false;
- connection = null;
- serviceContexts = null;
- forwardRequest = null;
- forwardRequestIOR = null;
- exception = null;
-
- // We don't need to reset the Slots because they are
- // already in the clean state after recieve_ interceptor
- // are called.
- }
-
- /*
- **********************************************************************
- * Access protection
- **********************************************************************/
-
- // Method IDs for all methods in RequestInfo. This allows for a
- // convenient O(1) lookup for checkAccess().
- protected static final int MID_REQUEST_ID = 0;
- protected static final int MID_OPERATION = 1;
- protected static final int MID_ARGUMENTS = 2;
- protected static final int MID_EXCEPTIONS = 3;
- protected static final int MID_CONTEXTS = 4;
- protected static final int MID_OPERATION_CONTEXT = 5;
- protected static final int MID_RESULT = 6;
- protected static final int MID_RESPONSE_EXPECTED = 7;
- protected static final int MID_SYNC_SCOPE = 8;
- protected static final int MID_REPLY_STATUS = 9;
- protected static final int MID_FORWARD_REFERENCE = 10;
- protected static final int MID_GET_SLOT = 11;
- protected static final int MID_GET_REQUEST_SERVICE_CONTEXT = 12;
- protected static final int MID_GET_REPLY_SERVICE_CONTEXT = 13;
- // The last value from RequestInfo (be sure to update this):
- protected static final int MID_RI_LAST = 13;
-
- /*
- **********************************************************************
- * Public interfaces
- **********************************************************************/
-
- /**
- * Creates a new RequestInfoImpl object.
- */
- public RequestInfoImpl( ORB myORB ) {
- super();
-
- this.myORB = myORB;
- wrapper = InterceptorsSystemException.get( myORB,
- CORBALogDomains.RPC_PROTOCOL ) ;
- stdWrapper = OMGSystemException.get( myORB,
- CORBALogDomains.RPC_PROTOCOL ) ;
-
- // Capture the current TSC and make it the RSC of this request.
- PICurrent current = (PICurrent)(myORB.getPIHandler().getPICurrent());
- slotTable = current.getSlotTable( );
- }
-
- /**
- * Implementation for request_id() differs for client and server
- * implementations.
- *
- * Uniquely identifies an active request/reply sequence. Once a
- * request/reply sequence is concluded this ID may be reused. (this
- * is NOT necessarily the same as the GIOP request_id).
- */
- abstract public int request_id ();
-
- /**
- * Implementation for operation() differs for client and server
- * implementations.
- *
- * The name of the operation being invoked.
- */
- abstract public String operation ();
-
-
- /**
- * This method returns the list of arguments for the operation that was
- * invoked. It raises NO_RESOURCES exception if the operation is not invoked
- * by using DII mechanism.
- */
- abstract public Parameter[] arguments ();
-
- /**
- * This method returns the list of exceptios that was raised when the
- * operation was invoked. It raises NO_RESOURCES exception if the operation
- * is not invoked by using DII mechanism.
- */
- abstract public TypeCode[] exceptions ();
-
- /**
- * This method returns the list of contexts for the DII operation.
- * It raises NO_RESOURCES exception if the operation is not invoked by
- * using DII mechanism.
- */
- abstract public String[] contexts ();
-
- /**
- * This method returns the list of operation_context for the DII operation.
- * It raises NO_RESOURCES exception if the operation is not invoked by
- * using DII mechanism.
- */
- abstract public String[] operation_context ();
-
- /**
- * This method returns the result from the invoked DII operation.
- * It raises NO_RESOURCES exception if the operation is not invoked by
- * using DII mechanism.
- */
- abstract public Any result ();
-
- /**
- * Implementation for response_expected() differs for client and server
- * implementations.
- *
- * Indicates whether a response is expected. On the client, a reply is
- * not returned when response_expected is false, so receive_reply cannot
- * be called. receive_other is called unless an exception occurs, in
- * which case receive_exception is called. On the client, within
- * send_poll, this attribute is true.
- */
- abstract public boolean response_expected ();
-
- /**
- * Defined in the Messaging specification. Pertinent only when
- * response_expected is false. If response_expected is true, the value
- * of sync_scope is undefined. It defines how far the request shall
- * progress before control is returned to the client. This attribute may
- * have one of the follwing values:
- *
- * - Messaging::SYNC_NONE
- * - Messaging::SYNC_WITH_TRANSPORT
- * - Messaging::SYNC_WITH_SERVER
- * - Messaging::SYNC_WITH_TARGET
- *
- */
- public short sync_scope (){
- checkAccess( MID_SYNC_SCOPE );
- return SYNC_WITH_TRANSPORT.value; // REVISIT - get from MessageMediator
- }
-
- /**
- * Describes the state of the result of the operation invocation. Its
- * value can be one of the following:
- *
- * - PortableInterceptor::SUCCESSFUL
- * - PortableInterceptor::SYSTEM_EXCEPTION
- * - PortableInterceptor::USER_EXCEPTION
- * - PortableInterceptor::LOCATION_FORWARD
- * - PortableInterceptor::TRANSPORT_RETRY
- *
- */
- public short reply_status (){
- checkAccess( MID_REPLY_STATUS );
- return replyStatus;
- }
-
- /**
- * Implementation for forward_reference() differs for client and server
- * implementations.
- *
- * If the reply_status attribute is LOCATION_FORWARD
- * then this attribute will contain the object
- * to which the request will be forwarded. It is indeterminate whether a
- * forwarded request will actually occur.
- */
- abstract public Object forward_reference ();
-
-
- /**
- * Returns the data from the given slot of the PortableInterceptor::Current
- * that is in the scope of the request.
- *
- * If the given slot has not been set, then an any containing a type code
- * with a TCKind value of tk_null is returned.
- *
- * If the ID does not define an allocated slot, InvalidSlot is raised.
- */
- public Any get_slot (int id)
- throws InvalidSlot
- {
- // access is currently valid for all states:
- //checkAccess( MID_GET_SLOT );
- // Delegate the call to the slotTable which was set when RequestInfo was
- // created.
- return slotTable.get_slot( id );
- }
-
- /**
- * Implementation for get_request_service_context() differs for client
- * and server implementations.
- *
- * This operation returns a copy of the service context with the given ID
- * that is associated with the request. If the request's service context
- * does not contain an etry for that ID, BAD_PARAM with a minor code of
- * TBD_BP is raised.
- */
- abstract public org.omg.IOP.ServiceContext
- get_request_service_context(int id);
-
- /**
- * Implementation for get_reply_service_context() differs for client
- * and server implementations.
- *
- * This operation returns a copy of the service context with the given ID
- * that is associated with the reply. IF the request's service context
- * does not contain an entry for that ID, BAD_PARAM with a minor code of
- * TBD_BP is raised.
- */
- abstract public org.omg.IOP.ServiceContext
- get_reply_service_context (int id);
-
-
- // NOTE: When adding a method, be sure to:
- // 1. Add a MID_* constant for that method
- // 2. Call checkAccess at the start of the method
- // 3. Define entries in the validCall[][] table for interception points
- // in both ClientRequestInfoImpl and ServerRequestInfoImpl.
-
-
-
- /*
- **********************************************************************
- * Proprietary methods
- **********************************************************************/
-
- /**
- * @return The connection on which the request is made.
- *
- * Note: we store the connection as an internal type but
- * expose it here as an external type.
- */
- public com.sun.corba.se.spi.legacy.connection.Connection connection()
- {
- return connection;
- }
-
- /*
- **********************************************************************
- * Private utility methods
- **********************************************************************/
-
- /**
- * Inserts the UserException inside the given ApplicationException
- * into the given Any. Throws an UNKNOWN with minor code
- * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be
- * found to insert it with.
- */
- private void insertApplicationException( ApplicationException appException,
- Any result )
- throws UNKNOWN
- {
- try {
- // Extract the UserException from the ApplicationException.
- // Look up class name from repository id:
- RepositoryId repId = RepositoryId.cache.getId(
- appException.getId() );
- String className = repId.getClassName();
-
- // Find the read method on the helper class:
- String helperClassName = className + "Helper";
- Class> helperClass =
- SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
- Class[] readParams = new Class[1];
- readParams[0] = org.omg.CORBA.portable.InputStream.class;
- Method readMethod = helperClass.getMethod( "read", readParams );
-
- // Invoke the read method, passing in the input stream to
- // retrieve the user exception. Mark and reset the stream
- // as to not disturb it.
- InputStream ueInputStream = appException.getInputStream();
- ueInputStream.mark( 0 );
- UserException userException = null;
- try {
- java.lang.Object[] readArguments = new java.lang.Object[1];
- readArguments[0] = ueInputStream;
- userException = (UserException)readMethod.invoke(
- null, readArguments );
- }
- finally {
- try {
- ueInputStream.reset();
- }
- catch( IOException e ) {
- throw wrapper.markAndResetFailed( e ) ;
- }
- }
-
- // Insert this UserException into the provided Any using the
- // helper class.
- insertUserException( userException, result );
- } catch( ClassNotFoundException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( NoSuchMethodException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( SecurityException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( IllegalAccessException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( IllegalArgumentException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- } catch( InvocationTargetException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
- }
- }
-
- /**
- * Inserts the UserException into the given Any.
- * Throws an UNKNOWN with minor code
- * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be
- * found to insert it with.
- */
- private void insertUserException( UserException userException, Any result )
- throws UNKNOWN
- {
- try {
- // Insert this UserException into the provided Any using the
- // helper class.
- if( userException != null ) {
- Class exceptionClass = userException.getClass();
- String className = exceptionClass.getName();
- String helperClassName = className + "Helper";
- Class> helperClass =
- SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
-
- // Find insert( Any, class ) method
- Class[] insertMethodParams = new Class[2];
- insertMethodParams[0] = org.omg.CORBA.Any.class;
- insertMethodParams[1] = exceptionClass;
- Method insertMethod = helperClass.getMethod(
- "insert", insertMethodParams );
-
- // Call helper.insert( result, userException ):
- java.lang.Object[] insertMethodArguments =
- new java.lang.Object[2];
- insertMethodArguments[0] = result;
- insertMethodArguments[1] = userException;
- insertMethod.invoke( null, insertMethodArguments );
- }
- } catch( ClassNotFoundException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( NoSuchMethodException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( SecurityException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( IllegalAccessException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( IllegalArgumentException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- } catch( InvocationTargetException e ) {
- throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
- }
- }
-
- /*
- **********************************************************************
- * Protected utility methods
- **********************************************************************/
-
- /**
- * Internal utility method to convert an NVList into a PI Parameter[]
- */
- protected Parameter[] nvListToParameterArray( NVList parNVList ) {
-
- // _REVISIT_ This utility method should probably be doing a deep
- // copy so interceptor can't accidentally change the arguments.
-
- int count = parNVList.count();
- Parameter[] plist = new Parameter[count];
- try {
- for( int i = 0; i < count; i++ ) {
- Parameter p = new Parameter();
- plist[i] = p;
- NamedValue nv = parNVList.item( i );
- plist[i].argument = nv.value();
- // ParameterMode spec can be found in 99-10-07.pdf
- // Section:10.5.22
- // nv.flags spec can be found in 99-10-07.pdf
- // Section 7.1.1
- // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3
- // To convert this into enum PARAM_IN, PARAM_OUT and
- // PARAM_INOUT the value is subtracted by 1.
- plist[i].mode = ParameterMode.from_int( nv.flags() - 1 );
- }
- } catch ( Exception e ) {
- throw wrapper.exceptionInArguments( e ) ;
- }
-
- return plist;
- }
-
- /**
- * Utility to wrap the given Exception in an Any object and return it.
- * If the exception is a UserException which cannot be inserted into
- * an any, then this returns an Any containing the system exception
- * UNKNOWN.
- */
- protected Any exceptionToAny( Exception exception ){
- Any result = myORB.create_any();
-
- if( exception == null ) {
- // Note: exception should never be null here since we will throw
- // a BAD_INV_ORDER if this is not called from receive_exception.
- throw wrapper.exceptionWasNull2() ;
- } else if( exception instanceof SystemException ) {
- ORBUtility.insertSystemException(
- (SystemException)exception, result );
- } else if( exception instanceof ApplicationException ) {
- // Use the Helper class for this exception to insert it into an
- // Any.
- try {
- // Insert the user exception inside the application exception
- // into the Any result:
- ApplicationException appException =
- (ApplicationException)exception;
- insertApplicationException( appException, result );
- } catch( UNKNOWN e ) {
- // As per ptc/00-08-06, 21.3.13.4. if we cannot find the
- // appropriate class, then return an any containing UNKNOWN,
- // with a minor code of 1. This is conveniently the same
- // exception that is returned from the
- // insertApplicationException utility method.
- ORBUtility.insertSystemException( e, result );
- }
- } else if( exception instanceof UserException ) {
- try {
- UserException userException = (UserException)exception;
- insertUserException( userException, result );
- } catch( UNKNOWN e ) {
- ORBUtility.insertSystemException( e, result );
- }
- }
-
-
- return result;
- }
-
- /**
- * Utility method to look up a service context with the given id and
- * convert it to an IOP.ServiceContext. Uses the given HashMap as
- * a cache. If not found in cache, the result is inserted in the cache.
- */
- protected org.omg.IOP.ServiceContext
- getServiceContext ( HashMap cachedServiceContexts,
- ServiceContexts serviceContexts, int id )
- {
- org.omg.IOP.ServiceContext result = null;
- Integer integerId = new Integer( id );
-
- // Search cache first:
- result = (org.omg.IOP.ServiceContext)
- cachedServiceContexts.get( integerId );
-
- // null could normally mean that either we cached the value null
- // or it's not in the cache. However, there is no way for us to
- // cache the value null in the following code.
- if( result == null ) {
- // Not in cache. Find it and put in cache.
- // Get the desired "core" service context.
- com.sun.corba.se.spi.servicecontext.ServiceContext context =
- serviceContexts.get( id );
- if (context == null)
- throw stdWrapper.invalidServiceContextId() ;
-
- // Convert the "core" service context to an
- // "IOP" ServiceContext by writing it to a
- // CDROutputStream and reading it back.
- EncapsOutputStream out =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
-
- context.write( out, GIOPVersion.V1_2 );
- InputStream inputStream = out.create_input_stream();
- result = ServiceContextHelper.read( inputStream );
-
- cachedServiceContexts.put( integerId, result );
- }
-
- // Good citizen: For increased efficiency, we assume that interceptors
- // will not modify the returned ServiceContext. Otherwise, we would
- // have to make a deep copy.
-
- return result;
- }
-
-
- /**
- * Utility method to add an IOP.ServiceContext to a core.ServiceContexts
- * object. If replace is true, any service context with the given id
- * is replaced.
- *
- * Raises BAD_INV_ORDER if replace is false and a service context with
- * the given id already exists.
- *
- * Uses the given HashMap as a cache. If a service context is placed
- * in the container, it goes in the HashMap as well.
- */
- protected void addServiceContext(
- HashMap cachedServiceContexts,
- ServiceContexts serviceContexts,
- org.omg.IOP.ServiceContext service_context,
- boolean replace )
- {
- int id = 0 ;
- // Convert IOP.service_context to core.ServiceContext:
- EncapsOutputStream outputStream =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
- InputStream inputStream = null;
- UnknownServiceContext coreServiceContext = null;
- ServiceContextHelper.write( outputStream, service_context );
- inputStream = outputStream.create_input_stream();
-
- // Constructor expects id to already have been read from stream.
- coreServiceContext = new UnknownServiceContext(
- inputStream.read_long(),
- (org.omg.CORBA_2_3.portable.InputStream)inputStream );
-
- id = coreServiceContext.getId();
-
- if (serviceContexts.get(id) != null)
- if (replace)
- serviceContexts.delete( id );
- else
- throw stdWrapper.serviceContextAddFailed( new Integer(id) ) ;
-
- serviceContexts.put( coreServiceContext );
-
- // Place IOP.ServiceContext in cache as well:
- cachedServiceContexts.put( new Integer( id ), service_context );
- }
-
- /**
- * Sets the number of interceptors whose starting interception
- * points were successfully invoked on this client call. As specified
- * in orbos/99-12-02, section 5.2.1., not all interceptors will
- * be invoked if a ForwardRequest exception or a system exception
- * is raised. This keeps track of how many were successfully executed
- * so we know not to execute the corresponding ending interception
- * points for the interceptors whose starting interception points
- * were not completed. This simulates the "Flow Stack Visual Model"
- * presented in section 5.1.3.*/
- protected void setFlowStackIndex(int num ) {
- this.flowStackIndex = num;
- }
-
- /**
- * Returns the number of interceptors whose starting interception
- * points were actually invoked on this client request. See
- * setFlowStackIndex for more details.
- */
- protected int getFlowStackIndex() {
- return this.flowStackIndex;
- }
-
- /**
- * Sets which ending interception point should be called
- * for each interceptor in the virtual flow stack.
- */
- protected void setEndingPointCall( int call ) {
- this.endingPointCall = call;
- }
-
- /**
- * Retrieves the current ending point call type (see
- * setEndingPointCall for more details).
- */
- protected int getEndingPointCall() {
- return this.endingPointCall;
- }
-
- /**
- * Sets which intermediate interception point should be called
- * for each interceptor in the virtual flow stack.
- */
- protected void setIntermediatePointCall( int call ) {
- this.intermediatePointCall = call;
- }
-
- /**
- * Retrieves the current intermediate point call type (see
- * setEndingPointCall for more details).
- */
- protected int getIntermediatePointCall() {
- return this.intermediatePointCall;
- }
-
- /**
- * Sets which starting interception point should be called
- * for each interceptor in the virtual flow stack.
- */
- protected void setStartingPointCall( int call ) {
- this.startingPointCall = call;
- }
-
- /**
- * Retrieves the current starting point call type (see
- * setStartingPointCall for more details).
- */
- protected int getStartingPointCall() {
- return this.startingPointCall;
- }
-
- /**
- * Returns true if all interceptors' starting and ending points
- * have already executed to completion, or false if not yet.
- */
- protected boolean getAlreadyExecuted() {
- return this.alreadyExecuted;
- }
-
- /**
- * Sets whether all interceotrs' starting and ending points
- * have already been executed to completion.
- */
- protected void setAlreadyExecuted( boolean alreadyExecuted ) {
- this.alreadyExecuted = alreadyExecuted;
- }
-
- /**
- * Sets the value to be returned by reply_status
- */
- protected void setReplyStatus( short replyStatus ) {
- this.replyStatus = replyStatus;
- }
-
- /**
- * Gets the current reply_status without doing an access check
- * (available only to package and subclasses)
- */
- protected short getReplyStatus() {
- return this.replyStatus;
- }
-
- /**
- * Stores the given ForwardRequest object for later analysis.
- * This version supplements setForwardRequest( IOR );
- */
- protected void setForwardRequest( ForwardRequest forwardRequest ) {
- this.forwardRequest = forwardRequest;
- this.forwardRequestIOR = null;
- }
-
- /**
- * Stores the given IOR for later forward request analysis.
- * This version supplements setForwardRequest( ForwardRequest );
- */
- protected void setForwardRequest( IOR ior ) {
- this.forwardRequestIOR = ior;
- this.forwardRequest = null;
- }
-
- /**
- * Retrieves the ForwardRequest object as a ForwardRequest exception.
- */
- protected ForwardRequest getForwardRequestException() {
- if( this.forwardRequest == null ) {
- if( this.forwardRequestIOR != null ) {
- // Convert the internal IOR to a forward request exception
- // by creating an object reference.
- org.omg.CORBA.Object obj = iorToObject(this.forwardRequestIOR);
- this.forwardRequest = new ForwardRequest( obj );
- }
- }
-
- return this.forwardRequest;
- }
-
- /**
- * Retrieves the IOR of the ForwardRequest exception.
- */
- protected IOR getForwardRequestIOR() {
- if( this.forwardRequestIOR == null ) {
- if( this.forwardRequest != null ) {
- this.forwardRequestIOR = ORBUtility.getIOR(
- this.forwardRequest.forward ) ;
- }
- }
-
- return this.forwardRequestIOR;
- }
-
- /**
- * Sets the exception to be returned by received_exception and
- * received_exception_id.
- */
- protected void setException( Exception exception ) {
- this.exception = exception;
- }
-
- /**
- * Returns the exception to be returned by received_exception and
- * received_exception_id.
- */
- Exception getException() {
- return this.exception;
- }
-
- /**
- * Sets the execution point that we are currently executing
- * (starting points, intermediate points, or ending points).
- * This allows us to enforce the validity table.
- */
- protected void setCurrentExecutionPoint( int executionPoint ) {
- this.currentExecutionPoint = executionPoint;
- }
-
- /**
- * Check whether the caller is allowed to access this method at
- * this particular time. This is overridden in subclasses to implement
- * the validity table specified in ptc/00-04-05, table 21-1 and 21-2.
- * The currentExecutionPoint attribute is checked, and if access is
- * forbidden at this time, BAD_INV_ORDER is raised with a minor code of
- * TBD_BIO.
- *
- * @param methodID The ID of this method, one of the MID_* constants.
- * This allows us to easily look up the method access in a table.
- * Note that method ids may overlap between subclasses.
- */
- protected abstract void checkAccess( int methodID )
- throws BAD_INV_ORDER;
-
- /**
- * The server side does an explicit set rather than taking the
- * current PICurrent table as is done in the general RequestInfoImpl
- * constructor.
- */
- void setSlotTable(SlotTable slotTable)
- {
- this.slotTable = slotTable;
- }
-
- protected org.omg.CORBA.Object iorToObject( IOR ior )
- {
- return ORBUtility.makeObjectReference( ior ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java 2018-01-30 20:17:20.000000000 -0500
+++ /dev/null 2018-01-30 20:17:20.000000000 -0500
@@ -1,907 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.BAD_INV_ORDER;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NO_RESOURCES;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.TypeCode;
-
-import org.omg.PortableServer.Servant;
-
-import org.omg.IOP.TaggedProfile;
-import org.omg.IOP.ServiceContext;
-
-import org.omg.Dynamic.Parameter;
-
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.PortableInterceptor.ServerRequestInfo;
-import org.omg.PortableInterceptor.LOCATION_FORWARD;
-import org.omg.PortableInterceptor.SUCCESSFUL;
-import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
-import org.omg.PortableInterceptor.TRANSPORT_RETRY;
-import org.omg.PortableInterceptor.USER_EXCEPTION;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import java.util.*;
-
-/**
- * Implementation of the ServerRequestInfo interface as specified in
- * orbos/99-12-02 section 5.4.3.
- */
-public final class ServerRequestInfoImpl
- extends RequestInfoImpl
- implements ServerRequestInfo
-{
- // The available constants for startingPointCall
- static final int CALL_RECEIVE_REQUEST_SERVICE_CONTEXT = 0;
-
- // The available constants for intermediatePointCall. The default (0)
- // is receive_request, but can be set to none on demand.
- static final int CALL_RECEIVE_REQUEST = 0;
- static final int CALL_INTERMEDIATE_NONE = 1;
-
- // The available constants for endingPointCall
- static final int CALL_SEND_REPLY = 0;
- static final int CALL_SEND_EXCEPTION = 1;
- static final int CALL_SEND_OTHER = 2;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
- // Set to true if the server ending point raised ForwardRequest at some
- // point in the ending point.
- private boolean forwardRequestRaisedInEnding;
-
- // Sources of server request information:
- private CorbaMessageMediator request;
- private java.lang.Object servant;
- private byte[] objectId;
- private ObjectKeyTemplate oktemp ;
-
- // Information cached from calls to oktemp
- private byte[] adapterId;
- private String[] adapterName;
-
- private ArrayList addReplyServiceContextQueue;
- private ReplyMessage replyMessage;
- private String targetMostDerivedInterface;
- private NVList dsiArguments;
- private Any dsiResult;
- private Any dsiException;
- private boolean isDynamic;
- private ObjectAdapter objectAdapter;
- private int serverRequestId;
-
- // Cached information:
- private Parameter[] cachedArguments;
- private Any cachedSendingException;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedRequestServiceContexts;
- // key = Integer, value = IOP.ServiceContext.
- private HashMap cachedReplyServiceContexts;
-
- //////////////////////////////////////////////////////////////////////
- //
- // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
- //
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Reset the info object so that it can be reused for a retry,
- * for example.
- */
- void reset() {
- super.reset();
-
- // Please keep these in the same order as declared above.
-
- forwardRequestRaisedInEnding = false;
-
- request = null;
- servant = null;
- objectId = null;
- oktemp = null;
-
- adapterId = null;
- adapterName = null;
-
- addReplyServiceContextQueue = null;
- replyMessage = null;
- targetMostDerivedInterface = null;
- dsiArguments = null;
- dsiResult = null;
- dsiException = null;
- isDynamic = false;
- objectAdapter = null;
- serverRequestId = myORB.getPIHandler().allocateServerRequestId();
-
- // reset cached attributes:
- cachedArguments = null;
- cachedSendingException = null;
- cachedRequestServiceContexts = null;
- cachedReplyServiceContexts = null;
-
- startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT;
- intermediatePointCall = CALL_RECEIVE_REQUEST;
- endingPointCall = CALL_SEND_REPLY;
- }
-
- /*
- **********************************************************************
- * Access protection
- **********************************************************************/
-
- // Method IDs for all methods in ServerRequestInfo. This allows for a
- // convenient O(1) lookup for checkAccess().
- protected static final int MID_SENDING_EXCEPTION = MID_RI_LAST + 1;
- protected static final int MID_OBJECT_ID = MID_RI_LAST + 2;
- protected static final int MID_ADAPTER_ID = MID_RI_LAST + 3;
- protected static final int MID_TARGET_MOST_DERIVED_INTERFACE
- = MID_RI_LAST + 4;
- protected static final int MID_GET_SERVER_POLICY = MID_RI_LAST + 5;
- protected static final int MID_SET_SLOT = MID_RI_LAST + 6;
- protected static final int MID_TARGET_IS_A = MID_RI_LAST + 7;
- protected static final int MID_ADD_REPLY_SERVICE_CONTEXT
- = MID_RI_LAST + 8;
- protected static final int MID_SERVER_ID = MID_RI_LAST + 9;
- protected static final int MID_ORB_ID = MID_RI_LAST + 10;
- protected static final int MID_ADAPTER_NAME = MID_RI_LAST + 11;
-
- // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2).
- // Note: These must be in the same order as specified in contants.
- private static final boolean validCall[][] = {
- // LEGEND:
- // r_rsc = receive_request_service_contexts
- // r_req = receive_request
- // s_rep = send_reply
- // s_exc = send_exception
- // s_oth = send_other
- //
- // A true value indicates call is valid at specified point.
- // A false value indicates the call is invalid.
- //
- // NOTE: If the order or number of columns change, update
- // checkAccess() accordingly.
- //
- // { r_rsc, r_req, s_rep, s_exc, s_oth }
- // RequestInfo methods:
- /*request_id*/ { true , true , true , true , true },
- /*operation*/ { true , true , true , true , true },
- /*arguments*/ { false, true , true , false, false },
- /*exceptions*/ { false, true , true , true , true },
- /*contexts*/ { false, true , true , true , true },
- /*operation_context*/ { false, true , true , false, false },
- /*result*/ { false, false, true , false, false },
- /*response_expected*/ { true , true , true , true , true },
- /*sync_scope*/ { true , true , true , true , true },
- /*reply_status*/ { false, false, true , true , true },
- /*forward_reference*/ { false, false, false, false, true },
- /*get_slot*/ { true , true , true , true , true },
- /*get_request_service_context*/ { true , true , true , true , true },
- /*get_reply_service_context*/ { false, false, true , true , true },
- //
- // ServerRequestInfo methods::
- /*sending_exception*/ { false, false, false, true , false },
- /*object_id*/ { false, true , true , true , true },
- /*adapter_id*/ { false, true , true , true , true },
- /*target_most_derived_inte...*/ { false, true , false, false, false },
- /*get_server_policy*/ { true , true , true , true , true },
- /*set_slot*/ { true , true , true , true , true },
- /*target_is_a*/ { false, true , false, false, false },
- /*add_reply_service_context*/ { true , true , true , true , true },
- /*orb_id*/ { false, true , true , true , true },
- /*server_id*/ { false, true , true , true , true },
- /*adapter_name*/ { false, true , true , true , true }
- };
-
- /*
- **********************************************************************
- * Public interfaces
- **********************************************************************/
-
- /**
- * Creates a new ServerRequestInfo implementation.
- * The constructor is package scope since no other package need create
- * an instance of this class.
- */
- ServerRequestInfoImpl( ORB myORB ) {
- super( myORB );
- startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT;
- intermediatePointCall = CALL_RECEIVE_REQUEST;
- endingPointCall = CALL_SEND_REPLY;
- serverRequestId = myORB.getPIHandler().allocateServerRequestId();
- }
-
- /**
- * Any containing the exception to be returned to the client.
- */
- public Any sending_exception () {
- checkAccess( MID_SENDING_EXCEPTION );
-
- if( cachedSendingException == null ) {
- Any result = null ;
-
- if( dsiException != null ) {
- result = dsiException;
- } else if( exception != null ) {
- result = exceptionToAny( exception );
- } else {
- // sending_exception should not be callable if both dsiException
- // and exception are null.
- throw wrapper.exceptionUnavailable() ;
- }
-
- cachedSendingException = result;
- }
-
- return cachedSendingException;
- }
-
- /**
- * The opaque object_id describing the target of the operation invocation.
- */
- public byte[] object_id () {
- checkAccess( MID_OBJECT_ID );
-
- if( objectId == null ) {
- // For some reason, we never set object id. This could be
- // because a servant locator caused a location forward or
- // raised an exception. As per ptc/00-08-06, section 21.3.14,
- // we throw NO_RESOURCES
- throw stdWrapper.piOperationNotSupported6() ;
- }
-
- // Good citizen: In the interest of efficiency, we will assume
- // interceptors will not change the resulting byte[] array.
- // Otherwise, we would need to make a clone of this array.
-
- return objectId;
- }
-
- private void checkForNullTemplate()
- {
- if (oktemp == null) {
- // For some reason, we never set the ObjectKeyTemplate
- // because a servant locator caused a location forward or
- // raised an exception. As per ptc/00-08-06, section 21.3.14,
- // we throw NO_RESOURCES
- throw stdWrapper.piOperationNotSupported7() ;
- }
- }
-
- public String server_id()
- {
- checkAccess( MID_SERVER_ID ) ;
- checkForNullTemplate() ;
-
- // Good citizen: In the interest of efficiency, we will assume
- // interceptors will not change the resulting byte[] array.
- // Otherwise, we would need to make a clone of this array.
-
- return Integer.toString( oktemp.getServerId() ) ;
- }
-
- public String orb_id()
- {
- checkAccess( MID_ORB_ID ) ;
-
- return myORB.getORBData().getORBId() ;
- }
-
- synchronized public String[] adapter_name()
- {
- checkAccess( MID_ADAPTER_NAME ) ;
-
- if (adapterName == null) {
- checkForNullTemplate() ;
-
- ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
- adapterName = oaid.getAdapterName() ;
- }
-
- return adapterName ;
- }
-
- /**
- * The opaque identifier for the object adapter.
- */
- synchronized public byte[] adapter_id ()
- {
- checkAccess( MID_ADAPTER_ID );
-
- if( adapterId == null ) {
- checkForNullTemplate() ;
- adapterId = oktemp.getAdapterId() ;
- }
-
- return adapterId;
- }
-
- /**
- * The RepositoryID for the most derived interface of the servant.
- */
- public String target_most_derived_interface () {
- checkAccess( MID_TARGET_MOST_DERIVED_INTERFACE );
- return targetMostDerivedInterface;
- }
-
- /**
- * Returns the policy in effect for this operation for the given policy
- * type.
- */
- public Policy get_server_policy (int type) {
- // access is currently valid for all states:
- //checkAccess( MID_GET_SERVER_POLICY );
-
- Policy result = null;
-
- if( objectAdapter != null ) {
- result = objectAdapter.getEffectivePolicy( type );
- }
-
- // _REVISIT_ RTF Issue: get_server_policy spec not in sync with
- // get_effective_policy spec.
-
- return result;
- }
-
- /**
- * Allows an Interceptor to set a slot in the Current that is in the scope
- * of the request. If data already exists in that slot, it will be
- * overwritten. If the ID does not define an allocated slot, InvalidSlot
- * is raised.
- */
- public void set_slot (int id, Any data) throws InvalidSlot {
- // access is currently valid for all states:
- //checkAccess( MID_SET_SLOT );
-
- slotTable.set_slot( id, data );
- }
-
- /**
- * Returns true if the servant is the given RepositoryId, false if it is
- * not.
- */
- public boolean target_is_a (String id) {
- checkAccess( MID_TARGET_IS_A );
-
- boolean result = false ;
- if( servant instanceof Servant ) {
- result = ((Servant)servant)._is_a( id );
- } else if (StubAdapter.isStub( servant )) {
- result = ((org.omg.CORBA.Object)servant)._is_a( id );
- } else {
- throw wrapper.servantInvalid() ;
- }
-
- return result;
- }
-
- /**
- * Allows Interceptors to add service contexts to the request.
- */
- public void add_reply_service_context ( ServiceContext service_context,
- boolean replace )
- {
- // access is currently valid for all states:
- //checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT );
-
- if( currentExecutionPoint == EXECUTION_POINT_ENDING ) {
- ServiceContexts scs = replyMessage.getServiceContexts();
-
- // May be null. If this is null, create a new one in its place.
- if( scs == null ) {
- scs = new ServiceContexts( myORB );
- replyMessage.setServiceContexts( scs );
- }
-
- if( cachedReplyServiceContexts == null ) {
- cachedReplyServiceContexts = new HashMap();
- }
-
- // This is during and ending point, so we now have enough
- // information to add the reply service context.
- addServiceContext( cachedReplyServiceContexts, scs,
- service_context, replace );
- }
-
- // We enqueue all adds for the following reasons:
- //
- // If we are not in the ending point then we do not yet have a
- // pointer to the ServiceContexts object so we cannot access the
- // service contexts until we get to the ending point.
- // So we enqueue this add reply service context request.
- // It is added when we do have a handle on the service contexts object.
- //
- // If we are in the ending point and we just add directly to the
- // SC container but then an interceptor raises a SystemException
- // then that add will be lost since a new container is created
- // for the SystemException response.
- //
- // Therefore we always enqueue and never dequeue (per request) so
- // that all adds will be completed.
-
- AddReplyServiceContextCommand addReply =
- new AddReplyServiceContextCommand();
- addReply.service_context = service_context;
- addReply.replace = replace;
-
- if( addReplyServiceContextQueue == null ) {
- addReplyServiceContextQueue = new ArrayList();
- }
-
- // REVISIT: this does not add to the cache.
- enqueue( addReply );
- }
-
- // NOTE: When adding a method, be sure to:
- // 1. Add a MID_* constant for that method
- // 2. Call checkAccess at the start of the method
- // 3. Define entries in the validCall[][] table for interception points.
-
- /*
- **********************************************************************
- * Public RequestInfo interfaces
- *
- * These are implemented here because they have differing
- * implementations depending on whether this is a client or a server
- * request info object.
- **********************************************************************/
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public int request_id (){
- // access is currently valid for all states:
- //checkAccess( MID_REQUEST_ID );
- /*
- * NOTE: The request id in server interceptors is NOT the
- * same as the GIOP request id. The ORB may be servicing several
- * connections, each with possibly overlapping sets of request ids.
- * Therefore we create a request id specific to interceptors.
- */
- return serverRequestId;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public String operation (){
- // access is currently valid for all states:
- //checkAccess( MID_OPERATION );
- return request.getOperationName();
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public Parameter[] arguments (){
- checkAccess( MID_ARGUMENTS );
-
- if( cachedArguments == null ) {
- if( !isDynamic ) {
- throw stdWrapper.piOperationNotSupported1() ;
- }
-
- if( dsiArguments == null ) {
- throw stdWrapper.piOperationNotSupported8() ;
- }
-
- // If it is a DSI request then get the arguments from the DSI req
- // and convert that into parameters.
- cachedArguments = nvListToParameterArray( dsiArguments );
- }
-
- // Good citizen: In the interest of efficiency, we assume
- // interceptors will be "good citizens" in that they will not
- // modify the contents of the Parameter[] array. We also assume
- // they will not change the values of the containing Anys.
-
- return cachedArguments;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public TypeCode[] exceptions (){
- checkAccess( MID_EXCEPTIONS );
-
- // _REVISIT_ PI RTF Issue: No exception list on server side.
-
- throw stdWrapper.piOperationNotSupported2() ;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public String[] contexts (){
- checkAccess( MID_CONTEXTS );
-
- // We do not support this because our ORB does not send contexts.
-
- throw stdWrapper.piOperationNotSupported3() ;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public String[] operation_context (){
- checkAccess( MID_OPERATION_CONTEXT );
-
- // We do not support this because our ORB does not send
- // operation_context.
-
- throw stdWrapper.piOperationNotSupported4() ;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public Any result (){
- checkAccess( MID_RESULT );
-
- if( !isDynamic ) {
- throw stdWrapper.piOperationNotSupported5() ;
- }
-
- if( dsiResult == null ) {
- throw wrapper.piDsiResultIsNull() ;
- }
-
- // Good citizen: In the interest of efficiency, we assume that
- // interceptors will not modify the contents of the result Any.
- // Otherwise, we would need to create a deep copy of the Any.
-
- return dsiResult;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public boolean response_expected (){
- // access is currently valid for all states:
- //checkAccess( MID_RESPONSE_EXPECTED );
- return !request.isOneWay();
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public Object forward_reference (){
- checkAccess( MID_FORWARD_REFERENCE );
- // Check to make sure we are in LOCATION_FORWARD
- // state as per ptc/00-08-06, table 21-2
- // footnote 2.
- if( replyStatus != LOCATION_FORWARD.value ) {
- throw stdWrapper.invalidPiCall1() ;
- }
-
- return getForwardRequestException().forward;
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public org.omg.IOP.ServiceContext get_request_service_context( int id ) {
- checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );
-
- if( cachedRequestServiceContexts == null ) {
- cachedRequestServiceContexts = new HashMap();
- }
-
- return getServiceContext( cachedRequestServiceContexts,
- request.getRequestServiceContexts(), id );
- }
-
- /**
- * See ServerRequestInfo for javadocs.
- */
- public org.omg.IOP.ServiceContext get_reply_service_context( int id ) {
- checkAccess( MID_GET_REPLY_SERVICE_CONTEXT );
-
- if( cachedReplyServiceContexts == null ) {
- cachedReplyServiceContexts = new HashMap();
- }
-
- return getServiceContext( cachedReplyServiceContexts,
- replyMessage.getServiceContexts(), id );
- }
-
- /*
- **********************************************************************
- * Private-scope classes and methods
- **********************************************************************/
-
- // A command encapsulating a request to add a reply service context.
- // These commands are enqueued until we have a handle on the actual
- // reply service context, at which point they are executed.
- private class AddReplyServiceContextCommand {
- ServiceContext service_context;
- boolean replace;
- }
-
- // Adds the given add reply service context command to the queue of
- // such commands. If a command is detected to have the same id as
- // the service context in this command, and replace is false,
- // BAD_INV_ORDER is thrown. If replace is true, the original command
- // in the queue is replaced by this command.
- private void enqueue( AddReplyServiceContextCommand addReply ) {
- int size = addReplyServiceContextQueue.size();
- boolean found = false;
-
- for( int i = 0; i < size; i++ ) {
- AddReplyServiceContextCommand cmd =
- (AddReplyServiceContextCommand)
- addReplyServiceContextQueue.get( i );
-
- if( cmd.service_context.context_id ==
- addReply.service_context.context_id )
- {
- found = true;
- if( addReply.replace ) {
- addReplyServiceContextQueue.set( i, addReply );
- } else {
- throw stdWrapper.serviceContextAddFailed(
- new Integer( cmd.service_context.context_id ) ) ;
- }
- break;
- }
- }
-
- if( !found ) {
- addReplyServiceContextQueue.add( addReply );
- }
- }
-
- /*
- **********************************************************************
- * Package and protected-scope methods
- **********************************************************************/
-
- /**
- * Overridden from RequestInfoImpl. This version calls the super
- * and then, if we are changing to ending points, executes all
- * enqueued AddReplyServiceContextCommands.
- */
- protected void setCurrentExecutionPoint( int executionPoint ) {
- super.setCurrentExecutionPoint( executionPoint );
-
- // If we are transitioning to ending point, we will now have a pointer
- // to the reply service contexts, so we can execute all queued
- // add reply service context requests.
- if( (executionPoint == EXECUTION_POINT_ENDING) &&
- (addReplyServiceContextQueue != null) )
- {
- int size = addReplyServiceContextQueue.size();
- for( int i = 0; i < size; i++ ) {
- AddReplyServiceContextCommand addReply =
- (AddReplyServiceContextCommand)
- addReplyServiceContextQueue.get( i );
- try {
- add_reply_service_context( addReply.service_context,
- addReply.replace );
- }
- catch( BAD_INV_ORDER e ) {
- // _REVISIT_ The only way this can happen is if during
- // rrsc or rr, the interceptor tried to add with
- // replace=false to a service context that is present in
- // the reply message. At that time there was no way for
- // us to check for this, so the best we can do is ignore
- // the original request.
- }
- }
-
- // We specifically do not empty the SC queue so that if
- // the interceptor raises an exception the queued service contexts
- // will be put in the exception response.
- }
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setInfo( CorbaMessageMediator request, ObjectAdapter oa,
- byte[] objectId, ObjectKeyTemplate oktemp )
- {
- this.request = request;
- this.objectId = objectId;
- this.oktemp = oktemp;
- this.objectAdapter = oa ;
- this.connection = (com.sun.corba.se.spi.legacy.connection.Connection)
- request.getConnection();
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setDSIArguments( NVList arguments ) {
- this.dsiArguments = arguments;
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setDSIException( Any exception ) {
- this.dsiException = exception;
-
- // Clear cached exception value:
- cachedSendingException = null;
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setDSIResult( Any result ) {
- this.dsiResult = result;
- }
-
- /**
- * Sets the exception to be returned by received_exception and
- * received_exception_id.
- */
- protected void setException( Exception exception ) {
- super.setException( exception );
-
- // Make sure DSIException is null because this is the more recent one.
- this.dsiException = null;
-
- // Clear cached exception value:
- cachedSendingException = null;
- }
-
- /**
- * Stores the various sources of information used for this info object.
- */
- protected void setInfo( java.lang.Object servant,
- String targetMostDerivedInterface )
- {
- this.servant = servant;
- this.targetMostDerivedInterface = targetMostDerivedInterface;
- this.isDynamic =
- (servant instanceof
- org.omg.PortableServer.DynamicImplementation) ||
- (servant instanceof org.omg.CORBA.DynamicImplementation);
- }
-
- /**
- * Set reply message
- */
- void setReplyMessage( ReplyMessage replyMessage ) {
- this.replyMessage = replyMessage;
- }
-
- /**
- * Overridden from RequestInfoImpl. Calls the super class, then
- * sets the ending point call depending on the reply status.
- */
- protected void setReplyStatus( short replyStatus ) {
- super.setReplyStatus( replyStatus );
- switch( replyStatus ) {
- case SUCCESSFUL.value:
- endingPointCall = CALL_SEND_REPLY;
- break;
- case SYSTEM_EXCEPTION.value:
- case USER_EXCEPTION.value:
- endingPointCall = CALL_SEND_EXCEPTION;
- break;
- case LOCATION_FORWARD.value:
- case TRANSPORT_RETRY.value:
- endingPointCall = CALL_SEND_OTHER;
- break;
- }
- }
-
- /**
- * Release the servant object so the user has control over its lifetime.
- * Called after receive_request is finished executing.
- */
- void releaseServant() {
- this.servant = null;
- }
-
- /**
- * Sets the forwardRequestRaisedInEnding flag to true, indicating that
- * a server ending point has raised location forward at some point.
- */
- void setForwardRequestRaisedInEnding() {
- this.forwardRequestRaisedInEnding = true;
- }
-
- /**
- * Returns true if ForwardRequest was raised by a server ending point
- * or false otherwise.
- */
- boolean isForwardRequestRaisedInEnding() {
- return this.forwardRequestRaisedInEnding;
- }
-
- /**
- * Returns true if this is a dynamic invocation, or false if not
- */
- boolean isDynamic() {
- return this.isDynamic;
- }
-
- /**
- * See description for RequestInfoImpl.checkAccess
- */
- protected void checkAccess( int methodID )
- {
- // Make sure currentPoint matches the appropriate index in the
- // validCall table:
- int validCallIndex = 0;
- switch( currentExecutionPoint ) {
- case EXECUTION_POINT_STARTING:
- validCallIndex = 0;
- break;
- case EXECUTION_POINT_INTERMEDIATE:
- validCallIndex = 1;
- break;
- case EXECUTION_POINT_ENDING:
- switch( endingPointCall ) {
- case CALL_SEND_REPLY:
- validCallIndex = 2;
- break;
- case CALL_SEND_EXCEPTION:
- validCallIndex = 3;
- break;
- case CALL_SEND_OTHER:
- validCallIndex = 4;
- break;
- }
- break;
- }
-
- // Check the validCall table:
- if( !validCall[methodID][validCallIndex] ) {
- throw stdWrapper.invalidPiCall2() ;
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java 2018-01-30 20:17:21.000000000 -0500
+++ /dev/null 2018-01-30 20:17:21.000000000 -0500
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-import com.sun.corba.se.spi.orb.ORB;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-import org.omg.CORBA.Any;
-
-/**
- * SlotTable is used internally by PICurrent to store the slot information.
- */
-public class SlotTable {
- // The vector where all the slot data for the current thread is stored
- private Any[] theSlotData;
-
- // Required for instantiating Any object.
- private ORB orb;
-
- // The flag to check whether there are any updates in the current SlotTable.
- // The slots will be reset to null, only if this flag is set.
- private boolean dirtyFlag;
-
- /**
- * The constructor instantiates an Array of Any[] of size given by slotSize
- * parameter.
- */
- SlotTable( ORB orb, int slotSize ) {
- dirtyFlag = false;
- this.orb = orb;
- theSlotData = new Any[slotSize];
- }
-
- /**
- * This method sets the slot data at the given slot id (index).
- */
- public void set_slot( int id, Any data ) throws InvalidSlot
- {
- // First check whether the slot is allocated
- // If not, raise the invalid slot exception
- if( id >= theSlotData.length ) {
- throw new InvalidSlot();
- }
- dirtyFlag = true;
- theSlotData[id] = data;
- }
-
- /**
- * This method get the slot data for the given slot id (index).
- */
- public Any get_slot( int id ) throws InvalidSlot
- {
- // First check whether the slot is allocated
- // If not, raise the invalid slot exception
- if( id >= theSlotData.length ) {
- throw new InvalidSlot();
- }
- if( theSlotData[id] == null ) {
- theSlotData [id] = new AnyImpl(orb);
- }
- return theSlotData[ id ];
- }
-
-
- /**
- * This method resets all the slot data to null if dirtyFlag is set.
- */
- void resetSlots( ) {
- if( dirtyFlag == true ) {
- for( int i = 0; i < theSlotData.length; i++ ) {
- theSlotData[i] = null;
- }
- }
- }
-
- /**
- * This method returns the size of the allocated slots.
- */
- int getSize( ) {
- return theSlotData.length;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java 2018-01-30 20:17:22.000000000 -0500
+++ /dev/null 2018-01-30 20:17:22.000000000 -0500
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-
-import com.sun.corba.se.impl.logging.InterceptorsSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * SlotTableStack is the container of SlotTable instances for each thread
- */
-public class SlotTableStack
-{
- // SlotTablePool is the container for reusable SlotTables'
- private class SlotTablePool {
-
- // Contains a list of reusable SlotTable
- private SlotTable[] pool;
-
- // High water mark for the pool
- // If the pool size reaches this limit then putSlotTable will
- // not put SlotTable to the pool.
- private final int HIGH_WATER_MARK = 5;
-
- // currentIndex points to the last SlotTable in the list
- private int currentIndex;
-
- SlotTablePool( ) {
- pool = new SlotTable[HIGH_WATER_MARK];
- currentIndex = 0;
- }
-
- /**
- * Puts SlotTable to the re-usable pool.
- */
- void putSlotTable( SlotTable table ) {
- // If there are enough SlotTables in the pool, then don't add
- // this table to the pool.
- if( currentIndex >= HIGH_WATER_MARK ) {
- // Let the garbage collector collect it.
- return;
- }
- pool[currentIndex] = table;
- currentIndex++;
- }
-
- /**
- * Gets SlotTable from the re-usable pool.
- */
- SlotTable getSlotTable( ) {
- // If there are no entries in the pool then return null
- if( currentIndex == 0 ) {
- return null;
- }
- // Works like a stack, Gets the last one added first
- currentIndex--;
- return pool[currentIndex];
- }
- }
-
- // Contains all the active SlotTables for each thread.
- // The List is made to behave like a stack.
- private java.util.List tableContainer;
-
- // Keeps track of number of PICurrents in the stack.
- private int currentIndex;
-
- // For Every Thread there will be a pool of re-usable SlotTables'
- // stored in SlotTablePool
- private SlotTablePool tablePool;
-
- // The ORB associated with this slot table stack
- private ORB orb;
-
- private InterceptorsSystemException wrapper ;
-
- /**
- * Constructs the stack and and SlotTablePool
- */
- SlotTableStack( ORB orb, SlotTable table ) {
- this.orb = orb;
- wrapper = InterceptorsSystemException.get( orb, CORBALogDomains.RPC_PROTOCOL ) ;
-
- currentIndex = 0;
- tableContainer = new java.util.ArrayList( );
- tablePool = new SlotTablePool( );
- // SlotTableStack will be created with one SlotTable on the stack.
- // This table is used as the reference to query for number of
- // allocated slots to create other slottables.
- tableContainer.add( currentIndex, table );
- currentIndex++;
- }
-
-
- /**
- * pushSlotTable pushes a fresh Slot Table on to the stack by doing the
- * following,
- * 1: Checks to see if there is any SlotTable in SlotTablePool
- * If present then use that instance to push into the SlotTableStack
- *
- * 2: If there is no SlotTable in the pool, then creates a new one and
- * pushes that into the SlotTableStack
- */
- void pushSlotTable( ) {
- SlotTable table = tablePool.getSlotTable( );
- if( table == null ) {
- // get an existing PICurrent to get the slotSize
- SlotTable tableTemp = peekSlotTable();
- table = new SlotTable( orb, tableTemp.getSize( ));
- }
- // NOTE: Very important not to always "add" - otherwise a memory leak.
- if (currentIndex == tableContainer.size()) {
- // Add will cause the table to grow.
- tableContainer.add( currentIndex, table );
- } else if (currentIndex > tableContainer.size()) {
- throw wrapper.slotTableInvariant( new Integer( currentIndex ),
- new Integer( tableContainer.size() ) ) ;
- } else {
- // Set will override unused slots.
- tableContainer.set( currentIndex, table );
- }
- currentIndex++;
- }
-
- /**
- * popSlotTable does the following
- * 1: pops the top SlotTable in the SlotTableStack
- *
- * 2: resets the slots in the SlotTable which resets the slotvalues to
- * null if there are any previous sets.
- *
- * 3: puts the reset SlotTable into the SlotTablePool to reuse
- */
- void popSlotTable( ) {
- if( currentIndex <= 1 ) {
- // Do not pop the SlotTable, If there is only one.
- // This should not happen, But an extra check for safety.
- throw wrapper.cantPopOnlyPicurrent() ;
- }
- currentIndex--;
- SlotTable table = (SlotTable)tableContainer.get( currentIndex );
- tableContainer.set( currentIndex, null ); // Do not leak memory.
- table.resetSlots( );
- tablePool.putSlotTable( table );
- }
-
- /**
- * peekSlotTable gets the top SlotTable from the SlotTableStack without
- * popping.
- */
- SlotTable peekSlotTable( ) {
- return (SlotTable) tableContainer.get( currentIndex - 1);
- }
-
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java 2018-01-30 20:17:23.000000000 -0500
+++ /dev/null 2018-01-30 20:17:23.000000000 -0500
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import org.omg.CORBA.ORB;
-import java.util.Properties;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-import java.util.Hashtable;
-import java.util.Stack;
-
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.SendingContext._CodeBaseImplBase;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.org.omg.SendingContext.CodeBaseHelper;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.ORB;
-
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * This class acts as the remote interface to receivers wishing to retrieve
- * the information of a remote Class.
- */
-public class FVDCodeBaseImpl extends _CodeBaseImplBase
-{
- // Contains rep. ids as keys to FullValueDescriptions
- private static Hashtable fvds = new Hashtable();
-
- // Private ORBSingleton used when we need an ORB while not
- // having a delegate set.
- private transient ORB orb = null;
-
- private transient OMGSystemException wrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // backward compatability so that appropriate rep-id calculations
- // can take place
- // this needs to be transient to prevent serialization during
- // marshalling/unmarshalling
- private transient ValueHandlerImpl vhandler = null;
-
- void setValueHandler(ValueHandler vh)
- {
- vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- }
-
- // Operation to obtain the IR from the sending context
- public com.sun.org.omg.CORBA.Repository get_ir (){
- return null;
- }
-
- // Operations to obtain a URL to the implementation code
- public String implementation (String x){
- try{
- // default to using the current ORB version in case the
- // vhandler is not set
- if (vhandler == null) {
- vhandler = ValueHandlerImpl.getInstance(false);
- }
-
- // Util.getCodebase may return null which would
- // cause a BAD_PARAM exception.
- String result = Util.getCodebase(vhandler.getClassFromType(x));
- if (result == null)
- return "";
- else
- return result;
- } catch(ClassNotFoundException cnfe){
- throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE,
- cnfe ) ;
- }
- }
-
- public String[] implementations (String[] x){
- String result[] = new String[x.length];
-
- for (int i = 0; i < x.length; i++)
- result[i] = implementation(x[i]);
-
- return result;
- }
-
- // the same information
- public FullValueDescription meta (String x){
- try{
- FullValueDescription result = (FullValueDescription)fvds.get(x);
-
- if (result == null) {
- // default to using the current ORB version in case the
- // vhandler is not set
- if (vhandler == null) {
- vhandler = ValueHandlerImpl.getInstance(false);
- }
-
- try{
- result = ValueUtility.translate(_orb(),
- ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler);
- } catch(Throwable t){
- if (orb == null)
- orb = ORB.init(); //d11638
- result = ValueUtility.translate(orb,
- ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler);
- }
-
- if (result != null){
- fvds.put(x, result);
- } else {
- throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE);
- }
- }
-
- return result;
- } catch(Throwable t){
- throw wrapper.incompatibleValueImpl(CompletionStatus.COMPLETED_MAYBE,t);
- }
- }
-
- public FullValueDescription[] metas (String[] x){
- FullValueDescription descriptions[] = new FullValueDescription[x.length];
-
- for (int i = 0; i < x.length; i++)
- descriptions[i] = meta(x[i]);
-
- return descriptions;
- }
-
- // information
- public String[] bases (String x){
- try {
- // default to using the current ORB version in case the
- // vhandler is not set
- if (vhandler == null) {
- vhandler = ValueHandlerImpl.getInstance(false);
- }
-
- Stack repIds = new Stack();
- Class parent = ObjectStreamClass.lookup(vhandler.getClassFromType(x)).forClass().getSuperclass();
-
- while (!parent.equals(java.lang.Object.class)) {
- repIds.push(vhandler.createForAnyType(parent));
- parent = parent.getSuperclass();
- }
-
- String result[] = new String[repIds.size()];
- for (int i = result.length - 1; i >= 0; i++)
- result[i] = (String)repIds.pop();
-
- return result;
- } catch (Throwable t) {
- throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE, t );
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java 2018-01-30 20:17:24.000000000 -0500
+++ /dev/null 2018-01-30 20:17:24.000000000 -0500
@@ -1,2810 +0,0 @@
-/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.ObjectInputValidation;
-import java.io.NotActiveException;
-import java.io.InvalidObjectException;
-import java.io.InvalidClassException;
-import java.io.OptionalDataException;
-import java.io.Externalizable;
-import java.io.EOFException;
-import java.lang.reflect.*;
-import java.util.Vector;
-import java.util.Enumeration;
-
-import sun.corba.Bridge ;
-
-import java.security.AccessController ;
-import java.security.PrivilegedAction ;
-
-import com.sun.corba.se.impl.util.Utility;
-
-import org.omg.CORBA.portable.ValueInputStream;
-
-import org.omg.CORBA.ValueMember;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.portable.IndirectionException;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.TypeCode;
-
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-
-import java.security.*;
-import java.util.*;
-
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-import com.sun.corba.se.impl.logging.UtilSystemException ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-/**
- * IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization
- * input semantics.
- *
- * @author Stephen Lewallen
- * @since JDK1.1.6
- */
-
-public class IIOPInputStream
- extends com.sun.corba.se.impl.io.InputStreamHook
-{
- private static Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- private static OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
- private static UtilSystemException utilWrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // Necessary to pass the appropriate fields into the
- // defaultReadObjectDelegate method (which takes no
- // parameters since it's called from
- // java.io.ObjectInpuStream defaultReadObject()
- // which we can't change).
- //
- // This is only used in the case where the fields had
- // to be obtained remotely because of a serializable
- // version difference. Set in inputObjectUsingFVD.
- // Part of serialization evolution fixes for Ladybird,
- // bug 4365188.
- private ValueMember defaultReadObjectFVDMembers[] = null;
-
- private org.omg.CORBA_2_3.portable.InputStream orbStream;
-
- private CodeBase cbSender;
-
- private ValueHandlerImpl vhandler; //d4365188
-
- private Object currentObject = null;
-
- private ObjectStreamClass currentClassDesc = null;
-
- private Class currentClass = null;
-
- private int recursionDepth = 0;
-
- private int simpleReadDepth = 0;
-
- // The ActiveRecursionManager replaces the old RecursionManager which
- // used to record how many recursions were made, and resolve them after
- // an object was completely deserialized.
- //
- // That created problems (as in bug 4414154) because when custom
- // unmarshaling in readObject, there can be recursive references
- // to one of the objects currently being unmarshaled, and the
- // passive recursion system failed.
- ActiveRecursionManager activeRecursionMgr = new ActiveRecursionManager();
-
- private IOException abortIOException = null;
-
- /* Remember the first exception that stopped this stream. */
- private ClassNotFoundException abortClassNotFoundException = null;
-
- /* Vector of validation callback objects
- * The vector is created as needed. The vector is maintained in
- * order of highest (first) priority to lowest
- */
- private Vector callbacks;
-
- // Serialization machinery fields
- /* Arrays used to keep track of classes and ObjectStreamClasses
- * as they are being merged; used in inputObject.
- * spClass is the stack pointer for both. */
- ObjectStreamClass[] classdesc;
- Class[] classes;
- int spClass;
-
- private static final String kEmptyStr = "";
-
- // TCKind TypeCodes used in FVD inputClassFields
- //public static final TypeCode kRemoteTypeCode = new TypeCodeImpl(TCKind._tk_objref);
- //public static final TypeCode kValueTypeCode = new TypeCodeImpl(TCKind._tk_value);
- // removed TypeCodeImpl dependency
- public static final TypeCode kRemoteTypeCode = ORB.init().get_primitive_tc(TCKind.tk_objref);
- public static final TypeCode kValueTypeCode = ORB.init().get_primitive_tc(TCKind.tk_value);
-
- // TESTING CODE - useFVDOnly should be made final before FCS in order to
- // optimize out the check.
- private static final boolean useFVDOnly = false;
-
- private byte streamFormatVersion;
-
- // Return the stream format version currently being used
- // to deserialize an object
- protected byte getStreamFormatVersion() {
- return streamFormatVersion;
- }
-
- // At the beginning of data sent by a writeObject or
- // writeExternal method there is a byte telling the
- // reader the stream format version.
- private void readFormatVersion() throws IOException {
-
- streamFormatVersion = orbStream.read_octet();
-
- if (streamFormatVersion < 1 ||
- streamFormatVersion > vhandler.getMaximumStreamFormatVersion()) {
- SystemException sysex = omgWrapper.unsupportedFormatVersion(
- CompletionStatus.COMPLETED_MAYBE);
- // XXX I18N? Logging for IOException?
- IOException result = new IOException("Unsupported format version: "
- + streamFormatVersion);
- result.initCause( sysex ) ;
- throw result ;
- }
-
- if (streamFormatVersion == 2) {
- if (!(orbStream instanceof ValueInputStream)) {
- SystemException sysex = omgWrapper.notAValueinputstream(
- CompletionStatus.COMPLETED_MAYBE);
- // XXX I18N? Logging for IOException?
- IOException result = new IOException("Not a ValueInputStream");
- result.initCause( sysex ) ;
- throw result;
- }
- }
- }
-
- public static void setTestFVDFlag(boolean val){
- // useFVDOnly = val;
- }
-
- /**
- * Dummy constructor; passes upper stream a dummy stream;
- **/
- public IIOPInputStream()
- throws java.io.IOException {
- super();
- resetStream();
- }
-
- final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
- orbStream = os;
- }
-
- final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
- return orbStream;
- }
-
- //added setSender and getSender
- public final void setSender(CodeBase cb) {
- cbSender = cb;
- }
-
- public final CodeBase getSender() {
- return cbSender;
- }
-
- // 4365188 this is added to enable backward compatability w/ wrong
- // rep-ids
- public final void setValueHandler(ValueHandler vh) {
- vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- }
-
- public final ValueHandler getValueHandler() {
- return (javax.rmi.CORBA.ValueHandler) vhandler;
- }
-
- final void increaseRecursionDepth(){
- recursionDepth++;
- }
-
- final int decreaseRecursionDepth(){
- return --recursionDepth;
- }
-
- /**
- * Override the actions of the final method "readObject()"
- * in ObjectInputStream.
- * @since JDK1.1.6
- *
- * Read an object from the ObjectInputStream.
- * The class of the object, the signature of the class, and the values
- * of the non-transient and non-static fields of the class and all
- * of its supertypes are read. Default deserializing for a class can be
- * overriden using the writeObject and readObject methods.
- * Objects referenced by this object are read transitively so
- * that a complete equivalent graph of objects is reconstructed by readObject.
- *
- * The root object is completly restored when all of its fields
- * and the objects it references are completely restored. At this
- * point the object validation callbacks are executed in order
- * based on their registered priorities. The callbacks are
- * registered by objects (in the readObject special methods)
- * as they are individually restored.
- *
- * Exceptions are thrown for problems with the InputStream and for classes
- * that should not be deserialized. All exceptions are fatal to the
- * InputStream and leave it in an indeterminate state; it is up to the caller
- * to ignore or recover the stream state.
- * @exception java.lang.ClassNotFoundException Class of a serialized object
- * cannot be found.
- * @exception InvalidClassException Something is wrong with a class used by
- * serialization.
- * @exception StreamCorruptedException Control information in the
- * stream is inconsistent.
- * @exception OptionalDataException Primitive data was found in the
- * stream instead of objects.
- * @exception IOException Any of the usual Input/Output related exceptions.
- * @since JDK1.1
- */
- public final synchronized Object readObjectDelegate() throws IOException
- {
- try {
-
- readObjectState.readData(this);
-
- return orbStream.read_abstract_interface();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, true);
- throw marshalException;
- } catch(IndirectionException cdrie)
- {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- return activeRecursionMgr.getObject(cdrie.offset);
- }
- }
-
- final synchronized Object simpleReadObject(Class clz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- /* throws OptionalDataException, ClassNotFoundException, IOException */
- {
- /* Save the current state and get ready to read an object. */
- Object prevObject = currentObject;
- ObjectStreamClass prevClassDesc = currentClassDesc;
- Class prevClass = currentClass;
- byte oldStreamFormatVersion = streamFormatVersion;
-
- simpleReadDepth++; // Entering
- Object obj = null;
-
- /*
- * Check for reset, handle it before reading an object.
- */
- try {
- // d4365188: backward compatability
- if (vhandler.useFullValueDescription(clz, repositoryID)) {
- obj = inputObjectUsingFVD(clz, repositoryID, sender, offset);
- } else {
- obj = inputObject(clz, repositoryID, sender, offset);
- }
-
- obj = currentClassDesc.readResolve(obj);
- }
- catch(ClassNotFoundException cnfe)
- {
- bridge.throwException( cnfe ) ;
- return null;
- }
- catch(IOException ioe)
- {
- // System.out.println("CLZ = " + clz + "; " + ioe.toString());
- bridge.throwException(ioe) ;
- return null;
- }
- finally {
- simpleReadDepth --;
- currentObject = prevObject;
- currentClassDesc = prevClassDesc;
- currentClass = prevClass;
- streamFormatVersion = oldStreamFormatVersion;
- }
-
-
- /* Check for thrown exceptions and re-throw them, clearing them if
- * this is the last recursive call .
- */
- IOException exIOE = abortIOException;
- if (simpleReadDepth == 0)
- abortIOException = null;
- if (exIOE != null){
- bridge.throwException( exIOE ) ;
- return null;
- }
-
-
- ClassNotFoundException exCNF = abortClassNotFoundException;
- if (simpleReadDepth == 0)
- abortClassNotFoundException = null;
- if (exCNF != null) {
- bridge.throwException( exCNF ) ;
- return null;
- }
-
- return obj;
- }
-
- public final synchronized void simpleSkipObject(String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender)
- /* throws OptionalDataException, ClassNotFoundException, IOException */
- {
-
- /* Save the current state and get ready to read an object. */
- Object prevObject = currentObject;
- ObjectStreamClass prevClassDesc = currentClassDesc;
- Class prevClass = currentClass;
- byte oldStreamFormatVersion = streamFormatVersion;
-
- simpleReadDepth++; // Entering
- Object obj = null;
-
- /*
- * Check for reset, handle it before reading an object.
- */
- try {
- skipObjectUsingFVD(repositoryID, sender);
- }
- catch(ClassNotFoundException cnfe)
- {
- bridge.throwException( cnfe ) ;
- return;
- }
- catch(IOException ioe)
- {
- bridge.throwException( ioe ) ;
- return;
- }
- finally {
- simpleReadDepth --;
- streamFormatVersion = oldStreamFormatVersion;
- currentObject = prevObject;
- currentClassDesc = prevClassDesc;
- currentClass = prevClass;
- }
-
-
- /* Check for thrown exceptions and re-throw them, clearing them if
- * this is the last recursive call .
- */
- IOException exIOE = abortIOException;
- if (simpleReadDepth == 0)
- abortIOException = null;
- if (exIOE != null){
- bridge.throwException( exIOE ) ;
- return;
- }
-
-
- ClassNotFoundException exCNF = abortClassNotFoundException;
- if (simpleReadDepth == 0)
- abortClassNotFoundException = null;
- if (exCNF != null) {
- bridge.throwException( exCNF ) ;
- return;
- }
-
- return;
- }
- /////////////////
-
- /**
- * This method is called by trusted subclasses of ObjectOutputStream
- * that constructed ObjectOutputStream using the
- * protected no-arg constructor. The subclass is expected to provide
- * an override method with the modifier "final".
- *
- * @return the Object read from the stream.
- *
- * @see #ObjectInputStream()
- * @see #readObject
- * @since JDK 1.2
- */
- protected final Object readObjectOverride()
- throws OptionalDataException, ClassNotFoundException, IOException
- {
- return readObjectDelegate();
- }
-
- /**
- * Override the actions of the final method "defaultReadObject()"
- * in ObjectInputStream.
- * @since JDK1.1.6
- *
- * Read the non-static and non-transient fields of the current class
- * from this stream. This may only be called from the readObject method
- * of the class being deserialized. It will throw the NotActiveException
- * if it is called otherwise.
- *
- * @exception java.lang.ClassNotFoundException if the class of a serialized
- * object could not be found.
- * @exception IOException if an I/O error occurs.
- * @exception NotActiveException if the stream is not currently reading
- * objects.
- * @since JDK1.1
- */
- final synchronized void defaultReadObjectDelegate()
- /* throws IOException, ClassNotFoundException, NotActiveException */
- {
- try {
- if (currentObject == null || currentClassDesc == null)
- // XXX I18N, logging needed.
- throw new NotActiveException("defaultReadObjectDelegate");
-
- if (!currentClassDesc.forClass().isAssignableFrom(
- currentObject.getClass())) {
- throw new IOException("Object Type mismatch");
- }
-
- // The array will be null unless fields were retrieved
- // remotely because of a serializable version difference.
- // Bug fix for 4365188. See the definition of
- // defaultReadObjectFVDMembers for more information.
- if (defaultReadObjectFVDMembers != null &&
- defaultReadObjectFVDMembers.length > 0) {
-
- // WARNING: Be very careful! What if some of
- // these fields actually have to do this, too?
- // This works because the defaultReadObjectFVDMembers
- // reference is passed to inputClassFields, but
- // there is no guarantee that
- // defaultReadObjectFVDMembers will point to the
- // same array after calling inputClassFields.
-
- // Use the remote fields to unmarshal.
- inputClassFields(currentObject,
- currentClass,
- currentClassDesc,
- defaultReadObjectFVDMembers,
- cbSender);
-
- } else {
-
- // Use the local fields to unmarshal.
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- inputClassFields(currentObject, currentClass, fields, cbSender);
- }
- }
- }
- catch(NotActiveException nae)
- {
- bridge.throwException( nae ) ;
- }
- catch(IOException ioe)
- {
- bridge.throwException( ioe ) ;
- }
- catch(ClassNotFoundException cnfe)
- {
- bridge.throwException( cnfe ) ;
- }
-
- }
-
- /**
- * Override the actions of the final method "enableResolveObject()"
- * in ObjectInputStream.
- * @since JDK1.1.6
- *
- * Enable the stream to allow objects read from the stream to be replaced.
- * If the stream is a trusted class it is allowed to enable replacment.
- * Trusted classes are those classes with a classLoader equals null.
- *
- * When enabled the resolveObject method is called for every object
- * being deserialized.
- *
- * @exception SecurityException The classloader of this stream object is non-null.
- * @since JDK1.1
- */
- public final boolean enableResolveObjectDelegate(boolean enable)
- /* throws SecurityException */
- {
- return false;
- }
-
- // The following three methods allow the implementing orbStream
- // to provide mark/reset behavior as defined in java.io.InputStream.
-
- public final void mark(int readAheadLimit) {
- orbStream.mark(readAheadLimit);
- }
-
- public final boolean markSupported() {
- return orbStream.markSupported();
- }
-
- public final void reset() throws IOException {
- try {
- orbStream.reset();
- } catch (Error e) {
- IOException err = new IOException(e.getMessage());
- err.initCause(e) ;
- throw err ;
- }
- }
-
- public final int available() throws IOException{
- return 0; // unreliable
- }
-
- public final void close() throws IOException{
- // no op
- }
-
- public final int read() throws IOException{
- try{
- readObjectState.readData(this);
-
- return (orbStream.read_octet() << 0) & 0x000000FF;
- } catch (MARSHAL marshalException) {
- if (marshalException.minor
- == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
- setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
- return -1;
- }
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e) ;
- throw exc ;
- }
- }
-
- public final int read(byte data[], int offset, int length) throws IOException{
- try{
- readObjectState.readData(this);
-
- orbStream.read_octet_array(data, offset, length);
- return length;
- } catch (MARSHAL marshalException) {
- if (marshalException.minor
- == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
- setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
- return -1;
- }
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e) ;
- throw exc ;
- }
-
- }
-
- public final boolean readBoolean() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_boolean();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
-
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final byte readByte() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_octet();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
-
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final char readChar() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_wchar();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
-
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final double readDouble() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_double();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final float readFloat() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_float();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final void readFully(byte data[]) throws IOException{
-// d11623 : implement readFully, required for serializing some core classes
-
- readFully(data, 0, data.length);
- }
-
- public final void readFully(byte data[], int offset, int size) throws IOException{
-// d11623 : implement readFully, required for serializing some core classes
- try{
- readObjectState.readData(this);
-
- orbStream.read_octet_array(data, offset, size);
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final int readInt() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_long();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final String readLine() throws IOException{
- // XXX I18N, logging needed.
- throw new IOException("Method readLine not supported");
- }
-
- public final long readLong() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_longlong();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final short readShort() throws IOException{
- try{
- readObjectState.readData(this);
-
- return orbStream.read_short();
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- protected final void readStreamHeader() throws IOException, StreamCorruptedException{
- // no op
- }
-
- public final int readUnsignedByte() throws IOException{
- try{
- readObjectState.readData(this);
-
- return (orbStream.read_octet() << 0) & 0x000000FF;
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- public final int readUnsignedShort() throws IOException{
- try{
- readObjectState.readData(this);
-
- return (orbStream.read_ushort() << 0) & 0x0000FFFF;
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- /**
- * Helper method for correcting the Kestrel bug 4367783 (dealing
- * with larger than 8-bit chars). The old behavior is preserved
- * in orbutil.IIOPInputStream_1_3 in order to interoperate with
- * our legacy ORBs.
- */
- protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream)
- {
- return stream.read_wstring();
- }
-
- public final String readUTF() throws IOException{
- try{
- readObjectState.readData(this);
-
- return internalReadUTF(orbStream);
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e);
- throw exc ;
- }
- }
-
- // If the ORB stream detects an incompatibility between what's
- // on the wire and what our Serializable's readObject wants,
- // it throws a MARSHAL exception with a specific minor code.
- // This is rethrown to the readObject as an OptionalDataException.
- // So far in RMI-IIOP, this process isn't specific enough to
- // tell the readObject how much data is available, so we always
- // set the OptionalDataException's EOF marker to true.
- private void handleOptionalDataMarshalException(MARSHAL marshalException,
- boolean objectRead)
- throws IOException {
-
- // Java Object Serialization spec 3.4: "If the readObject method
- // of the class attempts to read more data than is present in the
- // optional part of the stream for this class, the stream will
- // return -1 for bytewise reads, throw an EOFException for
- // primitive data reads, or throw an OptionalDataException
- // with the eof field set to true for object reads."
- if (marshalException.minor
- == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
-
- IOException result;
-
- if (!objectRead)
- result = new EOFException("No more optional data");
- else
- result = bridge.newOptionalDataExceptionForSerialization(true);
-
- result.initCause(marshalException);
-
- setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
-
- throw result;
- }
- }
-
- public final synchronized void registerValidation(ObjectInputValidation obj,
- int prio)
- throws NotActiveException, InvalidObjectException{
- // XXX I18N, logging needed.
- throw new Error("Method registerValidation not supported");
- }
-
- protected final Class resolveClass(ObjectStreamClass v)
- throws IOException, ClassNotFoundException{
- // XXX I18N, logging needed.
- throw new IOException("Method resolveClass not supported");
- }
-
- protected final Object resolveObject(Object obj) throws IOException{
- // XXX I18N, logging needed.
- throw new IOException("Method resolveObject not supported");
- }
-
- public final int skipBytes(int len) throws IOException{
- try{
- readObjectState.readData(this);
-
- byte buf[] = new byte[len];
- orbStream.read_octet_array(buf, 0, len);
- return len;
- } catch (MARSHAL marshalException) {
- handleOptionalDataMarshalException(marshalException, false);
-
- throw marshalException;
- } catch(Error e) {
- IOException exc = new IOException(e.getMessage());
- exc.initCause(e) ;
- throw exc ;
- }
- }
-
- private synchronized Object inputObject(Class clz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- throws IOException, ClassNotFoundException
- {
-
- /*
- * Get the descriptor and then class of the incoming object.
- */
-
- currentClassDesc = ObjectStreamClass.lookup(clz);
- currentClass = currentClassDesc.forClass();
- //currentClassDesc.setClass(currentClass);
- if (currentClass == null)
- // XXX I18N, logging needed.
- throw new ClassNotFoundException(currentClassDesc.getName());
-
- try {
- /* If Externalizable,
- * Create an instance and tell it to read its data.
- * else,
- * Handle it as a serializable class.
- */
- if (Enum.class.isAssignableFrom( clz )) {
- int ordinal = orbStream.read_long() ;
- String value = (String)orbStream.read_value( String.class ) ;
- return Enum.valueOf( clz, value ) ;
- } else if (currentClassDesc.isExternalizable()) {
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance();
- if (currentObject != null) {
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
-
- // Read format version
- readFormatVersion();
-
- Externalizable ext = (Externalizable)currentObject;
- ext.readExternal(this);
- }
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
- } // end : if (currentClassDesc.isExternalizable())
- else {
- /* Count number of classes and descriptors we might have
- * to work on.
- */
-
- ObjectStreamClass currdesc = currentClassDesc;
- Class currclass = currentClass;
-
- int spBase = spClass; // current top of stack
-
- if (currentClass.getName().equals("java.lang.String")) {
- return this.readUTF();
- }
- /* The object's classes should be processed from supertype to subtype
- * Push all the clases of the current object onto a stack.
- * Note that only the serializable classes are represented
- * in the descriptor list.
- *
- * Handle versioning where one or more supertypes of
- * have been inserted or removed. The stack will
- * contain pairs of descriptors and the corresponding
- * class. If the object has a class that did not occur in
- * the original the descriptor will be null. If the
- * original object had a descriptor for a class not
- * present in the local hierarchy of the object the class will be
- * null.
- *
- */
-
- /*
- * This is your basic diff pattern, made simpler
- * because reordering is not allowed.
- */
- // sun.4296963 ibm.11861
- // d11861 we should stop when we find the highest serializable class
- // We need this so that when we allocate the new object below, we
- // can call the constructor of the non-serializable superclass.
- // Note that in the JRMP variant of this code the
- // ObjectStreamClass.lookup() method handles this, but we've put
- // this fix here rather than change lookup because the new behaviour
- // is needed in other cases.
-
- for (currdesc = currentClassDesc, currclass = currentClass;
- currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/
- currdesc = currdesc.getSuperclass()) {
-
- /*
- * Search the classes to see if the class of this
- * descriptor appears further up the hierarchy. Until
- * it's found assume its an inserted class. If it's
- * not found, its the descriptor's class that has been
- * removed.
- */
- Class cc = currdesc.forClass();
- Class cl;
- for (cl = currclass; cl != null; cl = cl.getSuperclass()) {
- if (cc == cl) {
- // found a superclass that matches this descriptor
- break;
- } else {
- /* Ignore a class that doesn't match. No
- * action is needed since it is already
- * initialized.
- */
- }
- } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass())
- /* Test if there is room for this new entry.
- * If not, double the size of the arrays and copy the contents.
- */
- spClass++;
- if (spClass >= classes.length) {
- int newlen = classes.length * 2;
- Class[] newclasses = new Class[newlen];
- ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen];
-
- System.arraycopy(classes, 0,
- newclasses, 0,
- classes.length);
- System.arraycopy(classdesc, 0,
- newclassdesc, 0,
- classes.length);
-
- classes = newclasses;
- classdesc = newclassdesc;
- }
-
- if (cl == null) {
- /* Class not found corresponding to this descriptor.
- * Pop off all the extra classes pushed.
- * Push the descriptor and a null class.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = null;
- } else {
- /* Current class descriptor matches current class.
- * Some classes may have been inserted.
- * Record the match and advance the class, continue
- * with the next descriptor.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = cl;
- currclass = cl.getSuperclass();
- }
- } // end : for (currdesc = currentClassDesc, currclass = currentClass;
-
- /* Allocate a new object. The object is only constructed
- * above the highest serializable class and is set to
- * default values for all more specialized classes.
- */
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance() ;
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
-
- /*
- * For all the pushed descriptors and classes.
- * if the class has its own writeObject and readObject methods
- * call the readObject method
- * else
- * invoke the defaultReadObject method
- */
- try {
- for (spClass = spClass; spClass > spBase; spClass--) {
- /*
- * Set current descriptor and corresponding class
- */
- currentClassDesc = classdesc[spClass];
- currentClass = classes[spClass];
- if (classes[spClass] != null) {
- /* Read the data from the stream described by the
- * descriptor and store into the matching class.
- */
-
- ReadObjectState oldState = readObjectState;
- setState(DEFAULT_STATE);
-
- try {
-
- // Changed since invokeObjectReader no longer does this.
- if (currentClassDesc.hasWriteObject()) {
-
- // Read format version
- readFormatVersion();
-
- // Read defaultWriteObject indicator
- boolean calledDefaultWriteObject = readBoolean();
-
- readObjectState.beginUnmarshalCustomValue(this,
- calledDefaultWriteObject,
- currentClassDesc.hasReadObject());
- } else {
- if (currentClassDesc.hasReadObject())
- setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
- }
-
- if (!invokeObjectReader(currentClassDesc, currentObject, currentClass) ||
- readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) {
-
- // Error case of no readObject and didn't call
- // defaultWriteObject handled in default state
-
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- inputClassFields(currentObject, currentClass, fields, sender);
- }
- }
-
- if (currentClassDesc.hasWriteObject())
- readObjectState.endUnmarshalCustomValue(this);
-
- } finally {
- setState(oldState);
- }
-
- } else {
-
- // _REVISIT_ : Can we ever get here?
- /* No local class for this descriptor,
- * Skip over the data for this class.
- * like defaultReadObject with a null currentObject.
- * The code will read the values but discard them.
- */
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- inputClassFields(null, currentClass, fields, sender);
- }
-
- }
-
- }
- } finally {
- // Make sure we exit at the same stack level as when we started.
- spClass = spBase;
- }
- }
- } finally {
- // We've completed deserializing this object. Any
- // future indirections will be handled correctly at the
- // CDR level. The ActiveRecursionManager only deals with
- // objects currently being deserialized.
- activeRecursionMgr.removeObject(offset);
- }
-
- return currentObject;
- }
-
- // This retrieves a vector of FVD's for the hierarchy of serializable classes stemming from
- // repositoryID. It is assumed that the sender will not provide base_value id's for non-serializable
- // classes!
- private Vector getOrderedDescriptions(String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender) {
- Vector descs = new Vector();
-
- if (sender == null) {
- return descs;
- }
-
- FullValueDescription aFVD = sender.meta(repositoryID);
- while (aFVD != null) {
- descs.insertElementAt(aFVD, 0);
- if ((aFVD.base_value != null) && !kEmptyStr.equals(aFVD.base_value)) {
- aFVD = sender.meta(aFVD.base_value);
- }
- else return descs;
- }
-
- return descs;
- }
-
- /**
- * This input method uses FullValueDescriptions retrieved from the sender's runtime to
- * read in the data. This method is capable of throwing out data not applicable to client's fields.
- * This method handles instances where the reader has a class not sent by the sender, the sender sent
- * a class not present on the reader, and/or the reader's class does not match the sender's class.
- *
- * NOTE : If the local description indicates custom marshaling and the remote type's FVD also
- * indicates custom marsahling than the local type is used to read the data off the wire. However,
- * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is
- * a form of custom marshaling.
- *
- */
- private synchronized Object inputObjectUsingFVD(Class clz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- throws IOException, ClassNotFoundException
- {
- int spBase = spClass; // current top of stack
- try{
-
- /*
- * Get the descriptor and then class of the incoming object.
- */
-
- ObjectStreamClass currdesc = currentClassDesc = ObjectStreamClass.lookup(clz);
- Class currclass = currentClass = clz;
-
- /* If Externalizable,
- * Create an instance and tell it to read its data.
- * else,
- * Handle it as a serializable class.
- */
- if (currentClassDesc.isExternalizable()) {
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance();
- if (currentObject != null) {
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
-
- // Read format version
- readFormatVersion();
-
- Externalizable ext = (Externalizable)currentObject;
- ext.readExternal(this);
- }
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
- } else {
- /*
- * This is your basic diff pattern, made simpler
- * because reordering is not allowed.
- */
- for (currdesc = currentClassDesc, currclass = currentClass;
- currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/
-
- currdesc = currdesc.getSuperclass()) {
-
- /*
- * Search the classes to see if the class of this
- * descriptor appears further up the hierarchy. Until
- * it's found assume its an inserted class. If it's
- * not found, its the descriptor's class that has been
- * removed.
- */
- Class cc = currdesc.forClass();
- Class cl;
- for (cl = currclass; cl != null; cl = cl.getSuperclass()) {
- if (cc == cl) {
- // found a superclass that matches this descriptor
- break;
- } else {
- /* Ignore a class that doesn't match. No
- * action is needed since it is already
- * initialized.
- */
- }
- } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass())
- /* Test if there is room for this new entry.
- * If not, double the size of the arrays and copy the contents.
- */
- spClass++;
- if (spClass >= classes.length) {
- int newlen = classes.length * 2;
- Class[] newclasses = new Class[newlen];
- ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen];
-
- System.arraycopy(classes, 0,
- newclasses, 0,
- classes.length);
- System.arraycopy(classdesc, 0,
- newclassdesc, 0,
- classes.length);
-
- classes = newclasses;
- classdesc = newclassdesc;
- }
-
- if (cl == null) {
- /* Class not found corresponding to this descriptor.
- * Pop off all the extra classes pushed.
- * Push the descriptor and a null class.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = null;
- } else {
- /* Current class descriptor matches current class.
- * Some classes may have been inserted.
- * Record the match and advance the class, continue
- * with the next descriptor.
- */
- classdesc[spClass] = currdesc;
- classes[spClass] = cl;
- currclass = cl.getSuperclass();
- }
- } // end : for (currdesc = currentClassDesc, currclass = currentClass;
-
- /* Allocate a new object.
- */
- try {
- currentObject = (currentClass == null) ?
- null : currentClassDesc.newInstance();
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- activeRecursionMgr.addObject(offset, currentObject);
- } catch (InvocationTargetException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InvocationTargetException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (UnsupportedOperationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "UnsupportedOperationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- } catch (InstantiationException e) {
- InvalidClassException exc = new InvalidClassException(
- currentClass.getName(),
- "InstantiationException accessing no-arg constructor");
- exc.initCause( e ) ;
- throw exc ;
- }
-
- Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
-
- while((fvdsList.hasMoreElements()) && (spClass > spBase)) {
- FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
- // d4365188: backward compatability
- String repIDForFVD = vhandler.getClassName(fvd.id);
- String repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
-
- while ((spClass > spBase) &&
- (!repIDForFVD.equals(repIDForClass))) {
- int pos = findNextClass(repIDForFVD, classes, spClass, spBase);
- if (pos != -1) {
- spClass = pos;
- currclass = currentClass = classes[spClass];
- repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
- }
- else { // Read and throw away one level of the fvdslist
-
- // This seems to mean that the sender had a superclass that
- // we don't have
-
- if (fvd.is_custom) {
-
- readFormatVersion();
- boolean calledDefaultWriteObject = readBoolean();
-
- if (calledDefaultWriteObject)
- inputClassFields(null, null, null, fvd.members, sender);
-
- if (getStreamFormatVersion() == 2) {
-
- ((ValueInputStream)getOrbStream()).start_value();
- ((ValueInputStream)getOrbStream()).end_value();
- }
-
- // WARNING: If stream format version is 1 and there's
- // optional data, we'll get some form of exception down
- // the line or data corruption.
-
- } else {
-
- inputClassFields(null, currentClass, null, fvd.members, sender);
- }
-
- if (fvdsList.hasMoreElements()){
- fvd = (FullValueDescription)fvdsList.nextElement();
- repIDForFVD = vhandler.getClassName(fvd.id);
- }
- else return currentObject;
- }
- }
-
- currdesc = currentClassDesc = ObjectStreamClass.lookup(currentClass);
-
- if (!repIDForClass.equals("java.lang.Object")) {
-
- // If the sender used custom marshaling, then it should have put
- // the two bytes on the wire indicating stream format version
- // and whether or not the writeObject method called
- // defaultWriteObject/writeFields.
-
- ReadObjectState oldState = readObjectState;
- setState(DEFAULT_STATE);
-
- try {
-
- if (fvd.is_custom) {
-
- // Read format version
- readFormatVersion();
-
- // Read defaultWriteObject indicator
- boolean calledDefaultWriteObject = readBoolean();
-
- readObjectState.beginUnmarshalCustomValue(this,
- calledDefaultWriteObject,
- currentClassDesc.hasReadObject());
- }
-
- boolean usedReadObject = false;
-
- // Always use readObject if it exists, and fall back to default
- // unmarshaling if it doesn't.
- try {
-
- if (!fvd.is_custom && currentClassDesc.hasReadObject())
- setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
-
- // See the definition of defaultReadObjectFVDMembers
- // for more information. This concerns making sure
- // we use the remote FVD's members in defaultReadObject.
- defaultReadObjectFVDMembers = fvd.members;
- usedReadObject = invokeObjectReader(currentClassDesc,
- currentObject,
- currentClass);
-
- } finally {
- defaultReadObjectFVDMembers = null;
- }
-
- // Note that the !usedReadObject !calledDefaultWriteObject
- // case is handled by the beginUnmarshalCustomValue method
- // of the default state
- if (!usedReadObject || readObjectState == IN_READ_OBJECT_DEFAULTS_SENT)
- inputClassFields(currentObject, currentClass, currdesc, fvd.members, sender);
-
- if (fvd.is_custom)
- readObjectState.endUnmarshalCustomValue(this);
-
- } finally {
- setState(oldState);
- }
-
- currclass = currentClass = classes[--spClass];
-
- } else {
-
- // The remaining hierarchy of the local class does not match the sender's FVD.
- // So, use remaining FVDs to read data off wire. If any remaining FVDs indicate
- // custom marshaling, throw MARSHAL error.
- inputClassFields(null, currentClass, null, fvd.members, sender);
-
- while (fvdsList.hasMoreElements()){
- fvd = (FullValueDescription)fvdsList.nextElement();
-
- if (fvd.is_custom)
- skipCustomUsingFVD(fvd.members, sender);
- else
- inputClassFields(null, currentClass, null, fvd.members, sender);
- }
-
- }
-
- } // end : while(fvdsList.hasMoreElements())
- while (fvdsList.hasMoreElements()){
-
- FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
- if (fvd.is_custom)
- skipCustomUsingFVD(fvd.members, sender);
- else
- throwAwayData(fvd.members, sender);
- }
- }
-
- return currentObject;
- }
- finally {
- // Make sure we exit at the same stack level as when we started.
- spClass = spBase;
-
- // We've completed deserializing this object. Any
- // future indirections will be handled correctly at the
- // CDR level. The ActiveRecursionManager only deals with
- // objects currently being deserialized.
- activeRecursionMgr.removeObject(offset);
- }
-
- }
-
- /**
- * This input method uses FullValueDescriptions retrieved from the sender's runtime to
- * read in the data. This method is capable of throwing out data not applicable to client's fields.
- *
- * NOTE : If the local description indicates custom marshaling and the remote type's FVD also
- * indicates custom marsahling than the local type is used to read the data off the wire. However,
- * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is
- * a form of custom marshaling.
- *
- */
- private Object skipObjectUsingFVD(String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws IOException, ClassNotFoundException
- {
-
- Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
-
- while(fvdsList.hasMoreElements()) {
- FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
- String repIDForFVD = vhandler.getClassName(fvd.id);
-
- if (!repIDForFVD.equals("java.lang.Object")) {
- if (fvd.is_custom) {
-
- readFormatVersion();
-
- boolean calledDefaultWriteObject = readBoolean();
-
- if (calledDefaultWriteObject)
- inputClassFields(null, null, null, fvd.members, sender);
-
- if (getStreamFormatVersion() == 2) {
-
- ((ValueInputStream)getOrbStream()).start_value();
- ((ValueInputStream)getOrbStream()).end_value();
- }
-
- // WARNING: If stream format version is 1 and there's
- // optional data, we'll get some form of exception down
- // the line.
-
- } else {
- // Use default marshaling
- inputClassFields(null, null, null, fvd.members, sender);
- }
- }
-
- } // end : while(fvdsList.hasMoreElements())
- return null;
-
- }
-
- ///////////////////
-
- private int findNextClass(String classname, Class classes[], int _spClass, int _spBase){
-
- for (int i = _spClass; i > _spBase; i--){
- if (classname.equals(classes[i].getName())) {
- return i;
- }
- }
-
- return -1;
- }
-
- /*
- * Invoke the readObject method if present. Assumes that in the case of custom
- * marshaling, the format version and defaultWriteObject indicator were already
- * removed.
- */
- private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, Class aclass)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
- try {
- return osc.invokeReadObject( obj, this ) ;
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof ClassNotFoundException)
- throw (ClassNotFoundException)t;
- else if (t instanceof IOException)
- throw (IOException)t;
- else if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- else if (t instanceof Error)
- throw (Error) t;
- else
- // XXX I18N, logging needed.
- throw new Error("internal error");
- }
- }
-
- /*
- * Reset the stream to be just like it was after the constructor.
- */
- private void resetStream() throws IOException {
-
- if (classes == null)
- classes = new Class[20];
- else {
- for (int i = 0; i < classes.length; i++)
- classes[i] = null;
- }
- if (classdesc == null)
- classdesc = new ObjectStreamClass[20];
- else {
- for (int i = 0; i < classdesc.length; i++)
- classdesc[i] = null;
- }
- spClass = 0;
-
- if (callbacks != null)
- callbacks.setSize(0); // discard any pending callbacks
- }
-
- /**
- * Factored out of inputClassFields This reads a primitive value and sets it
- * in the field of o described by the ObjectStreamField field.
- *
- * Note that reflection cannot be used here, because reflection cannot be used
- * to set final fields.
- */
- private void inputPrimitiveField(Object o, Class cl, ObjectStreamField field)
- throws InvalidClassException, IOException {
-
- try {
- switch (field.getTypeCode()) {
- case 'B':
- byte byteValue = orbStream.read_octet();
- if (field.getField() != null) {
- bridge.putByte( o, field.getFieldID(), byteValue ) ;
- //reflective code: field.getField().setByte( o, byteValue ) ;
- }
- break;
- case 'Z':
- boolean booleanValue = orbStream.read_boolean();
- if (field.getField() != null) {
- bridge.putBoolean( o, field.getFieldID(), booleanValue ) ;
- //reflective code: field.getField().setBoolean( o, booleanValue ) ;
- }
- break;
- case 'C':
- char charValue = orbStream.read_wchar();
- if (field.getField() != null) {
- bridge.putChar( o, field.getFieldID(), charValue ) ;
- //reflective code: field.getField().setChar( o, charValue ) ;
- }
- break;
- case 'S':
- short shortValue = orbStream.read_short();
- if (field.getField() != null) {
- bridge.putShort( o, field.getFieldID(), shortValue ) ;
- //reflective code: field.getField().setShort( o, shortValue ) ;
- }
- break;
- case 'I':
- int intValue = orbStream.read_long();
- if (field.getField() != null) {
- bridge.putInt( o, field.getFieldID(), intValue ) ;
- //reflective code: field.getField().setInt( o, intValue ) ;
- }
- break;
- case 'J':
- long longValue = orbStream.read_longlong();
- if (field.getField() != null) {
- bridge.putLong( o, field.getFieldID(), longValue ) ;
- //reflective code: field.getField().setLong( o, longValue ) ;
- }
- break;
- case 'F' :
- float floatValue = orbStream.read_float();
- if (field.getField() != null) {
- bridge.putFloat( o, field.getFieldID(), floatValue ) ;
- //reflective code: field.getField().setFloat( o, floatValue ) ;
- }
- break;
- case 'D' :
- double doubleValue = orbStream.read_double();
- if (field.getField() != null) {
- bridge.putDouble( o, field.getFieldID(), doubleValue ) ;
- //reflective code: field.getField().setDouble( o, doubleValue ) ;
- }
- break;
- default:
- // XXX I18N, logging needed.
- throw new InvalidClassException(cl.getName());
- }
- } catch (IllegalArgumentException e) {
- /* This case should never happen. If the field types
- are not the same, InvalidClassException is raised when
- matching the local class to the serialized ObjectStreamClass. */
- ClassCastException cce = new ClassCastException("Assigning instance of class " +
- field.getType().getName() +
- " to field " +
- currentClassDesc.getName() + '#' +
- field.getField().getName());
- cce.initCause( e ) ;
- throw cce ;
- }
- }
-
- private Object inputObjectField(org.omg.CORBA.ValueMember field,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws IndirectionException, ClassNotFoundException, IOException,
- StreamCorruptedException {
-
- Object objectValue = null;
- Class type = null;
- String id = field.id;
-
- try {
- type = vhandler.getClassFromType(id);
- } catch(ClassNotFoundException cnfe) {
- // Make sure type = null
- type = null;
- }
-
- String signature = null;
- if (type != null)
- signature = ValueUtility.getSignature(field);
-
- if (signature != null && (signature.equals("Ljava/lang/Object;") ||
- signature.equals("Ljava/io/Serializable;") ||
- signature.equals("Ljava/io/Externalizable;"))) {
- objectValue = javax.rmi.CORBA.Util.readAny(orbStream);
- } else {
- // Decide what method call to make based on the type. If
- // it is a type for which we need to load a stub, convert
- // the type to the correct stub type.
- //
- // NOTE : Since FullValueDescription does not allow us
- // to ask whether something is an interface we do not
- // have the ability to optimize this check.
-
- int callType = ValueHandlerImpl.kValueType;
-
- if (!vhandler.isSequence(id)) {
-
- if (field.type.kind().value() == kRemoteTypeCode.kind().value()) {
-
- // RMI Object reference...
- callType = ValueHandlerImpl.kRemoteType;
-
- } else {
-
- // REVISIT. If we don't have the local class,
- // we should probably verify that it's an RMI type,
- // query the remote FVD, and use is_abstract.
- // Our FVD seems to get NullPointerExceptions for any
- // non-RMI types.
-
- // This uses the local class in the same way as
- // inputObjectField(ObjectStreamField) does. REVISIT
- // inputObjectField(ObjectStreamField)'s loadStubClass
- // logic. Assumption is that the given type cannot
- // evolve to become a CORBA abstract interface or
- // a RMI abstract interface.
-
- if (type != null && type.isInterface() &&
- (vhandler.isAbstractBase(type) ||
- ObjectStreamClassCorbaExt.isAbstractInterface(type))) {
-
- callType = ValueHandlerImpl.kAbstractType;
- }
- }
- }
-
- // Now that we have used the FVD of the field to determine the proper course
- // of action, it is ok to use the type (Class) from this point forward since
- // the rep. id for this read will also follow on the wire.
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- if (type != null)
- objectValue = Utility.readObjectAndNarrow(orbStream, type);
- else
- objectValue = orbStream.read_Object();
- break;
- case ValueHandlerImpl.kAbstractType:
- if (type != null)
- objectValue = Utility.readAbstractAndNarrow(orbStream, type);
- else
- objectValue = orbStream.read_abstract_interface();
- break;
- case ValueHandlerImpl.kValueType:
- if (type != null)
- objectValue = orbStream.read_value(type);
- else
- objectValue = orbStream.read_value();
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown callType: " + callType);
- }
- }
-
- return objectValue;
- }
-
- /**
- * Factored out of inputClassFields and reused in
- * inputCurrentClassFieldsForReadFields.
- *
- * Reads the field (which of an Object type as opposed to a primitive)
- * described by ObjectStreamField field and returns it.
- */
- private Object inputObjectField(ObjectStreamField field)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IndirectionException, IOException {
-
- if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) {
- return javax.rmi.CORBA.Util.readAny(orbStream);
- }
-
- Object objectValue = null;
-
- // fields have an API to provide the actual class
- // corresponding to the data type
- // Class type = osc.forClass();
- Class fieldType = field.getType();
- Class actualType = fieldType; // This may change if stub loaded.
-
- // Decide what method call to make based on the fieldType. If
- // it is a type for which we need to load a stub, convert
- // the type to the correct stub type.
-
- int callType = ValueHandlerImpl.kValueType;
- boolean narrow = false;
-
- if (fieldType.isInterface()) {
- boolean loadStubClass = false;
-
- if (java.rmi.Remote.class.isAssignableFrom(fieldType)) {
-
- // RMI Object reference...
- callType = ValueHandlerImpl.kRemoteType;
-
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(fieldType)){
-
- // IDL Object reference...
- callType = ValueHandlerImpl.kRemoteType;
- loadStubClass = true;
-
- } else if (vhandler.isAbstractBase(fieldType)) {
- // IDL Abstract Object reference...
-
- callType = ValueHandlerImpl.kAbstractType;
- loadStubClass = true;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(fieldType)) {
- // RMI Abstract Object reference...
-
- callType = ValueHandlerImpl.kAbstractType;
- }
-
- if (loadStubClass) {
- try {
- String codebase = Util.getCodebase(fieldType);
- String repID = vhandler.createForAnyType(fieldType);
- Class stubType =
- Utility.loadStubClass(repID, codebase, fieldType);
- actualType = stubType;
- } catch (ClassNotFoundException e) {
- narrow = true;
- }
- } else {
- narrow = true;
- }
- }
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- if (!narrow)
- objectValue = (Object)orbStream.read_Object(actualType);
- else
- objectValue = Utility.readObjectAndNarrow(orbStream, actualType);
- break;
- case ValueHandlerImpl.kAbstractType:
- if (!narrow)
- objectValue = (Object)orbStream.read_abstract_interface(actualType);
- else
- objectValue = Utility.readAbstractAndNarrow(orbStream, actualType);
- break;
- case ValueHandlerImpl.kValueType:
- objectValue = (Object)orbStream.read_value(actualType);
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown callType: " + callType);
- }
-
- return objectValue;
- }
-
- private final boolean mustUseRemoteValueMembers() {
- return defaultReadObjectFVDMembers != null;
- }
-
- void readFields(java.util.Map fieldToValueMap)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- if (mustUseRemoteValueMembers()) {
- inputRemoteMembersForReadFields(fieldToValueMap);
- } else
- inputCurrentClassFieldsForReadFields(fieldToValueMap);
- }
-
- private final void inputRemoteMembersForReadFields(java.util.Map fieldToValueMap)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- // Must have this local variable since defaultReadObjectFVDMembers
- // may get mangled by recursion.
- ValueMember fields[] = defaultReadObjectFVDMembers;
-
- try {
-
- for (int i = 0; i < fields.length; i++) {
-
- switch (fields[i].type.kind().value()) {
-
- case TCKind._tk_octet:
- byte byteValue = orbStream.read_octet();
- fieldToValueMap.put(fields[i].name, new Byte(byteValue));
- break;
- case TCKind._tk_boolean:
- boolean booleanValue = orbStream.read_boolean();
- fieldToValueMap.put(fields[i].name, new Boolean(booleanValue));
- break;
- case TCKind._tk_char:
- // Backwards compatibility. Older Sun ORBs sent
- // _tk_char even though they read and wrote wchars
- // correctly.
- //
- // Fall through to the _tk_wchar case.
- case TCKind._tk_wchar:
- char charValue = orbStream.read_wchar();
- fieldToValueMap.put(fields[i].name, new Character(charValue));
- break;
- case TCKind._tk_short:
- short shortValue = orbStream.read_short();
- fieldToValueMap.put(fields[i].name, new Short(shortValue));
- break;
- case TCKind._tk_long:
- int intValue = orbStream.read_long();
- fieldToValueMap.put(fields[i].name, new Integer(intValue));
- break;
- case TCKind._tk_longlong:
- long longValue = orbStream.read_longlong();
- fieldToValueMap.put(fields[i].name, new Long(longValue));
- break;
- case TCKind._tk_float:
- float floatValue = orbStream.read_float();
- fieldToValueMap.put(fields[i].name, new Float(floatValue));
- break;
- case TCKind._tk_double:
- double doubleValue = orbStream.read_double();
- fieldToValueMap.put(fields[i].name, new Double(doubleValue));
- break;
- case TCKind._tk_value:
- case TCKind._tk_objref:
- case TCKind._tk_value_box:
- Object objectValue = null;
- try {
- objectValue = inputObjectField(fields[i],
- cbSender);
-
- } catch (IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- fieldToValueMap.put(fields[i].name, objectValue);
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown kind: "
- + fields[i].type.kind().value());
- }
- }
- } catch (Throwable t) {
- StreamCorruptedException result = new StreamCorruptedException(t.getMessage());
- result.initCause(t);
- throw result;
- }
- }
-
- /**
- * Called from InputStreamHook.
- *
- * Reads the fields of the current class (could be the ones
- * queried from the remote FVD) and puts them in
- * the given Map, name to value. Wraps primitives in the
- * corresponding java.lang Objects.
- */
- private final void inputCurrentClassFieldsForReadFields(java.util.Map fieldToValueMap)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy();
-
- int primFields = fields.length - currentClassDesc.objFields;
-
- // Handle the primitives first
- for (int i = 0; i < primFields; ++i) {
-
- switch (fields[i].getTypeCode()) {
- case 'B':
- byte byteValue = orbStream.read_octet();
- fieldToValueMap.put(fields[i].getName(),
- new Byte(byteValue));
- break;
- case 'Z':
- boolean booleanValue = orbStream.read_boolean();
- fieldToValueMap.put(fields[i].getName(),
- new Boolean(booleanValue));
- break;
- case 'C':
- char charValue = orbStream.read_wchar();
- fieldToValueMap.put(fields[i].getName(),
- new Character(charValue));
- break;
- case 'S':
- short shortValue = orbStream.read_short();
- fieldToValueMap.put(fields[i].getName(),
- new Short(shortValue));
- break;
- case 'I':
- int intValue = orbStream.read_long();
- fieldToValueMap.put(fields[i].getName(),
- new Integer(intValue));
- break;
- case 'J':
- long longValue = orbStream.read_longlong();
- fieldToValueMap.put(fields[i].getName(),
- new Long(longValue));
- break;
- case 'F' :
- float floatValue = orbStream.read_float();
- fieldToValueMap.put(fields[i].getName(),
- new Float(floatValue));
- break;
- case 'D' :
- double doubleValue = orbStream.read_double();
- fieldToValueMap.put(fields[i].getName(),
- new Double(doubleValue));
- break;
- default:
- // XXX I18N, logging needed.
- throw new InvalidClassException(currentClassDesc.getName());
- }
- }
-
- /* Read and set object fields from the input stream. */
- if (currentClassDesc.objFields > 0) {
- for (int i = primFields; i < fields.length; i++) {
- Object objectValue = null;
- try {
- objectValue = inputObjectField(fields[i]);
- } catch(IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- fieldToValueMap.put(fields[i].getName(), objectValue);
- }
- }
- }
-
- /*
- * Read the fields of the specified class from the input stream and set
- * the values of the fields in the specified object. If the specified
- * object is null, just consume the fields without setting any values. If
- * any ObjectStreamField does not have a reflected Field, don't try to set
- * that field in the object.
- *
- * REVISIT -- This code doesn't do what the comment says to when
- * getField() is null!
- */
- private void inputClassFields(Object o, Class> cl,
- ObjectStreamField[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
-
- int primFields = fields.length - currentClassDesc.objFields;
-
- // this will leave primitives in the inputstream
- // should really consume and discard where necessary
- if (o != null) {
- for (int i = 0; i < primFields; ++i) {
- inputPrimitiveField(o, cl, fields[i]);
- }
- }
-
- /* Read and set object fields from the input stream. */
- if (currentClassDesc.objFields > 0) {
- for (int i = primFields; i < fields.length; i++) {
- Object objectValue = null;
-
- try {
- objectValue = inputObjectField(fields[i]);
- } catch(IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- if ((o == null) || (fields[i].getField() == null)) {
- continue;
- }
-
- try {
- Class> fieldCl = fields[i].getClazz();
- if ((objectValue != null)
- && (!fieldCl.isAssignableFrom(
- objectValue.getClass()))) {
- throw new IllegalArgumentException("Field mismatch");
- }
- Field declaredClassField = null;
- final String inputStreamFieldName = fields[i].getName();
- try {
- declaredClassField = getDeclaredField( cl, inputStreamFieldName);
- } catch (PrivilegedActionException paEx) {
- throw new IllegalArgumentException(
- (NoSuchFieldException) paEx.getException());
- } catch (SecurityException secEx) {
- throw new IllegalArgumentException(secEx);
- } catch (NullPointerException npEx) {
- continue;
- } catch (NoSuchFieldException e) {
- continue;
- }
-
- if (declaredClassField == null) {
- continue;
- }
-
- Class> declaredFieldClass = declaredClassField.getType();
-
- // check input field type is a declared field type
- // input field is a subclass of the declared field
- if (!declaredFieldClass.isAssignableFrom(fieldCl)) {
- throw new IllegalArgumentException(
- "Field Type mismatch");
- }
- if (objectValue != null && !fieldCl.isInstance(objectValue)) {
- throw new IllegalArgumentException();
- }
- bridge.putObject( o, fields[i].getFieldID(), objectValue ) ;
- // reflective code: fields[i].getField().set( o, objectValue ) ;
- } catch (IllegalArgumentException iaEx) {
- String objectValueClassName = "null";
- String currentClassDescClassName = "null";
- String fieldName = "null";
- if (objectValue != null) {
- objectValueClassName = objectValue.getClass().getName();
- }
- if (currentClassDesc != null) {
- currentClassDescClassName = currentClassDesc.getName();
- }
- if (fields[i] != null && fields[i].getField() != null) {
- fieldName = fields[i].getField().getName();
- }
- ClassCastException ccEx = new ClassCastException(
- "Assigning instance of class " + objectValueClassName
- + " to field " + currentClassDescClassName + '#' + fieldName);
- ccEx.initCause( iaEx ) ;
- throw ccEx ;
- }
- } // end : for loop
- }
- }
-
- /*
- * Read the fields of the specified class from the input stream and set
- * the values of the fields in the specified object. If the specified
- * object is null, just consume the fields without setting any values. If
- * any ObjectStreamField does not have a reflected Field, don't try to set
- * that field in the object.
- */
- private void inputClassFields(Object o, Class cl,
- ObjectStreamClass osc,
- ValueMember[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
- try{
- for (int i = 0; i < fields.length; ++i) {
- try {
- switch (fields[i].type.kind().value()) {
- case TCKind._tk_octet:
- byte byteValue = orbStream.read_octet();
- if ((o != null) && osc.hasField(fields[i]))
- setByteField(o, cl, fields[i].name, byteValue);
- break;
- case TCKind._tk_boolean:
- boolean booleanValue = orbStream.read_boolean();
- if ((o != null) && osc.hasField(fields[i]))
- setBooleanField(o, cl, fields[i].name, booleanValue);
- break;
- case TCKind._tk_char:
- // Backwards compatibility. Older Sun ORBs sent
- // _tk_char even though they read and wrote wchars
- // correctly.
- //
- // Fall through to the _tk_wchar case.
- case TCKind._tk_wchar:
- char charValue = orbStream.read_wchar();
- if ((o != null) && osc.hasField(fields[i]))
- setCharField(o, cl, fields[i].name, charValue);
- break;
- case TCKind._tk_short:
- short shortValue = orbStream.read_short();
- if ((o != null) && osc.hasField(fields[i]))
- setShortField(o, cl, fields[i].name, shortValue);
- break;
- case TCKind._tk_long:
- int intValue = orbStream.read_long();
- if ((o != null) && osc.hasField(fields[i]))
- setIntField(o, cl, fields[i].name, intValue);
- break;
- case TCKind._tk_longlong:
- long longValue = orbStream.read_longlong();
- if ((o != null) && osc.hasField(fields[i]))
- setLongField(o, cl, fields[i].name, longValue);
- break;
- case TCKind._tk_float:
- float floatValue = orbStream.read_float();
- if ((o != null) && osc.hasField(fields[i]))
- setFloatField(o, cl, fields[i].name, floatValue);
- break;
- case TCKind._tk_double:
- double doubleValue = orbStream.read_double();
- if ((o != null) && osc.hasField(fields[i]))
- setDoubleField(o, cl, fields[i].name, doubleValue);
- break;
- case TCKind._tk_value:
- case TCKind._tk_objref:
- case TCKind._tk_value_box:
- Object objectValue = null;
- try {
- objectValue = inputObjectField(fields[i], sender);
- } catch (IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- objectValue = activeRecursionMgr.getObject(cdrie.offset);
- }
-
- if (o == null)
- continue;
- try {
- if (osc.hasField(fields[i])){
- setObjectField(o,
- cl,
- fields[i].name,
- objectValue);
- } else {
- // REVISIT. Convert to a log message.
- // This is a normal case when fields have
- // been added as part of evolution, but
- // silently skipping can make it hard to
- // debug if there's an error
-// System.out.println("**** warning, not setting field: "
-// + fields[i].name
-// + " since not on class "
-// + osc.getName());
-
- }
- } catch (IllegalArgumentException e) {
- // XXX I18N, logging needed.
- ClassCastException cce = new ClassCastException("Assigning instance of class " +
- objectValue.getClass().getName() + " to field " + fields[i].name);
- cce.initCause(e) ;
- throw cce ;
- }
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown kind: "
- + fields[i].type.kind().value());
- }
- } catch (IllegalArgumentException e) {
- /* This case should never happen. If the field types
- are not the same, InvalidClassException is raised when
- matching the local class to the serialized ObjectStreamClass. */
- // XXX I18N, logging needed.
- ClassCastException cce = new ClassCastException("Assigning instance of class " + fields[i].id +
- " to field " + currentClassDesc.getName() + '#' + fields[i].name);
- cce.initCause( e ) ;
- throw cce ;
- }
- }
- } catch(Throwable t){
- // XXX I18N, logging needed.
- StreamCorruptedException sce = new StreamCorruptedException(t.getMessage());
- sce.initCause(t) ;
- throw sce ;
- }
- }
-
- private void skipCustomUsingFVD(ValueMember[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException
- {
- readFormatVersion();
- boolean calledDefaultWriteObject = readBoolean();
-
- if (calledDefaultWriteObject)
- throwAwayData(fields, sender);
-
- if (getStreamFormatVersion() == 2) {
-
- ((ValueInputStream)getOrbStream()).start_value();
- ((ValueInputStream)getOrbStream()).end_value();
- }
- }
-
- /*
- * Read the fields of the specified class from the input stream throw data away.
- * This must handle same switch logic as above.
- */
- private void throwAwayData(ValueMember[] fields,
- com.sun.org.omg.SendingContext.CodeBase sender)
- throws InvalidClassException, StreamCorruptedException,
- ClassNotFoundException, IOException {
-
- for (int i = 0; i < fields.length; ++i) {
-
- try {
-
- switch (fields[i].type.kind().value()) {
- case TCKind._tk_octet:
- orbStream.read_octet();
- break;
- case TCKind._tk_boolean:
- orbStream.read_boolean();
- break;
- case TCKind._tk_char:
- // Backwards compatibility. Older Sun ORBs sent
- // _tk_char even though they read and wrote wchars
- // correctly.
- //
- // Fall through to the _tk_wchar case.
- case TCKind._tk_wchar:
- orbStream.read_wchar();
- break;
- case TCKind._tk_short:
- orbStream.read_short();
- break;
- case TCKind._tk_long:
- orbStream.read_long();
- break;
- case TCKind._tk_longlong:
- orbStream.read_longlong();
- break;
- case TCKind._tk_float:
- orbStream.read_float();
- break;
- case TCKind._tk_double:
- orbStream.read_double();
- break;
- case TCKind._tk_value:
- case TCKind._tk_objref:
- case TCKind._tk_value_box:
- Class type = null;
- String id = fields[i].id;
-
- try {
- type = vhandler.getClassFromType(id);
- }
- catch(ClassNotFoundException cnfe){
- // Make sure type = null
- type = null;
- }
- String signature = null;
- if (type != null)
- signature = ValueUtility.getSignature(fields[i]);
-
- // Read value
- try {
- if ((signature != null) && ( signature.equals("Ljava/lang/Object;") ||
- signature.equals("Ljava/io/Serializable;") ||
- signature.equals("Ljava/io/Externalizable;")) ) {
- javax.rmi.CORBA.Util.readAny(orbStream);
- }
- else {
- // Decide what method call to make based on the type.
- //
- // NOTE : Since FullValueDescription does not allow us
- // to ask whether something is an interface we do not
- // have the ability to optimize this check.
-
- int callType = ValueHandlerImpl.kValueType;
-
- if (!vhandler.isSequence(id)) {
- FullValueDescription fieldFVD = sender.meta(fields[i].id);
- if (kRemoteTypeCode == fields[i].type) {
-
- // RMI Object reference...
- callType = ValueHandlerImpl.kRemoteType;
- } else if (fieldFVD.is_abstract) {
- // RMI Abstract Object reference...
-
- callType = ValueHandlerImpl.kAbstractType;
- }
- }
-
- // Now that we have used the FVD of the field to determine the proper course
- // of action, it is ok to use the type (Class) from this point forward since
- // the rep. id for this read will also follow on the wire.
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- orbStream.read_Object();
- break;
- case ValueHandlerImpl.kAbstractType:
- orbStream.read_abstract_interface();
- break;
- case ValueHandlerImpl.kValueType:
- if (type != null) {
- orbStream.read_value(type);
- } else {
- orbStream.read_value();
- }
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown callType: "
- + callType);
- }
- }
-
- }
- catch(IndirectionException cdrie) {
- // Since we are throwing this away, don't bother handling recursion.
- continue;
- }
-
- break;
- default:
- // XXX I18N, logging needed.
- throw new StreamCorruptedException("Unknown kind: "
- + fields[i].type.kind().value());
-
- }
- } catch (IllegalArgumentException e) {
- /* This case should never happen. If the field types
- are not the same, InvalidClassException is raised when
- matching the local class to the serialized ObjectStreamClass. */
- // XXX I18N, logging needed.
- ClassCastException cce = new ClassCastException("Assigning instance of class " +
- fields[i].id + " to field " + currentClassDesc.getName() +
- '#' + fields[i].name);
- cce.initCause(e) ;
- throw cce ;
- }
- }
- }
-
- private static void setObjectField(Object o, Class> c, String fieldName, Object v) {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- Class fieldCl = fld.getType();
- if(v != null && !fieldCl.isInstance(v)) {
- throw new Exception();
- }
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putObject( o, key, v ) ;
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetObjectField( e, fieldName,
- o.toString(),
- v.toString() ) ;
- } else {
- throw utilWrapper.errorSetObjectField( e, fieldName,
- "null " + c.getName() + " object",
- v.toString() ) ;
- }
- }
- }
-
- private static void setBooleanField(Object o, Class> c, String fieldName, boolean v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Boolean.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putBoolean( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetBooleanField( e, fieldName,
- o.toString(),
- new Boolean(v) ) ;
- } else {
- throw utilWrapper.errorSetBooleanField( e, fieldName,
- "null " + c.getName() + " object",
- new Boolean(v) ) ;
- }
- }
- }
-
- private static void setByteField(Object o, Class> c, String fieldName, byte v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Byte.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putByte( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetByteField( e, fieldName,
- o.toString(),
- new Byte(v) ) ;
- } else {
- throw utilWrapper.errorSetByteField( e, fieldName,
- "null " + c.getName() + " object",
- new Byte(v) ) ;
- }
- }
- }
-
- private static void setCharField(Object o, Class> c, String fieldName, char v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Character.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putChar( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetCharField( e, fieldName,
- o.toString(),
- new Character(v) ) ;
- } else {
- throw utilWrapper.errorSetCharField( e, fieldName,
- "null " + c.getName() + " object",
- new Character(v) ) ;
- }
- }
- }
-
- private static void setShortField(Object o, Class> c, String fieldName, short v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Short.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putShort( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetShortField( e, fieldName,
- o.toString(),
- new Short(v) ) ;
- } else {
- throw utilWrapper.errorSetShortField( e, fieldName,
- "null " + c.getName() + " object",
- new Short(v) ) ;
- }
- }
- }
-
- private static void setIntField(Object o, Class> c, String fieldName, int v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Integer.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putInt( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetIntField( e, fieldName,
- o.toString(),
- new Integer(v) ) ;
- } else {
- throw utilWrapper.errorSetIntField( e, fieldName,
- "null " + c.getName() + " object",
- new Integer(v) ) ;
- }
- }
- }
-
- private static void setLongField(Object o, Class> c, String fieldName, long v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Long.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putLong( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetLongField( e, fieldName,
- o.toString(),
- new Long(v) ) ;
- } else {
- throw utilWrapper.errorSetLongField( e, fieldName,
- "null " + c.getName() + " object",
- new Long(v) ) ;
- }
- }
- }
-
- private static void setFloatField(Object o, Class> c, String fieldName, float v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Float.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putFloat( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetFloatField( e, fieldName,
- o.toString(),
- new Float(v) ) ;
- } else {
- throw utilWrapper.errorSetFloatField( e, fieldName,
- "null " + c.getName() + " object",
- new Float(v) ) ;
- }
- }
- }
-
- private static void setDoubleField(Object o, Class> c, String fieldName, double v)
- {
- try {
- Field fld = getDeclaredField( c, fieldName ) ;
- if ((fld != null) && (fld.getType() == Double.TYPE)) {
- long key = bridge.objectFieldOffset( fld ) ;
- bridge.putDouble( o, key, v ) ;
- } else {
- throw new InvalidObjectException("Field Type mismatch");
- }
- } catch (Exception e) {
- if (o != null) {
- throw utilWrapper.errorSetDoubleField( e, fieldName,
- o.toString(),
- new Double(v) ) ;
- } else {
- throw utilWrapper.errorSetDoubleField( e, fieldName,
- "null " + c.getName() + " object",
- new Double(v) ) ;
- }
- }
- }
-
-
- private static Field getDeclaredField(final Class> c,
- final String fieldName)
- throws PrivilegedActionException, NoSuchFieldException, SecurityException {
- if (System.getSecurityManager() == null) {
- return c.getDeclaredField(fieldName);
- } else {
- return AccessController
- .doPrivileged(new PrivilegedExceptionAction() {
- public Field run() throws NoSuchFieldException {
- return c.getDeclaredField(fieldName);
- }
- });
- }
- }
-
- /**
- * This class maintains a map of stream position to
- * an Object currently being deserialized. It is used
- * to handle the cases where the are indirections to
- * an object on the recursion stack. The CDR level
- * handles indirections to objects previously seen
- * (and completely deserialized) in the stream.
- */
- static class ActiveRecursionManager
- {
- private Map offsetToObjectMap;
-
- public ActiveRecursionManager() {
- // A hash map is unsynchronized and allows
- // null values
- offsetToObjectMap = new HashMap<>();
- }
-
- // Called right after allocating a new object.
- // Offset is the starting position in the stream
- // of the object.
- public void addObject(int offset, Object value) {
- offsetToObjectMap.put(new Integer(offset), value);
- }
-
- // If the given starting position doesn't refer
- // to the beginning of an object currently being
- // deserialized, this throws an IOException.
- // Otherwise, it returns a reference to the
- // object.
- public Object getObject(int offset) throws IOException {
- Integer position = new Integer(offset);
-
- if (!offsetToObjectMap.containsKey(position))
- // XXX I18N, logging needed.
- throw new IOException("Invalid indirection to offset "
- + offset);
-
- return offsetToObjectMap.get(position);
- }
-
- // Called when an object has been completely
- // deserialized, so it should no longer be in
- // this mapping. The CDR level can handle
- // further indirections.
- public void removeObject(int offset) {
- offsetToObjectMap.remove(new Integer(offset));
- }
-
- // If the given offset doesn't map to an Object,
- // then it isn't an indirection to an object
- // currently being deserialized.
- public boolean containsObject(int offset) {
- return offsetToObjectMap.containsKey(new Integer(offset));
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java 2018-01-30 20:17:24.000000000 -0500
+++ /dev/null 2018-01-30 20:17:24.000000000 -0500
@@ -1,801 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import org.omg.CORBA.portable.OutputStream;
-
-import java.security.AccessController ;
-import java.security.PrivilegedAction ;
-
-import java.io.IOException;
-import java.io.InvalidClassException;
-import java.io.Externalizable;
-import java.io.NotSerializableException;
-import java.io.NotActiveException;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.rmi.CORBA.Util;
-
-import sun.corba.Bridge ;
-
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.UtilSystemException ;
-
-/**
- * IIOPOutputStream is ...
- *
- * @author Stephen Lewallen
- * @since JDK1.1.6
- */
-
-public class IIOPOutputStream
- extends com.sun.corba.se.impl.io.OutputStreamHook
-{
- private UtilSystemException wrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- private static Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- private org.omg.CORBA_2_3.portable.OutputStream orbStream;
-
- private Object currentObject = null;
-
- private ObjectStreamClass currentClassDesc = null;
-
- private int recursionDepth = 0;
-
- private int simpleWriteDepth = 0;
-
- private IOException abortIOException = null;
-
- private java.util.Stack classDescStack = new java.util.Stack();
-
- // Used when calling an object's writeObject method
- private Object[] writeObjectArgList = {this};
-
- public IIOPOutputStream()
- throws java.io.IOException
- {
- super();
- }
-
- // If using RMI-IIOP stream format version 2, this tells
- // the ORB stream (which must be a ValueOutputStream) to
- // begin a new valuetype to contain the optional data
- // of the writeObject method.
- protected void beginOptionalCustomData() {
-
- if (streamFormatVersion == 2) {
-
- org.omg.CORBA.portable.ValueOutputStream vout
- = (org.omg.CORBA.portable.ValueOutputStream)orbStream;
-
- vout.start_value(currentClassDesc.getRMIIIOPOptionalDataRepId());
- }
- }
-
- final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
- orbStream = os;
- }
-
- final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
- return orbStream;
- }
-
- final void increaseRecursionDepth(){
- recursionDepth++;
- }
-
- final int decreaseRecursionDepth(){
- return --recursionDepth;
- }
-
- /**
- * Override the actions of the final method "writeObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final void writeObjectOverride(Object obj)
- throws IOException
- {
- writeObjectState.writeData(this);
-
- Util.writeAbstractObject((OutputStream)orbStream, obj);
- }
-
- /**
- * Override the actions of the final method "writeObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final void simpleWriteObject(Object obj, byte formatVersion)
- /* throws IOException */
- {
- byte oldStreamFormatVersion = streamFormatVersion;
-
- streamFormatVersion = formatVersion;
-
- Object prevObject = currentObject;
- ObjectStreamClass prevClassDesc = currentClassDesc;
- simpleWriteDepth++;
-
- try {
- // if (!checkSpecialClasses(obj) && !checkSubstitutableSpecialClasses(obj))
- outputObject(obj);
-
- } catch (IOException ee) {
- if (abortIOException == null)
- abortIOException = ee;
- } finally {
- /* Restore state of previous call incase this is a nested call */
- streamFormatVersion = oldStreamFormatVersion;
- simpleWriteDepth--;
- currentObject = prevObject;
- currentClassDesc = prevClassDesc;
- }
-
- /* If the recursion depth is 0, test for and clear the pending exception.
- * If there is a pending exception throw it.
- */
- IOException pending = abortIOException;
- if (simpleWriteDepth == 0)
- abortIOException = null;
- if (pending != null) {
- bridge.throwException( pending ) ;
- }
- }
-
- // Required by the superclass.
- ObjectStreamField[] getFieldsNoCopy() {
- return currentClassDesc.getFieldsNoCopy();
- }
-
- /**
- * Override the actions of the final method "defaultWriteObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final void defaultWriteObjectDelegate()
- /* throws IOException */
- {
- try {
- if (currentObject == null || currentClassDesc == null)
- // XXX I18N, Logging needed.
- throw new NotActiveException("defaultWriteObjectDelegate");
-
- ObjectStreamField[] fields =
- currentClassDesc.getFieldsNoCopy();
- if (fields.length > 0) {
- outputClassFields(currentObject, currentClassDesc.forClass(),
- fields);
- }
- } catch(IOException ioe) {
- bridge.throwException(ioe);
- }
- }
-
- /**
- * Override the actions of the final method "enableReplaceObject()"
- * in ObjectOutputStream.
- * @since JDK1.1.6
- */
- public final boolean enableReplaceObjectDelegate(boolean enable)
- /* throws SecurityException */
- {
- return false;
-
- }
-
-
- protected final void annotateClass(Class> cl) throws IOException{
- // XXX I18N, Logging needed.
- throw new IOException("Method annotateClass not supported");
- }
-
- public final void close() throws IOException{
- // no op
- }
-
- protected final void drain() throws IOException{
- // no op
- }
-
- public final void flush() throws IOException{
- try{
- orbStream.flush();
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- protected final Object replaceObject(Object obj) throws IOException{
- // XXX I18N, Logging needed.
- throw new IOException("Method replaceObject not supported");
- }
-
- /**
- * Reset will disregard the state of any objects already written
- * to the stream. The state is reset to be the same as a new
- * ObjectOutputStream. The current point in the stream is marked
- * as reset so the corresponding ObjectInputStream will be reset
- * at the same point. Objects previously written to the stream
- * will not be refered to as already being in the stream. They
- * will be written to the stream again.
- * @since JDK1.1
- */
- public final void reset() throws IOException{
- try{
- //orbStream.reset();
-
- if (currentObject != null || currentClassDesc != null)
- // XXX I18N, Logging needed.
- throw new IOException("Illegal call to reset");
-
- abortIOException = null;
-
- if (classDescStack == null)
- classDescStack = new java.util.Stack();
- else
- classDescStack.setSize(0);
-
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void write(byte b[]) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet_array(b, 0, b.length);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void write(byte b[], int off, int len) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet_array(b, off, len);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void write(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet((byte)(data & 0xFF));
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeBoolean(boolean data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_boolean(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeByte(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_octet((byte)data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeBytes(String data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- byte buf[] = data.getBytes();
- orbStream.write_octet_array(buf, 0, buf.length);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeChar(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_wchar((char)data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeChars(String data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- char buf[] = data.toCharArray();
- orbStream.write_wchar_array(buf, 0, buf.length);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeDouble(double data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_double(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeFloat(float data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_float(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeInt(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_long(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeLong(long data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_longlong(data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- public final void writeShort(int data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- orbStream.write_short((short)data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- protected final void writeStreamHeader() throws IOException{
- // no op
- }
-
- /**
- * Helper method for correcting the Kestrel bug 4367783 (dealing
- * with larger than 8-bit chars). The old behavior is preserved
- * in orbutil.IIOPInputStream_1_3 in order to interoperate with
- * our legacy ORBs.
- */
- protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream,
- String data)
- {
- stream.write_wstring(data);
- }
-
- public final void writeUTF(String data) throws IOException{
- try{
- writeObjectState.writeData(this);
-
- internalWriteUTF(orbStream, data);
- } catch(Error e) {
- IOException ioexc = new IOException(e.getMessage());
- ioexc.initCause(e) ;
- throw ioexc ;
- }
- }
-
- // INTERNAL UTILITY METHODS
- /*
- * Check for special cases of serializing objects.
- * These objects are not subject to replacement.
- */
- private boolean checkSpecialClasses(Object obj) throws IOException {
-
- /*
- * If this is a class, don't allow substitution
- */
- //if (obj instanceof Class) {
- // throw new IOException("Serialization of Class not supported");
- //}
-
- if (obj instanceof ObjectStreamClass) {
- // XXX I18N, Logging needed.
- throw new IOException("Serialization of ObjectStreamClass not supported");
- }
-
- return false;
- }
-
- /*
- * Check for special cases of substitutable serializing objects.
- * These classes are replaceable.
- */
- private boolean checkSubstitutableSpecialClasses(Object obj)
- throws IOException
- {
- if (obj instanceof String) {
- orbStream.write_value((java.io.Serializable)obj);
- return true;
- }
-
- //if (obj.getClass().isArray()) {
- // outputArray(obj);
- // return true;
- //}
-
- return false;
- }
-
- /*
- * Write out the object
- */
- private void outputObject(final Object obj) throws IOException{
-
- currentObject = obj;
- Class currclass = obj.getClass();
-
- /* Get the Class descriptor for this class,
- * Throw a NotSerializableException if there is none.
- */
- currentClassDesc = ObjectStreamClass.lookup(currclass);
- if (currentClassDesc == null) {
- // XXX I18N, Logging needed.
- throw new NotSerializableException(currclass.getName());
- }
-
- /* If the object is externalizable,
- * call writeExternal.
- * else do Serializable processing.
- */
- if (currentClassDesc.isExternalizable()) {
- // Write format version
- orbStream.write_octet(streamFormatVersion);
-
- Externalizable ext = (Externalizable)obj;
- ext.writeExternal(this);
-
- } else {
-
- /* The object's classes should be processed from supertype to subtype
- * Push all the clases of the current object onto a stack.
- * Remember the stack pointer where this set of classes is being pushed.
- */
- if (currentClassDesc.forClass().getName().equals("java.lang.String")) {
- this.writeUTF((String)obj);
- return;
- }
- int stackMark = classDescStack.size();
- try {
- ObjectStreamClass next;
- while ((next = currentClassDesc.getSuperclass()) != null) {
- classDescStack.push(currentClassDesc);
- currentClassDesc = next;
- }
-
- /*
- * For currentClassDesc and all the pushed class descriptors
- * If the class is writing its own data
- * set blockData = true; call the class writeObject method
- * If not
- * invoke either the defaultWriteObject method.
- */
- do {
-
- WriteObjectState oldState = writeObjectState;
-
- try {
-
- setState(NOT_IN_WRITE_OBJECT);
-
- if (currentClassDesc.hasWriteObject()) {
- invokeObjectWriter(currentClassDesc, obj );
- } else {
- defaultWriteObjectDelegate();
- }
- } finally {
- setState(oldState);
- }
-
- } while (classDescStack.size() > stackMark &&
- (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
- } finally {
- classDescStack.setSize(stackMark);
- }
- }
- }
-
- /*
- * Invoke writer.
- * _REVISIT_ invokeObjectWriter and invokeObjectReader behave inconsistently with each other since
- * the reader returns a boolean...fix later
- */
- private void invokeObjectWriter(ObjectStreamClass osc, Object obj)
- throws IOException
- {
- Class c = osc.forClass() ;
-
- try {
-
- // Write format version
- orbStream.write_octet(streamFormatVersion);
-
- writeObjectState.enterWriteObject(this);
-
- // writeObject(obj, c, this);
- osc.invokeWriteObject( obj, this ) ;
-
- writeObjectState.exitWriteObject(this);
-
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof IOException)
- throw (IOException)t;
- else if (t instanceof RuntimeException)
- throw (RuntimeException) t;
- else if (t instanceof Error)
- throw (Error) t;
- else
- // XXX I18N, Logging needed.
- throw new Error("invokeObjectWriter internal error",e);
- }
- }
-
- void writeField(ObjectStreamField field, Object value) throws IOException {
- switch (field.getTypeCode()) {
- case 'B':
- if (value == null)
- orbStream.write_octet((byte)0);
- else
- orbStream.write_octet(((Byte)value).byteValue());
- break;
- case 'C':
- if (value == null)
- orbStream.write_wchar((char)0);
- else
- orbStream.write_wchar(((Character)value).charValue());
- break;
- case 'F':
- if (value == null)
- orbStream.write_float((float)0);
- else
- orbStream.write_float(((Float)value).floatValue());
- break;
- case 'D':
- if (value == null)
- orbStream.write_double((double)0);
- else
- orbStream.write_double(((Double)value).doubleValue());
- break;
- case 'I':
- if (value == null)
- orbStream.write_long((int)0);
- else
- orbStream.write_long(((Integer)value).intValue());
- break;
- case 'J':
- if (value == null)
- orbStream.write_longlong((long)0);
- else
- orbStream.write_longlong(((Long)value).longValue());
- break;
- case 'S':
- if (value == null)
- orbStream.write_short((short)0);
- else
- orbStream.write_short(((Short)value).shortValue());
- break;
- case 'Z':
- if (value == null)
- orbStream.write_boolean(false);
- else
- orbStream.write_boolean(((Boolean)value).booleanValue());
- break;
- case '[':
- case 'L':
- // What to do if it's null?
- writeObjectField(field, value);
- break;
- default:
- // XXX I18N, Logging needed.
- throw new InvalidClassException(currentClassDesc.getName());
- }
- }
-
- private void writeObjectField(ObjectStreamField field,
- Object objectValue) throws IOException {
-
- if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) {
- javax.rmi.CORBA.Util.writeAny(orbStream, objectValue);
- }
- else {
- Class type = field.getType();
- int callType = ValueHandlerImpl.kValueType;
-
- if (type.isInterface()) {
- String className = type.getName();
-
- if (java.rmi.Remote.class.isAssignableFrom(type)) {
-
- // RMI Object reference...
-
- callType = ValueHandlerImpl.kRemoteType;
-
-
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){
-
- // IDL Object reference...
- callType = ValueHandlerImpl.kRemoteType;
-
- } else if (RepositoryId.isAbstractBase(type)) {
- // IDL Abstract Object reference...
- callType = ValueHandlerImpl.kAbstractType;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) {
- callType = ValueHandlerImpl.kAbstractType;
- }
- }
-
- switch (callType) {
- case ValueHandlerImpl.kRemoteType:
- Util.writeRemoteObject(orbStream, objectValue);
- break;
- case ValueHandlerImpl.kAbstractType:
- Util.writeAbstractObject(orbStream, objectValue);
- break;
- case ValueHandlerImpl.kValueType:
- try{
- orbStream.write_value((java.io.Serializable)objectValue, type);
- }
- catch(ClassCastException cce){
- if (objectValue instanceof java.io.Serializable)
- throw cce;
- else
- Utility.throwNotSerializableForCorba(objectValue.getClass().getName());
- }
- }
- }
- }
-
- /* Write the fields of the specified class by invoking the appropriate
- * write* method on this class.
- */
- private void outputClassFields(Object o, Class cl,
- ObjectStreamField[] fields)
- throws IOException {
-
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getField() == null)
- throw new InvalidClassException(cl.getName(),
- "Nonexistent field " + fields[i].getName());
- switch (fields[i].getTypeCode()) {
- case 'B':
- byte byteValue = bridge.getByte(o, fields[i].getFieldID()) ;
- orbStream.write_octet(byteValue);
- break;
- case 'C':
- char charValue = bridge.getChar(o, fields[i].getFieldID()) ;
- orbStream.write_wchar(charValue);
- break;
- case 'F':
- float floatValue = bridge.getFloat(o, fields[i].getFieldID()) ;
- orbStream.write_float(floatValue);
- break;
- case 'D' :
- double doubleValue = bridge.getDouble(o, fields[i].getFieldID()) ;
- orbStream.write_double(doubleValue);
- break;
- case 'I':
- int intValue = bridge.getInt(o, fields[i].getFieldID()) ;
- orbStream.write_long(intValue);
- break;
- case 'J':
- long longValue = bridge.getLong(o, fields[i].getFieldID()) ;
- orbStream.write_longlong(longValue);
- break;
- case 'S':
- short shortValue = bridge.getShort(o, fields[i].getFieldID()) ;
- orbStream.write_short(shortValue);
- break;
- case 'Z':
- boolean booleanValue = bridge.getBoolean(o, fields[i].getFieldID()) ;
- orbStream.write_boolean(booleanValue);
- break;
- case '[':
- case 'L':
- Object objectValue = bridge.getObject(o, fields[i].getFieldID()) ;
- writeObjectField(fields[i], objectValue);
- break;
- default:
- throw new InvalidClassException(cl.getName());
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java 2018-01-30 20:17:25.000000000 -0500
+++ /dev/null 2018-01-30 20:17:25.000000000 -0500
@@ -1,469 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.NotActiveException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.util.*;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-
-import org.omg.CORBA.portable.ValueInputStream;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersion;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.UtilSystemException;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-
-public abstract class InputStreamHook extends ObjectInputStream
-{
- // These should be visible in all the nested classes
- static final OMGSystemException omgWrapper =
- OMGSystemException.get( CORBALogDomains.RPC_ENCODING ) ;
-
- static final UtilSystemException utilWrapper =
- UtilSystemException.get( CORBALogDomains.RPC_ENCODING ) ;
-
- private class HookGetFields extends ObjectInputStream.GetField {
- private Map fields = null;
-
- HookGetFields(Map fields){
- this.fields = fields;
- }
-
- /**
- * Get the ObjectStreamClass that describes the fields in the stream.
- *
- * REVISIT! This doesn't work since we have our own ObjectStreamClass.
- */
- public java.io.ObjectStreamClass getObjectStreamClass() {
- return null;
- }
-
- /**
- * Return true if the named field is defaulted and has no value
- * in this stream.
- */
- public boolean defaulted(String name)
- throws IOException, IllegalArgumentException {
- return (!fields.containsKey(name));
- }
-
- /**
- * Get the value of the named boolean field from the persistent field.
- */
- public boolean get(String name, boolean defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Boolean)fields.get(name)).booleanValue();
- }
-
- /**
- * Get the value of the named char field from the persistent fields.
- */
- public char get(String name, char defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Character)fields.get(name)).charValue();
-
- }
-
- /**
- * Get the value of the named byte field from the persistent fields.
- */
- public byte get(String name, byte defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Byte)fields.get(name)).byteValue();
-
- }
-
- /**
- * Get the value of the named short field from the persistent fields.
- */
- public short get(String name, short defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Short)fields.get(name)).shortValue();
-
- }
-
- /**
- * Get the value of the named int field from the persistent fields.
- */
- public int get(String name, int defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Integer)fields.get(name)).intValue();
-
- }
-
- /**
- * Get the value of the named long field from the persistent fields.
- */
- public long get(String name, long defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Long)fields.get(name)).longValue();
-
- }
-
- /**
- * Get the value of the named float field from the persistent fields.
- */
- public float get(String name, float defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Float)fields.get(name)).floatValue();
-
- }
-
- /**
- * Get the value of the named double field from the persistent field.
- */
- public double get(String name, double defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Double)fields.get(name)).doubleValue();
-
- }
-
- /**
- * Get the value of the named Object field from the persistent field.
- */
- public Object get(String name, Object defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return fields.get(name);
-
- }
-
- public String toString(){
- return fields.toString();
- }
- }
-
- public InputStreamHook()
- throws IOException {
- super();
- }
-
- public void defaultReadObject()
- throws IOException, ClassNotFoundException, NotActiveException
- {
- readObjectState.beginDefaultReadObject(this);
-
- defaultReadObjectDelegate();
-
- readObjectState.endDefaultReadObject(this);
- }
-
- abstract void defaultReadObjectDelegate();
-
- abstract void readFields(java.util.Map fieldToValueMap)
- throws java.io.InvalidClassException, java.io.StreamCorruptedException,
- ClassNotFoundException, java.io.IOException;
-
-
- // See java.io.ObjectInputStream.GetField
- // Remember that this is equivalent to defaultReadObject
- // in RMI-IIOP
- public ObjectInputStream.GetField readFields()
- throws IOException, ClassNotFoundException, NotActiveException {
-
- HashMap fieldValueMap = new HashMap();
-
- // We were treating readFields same as defaultReadObject. It is
- // incorrect if the state is readOptionalData. If this line
- // is uncommented, it will throw a stream corrupted exception.
- // _REVISIT_: The ideal fix would be to add a new state. In
- // writeObject user may do one of the following
- // 1. Call defaultWriteObject()
- // 2. Put out optional fields
- // 3. Call writeFields
- // We have the state defined for (1) and (2) but not for (3), so
- // we should ideally introduce a new state for 3 and have the
- // beginDefaultReadObject do nothing.
- //readObjectState.beginDefaultReadObject(this);
-
- readFields(fieldValueMap);
-
- readObjectState.endDefaultReadObject(this);
-
- return new HookGetFields(fieldValueMap);
- }
-
- // The following is a State pattern implementation of what
- // should be done when the sender's Serializable has a
- // writeObject method. This was especially necessary for
- // RMI-IIOP stream format version 2. Please see the
- // state diagrams in the docs directory of the workspace.
- //
- // On the reader's side, the main factors are whether or not
- // we have a readObject method and whether or not the
- // sender wrote default data
-
- protected void setState(ReadObjectState newState) {
- readObjectState = newState;
- }
-
- protected abstract byte getStreamFormatVersion();
- abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
-
- // Description of possible actions
- protected static class ReadObjectState {
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject) throws IOException {}
-
- public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {}
- public void beginDefaultReadObject(InputStreamHook stream) throws IOException {}
- public void endDefaultReadObject(InputStreamHook stream) throws IOException {}
- public void readData(InputStreamHook stream) throws IOException {}
- }
-
- protected ReadObjectState readObjectState = DEFAULT_STATE;
-
- protected static final ReadObjectState DEFAULT_STATE = new DefaultState();
- protected static final ReadObjectState IN_READ_OBJECT_OPT_DATA
- = new InReadObjectOptionalDataState();
- protected static final ReadObjectState IN_READ_OBJECT_NO_MORE_OPT_DATA
- = new InReadObjectNoMoreOptionalDataState();
- protected static final ReadObjectState IN_READ_OBJECT_DEFAULTS_SENT
- = new InReadObjectDefaultsSentState();
- protected static final ReadObjectState NO_READ_OBJECT_DEFAULTS_SENT
- = new NoReadObjectDefaultsSentState();
-
- protected static final ReadObjectState IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED
- = new InReadObjectRemoteDidNotUseWriteObjectState();
- protected static final ReadObjectState IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM
- = new InReadObjectPastDefaultsRemoteDidNotUseWOState();
-
- protected static class DefaultState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- throws IOException {
-
- if (hasReadObject) {
- if (calledDefaultWriteObject)
- stream.setState(IN_READ_OBJECT_DEFAULTS_SENT);
- else {
- try {
- if (stream.getStreamFormatVersion() == 2)
- ((ValueInputStream)stream.getOrbStream()).start_value();
- } catch( Exception e ) {
- // This will happen for Big Integer which uses
- // writeFields in it's writeObject. We should be past
- // start_value by now.
- // NOTE: If we don't log any exception here we should
- // be fine. If there is an error, it will be caught
- // while reading the optional data.
-
- }
- stream.setState(IN_READ_OBJECT_OPT_DATA);
- }
- } else {
- if (calledDefaultWriteObject)
- stream.setState(NO_READ_OBJECT_DEFAULTS_SENT);
- else
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("No default data sent");
- }
- }
- }
-
- // REVISIT. If a readObject exits here without reading
- // default data, we won't skip it. This could be done automatically
- // as in line 1492 in IIOPInputStream.
- protected static class InReadObjectRemoteDidNotUseWriteObjectState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- {
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void endDefaultReadObject(InputStreamHook stream) {
- stream.setState(IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM);
- }
-
- public void readData(InputStreamHook stream) {
- stream.throwOptionalDataIncompatibleException();
- }
- }
-
- protected static class InReadObjectPastDefaultsRemoteDidNotUseWOState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- {
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void beginDefaultReadObject(InputStreamHook stream) throws IOException
- {
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("Default data already read");
- }
-
-
- public void readData(InputStreamHook stream) {
- stream.throwOptionalDataIncompatibleException();
- }
- }
-
- protected void throwOptionalDataIncompatibleException()
- {
- throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
- }
-
-
- protected static class InReadObjectDefaultsSentState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject) {
- // This should never happen.
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void endUnmarshalCustomValue(InputStreamHook stream) {
-
- // In stream format version 2, we can skip over
- // the optional data this way. In stream format version 1,
- // we will probably wind up with an error if we're
- // unmarshaling a superclass.
- if (stream.getStreamFormatVersion() == 2) {
- ((ValueInputStream)stream.getOrbStream()).start_value();
- ((ValueInputStream)stream.getOrbStream()).end_value();
- }
-
- stream.setState(DEFAULT_STATE);
- }
-
- public void endDefaultReadObject(InputStreamHook stream) throws IOException {
-
- // Read the fake valuetype header in stream format version 2
- if (stream.getStreamFormatVersion() == 2)
- ((ValueInputStream)stream.getOrbStream()).start_value();
-
- stream.setState(IN_READ_OBJECT_OPT_DATA);
- }
-
- public void readData(InputStreamHook stream) throws IOException {
- org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
- if ((orb == null) ||
- !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
- throw new StreamCorruptedException(
- "Default data must be read first");
- }
- ORBVersion clientOrbVersion =
- ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();
-
- // Fix Date interop bug. For older versions of the ORB don't do
- // anything for readData(). Before this used to throw
- // StreamCorruptedException for older versions of the ORB where
- // calledDefaultWriteObject always returns true.
- if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
- (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("Default data must be read first");
- }
- }
- }
-
- protected static class InReadObjectOptionalDataState extends ReadObjectState {
-
- public void beginUnmarshalCustomValue(InputStreamHook stream,
- boolean calledDefaultWriteObject,
- boolean hasReadObject)
- {
- // This should never happen.
- throw utilWrapper.badBeginUnmarshalCustomValue() ;
- }
-
- public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException
- {
- if (stream.getStreamFormatVersion() == 2) {
- ((ValueInputStream)stream.getOrbStream()).end_value();
- }
- stream.setState(DEFAULT_STATE);
- }
-
- public void beginDefaultReadObject(InputStreamHook stream) throws IOException
- {
- // XXX I18N and logging needed.
- throw new StreamCorruptedException("Default data not sent or already read/passed");
- }
-
-
- }
-
- protected static class InReadObjectNoMoreOptionalDataState
- extends InReadObjectOptionalDataState {
-
- public void readData(InputStreamHook stream) throws IOException {
- stream.throwOptionalDataIncompatibleException();
- }
- }
-
- protected static class NoReadObjectDefaultsSentState extends ReadObjectState {
- public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {
- // Code should read default fields before calling this
-
- if (stream.getStreamFormatVersion() == 2) {
- ((ValueInputStream)stream.getOrbStream()).start_value();
- ((ValueInputStream)stream.getOrbStream()).end_value();
- }
-
- stream.setState(DEFAULT_STATE);
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java 2018-01-30 20:17:26.000000000 -0500
+++ /dev/null 2018-01-30 20:17:26.000000000 -0500
@@ -1,1795 +0,0 @@
-/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 2012 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.invoke.MethodHandle;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.DigestOutputStream;
-import java.security.AccessController;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
-
-import java.io.IOException;
-import java.io.DataOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InvalidClassException;
-import java.io.Externalizable;
-import java.io.Serializable;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import org.omg.CORBA.ValueMember;
-
-import sun.corba.Bridge;
-
-/**
- * An ObjectStreamClass describes a class that can be serialized to a stream
- * or a class that was serialized to a stream. It contains the name
- * and the serialVersionUID of the class.
- *
- * The ObjectStreamClass for a specific class loaded in this Java VM can
- * be found using the lookup method.
- *
- * @author Roger Riggs
- * @since JDK1.1
- */
-public class ObjectStreamClass implements java.io.Serializable {
- private static final boolean DEBUG_SVUID = false ;
-
- public static final long kDefaultUID = -1;
-
- /** true if represents enum type */
- private boolean isEnum;
-
- private static final Bridge bridge =
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Bridge run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- /** Find the descriptor for a class that can be serialized. Null
- * is returned if the specified class does not implement
- * java.io.Serializable or java.io.Externalizable.
- */
- static final ObjectStreamClass lookup(Class> cl)
- {
- ObjectStreamClass desc = lookupInternal(cl);
- if (desc.isSerializable() || desc.isExternalizable())
- return desc;
- return null;
- }
-
- /*
- * Find the class descriptor for the specified class.
- * Package access only so it can be called from ObjectIn/OutStream.
- */
- static ObjectStreamClass lookupInternal(Class> cl)
- {
- /* Synchronize on the hashtable so no two threads will do
- * this at the same time.
- */
- ObjectStreamClass desc = null;
- synchronized (descriptorFor) {
- /* Find the matching descriptor if it already known */
- desc = findDescriptorFor(cl);
- if (desc == null) {
- /* Check if it's serializable */
- boolean serializable = Serializable.class.isAssignableFrom(cl);
-
- /* If the class is only Serializable,
- * lookup the descriptor for the superclass.
- */
- ObjectStreamClass superdesc = null;
- if (serializable) {
- Class> superclass = cl.getSuperclass();
- if (superclass != null)
- superdesc = lookup(superclass);
- }
-
- /* Check if its' externalizable.
- * If it's Externalizable, clear the serializable flag.
- * Only one or the other may be set in the protocol.
- */
- boolean externalizable = false;
- if (serializable) {
- externalizable =
- ((superdesc != null) && superdesc.isExternalizable()) ||
- Externalizable.class.isAssignableFrom(cl);
- if (externalizable) {
- serializable = false;
- }
- }
-
- /* Create a new version descriptor,
- * it put itself in the known table.
- */
- desc = new ObjectStreamClass(cl, superdesc,
- serializable, externalizable);
- }
- // Must always call init. See bug 4488137. This code was
- // incorrectly changed to return immediately on a non-null
- // cache result. That allowed threads to gain access to
- // unintialized instances.
- //
- // History: Note, the following init() call was originally within
- // the synchronization block, as it currently is now. Later, the
- // init() call was moved outside the synchronization block, and
- // the init() method used a private member variable lock, to
- // avoid performance problems. See bug 4165204. But that lead to
- // a deadlock situation, see bug 5104239. Hence, the init() method
- // has now been moved back into the synchronization block. The
- // right approach to solving these problems would be to rewrite
- // this class, based on the latest java.io.ObjectStreamClass.
- desc.init();
- }
- return desc;
- }
-
- /**
- * The name of the class described by this descriptor.
- */
- public final String getName() {
- return name;
- }
-
- /**
- * Return the serialVersionUID for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public static final long getSerialVersionUID( java.lang.Class> clazz) {
- ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
- if( theosc != null )
- {
- return theosc.getSerialVersionUID( );
- }
- return 0;
- }
-
- /**
- * Return the serialVersionUID for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public final long getSerialVersionUID() {
- return suid;
- }
-
- /**
- * Return the serialVersionUID string for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public final String getSerialVersionUIDStr() {
- if (suidStr == null)
- suidStr = Long.toHexString(suid).toUpperCase();
- return suidStr;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public static final long getActualSerialVersionUID( java.lang.Class> clazz )
- {
- ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
- if( theosc != null )
- {
- return theosc.getActualSerialVersionUID( );
- }
- return 0;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public final long getActualSerialVersionUID() {
- return actualSuid;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public final String getActualSerialVersionUIDStr() {
- if (actualSuidStr == null)
- actualSuidStr = Long.toHexString(actualSuid).toUpperCase();
- return actualSuidStr;
- }
-
- /**
- * Return the class in the local VM that this version is mapped to.
- * Null is returned if there is no corresponding local class.
- */
- public final Class> forClass() {
- return ofClass;
- }
-
- /**
- * Return an array of the fields of this serializable class.
- * @return an array containing an element for each persistent
- * field of this class. Returns an array of length zero if
- * there are no fields.
- * @since JDK1.2
- */
- public ObjectStreamField[] getFields() {
- // Return a copy so the caller can't change the fields.
- if (fields.length > 0) {
- ObjectStreamField[] dup = new ObjectStreamField[fields.length];
- System.arraycopy(fields, 0, dup, 0, fields.length);
- return dup;
- } else {
- return fields;
- }
- }
-
- public boolean hasField(ValueMember field)
- {
- try {
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getName().equals(field.name)) {
- if (fields[i].getSignature().equals(
- ValueUtility.getSignature(field)))
- return true;
- }
- }
- } catch (Exception exc) {
- // Ignore this; all we want to do is return false
- // Note that ValueUtility.getSignature can throw checked exceptions.
- }
-
- return false;
- }
-
- /* Avoid unnecessary allocations. */
- final ObjectStreamField[] getFieldsNoCopy() {
- return fields;
- }
-
- /**
- * Get the field of this class by name.
- * @return The ObjectStreamField object of the named field or null if there
- * is no such named field.
- */
- public final ObjectStreamField getField(String name) {
- /* Binary search of fields by name.
- */
- for (int i = fields.length-1; i >= 0; i--) {
- if (name.equals(fields[i].getName())) {
- return fields[i];
- }
- }
- return null;
- }
-
- public final boolean invokeWriteObject(Object obj, ObjectOutputStream ois) throws InvocationTargetException {
- if (!hasWriteObject()) {
- return false;
- }
- try {
- writeObjectMethod.invoke(obj, ois);
- } catch (Throwable t) {
- throw new InvocationTargetException(t, "writeObject");
- }
- return true;
- }
-
- public final boolean invokeReadObject(Object obj, ObjectInputStream ois) throws InvocationTargetException {
- if (hasReadObject()) {
- try {
- readObjectMethod.invoke(obj, ois);
- return true;
- } catch (Throwable t) {
- throw new InvocationTargetException(t, "readObject");
- }
- } else {
- return false;
- }
- }
-
- public Serializable writeReplace(Serializable value) {
- if (writeReplaceObjectMethod != null) {
- try {
- return (Serializable) writeReplaceObjectMethod.invoke(value);
- } catch (Throwable t) {
- throw new InternalError("unexpected error", t);
- }
- }
- else return value;
- }
-
- public Object readResolve(Object value) {
- if (readResolveObjectMethod != null) {
- try {
- return readResolveObjectMethod.invoke(value);
- } catch (Throwable t) {
- throw new InternalError("unexpected error", t);
- }
- }
- else return value;
- }
-
- /**
- * Return a string describing this ObjectStreamClass.
- */
- public final String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append(name);
- sb.append(": static final long serialVersionUID = ");
- sb.append(Long.toString(suid));
- sb.append("L;");
- return sb.toString();
- }
-
- /*
- * Create a new ObjectStreamClass from a loaded class.
- * Don't call this directly, call lookup instead.
- */
- private ObjectStreamClass(java.lang.Class> cl, ObjectStreamClass superdesc,
- boolean serial, boolean extern)
- {
- ofClass = cl; /* created from this class */
-
- if (Proxy.isProxyClass(cl)) {
- forProxyClass = true;
- }
-
- name = cl.getName();
- isEnum = Enum.class.isAssignableFrom(cl);
- superclass = superdesc;
- serializable = serial;
- if (!forProxyClass) {
- // proxy classes are never externalizable
- externalizable = extern;
- }
-
- /*
- * Enter this class in the table of known descriptors.
- * Otherwise, when the fields are read it may recurse
- * trying to find the descriptor for itself.
- */
- insertDescriptorFor(this);
-
- /*
- * The remainder of initialization occurs in init(), which is called
- * after the lock on the global class descriptor table has been
- * released.
- */
- }
-
- static final class PersistentFieldsValue
- extends ClassValue {
- PersistentFieldsValue() { }
-
- protected ObjectStreamField[] computeValue(Class> type) {
- try {
- bridge.ensureClassInitialized(type);
- Field pf = type.getDeclaredField("serialPersistentFields");
- int mods = pf.getModifiers();
- if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) &&
- Modifier.isFinal(mods)) {
- long offset = bridge.staticFieldOffset(pf);
- java.io.ObjectStreamField[] fields =
- (java.io.ObjectStreamField[])bridge.getObject(type, offset);
- return translateFields(fields);
- }
- } catch (NoSuchFieldException |
- IllegalArgumentException | ClassCastException e) {
- }
- return null;
- }
-
- private static ObjectStreamField[] translateFields(java.io.ObjectStreamField[] fields) {
- if (fields == null) {
- return null;
- }
- ObjectStreamField[] translation =
- new ObjectStreamField[fields.length];
- for (int i = 0; i < fields.length; i++) {
- translation[i] = new ObjectStreamField(fields[i].getName(),
- fields[i].getType());
- }
- return translation;
- }
- }
-
- private static final PersistentFieldsValue persistentFieldsValue =
- new PersistentFieldsValue();
-
- /**
- * Creates a PermissionDomain that grants no permission.
- */
- private ProtectionDomain noPermissionsDomain() {
- PermissionCollection perms = new Permissions();
- perms.setReadOnly();
- return new ProtectionDomain(null, perms);
- }
-
- /**
- * Aggregate the ProtectionDomains of all the classes that separate
- * a concrete class {@code cl} from its ancestor's class declaring
- * a constructor {@code cons}.
- *
- * If {@code cl} is defined by the boot loader, or the constructor
- * {@code cons} is declared by {@code cl}, or if there is no security
- * manager, then this method does nothing and {@code null} is returned.
- *
- * @param cons A constructor declared by {@code cl} or one of its
- * ancestors.
- * @param cl A concrete class, which is either the class declaring
- * the constructor {@code cons}, or a serializable subclass
- * of that class.
- * @return An array of ProtectionDomain representing the set of
- * ProtectionDomain that separate the concrete class {@code cl}
- * from its ancestor's declaring {@code cons}, or {@code null}.
- */
- private ProtectionDomain[] getProtectionDomains(Constructor> cons,
- Class> cl) {
- ProtectionDomain[] domains = null;
- if (cons != null && cl.getClassLoader() != null
- && System.getSecurityManager() != null) {
- Class> cls = cl;
- Class> fnscl = cons.getDeclaringClass();
- Set pds = null;
- while (cls != fnscl) {
- ProtectionDomain pd = cls.getProtectionDomain();
- if (pd != null) {
- if (pds == null) pds = new HashSet<>();
- pds.add(pd);
- }
- cls = cls.getSuperclass();
- if (cls == null) {
- // that's not supposed to happen
- // make a ProtectionDomain with no permission.
- // should we throw instead?
- if (pds == null) pds = new HashSet<>();
- else pds.clear();
- pds.add(noPermissionsDomain());
- break;
- }
- }
- if (pds != null) {
- domains = pds.toArray(new ProtectionDomain[0]);
- }
- }
- return domains;
- }
-
- /*
- * Initialize class descriptor. This method is only invoked on class
- * descriptors created via calls to lookupInternal(). This method is kept
- * separate from the ObjectStreamClass constructor so that lookupInternal
- * does not have to hold onto a global class descriptor table lock while the
- * class descriptor is being initialized (see bug 4165204).
- */
-
-
- private void init() {
- synchronized (lock) {
-
- // See description at definition of initialized.
- if (initialized)
- return;
-
- final Class> cl = ofClass;
-
- if (!serializable ||
- externalizable ||
- forProxyClass ||
- name.equals("java.lang.String")){
- fields = NO_FIELDS;
- } else if (serializable) {
- /* Ask for permission to override field access checks.
- */
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- /* Fill in the list of persistent fields.
- * If it is declared, use the declared serialPersistentFields.
- * Otherwise, extract the fields from the class itself.
- */
- fields = persistentFieldsValue.get(cl);
-
- if (fields == null) {
- /* Get all of the declared fields for this Class.
- * Create a temporary ObjectStreamField array to hold each
- * non-static, non-transient field. Then copy the
- * temporary array into an array of the correct
- * size once the number of fields is known.
- */
- Field[] actualfields = cl.getDeclaredFields();
-
- int numFields = 0;
- ObjectStreamField[] tempFields =
- new ObjectStreamField[actualfields.length];
- for (int i = 0; i < actualfields.length; i++) {
- Field fld = actualfields[i] ;
- int modifiers = fld.getModifiers();
- if (!Modifier.isStatic(modifiers) &&
- !Modifier.isTransient(modifiers)) {
- tempFields[numFields++] = new ObjectStreamField(fld);
- }
- }
-
- fields = new ObjectStreamField[numFields];
- System.arraycopy(tempFields, 0, fields, 0, numFields);
-
- } else {
- // For each declared persistent field, look for an actual
- // reflected Field. If there is one, make sure it's the correct
- // type and cache it in the ObjectStreamClass for that field.
- for (int j = fields.length-1; j >= 0; j--) {
- try {
- Field reflField = cl.getDeclaredField(fields[j].getName());
- if (fields[j].getType() == reflField.getType()) {
- fields[j].setField(reflField);
- }
- } catch (NoSuchFieldException e) {
- // Nothing to do
- }
- }
- }
- return null;
- }
- });
-
- if (fields.length > 1)
- Arrays.sort(fields);
-
- /* Set up field data for use while writing using the API api. */
- computeFieldInfo();
- }
-
- /* Get the serialVersionUID from the class.
- * It uses the access override mechanism so make sure
- * the field objects is only used here.
- *
- * NonSerializable classes have a serialVerisonUID of 0L.
- */
- if (isNonSerializable() || isEnum) {
- suid = 0L;
- } else {
- // Lookup special Serializable members using reflection.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- if (forProxyClass) {
- // proxy classes always have serialVersionUID of 0L
- suid = 0L;
- } else {
- try {
- final Field f = cl.getDeclaredField("serialVersionUID");
- int mods = f.getModifiers();
- // SerialBug 5: static final SUID should be read
- if (Modifier.isStatic(mods) && Modifier.isFinal(mods) ) {
- long offset = bridge.staticFieldOffset(f);
- suid = bridge.getLong(cl, offset);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- } else {
- suid = _computeSerialVersionUID(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- }
- } catch (NoSuchFieldException ex) {
- suid = _computeSerialVersionUID(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- }
- }
-
- writeReplaceObjectMethod = bridge.writeReplaceForSerialization(cl);
-
- readResolveObjectMethod = bridge.readResolveForSerialization(cl);
-
- domains = new ProtectionDomain[] {noPermissionsDomain()};
-
- if (externalizable)
- cons = getExternalizableConstructor(cl) ;
- else
- cons = getSerializableConstructor(cl) ;
-
- domains = getProtectionDomains(cons, cl);
-
- if (serializable && !forProxyClass) {
- writeObjectMethod = bridge.writeObjectForSerialization(cl) ;
- readObjectMethod = bridge.readObjectForSerialization(cl);
- }
- return null;
- }
- });
- }
-
- // This call depends on a lot of information computed above!
- actualSuid = ObjectStreamClass.computeStructuralUID(this, cl);
-
- // If we have a write object method, precompute the
- // RMI-IIOP stream format version 2 optional data
- // repository ID.
- if (hasWriteObject())
- rmiiiopOptionalDataRepId = computeRMIIIOPOptionalDataRepId();
-
- // This must be done last.
- initialized = true;
- }
- }
-
- // Specific to RMI-IIOP
- /**
- * Java to IDL ptc-02-01-12 1.5.1
- *
- * "The rep_id string passed to the start_value method must be
- * 'RMI:org.omg.custom.class:hashcode:suid' where class is the
- * fully-qualified name of the class whose writeObject method
- * is being invoked and hashcode and suid are the class's hashcode
- * and SUID."
- */
- private String computeRMIIIOPOptionalDataRepId() {
-
- StringBuffer sbuf = new StringBuffer("RMI:org.omg.custom.");
- sbuf.append(RepositoryId.convertToISOLatin1(this.getName()));
- sbuf.append(':');
- sbuf.append(this.getActualSerialVersionUIDStr());
- sbuf.append(':');
- sbuf.append(this.getSerialVersionUIDStr());
-
- return sbuf.toString();
- }
-
- /**
- * This will return null if there is no writeObject method.
- */
- public final String getRMIIIOPOptionalDataRepId() {
- return rmiiiopOptionalDataRepId;
- }
-
- /*
- * Create an empty ObjectStreamClass for a class about to be read.
- * This is separate from read so ObjectInputStream can assign the
- * wire handle early, before any nested ObjectStreamClass might
- * be read.
- */
- ObjectStreamClass(String n, long s) {
- name = n;
- suid = s;
- superclass = null;
- }
-
-
- /*
- * Set the class this version descriptor matches.
- * The base class name and serializable hash must match.
- * Fill in the reflected Fields that will be used
- * for reading.
- */
- final void setClass(Class> cl) throws InvalidClassException {
-
- if (cl == null) {
- localClassDesc = null;
- ofClass = null;
- computeFieldInfo();
- return;
- }
-
- localClassDesc = lookupInternal(cl);
- if (localClassDesc == null)
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Local class not compatible");
- if (suid != localClassDesc.suid) {
-
- /* Check for exceptional cases that allow mismatched suid. */
-
- /* Allow adding Serializable or Externalizable
- * to a later release of the class.
- */
- boolean addedSerialOrExtern =
- isNonSerializable() || localClassDesc.isNonSerializable();
-
- /* Disregard the serialVersionUID of an array
- * when name and cl.Name differ. If resolveClass() returns
- * an array with a different package name,
- * the serialVersionUIDs will not match since the fully
- * qualified array class is used in the
- * computation of the array's serialVersionUID. There is
- * no way to set a permanent serialVersionUID for an array type.
- */
-
- boolean arraySUID = (cl.isArray() && ! cl.getName().equals(name));
-
- if (! arraySUID && ! addedSerialOrExtern ) {
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Local class not compatible:" +
- " stream classdesc serialVersionUID=" + suid +
- " local class serialVersionUID=" + localClassDesc.suid);
- }
- }
-
- /* compare the class names, stripping off package names. */
- if (! compareClassNames(name, cl.getName(), '.'))
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Incompatible local class name. " +
- "Expected class name compatible with " +
- name);
-
- /*
- * Test that both implement either serializable or externalizable.
- */
-
- // The next check is more generic, since it covers the
- // Proxy case, the JDK 1.3 serialization code has
- // both checks
- //if ((serializable && localClassDesc.externalizable) ||
- // (externalizable && localClassDesc.serializable))
- // throw new InvalidClassException(localCl.getName(),
- // "Serializable is incompatible with Externalizable");
-
- if ((serializable != localClassDesc.serializable) ||
- (externalizable != localClassDesc.externalizable) ||
- (!serializable && !externalizable))
-
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "Serialization incompatible with Externalization");
-
- /* Set up the reflected Fields in the class where the value of each
- * field in this descriptor should be stored.
- * Each field in this ObjectStreamClass (the source) is located (by
- * name) in the ObjectStreamClass of the class(the destination).
- * In the usual (non-versioned case) the field is in both
- * descriptors and the types match, so the reflected Field is copied.
- * If the type does not match, a InvalidClass exception is thrown.
- * If the field is not present in the class, the reflected Field
- * remains null so the field will be read but discarded.
- * If extra fields are present in the class they are ignored. Their
- * values will be set to the default value by the object allocator.
- * Both the src and dest field list are sorted by type and name.
- */
-
- ObjectStreamField[] destfield =
- (ObjectStreamField[])localClassDesc.fields;
- ObjectStreamField[] srcfield =
- (ObjectStreamField[])fields;
-
- int j = 0;
- nextsrc:
- for (int i = 0; i < srcfield.length; i++ ) {
- /* Find this field in the dest*/
- for (int k = j; k < destfield.length; k++) {
- if (srcfield[i].getName().equals(destfield[k].getName())) {
- /* found match */
- if (srcfield[i].isPrimitive() &&
- !srcfield[i].typeEquals(destfield[k])) {
- // XXX I18N, logging needed
- throw new InvalidClassException(cl.getName(),
- "The type of field " +
- srcfield[i].getName() +
- " of class " + name +
- " is incompatible.");
- }
-
- /* Skip over any fields in the dest that are not in the src */
- j = k;
-
- srcfield[i].setField(destfield[j].getField());
- // go on to the next source field
- continue nextsrc;
- }
- }
- }
-
- /* Set up field data for use while reading from the input stream. */
- computeFieldInfo();
-
- /* Remember the class this represents */
- ofClass = cl;
-
- /* get the cache of these methods from the local class
- * implementation.
- */
- readObjectMethod = localClassDesc.readObjectMethod;
- readResolveObjectMethod = localClassDesc.readResolveObjectMethod;
- }
-
- /* Compare the base class names of streamName and localName.
- *
- * @return Return true iff the base class name compare.
- * @param streamName Fully qualified class name.
- * @param localName Fully qualified class name.
- * @param pkgSeparator class names use either '.' or '/'.
- *
- * Only compare base class name to allow package renaming.
- */
- static boolean compareClassNames(String streamName,
- String localName,
- char pkgSeparator) {
- /* compare the class names, stripping off package names. */
- int streamNameIndex = streamName.lastIndexOf(pkgSeparator);
- if (streamNameIndex < 0)
- streamNameIndex = 0;
-
- int localNameIndex = localName.lastIndexOf(pkgSeparator);
- if (localNameIndex < 0)
- localNameIndex = 0;
-
- return streamName.regionMatches(false, streamNameIndex,
- localName, localNameIndex,
- streamName.length() - streamNameIndex);
- }
-
- /*
- * Compare the types of two class descriptors.
- * They match if they have the same class name and suid
- */
- final boolean typeEquals(ObjectStreamClass other) {
- return (suid == other.suid) &&
- compareClassNames(name, other.name, '.');
- }
-
- /*
- * Return the superclass descriptor of this descriptor.
- */
- final void setSuperclass(ObjectStreamClass s) {
- superclass = s;
- }
-
- /*
- * Return the superclass descriptor of this descriptor.
- */
- final ObjectStreamClass getSuperclass() {
- return superclass;
- }
-
- /**
- * Return whether the class has a readObject method
- */
- final boolean hasReadObject() {
- return readObjectMethod != null;
- }
-
- /*
- * Return whether the class has a writeObject method
- */
- final boolean hasWriteObject() {
- return writeObjectMethod != null ;
- }
-
- /**
- * Returns true if represented class is serializable or externalizable and
- * defines a conformant writeReplace method. Otherwise, returns false.
- */
- boolean hasWriteReplaceMethod() {
- return (writeReplaceObjectMethod != null);
- }
-
- /**
- * Returns true if represented class is serializable or externalizable and
- * defines a conformant readResolve method. Otherwise, returns false.
- */
- boolean hasReadResolveMethod() {
- return (readResolveObjectMethod != null);
- }
-
- /**
- * Returns when or not this class should be custom
- * marshaled (use chunking). This should happen if
- * it is Externalizable OR if it or
- * any of its superclasses has a writeObject method,
- */
- final boolean isCustomMarshaled() {
- return (hasWriteObject() || isExternalizable())
- || (superclass != null && superclass.isCustomMarshaled());
- }
-
- /*
- * Return true if all instances of 'this' Externalizable class
- * are written in block-data mode from the stream that 'this' was read
- * from.
- *
- * In JDK 1.1, all Externalizable instances are not written
- * in block-data mode.
- * In JDK 1.2, all Externalizable instances, by default, are written
- * in block-data mode and the Externalizable instance is terminated with
- * tag TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable
- * instances.
- *
- * IMPLEMENTATION NOTE:
- * This should have been a mode maintained per stream; however,
- * for compatibility reasons, it was only possible to record
- * this change per class. All Externalizable classes within
- * a given stream should either have this mode enabled or
- * disabled. This is enforced by not allowing the PROTOCOL_VERSION
- * of a stream to he changed after any objects have been written.
- *
- * @see ObjectOutputStream#useProtocolVersion
- * @see ObjectStreamConstants#PROTOCOL_VERSION_1
- * @see ObjectStreamConstants#PROTOCOL_VERSION_2
- *
- * @since JDK 1.2
- */
- boolean hasExternalizableBlockDataMode() {
- return hasExternalizableBlockData;
- }
-
- /**
- * Creates a new instance of the represented class. If the class is
- * externalizable, invokes its public no-arg constructor; otherwise, if the
- * class is serializable, invokes the no-arg constructor of the first
- * non-serializable superclass. Throws UnsupportedOperationException if
- * this class descriptor is not associated with a class, if the associated
- * class is non-serializable or if the appropriate no-arg constructor is
- * inaccessible/unavailable.
- */
- Object newInstance()
- throws InstantiationException, InvocationTargetException,
- UnsupportedOperationException
- {
- if (cons != null) {
- try {
- return bridge.newInstanceForSerialization(cons, domains);
- } catch (IllegalAccessException ex) {
- // should not occur, as access checks have been suppressed
- InternalError ie = new InternalError();
- ie.initCause( ex ) ;
- throw ie ;
- }
- } else {
- throw new UnsupportedOperationException("no constructor for " + ofClass);
- }
- }
-
- /**
- * Returns public no-arg constructor of given class, or null if none found.
- * Access checks are disabled on the returned constructor (if any), since
- * the defining class may still be non-public.
- */
- private static Constructor> getExternalizableConstructor(Class> cl) {
- return bridge.newConstructorForExternalization(cl);
- }
-
- /**
- * Returns subclass-accessible no-arg constructor of first non-serializable
- * superclass, or null if none found. Access checks are disabled on the
- * returned constructor (if any).
- */
- private static Constructor> getSerializableConstructor(Class> cl) {
- return bridge.newConstructorForSerialization(cl);
- }
-
- /*
- * Return the ObjectStreamClass of the local class this one is based on.
- */
- final ObjectStreamClass localClassDescriptor() {
- return localClassDesc;
- }
-
- /*
- * Get the Serializability of the class.
- */
- boolean isSerializable() {
- return serializable;
- }
-
- /*
- * Get the externalizability of the class.
- */
- boolean isExternalizable() {
- return externalizable;
- }
-
- boolean isNonSerializable() {
- return ! (externalizable || serializable);
- }
-
- /*
- * Calculate the size of the array needed to store primitive data and the
- * number of object references to read when reading from the input
- * stream.
- */
- private void computeFieldInfo() {
- primBytes = 0;
- objFields = 0;
-
- for (int i = 0; i < fields.length; i++ ) {
- switch (fields[i].getTypeCode()) {
- case 'B':
- case 'Z':
- primBytes += 1;
- break;
- case 'C':
- case 'S':
- primBytes += 2;
- break;
-
- case 'I':
- case 'F':
- primBytes += 4;
- break;
- case 'J':
- case 'D' :
- primBytes += 8;
- break;
-
- case 'L':
- case '[':
- objFields += 1;
- break;
- }
- }
- }
-
- private static void msg( String str )
- {
- System.out.println( str ) ;
- }
-
- /* JDK 1.5 has introduced some new modifier bits (such as SYNTHETIC)
- * that can affect the SVUID computation (see bug 4897937). These bits
- * must be ignored, as otherwise interoperability with ORBs in earlier
- * JDK versions can be compromised. I am adding these masks for this
- * purpose as discussed in the CCC for this bug (see http://ccc.sfbay/4897937).
- */
-
- public static final int CLASS_MASK = Modifier.PUBLIC | Modifier.FINAL |
- Modifier.INTERFACE | Modifier.ABSTRACT ;
- public static final int FIELD_MASK = Modifier.PUBLIC | Modifier.PRIVATE |
- Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL |
- Modifier.TRANSIENT | Modifier.VOLATILE ;
- public static final int METHOD_MASK = Modifier.PUBLIC | Modifier.PRIVATE |
- Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL |
- Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT |
- Modifier.STRICT ;
-
- /*
- * Compute a hash for the specified class. Incrementally add
- * items to the hash accumulating in the digest stream.
- * Fold the hash into a long. Use the SHA secure hash function.
- */
- private static long _computeSerialVersionUID(Class> cl) {
- if (DEBUG_SVUID)
- msg( "Computing SerialVersionUID for " + cl ) ;
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + cl.getName() + "\" )" ) ;
- data.writeUTF(cl.getName());
-
- int classaccess = cl.getModifiers();
- classaccess &= (Modifier.PUBLIC | Modifier.FINAL |
- Modifier.INTERFACE | Modifier.ABSTRACT);
-
- /* Workaround for javac bug that only set ABSTRACT for
- * interfaces if the interface had some methods.
- * The ABSTRACT bit reflects that the number of methods > 0.
- * This is required so correct hashes can be computed
- * for existing class files.
- * Previously this hack was previously present in the VM.
- */
- Method[] method = cl.getDeclaredMethods();
- if ((classaccess & Modifier.INTERFACE) != 0) {
- classaccess &= (~Modifier.ABSTRACT);
- if (method.length > 0) {
- classaccess |= Modifier.ABSTRACT;
- }
- }
-
- // Mask out any post-1.4 attributes
- classaccess &= CLASS_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + classaccess + " ) " ) ;
- data.writeInt(classaccess);
-
- /*
- * Get the list of interfaces supported,
- * Accumulate their names their names in Lexical order
- * and add them to the hash
- */
- if (!cl.isArray()) {
- /* In 1.2fcs, getInterfaces() was modified to return
- * {java.lang.Cloneable, java.io.Serializable} when
- * called on array classes. These values would upset
- * the computation of the hash, so we explicitly omit
- * them from its computation.
- */
-
- Class> interfaces[] = cl.getInterfaces();
- Arrays.sort(interfaces, compareClassByName);
-
- for (int i = 0; i < interfaces.length; i++) {
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + interfaces[i].getName() + "\" ) " ) ;
- data.writeUTF(interfaces[i].getName());
- }
- }
-
- /* Sort the field names to get a deterministic order */
- Field[] field = cl.getDeclaredFields();
- Arrays.sort(field, compareMemberByName);
-
- for (int i = 0; i < field.length; i++) {
- Field f = field[i];
-
- /* Include in the hash all fields except those that are
- * private transient and private static.
- */
- int m = f.getModifiers();
- if (Modifier.isPrivate(m) &&
- (Modifier.isTransient(m) || Modifier.isStatic(m)))
- continue;
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + f.getName() + "\" ) " ) ;
- data.writeUTF(f.getName());
-
- // Mask out any post-1.4 bits
- m &= FIELD_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + m + " ) " ) ;
- data.writeInt(m);
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + getSignature(f.getType()) + "\" ) " ) ;
- data.writeUTF(getSignature(f.getType()));
- }
-
- if (hasStaticInitializer(cl)) {
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"\" ) " ) ;
- data.writeUTF("");
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + Modifier.STATIC + " )" ) ;
- data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"()V\" )" ) ;
- data.writeUTF("()V");
- }
-
- /*
- * Get the list of constructors including name and signature
- * Sort lexically, add all except the private constructors
- * to the hash with their access flags
- */
-
- MethodSignature[] constructors =
- MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors());
- for (int i = 0; i < constructors.length; i++) {
- MethodSignature c = constructors[i];
- String mname = "";
- String desc = c.signature;
- desc = desc.replace('/', '.');
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + mname + "\" )" ) ;
- data.writeUTF(mname);
-
- // mask out post-1.4 modifiers
- int modifier = c.member.getModifiers() & METHOD_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + modifier + " ) " ) ;
- data.writeInt( modifier ) ;
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + desc+ "\" )" ) ;
- data.writeUTF(desc);
- }
-
- /* Include in the hash all methods except those that are
- * private transient and private static.
- */
- MethodSignature[] methods =
- MethodSignature.removePrivateAndSort(method);
- for (int i = 0; i < methods.length; i++ ) {
- MethodSignature m = methods[i];
- String desc = m.signature;
- desc = desc.replace('/', '.');
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + m.member.getName()+ "\" )" ) ;
- data.writeUTF(m.member.getName());
-
- // mask out post-1.4 modifiers
- int modifier = m.member.getModifiers() & METHOD_MASK ;
-
- if (DEBUG_SVUID)
- msg( "\twriteInt( " + modifier + " ) " ) ;
- data.writeInt( modifier ) ;
-
- if (DEBUG_SVUID)
- msg( "\twriteUTF( \"" + desc + "\" )" ) ;
- data.writeUTF(desc);
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- for (int i = 0; i < Math.min(8, hasharray.length); i++) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- SecurityException se = new SecurityException() ;
- se.initCause( complain ) ;
- throw se ;
- }
-
- return h;
- }
-
- private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class> cl) {
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
-
- if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
- (cl.isInterface())){
- return 0;
- }
-
- if (java.io.Externalizable.class.isAssignableFrom(cl)) {
- return 1;
- }
-
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
- // Get SUID of parent
- Class> parent = cl.getSuperclass();
- if ((parent != null))
- // SerialBug 1; acc. to spec the one for
- // java.lang.object
- // should be computed and put
- // && (parent != java.lang.Object.class))
- {
- //data.writeLong(computeSerialVersionUID(null,parent));
- data.writeLong(computeStructuralUID(lookup(parent), parent));
- }
-
- if (osc.hasWriteObject())
- data.writeInt(2);
- else
- data.writeInt(1);
-
- // CORBA formal 00-11-03 10.6.2: For each field of the
- // class that is mapped to IDL, sorted lexicographically
- // by Java field name, in increasing order...
- ObjectStreamField[] field = osc.getFields();
- if (field.length > 1) {
- Arrays.sort(field, compareObjStrFieldsByName);
- }
-
- // ...Java field name in UTF encoding, field
- // descriptor, as defined by the JVM spec...
- for (int i = 0; i < field.length; i++) {
- data.writeUTF(field[i].getName());
- data.writeUTF(field[i].getSignature());
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- // int minimum = Math.min(8, hasharray.length);
- // SerialBug 3: SHA computation is wrong; for loop reversed
- //for (int i = minimum; i > 0; i--)
- for (int i = 0; i < Math.min(8, hasharray.length); i++) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- SecurityException se = new SecurityException();
- se.initCause( complain ) ;
- throw se ;
- }
- return h;
- }
-
- /**
- * Compute the JVM signature for the class.
- */
- static String getSignature(Class> clazz) {
- String type = null;
- if (clazz.isArray()) {
- Class> cl = clazz;
- int dimensions = 0;
- while (cl.isArray()) {
- dimensions++;
- cl = cl.getComponentType();
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < dimensions; i++) {
- sb.append("[");
- }
- sb.append(getSignature(cl));
- type = sb.toString();
- } else if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = "I";
- } else if (clazz == Byte.TYPE) {
- type = "B";
- } else if (clazz == Long.TYPE) {
- type = "J";
- } else if (clazz == Float.TYPE) {
- type = "F";
- } else if (clazz == Double.TYPE) {
- type = "D";
- } else if (clazz == Short.TYPE) {
- type = "S";
- } else if (clazz == Character.TYPE) {
- type = "C";
- } else if (clazz == Boolean.TYPE) {
- type = "Z";
- } else if (clazz == Void.TYPE) {
- type = "V";
- }
- } else {
- type = "L" + clazz.getName().replace('.', '/') + ";";
- }
- return type;
- }
-
- /*
- * Compute the JVM method descriptor for the method.
- */
- static String getSignature(Method meth) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class>[] params = meth.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")");
- sb.append(getSignature(meth.getReturnType()));
- return sb.toString();
- }
-
- /*
- * Compute the JVM constructor descriptor for the constructor.
- */
- static String getSignature(Constructor cons) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class>[] params = cons.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")V");
- return sb.toString();
- }
-
- /*
- * Cache of Class -> ClassDescriptor Mappings.
- */
- static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61];
-
- /*
- * findDescriptorFor a Class. This looks in the cache for a
- * mapping from Class -> ObjectStreamClass mappings. The hashCode
- * of the Class is used for the lookup since the Class is the key.
- * The entries are extended from java.lang.ref.SoftReference so the
- * gc will be able to free them if needed.
- */
- private static ObjectStreamClass findDescriptorFor(Class> cl) {
-
- int hash = cl.hashCode();
- int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
- ObjectStreamClassEntry e;
- ObjectStreamClassEntry prev;
-
- /* Free any initial entries whose refs have been cleared */
- while ((e = descriptorFor[index]) != null && e.get() == null) {
- descriptorFor[index] = e.next;
- }
-
- /* Traverse the chain looking for a descriptor with ofClass == cl.
- * unlink entries that are unresolved.
- */
- prev = e;
- while (e != null ) {
- ObjectStreamClass desc = (ObjectStreamClass)(e.get());
- if (desc == null) {
- // This entry has been cleared, unlink it
- prev.next = e.next;
- } else {
- if (desc.ofClass == cl)
- return desc;
- prev = e;
- }
- e = e.next;
- }
- return null;
- }
-
- /*
- * insertDescriptorFor a Class -> ObjectStreamClass mapping.
- */
- private static void insertDescriptorFor(ObjectStreamClass desc) {
- // Make sure not already present
- if (findDescriptorFor(desc.ofClass) != null) {
- return;
- }
-
- int hash = desc.ofClass.hashCode();
- int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
- ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc);
- e.next = descriptorFor[index];
- descriptorFor[index] = e;
- }
-
- private static Field[] getDeclaredFields(final Class> clz) {
- return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return clz.getDeclaredFields();
- }
- });
- }
-
-
- /*
- * The name of this descriptor
- */
- private String name;
-
- /*
- * The descriptor of the supertype.
- */
- private ObjectStreamClass superclass;
-
- /*
- * Flags for Serializable and Externalizable.
- */
- private boolean serializable;
- private boolean externalizable;
-
- /*
- * Array of persistent fields of this class, sorted by
- * type and name.
- */
- private ObjectStreamField[] fields;
-
- /*
- * Class that is a descriptor for in this virtual machine.
- */
- private Class> ofClass;
-
- /*
- * True if descriptor for a proxy class.
- */
- boolean forProxyClass;
-
-
- /*
- * SerialVersionUID for this class.
- */
- private long suid = kDefaultUID;
- private String suidStr = null;
-
- /*
- * Actual (computed) SerialVersionUID for this class.
- */
- private long actualSuid = kDefaultUID;
- private String actualSuidStr = null;
-
- /*
- * The total number of bytes of primitive fields.
- * The total number of object fields.
- */
- int primBytes;
- int objFields;
-
- /**
- * Flag indicating whether or not this instance has
- * successfully completed initialization. This is to
- * try to fix bug 4373844. Working to move to
- * reusing java.io.ObjectStreamClass for JDK 1.5.
- */
- private boolean initialized = false;
-
- /* Internal lock object. */
- private Object lock = new Object();
-
- /* In JDK 1.1, external data was not written in block mode.
- * As of JDK 1.2, external data is written in block data mode. This
- * flag enables JDK 1.2 to be able to read JDK 1.1 written external data.
- *
- * @since JDK 1.2
- */
- private boolean hasExternalizableBlockData;
- private transient MethodHandle writeObjectMethod;
- private transient MethodHandle readObjectMethod;
- private transient MethodHandle writeReplaceObjectMethod;
- private transient MethodHandle readResolveObjectMethod;
- private transient Constructor> cons;
- private transient ProtectionDomain[] domains;
-
- /**
- * Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a
- * stream format version 2 which puts a fake valuetype around
- * a Serializable's optional custom data. This valuetype has
- * a special repository ID made from the Serializable's
- * information which we are pre-computing and
- * storing here.
- */
- private String rmiiiopOptionalDataRepId = null;
-
- /*
- * ObjectStreamClass that this one was built from.
- */
- private ObjectStreamClass localClassDesc;
-
- /**
- * Returns true if the given class defines a static initializer method,
- * false otherwise.
- */
- private static boolean hasStaticInitializer(Class> cl) {
- return bridge.hasStaticInitializerForSerialization(cl);
- }
-
-
- /** use serialVersionUID from JDK 1.1. for interoperability */
- private static final long serialVersionUID = -6120832682080437368L;
-
- /**
- * Set serialPersistentFields of a Serializable class to this value to
- * denote that the class has no Serializable fields.
- */
- public static final ObjectStreamField[] NO_FIELDS =
- new ObjectStreamField[0];
-
- /*
- * Entries held in the Cache of known ObjectStreamClass objects.
- * Entries are chained together with the same hash value (modulo array size).
- */
- private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference
- {
- ObjectStreamClassEntry(ObjectStreamClass c) {
- //super(c);
- this.c = c;
- }
- ObjectStreamClassEntry next;
-
- public Object get()
- {
- return c;
- }
- private ObjectStreamClass c;
- }
-
- /*
- * Comparator object for Classes and Interfaces
- */
- private static Comparator compareClassByName =
- new CompareClassByName();
-
- private static class CompareClassByName implements Comparator {
- public int compare(Object o1, Object o2) {
- Class> c1 = (Class)o1;
- Class> c2 = (Class)o2;
- return (c1.getName()).compareTo(c2.getName());
- }
- }
-
- /**
- * Comparator for ObjectStreamFields by name
- */
- private final static Comparator compareObjStrFieldsByName
- = new CompareObjStrFieldsByName();
-
- private static class CompareObjStrFieldsByName implements Comparator {
- public int compare(Object o1, Object o2) {
- ObjectStreamField osf1 = (ObjectStreamField)o1;
- ObjectStreamField osf2 = (ObjectStreamField)o2;
-
- return osf1.getName().compareTo(osf2.getName());
- }
- }
-
- /*
- * Comparator object for Members, Fields, and Methods
- */
- private static Comparator compareMemberByName =
- new CompareMemberByName();
-
- private static class CompareMemberByName implements Comparator {
- public int compare(Object o1, Object o2) {
- String s1 = ((Member)o1).getName();
- String s2 = ((Member)o2).getName();
-
- if (o1 instanceof Method) {
- s1 += getSignature((Method)o1);
- s2 += getSignature((Method)o2);
- } else if (o1 instanceof Constructor) {
- s1 += getSignature((Constructor)o1);
- s2 += getSignature((Constructor)o2);
- }
- return s1.compareTo(s2);
- }
- }
-
- /* It is expensive to recompute a method or constructor signature
- many times, so compute it only once using this data structure. */
- private static class MethodSignature implements Comparator {
- Member member;
- String signature; // cached parameter signature
-
- /* Given an array of Method or Constructor members,
- return a sorted array of the non-private members.*/
- /* A better implementation would be to implement the returned data
- structure as an insertion sorted link list.*/
- static MethodSignature[] removePrivateAndSort(Member[] m) {
- int numNonPrivate = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- numNonPrivate++;
- }
- }
- MethodSignature[] cm = new MethodSignature[numNonPrivate];
- int cmi = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- cm[cmi] = new MethodSignature(m[i]);
- cmi++;
- }
- }
- if (cmi > 0)
- Arrays.sort(cm, cm[0]);
- return cm;
- }
-
- /* Assumes that o1 and o2 are either both methods
- or both constructors.*/
- public int compare(Object o1, Object o2) {
- /* Arrays.sort calls compare when o1 and o2 are equal.*/
- if (o1 == o2)
- return 0;
-
- MethodSignature c1 = (MethodSignature)o1;
- MethodSignature c2 = (MethodSignature)o2;
-
- int result;
- if (isConstructor()) {
- result = c1.signature.compareTo(c2.signature);
- } else { // is a Method.
- result = c1.member.getName().compareTo(c2.member.getName());
- if (result == 0)
- result = c1.signature.compareTo(c2.signature);
- }
- return result;
- }
-
- final private boolean isConstructor() {
- return member instanceof Constructor;
- }
- private MethodSignature(Member m) {
- member = m;
- if (isConstructor()) {
- signature = ObjectStreamClass.getSignature((Constructor)m);
- } else {
- signature = ObjectStreamClass.getSignature((Method)m);
- }
- }
- }
-
- /**
- * Returns non-static, non-abstract method with given signature provided it
- * is defined by or accessible (via inheritance) by the given class, or
- * null if no match found. Access checks are disabled on the returned
- * method (if any).
- *
- * Copied from the Merlin java.io.ObjectStreamClass.
- */
- private static Method getInheritableMethod(Class> cl, String name,
- Class>[] argTypes,
- Class> returnType)
- {
- Method meth = null;
- Class> defCl = cl;
- while (defCl != null) {
- try {
- meth = defCl.getDeclaredMethod(name, argTypes);
- break;
- } catch (NoSuchMethodException ex) {
- defCl = defCl.getSuperclass();
- }
- }
-
- if ((meth == null) || (meth.getReturnType() != returnType)) {
- return null;
- }
- int mods = meth.getModifiers();
- if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
- return null;
- } else if ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) {
- return meth;
- } else if ((mods & Modifier.PRIVATE) != 0) {
- return (cl == defCl) ? meth : null;
- } else {
- return packageEquals(cl, defCl) ? meth : null;
- }
- }
-
- /**
- * Returns true if classes are defined in the same package, false
- * otherwise.
- *
- * Copied from the Merlin java.io.ObjectStreamClass.
- */
- private static boolean packageEquals(Class> cl1, Class> cl2) {
- Package pkg1 = cl1.getPackage(), pkg2 = cl2.getPackage();
- return ((pkg1 == pkg2) || ((pkg1 != null) && (pkg1.equals(pkg2))));
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java 2018-01-30 20:17:27.000000000 -0500
+++ /dev/null 2018-01-30 20:17:27.000000000 -0500
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedAction;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-
-
-// This file contains some utility methods that
-// originally were in the OSC in the RMI-IIOP
-// code delivered by IBM. They don't make
-// sense there, and hence have been put
-// here so that they can be factored out in
-// an attempt to eliminate redundant code from
-// ObjectStreamClass. Eventually the goal is
-// to move to java.io.ObjectStreamClass, and
-// java.io.ObjectStreamField.
-
-// class is package private for security reasons
-
-class ObjectStreamClassCorbaExt {
-
- /**
- * Return true, iff,
- *
- * 1. 'cl' is an interface, and
- * 2. 'cl' and all its ancestors do not implement java.rmi.Remote, and
- * 3. if 'cl' has no methods (including those of its ancestors), or,
- * if all the methods (including those of its ancestors) throw an
- * exception that is atleast java.rmi.RemoteException or one of
- * java.rmi.RemoteException's super classes.
- */
- static final boolean isAbstractInterface(Class cl) {
- if (!cl.isInterface() || // #1
- java.rmi.Remote.class.isAssignableFrom(cl)) { // #2
- return false;
- }
- Method[] methods = cl.getMethods();
- for (int i = 0; i < methods.length; i++) {
- Class exceptions[] = methods[i].getExceptionTypes();
- boolean exceptionMatch = false;
- for (int j = 0; (j < exceptions.length) && !exceptionMatch; j++) {
- if ((java.rmi.RemoteException.class == exceptions[j]) ||
- (java.lang.Throwable.class == exceptions[j]) ||
- (java.lang.Exception.class == exceptions[j]) ||
- (java.io.IOException.class == exceptions[j])) {
- exceptionMatch = true;
- }
- }
- if (!exceptionMatch) {
- return false;
- }
- }
- return true;
- }
-
- /*
- * Returns TRUE if type is 'any'.
- */
- static final boolean isAny(String typeString) {
-
- int isAny = 0;
-
- if ( (typeString != null) &&
- (typeString.equals("Ljava/lang/Object;") ||
- typeString.equals("Ljava/io/Serializable;") ||
- typeString.equals("Ljava/io/Externalizable;")) )
- isAny = 1;
-
- return (isAny==1);
- }
-
- private static final Method[] getDeclaredMethods(final Class clz) {
- return (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return clz.getDeclaredMethods();
- }
- });
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java 2018-01-30 20:17:27.000000000 -0500
+++ /dev/null 2018-01-30 20:17:27.000000000 -0500
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.lang.reflect.Field;
-import java.lang.Comparable;
-import java.util.Hashtable;
-
-import sun.corba.Bridge ;
-import java.security.AccessController ;
-import java.security.PrivilegedAction ;
-
-/**
- * A description of a field in a serializable class.
- * A array of these is used to declare the persistent fields of
- * a class.
- *
- */
-public class ObjectStreamField implements Comparable
-{
- private static final Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return Bridge.get() ;
- }
- }
- ) ;
-
- /**
- * Create a named field with the specified type.
- */
- ObjectStreamField(String n, Class clazz) {
- name = n;
- this.clazz = clazz;
-
- // Compute the typecode for easy switching
- if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = 'I';
- } else if (clazz == Byte.TYPE) {
- type = 'B';
- } else if (clazz == Long.TYPE) {
- type = 'J';
- } else if (clazz == Float.TYPE) {
- type = 'F';
- } else if (clazz == Double.TYPE) {
- type = 'D';
- } else if (clazz == Short.TYPE) {
- type = 'S';
- } else if (clazz == Character.TYPE) {
- type = 'C';
- } else if (clazz == Boolean.TYPE) {
- type = 'Z';
- }
- } else if (clazz.isArray()) {
- type = '[';
- typeString = ObjectStreamClass.getSignature(clazz);
- } else {
- type = 'L';
- typeString = ObjectStreamClass.getSignature(clazz);
- }
-
- if (typeString != null)
- signature = typeString;
- else
- signature = String.valueOf(type);
-
- }
-
- ObjectStreamField(Field field) {
- this(field.getName(), field.getType());
- setField( field ) ;
- }
-
- /**
- * Create an ObjectStreamField containing a reflected Field.
- */
- ObjectStreamField(String n, char t, Field f, String ts)
- {
- name = n;
- type = t;
- setField( f ) ;
- typeString = ts;
-
- if (typeString != null)
- signature = typeString;
- else
- signature = String.valueOf(type);
-
- }
-
- /**
- * Get the name of this field.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the type of the field.
- */
- public Class getType() {
- if (clazz != null)
- return clazz;
- switch (type) {
- case 'B': clazz = Byte.TYPE;
- break;
- case 'C': clazz = Character.TYPE;
- break;
- case 'S': clazz = Short.TYPE;
- break;
- case 'I': clazz = Integer.TYPE;
- break;
- case 'J': clazz = Long.TYPE;
- break;
- case 'F': clazz = Float.TYPE;
- break;
- case 'D': clazz = Double.TYPE;
- break;
- case 'Z': clazz = Boolean.TYPE;
- break;
- case '[':
- case 'L':
- clazz = Object.class;
- break;
- }
-
- return clazz;
- }
-
- public char getTypeCode() {
- return type;
- }
-
- public String getTypeString() {
- return typeString;
- }
-
- Field getField() {
- return field;
- }
-
- void setField(Field field) {
- this.field = field;
- this.fieldID = bridge.objectFieldOffset( field ) ;
- }
-
- /*
- * Default constructor creates an empty field.
- * Usually used just to get to the sort functions.
- */
- ObjectStreamField() {
- }
-
- /**
- * test if this field is a primitive or not.
- */
- public boolean isPrimitive() {
- return (type != '[' && type != 'L');
- }
-
- /**
- * Compare this with another ObjectStreamField.
- * return -1 if this is smaller, 0 if equal, 1 if greater
- * types that are primitives are "smaller" than objects.
- * if equal, the names are compared.
- */
- public int compareTo(Object o) {
- ObjectStreamField f2 = (ObjectStreamField)o;
- boolean thisprim = (this.typeString == null);
- boolean otherprim = (f2.typeString == null);
-
- if (thisprim != otherprim) {
- return (thisprim ? -1 : 1);
- }
- return this.name.compareTo(f2.name);
- }
-
- /**
- * Compare the types of two class descriptors.
- * The match if they have the same primitive types.
- * or if they are both objects and the object types match.
- */
- public boolean typeEquals(ObjectStreamField other) {
- if (other == null || type != other.type)
- return false;
-
- /* Return true if the primitive types matched */
- if (typeString == null && other.typeString == null)
- return true;
-
- return ObjectStreamClass.compareClassNames(typeString,
- other.typeString,
- '/');
- }
-
- /* Returns the signature of the Field.
- *
- */
- public String getSignature() {
-
- return signature;
-
- }
-
- /**
- * Return a string describing this field.
- */
- public String toString() {
- if (typeString != null)
- return typeString + " " + name;
- else
- return type + " " + name;
- }
-
- public Class getClazz() {
- return clazz;
- }
-
- /* Returns the Field ID
- *
- */
- public long getFieldID() {
- return fieldID ;
- }
-
- private String name; // the name of the field
- private char type; // type first byte of the type signature
- private Field field; // Reflected field
- private String typeString; // iff object, typename
- private Class clazz; // the type of this field, if has been resolved
-
- // the next 2 things are RMI-IIOP specific, it can be easily
- // removed, if we can figure out all place where there are dependencies
- // to this. Signature is esentially equal to typestring. Then
- // essentially we can use the java.io.ObjectStreamField as such.
-
- private String signature; // the signature of the field
- private long fieldID = Bridge.INVALID_FIELD_OFFSET ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java 2018-01-30 20:17:28.000000000 -0500
+++ /dev/null 2018-01-30 20:17:28.000000000 -0500
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-/**
- * Unexpected data appeared in an ObjectInputStream trying to read
- * an Object.
- * This exception occurs when the stream contains primitive data
- * instead of the object expected by readObject.
- * The eof flag in the exception is true to indicate that no more
- * primitive data is available.
- * The count field contains the number of bytes available to read.
- *
- * @author unascribed
- * @since JDK1.1
- */
-public class OptionalDataException extends java.io.IOException {
- /*
- * Create an OptionalDataException
with a length.
- */
- OptionalDataException(int len) {
- eof = false;
- length = len;
- }
-
- /*
- * Create an OptionalDataException
signifing no
- * more primitive data is available.
- */
- OptionalDataException(boolean end) {
- length = 0;
- eof = end;
- }
-
- /**
- * The number of bytes of primitive data available to be read
- * in the current buffer.
- */
- public int length;
-
- /**
- * True if there is no more data in the buffered part of the stream.
- */
- public boolean eof;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java 2018-01-30 20:17:29.000000000 -0500
+++ /dev/null 2018-01-30 20:17:29.000000000 -0500
@@ -1,318 +0,0 @@
-/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import java.io.IOException;
-import java.io.NotActiveException;
-import java.io.OutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectOutput;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.omg.CORBA.INTERNAL;
-
-public abstract class OutputStreamHook extends ObjectOutputStream
-{
- private HookPutFields putFields = null;
-
- /**
- * Since ObjectOutputStream.PutField methods specify no exceptions,
- * we are not checking for null parameters on put methods.
- */
- private class HookPutFields extends ObjectOutputStream.PutField
- {
- private Map fields = new HashMap<>();
-
- /**
- * Put the value of the named boolean field into the persistent field.
- */
- public void put(String name, boolean value){
- fields.put(name, new Boolean(value));
- }
-
- /**
- * Put the value of the named char field into the persistent fields.
- */
- public void put(String name, char value){
- fields.put(name, new Character(value));
- }
-
- /**
- * Put the value of the named byte field into the persistent fields.
- */
- public void put(String name, byte value){
- fields.put(name, new Byte(value));
- }
-
- /**
- * Put the value of the named short field into the persistent fields.
- */
- public void put(String name, short value){
- fields.put(name, new Short(value));
- }
-
- /**
- * Put the value of the named int field into the persistent fields.
- */
- public void put(String name, int value){
- fields.put(name, new Integer(value));
- }
-
- /**
- * Put the value of the named long field into the persistent fields.
- */
- public void put(String name, long value){
- fields.put(name, new Long(value));
- }
-
- /**
- * Put the value of the named float field into the persistent fields.
- *
- */
- public void put(String name, float value){
- fields.put(name, new Float(value));
- }
-
- /**
- * Put the value of the named double field into the persistent field.
- */
- public void put(String name, double value){
- fields.put(name, new Double(value));
- }
-
- /**
- * Put the value of the named Object field into the persistent field.
- */
- public void put(String name, Object value){
- fields.put(name, value);
- }
-
- /**
- * Write the data and fields to the specified ObjectOutput stream.
- */
- public void write(ObjectOutput out) throws IOException {
- OutputStreamHook hook = (OutputStreamHook)out;
-
- ObjectStreamField[] osfields = hook.getFieldsNoCopy();
-
- // Write the fields to the stream in the order
- // provided by the ObjectStreamClass. (They should
- // be sorted appropriately already.)
- for (int i = 0; i < osfields.length; i++) {
-
- Object value = fields.get(osfields[i].getName());
-
- hook.writeField(osfields[i], value);
- }
- }
- }
-
- abstract void writeField(ObjectStreamField field, Object value) throws IOException;
-
- public OutputStreamHook()
- throws java.io.IOException {
- super();
- }
-
- public void defaultWriteObject() throws IOException {
-
- writeObjectState.defaultWriteObject(this);
-
- defaultWriteObjectDelegate();
- }
-
- public abstract void defaultWriteObjectDelegate();
-
- public ObjectOutputStream.PutField putFields()
- throws IOException {
- if (putFields == null) {
- putFields = new HookPutFields();
- }
- return putFields;
- }
-
- // Stream format version, saved/restored during recursive calls
- protected byte streamFormatVersion = 1;
-
- // Return the stream format version currently being used
- // to serialize an object
- public byte getStreamFormatVersion() {
- return streamFormatVersion;
- }
-
- abstract ObjectStreamField[] getFieldsNoCopy();
-
- // User uses PutFields to simulate default data.
- // See java.io.ObjectOutputStream.PutFields
- public void writeFields()
- throws IOException {
-
- writeObjectState.defaultWriteObject(this);
- if (putFields != null) {
- putFields.write(this);
- } else {
- throw new NotActiveException("no current PutField object");
- }
- }
-
- abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
-
- protected abstract void beginOptionalCustomData();
-
-
- // The following is a State pattern implementation of what
- // should be done when a Serializable has a
- // writeObject method. This was especially necessary for
- // RMI-IIOP stream format version 2. Please see the
- // state diagrams in the docs directory of the workspace.
-
- protected WriteObjectState writeObjectState = NOT_IN_WRITE_OBJECT;
-
- protected void setState(WriteObjectState newState) {
- writeObjectState = newState;
- }
-
- // Description of possible actions
- protected static class WriteObjectState {
- public void enterWriteObject(OutputStreamHook stream) throws IOException {}
- public void exitWriteObject(OutputStreamHook stream) throws IOException {}
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {}
- public void writeData(OutputStreamHook stream) throws IOException {}
- }
-
- protected static class DefaultState extends WriteObjectState {
- public void enterWriteObject(OutputStreamHook stream) throws IOException {
- stream.setState(IN_WRITE_OBJECT);
- }
- }
-
- protected static final WriteObjectState NOT_IN_WRITE_OBJECT = new DefaultState();
- protected static final WriteObjectState IN_WRITE_OBJECT = new InWriteObjectState();
- protected static final WriteObjectState WROTE_DEFAULT_DATA = new WroteDefaultDataState();
- protected static final WriteObjectState WROTE_CUSTOM_DATA = new WroteCustomDataState();
-
- protected static class InWriteObjectState extends WriteObjectState {
-
- public void enterWriteObject(OutputStreamHook stream) throws IOException {
- // XXX I18N, logging needed.
- throw new IOException("Internal state failure: Entered writeObject twice");
- }
-
- public void exitWriteObject(OutputStreamHook stream) throws IOException {
-
- // We didn't write any data, so write the
- // called defaultWriteObject indicator as false
- stream.getOrbStream().write_boolean(false);
-
- // If we're in stream format verison 2, we must
- // put the "null" marker to say that there isn't
- // any optional data
- if (stream.getStreamFormatVersion() == 2)
- stream.getOrbStream().write_long(0);
-
- stream.setState(NOT_IN_WRITE_OBJECT);
- }
-
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {
-
- // The writeObject method called defaultWriteObject
- // or writeFields, so put the called defaultWriteObject
- // indicator as true
- stream.getOrbStream().write_boolean(true);
-
- stream.setState(WROTE_DEFAULT_DATA);
- }
-
- public void writeData(OutputStreamHook stream) throws IOException {
-
- // The writeObject method first called a direct
- // write operation. Write the called defaultWriteObject
- // indicator as false, put the special stream format
- // version 2 header (if stream format version 2, of course),
- // and write the data
- stream.getOrbStream().write_boolean(false);
- stream.beginOptionalCustomData();
- stream.setState(WROTE_CUSTOM_DATA);
- }
- }
-
- protected static class WroteDefaultDataState extends InWriteObjectState {
-
- public void exitWriteObject(OutputStreamHook stream) throws IOException {
-
- // We only wrote default data, so if in stream format
- // version 2, put the null indicator to say that there
- // is no optional data
- if (stream.getStreamFormatVersion() == 2)
- stream.getOrbStream().write_long(0);
-
- stream.setState(NOT_IN_WRITE_OBJECT);
- }
-
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {
- // XXX I18N, logging needed.
- throw new IOException("Called defaultWriteObject/writeFields twice");
- }
-
- public void writeData(OutputStreamHook stream) throws IOException {
-
- // The writeObject method called a direct write operation.
- // If in stream format version 2, put the fake valuetype
- // header.
- stream.beginOptionalCustomData();
-
- stream.setState(WROTE_CUSTOM_DATA);
- }
- }
-
- protected static class WroteCustomDataState extends InWriteObjectState {
-
- public void exitWriteObject(OutputStreamHook stream) throws IOException {
- // In stream format version 2, we must tell the ORB
- // stream to close the fake custom valuetype.
- if (stream.getStreamFormatVersion() == 2)
- ((org.omg.CORBA.portable.ValueOutputStream)stream.getOrbStream()).end_value();
-
- stream.setState(NOT_IN_WRITE_OBJECT);
- }
-
- public void defaultWriteObject(OutputStreamHook stream) throws IOException {
- // XXX I18N, logging needed.
- throw new IOException("Cannot call defaultWriteObject/writeFields after writing custom data in RMI-IIOP");
- }
-
- // We don't have to do anything special here, just let
- // the stream write the data.
- public void writeData(OutputStreamHook stream) throws IOException {}
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java 2018-01-30 20:17:30.000000000 -0500
+++ /dev/null 2018-01-30 20:17:30.000000000 -0500
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-public class TypeMismatchException extends Error
-{
- public TypeMismatchException()
- {
- super();
- }
-
- public TypeMismatchException(String mssg)
- {
- super(mssg);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java 2018-01-30 20:17:30.000000000 -0500
+++ /dev/null 2018-01-30 20:17:30.000000000 -0500
@@ -1,926 +0,0 @@
-/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import javax.rmi.CORBA.Util;
-
-import java.util.Hashtable;
-import java.io.IOException;
-
-import com.sun.corba.se.impl.util.RepositoryId;
-import com.sun.corba.se.impl.util.Utility;
-
-import org.omg.CORBA.TCKind;
-
-import org.omg.CORBA.portable.IndirectionException;
-import com.sun.org.omg.SendingContext.CodeBase;
-import com.sun.org.omg.SendingContext.CodeBaseHelper;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.impl.logging.UtilSystemException;
-
-public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat {
-
- // Property to override our maximum stream format version
- public static final String FORMAT_VERSION_PROPERTY
- = "com.sun.CORBA.MaxStreamFormatVersion";
-
- private static final byte MAX_SUPPORTED_FORMAT_VERSION = (byte)2;
- private static final byte STREAM_FORMAT_VERSION_1 = (byte)1;
-
- // The ValueHandler's maximum stream format version to advertise,
- // set in a static initializer.
- private static final byte MAX_STREAM_FORMAT_VERSION;
-
- static {
- MAX_STREAM_FORMAT_VERSION = getMaxStreamFormatVersion();
- }
-
- // Looks for the FORMAT_VERSION_PROPERTY system property
- // to allow the user to override our default stream format
- // version. Note that this still only allows them to pick
- // a supported version (1 through MAX_STREAM_FORMAT_VERSION).
- private static byte getMaxStreamFormatVersion() {
-
- try {
-
- String propValue = (String) AccessController.doPrivileged(
- new PrivilegedAction() {
- public java.lang.Object run() {
- return System.getProperty(ValueHandlerImpl.FORMAT_VERSION_PROPERTY);
- }
- });
-
- // The property wasn't set
- if (propValue == null)
- return MAX_SUPPORTED_FORMAT_VERSION;
-
- byte result = Byte.parseByte(propValue);
-
- // REVISIT. Just set to MAX_SUPPORTED_FORMAT_VERSION
- // or really let the system shutdown with this Error?
- if (result < 1 || result > MAX_SUPPORTED_FORMAT_VERSION)
- // XXX I18N, logging needed.
- throw new ExceptionInInitializerError("Invalid stream format version: "
- + result
- + ". Valid range is 1 through "
- + MAX_SUPPORTED_FORMAT_VERSION);
-
- return result;
-
- } catch (Exception ex) {
- // REVISIT. Swallow this or really let
- // the system shutdown with this Error?
-
- Error err = new ExceptionInInitializerError(ex);
- err.initCause( ex ) ;
- throw err ;
- }
- }
-
- public static final short kRemoteType = 0;
- public static final short kAbstractType = 1;
- public static final short kValueType = 2;
-
- private Hashtable inputStreamPairs = null;
- private Hashtable outputStreamPairs = null;
- private CodeBase codeBase = null;
- private boolean useHashtables = true;
- private boolean isInputStream = true;
- private IIOPOutputStream outputStreamBridge = null;
- private IIOPInputStream inputStreamBridge = null;
- private OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
- private UtilSystemException utilWrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING ) ;
-
- // See javax.rmi.CORBA.ValueHandlerMultiFormat
- public byte getMaximumStreamFormatVersion() {
- return MAX_STREAM_FORMAT_VERSION;
- }
-
- // See javax.rmi.CORBA.ValueHandlerMultiFormat
- public void writeValue(org.omg.CORBA.portable.OutputStream out,
- java.io.Serializable value,
- byte streamFormatVersion) {
-
- if (streamFormatVersion == 2) {
- if (!(out instanceof org.omg.CORBA.portable.ValueOutputStream)) {
- throw omgWrapper.notAValueoutputstream() ;
- }
- } else if (streamFormatVersion != 1) {
- throw omgWrapper.invalidStreamFormatVersion(
- new Integer(streamFormatVersion) ) ;
- }
-
- writeValueWithVersion(out, value, streamFormatVersion);
- }
-
- private ValueHandlerImpl(){}
-
- private ValueHandlerImpl(boolean isInputStream) {
- this();
- useHashtables = false;
- this.isInputStream = isInputStream;
- }
-
- static ValueHandlerImpl getInstance() {
- return new ValueHandlerImpl();
- }
-
- static ValueHandlerImpl getInstance(boolean isInputStream) {
- return new ValueHandlerImpl(isInputStream);
- }
-
- /**
- * Writes the value to the stream using java semantics.
- * @param out The stream to write the value to
- * @param value The value to be written to the stream
- **/
- public void writeValue(org.omg.CORBA.portable.OutputStream out,
- java.io.Serializable value) {
- writeValueWithVersion(out, value, STREAM_FORMAT_VERSION_1);
- }
-
- private void writeValueWithVersion(org.omg.CORBA.portable.OutputStream _out,
- java.io.Serializable value,
- byte streamFormatVersion) {
-
- org.omg.CORBA_2_3.portable.OutputStream out =
- (org.omg.CORBA_2_3.portable.OutputStream) _out;
-
- if (!useHashtables) {
- if (outputStreamBridge == null) {
- outputStreamBridge = createOutputStream();
- outputStreamBridge.setOrbStream(out);
- }
-
- try {
- outputStreamBridge.increaseRecursionDepth();
- writeValueInternal(outputStreamBridge, out, value, streamFormatVersion);
- } finally {
- outputStreamBridge.decreaseRecursionDepth();
- }
-
- return;
- }
-
- IIOPOutputStream jdkToOrbOutputStreamBridge = null;
-
- if (outputStreamPairs == null)
- outputStreamPairs = new Hashtable();
-
- jdkToOrbOutputStreamBridge = (IIOPOutputStream)outputStreamPairs.get(_out);
-
- if (jdkToOrbOutputStreamBridge == null) {
- jdkToOrbOutputStreamBridge = createOutputStream();
- jdkToOrbOutputStreamBridge.setOrbStream(out);
- outputStreamPairs.put(_out, jdkToOrbOutputStreamBridge);
- }
-
- try {
-
- jdkToOrbOutputStreamBridge.increaseRecursionDepth();
- writeValueInternal(jdkToOrbOutputStreamBridge, out, value, streamFormatVersion);
- } finally {
- if (jdkToOrbOutputStreamBridge.decreaseRecursionDepth() == 0) {
- outputStreamPairs.remove(_out);
- }
- }
- }
-
- private void writeValueInternal(IIOPOutputStream bridge,
- org.omg.CORBA_2_3.portable.OutputStream out,
- java.io.Serializable value,
- byte streamFormatVersion)
- {
- Class clazz = value.getClass();
-
- if (clazz.isArray())
- write_Array(out, value, clazz.getComponentType());
- else
- bridge.simpleWriteObject(value, streamFormatVersion);
- }
-
- /**
- * Reads a value from the stream using java semantics.
- * @param in The stream to read the value from
- * @param clazz The type of the value to be read in
- * @param rt The sending context runtime
- **/
- public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in,
- int offset,
- java.lang.Class clazz,
- String repositoryID,
- org.omg.SendingContext.RunTime rt)
- {
- // Must use narrow rather than a direct cast to a com.sun
- // class. Fix for bug 4379539.
- CodeBase sender = CodeBaseHelper.narrow(rt);
-
- org.omg.CORBA_2_3.portable.InputStream inStream =
- (org.omg.CORBA_2_3.portable.InputStream) in;
-
- if (!useHashtables) {
- if (inputStreamBridge == null) {
- inputStreamBridge = createInputStream();
- inputStreamBridge.setOrbStream(inStream);
- inputStreamBridge.setSender(sender); //d11638
- // backward compatability 4365188
- inputStreamBridge.setValueHandler(this);
- }
-
- java.io.Serializable result = null;
-
- try {
-
- inputStreamBridge.increaseRecursionDepth();
- result = (java.io.Serializable) readValueInternal(inputStreamBridge, inStream, offset, clazz, repositoryID, sender);
-
- } finally {
-
- if (inputStreamBridge.decreaseRecursionDepth() == 0) {
- // Indirections are resolved immediately since
- // the change to the active recursion manager,
- // so this will never happen.
- }
- }
-
- return result;
- }
-
- IIOPInputStream jdkToOrbInputStreamBridge = null;
- if (inputStreamPairs == null)
- inputStreamPairs = new Hashtable();
-
- jdkToOrbInputStreamBridge = (IIOPInputStream)inputStreamPairs.get(in);
-
- if (jdkToOrbInputStreamBridge == null) {
-
- jdkToOrbInputStreamBridge = createInputStream();
- jdkToOrbInputStreamBridge.setOrbStream(inStream);
- jdkToOrbInputStreamBridge.setSender(sender); //d11638
- // backward compatability 4365188
- jdkToOrbInputStreamBridge.setValueHandler(this);
- inputStreamPairs.put(in, jdkToOrbInputStreamBridge);
- }
-
- java.io.Serializable result = null;
-
- try {
-
- jdkToOrbInputStreamBridge.increaseRecursionDepth();
- result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, inStream, offset, clazz, repositoryID, sender);
-
- } finally {
-
- if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) {
- inputStreamPairs.remove(in);
- }
- }
-
- return result;
- }
-
- private java.io.Serializable readValueInternal(IIOPInputStream bridge,
- org.omg.CORBA_2_3.portable.InputStream in,
- int offset,
- java.lang.Class clazz,
- String repositoryID,
- com.sun.org.omg.SendingContext.CodeBase sender)
- {
- java.io.Serializable result = null;
-
- if (clazz == null) {
- // clazz == null indicates an FVD situation for a nonexistant class
- if (isArray(repositoryID)){
- read_Array(bridge, in, null, sender, offset);
- } else {
- bridge.simpleSkipObject(repositoryID, sender);
- }
- return result;
- }
-
- if (clazz.isArray()) {
- result = (java.io.Serializable)read_Array(bridge, in, clazz, sender, offset);
- } else {
- result = (java.io.Serializable)bridge.simpleReadObject(clazz, repositoryID, sender, offset);
- }
-
- return result;
- }
-
- /**
- * Returns the repository ID for the given RMI value Class.
- * @param clz The class to return a repository ID for.
- * @return the repository ID of the Class.
- **/
- public java.lang.String getRMIRepositoryID(java.lang.Class clz) {
- return RepositoryId.createForJavaType(clz);
- }
-
- /**
- * Indicates whether the given Class performs custom or
- * default marshaling.
- * @param clz The class to test for custom marshaling.
- * @return True if the class performs custom marshaling, false
- * if it does not.
- **/
- public boolean isCustomMarshaled(java.lang.Class clz) {
- return ObjectStreamClass.lookup(clz).isCustomMarshaled();
- }
-
- /**
- * Returns the CodeBase for this ValueHandler. This is used by
- * the ORB runtime. The server sends the service context containing
- * the IOR for this CodeBase on the first GIOP reply. The clients
- * do the same on the first GIOP request.
- * @return the SendingContext.CodeBase of this ValueHandler.
- **/
- public org.omg.SendingContext.RunTime getRunTimeCodeBase() {
- if (codeBase != null)
- return codeBase;
- else {
- codeBase = new FVDCodeBaseImpl();
-
- // backward compatability 4365188
- // set the valueHandler so that correct/incorrect RepositoryID
- // calculations can be done based on the ORB version
- FVDCodeBaseImpl fvdImpl = (FVDCodeBaseImpl) codeBase;
- fvdImpl.setValueHandler(this);
- return codeBase;
- }
- }
-
-
- // methods supported for backward compatability so that the appropriate
- // Rep-id calculations take place based on the ORB version
-
- /**
- * Returns a boolean of whether or not RepositoryId indicates
- * FullValueDescriptor.
- * used for backward compatability
- */
-
- public boolean useFullValueDescription(Class clazz, String repositoryID)
- throws IOException
- {
- return RepositoryId.useFullValueDescription(clazz, repositoryID);
- }
-
- public String getClassName(String id)
- {
- RepositoryId repID = RepositoryId.cache.getId(id);
- return repID.getClassName();
- }
-
- public Class getClassFromType(String id)
- throws ClassNotFoundException
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getClassFromType();
- }
-
- public Class getAnyClassFromType(String id)
- throws ClassNotFoundException
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getAnyClassFromType();
- }
-
- public String createForAnyType(Class cl)
- {
- return RepositoryId.createForAnyType(cl);
- }
-
- public String getDefinedInId(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getDefinedInId();
- }
-
- public String getUnqualifiedName(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getUnqualifiedName();
- }
-
- public String getSerialVersionUID(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.getSerialVersionUID();
- }
-
-
- public boolean isAbstractBase(Class clazz)
- {
- return RepositoryId.isAbstractBase(clazz);
- }
-
- public boolean isSequence(String id)
- {
- RepositoryId repId = RepositoryId.cache.getId(id);
- return repId.isSequence();
- }
-
- /**
- * If the value contains a writeReplace method then the result
- * is returned. Otherwise, the value itself is returned.
- * @return the true value to marshal on the wire.
- **/
- public java.io.Serializable writeReplace(java.io.Serializable value) {
- return ObjectStreamClass.lookup(value.getClass()).writeReplace(value);
- }
-
- private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out,
- char[] array,
- int offset,
- int length)
- {
- out.write_wchar_array(array, offset, length);
- }
-
- private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable obj, Class type) {
-
- int i, length;
-
- if (type.isPrimitive()) {
- if (type == Integer.TYPE) {
- int[] array = (int[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_long_array(array, 0, length);
- } else if (type == Byte.TYPE) {
- byte[] array = (byte[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_octet_array(array, 0, length);
- } else if (type == Long.TYPE) {
- long[] array = (long[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_longlong_array(array, 0, length);
- } else if (type == Float.TYPE) {
- float[] array = (float[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_float_array(array, 0, length);
- } else if (type == Double.TYPE) {
- double[] array = (double[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_double_array(array, 0, length);
- } else if (type == Short.TYPE) {
- short[] array = (short[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_short_array(array, 0, length);
- } else if (type == Character.TYPE) {
- char[] array = (char[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- writeCharArray(out, array, 0, length);
- } else if (type == Boolean.TYPE) {
- boolean[] array = (boolean[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- out.write_boolean_array(array, 0, length);
- } else {
- // XXX I18N, logging needed.
- throw new Error("Invalid primitive type : " +
- obj.getClass().getName());
- }
- } else if (type == java.lang.Object.class) {
- Object[] array = (Object[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- for (i = 0; i < length; i++) {
- Util.writeAny(out, array[i]);
- }
- } else {
- Object[] array = (Object[])((Object)obj);
- length = array.length;
- out.write_ulong(length);
- int callType = kValueType;
-
- if (type.isInterface()) {
- String className = type.getName();
-
- if (java.rmi.Remote.class.isAssignableFrom(type)) {
- // RMI Object reference...
- callType = kRemoteType;
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){
- // IDL Object reference...
- callType = kRemoteType;
- } else if (RepositoryId.isAbstractBase(type)) {
- // IDL Abstract Object reference...
- callType = kAbstractType;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) {
- callType = kAbstractType;
- }
- }
-
- for (i = 0; i < length; i++) {
- switch (callType) {
- case kRemoteType:
- Util.writeRemoteObject(out, array[i]);
- break;
- case kAbstractType:
- Util.writeAbstractObject(out,array[i]);
- break;
- case kValueType:
- try{
- out.write_value((java.io.Serializable)array[i]);
- } catch(ClassCastException cce){
- if (array[i] instanceof java.io.Serializable)
- throw cce;
- else {
- Utility.throwNotSerializableForCorba(
- array[i].getClass().getName());
- }
- }
- break;
- }
- }
- }
- }
-
- private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
- char[] array,
- int offset,
- int length)
- {
- in.read_wchar_array(array, offset, length);
- }
-
- private java.lang.Object read_Array(IIOPInputStream bridge,
- org.omg.CORBA_2_3.portable.InputStream in,
- Class sequence,
- com.sun.org.omg.SendingContext.CodeBase sender,
- int offset)
- {
- try {
- // Read length of coming array
- int length = in.read_ulong();
- int i;
-
- if (sequence == null) {
- for (i = 0; i < length; i++)
- in.read_value();
-
- return null;
- }
-
- Class componentType = sequence.getComponentType();
- Class actualType = componentType;
-
-
- if (componentType.isPrimitive()) {
- if (componentType == Integer.TYPE) {
- int[] array = new int[length];
- in.read_long_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Byte.TYPE) {
- byte[] array = new byte[length];
- in.read_octet_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Long.TYPE) {
- long[] array = new long[length];
- in.read_longlong_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Float.TYPE) {
- float[] array = new float[length];
- in.read_float_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Double.TYPE) {
- double[] array = new double[length];
- in.read_double_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Short.TYPE) {
- short[] array = new short[length];
- in.read_short_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Character.TYPE) {
- char[] array = new char[length];
- readCharArray(in, array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else if (componentType == Boolean.TYPE) {
- boolean[] array = new boolean[length];
- in.read_boolean_array(array, 0, length);
- return ((java.io.Serializable)((Object)array));
- } else {
- // XXX I18N, logging needed.
- throw new Error("Invalid primitive componentType : " + sequence.getName());
- }
- } else if (componentType == java.lang.Object.class) {
- Object[] array = (Object[])java.lang.reflect.Array.newInstance(
- componentType, length);
-
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- bridge.activeRecursionMgr.addObject(offset, array);
-
- for (i = 0; i < length; i++) {
- Object objectValue = null;
- try {
- objectValue = Util.readAny(in);
- } catch(IndirectionException cdrie) {
- try {
- // The CDR stream had never seen the given offset
- // before, so check the recursion manager (it will
- // throw an IOException if it doesn't have a
- // reference, either).
- objectValue = bridge.activeRecursionMgr.getObject(
- cdrie.offset);
- } catch (IOException ie) {
- // Translate to a MARSHAL exception since
- // ValueHandlers aren't allowed to throw
- // IOExceptions
- throw utilWrapper.invalidIndirection( ie,
- new Integer( cdrie.offset ) ) ;
- }
- }
-
- array[i] = objectValue;
- }
- return ((java.io.Serializable)((Object)array));
- } else {
- Object[] array = (Object[])java.lang.reflect.Array.newInstance(
- componentType, length);
- // Store this object and its beginning position
- // since there might be indirections to it while
- // it's been unmarshalled.
- bridge.activeRecursionMgr.addObject(offset, array);
-
- // Decide what method call to make based on the componentType.
- // If it is a componentType for which we need to load a stub,
- // convert the componentType to the correct stub type.
-
- int callType = kValueType;
- boolean narrow = false;
-
- if (componentType.isInterface()) {
- boolean loadStubClass = false;
- // String className = componentType.getName();
-
- if (java.rmi.Remote.class.isAssignableFrom(componentType)) {
-
- // RMI Object reference...
- callType = kRemoteType;
-
- // for better performance, load the stub class once
- // instead of for each element of the array
- loadStubClass = true;
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(componentType)){
- // IDL Object reference...
- callType = kRemoteType;
- loadStubClass = true;
- } else if (RepositoryId.isAbstractBase(componentType)) {
- // IDL Abstract Object reference...
- callType = kAbstractType;
- loadStubClass = true;
- } else if (ObjectStreamClassCorbaExt.isAbstractInterface(componentType)) {
-
- // RMI Abstract Object reference...
-
- // componentType = null;
- callType = kAbstractType;
- }
-
- if (loadStubClass) {
- try {
- String codebase = Util.getCodebase(componentType);
- String repID = RepositoryId.createForAnyType(componentType);
- Class stubType =
- Utility.loadStubClass(repID, codebase, componentType);
- actualType = stubType;
- } catch (ClassNotFoundException e) {
- narrow = true;
- }
- } else {
- narrow = true;
- }
- }
-
- for (i = 0; i < length; i++) {
-
- try {
- switch (callType) {
- case kRemoteType:
- if (!narrow)
- array[i] = (Object)in.read_Object(actualType);
- else {
- array[i] = Utility.readObjectAndNarrow(in, actualType);
-
- }
- break;
- case kAbstractType:
- if (!narrow)
- array[i] = (Object)in.read_abstract_interface(actualType);
- else {
- array[i] = Utility.readAbstractAndNarrow(in, actualType);
- }
- break;
- case kValueType:
- array[i] = (Object)in.read_value(actualType);
- break;
- }
- } catch(IndirectionException cdrie) {
- // The CDR stream had never seen the given offset before,
- // so check the recursion manager (it will throw an
- // IOException if it doesn't have a reference, either).
- try {
- array[i] = bridge.activeRecursionMgr.getObject(
- cdrie.offset);
- } catch (IOException ioe) {
- // Translate to a MARSHAL exception since
- // ValueHandlers aren't allowed to throw
- // IOExceptions
- throw utilWrapper.invalidIndirection( ioe,
- new Integer( cdrie.offset ) ) ;
- }
- }
-
- }
-
- return ((java.io.Serializable)((Object)array));
- }
- } finally {
- // We've completed deserializing this object. Any
- // future indirections will be handled correctly at the
- // CDR level. The ActiveRecursionManager only deals with
- // objects currently being deserialized.
- bridge.activeRecursionMgr.removeObject(offset);
- }
- }
-
- private boolean isArray(String repId){
- return RepositoryId.cache.getId(repId).isSequence();
- }
-
- private String getOutputStreamClassName() {
- return "com.sun.corba.se.impl.io.IIOPOutputStream";
- }
-
- private IIOPOutputStream createOutputStream() {
- final String name = getOutputStreamClassName();
- try {
- IIOPOutputStream stream = createOutputStreamBuiltIn(name);
- if (stream != null) {
- return stream;
- }
- return createCustom(IIOPOutputStream.class, name);
- } catch (Throwable t) {
- // Throw exception under the carpet.
- InternalError ie = new InternalError(
- "Error loading " + name
- );
- ie.initCause(t);
- throw ie;
- }
- }
-
- /**
- * Construct a built in implementation with priveleges.
- * Returning null indicates a non-built is specified.
- */
- private IIOPOutputStream createOutputStreamBuiltIn(
- final String name
- ) throws Throwable {
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public IIOPOutputStream run() throws IOException {
- return createOutputStreamBuiltInNoPriv(name);
- }
- }
- );
- } catch (java.security.PrivilegedActionException exc) {
- throw exc.getCause();
- }
- }
-
- /**
- * Returning null indicates a non-built is specified.
- */
- private IIOPOutputStream createOutputStreamBuiltInNoPriv(
- final String name
- ) throws IOException {
- return name.equals(IIOPOutputStream.class.getName()) ?
- new IIOPOutputStream() : null;
- }
-
- private String getInputStreamClassName() {
- return "com.sun.corba.se.impl.io.IIOPInputStream";
- }
-
- private IIOPInputStream createInputStream() {
- final String name = getInputStreamClassName();
- try {
- IIOPInputStream stream = createInputStreamBuiltIn(name);
- if (stream != null) {
- return stream;
- }
- return createCustom(IIOPInputStream.class, name);
- } catch (Throwable t) {
- // Throw exception under the carpet.
- InternalError ie = new InternalError(
- "Error loading " + name
- );
- ie.initCause(t);
- throw ie;
- }
- }
-
- /**
- * Construct a built in implementation with priveleges.
- * Returning null indicates a non-built is specified.
- */
- private IIOPInputStream createInputStreamBuiltIn(
- final String name
- ) throws Throwable {
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public IIOPInputStream run() throws IOException {
- return createInputStreamBuiltInNoPriv(name);
- }
- }
- );
- } catch (java.security.PrivilegedActionException exc) {
- throw exc.getCause();
- }
- }
-
- /**
- * Returning null indicates a non-built is specified.
- */
- private IIOPInputStream createInputStreamBuiltInNoPriv(
- final String name
- ) throws IOException {
- return name.equals(IIOPInputStream.class.getName()) ?
- new IIOPInputStream() : null;
- }
-
- /**
- * Create a custom implementation without privileges.
- */
- private T createCustom(
- final Class type, final String className
- ) throws Throwable {
- // Note: We use the thread context or system ClassLoader here
- // since we want to load classes outside of the
- // core JDK when running J2EE Pure ORB and
- // talking to Kestrel.
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
-
- Class> clazz = cl.loadClass(className);
- Class extends T> streamClass = clazz.asSubclass(type);
-
- // Since the ClassLoader should cache the class, this isn't
- // as expensive as it looks.
- return streamClass.newInstance();
-
- }
-
- TCKind getJavaCharTCKind() {
- return TCKind.tk_wchar;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueUtility.java 2018-01-30 20:17:31.000000000 -0500
+++ /dev/null 2018-01-30 20:17:31.000000000 -0500
@@ -1,483 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.io;
-
-import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
-import com.sun.org.omg.CORBA.OperationDescription;
-import com.sun.org.omg.CORBA.AttributeDescription;
-import org.omg.CORBA.ValueMember;
-import com.sun.org.omg.CORBA.Initializer;
-import org.omg.CORBA.IDLType;
-import com.sun.org.omg.CORBA._IDLTypeStub;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCodePackage.*;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TCKind;
-import java.lang.reflect.*;
-import com.sun.corba.se.impl.util.RepositoryId;
-import java.util.*;
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-
-/**
- * Holds utility methods for converting from ObjectStreamClass to
- * FullValueDescription and generating typecodes from ObjectStreamClass.
- **/
-public class ValueUtility {
-
- public static final short PRIVATE_MEMBER = 0;
- public static final short PUBLIC_MEMBER = 1;
-
- private static final String primitiveConstants[] = {
- null, // tk_null 0
- null, // tk_void 1
- "S", // tk_short 2
- "I", // tk_long 3
- "S", // tk_ushort 4
- "I", // tk_ulong 5
- "F", // tk_float 6
- "D", // tk_double 7
- "Z", // tk_boolean 8
- "C", // tk_char 9
- "B", // tk_octet 10
- null, // tk_any 11
- null, // tk_typecode 12
- null, // tk_principal 13
- null, // tk_objref 14
- null, // tk_struct 15
- null, // tk_union 16
- null, // tk_enum 17
- null, // tk_string 18
- null, // tk_sequence 19
- null, // tk_array 20
- null, // tk_alias 21
- null, // tk_except 22
- "J", // tk_longlong 23
- "J", // tk_ulonglong 24
- "D", // tk_longdouble 25
- "C", // tk_wchar 26
- null, // tk_wstring 27
- null, // tk_fixed 28
- null, // tk_value 29
- null, // tk_value_box 30
- null, // tk_native 31
- null, // tk_abstract_interface 32
- };
-
- static {
- sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() {
- public ValueHandlerImpl newValueHandlerImpl() {
- return ValueHandlerImpl.getInstance();
- }
- public Class> loadClass(String className) throws ClassNotFoundException {
- if (Thread.currentThread().getContextClassLoader() != null) {
- return Thread.currentThread().getContextClassLoader().
- loadClass(className);
- } else {
- return ClassLoader.getSystemClassLoader().loadClass(className);
- }
- }
- });
- }
-
- public static String getSignature(ValueMember member)
- throws ClassNotFoundException {
-
- // REVISIT. Can the type be something that is
- // non-primitive yet not a value_box, value, or objref?
- // If so, should use ObjectStreamClass or throw
- // exception.
-
- if (member.type.kind().value() == TCKind._tk_value_box ||
- member.type.kind().value() == TCKind._tk_value ||
- member.type.kind().value() == TCKind._tk_objref) {
- Class c = RepositoryId.cache.getId(member.id).getClassFromType();
- return ObjectStreamClass.getSignature(c);
-
- } else {
-
- return primitiveConstants[member.type.kind().value()];
- }
-
- }
-
- public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){
-
- // Create FullValueDescription
- FullValueDescription result = new FullValueDescription();
- Class className = osc.forClass();
-
- ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- String repId = vhandler.createForAnyType(className);
-
- // Set FVD name
- result.name = vhandler.getUnqualifiedName(repId);
- if (result.name == null)
- result.name = "";
-
- // Set FVD id _REVISIT_ : Manglings
- result.id = vhandler.getRMIRepositoryID(className);
- if (result.id == null)
- result.id = "";
-
- // Set FVD is_abstract
- result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);
-
- // Set FVD is_custom
- result.is_custom = osc.hasWriteObject() || osc.isExternalizable();
-
- // Set FVD defined_in _REVISIT_ : Manglings
- result.defined_in = vhandler.getDefinedInId(repId);
- if (result.defined_in == null)
- result.defined_in = "";
-
- // Set FVD version
- result.version = vhandler.getSerialVersionUID(repId);
- if (result.version == null)
- result.version = "";
-
- // Skip FVD operations - N/A
- result.operations = new OperationDescription[0];
-
- // Skip FVD attributed - N/A
- result.attributes = new AttributeDescription[0];
-
- // Set FVD members
- // Maps classes to repositoryIDs strings. This is used to detect recursive types.
- IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
- // Stores all types created for resolving indirect types at the end.
- result.members = translateMembers(orb, osc, vh, createdIDs);
-
- // Skip FVD initializers - N/A
- result.initializers = new Initializer[0];
-
- Class interfaces[] = osc.forClass().getInterfaces();
- int abstractCount = 0;
-
- // Skip FVD supported_interfaces
- result.supported_interfaces = new String[interfaces.length];
- for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
- interfaceIndex++) {
- result.supported_interfaces[interfaceIndex] =
- vhandler.createForAnyType(interfaces[interfaceIndex]);
-
- if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
- (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
- abstractCount++;
- }
-
- // Skip FVD abstract_base_values - N/A
- result.abstract_base_values = new String[abstractCount];
- for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
- interfaceIndex++) {
- if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
- (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
- result.abstract_base_values[interfaceIndex] =
- vhandler.createForAnyType(interfaces[interfaceIndex]);
-
- }
-
- result.is_truncatable = false;
-
- // Set FVD base_value
- Class superClass = osc.forClass().getSuperclass();
- if (java.io.Serializable.class.isAssignableFrom(superClass))
- result.base_value = vhandler.getRMIRepositoryID(superClass);
- else
- result.base_value = "";
-
- // Set FVD type
- //result.type = createTypeCodeForClass(orb, osc.forClass());
- result.type = orb.get_primitive_tc(TCKind.tk_value); //11638
-
- return result;
-
- }
-
- private static ValueMember[] translateMembers (ORB orb,
- ObjectStreamClass osc,
- ValueHandler vh,
- IdentityKeyValueStack createdIDs)
- {
- ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
- ObjectStreamField fields[] = osc.getFields();
- int fieldsLength = fields.length;
- ValueMember[] members = new ValueMember[fieldsLength];
- // Note : fields come out of ObjectStreamClass in correct order for
- // writing. So, we will create the same order in the members array.
- for (int i = 0; i < fieldsLength; i++) {
- String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
- members[i] = new ValueMember();
- members[i].name = fields[i].getName();
- members[i].id = valRepId; // _REVISIT_ : Manglings
- members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
- members[i].version = "1.0";
- members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing
-
- if (fields[i].getField() == null) {
- // When using serialPersistentFields, the class may
- // no longer have an actual Field that corresponds
- // to one of the items. The Java to IDL spec
- // ptc-00-01-06 1.3.5.6 says that the IDL field
- // should be private in this case.
- members[i].access = PRIVATE_MEMBER;
- } else {
- int m = fields[i].getField().getModifiers();
- if (Modifier.isPublic(m))
- members[i].access = PUBLIC_MEMBER;
- else
- members[i].access = PRIVATE_MEMBER;
- }
-
- switch (fields[i].getTypeCode()) {
- case 'B':
- members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
- break;
- case 'C':
- members[i].type
- = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
- break;
- case 'F':
- members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
- break;
- case 'D' :
- members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
- break;
- case 'I':
- members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
- break;
- case 'J':
- members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
- break;
- case 'S':
- members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
- break;
- case 'Z':
- members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
- break;
- // case '[':
- // members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
- // members[i].id = RepositoryId.createForAnyType(fields[i].getType());
- // break;
- default:
- members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
- createdIDs);
- members[i].id = vhandler.createForAnyType(fields[i].getType());
- break;
- } // end switch
-
- } // end for loop
-
- return members;
- }
-
- private static boolean exists(String str, String strs[]){
- for (int i = 0; i < strs.length; i++)
- if (str.equals(strs[i]))
- return true;
-
- return false;
- }
-
- public static boolean isAssignableFrom(String clzRepositoryId, FullValueDescription type,
- com.sun.org.omg.SendingContext.CodeBase sender){
-
- if (exists(clzRepositoryId, type.supported_interfaces))
- return true;
-
- if (clzRepositoryId.equals(type.id))
- return true;
-
- if ((type.base_value != null) &&
- (!type.base_value.equals(""))) {
- FullValueDescription parent = sender.meta(type.base_value);
-
- return isAssignableFrom(clzRepositoryId, parent, sender);
- }
-
- return false;
-
- }
-
- public static TypeCode createTypeCodeForClass (ORB orb, java.lang.Class c, ValueHandler vh) {
- // Maps classes to repositoryIDs strings. This is used to detect recursive types.
- IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
- // Stores all types created for resolving indirect types at the end.
- TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs);
- return tc;
- }
-
- private static TypeCode createTypeCodeForClassInternal (ORB orb,
- java.lang.Class c,
- ValueHandler vh,
- IdentityKeyValueStack createdIDs)
- {
- // This wrapper method is the protection against infinite recursion.
- TypeCode tc = null;
- String id = (String)createdIDs.get(c);
- if (id != null) {
- return orb.create_recursive_tc(id);
- } else {
- id = vh.getRMIRepositoryID(c);
- if (id == null) id = "";
- // cache the rep id BEFORE creating a new typecode.
- // so that recursive tc can look up the rep id.
- createdIDs.push(c, id);
- tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
- createdIDs.pop();
- return tc;
- }
- }
-
- // Maintains a stack of key-value pairs. Compares elements using == operator.
- private static class IdentityKeyValueStack {
- private static class KeyValuePair {
- Object key;
- Object value;
- KeyValuePair(Object key, Object value) {
- this.key = key;
- this.value = value;
- }
- boolean equals(KeyValuePair pair) {
- return pair.key == this.key;
- }
- }
-
- Stack pairs = null;
-
- Object get(Object key) {
- if (pairs == null) {
- return null;
- }
- for (Iterator i = pairs.iterator(); i.hasNext();) {
- KeyValuePair pair = (KeyValuePair)i.next();
- if (pair.key == key) {
- return pair.value;
- }
- }
- return null;
- }
-
- void push(Object key, Object value) {
- if (pairs == null) {
- pairs = new Stack();
- }
- pairs.push(new KeyValuePair(key, value));
- }
-
- void pop() {
- pairs.pop();
- }
- }
-
- private static TypeCode createTypeCodeInternal (ORB orb,
- java.lang.Class c,
- ValueHandler vh,
- String id,
- IdentityKeyValueStack createdIDs)
- {
- if ( c.isArray() ) {
- // Arrays - may recurse for multi-dimensional arrays
- Class componentClass = c.getComponentType();
- TypeCode embeddedType;
- if ( componentClass.isPrimitive() ){
- embeddedType
- = ValueUtility.getPrimitiveTypeCodeForClass(orb,
- componentClass,
- vh);
- } else {
- embeddedType = createTypeCodeForClassInternal(orb, componentClass, vh,
- createdIDs);
- }
- TypeCode t = orb.create_sequence_tc (0, embeddedType);
- return orb.create_value_box_tc (id, "Sequence", t);
- } else if ( c == java.lang.String.class ) {
- // Strings
- TypeCode t = orb.create_string_tc (0);
- return orb.create_value_box_tc (id, "StringValue", t);
- } else if (java.rmi.Remote.class.isAssignableFrom(c)) {
- return orb.get_primitive_tc(TCKind.tk_objref);
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(c)) {
- return orb.get_primitive_tc(TCKind.tk_objref);
- }
-
- // Anything else
-
- ObjectStreamClass osc = ObjectStreamClass.lookup(c);
-
- if (osc == null) {
- return orb.create_value_box_tc (id, "Value", orb.get_primitive_tc (TCKind.tk_value));
- }
-
- // type modifier
- // REVISIT truncatable and abstract?
- short modifier = (osc.isCustomMarshaled() ? org.omg.CORBA.VM_CUSTOM.value : org.omg.CORBA.VM_NONE.value);
-
- // concrete base
- TypeCode base = null;
- Class superClass = c.getSuperclass();
- if (superClass != null && java.io.Serializable.class.isAssignableFrom(superClass)) {
- base = createTypeCodeForClassInternal(orb, superClass, vh, createdIDs);
- }
-
- // members
- ValueMember[] members = translateMembers (orb, osc, vh, createdIDs);
-
- return orb.create_value_tc(id, c.getName(), modifier, base, members);
- }
-
- public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
- Class c,
- ValueHandler vh) {
-
- if (c == Integer.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_long);
- } else if (c == Byte.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_octet);
- } else if (c == Long.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_longlong);
- } else if (c == Float.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_float);
- } else if (c == Double.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_double);
- } else if (c == Short.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_short);
- } else if (c == Character.TYPE) {
- return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
- } else if (c == Boolean.TYPE) {
- return orb.get_primitive_tc (TCKind.tk_boolean);
- } else {
- // _REVISIT_ Not sure if this is right.
- return orb.get_primitive_tc (TCKind.tk_any);
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java 2018-01-30 20:17:32.000000000 -0500
+++ /dev/null 2018-01-30 20:17:32.000000000 -0500
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-
-public class ByteBuffer {
- /**
- * The array buffer into which the components of the ByteBuffer are
- * stored. The capacity of the ByteBuffer is the length of this array buffer,
- * and is at least large enough to contain all the ByteBuffer's elements.
- *
- * Any array elements following the last element in the ByteBuffer are 0.
- */
- protected byte elementData[];
-
- /**
- * The number of valid components in this {@code ByteBuffer} object.
- * Components {@code elementData[0]} through
- * {@code elementData[elementCount-1]} are the actual items.
- *
- * @serial
- */
- protected int elementCount;
-
- /**
- * The amount by which the capacity of the ByteBuffer is automatically
- * incremented when its size becomes greater than its capacity. If
- * the capacity increment is less than or equal to zero, the capacity
- * of the ByteBuffer is doubled each time it needs to grow.
- *
- * @serial
- */
- protected int capacityIncrement;
-
- /**
- * Constructs an empty ByteBuffer with the specified initial capacity and
- * capacity increment.
- *
- * @param initialCapacity the initial capacity of the ByteBuffer.
- * @param capacityIncrement the amount by which the capacity is
- * increased when the ByteBuffer overflows.
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
- */
- public ByteBuffer(int initialCapacity, int capacityIncrement) {
- super();
- if (initialCapacity < 0)
- throw new IllegalArgumentException("Illegal Capacity: "+
- initialCapacity);
- this.elementData = new byte[initialCapacity];
- this.capacityIncrement = capacityIncrement;
- }
-
- /**
- * Constructs an empty ByteBuffer with the specified initial capacity and
- * with its capacity increment equal to zero.
- *
- * @param initialCapacity the initial capacity of the ByteBuffer.
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
- */
- public ByteBuffer(int initialCapacity) {
- this(initialCapacity, 0);
- }
-
- /**
- * Constructs an empty ByteBuffer so that its internal data array
- * has size {@code 10} and its standard capacity increment is
- * zero.
- */
- public ByteBuffer() {
- this(200);
- }
-
- /**
- * Trims the capacity of this ByteBuffer to be the ByteBuffer's current
- * size. If the capacity of this cector is larger than its current
- * size, then the capacity is changed to equal the size by replacing
- * its internal data array, kept in the field {@code elementData},
- * with a smaller one. An application can use this operation to
- * minimize the storage of a ByteBuffer.
- */
- public void trimToSize() {
- int oldCapacity = elementData.length;
- if (elementCount < oldCapacity) {
- byte oldData[] = elementData;
- elementData = new byte[elementCount];
- System.arraycopy(oldData, 0, elementData, 0, elementCount);
- }
- }
-
- /**
- * This implements the unsynchronized semantics of ensureCapacity.
- * Synchronized methods in this class can internally call this
- * method for ensuring capacity without incurring the cost of an
- * extra synchronization.
- *
- * @see java.util.ByteBuffer#ensureCapacity(int)
- */
- private void ensureCapacityHelper(int minCapacity) {
- int oldCapacity = elementData.length;
- if (minCapacity > oldCapacity) {
- byte oldData[] = elementData;
- int newCapacity = (capacityIncrement > 0) ?
- (oldCapacity + capacityIncrement) : (oldCapacity * 2);
- if (newCapacity < minCapacity) {
- newCapacity = minCapacity;
- }
- elementData = new byte[newCapacity];
- System.arraycopy(oldData, 0, elementData, 0, elementCount);
- }
- }
-
- /**
- * Returns the current capacity of this ByteBuffer.
- *
- * @return the current capacity (the length of its internal
- * data arary, kept in the field {@code elementData}
- * of this ByteBuffer.
- */
- public int capacity() {
- return elementData.length;
- }
-
- /**
- * Returns the number of components in this ByteBuffer.
- *
- * @return the number of components in this ByteBuffer.
- */
- public int size() {
- return elementCount;
- }
-
- /**
- * Tests if this ByteBuffer has no components.
- *
- * @return {@code true} if and only if this ByteBuffer has
- * no components, that is, its size is zero;
- * {@code false} otherwise.
- */
- public boolean isEmpty() {
- return elementCount == 0;
- }
-
- public void append(byte value)
- {
- ensureCapacityHelper(elementCount + 1);
- elementData[elementCount++] = value;
- }
-
- public void append( int value )
- {
- ensureCapacityHelper(elementCount + 4);
- doAppend( value ) ;
- }
-
- private void doAppend( int value )
- {
- int current = value ;
- for (int ctr=0; ctr<4; ctr++) {
- elementData[elementCount+ctr] = (byte)(current & 255) ;
- current = current >> 8 ;
- }
- elementCount += 4 ;
- }
-
- public void append( String value )
- {
- byte[] data = value.getBytes() ;
- ensureCapacityHelper( elementCount + data.length + 4 ) ;
- doAppend( data.length ) ;
- System.arraycopy( data, 0, elementData, elementCount, data.length ) ;
- elementCount += data.length ;
- }
-
- /**
- * Returns an array containing all of the elements in this ByteBuffer
- * in the correct order.
- *
- * @since 1.2
- */
- public byte[] toArray() {
- return elementData ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java 2018-01-30 20:17:32.000000000 -0500
+++ /dev/null 2018-01-30 20:17:32.000000000 -0500
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.Identifiable ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.WriteContents ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.ior.FreezableList ;
-
-import com.sun.corba.se.impl.encoding.CDROutputStream ;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-import com.sun.corba.se.impl.encoding.EncapsInputStream ;
-
-import sun.corba.EncapsInputStreamFactory;
-
-/**
- * This static utility class contains various utility methods for reading and
- * writing CDR encapsulations.
- *
- * @author Ken Cavanaugh
- */
-public class EncapsulationUtility
-{
- private EncapsulationUtility()
- {
- }
-
- /** Read the count from is, then read count Identifiables from
- * is using the factory. Add each constructed Identifiable to container.
- */
- public static void readIdentifiableSequence( List container,
- IdentifiableFactoryFinder finder, InputStream istr)
- {
- int count = istr.read_long() ;
- for (int ctr = 0; ctr iorTypeNames;
- private static final Set builtinIorTypeNames;
- private ORB theOrb;
-
- static {
- builtinIorTypeNames = initBuiltinIorTypeNames();
- }
-
- public IORTypeCheckRegistryImpl( String filterProperties, ORB orb) {
- theOrb = orb;
- iorTypeNames = parseIorClassNameList(filterProperties);
- }
-
- /*
- *
- * A note on the validation flow:
- * 1. against the filter class name list
- * 2. against the builtin class name list
- */
-
- @Override
- public boolean isValidIORType(String iorClassName) {
- dprintTransport(".isValidIORType : iorClassName == " + iorClassName);
- return validateIorTypeByName(iorClassName);
- }
-
-
- private boolean validateIorTypeByName(String iorClassName) {
- dprintTransport(".validateIorTypeByName : iorClassName == " + iorClassName);
- boolean isValidType;
-
- isValidType = checkIorTypeNames(iorClassName);
-
- if (!isValidType) {
- isValidType = checkBuiltinClassNames(iorClassName);
- }
-
- dprintTransport(".validateIorTypeByName : isValidType == " + isValidType);
- return isValidType;
- }
-
-
- /*
- * check if the class name corresponding to an IOR Type name
- * is in the ior class name list as generated from the filter property.
- * So if the IOR type is recorded in the registry then allow the creation of the
- * stub factory and let it resolve and load the class. That is if current
- * type check deliberation permits.
- * IOR Type names are configured by the filter property
- */
-
- private boolean checkIorTypeNames(
- String theIorClassName) {
- return (iorTypeNames != null) && (iorTypeNames.contains(theIorClassName));
- }
-
- /*
- * Check the IOR interface class name against the set of
- * class names that correspond to the builtin JDK IDL stub classes.
- */
-
- private boolean checkBuiltinClassNames(
- String theIorClassName) {
- return builtinIorTypeNames.contains(theIorClassName);
- }
-
-
- private Set parseIorClassNameList(String filterProperty) {
- Set _iorTypeNames = null;
- if (filterProperty != null) {
- String[] tempIorClassNames = filterProperty.split(";");
- _iorTypeNames = Set.of(tempIorClassNames);
- if (theOrb.orbInitDebugFlag) {
- dprintConfiguredIorTypeNames();
- }
- }
- return _iorTypeNames;
- }
-
-
- private static Set initBuiltinIorTypeNames() {
- Set> builtInCorbaStubTypes = initBuiltInCorbaStubTypes();
- String [] tempBuiltinIorTypeNames = new String[builtInCorbaStubTypes.size()];
- int i = 0;
- for (Class> _stubClass: builtInCorbaStubTypes) {
- tempBuiltinIorTypeNames[i++] = _stubClass.getName();
- }
- return Set.of(tempBuiltinIorTypeNames);
- }
-
- private static Set> initBuiltInCorbaStubTypes() {
- Class> tempBuiltinCorbaStubTypes[] = {
- com.sun.corba.se.spi.activation.Activator.class,
- com.sun.corba.se.spi.activation._ActivatorStub.class,
- com.sun.corba.se.spi.activation._InitialNameServiceStub.class,
- com.sun.corba.se.spi.activation._LocatorStub.class,
- com.sun.corba.se.spi.activation._RepositoryStub.class,
- com.sun.corba.se.spi.activation._ServerManagerStub.class,
- com.sun.corba.se.spi.activation._ServerStub.class,
- org.omg.CosNaming.BindingIterator.class,
- org.omg.CosNaming._BindingIteratorStub.class,
- org.omg.CosNaming.NamingContextExt.class,
- org.omg.CosNaming._NamingContextExtStub.class,
- org.omg.CosNaming.NamingContext.class,
- org.omg.CosNaming._NamingContextStub.class,
- org.omg.DynamicAny.DynAnyFactory.class,
- org.omg.DynamicAny._DynAnyFactoryStub.class,
- org.omg.DynamicAny.DynAny.class,
- org.omg.DynamicAny._DynAnyStub.class,
- org.omg.DynamicAny.DynArray.class,
- org.omg.DynamicAny._DynArrayStub.class,
- org.omg.DynamicAny.DynEnum.class,
- org.omg.DynamicAny._DynEnumStub.class,
- org.omg.DynamicAny.DynFixed.class,
- org.omg.DynamicAny._DynFixedStub.class,
- org.omg.DynamicAny.DynSequence.class,
- org.omg.DynamicAny._DynSequenceStub.class,
- org.omg.DynamicAny.DynStruct.class,
- org.omg.DynamicAny._DynStructStub.class,
- org.omg.DynamicAny.DynUnion.class,
- org.omg.DynamicAny._DynUnionStub.class,
- org.omg.DynamicAny._DynValueStub.class,
- org.omg.DynamicAny.DynValue.class,
- org.omg.PortableServer.ServantActivator.class,
- org.omg.PortableServer._ServantActivatorStub.class,
- org.omg.PortableServer.ServantLocator.class,
- org.omg.PortableServer._ServantLocatorStub.class };
- return Set.>of(tempBuiltinCorbaStubTypes);
- }
-
- private void dprintConfiguredIorTypeNames() {
- if (iorTypeNames != null) {
- for (String iorTypeName : iorTypeNames) {
- ORBUtility.dprint(this, ".dprintConfiguredIorTypeNames: " + iorTypeName);
- }
- }
- }
-
- private void dprintTransport(String msg) {
- if (theOrb.transportDebugFlag) {
- ORBUtility.dprint(this, msg);
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java 2018-01-30 20:17:38.000000000 -0500
+++ /dev/null 2018-01-30 20:17:38.000000000 -0500
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import java.util.Map ;
-import java.util.HashMap ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.Identifiable ;
-import com.sun.corba.se.spi.ior.IdentifiableFactory ;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-public abstract class IdentifiableFactoryFinderBase implements
- IdentifiableFactoryFinder
-{
- private ORB orb ;
- private Map map ;
- protected IORSystemException wrapper ;
-
- protected IdentifiableFactoryFinderBase( ORB orb )
- {
- map = new HashMap() ;
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- protected IdentifiableFactory getFactory(int id)
- {
- Integer ident = new Integer( id ) ;
- IdentifiableFactory factory = (IdentifiableFactory)(map.get(
- ident ) ) ;
- return factory ;
- }
-
- public abstract Identifiable handleMissingFactory( int id, InputStream is ) ;
-
- public Identifiable create(int id, InputStream is)
- {
- IdentifiableFactory factory = getFactory( id ) ;
-
- if (factory != null)
- return factory.create( is ) ;
- else
- return handleMissingFactory( id, is ) ;
- }
-
- public void registerFactory(IdentifiableFactory factory)
- {
- Integer ident = new Integer( factory.getId() ) ;
- map.put( ident, factory ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java 2018-01-30 20:17:39.000000000 -0500
+++ /dev/null 2018-01-30 20:17:39.000000000 -0500
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author Ken Cavanaugh
- */
-public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase
-{
- /** This constructor reads the template ONLY from the stream.
- */
- public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
- {
- super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
-
- setORBVersion( is ) ;
- }
-
- /** This constructor reads a complete ObjectKey (template and Id)
- * from the stream.
- */
- public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
- OctetSeqHolder osh )
- {
- super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
-
- osh.value = readObjectKey( is ) ;
-
- setORBVersion( is ) ;
- }
-
- public JIDLObjectKeyTemplate( ORB orb, int scid, int serverid )
- {
- super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid,
- JIDL_ORB_ID, JIDL_OAID ) ;
-
- setORBVersion( ORBVersionFactory.getORBVersion() ) ;
- }
-
- protected void writeTemplate( OutputStream os )
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java 2018-01-30 20:17:40.000000000 -0500
+++ /dev/null 2018-01-30 20:17:40.000000000 -0500
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.io.IOException ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-public abstract class NewObjectKeyTemplateBase extends ObjectKeyTemplateBase
-{
- public NewObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
- String orbid, ObjectAdapterId oaid )
- {
- super( orb, magic, scid, serverid, orbid, oaid ) ;
- // subclass must set the version, since we don't have the object key here.
-
- if (magic != ObjectKeyFactoryImpl.JAVAMAGIC_NEWER)
- throw wrapper.badMagic( new Integer( magic ) ) ;
- }
-
- public void write(ObjectId objectId, OutputStream os)
- {
- super.write( objectId, os ) ;
- getORBVersion().write( os ) ;
- }
-
- public void write(OutputStream os)
- {
- super.write( os ) ;
- getORBVersion().write( os ) ;
- }
-
- protected void setORBVersion( InputStream is )
- {
- ORBVersion version = ORBVersionFactory.create( is ) ;
- setORBVersion( version ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java 2018-01-30 20:17:40.000000000 -0500
+++ /dev/null 2018-01-30 20:17:40.000000000 -0500
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-import java.util.Arrays ;
-
-public class ObjectAdapterIdArray extends ObjectAdapterIdBase {
- private final String[] objectAdapterId ;
-
- public ObjectAdapterIdArray( String[] objectAdapterId )
- {
- this.objectAdapterId = objectAdapterId ;
- }
-
- /** Special constructor used for OA IDs of length 2.
- */
- public ObjectAdapterIdArray( String name1, String name2 )
- {
- objectAdapterId = new String[2] ;
- objectAdapterId[0] = name1 ;
- objectAdapterId[1] = name2 ;
- }
-
- public int getNumLevels()
- {
- return objectAdapterId.length ;
- }
-
- public Iterator iterator()
- {
- return Arrays.asList( objectAdapterId ).iterator() ;
- }
-
- public String[] getAdapterName()
- {
- return (String[])(objectAdapterId.clone()) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java 2018-01-30 20:17:41.000000000 -0500
+++ /dev/null 2018-01-30 20:17:41.000000000 -0500
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-abstract class ObjectAdapterIdBase implements ObjectAdapterId {
- public boolean equals( Object other )
- {
- if (!(other instanceof ObjectAdapterId))
- return false ;
-
- ObjectAdapterId theOther = (ObjectAdapterId)other ;
-
- Iterator iter1 = iterator() ;
- Iterator iter2 = theOther.iterator() ;
-
- while (iter1.hasNext() && iter2.hasNext()) {
- String str1 = (String)(iter1.next()) ;
- String str2 = (String)(iter2.next()) ;
-
- if (!str1.equals( str2 ))
- return false ;
- }
-
- return iter1.hasNext() == iter2.hasNext() ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- Iterator iter = iterator() ;
- while (iter.hasNext()) {
- String str = (String)(iter.next()) ;
- result = 37*result + str.hashCode() ;
- }
- return result ;
- }
-
- public String toString()
- {
- StringBuffer buff = new StringBuffer() ;
- buff.append( "ObjectAdapterID[" ) ;
- Iterator iter = iterator() ;
- boolean first = true ;
- while (iter.hasNext()) {
- String str = (String)(iter.next()) ;
-
- if (first)
- first = false ;
- else
- buff.append( "/" ) ;
-
- buff.append( str ) ;
- }
-
- buff.append( "]" ) ;
-
- return buff.toString() ;
- }
-
- public void write( OutputStream os )
- {
- os.write_long( getNumLevels() ) ;
- Iterator iter = iterator() ;
- while (iter.hasNext()) {
- String str = (String)(iter.next()) ;
- os.write_string( str ) ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java 2018-01-30 20:17:42.000000000 -0500
+++ /dev/null 2018-01-30 20:17:42.000000000 -0500
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-/** ObjectAdapterIdNumber is used to represent pre-JDK 1.4 POA adapter
- * IDs. The POA ID was simply represented as a single integer, which was
- * mapped to the actual POA instance. Here, we just represent these
- * internally as arrays of the form {@code { "OldRootPOA", "" }},
- * and provide an extra method to get the number back.
- */
-public class ObjectAdapterIdNumber extends ObjectAdapterIdArray {
- private int poaid ;
-
- public ObjectAdapterIdNumber( int poaid )
- {
- super( "OldRootPOA", Integer.toString( poaid ) ) ;
- this.poaid = poaid ;
- }
-
- public int getOldPOAId()
- {
- return poaid ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java 2018-01-30 20:17:42.000000000 -0500
+++ /dev/null 2018-01-30 20:17:42.000000000 -0500
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Arrays ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-public final class ObjectIdImpl implements ObjectId
-{
- private byte[] id;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectIdImpl))
- return false ;
-
- ObjectIdImpl other = (ObjectIdImpl)obj ;
-
- return Arrays.equals( this.id, other.id ) ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- for (int ctr=0; ctr= ORBConstants.FIRST_POA_SCID) &&
- (scid <= ORBConstants.MAX_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new POAObjectKeyTemplate( orb, magic, scid, is, osh ) ;
- else
- oktemp = new OldPOAObjectKeyTemplate( orb, magic, scid, is, osh ) ;
- } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new JIDLObjectKeyTemplate( orb, magic, scid, is, osh ) ;
- else
- oktemp = new OldJIDLObjectKeyTemplate( orb, magic, scid, is, osh );
- }
-
- return oktemp ;
- }
- } ;
-
- /** This handler reads only the oktemp.
- */
- private Handler oktempOnly = new Handler() {
- public ObjectKeyTemplate handle( int magic, int scid,
- InputStream is, OctetSeqHolder osh ) {
- ObjectKeyTemplate oktemp = null ;
-
- if ((scid >= ORBConstants.FIRST_POA_SCID) &&
- (scid <= ORBConstants.MAX_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new POAObjectKeyTemplate( orb, magic, scid, is ) ;
- else
- oktemp = new OldPOAObjectKeyTemplate( orb, magic, scid, is ) ;
- } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) {
- if (magic >= JAVAMAGIC_NEWER)
- oktemp = new JIDLObjectKeyTemplate( orb, magic, scid, is ) ;
- else
- oktemp = new OldJIDLObjectKeyTemplate( orb, magic, scid, is ) ;
- }
-
- return oktemp ;
- }
- } ;
-
- /** Returns true iff magic is in the range of valid magic numbers
- * for our ORB.
- */
- private boolean validMagic( int magic )
- {
- return (magic >= MAGIC_BASE) && (magic <= MAX_MAGIC) ;
- }
-
- /** Creates an ObjectKeyTemplate from the InputStream. Most of the
- * decoding is done inside the handler.
- */
- private ObjectKeyTemplate create( InputStream is, Handler handler,
- OctetSeqHolder osh )
- {
- ObjectKeyTemplate oktemp = null ;
-
- try {
- is.mark(0) ;
- int magic = is.read_long() ;
-
- if (validMagic( magic )) {
- int scid = is.read_long() ;
- oktemp = handler.handle( magic, scid, is, osh ) ;
- }
- } catch (MARSHAL mexc) {
- // XXX log this error
- // ignore this: error handled below because oktemp == null
- }
-
- if (oktemp == null)
- // If we did not successfully construct a oktemp, reset the
- // stream so that WireObjectKeyTemplate can correctly construct the
- // object key.
- try {
- is.reset() ;
- } catch (IOException exc) {
- // XXX log this error
- // ignore this
- }
-
- return oktemp ;
- }
-
- public ObjectKey create( byte[] key )
- {
- OctetSeqHolder osh = new OctetSeqHolder() ;
- EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length );
-
- ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ;
- if (oktemp == null)
- oktemp = new WireObjectKeyTemplate( is, osh ) ;
-
- ObjectId oid = new ObjectIdImpl( osh.value ) ;
- return new ObjectKeyImpl( oktemp, oid ) ;
- }
-
- public ObjectKeyTemplate createTemplate( InputStream is )
- {
- ObjectKeyTemplate oktemp = create( is, oktempOnly, null ) ;
- if (oktemp == null)
- oktemp = new WireObjectKeyTemplate( orb ) ;
-
- return oktemp ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java 2018-01-30 20:17:44.000000000 -0500
+++ /dev/null 2018-01-30 20:17:44.000000000 -0500
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-public class ObjectKeyImpl implements ObjectKey
-{
- private ObjectKeyTemplate oktemp;
- private ObjectId id;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof ObjectKeyImpl))
- return false ;
-
- ObjectKeyImpl other = (ObjectKeyImpl)obj ;
-
- return oktemp.equals( other.oktemp ) &&
- id.equals( other.id ) ;
- }
-
- public int hashCode()
- {
- return oktemp.hashCode() ^ id.hashCode() ;
- }
-
- public ObjectKeyTemplate getTemplate()
- {
- return oktemp ;
- }
-
- public ObjectId getId()
- {
- return id ;
- }
-
- public ObjectKeyImpl( ObjectKeyTemplate oktemp, ObjectId id )
- {
- this.oktemp = oktemp ;
- this.id = id ;
- }
-
- public void write( OutputStream os )
- {
- oktemp.write( id, os ) ;
- }
-
- public byte[] getBytes( org.omg.CORBA.ORB orb )
- {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
- write( os ) ;
- return os.toByteArray() ;
- }
-
- public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb )
- {
- return oktemp.getServerRequestDispatcher( orb, id ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java 2018-01-30 20:17:44.000000000 -0500
+++ /dev/null 2018-01-30 20:17:44.000000000 -0500
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-
-public abstract class ObjectKeyTemplateBase implements ObjectKeyTemplate
-{
- // Fixed constants for Java IDL object key template forms
- public static final String JIDL_ORB_ID = "" ;
- private static final String[] JIDL_OAID_STRINGS = { "TransientObjectAdapter" } ;
- public static final ObjectAdapterId JIDL_OAID = new ObjectAdapterIdArray( JIDL_OAID_STRINGS ) ;
-
- private ORB orb ;
- protected IORSystemException wrapper ;
- private ORBVersion version ;
- private int magic ;
- private int scid ;
- private int serverid ;
- private String orbid ;
- private ObjectAdapterId oaid ;
-
- private byte[] adapterId ;
-
- public byte[] getAdapterId()
- {
- return (byte[])(adapterId.clone()) ;
- }
-
- private byte[] computeAdapterId()
- {
- // write out serverid, orbid, oaid
- ByteBuffer buff = new ByteBuffer() ;
-
- buff.append( getServerId() ) ;
- buff.append( orbid ) ;
-
- buff.append( oaid.getNumLevels() ) ;
- Iterator iter = oaid.iterator() ;
- while (iter.hasNext()) {
- String comp = (String)(iter.next()) ;
- buff.append( comp ) ;
- }
-
- buff.trimToSize() ;
-
- return buff.toArray() ;
- }
-
- public ObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
- String orbid, ObjectAdapterId oaid )
- {
- this.orb = orb ;
- this.wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- this.magic = magic ;
- this.scid = scid ;
- this.serverid = serverid ;
- this.orbid = orbid ;
- this.oaid = oaid ;
-
- adapterId = computeAdapterId() ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectKeyTemplateBase))
- return false ;
-
- ObjectKeyTemplateBase other = (ObjectKeyTemplateBase)obj ;
-
- return (magic == other.magic) && (scid == other.scid) &&
- (serverid == other.serverid) && (version.equals( other.version ) &&
- orbid.equals( other.orbid ) && oaid.equals( other.oaid )) ;
- }
-
- public int hashCode()
- {
- int result = 17 ;
- result = 37*result + magic ;
- result = 37*result + scid ;
- result = 37*result + serverid ;
- result = 37*result + version.hashCode() ;
- result = 37*result + orbid.hashCode() ;
- result = 37*result + oaid.hashCode() ;
- return result ;
- }
-
- public int getSubcontractId()
- {
- return scid ;
- }
-
- public int getServerId()
- {
- return serverid ;
- }
-
- public String getORBId()
- {
- return orbid ;
- }
-
- public ObjectAdapterId getObjectAdapterId()
- {
- return oaid ;
- }
-
- public void write(ObjectId objectId, OutputStream os)
- {
- writeTemplate( os ) ;
- objectId.write( os ) ;
- }
-
- public void write( OutputStream os )
- {
- writeTemplate( os ) ;
- }
-
- abstract protected void writeTemplate( OutputStream os ) ;
-
- protected int getMagic()
- {
- return magic ;
- }
-
- // All subclasses should set the version in their constructors.
- // Public so it can be used in a white-box test.
- public void setORBVersion( ORBVersion version )
- {
- this.version = version ;
- }
-
- public ORBVersion getORBVersion()
- {
- return version ;
- }
-
- protected byte[] readObjectKey( InputStream is )
- {
- int len = is.read_long() ;
- byte[] result = new byte[len] ;
- is.read_octet_array( result, 0, len ) ;
- return result ;
- }
-
- public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id )
- {
- return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( scid ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java 2018-01-30 20:17:45.000000000 -0500
+++ /dev/null 2018-01-30 20:17:45.000000000 -0500
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-import org.omg.CORBA.portable.StreamableValue ;
-
-import org.omg.CORBA.TypeCode ;
-
-import org.omg.PortableInterceptor.ObjectReferenceFactory ;
-import org.omg.PortableInterceptor.ObjectReferenceFactoryHelper ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactory;
-import com.sun.corba.se.spi.ior.IORTemplateList;
-import com.sun.corba.se.spi.ior.IORFactories;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-/** This is an implementation of the ObjectReferenceFactory abstract value
-* type defined by the portable interceptors IDL.
-* Note that this is a direct Java implementation
-* of the abstract value type: there is no stateful value type defined in IDL,
-* since defining the state in IDL is awkward and inefficient. The best way
-* to define the state is to use internal data structures that can be written
-* to and read from CORBA streams.
-*/
-public class ObjectReferenceFactoryImpl extends ObjectReferenceProducerBase
- implements ObjectReferenceFactory, StreamableValue
-{
- transient private IORTemplateList iorTemplates ;
-
- public ObjectReferenceFactoryImpl( InputStream is )
- {
- super( (ORB)(is.orb()) ) ;
- _read( is ) ;
- }
-
- public ObjectReferenceFactoryImpl( ORB orb, IORTemplateList iortemps )
- {
- super( orb ) ;
- iorTemplates = iortemps ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectReferenceFactoryImpl))
- return false ;
-
- ObjectReferenceFactoryImpl other = (ObjectReferenceFactoryImpl)obj ;
-
- return (iorTemplates != null) &&
- iorTemplates.equals( other.iorTemplates ) ;
- }
-
- public int hashCode()
- {
- return iorTemplates.hashCode() ;
- }
-
- // Note that this repository ID must reflect the implementation
- // of the abstract valuetype (that is, this class), not the
- // repository ID of the org.omg.PortableInterceptor.ObjectReferenceFactory
- // class. This allows for multiple independent implementations
- // of the abstract valuetype, should that become necessary.
- public static final String repositoryId =
- "IDL:com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl:1.0" ;
-
- public String[] _truncatable_ids()
- {
- return new String[] { repositoryId } ;
- }
-
- public TypeCode _type()
- {
- return ObjectReferenceFactoryHelper.type() ;
- }
-
- /** Read the data into a (presumably) empty ObjectReferenceFactoryImpl.
- * This sets the orb to the ORB of the InputStream.
- */
- public void _read( InputStream is )
- {
- org.omg.CORBA_2_3.portable.InputStream istr =
- (org.omg.CORBA_2_3.portable.InputStream)is ;
-
- iorTemplates = IORFactories.makeIORTemplateList( istr ) ;
- }
-
- /** Write the state to the OutputStream.
- */
- public void _write( OutputStream os )
- {
- org.omg.CORBA_2_3.portable.OutputStream ostr =
- (org.omg.CORBA_2_3.portable.OutputStream)os ;
-
- iorTemplates.write( ostr ) ;
- }
-
- public IORFactory getIORFactory()
- {
- return iorTemplates ;
- }
-
- public IORTemplateList getIORTemplateList()
- {
- return iorTemplates ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java 2018-01-30 20:17:46.000000000 -0500
+++ /dev/null 2018-01-30 20:17:46.000000000 -0500
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.IORFactory ;
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-import com.sun.corba.se.spi.ior.IORTemplateList ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-public abstract class ObjectReferenceProducerBase {
- transient protected ORB orb ;
-
- public abstract IORFactory getIORFactory() ;
-
- public abstract IORTemplateList getIORTemplateList() ;
-
- public ObjectReferenceProducerBase( ORB orb )
- {
- this.orb = orb ;
- }
-
- public org.omg.CORBA.Object make_object (String repositoryId,
- byte[] objectId)
- {
- ObjectId oid = IORFactories.makeObjectId( objectId ) ;
- IOR ior = getIORFactory().makeIOR( orb, repositoryId, oid ) ;
-
- return ORBUtility.makeObjectReference( ior ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java 2018-01-30 20:17:46.000000000 -0500
+++ /dev/null 2018-01-30 20:17:46.000000000 -0500
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior ;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-import org.omg.CORBA.portable.StreamableValue ;
-
-import org.omg.CORBA.TypeCode ;
-
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactory;
-import com.sun.corba.se.spi.ior.IORTemplate;
-import com.sun.corba.se.spi.ior.IORTemplateList;
-import com.sun.corba.se.spi.ior.IORFactories;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-/** This is an implementation of the ObjectReferenceTemplate abstract value
-* type defined by the portable interceptors IDL.
-* Note that this is a direct Java implementation
-* of the abstract value type: there is no stateful value type defined in IDL,
-* since defining the state in IDL is awkward and inefficient. The best way
-* to define the state is to use internal data structures that can be written
-* to and read from CORBA streams.
-*/
-public class ObjectReferenceTemplateImpl extends ObjectReferenceProducerBase
- implements ObjectReferenceTemplate, StreamableValue
-{
- transient private IORTemplate iorTemplate ;
-
- public ObjectReferenceTemplateImpl( InputStream is )
- {
- super( (ORB)(is.orb()) ) ;
- _read( is ) ;
- }
-
- public ObjectReferenceTemplateImpl( ORB orb, IORTemplate iortemp )
- {
- super( orb ) ;
- iorTemplate = iortemp ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ObjectReferenceTemplateImpl))
- return false ;
-
- ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl)obj ;
-
- return (iorTemplate != null) &&
- iorTemplate.equals( other.iorTemplate ) ;
- }
-
- public int hashCode()
- {
- return iorTemplate.hashCode() ;
- }
-
- // Note that this repository ID must reflect the implementation
- // of the abstract valuetype (that is, this class), not the
- // repository ID of the org.omg.PortableInterceptor.ObjectReferenceTemplate
- // class. This allows for multiple independent implementations
- // of the abstract valuetype, should that become necessary.
- public static final String repositoryId =
- "IDL:com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl:1.0" ;
-
- public String[] _truncatable_ids()
- {
- return new String[] { repositoryId } ;
- }
-
- public TypeCode _type()
- {
- return ObjectReferenceTemplateHelper.type() ;
- }
-
- /** Read the data into a (presumably) empty ORTImpl. This sets the
- * orb to the ORB of the InputStream.
- */
- public void _read( InputStream is )
- {
- org.omg.CORBA_2_3.portable.InputStream istr =
- (org.omg.CORBA_2_3.portable.InputStream)is ;
- iorTemplate = IORFactories.makeIORTemplate( istr ) ;
- orb = (ORB)(istr.orb()) ;
- }
-
- /** Write the state to the OutputStream.
- */
- public void _write( OutputStream os )
- {
- org.omg.CORBA_2_3.portable.OutputStream ostr =
- (org.omg.CORBA_2_3.portable.OutputStream)os ;
-
- iorTemplate.write( ostr ) ;
- }
-
- public String server_id ()
- {
- int val = iorTemplate.getObjectKeyTemplate().getServerId() ;
- return Integer.toString( val ) ;
- }
-
- public String orb_id ()
- {
- return iorTemplate.getObjectKeyTemplate().getORBId() ;
- }
-
- public String[] adapter_name()
- {
- ObjectAdapterId poaid =
- iorTemplate.getObjectKeyTemplate().getObjectAdapterId() ;
-
- return poaid.getAdapterName() ;
- }
-
- public IORFactory getIORFactory()
- {
- return iorTemplate ;
- }
-
- public IORTemplateList getIORTemplateList()
- {
- IORTemplateList tl = IORFactories.makeIORTemplateList() ;
- tl.add( iorTemplate ) ;
- tl.makeImmutable() ;
- return tl ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java 2018-01-30 20:17:47.000000000 -0500
+++ /dev/null 2018-01-30 20:17:47.000000000 -0500
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream ;
-
-/**
- * Handles object keys created by JDK ORBs from before JDK 1.4.0.
- */
-public final class OldJIDLObjectKeyTemplate extends OldObjectKeyTemplateBase
-{
- /**
- * JDK 1.3.1 FCS did not include a version byte at the end of
- * its object keys. JDK 1.3.1_01 included the byte with the
- * value 1. Anything below 1 is considered an invalid value.
- */
- public static final byte NULL_PATCH_VERSION = 0;
-
- byte patchVersion = OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION;
-
- public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid,
- InputStream is, OctetSeqHolder osh )
- {
- this( orb, magic, scid, is );
-
- osh.value = readObjectKey( is ) ;
-
- /**
- * Beginning with JDK 1.3.1_01, a byte was placed at the end of
- * the object key with a value indicating the patch version.
- * JDK 1.3.1_01 had the value 1. If other patches are necessary
- * which involve ORB versioning changes, they should increment
- * the patch version.
- *
- * Note that if we see a value greater than 1 in this code, we
- * will treat it as if we're talking to the most recent ORB version.
- *
- * WARNING: This code is sensitive to changes in CDRInputStream
- * getPosition. It assumes that the CDRInputStream is an
- * encapsulation whose position can be compared to the object
- * key array length.
- */
- if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW &&
- osh.value.length > ((CDRInputStream)is).getPosition()) {
-
- patchVersion = is.read_octet();
-
- if (patchVersion == ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
- setORBVersion(ORBVersionFactory.getJDK1_3_1_01());
- else if (patchVersion > ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
- setORBVersion(ORBVersionFactory.getORBVersion());
- else
- throw wrapper.invalidJdk131PatchLevel( new Integer( patchVersion ) ) ;
- }
- }
-
-
- public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, int serverid)
- {
- super( orb, magic, scid, serverid, JIDL_ORB_ID, JIDL_OAID ) ;
- }
-
- public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is)
- {
- this( orb, magic, scid, is.read_long() ) ;
- }
-
- protected void writeTemplate( OutputStream os )
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
- }
-
- public void write(ObjectId objectId, OutputStream os)
- {
- super.write(objectId, os);
-
- if (patchVersion != OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION)
- os.write_octet( patchVersion ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java 2018-01-30 20:17:48.000000000 -0500
+++ /dev/null 2018-01-30 20:17:48.000000000 -0500
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author Ken Cavanaugh
- */
-public abstract class OldObjectKeyTemplateBase extends ObjectKeyTemplateBase
-{
- public OldObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
- String orbid, ObjectAdapterId oaid )
- {
- super( orb, magic, scid, serverid, orbid, oaid ) ;
-
- // set version based on magic
- if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
- setORBVersion( ORBVersionFactory.getOLD() ) ;
- else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
- setORBVersion( ORBVersionFactory.getNEW() ) ;
- else // any other magic should not be here
- throw wrapper.badMagic( new Integer( magic ) ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java 2018-01-30 20:17:48.000000000 -0500
+++ /dev/null 2018-01-30 20:17:48.000000000 -0500
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.OctetSeqHolder ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-/**
- * @author Ken Cavanaugh
- */
-public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase
-{
- /** This constructor reads the template ONLY from the stream
- */
- public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
- {
- this( orb, magic, scid, is.read_long(), is.read_long(), is.read_long() ) ;
- }
-
- /** This constructor reads a complete ObjectKey (template and Id)
- * from the stream.
- */
- public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
- OctetSeqHolder osh )
- {
- this( orb, magic, scid, is ) ;
- osh.value = readObjectKey( is ) ;
- }
-
- public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, int serverid,
- int orbid, int poaid)
- {
- super( orb, magic, scid, serverid,
- Integer.toString( orbid ),
- new ObjectAdapterIdNumber( poaid ) ) ;
- }
-
- public void writeTemplate(OutputStream os)
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
-
- int orbid = Integer.parseInt( getORBId() ) ;
- os.write_long( orbid ) ;
-
- ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber)(getObjectAdapterId()) ;
- int poaid = oaid.getOldPOAId() ;
- os.write_long( poaid ) ;
- }
-
- public ORBVersion getORBVersion()
- {
- if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
- return ORBVersionFactory.getOLD() ;
- else if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
- return ORBVersionFactory.getNEW() ;
- else
- throw new INTERNAL() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java 2018-01-30 20:17:49.000000000 -0500
+++ /dev/null 2018-01-30 20:17:49.000000000 -0500
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.util.Iterator ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import com.sun.corba.se.spi.activation.POANameHelper ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
-
-public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase
-{
- /** This constructor reads the template ONLY from the stream.
- */
- public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
- {
- super( orb, magic, scid, is.read_long(), is.read_string(),
- new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
-
- setORBVersion( is ) ;
- }
-
- /** This constructor reads a complete ObjectKey (template and Id)
- * from the stream.
- */
- public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
- OctetSeqHolder osh )
- {
- super( orb, magic, scid, is.read_long(), is.read_string(),
- new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
-
- osh.value = readObjectKey( is ) ;
-
- setORBVersion( is ) ;
- }
-
- public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid,
- ObjectAdapterId objectAdapterId)
- {
- super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid,
- objectAdapterId ) ;
-
- setORBVersion( ORBVersionFactory.getORBVersion() ) ;
- }
-
- public void writeTemplate(OutputStream os)
- {
- os.write_long( getMagic() ) ;
- os.write_long( getSubcontractId() ) ;
- os.write_long( getServerId() ) ;
- os.write_string( getORBId() ) ;
- getObjectAdapterId().write( os ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java 2018-01-30 20:17:50.000000000 -0500
+++ /dev/null 2018-01-30 20:17:50.000000000 -0500
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.ior;
-
-import java.io.ObjectInputStream ;
-import java.io.ObjectOutputStream ;
-import java.io.IOException ;
-import java.io.StringWriter ;
-
-import org.omg.CORBA.ORB ;
-
-import org.omg.CORBA.portable.Delegate ;
-import org.omg.CORBA.portable.InputStream ;
-import org.omg.CORBA.portable.OutputStream ;
-
-// Be very careful: com.sun.corba imports must not depend on
-// PEORB internal classes in ways that prevent portability to
-// other vendor's ORBs.
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
-import com.sun.corba.se.impl.orbutil.HexOutputStream ;
-
-/**
- * This class implements a very simply IOR representation
- * which must be completely ORBImpl free so that this class
- * can be used in the implementation of a portable StubDelegateImpl.
- */
-public class StubIORImpl
-{
- // cached hash code
- private int hashCode;
-
- // IOR components
- private byte[] typeData;
- private int[] profileTags;
- private byte[][] profileData;
-
- public StubIORImpl()
- {
- hashCode = 0 ;
- typeData = null ;
- profileTags = null ;
- profileData = null ;
- }
-
- public String getRepositoryId()
- {
- if (typeData == null)
- return null ;
-
- return new String( typeData ) ;
- }
-
- public StubIORImpl( org.omg.CORBA.Object obj )
- {
- // write the IOR to an OutputStream and get an InputStream
- OutputStream ostr = StubAdapter.getORB( obj ).create_output_stream();
- ostr.write_Object(obj);
- InputStream istr = ostr.create_input_stream();
-
- // read the IOR components back from the stream
- int typeLength = istr.read_long();
- typeData = new byte[typeLength];
- istr.read_octet_array(typeData, 0, typeLength);
- int numProfiles = istr.read_long();
- profileTags = new int[numProfiles];
- profileData = new byte[numProfiles][];
- for (int i = 0; i < numProfiles; i++) {
- profileTags[i] = istr.read_long();
- profileData[i] = new byte[istr.read_long()];
- istr.read_octet_array(profileData[i], 0, profileData[i].length);
- }
- }
-
- public Delegate getDelegate( ORB orb )
- {
- // write the IOR components to an org.omg.CORBA.portable.OutputStream
- OutputStream ostr = orb.create_output_stream();
- ostr.write_long(typeData.length);
- ostr.write_octet_array(typeData, 0, typeData.length);
- ostr.write_long(profileTags.length);
- for (int i = 0; i < profileTags.length; i++) {
- ostr.write_long(profileTags[i]);
- ostr.write_long(profileData[i].length);
- ostr.write_octet_array(profileData[i], 0, profileData[i].length);
- }
-
- InputStream istr = ostr.create_input_stream() ;
-
- // read the IOR back from the stream
- org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
- return StubAdapter.getDelegate( obj ) ;
- }
-
- public void doRead( java.io.ObjectInputStream stream )
- throws IOException, ClassNotFoundException
- {
- // read the IOR from the ObjectInputStream
- int typeLength = stream.readInt();
- typeData = new byte[typeLength];
- stream.readFully(typeData);
- int numProfiles = stream.readInt();
- profileTags = new int[numProfiles];
- profileData = new byte[numProfiles][];
- for (int i = 0; i < numProfiles; i++) {
- profileTags[i] = stream.readInt();
- profileData[i] = new byte[stream.readInt()];
- stream.readFully(profileData[i]);
- }
- }
-
- public void doWrite( ObjectOutputStream stream )
- throws IOException
- {
- // write the IOR to the ObjectOutputStream
- stream.writeInt(typeData.length);
- stream.write(typeData);
- stream.writeInt(profileTags.length);
- for (int i = 0; i < profileTags.length; i++) {
- stream.writeInt(profileTags[i]);
- stream.writeInt(profileData[i].length);
- stream.write(profileData[i]);
- }
- }
-
- /**
- * Returns a hash code value for the object which is the same for all stubs
- * that represent the same remote object.
- * @return the hash code value.
- */
- public synchronized int hashCode()
- {
- if (hashCode == 0) {
-
- // compute the hash code
- for (int i = 0; i < typeData.length; i++) {
- hashCode = hashCode * 37 + typeData[i];
- }
-
- for (int i = 0; i < profileTags.length; i++) {
- hashCode = hashCode * 37 + profileTags[i];
- for (int j = 0; j < profileData[i].length; j++) {
- hashCode = hashCode * 37 + profileData[i][j];
- }
- }
- }
-
- return hashCode;
- }
-
- private boolean equalArrays( int[] data1, int[] data2 )
- {
- if (data1.length != data2.length)
- return false ;
-
- for (int ctr=0; ctr,[]data, ...]"}
- * @return a string representation of this stub.
- */
- public String toString()
- {
- StringBuffer result = new StringBuffer() ;
- result.append( "SimpleIORImpl[" ) ;
- String repositoryId = new String( typeData ) ;
- result.append( repositoryId ) ;
- for (int ctr=0; ctr32K
- CodeSetsComponent
- - none additional
- JavaCodebaseComponent
- - none additional
- ORBTypeComponent
- - none additional
- PoliciesComponent
- - none additional
-
-IdentifiableContainerBase (DONE)
- - Test iteratorById on Identifiables (DONE)
- - Iterator on id not present is empty (hasNext() == false)
- - Iterator on id present returns all ids in sequence
-IdEncapsulationContainerBase (DONE)
- - Test read sequence of TaggedComponents
- - Test writing sequence of TaggedComponents
-GenericIdEncapsulation (DONE)
- - Test by using for tagged profile and tagged component
- - write out and read back test
-IIOPAddress (DONE)
- - Constructed object returns correct values
- - equals:
- - false for non-IIOPAddress value
- - true iff ports and hosts match
-IIOPProfile (DONE)
- - construct from id, template; check that correct values are returned
- - write out and read back
- - no components for 1.0
- - components for >1.0
- - getObjectKey returns value constructed correctly
- - isEquivalent iff ids equal and templates equivalent
-IIOPProfileTemplate (DONE)
- - Constructed object contains correct values
- - isEquivalent iff address and template are equal
- - cannot have new components added after makeImmutable call
-IOR (DONE)
- - Constructed object contains correct values
- - IOR() has null typeid and no profiles (DONE)
- - IOR( String ) has given typeid and no profiles (DONE)
- - IOR( String, IIOPProfileTemplate, ObjectId ) has given typeid and
- one IIOPProfile corresponding to template and objectid
- - IOR( String, IORTemplate, ObjectId ) has profiles corresponding to
- IORTemplate and ObjectIds. (DONE)
- - IORTemplate( String, IORTemplate, ObjectIds ) has profiles
- corresponding to IORTemplate and ObjectIds (DONE)
- - IOR( IORTemplate, ObjectIds ) usual test (DONE)
- - write out/read back test (DONE)
- - Construct IOR with 2 IIOPProfiles, each with several components,
- and 2 GenericIdEncapsulation profiles, write out, read back,
- check for equals directly and by calling equals
- - cannot have new profiles added after makeImmutable call (DONE)
- - contained IIOPProfiles cannot have added components after
- makeImmutable call. (DONE)
-IORTemplate (DONE)
- - Constructed object contains correct value
-JIDLObjectKeyTemplate (DONE)
- - test that IDs match expected values when created from
- byte[] in ObjectKeyFactory.create
- - Constructed object contains correct values
- - write out and read back test
- - getId correctly extract id from key
-FreezableList (DONE)
- - ASSUME that it acts like a linked list: don't test entire interface
- - all modification operations throw UnsupportedOperationException
- after makeImmutable call
- - all iterators (whether created before or after makeImmutable call)
- throw U.O.E. after makeImmutable
-ObjectId (DONE)
- - constructed object returns same id
- - test cases in equals
-ObjectKey (DONE)
- - constructed object returns same id, template
- - write/read test
- - getBytes returns correct value (test by using factory and
- comparing)
-ObjectKeyFactory (DONE)
- - test create with hand created keys
- - key length < 4
- - key length >= 4
- - magic is JAVAMAGIC
- - scid is POA scid
- - scid is JIDL scid
- - other scid
- - magic is not JAVAMAGIC
- - test with error cases on length
-POAObjectKeyTemplate (DONE)
- - test that IDs match expected values when created from
- byte[] in ObjectKeyFactory.create
- - test that IDs match when created with explicit values
- - write out and read back test
- - getId correctly extracts id from key
-TaggedComponentFactories (DONE)
- - only tested inditectly by reading and writing IIOPProfileTemplate
- that contains all components
-TaggedComponentFactoryFinder (DONE)
- - registered factory can be looked up
- - lookup of unregistered factory returns null
- - reads tagged component from stream as correct type if registered
- - reads tagged component from stream as generic if not registered
-TaggedProfileFactoryFinder (DONE)
- - reads IIOP profile as IIOPProfile
- - reads others as Generic
-WireObjectTemplate (DONE)
- - getId returns entire key as id
- - serverId is -1
- - write out and read back test
-
-Interfaces (no tests):
- IdEncapsulation
- IdEncapsulationFactory
- IdEncapsulationFactoryFinder
- Identifiable
- ObjectKeyTemplateo
- ObjectKeyTemplate
- TaggedComponent
- TaggedProfile
- TaggedProfileTemplate
- Writeable
-
-Trivial classes:
- ObjectIds
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java 2018-01-30 20:17:53.000000000 -0500
+++ /dev/null 2018-01-30 20:17:53.000000000 -0500
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior;
-
-import org.omg.CORBA.OctetSeqHolder ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.encoding.CDRInputStream ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class WireObjectKeyTemplate implements ObjectKeyTemplate
-{
- private ORB orb ;
- private IORSystemException wrapper ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- return obj instanceof WireObjectKeyTemplate ;
- }
-
- public int hashCode()
- {
- return 53 ; // All WireObjectKeyTemplates are the same, so they should
- // have the same hashCode.
- }
-
- private byte[] getId( InputStream is )
- {
- CDRInputStream cis = (CDRInputStream)is ;
- int len = cis.getBufferLength() ;
- byte[] result = new byte[ len ] ;
- cis.read_octet_array( result, 0, len ) ;
- return result ;
- }
-
- public WireObjectKeyTemplate( ORB orb )
- {
- initORB( orb ) ;
- }
-
- public WireObjectKeyTemplate( InputStream is, OctetSeqHolder osh )
- {
- osh.value = getId( is ) ;
- initORB( (ORB)(is.orb())) ;
- }
-
- private void initORB( ORB orb )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- public void write( ObjectId id, OutputStream os )
- {
- byte[] key = id.getId() ;
- os.write_octet_array( key, 0, key.length ) ;
- }
-
- public void write( OutputStream os )
- {
- // Does nothing
- }
-
- public int getSubcontractId()
- {
- return ORBConstants.DEFAULT_SCID ;
- }
-
- /** While it might make sense to throw an exception here, this causes
- * problems since we need to check whether unusual object references
- * are local or not. It seems that the easiest way to handle this is
- * to return an invalid server id.
- */
- public int getServerId()
- {
- return -1 ;
- }
-
- public String getORBId()
- {
- throw wrapper.orbIdNotAvailable() ;
- }
-
- public ObjectAdapterId getObjectAdapterId()
- {
- throw wrapper.objectAdapterIdNotAvailable() ;
- }
-
- /** Adapter ID is not available, since our
- * ORB did not implement the object carrying this key.
- */
- public byte[] getAdapterId()
- {
- throw wrapper.adapterIdNotAvailable() ;
- }
-
- public ORBVersion getORBVersion()
- {
- return ORBVersionFactory.getFOREIGN() ;
- }
-
- public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id )
- {
- byte[] bid = id.getId() ;
- String str = new String( bid ) ;
- return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( str ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java 2018-01-30 20:17:54.000000000 -0500
+++ /dev/null 2018-01-30 20:17:54.000000000 -0500
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent ;
-
-import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase
- implements AlternateIIOPAddressComponent
-{
- private IIOPAddress addr ;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof AlternateIIOPAddressComponentImpl))
- return false ;
-
- AlternateIIOPAddressComponentImpl other =
- (AlternateIIOPAddressComponentImpl)obj ;
-
- return addr.equals( other.addr ) ;
- }
-
- public int hashCode()
- {
- return addr.hashCode() ;
- }
-
- public String toString()
- {
- return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ;
- }
-
- public AlternateIIOPAddressComponentImpl( IIOPAddress addr )
- {
- this.addr = addr ;
- }
-
- public IIOPAddress getAddress()
- {
- return addr ;
- }
-
- public void writeContents(OutputStream os)
- {
- addr.write( os ) ;
- }
-
- public int getId()
- {
- return TAG_ALTERNATE_IIOP_ADDRESS.value ; // 3 in CORBA 2.3.1 13.6.3
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java 2018-01-30 20:17:54.000000000 -0500
+++ /dev/null 2018-01-30 20:17:54.000000000 -0500
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent ;
-
-import org.omg.IOP.TAG_CODE_SETS ;
-
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
-import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
-import com.sun.corba.se.impl.encoding.MarshalInputStream ;
-
-public class CodeSetsComponentImpl extends TaggedComponentBase
- implements CodeSetsComponent
-{
- CodeSetComponentInfo csci ;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof CodeSetsComponentImpl))
- return false ;
-
- CodeSetsComponentImpl other = (CodeSetsComponentImpl)obj ;
-
- return csci.equals( other.csci ) ;
- }
-
- public int hashCode()
- {
- return csci.hashCode() ;
- }
-
- public String toString()
- {
- return "CodeSetsComponentImpl[csci=" + csci + "]" ;
- }
-
- public CodeSetsComponentImpl()
- {
- // Uses our default code sets (see CodeSetComponentInfo)
- csci = new CodeSetComponentInfo() ;
- }
-
- public CodeSetsComponentImpl( InputStream is )
- {
- csci = new CodeSetComponentInfo() ;
- csci.read( (MarshalInputStream)is ) ;
- }
-
- public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb)
- {
- if (orb == null)
- csci = new CodeSetComponentInfo();
- else
- csci = orb.getORBData().getCodeSetComponentInfo();
- }
-
- public CodeSetComponentInfo getCodeSetComponentInfo()
- {
- return csci ;
- }
-
- public void writeContents(OutputStream os)
- {
- csci.write( (MarshalOutputStream)os ) ;
- }
-
- public int getId()
- {
- return TAG_CODE_SETS.value ; // 1 in CORBA 2.3.1 13.6.3
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java 2018-01-30 20:17:55.000000000 -0500
+++ /dev/null 2018-01-30 20:17:55.000000000 -0500
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop ;
-
-import org.omg.CORBA.BAD_PARAM ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-
-abstract class IIOPAddressBase implements IIOPAddress
-{
- // Ports are marshalled as shorts on the wire. The IDL
- // type is unsigned short, which lacks a convenient representation
- // in Java in the 32768-65536 range. So, we treat ports as
- // ints throught this code, except that marshalling requires a
- // scaling conversion. intToShort and shortToInt are provided
- // for this purpose.
- protected short intToShort( int value )
- {
- if (value > 32767)
- return (short)(value - 65536) ;
- return (short)value ;
- }
-
- protected int shortToInt( short value )
- {
- if (value < 0)
- return value + 65536 ;
- return value ;
- }
-
- public void write( OutputStream os )
- {
- os.write_string( getHost() ) ;
- int port = getPort() ;
- os.write_short( intToShort( port ) ) ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof IIOPAddress))
- return false ;
-
- IIOPAddress other = (IIOPAddress)obj ;
-
- return getHost().equals(other.getHost()) &&
- (getPort() == other.getPort()) ;
- }
-
- public int hashCode()
- {
- return getHost().hashCode() ^ getPort() ;
- }
-
- public String toString()
- {
- return "IIOPAddress[" + getHost() + "," + getPort() + "]" ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java 2018-01-30 20:17:56.000000000 -0500
+++ /dev/null 2018-01-30 20:17:56.000000000 -0500
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA.BAD_PARAM ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-
-public final class IIOPAddressClosureImpl extends IIOPAddressBase
-{
- private Closure host;
- private Closure port;
-
- public IIOPAddressClosureImpl( Closure host, Closure port )
- {
- this.host = host ;
- this.port = port ;
- }
-
- public String getHost()
- {
- return (String)(host.evaluate()) ;
- }
-
- public int getPort()
- {
- Integer value = (Integer)(port.evaluate()) ;
- return value.intValue() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java 2018-01-30 20:17:56.000000000 -0500
+++ /dev/null 2018-01-30 20:17:56.000000000 -0500
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA.BAD_PARAM ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.IORSystemException ;
-
-public final class IIOPAddressImpl extends IIOPAddressBase
-{
- private ORB orb ;
- private IORSystemException wrapper ;
- private String host;
- private int port;
-
- public IIOPAddressImpl( ORB orb, String host, int port )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
-
- if ((port < 0) || (port > 65535))
- throw wrapper.badIiopAddressPort( new Integer(port)) ;
-
- this.host = host ;
- this.port = port ;
- }
-
- public IIOPAddressImpl( InputStream is )
- {
- host = is.read_string() ;
- short thePort = is.read_short() ;
- port = shortToInt( thePort ) ;
- }
-
- public String getHost()
- {
- return host ;
- }
-
- public int getPort()
- {
- return port ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java 2018-01-30 20:17:57.000000000 -0500
+++ /dev/null 2018-01-30 20:17:57.000000000 -0500
@@ -1,348 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import java.util.List ;
-import java.util.Iterator ;
-
-import org.omg.CORBA.SystemException ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-import org.omg.CORBA_2_3.portable.InputStream ;
-
-import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
-import org.omg.IOP.TAG_INTERNET_IOP;
-import org.omg.IOP.TAG_JAVA_CODEBASE;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.IdentifiableBase ;
-import com.sun.corba.se.spi.ior.IORFactories ;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.ior.EncapsulationUtility ;
-
-import com.sun.corba.se.impl.encoding.EncapsInputStream ;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import sun.corba.EncapsInputStreamFactory;
-
-import com.sun.corba.se.impl.util.JDKBridge;
-
-import com.sun.corba.se.impl.logging.IORSystemException;
-
-public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile
-{
- private ORB orb ;
- private IORSystemException wrapper ;
- private ObjectId oid;
- private IIOPProfileTemplate proftemp;
- private ObjectKeyTemplate oktemp ;
-
- // Cached lookups
- protected String codebase = null ;
- protected boolean cachedCodebase = false;
-
- private boolean checkedIsLocal = false ;
- private boolean cachedIsLocal = false ;
-
- // initialize-on-demand holder
- private static class LocalCodeBaseSingletonHolder {
- public static JavaCodebaseComponent comp ;
-
- static {
- String localCodebase = JDKBridge.getLocalCodebase() ;
- if (localCodebase == null)
- comp = null ;
- else
- comp = IIOPFactories.makeJavaCodebaseComponent(
- localCodebase ) ;
- }
- }
-
- private GIOPVersion giopVersion = null;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof IIOPProfileImpl))
- return false ;
-
- IIOPProfileImpl other = (IIOPProfileImpl)obj ;
-
- return oid.equals( other.oid ) && proftemp.equals( other.proftemp ) &&
- oktemp.equals( other.oktemp ) ;
- }
-
- public int hashCode()
- {
- return oid.hashCode() ^ proftemp.hashCode() ^ oktemp.hashCode() ;
- }
-
- public ObjectId getObjectId()
- {
- return oid ;
- }
-
- public TaggedProfileTemplate getTaggedProfileTemplate()
- {
- return proftemp ;
- }
-
- public ObjectKeyTemplate getObjectKeyTemplate()
- {
- return oktemp ;
- }
-
- private IIOPProfileImpl( ORB orb )
- {
- this.orb = orb ;
- wrapper = IORSystemException.get( orb,
- CORBALogDomains.OA_IOR ) ;
- }
-
- public IIOPProfileImpl( ORB orb, ObjectKeyTemplate oktemp, ObjectId oid,
- IIOPProfileTemplate proftemp )
- {
- this( orb ) ;
- this.oktemp = oktemp ;
- this.oid = oid ;
- this.proftemp = proftemp ;
- }
-
- public IIOPProfileImpl( InputStream is )
- {
- this( (ORB)(is.orb()) ) ;
- init( is ) ;
- }
-
- public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile)
- {
- this( orb ) ;
-
- if (profile == null || profile.tag != TAG_INTERNET_IOP.value ||
- profile.profile_data == null) {
- throw wrapper.invalidTaggedProfile() ;
- }
-
- EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
- profile.profile_data.length);
- istr.consumeEndian();
- init( istr ) ;
- }
-
- private void init( InputStream istr )
- {
- // First, read all of the IIOP IOR data
- GIOPVersion version = new GIOPVersion() ;
- version.read( istr ) ;
- IIOPAddress primary = new IIOPAddressImpl( istr ) ;
- byte[] key = EncapsulationUtility.readOctets( istr ) ;
-
- ObjectKey okey = orb.getObjectKeyFactory().create( key ) ;
- oktemp = okey.getTemplate() ;
- oid = okey.getId() ;
-
- proftemp = IIOPFactories.makeIIOPProfileTemplate( orb,
- version, primary ) ;
-
- // Handle any tagged components (if applicable)
- if (version.getMinor() > 0)
- EncapsulationUtility.readIdentifiableSequence( proftemp,
- orb.getTaggedComponentFactoryFinder(), istr ) ;
-
- // If there is no codebase in this IOR and there IS a
- // java.rmi.server.codebase property set, we need to
- // update the IOR with the local codebase. Note that
- // there is only one instance of the local codebase, but it
- // can be safely shared in multiple IORs since it is immutable.
- if (uncachedGetCodeBase() == null) {
- JavaCodebaseComponent jcc = LocalCodeBaseSingletonHolder.comp ;
-
- if (jcc != null) {
- if (version.getMinor() > 0)
- proftemp.add( jcc ) ;
-
- codebase = jcc.getURLs() ;
- }
-
- // Whether codebase is null or not, we have it,
- // and so getCodebase ned never call uncachedGetCodebase.
- cachedCodebase = true;
- }
- }
-
- public void writeContents(OutputStream os)
- {
- proftemp.write( oktemp, oid, os ) ;
- }
-
- public int getId()
- {
- return proftemp.getId() ;
- }
-
- public boolean isEquivalent( TaggedProfile prof )
- {
- if (!(prof instanceof IIOPProfile))
- return false ;
-
- IIOPProfile other = (IIOPProfile)prof ;
-
- return oid.equals( other.getObjectId() ) &&
- proftemp.isEquivalent( other.getTaggedProfileTemplate() ) &&
- oktemp.equals( other.getObjectKeyTemplate() ) ;
- }
-
- public ObjectKey getObjectKey()
- {
- ObjectKey result = IORFactories.makeObjectKey( oktemp, oid ) ;
- return result ;
- }
-
- public org.omg.IOP.TaggedProfile getIOPProfile()
- {
- EncapsOutputStream os =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
- os.write_long( getId() ) ;
- write( os ) ;
- InputStream is = (InputStream)(os.create_input_stream()) ;
- return org.omg.IOP.TaggedProfileHelper.read( is ) ;
- }
-
- private String uncachedGetCodeBase() {
- Iterator iter = proftemp.iteratorById( TAG_JAVA_CODEBASE.value ) ;
-
- if (iter.hasNext()) {
- JavaCodebaseComponent jcbc = (JavaCodebaseComponent)(iter.next()) ;
- return jcbc.getURLs() ;
- }
-
- return null ;
- }
-
- public synchronized String getCodebase() {
- if (!cachedCodebase) {
- cachedCodebase = true ;
- codebase = uncachedGetCodeBase() ;
- }
-
- return codebase ;
- }
-
- /**
- * @return the ORBVersion associated with the object key in the IOR.
- */
- public ORBVersion getORBVersion() {
- return oktemp.getORBVersion();
- }
-
- public synchronized boolean isLocal()
- {
- if (!checkedIsLocal) {
- checkedIsLocal = true ;
- String host = proftemp.getPrimaryAddress().getHost() ;
-
- cachedIsLocal = orb.isLocalHost(host) &&
- orb.isLocalServerId(oktemp.getSubcontractId(),
- oktemp.getServerId()) &&
- orb.getLegacyServerSocketManager()
- .legacyIsLocalServerPort(
- proftemp.getPrimaryAddress().getPort());
- }
-
- return cachedIsLocal ;
- }
-
- /** Return the servant for this IOR, if it is local AND if the OA that
- * implements this objref supports direct access to servants outside of an
- * invocation.
- * XXX revisit: do we want this at all? If we do, it might move to the
- * ObjectKeyTemplate instead.
- */
- public java.lang.Object getServant()
- {
- if (!isLocal())
- return null ;
-
- RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
- ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(
- oktemp.getSubcontractId() ) ;
-
- ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
- ObjectAdapter oa = null ;
-
- try {
- oa = oaf.find( oaid ) ;
- } catch (SystemException exc) {
- // Could not find the OA, so just return null.
- // This usually happens when POAs are being deleted,
- // and the POA always return null for getLocalServant anyway.
- wrapper.getLocalServantFailure( exc, oaid.toString() ) ;
- return null ;
- }
-
- byte[] boid = oid.getId() ;
- java.lang.Object servant = oa.getLocalServant( boid ) ;
- return servant ;
- }
-
- /**
- * Return GIOPVersion for this IOR.
- * Requests created against this IOR will be of the
- * return Version.
- */
- public synchronized GIOPVersion getGIOPVersion()
- {
- return proftemp.getGIOPVersion() ;
- }
-
- public void makeImmutable()
- {
- proftemp.makeImmutable() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java 2018-01-30 20:17:58.000000000 -0500
+++ /dev/null 2018-01-30 20:17:58.000000000 -0500
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import java.util.Iterator ;
-
-import org.omg.IOP.TAG_INTERNET_IOP ;
-
-import org.omg.CORBA_2_3.portable.InputStream ;
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponent ;
-import com.sun.corba.se.spi.ior.TaggedProfile ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
-import com.sun.corba.se.spi.ior.TaggedProfileTemplateBase ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
-import com.sun.corba.se.spi.ior.IdentifiableBase ;
-
-import com.sun.corba.se.impl.ior.EncapsulationUtility ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
-
-import com.sun.corba.se.impl.encoding.CDROutputStream ;
-
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.orb.ORB ;
-
-/**
- * If getMinorVersion==0, this does not contain any tagged components
- */
-public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase
- implements IIOPProfileTemplate
-{
- private ORB orb ;
- private GIOPVersion giopVersion ;
- private IIOPAddress primary ;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof IIOPProfileTemplateImpl))
- return false ;
-
- IIOPProfileTemplateImpl other = (IIOPProfileTemplateImpl)obj ;
-
- return super.equals( obj ) && giopVersion.equals( other.giopVersion ) &&
- primary.equals( other.primary ) ;
- }
-
- public int hashCode()
- {
- return super.hashCode() ^ giopVersion.hashCode() ^ primary.hashCode() ;
- }
-
- public TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id )
- {
- return IIOPFactories.makeIIOPProfile( orb, oktemp, id, this ) ;
- }
-
- public GIOPVersion getGIOPVersion()
- {
- return giopVersion ;
- }
-
- public IIOPAddress getPrimaryAddress()
- {
- return primary ;
- }
-
- public IIOPProfileTemplateImpl( ORB orb, GIOPVersion version, IIOPAddress primary )
- {
- this.orb = orb ;
- this.giopVersion = version ;
- this.primary = primary ;
- if (giopVersion.getMinor() == 0)
- // Adding tagged components is not allowed for IIOP 1.0,
- // so this template is complete and should be made immutable.
- makeImmutable() ;
- }
-
- public IIOPProfileTemplateImpl( InputStream istr )
- {
- byte major = istr.read_octet() ;
- byte minor = istr.read_octet() ;
- giopVersion = GIOPVersion.getInstance( major, minor ) ;
- primary = new IIOPAddressImpl( istr ) ;
- orb = (ORB)(istr.orb()) ;
- // Handle any tagged components (if applicable)
- if (minor > 0)
- EncapsulationUtility.readIdentifiableSequence(
- this, orb.getTaggedComponentFactoryFinder(), istr ) ;
-
- makeImmutable() ;
- }
-
- public void write( ObjectKeyTemplate okeyTemplate, ObjectId id, OutputStream os)
- {
- giopVersion.write( os ) ;
- primary.write( os ) ;
-
- // Note that this is NOT an encapsulation: do not marshal
- // the endianness flag. However, the length is required.
- // Note that this cannot be accomplished with a codec!
-
- // Use the byte order of the given stream
- OutputStream encapsulatedOS =
- sun.corba.OutputStreamFactory.newEncapsOutputStream(
- (ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ;
-
- okeyTemplate.write( id, encapsulatedOS ) ;
- EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ;
-
- if (giopVersion.getMinor() > 0)
- EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
- }
-
- /** Write out this IIOPProfileTemplateImpl only.
- */
- public void writeContents( OutputStream os)
- {
- giopVersion.write( os ) ;
- primary.write( os ) ;
-
- if (giopVersion.getMinor() > 0)
- EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
- }
-
- public int getId()
- {
- return TAG_INTERNET_IOP.value ;
- }
-
- public boolean isEquivalent( TaggedProfileTemplate temp )
- {
- if (!(temp instanceof IIOPProfileTemplateImpl))
- return false ;
-
- IIOPProfileTemplateImpl tempimp = (IIOPProfileTemplateImpl)temp ;
-
- return primary.equals( tempimp.primary ) ;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java 2018-01-30 20:17:58.000000000 -0500
+++ /dev/null 2018-01-30 20:17:58.000000000 -0500
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.IOP.TAG_JAVA_CODEBASE ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ;
-
-public class JavaCodebaseComponentImpl extends TaggedComponentBase
- implements JavaCodebaseComponent
-{
- private String URLs ;
-
- public boolean equals( Object obj )
- {
- if (obj == null)
- return false ;
-
- if (!(obj instanceof JavaCodebaseComponentImpl))
- return false ;
-
- JavaCodebaseComponentImpl other = (JavaCodebaseComponentImpl)obj ;
-
- return URLs.equals( other.getURLs() ) ;
- }
-
- public int hashCode()
- {
- return URLs.hashCode() ;
- }
-
- public String toString()
- {
- return "JavaCodebaseComponentImpl[URLs=" + URLs + "]" ;
- }
-
- public String getURLs()
- {
- return URLs ;
- }
-
- public JavaCodebaseComponentImpl( String URLs )
- {
- this.URLs = URLs ;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_string( URLs ) ;
- }
-
- public int getId()
- {
- return TAG_JAVA_CODEBASE.value ; // 25 in CORBA 2.3.1 13.6.3
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java 2018-01-30 20:17:59.000000000 -0500
+++ /dev/null 2018-01-30 20:17:59.000000000 -0500
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.TaggedComponentBase;
-
-/**
- * Tagged component that contains a value that indicates the Java
- * serialization version supported by the ORB.
- *
- * ORB Java serialization uses IIOP as the transport protocol, but uses
- * Java serialization mechanism and its accompanying encodings, instead
- * of IIOP CDR serialization mechanism. Java serialization is generally
- * observed to be faster than CDR.
- */
-public class JavaSerializationComponent extends TaggedComponentBase {
-
- private byte version;
-
- private static JavaSerializationComponent singleton;
-
- public static JavaSerializationComponent singleton() {
- if (singleton == null) {
- synchronized (JavaSerializationComponent.class) {
- singleton =
- new JavaSerializationComponent(Message.JAVA_ENC_VERSION);
- }
- }
- return singleton;
- }
-
- public JavaSerializationComponent(byte version) {
- this.version = version;
- }
-
- public byte javaSerializationVersion() {
- return this.version;
- }
-
- public void writeContents(OutputStream os) {
- os.write_octet(version);
- }
-
- public int getId() {
- return ORBConstants.TAG_JAVA_SERIALIZATION_ID;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof JavaSerializationComponent)) {
- return false;
- }
- JavaSerializationComponent other = (JavaSerializationComponent) obj;
- return this.version == other.version;
- }
-
- public int hashCode() {
- return this.version;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java 2018-01-30 20:18:00.000000000 -0500
+++ /dev/null 2018-01-30 20:18:00.000000000 -0500
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- */
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import javax.rmi.CORBA.Util;
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.ValueHandlerMultiFormat;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase;
-
-import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent;
-
-// Java to IDL ptc 02-01-12 1.4.11
-// TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
-public class MaxStreamFormatVersionComponentImpl extends TaggedComponentBase
- implements MaxStreamFormatVersionComponent
-{
- private byte version;
-
- public static final MaxStreamFormatVersionComponentImpl singleton
- = new MaxStreamFormatVersionComponentImpl();
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof MaxStreamFormatVersionComponentImpl))
- return false ;
-
- MaxStreamFormatVersionComponentImpl other =
- (MaxStreamFormatVersionComponentImpl)obj ;
-
- return version == other.version ;
- }
-
- public int hashCode()
- {
- return version ;
- }
-
- public String toString()
- {
- return "MaxStreamFormatVersionComponentImpl[version=" + version + "]" ;
- }
-
- public MaxStreamFormatVersionComponentImpl()
- {
- version = ORBUtility.getMaxStreamFormatVersion();
- }
-
- public MaxStreamFormatVersionComponentImpl(byte streamFormatVersion) {
- version = streamFormatVersion;
- }
-
- public byte getMaxStreamFormatVersion()
- {
- return version;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_octet(version);
- }
-
- public int getId()
- {
- return TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java 2018-01-30 20:18:00.000000000 -0500
+++ /dev/null 2018-01-30 20:18:00.000000000 -0500
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.IOP.TAG_ORB_TYPE ;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase ;
-
-import com.sun.corba.se.spi.ior.iiop.ORBTypeComponent ;
-
-import org.omg.CORBA_2_3.portable.OutputStream ;
-
-/**
- * @author Ken Cavanaugh
- */
-public class ORBTypeComponentImpl extends TaggedComponentBase
- implements ORBTypeComponent
-{
- private int ORBType;
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ORBTypeComponentImpl))
- return false ;
-
- ORBTypeComponentImpl other = (ORBTypeComponentImpl)obj ;
-
- return ORBType == other.ORBType ;
- }
-
- public int hashCode()
- {
- return ORBType ;
- }
-
- public String toString()
- {
- return "ORBTypeComponentImpl[ORBType=" + ORBType + "]" ;
- }
-
- public ORBTypeComponentImpl(int ORBType)
- {
- this.ORBType = ORBType ;
- }
-
- public int getId()
- {
- return TAG_ORB_TYPE.value ; // 0 in CORBA 2.3.1 13.6.3
- }
-
- public int getORBType()
- {
- return ORBType ;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_ulong( ORBType ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java 2018-01-30 20:18:01.000000000 -0500
+++ /dev/null 2018-01-30 20:18:01.000000000 -0500
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- */
-package com.sun.corba.se.impl.ior.iiop;
-
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-import com.sun.corba.se.spi.ior.TaggedComponentBase;
-import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-
-public class RequestPartitioningComponentImpl extends TaggedComponentBase
- implements RequestPartitioningComponent
-{
- private static ORBUtilSystemException wrapper =
- ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
-
- private int partitionToUse;
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof RequestPartitioningComponentImpl))
- return false ;
-
- RequestPartitioningComponentImpl other =
- (RequestPartitioningComponentImpl)obj ;
-
- return partitionToUse == other.partitionToUse ;
- }
-
- public int hashCode()
- {
- return partitionToUse;
- }
-
- public String toString()
- {
- return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ;
- }
-
- public RequestPartitioningComponentImpl()
- {
- partitionToUse = 0;
- }
-
- public RequestPartitioningComponentImpl(int thePartitionToUse) {
- if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
- thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
- throw wrapper.invalidRequestPartitioningComponentValue(
- new Integer(thePartitionToUse),
- new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
- new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
- }
- partitionToUse = thePartitionToUse;
- }
-
- public int getRequestPartitioningId()
- {
- return partitionToUse;
- }
-
- public void writeContents(OutputStream os)
- {
- os.write_ulong(partitionToUse);
- }
-
- public int getId()
- {
- return ORBConstants.TAG_REQUEST_PARTITIONING_ID;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/notes 2018-01-30 20:18:02.000000000 -0500
+++ /dev/null 2018-01-30 20:18:02.000000000 -0500
@@ -1,317 +0,0 @@
-Notes on IOR implementation
-
-1. Writeable is an interface that can write itself to an OutputStream.
-
-2. IdEncapsulation is a particular kind of Writeable that has an Id and
- an Encapsulation (a sequence of bytes) representing some other structure
- in a CDR encapsulation.
-
-3. ContainerBase is a base class for containers of IdEncapsulations.
-
-4. An IOR is a ContainerBase.
-
-5. A TaggedComponent is not a ContainerBase.
-
-6. Some (not all) Profiles are ContainerBases.
-
-7. IIOPAddress contains (host, port)
- IIOPServerLocation contains:
- - A primary IIOPAddress
- - 0 or more secondary IIOPAddresses (these get placed in
- TAG_ALTERNATE_IIOP_ADDRESS components)
-
-8. IIOPProfileTemplate:
- - major, minor version
- - 0 or more TaggedComponents
- - ObjectKeyTemplate
-
-9. ObjectKeyTemplate:
- - contains only wire data, not internal structures
-
- write( object id, output stream ): write the object key out
- to the output stream with the given object id
-
-10. Significant problem: must of the dispatch path code is written in terms of
- IORs when it should be based on profiles. Only a single profile is used in
- a request, and that is what should be passed around. This needs fixing soon
- to accommodate the eventual implementation of CORBA FT, and also to work
- properly with the new IOR.
-
-11. Another question: since profile contains key which contains scid, what if
- we have multiple profiles with different scids?
- One answer: create a cluster subcontract that invokes the individual
- profiles for FT. This may not mesh well with the FT spec.
-
-12. Uses of IORs in the ORB:
-
-Activation/ServerManagerImpl.java
- - Construct IOR for bad ID handler location forward
-corba/ClientDelegate.java
- - marshal, getIOR, unmarshal are all questionable and make
- poor use of IOR.
- - gets forwarded IOR from response
- - IORs handled in some service contexts
- - createRequest needs to parse IOR
- - gets the (one) IIOP profile that we care about
- - gets the object key
-corba/InitialNamingClient.java
- - constructs IOR from address info, object key
- - current implementation should use AlternateIIOPAddress components
- - constructs IOR with key "INIT" for old bootstrap
-corba/ORB.java
- - stringify and destringify IOR
-corba/ServerDelegate.java
- - access IOR from sending context service context
- - destroyObjref directly access transient key from a known offset.
- - creation sets up key inline with known offsets
-core/IOR.java
- - IOR sometimes stores a servant
- - IOR contains the following
- - Object servant
- - Endpoint ep
- - String codebase
- - boolean cachedCodebase
- - TaggedComponent localCodeBaseTC
- - InternetIOPTag
- - The two constructors that take full args also
- construct tagged components
- - will need alternate address components for INS
-core/SendingContextServiceContext.java
- - reads IOR from input stream
-iiop/CDRInputStream.java
- - needs type id, code base from IOR
-iiop/IIOPOutputStream.java
- - needs to access objkey as a sequence of bytes to realing requests.
-POA/GenericPOAClientSC.java
- - needs to pull POA ID out of object key
- - needs to created a new IOR that has an updated scid
-POA/GenericPOAServerSC.java
- - creates IORs
-TransactionalPOA/TransactionalServerSC.java
- - inline access to known offset in object key to
- determine whether transactional
-
-Guide to the files:
-
-Basic Interfaces:
- Identifiable.java (Object has an Id)
- Writeable.java (Object can write to OutputStream)
- IdEncapsulation.java (Writeable, Identifiable interface)
- IdEncapsulationFactory.java (Factory interface for IdEncapsulation)
- IdEncapsulationFactoryFinder.java (Finder interface for IdEncapsulationFactoryFinder)
-
- IIOPAddress.java (class containing host and port for IIOP)
-
-Basic support for IdEncapsulations (shared for components and profiles):
- GenericIdEncapsulation.java (Has id, octet sequence: used for generic
- TaggedComponent and TaggedProfile objects)
- FreezableList.java (Delegated implementation of List that can be made
- immutable after construction)
- IdentifiableContainerBase.java (extends FreezableList: container of Identifiable:
- supports iteratorById.)
- IdEncapsulationContainerBase.java (extends IdenitifableContainerBase:
- container of IdEncapsulation: supports read/write IdEncapsulationSequence)
-
-Object Keys:
- ObjectKeyFactory.java
- ObjectKeyTemplate.java (interface for the following:)
- JIDLObjectKeyTemplate.java (object key used in *Delegate)
- POAObjectKeyTemplate.java (object key used in GenericPOA*SC)
- WireObjectKeyTemplate.java (used for non-Sun ORB IORs)
- ObjectId.java (a simple wrapper for byte[])
- ObjectKey.java (contains ObjectId and ObjectKeyTemplate)
-
-Components:
- TaggedComponentFactories.java (contains method for registering factories)
- TaggedComponentFactoryFinder.java (contains registered factories)
- TaggedComponent.java (interface of all tagged components)
- AlternateIIOPAddressComponent.java
- CodeSetsComponent.java
- JavaCodebaseComponent.java
- ORBTypeComponent.java
- PoliciesComponent.java
-
-Profiles:
- IIOPProfile.java (IIOPProfileTemplate and ObjectId)
- IIOPProfileTemplate.java (contains version, address, ObjectKeyTemplate,
- list of TaggedComponent)
- TaggedProfile.java (interface for all TaggedProfiles)
- TaggedProfileFactoryFinder.java
- TaggedProfileTemplate.java
-
-IOR:
- IOR.java
- IORTemplate.java (List of IIOPProfileTemplate
- ObjectIds.java (List of ObjectId: needed for an IOR constructor)
-
-Notes from integration code review:
-
-General:
- - Look at making IOR API public, or
- move everything into com.sun.corba.se.impl.ior
- (don't hold up putback for this)
- Making public:
- - Writeable needs getBytes() as well as write()
- methods.
- - codec can be used with an Any to convert between
- IDL data type and sequence of bytes.
- - write() needs to use getBytes, then write id, length,
- octets to output stream.
- - getBytes() method needs to get typecode from IDL
- then create Any.
- - IdEncapsulations need to have constructor that takes
- byte[] (encapsulation of value).
- Why not?
- - Unencapsulated object keys can't be made portable
- - Lots of dependencies on ORB code in ObjectKey support
- Conclusion:
- - move to internal (DONE)
- - JAVA_MAGIC should move to ObjectKeyTemplates (DONE)
- - check for intToBytes/bytesToInt related to object key
- corba/ServerDelegate (DONE)
- POA/GenericPOAServerSC (DONE)
- POA/SubcontractResponseHandler (DONE)
- TransactionalPOA/TransactionalClientSC.java (DONE)
- TransactionalPOA/TransactionalServerSC.java (DONE)
-
-./com/sun/corba/se/impl/cosnaming/BootstrapServer.java
- - remove sc_init_key_* (DONE)
-
-./com/sun/corba/se/impl/poa/POAImpl.java
- - remove line 130: comment on other endpoints, e.g. SSL (DONE)
- - add revisit comment on line 133: use multiple server port API (DONE)
-
-./com/sun/corba/se/impl/corba/ORB.java
- - object_to_string: add comment that connect only takes place in
- non-POA cases. (DONE)
-
-./com/sun/corba/se/impl/corba/ServerDelegate.java
- - chase down the object key offsets (DONE)
- (search for bytesToInt and intToBytes)
-
-./com/sun/corba/se/impl/core/SubcontractRegistry.java
- - getServerSubcontract: add b-e l-e comment and history on INIT, TINI (DONE)
- - getServerSubcontract: reference to constants (May not do this?)
- - getServerSubcontract: return null at end IS reachable, in the
- case where we have essentially a name in the key that isn't
- one of the ones we support. Throw an exception? (DONE)
- - add minor code for INTERNAL (and string) (DONE)
- - remove setId calls in callers to getClientSubcontract (DONE)
- - throw INTERNAL exception for temp.size() != 1 case (DONE)
- Think about INST corbaloc problems (multi-profile IORs)
- both return nulls should throw exceptions (DONE)
-
-./com/sun/corba/se/impl/core/IOR.java
- - Add some comments to getIORfromString about 4/2 constants (DONE)
- - fix name: should be getIORFromString (DONE)
- - IOR( InputStream ) has a problem with cachedCodeBase:
- is should not call getCodeBase: must refactor to
- an internal implementation method. (DONE)
- - isEquivalent and isLocal should assert failure
- if multiple profiles (through exception in getProfile) (DONE)
- (add comments about multi case)
-
-./com/sun/corba/se/impl/iiop/CDRInputStream_1_0.java
- - read_Object: add assert in case servant is not Tie or objref (DONE)
-
-./com/sun/corba/se/internal/TransactionalPOA/TransactionalPOAImpl.java
- - add comment about transactionalIortemplate: goes away after
- we get to OTS 1.2 transactional policy. (DONE)
- - change transactionalClone( ObjectKeyTemplate ) so that
- we get an error (INTERNAL) if NOT POAObjectKeyTemplate (DONE)
- - line 138: get string constant from
- org.omg.CosTransactions.TransactionalObject (DONE)
- - remove Delegate d decl. (DONE)
-
-We need to assign minor codes for all exceptions!
-
-We need to clean up the minor code base usage! (DONE)
-
-Add equals/toString to:
- Do not try to develop a reflective universal equals: too slow!
- Do we really want equals on lists?
- If we do, define collectionEqual on FreezableList
-
-CodeSetsComponent: toString
-FreezableList: basic toString, equals methods
-IIOPProfile: toString
-IIOPProfileTemplate: toString
-IOR: toString
-IORTemplate.java: toString, equals (inherit?)
-IdEncapsulationContainerBase.java: make abstract, but provide base toString/equals
-IdentifiableContainerBase.java: make abstract (no other changes)
- (ContainerBase classes need some explanation)
-ObjectIds.java needs toString, equals (use FreezableList?)
-ObjectKey: toString
-ObjectKeyFactory.java: singleton: don't add toString or equals
-PoliciesComponent.java: should finish this sometime (after we figure out
- exactly what to do with it)
-TaggedComponentBase.java: should be abstract
-TaggedComponentFactories.java: a singelton
-TaggedComponentFactoryFinder.java: a singleton
-TaggedProfileFactoryFinder.java: a singleton
-JIDLObjectKeyTemplate: toString
-POAObjectKeyTemplate: toString
-WireObjectKeyTemplate: toString uninteresting: no data, equals not useful
-
-use util/Utility.objectToString to implement toString methods.
-
-Other changes:
-
- IIOPAddress.toString should include class name (DONE)
-
- New tests needed:
- IIOPProfile.getIOPComponents
- IIOPProfile.getIOPProfile
- GenericTaggedProfile.getIOPComponents
- GenericTaggedProfile.getIOPProfile
- GenericTaggedComponent.getIOPComponent
- ObjectKeyTemplate.getAdapterId
-
- Plus, do a read/write test for IOP stuff:
- construct profile
- convert to IOP.TaggedProfile
- write to stream
- get input stream
- construct profile
- check for equal
-
- do some tests on IOR.toString() just to see what gets printed.
-
- Add getAdapterId to *ObjectKeyTemplate.java (DONE)
- Add some tests for this:
- - WireObjectKeyTemplate throws an exception
- - Identically constructed ObjectKeyTemplates produce identical Adapter Ids.
- - Different OKTs produce different adapter IDs.
-
-New tests for versioning support:
-
-ORBVersionFactory:
- - for create array methods (DONE)
- - returns expected values for version encodings
- - throws INTERNAL for negative version
- - test one case for create stream method (DONE)
- - getORBVersion returns correct version (DONE)
-ORBVersionImpl:
- - check equals on some ORBVersions (DONE)
- - check that each ORBVersion returns correct orbtype (DONE)
-JIDLObjectKeyTemplate:
- - non-key constructor gives NEWER version (DONE)
-POAObjectKeyTemplate:
- - non-key constructor gives NEWER version (DONE)
-OldJIDLObjectKeyTemplate: (DONE)
- - non-key constructor with OLD, NEW MAGIC and check version
- - other values throw exception
-OldPOAObjectKeyTemplate: (DONE)
- - non-key constructor with OLD, NEW MAGIC and check version (DONE)
- - other values throw exception (DONE)
-WireObjectKeyTemplate (DONE)
- - version is FOREIGN
-ObjectKeyFactory (DONE)
- create the following keys and check results:
- JIDL OLD OldJIDL with correct magic, version
- JIDL NEW OldJIDL
- JIDL NEWER JIDL
- POA OLD OldPOA
- POA NEW OldPOA
- POA NEWER POA
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java 2018-01-30 20:18:02.000000000 -0500
+++ /dev/null 2018-01-30 20:18:02.000000000 -0500
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.javax.rmi.CORBA;
-
-import java.io.IOException;
-
-import java.rmi.RemoteException;
-
-import javax.rmi.CORBA.Tie;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.BAD_INV_ORDER;
-
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.InputStream;
-
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.util.Utility;
-
-import com.sun.corba.se.impl.ior.StubIORImpl ;
-import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ;
-
-import com.sun.corba.se.impl.logging.UtilSystemException ;
-
-/**
- * Base class from which all static RMI-IIOP stubs must inherit.
- */
-public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate
-{
- static UtilSystemException wrapper = UtilSystemException.get(
- CORBALogDomains.RMIIIOP ) ;
-
- private StubIORImpl ior ;
-
- public StubIORImpl getIOR()
- {
- return ior ;
- }
-
- public StubDelegateImpl()
- {
- ior = null ;
- }
-
- /**
- * Sets the IOR components if not already set.
- */
- private void init (javax.rmi.CORBA.Stub self)
- {
- // If the Stub is not connected to an ORB, BAD_OPERATION exception
- // will be raised by the code below.
- if (ior == null)
- ior = new StubIORImpl( self ) ;
- }
-
- /**
- * Returns a hash code value for the object which is the same for all stubs
- * that represent the same remote object.
- * @return the hash code value.
- */
- public int hashCode(javax.rmi.CORBA.Stub self)
- {
- init(self);
- return ior.hashCode() ;
- }
-
- /**
- * Compares two stubs for equality. Returns true
when used to compare stubs
- * that represent the same remote object, and false
otherwise.
- * @param obj the reference object with which to compare.
- * @return true
if this object is the same as the obj
- * argument; false
otherwise.
- */
- public boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj)
- {
- if (self == obj) {
- return true;
- }
-
- if (!(obj instanceof javax.rmi.CORBA.Stub)) {
- return false;
- }
-
- // no need to call init() because of calls to hashCode() below
-
- javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub) obj;
- if (other.hashCode() != self.hashCode()) {
- return false;
- }
-
- // hashCodes being the same does not mean equality. The stubs still
- // could be pointing to different IORs. So, do a literal comparison.
- // Apparently the ONLY way to do this (other than using private
- // reflection) toString, because it is not possible to directly
- // access the StubDelegateImpl from the Stub.
- return self.toString().equals( other.toString() ) ;
- }
-
- public boolean equals( Object obj )
- {
- if (this == obj)
- return true ;
-
- if (!(obj instanceof StubDelegateImpl))
- return false ;
-
- StubDelegateImpl other = (StubDelegateImpl)obj ;
-
- if (ior == null)
- return ior == other.ior ;
- else
- return ior.equals( other.ior ) ;
- }
-
- public int hashCode() {
- if (ior == null) {
- return 0;
- } else {
- return ior.hashCode();
- }
- }
-
- /**
- * Returns a string representation of this stub. Returns the same string
- * for all stubs that represent the same remote object.
- * @return a string representation of this stub.
- */
- public String toString(javax.rmi.CORBA.Stub self)
- {
- if (ior == null)
- return null ;
- else
- return ior.toString() ;
- }
-
- /**
- * Connects this stub to an ORB. Required after the stub is deserialized
- * but not after it is demarshalled by an ORB stream. If an unconnected
- * stub is passed to an ORB stream for marshalling, it is implicitly
- * connected to that ORB. Application code should not call this method
- * directly, but should call the portable wrapper method
- * {@link javax.rmi.PortableRemoteObject#connect}.
- * @param orb the ORB to connect to.
- * @exception RemoteException if the stub is already connected to a different
- * ORB, or if the stub does not represent an exported remote or local object.
- */
- public void connect(javax.rmi.CORBA.Stub self, ORB orb)
- throws RemoteException
- {
- ior = StubConnectImpl.connect( ior, self, self, orb ) ;
- }
-
- /**
- * Serialization method to restore the IOR state.
- */
- public void readObject(javax.rmi.CORBA.Stub self,
- java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException
- {
- if (ior == null)
- ior = new StubIORImpl() ;
-
- ior.doRead( stream ) ;
- }
-
- /**
- * Serialization method to save the IOR state.
- * @serialData The length of the IOR type ID (int), followed by the IOR type ID
- * (byte array encoded using ISO8859-1), followed by the number of IOR profiles
- * (int), followed by the IOR profiles. Each IOR profile is written as a
- * profile tag (int), followed by the length of the profile data (int), followed
- * by the profile data (byte array).
- */
- public void writeObject(javax.rmi.CORBA.Stub self,
- java.io.ObjectOutputStream stream) throws IOException
- {
- init(self);
- ior.doWrite( stream ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java 2018-01-30 20:18:03.000000000 -0500
+++ /dev/null 2018-01-30 20:18:03.000000000 -0500
@@ -1,778 +0,0 @@
-/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.javax.rmi.CORBA; // Util (sed marker, don't remove!)
-
-import java.rmi.RemoteException;
-import java.rmi.UnexpectedException;
-import java.rmi.MarshalException;
-
-import java.rmi.server.RMIClassLoader;
-
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import java.io.Serializable;
-import java.io.NotSerializableException;
-
-import java.lang.reflect.Constructor;
-
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.Tie;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import java.rmi.MarshalException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.AccessException;
-import java.rmi.Remote;
-import java.rmi.ServerError;
-import java.rmi.ServerException;
-import java.rmi.ServerRuntimeException;
-
-import javax.transaction.TransactionRequiredException;
-import javax.transaction.TransactionRolledbackException;
-import javax.transaction.InvalidTransactionException;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INV_OBJREF;
-import org.omg.CORBA.NO_PERMISSION;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.TRANSACTION_REQUIRED;
-import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
-import org.omg.CORBA.INVALID_TRANSACTION;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.ACTIVITY_REQUIRED;
-import org.omg.CORBA.ACTIVITY_COMPLETED;
-import org.omg.CORBA.INVALID_ACTIVITY;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.portable.UnknownException;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-// This class must be able to function with non-Sun ORBs.
-// This means that any of the following com.sun.corba classes
-// must only occur in contexts that also handle the non-Sun case.
-
-import com.sun.corba.se.pept.transport.ContactInfoList ;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
-import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
-import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.impl.io.ValueHandlerImpl;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.logging.OMGSystemException;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.IdentityHashtable;
-import com.sun.corba.se.impl.util.JDKBridge;
-import com.sun.corba.se.impl.logging.UtilSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import sun.corba.SharedSecrets;
-
-
-/**
- * Provides utility methods that can be used by stubs and ties to
- * perform common operations.
- */
-public class Util implements javax.rmi.CORBA.UtilDelegate
-{
- // Runs as long as there are exportedServants
- private static KeepAlive keepAlive = null;
-
- // Maps targets to ties.
- private static IdentityHashtable exportedServants = new IdentityHashtable();
-
- private static final ValueHandlerImpl valueHandlerSingleton =
- SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl();
-
- private UtilSystemException utilWrapper = UtilSystemException.get(
- CORBALogDomains.RPC_ENCODING);
-
- private static Util instance = null;
-
- public Util() {
- setInstance(this);
- }
-
- private static void setInstance( Util util ) {
- assert instance == null : "Instance already defined";
- instance = util;
- }
-
- public static Util getInstance() {
- return instance;
- }
-
- public static boolean isInstanceDefined() {
- return instance != null;
- }
-
- // Used by TOAFactory.shutdown to unexport all targets for this
- // particular ORB. This happens during ORB shutdown.
- public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
- {
- for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
- {
- java.lang.Object key = e.nextElement();
- Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);
-
- // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
- // We can ignore this because it means the tie is not connected to an ORB.
- try {
- if (orb == getTie(target).orb()) {
- try {
- unexportObject(target);
- } catch( java.rmi.NoSuchObjectException ex ) {
- // We neglect this exception if at all if it is
- // raised. It is not harmful.
- }
- }
- } catch (BAD_OPERATION bad) {
- /* Ignore */
- }
- }
- }
-
- /**
- * Maps a SystemException to a RemoteException.
- * @param ex the SystemException to map.
- * @return the mapped exception.
- */
- public RemoteException mapSystemException(SystemException ex)
- {
- if (ex instanceof UnknownException) {
- Throwable orig = ((UnknownException)ex).originalEx;
- if (orig instanceof Error) {
- return new ServerError("Error occurred in server thread",(Error)orig);
- } else if (orig instanceof RemoteException) {
- return new ServerException("RemoteException occurred in server thread",
- (Exception)orig);
- } else if (orig instanceof RuntimeException) {
- throw (RuntimeException) orig;
- }
- }
-
- // Build the message string...
- String name = ex.getClass().getName();
- String corbaName = name.substring(name.lastIndexOf('.')+1);
- String status;
- switch (ex.completed.value()) {
- case CompletionStatus._COMPLETED_YES:
- status = "Yes";
- break;
- case CompletionStatus._COMPLETED_NO:
- status = "No";
- break;
- case CompletionStatus._COMPLETED_MAYBE:
- default:
- status = "Maybe";
- break;
- }
-
- String message = "CORBA " + corbaName + " " + ex.minor + " " + status;
-
- // Now map to the correct RemoteException type...
- if (ex instanceof COMM_FAILURE) {
- return new MarshalException(message, ex);
- } else if (ex instanceof INV_OBJREF) {
- RemoteException newEx = new NoSuchObjectException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof NO_PERMISSION) {
- return new AccessException(message, ex);
- } else if (ex instanceof MARSHAL) {
- return new MarshalException(message, ex);
- } else if (ex instanceof OBJECT_NOT_EXIST) {
- RemoteException newEx = new NoSuchObjectException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof TRANSACTION_REQUIRED) {
- RemoteException newEx = new TransactionRequiredException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof TRANSACTION_ROLLEDBACK) {
- RemoteException newEx = new TransactionRolledbackException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof INVALID_TRANSACTION) {
- RemoteException newEx = new InvalidTransactionException(message);
- newEx.detail = ex;
- return newEx;
- } else if (ex instanceof BAD_PARAM) {
- Exception inner = ex;
-
- // Pre-Merlin Sun ORBs used the incorrect minor code for
- // this case. See Java to IDL ptc-00-01-08 1.4.8.
- if (ex.minor == ORBConstants.LEGACY_SUN_NOT_SERIALIZABLE ||
- ex.minor == OMGSystemException.NOT_SERIALIZABLE) {
-
- if (ex.getMessage() != null)
- inner = new NotSerializableException(ex.getMessage());
- else
- inner = new NotSerializableException();
-
- inner.initCause( ex ) ;
- }
-
- return new MarshalException(message,inner);
- } else if (ex instanceof ACTIVITY_REQUIRED) {
- try {
- Class> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
- "javax.activity.ActivityRequiredException");
- Class[] params = new Class[2];
- params[0] = java.lang.String.class;
- params[1] = java.lang.Throwable.class;
- Constructor cr = cl.getConstructor(params);
- Object[] args = new Object[2];
- args[0] = message;
- args[1] = ex;
- return (RemoteException) cr.newInstance(args);
- } catch (Throwable e) {
- utilWrapper.classNotFound(
- e, "javax.activity.ActivityRequiredException");
- }
- } else if (ex instanceof ACTIVITY_COMPLETED) {
- try {
- Class> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
- "javax.activity.ActivityCompletedException");
- Class[] params = new Class[2];
- params[0] = java.lang.String.class;
- params[1] = java.lang.Throwable.class;
- Constructor cr = cl.getConstructor(params);
- Object[] args = new Object[2];
- args[0] = message;
- args[1] = ex;
- return (RemoteException) cr.newInstance(args);
- } catch (Throwable e) {
- utilWrapper.classNotFound(
- e, "javax.activity.ActivityCompletedException");
- }
- } else if (ex instanceof INVALID_ACTIVITY) {
- try {
- Class> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
- "javax.activity.InvalidActivityException");
- Class[] params = new Class[2];
- params[0] = java.lang.String.class;
- params[1] = java.lang.Throwable.class;
- Constructor cr = cl.getConstructor(params);
- Object[] args = new Object[2];
- args[0] = message;
- args[1] = ex;
- return (RemoteException) cr.newInstance(args);
- } catch (Throwable e) {
- utilWrapper.classNotFound(
- e, "javax.activity.InvalidActivityException");
- }
- }
-
- // Just map to a generic RemoteException...
- return new RemoteException(message, ex);
- }
-
- /**
- * Writes any java.lang.Object as a CORBA any.
- * @param out the stream in which to write the any.
- * @param obj the object to write as an any.
- */
- public void writeAny( org.omg.CORBA.portable.OutputStream out,
- java.lang.Object obj)
- {
- org.omg.CORBA.ORB orb = out.orb();
-
- // Create Any
- Any any = orb.create_any();
-
- // Make sure we have a connected object...
- java.lang.Object newObj = Utility.autoConnect(obj,orb,false);
-
- if (newObj instanceof org.omg.CORBA.Object) {
- any.insert_Object((org.omg.CORBA.Object)newObj);
- } else {
- if (newObj == null) {
- // Handle the null case, including backwards
- // compatibility issues
- any.insert_Value(null, createTypeCodeForNull(orb));
- } else {
- if (newObj instanceof Serializable) {
- // If they're our Any and ORB implementations,
- // we may want to do type code related versioning.
- TypeCode tc = createTypeCode((Serializable)newObj, any, orb);
- if (tc == null)
- any.insert_Value((Serializable)newObj);
- else
- any.insert_Value((Serializable)newObj, tc);
- } else if (newObj instanceof Remote) {
- ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
- } else {
- ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
- }
- }
- }
-
- out.write_any(any);
- }
-
- /**
- * When using our own ORB and Any implementations, we need to get
- * the ORB version and create the type code appropriately. This is
- * to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
- * rather than a tk_wchar to describe a Java char field.
- *
- * This only works in RMI-IIOP with Util.writeAny since we actually
- * know what ORB and stream we're writing with when we insert
- * the value.
- *
- * Returns null if it wasn't possible to create the TypeCode (means
- * it wasn't our ORB or Any implementation).
- *
- * This does not handle null objs.
- */
- private TypeCode createTypeCode(Serializable obj,
- org.omg.CORBA.Any any,
- org.omg.CORBA.ORB orb) {
-
- if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
- orb instanceof ORB) {
-
- com.sun.corba.se.impl.corba.AnyImpl anyImpl
- = (com.sun.corba.se.impl.corba.AnyImpl)any;
-
- ORB ourORB = (ORB)orb;
-
- return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);
-
- } else
- return null;
- }
-
-
- /**
- * This is used to create the TypeCode for a null reference.
- * It also handles backwards compatibility with JDK 1.3.x.
- *
- * This method will not return null.
- */
- private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
- {
- if (orb instanceof ORB) {
-
- ORB ourORB = (ORB)orb;
-
- // Preserve backwards compatibility with Kestrel and Ladybird
- // by not fully implementing interop issue resolution 3857,
- // and returning a null TypeCode with a tk_value TCKind.
- // If we're not talking to Kestrel or Ladybird, fall through
- // to the abstract interface case (also used for foreign ORBs).
- if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
- ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {
-
- return orb.get_primitive_tc(TCKind.tk_value);
- }
- }
-
- // Use tk_abstract_interface as detailed in the resolution
-
- // REVISIT: Define this in IDL and get the ID in generated code
- String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";
-
- return orb.create_abstract_interface_tc(abstractBaseID, "");
- }
-
- /**
- * Reads a java.lang.Object as a CORBA any.
- * @param in the stream from which to read the any.
- * @return the object read from the stream.
- */
- public Object readAny(InputStream in)
- {
- Any any = in.read_any();
- if ( any.type().kind().value() == TCKind._tk_objref )
- return any.extract_Object ();
- else
- return any.extract_Value();
- }
-
- /**
- * Writes a java.lang.Object as a CORBA Object. If {@code obj} is
- * an exported RMI-IIOP server object, the tie is found
- * and wired to {@code obj}, then written to {@code out.write_Object(org.omg.CORBA.Object)}.
- * If {@code obj} is a CORBA Object, it is written to
- * {@code out.write_Object(org.omg.CORBA.Object)}.
- * @param out the stream in which to write the object.
- * @param obj the object to write.
- */
- public void writeRemoteObject(OutputStream out, java.lang.Object obj)
- {
- // Make sure we have a connected object, then
- // write it out...
-
- Object newObj = Utility.autoConnect(obj,out.orb(),false);
- out.write_Object((org.omg.CORBA.Object)newObj);
- }
-
- /**
- * Writes a java.lang.Object as either a value or a CORBA Object.
- * If {@code obj} is a value object or a stub object, it is written to
- * {@code out.write_abstract_interface(java.lang.Object)}. If {@code obj} is an exported
- * RMI-IIOP server object, the tie is found and wired to {@code obj},
- * then written to {@code out.write_abstract_interface(java.lang.Object)}.
- * @param out the stream in which to write the object.
- * @param obj the object to write.
- */
- public void writeAbstractObject( OutputStream out, java.lang.Object obj )
- {
- // Make sure we have a connected object, then
- // write it out...
-
- Object newObj = Utility.autoConnect(obj,out.orb(),false);
- ((org.omg.CORBA_2_3.portable.OutputStream)out).write_abstract_interface(newObj);
- }
-
- /**
- * Registers a target for a tie. Adds the tie to an internal table and calls
- * {@link Tie#setTarget} on the tie object.
- * @param tie the tie to register.
- * @param target the target for the tie.
- */
- public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
- {
- synchronized (exportedServants) {
- // Do we already have this target registered?
- if (lookupTie(target) == null) {
- // No, so register it and set the target...
- exportedServants.put(target,tie);
- tie.setTarget(target);
-
- // Do we need to instantiate our keep-alive thread?
- if (keepAlive == null) {
- // Yes. Instantiate our keep-alive thread and start
- // it up...
- keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
- public java.lang.Object run() {
- return new KeepAlive();
- }
- });
- keepAlive.start();
- }
- }
- }
- }
-
- /**
- * Removes the associated tie from an internal table and calls {@link Tie#deactivate}
- * to deactivate the object.
- * @param target the object to unexport.
- */
- public void unexportObject(java.rmi.Remote target)
- throws java.rmi.NoSuchObjectException
- {
- synchronized (exportedServants) {
- Tie cachedTie = lookupTie(target);
- if (cachedTie != null) {
- exportedServants.remove(target);
- Utility.purgeStubForTie(cachedTie);
- Utility.purgeTieAndServant(cachedTie);
- try {
- cleanUpTie(cachedTie);
- } catch (BAD_OPERATION e) {
- // ignore
- } catch (org.omg.CORBA.OBJ_ADAPTER e) {
- // This can happen when the target was never associated with a POA.
- // We can safely ignore this case.
- }
-
- // Is it time to shut down our keep alive thread?
- if (exportedServants.isEmpty()) {
- keepAlive.quit();
- keepAlive = null;
- }
- } else {
- throw new java.rmi.NoSuchObjectException("Tie not found" );
- }
- }
- }
-
- protected void cleanUpTie(Tie cachedTie)
- throws java.rmi.NoSuchObjectException
- {
- cachedTie.setTarget(null);
- cachedTie.deactivate();
- }
-
- /**
- * Returns the tie (if any) for a given target object.
- * @return the tie or null if no tie is registered for the given target.
- */
- public Tie getTie (Remote target)
- {
- synchronized (exportedServants) {
- return lookupTie(target);
- }
- }
-
- /**
- * An unsynchronized version of getTie() for internal use.
- */
- private static Tie lookupTie (Remote target)
- {
- Tie result = (Tie)exportedServants.get(target);
- if (result == null && target instanceof Tie) {
- if (exportedServants.contains(target)) {
- result = (Tie)target;
- }
- }
- return result;
- }
-
- /**
- * Returns a singleton instance of a class that implements the
- * {@link ValueHandler} interface.
- * @return a class which implements the ValueHandler interface.
- */
- public ValueHandler createValueHandler()
- {
- return valueHandlerSingleton;
- }
-
- /**
- * Returns the codebase, if any, for the given class.
- * @param clz the class to get a codebase for.
- * @return a space-separated list of URLs, or null.
- */
- public String getCodebase(java.lang.Class clz) {
- return RMIClassLoader.getClassAnnotation(clz);
- }
-
- /**
- * Returns a class instance for the specified class.
- * @param className the name of the class.
- * @param remoteCodebase a space-separated list of URLs at which
- * the class might be found. May be null.
- * @param loader a class whose ClassLoader may be used to
- * load the class if all other methods fail.
- * @return the {@code Class} object representing the loaded class.
- * @exception ClassNotFoundException if class cannot be loaded.
- */
- public Class loadClass( String className, String remoteCodebase,
- ClassLoader loader) throws ClassNotFoundException
- {
- return JDKBridge.loadClass(className,remoteCodebase,loader);
- }
-
- /**
- * The {@code isLocal} method has the same semantics as the
- * ObjectImpl._is_local method, except that it can throw a RemoteException.
- * (no it doesn't but the spec says it should.)
- *
- * The {@code _is_local()} method is provided so that stubs may determine
- * if a particular object is implemented by a local servant and hence local
- * invocation APIs may be used.
- *
- * @param stub the stub to test.
- *
- * @return The {@code _is_local()} method returns true if
- * the servant incarnating the object is located in the same process as
- * the stub and they both share the same ORB instance. The {@code _is_local()}
- * method returns false otherwise. The default behavior of {@code _is_local()} is
- * to return false.
- *
- * @throws RemoteException The Java to IDL specification does to
- * specify the conditions that cause a RemoteException to be thrown.
- */
- public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException
- {
- boolean result = false ;
-
- try {
- org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
- if (delegate instanceof CorbaClientDelegate) {
- // For the Sun ORB
- CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
- ContactInfoList cil = cdel.getContactInfoList() ;
- if (cil instanceof CorbaContactInfoList) {
- CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
- LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ;
- result = lcs.useLocalInvocation( null ) ;
- }
- } else {
- // For a non-Sun ORB
- result = delegate.is_local( stub ) ;
- }
- } catch (SystemException e) {
- throw javax.rmi.CORBA.Util.mapSystemException(e);
- }
-
- return result ;
- }
-
- /**
- * Wraps an exception thrown by an implementation
- * method. It returns the corresponding client-side exception.
- * @param orig the exception to wrap.
- * @return the wrapped exception.
- */
- public RemoteException wrapException(Throwable orig)
- {
- if (orig instanceof SystemException) {
- return mapSystemException((SystemException)orig);
- }
-
- if (orig instanceof Error) {
- return new ServerError("Error occurred in server thread",(Error)orig);
- } else if (orig instanceof RemoteException) {
- return new ServerException("RemoteException occurred in server thread",
- (Exception)orig);
- } else if (orig instanceof RuntimeException) {
- throw (RuntimeException) orig;
- }
-
- if (orig instanceof Exception)
- return new UnexpectedException( orig.toString(), (Exception)orig );
- else
- return new UnexpectedException( orig.toString());
- }
-
- /**
- * Copies or connects an array of objects. Used by local stubs
- * to copy any number of actual parameters, preserving sharing
- * across parameters as necessary to support RMI semantics.
- * @param obj the objects to copy or connect.
- * @param orb the ORB.
- * @return the copied or connected objects.
- * @exception RemoteException if any object could not be copied or connected.
- */
- public Object[] copyObjects (Object[] obj, org.omg.CORBA.ORB orb)
- throws RemoteException
- {
- if (obj == null)
- // Bug fix for 5018613: JCK test expects copyObjects to throw
- // NPE when obj==null. This is actually not in the spec, since
- // obj is not really an RMI-IDL data type, but we follow our
- // test here, and force this error to be thrown.
- throw new NullPointerException() ;
-
- Class compType = obj.getClass().getComponentType() ;
- if (Remote.class.isAssignableFrom( compType ) && !compType.isInterface()) {
- // obj is an array of remote impl types. This
- // causes problems with stream copier, so we copy
- // it over to an array of Remotes instead.
- Remote[] result = new Remote[obj.length] ;
- System.arraycopy( (Object)obj, 0, (Object)result, 0, obj.length ) ;
- return (Object[])copyObject( result, orb ) ;
- } else
- return (Object[])copyObject( obj, orb ) ;
- }
-
- /**
- * Copies or connects an object. Used by local stubs to copy
- * an actual parameter, result object, or exception.
- * @param obj the object to copy.
- * @param orb the ORB.
- * @return the copy or connected object.
- * @exception RemoteException if the object could not be copied or connected.
- */
- public Object copyObject (Object obj, org.omg.CORBA.ORB orb)
- throws RemoteException
- {
- if (orb instanceof ORB) {
- ORB lorb = (ORB)orb ;
-
- try {
- try {
- // This gets the copier for the current invocation, which was
- // previously set by preinvoke.
- return lorb.peekInvocationInfo().getCopierFactory().make().copy( obj ) ;
- } catch (java.util.EmptyStackException exc) {
- // copyObject was invoked outside of an invocation, probably by
- // a test. Get the default copier from the ORB.
- // XXX should we just make the default copier available directly
- // and avoid constructing one on each call?
- CopierManager cm = lorb.getCopierManager() ;
- ObjectCopier copier = cm.getDefaultObjectCopierFactory().make() ;
- return copier.copy( obj ) ;
- }
- } catch (ReflectiveCopyException exc) {
- RemoteException rexc = new RemoteException() ;
- rexc.initCause( exc ) ;
- throw rexc ;
- }
- } else {
- org.omg.CORBA_2_3.portable.OutputStream out =
- (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream();
- out.write_value((Serializable)obj);
- org.omg.CORBA_2_3.portable.InputStream in =
- (org.omg.CORBA_2_3.portable.InputStream)out.create_input_stream();
- return in.read_value();
- }
- }
-}
-
-class KeepAlive extends Thread
-{
- boolean quit = false;
-
- public KeepAlive ()
- {
- super(null, null, "Servant-KeepAlive-Thread", 0, false);
- setDaemon(false);
- }
-
- public synchronized void run ()
- {
- while (!quit) {
- try {
- wait();
- } catch (InterruptedException e) {}
- }
- }
-
- public synchronized void quit ()
- {
- quit = true;
- notifyAll();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java 2018-01-30 20:18:03.000000000 -0500
+++ /dev/null 2018-01-30 20:18:04.000000000 -0500
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.javax.rmi;
-
-import java.lang.reflect.Method ;
-
-import javax.rmi.CORBA.Tie;
-import javax.rmi.CORBA.Util;
-
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.Remote;
-
-import java.util.Properties;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.SystemException;
-
-import java.rmi.server.UnicastRemoteObject;
-import java.rmi.server.RemoteStub;
-import java.rmi.server.ExportException;
-
-import java.net.URL;
-
-import com.sun.corba.se.impl.util.JDKBridge;
-import com.sun.corba.se.impl.util.Utility;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
-
-import java.security.AccessController;
-import com.sun.corba.se.impl.orbutil.GetPropertyAction;
-
-/**
- * Server implementation objects may either inherit from
- * javax.rmi.PortableRemoteObject or they may implement a remote interface
- * and then use the exportObject method to register themselves as a server object.
- * The toStub method takes a server implementation and returns a stub that
- * can be used to access that server object.
- * The connect method makes a Remote object ready for remote communication.
- * The unexportObject method is used to deregister a server object, allowing it to become
- * available for garbage collection.
- * The narrow method takes an object reference or abstract interface type and
- * attempts to narrow it to conform to
- * the given interface. If the operation is successful the result will be an
- * object of the specified type, otherwise an exception will be thrown.
- */
-public class PortableRemoteObject
- implements javax.rmi.CORBA.PortableRemoteObjectDelegate {
-
- /**
- * Makes a server object ready to receive remote calls. Note
- * that subclasses of PortableRemoteObject do not need to call this
- * method, as it is called by the constructor.
- * @param obj the server object to export.
- * @exception RemoteException if export fails.
- */
- public void exportObject(Remote obj)
- throws RemoteException {
-
- if (obj == null) {
- throw new NullPointerException("invalid argument");
- }
-
- // Has this object already been exported to IIOP?
-
- if (Util.getTie(obj) != null) {
-
- // Yes, so this is an error...
-
- throw new ExportException (obj.getClass().getName() + " already exported");
- }
-
- // Can we load a Tie?
-
- Tie theTie = Utility.loadTie(obj);
-
- if (theTie != null) {
-
- // Yes, so export it to IIOP...
-
- Util.registerTarget(theTie,obj);
-
- } else {
-
- // No, so export to JRMP. If this is called twice for the
- // same object, it will throw an ExportException...
-
- UnicastRemoteObject.exportObject(obj);
- }
- }
-
- /**
- * Returns a stub for the given server object.
- * @param obj the server object for which a stub is required. Must either be a subclass
- * of PortableRemoteObject or have been previously the target of a call to
- * {@link #exportObject}.
- * @return the most derived stub for the object.
- * @exception NoSuchObjectException if a stub cannot be located for the given server object.
- */
- public Remote toStub (Remote obj)
- throws NoSuchObjectException
- {
- Remote result = null;
- if (obj == null) {
- throw new NullPointerException("invalid argument");
- }
-
- // If the class is already an IIOP stub then return it.
- if (StubAdapter.isStub( obj )) {
- return obj;
- }
-
- // If the class is already a JRMP stub then return it.
- if (obj instanceof java.rmi.server.RemoteStub) {
- return obj;
- }
-
- // Has it been exported to IIOP?
- Tie theTie = Util.getTie(obj);
-
- if (theTie != null) {
- result = Utility.loadStub(theTie,null,null,true);
- } else {
- if (Utility.loadTie(obj) == null) {
- result = java.rmi.server.RemoteObject.toStub(obj);
- }
- }
-
- if (result == null) {
- throw new NoSuchObjectException("object not exported");
- }
-
- return result;
- }
-
- /**
- * Deregisters a server object from the runtime, allowing the object to become
- * available for garbage collection.
- * @param obj the object to unexport.
- * @exception NoSuchObjectException if the remote object is not
- * currently exported.
- */
- public void unexportObject(Remote obj)
- throws NoSuchObjectException {
-
- if (obj == null) {
- throw new NullPointerException("invalid argument");
- }
-
- if (StubAdapter.isStub(obj) ||
- obj instanceof java.rmi.server.RemoteStub) {
- throw new NoSuchObjectException(
- "Can only unexport a server object.");
- }
-
- Tie theTie = Util.getTie(obj);
- if (theTie != null) {
- Util.unexportObject(obj);
- } else {
- if (Utility.loadTie(obj) == null) {
- UnicastRemoteObject.unexportObject(obj,true);
- } else {
- throw new NoSuchObjectException("Object not exported.");
- }
- }
- }
-
- /**
- * Checks to ensure that an object of a remote or abstract interface type
- * can be cast to a desired type.
- * @param narrowFrom the object to check.
- * @param narrowTo the desired type.
- * @return an object which can be cast to the desired type.
- * @throws ClassCastException if narrowFrom cannot be cast to narrowTo.
- */
- public java.lang.Object narrow ( java.lang.Object narrowFrom,
- java.lang.Class narrowTo) throws ClassCastException
- {
- java.lang.Object result = null;
-
- if (narrowFrom == null)
- return null;
-
- if (narrowTo == null)
- throw new NullPointerException("invalid argument");
-
- try {
- if (narrowTo.isAssignableFrom(narrowFrom.getClass()))
- return narrowFrom;
-
- // Is narrowTo an interface that might be
- // implemented by a servant running on iiop?
- if (narrowTo.isInterface() &&
- narrowTo != java.io.Serializable.class &&
- narrowTo != java.io.Externalizable.class) {
-
- org.omg.CORBA.Object narrowObj
- = (org.omg.CORBA.Object) narrowFrom;
-
- // Create an id from the narrowTo type...
- String id = RepositoryId.createForAnyType(narrowTo);
-
- if (narrowObj._is_a(id)) {
- return Utility.loadStub(narrowObj,narrowTo);
- } else {
- throw new ClassCastException( "Object is not of remote type " +
- narrowTo.getName() ) ;
- }
- } else {
- throw new ClassCastException( "Class " + narrowTo.getName() +
- " is not a valid remote interface" ) ;
- }
- } catch(Exception error) {
- ClassCastException cce = new ClassCastException() ;
- cce.initCause( error ) ;
- throw cce ;
- }
- }
-
- /**
- * Makes a Remote object ready for remote communication. This normally
- * happens implicitly when the object is sent or received as an argument
- * on a remote method call, but in some circumstances it is useful to
- * perform this action by making an explicit call. See the
- * {@link Stub#connect} method for more information.
- * @param target the object to connect.
- * @param source a previously connected object.
- * @throws RemoteException if source
is not connected
- * or if target
is already connected to a different ORB than
- * source
.
- */
- public void connect (Remote target, Remote source)
- throws RemoteException
- {
- if (target == null || source == null) {
- throw new NullPointerException("invalid argument");
- }
-
- ORB orb = null;
- try {
- if (StubAdapter.isStub( source )) {
- orb = StubAdapter.getORB( source ) ;
- } else {
- // Is this a servant that was exported to iiop?
- Tie tie = Util.getTie(source);
- if (tie == null) {
- /* loadTie always succeeds for dynamic RMI-IIOP
- // No, can we get a tie for it? If not,
- // assume that source is a JRMP object...
- if (Utility.loadTie(source) != null) {
- // Yes, so it is an iiop object which
- // has not been exported...
- throw new RemoteException(
- "'source' object not exported");
- }
- */
- } else {
- orb = tie.orb();
- }
- }
- } catch (SystemException e) {
- throw new RemoteException("'source' object not connected", e );
- }
-
- boolean targetIsIIOP = false ;
- Tie targetTie = null;
- if (StubAdapter.isStub(target)) {
- targetIsIIOP = true;
- } else {
- targetTie = Util.getTie(target);
- if (targetTie != null) {
- targetIsIIOP = true;
- } else {
- /* loadTie always succeeds for dynamic RMI-IIOP
- if (Utility.loadTie(target) != null) {
- throw new RemoteException("'target' servant not exported");
- }
- */
- }
- }
-
- if (!targetIsIIOP) {
- // Yes. Do we have an ORB from the source object?
- // If not, we're done - there is nothing to do to
- // connect a JRMP object. If so, it is an error because
- // the caller mixed JRMP and IIOP...
- if (orb != null) {
- throw new RemoteException(
- "'source' object exported to IIOP, 'target' is JRMP");
- }
- } else {
- // The target object is IIOP. Make sure we have a
- // valid ORB from the source object...
- if (orb == null) {
- throw new RemoteException(
- "'source' object is JRMP, 'target' is IIOP");
- }
-
- // And, finally, connect it up...
- try {
- if (targetTie != null) {
- // Is the tie already connected?
- try {
- ORB existingOrb = targetTie.orb();
-
- // Yes. Is it the same orb?
- if (existingOrb == orb) {
-
- // Yes, so nothing to do...
- return;
- } else {
- // No, so this is an error...
- throw new RemoteException(
- "'target' object was already connected");
- }
- } catch (SystemException e) {}
-
- // No, so do it...
- targetTie.orb(orb);
- } else {
- StubAdapter.connect( target, orb ) ;
- }
- } catch (SystemException e) {
-
- // The stub or tie was already connected...
- throw new RemoteException(
- "'target' object was already connected", e );
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java 2018-01-30 20:18:04.000000000 -0500
+++ /dev/null 2018-01-30 20:18:04.000000000 -0500
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
-import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.legacy.connection.EndPointInfoImpl;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-public class DefaultSocketFactory
- implements
- ORBSocketFactory
-{
- private com.sun.corba.se.spi.orb.ORB orb;
- private static ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- CORBALogDomains.RPC_TRANSPORT ) ;
-
- public DefaultSocketFactory()
- {
- }
-
- public void setORB(com.sun.corba.se.spi.orb.ORB orb)
- {
- this.orb = orb;
- }
-
- public ServerSocket createServerSocket(String type, int port)
- throws
- IOException
- {
- if (! type.equals(ORBSocketFactory.IIOP_CLEAR_TEXT)) {
- throw wrapper.defaultCreateServerSocketGivenNonIiopClearText( type ) ;
- }
-
- ServerSocket serverSocket;
-
- if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
- ServerSocketChannel serverSocketChannel =
- ServerSocketChannel.open();
- serverSocket = serverSocketChannel.socket();
- } else {
- serverSocket = new ServerSocket();
- }
- serverSocket.bind(new InetSocketAddress(port));
- return serverSocket;
- }
-
- public SocketInfo getEndPointInfo(ORB orb,
- IOR ior,
- SocketInfo socketInfo)
- {
- IIOPProfileTemplate temp =
- (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ;
- IIOPAddress primary = temp.getPrimaryAddress() ;
-
- return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT,
- primary.getPort(),
- primary.getHost().toLowerCase());
- }
-
- public Socket createSocket(SocketInfo socketInfo)
- throws
- IOException,
- GetEndPointInfoAgainException
- {
- Socket socket;
-
- if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
- InetSocketAddress address =
- new InetSocketAddress(socketInfo.getHost(),
- socketInfo.getPort());
- SocketChannel socketChannel = SocketChannel.open(address);
- socket = socketChannel.socket();
- } else {
- socket = new Socket(socketInfo.getHost(),
- socketInfo.getPort());
- }
-
- // REVISIT - this is done in SocketOrChannelConnectionImpl
- try {
- socket.setTcpNoDelay(true);
- } catch (Exception e) {
- ;
- }
- return socket;
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java 2018-01-30 20:18:05.000000000 -0500
+++ /dev/null 2018-01-30 20:18:05.000000000 -0500
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-public class EndPointInfoImpl
- implements
- SocketInfo,
- LegacyServerSocketEndPointInfo
-{
-
- protected String type;
- protected String hostname;
- protected int port;
- protected int locatorPort;
- protected String name;
-
- public EndPointInfoImpl(String type, int port, String hostname) {
- this.type = type;
- this.port = port;
- this.hostname = hostname;
- this.locatorPort = -1;
- this.name = LegacyServerSocketEndPointInfo.NO_NAME;
- }
-
- public String getType() {
- return type;
- }
-
- public String getHost() {
- return hostname;
- }
-
- public String getHostName() {
- return hostname;
- }
-
- public int getPort() {
- return port;
- }
-
- public int getLocatorPort ()
- {
- return locatorPort;
- }
-
- public void setLocatorPort (int port)
- {
- locatorPort = port;
- }
-
- public String getName()
- {
- return name;
- }
-
- public int hashCode() {
- return type.hashCode() ^ hostname.hashCode() ^ port;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof EndPointInfoImpl)) {
- return false;
- }
- EndPointInfoImpl other = (EndPointInfoImpl)obj;
- if (type == null) {
- if (other.type != null) {
- return false;
- }
- } else if (!type.equals(other.type)) {
- return false;
- }
- if (port != other.port) {
- return false;
- }
- if (!hostname.equals(other.hostname)) {
- return false;
- }
- return true;
- }
-
- public String toString ()
- {
- return
- type + " " +
- name + " " +
- hostname + " " +
- port;
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java 2018-01-30 20:18:05.000000000 -0500
+++ /dev/null 2018-01-30 20:18:06.000000000 -0500
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.net.ServerSocket;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-import com.sun.corba.se.pept.transport.ByteBufferPool;
-import com.sun.corba.se.pept.transport.ContactInfo;
-import com.sun.corba.se.pept.transport.Selector;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
-import com.sun.corba.se.spi.ior.ObjectId ;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.transport.CorbaTransportManager;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
-import com.sun.corba.se.impl.legacy.connection.USLPort;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public class LegacyServerSocketManagerImpl
- implements
- LegacyServerSocketManager
-{
- protected ORB orb;
- private ORBUtilSystemException wrapper ;
-
- public LegacyServerSocketManagerImpl(ORB orb)
- {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_TRANSPORT ) ;
- }
-
- ////////////////////////////////////////////////////
- //
- // LegacyServerSocketManager
- //
-
- // Only used in ServerManagerImpl.
- public int legacyGetTransientServerPort(String type)
- {
- return legacyGetServerPort(type, false);
- }
-
- // Only used by POAPolicyMediatorBase.
- public synchronized int legacyGetPersistentServerPort(String socketType)
- {
- if (orb.getORBData().getServerIsORBActivated()) {
- // this server is activated by orbd
- return legacyGetServerPort(socketType, true);
- } else if (orb.getORBData().getPersistentPortInitialized()) {
- // this is a user-activated server
- return orb.getORBData().getPersistentServerPort();
- } else {
- throw wrapper.persistentServerportNotSet(
- CompletionStatus.COMPLETED_MAYBE);
- }
- }
-
- // Only used by PI IORInfoImpl.
- public synchronized int legacyGetTransientOrPersistentServerPort(
- String socketType)
- {
- return legacyGetServerPort(socketType,
- orb.getORBData()
- .getServerIsORBActivated());
- }
-
- // Used in RepositoryImpl, ServerManagerImpl, POAImpl,
- // POAPolicyMediatorBase, TOAImpl.
- // To get either default or bootnaming endpoint.
- public synchronized LegacyServerSocketEndPointInfo legacyGetEndpoint(
- String name)
- {
- Iterator iterator = getAcceptorIterator();
- while (iterator.hasNext()) {
- LegacyServerSocketEndPointInfo endPoint = cast(iterator.next());
- if (endPoint != null && name.equals(endPoint.getName())) {
- return endPoint;
- }
- }
- throw new INTERNAL("No acceptor for: " + name);
- }
-
- // Check to see if the given port is equal to any of the ORB Server Ports.
- // XXX Does this need to change for the multi-homed case?
- // Used in IIOPProfileImpl, ORBImpl.
- public boolean legacyIsLocalServerPort(int port)
- {
- Iterator iterator = getAcceptorIterator();
- while (iterator.hasNext()) {
- LegacyServerSocketEndPointInfo endPoint = cast(iterator.next());
- if (endPoint != null && endPoint.getPort() == port) {
- return true;
- }
- }
- return false;
- }
-
- ////////////////////////////////////////////////////
- //
- // Implementation.
- //
-
- private int legacyGetServerPort (String socketType, boolean isPersistent)
- {
- Iterator endpoints = getAcceptorIterator();
- while (endpoints.hasNext()) {
- LegacyServerSocketEndPointInfo ep = cast(endpoints.next());
- if (ep != null && ep.getType().equals(socketType)) {
- if (isPersistent) {
- return ep.getLocatorPort();
- } else {
- return ep.getPort();
- }
- }
- }
- return -1;
- }
-
- private Iterator getAcceptorIterator()
- {
- Collection acceptors =
- orb.getCorbaTransportManager().getAcceptors(null, null);
- if (acceptors != null) {
- return acceptors.iterator();
- }
-
- throw wrapper.getServerPortCalledBeforeEndpointsInitialized() ;
- }
-
- private LegacyServerSocketEndPointInfo cast(Object o)
- {
- if (o instanceof LegacyServerSocketEndPointInfo) {
- return (LegacyServerSocketEndPointInfo) o;
- }
- return null;
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint("LegacyServerSocketManagerImpl", msg);
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java 2018-01-30 20:18:06.000000000 -0500
+++ /dev/null 2018-01-30 20:18:06.000000000 -0500
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.INTERNAL;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryAcceptorImpl
- extends
- SocketOrChannelAcceptorImpl
-{
- public SocketFactoryAcceptorImpl(ORB orb, int port,
- String name, String type)
- {
- super(orb, port, name, type);
- }
-
- ////////////////////////////////////////////////////
- //
- // pept Acceptor
- //
-
- public boolean initialize()
- {
- if (initialized) {
- return false;
- }
- if (orb.transportDebugFlag) {
- dprint("initialize: " + this);
- }
- try {
- serverSocket = orb.getORBData()
- .getLegacySocketFactory().createServerSocket(type, port);
- internalInitialize();
- } catch (Throwable t) {
- throw wrapper.createListenerFailed( t, Integer.toString(port) ) ;
- }
- initialized = true;
- return true;
- }
-
- ////////////////////////////////////////////////////
- //
- // Implementation.
- //
-
- protected String toStringName()
- {
- return "SocketFactoryAcceptorImpl";
- }
-
- protected void dprint(String msg)
- {
- ORBUtility.dprint(toStringName(), msg);
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java 2018-01-30 20:18:07.000000000 -0500
+++ /dev/null 2018-01-30 20:18:07.000000000 -0500
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.net.Socket;
-import java.nio.channels.SocketChannel;
-import java.util.Collections;
-
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.pept.transport.Acceptor;
-import com.sun.corba.se.pept.transport.ContactInfo;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
-import com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl;
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryConnectionImpl
- extends
- SocketOrChannelConnectionImpl
-{
- // Socket-factory client constructor.
- public SocketFactoryConnectionImpl(ORB orb,
- CorbaContactInfo contactInfo,
- boolean useSelectThreadToWait,
- boolean useWorkerThread)
- {
- super(orb, useSelectThreadToWait, useWorkerThread);
-
- // REVISIT - probably need a contact info for both
- // client and server for removing connections from cache?
- this.contactInfo = contactInfo;
-
- boolean isBlocking = !useSelectThreadToWait;
- SocketInfo socketInfo =
- // REVISIT - case - needs interface method
- ((SocketFactoryContactInfoImpl)contactInfo).socketInfo;
- try {
- socket =
- orb.getORBData().getLegacySocketFactory().createSocket(socketInfo);
- socketChannel = socket.getChannel();
- if (socketChannel != null) {
- socketChannel.configureBlocking(isBlocking);
- } else {
- // IMPORTANT: non-channel-backed sockets must use
- // dedicated reader threads.
- setUseSelectThreadToWait(false);
- }
- if (orb.transportDebugFlag) {
- dprint(".initialize: connection created: " + socket);
- }
- } catch (GetEndPointInfoAgainException ex) {
- throw wrapper.connectFailure(
- ex, socketInfo.getType(), socketInfo.getHost(),
- Integer.toString(socketInfo.getPort())) ;
- } catch (Exception ex) {
- throw wrapper.connectFailure(
- ex, socketInfo.getType(), socketInfo.getHost(),
- Integer.toString(socketInfo.getPort())) ;
- }
- state = OPENING;
- }
-
- public String toString()
- {
- synchronized ( stateEvent ){
- return
- "SocketFactoryConnectionImpl[" + " "
- + (socketChannel == null ?
- socket.toString() : socketChannel.toString()) + " "
- + getStateString( state ) + " "
- + shouldUseSelectThreadToWait() + " "
- + shouldUseWorkerThreadForEvent()
- + "]" ;
- }
- }
-
- // Note: public to override parent.
- public void dprint(String msg)
- {
- ORBUtility.dprint("SocketFactoryConnectionImpl", msg);
- }
-
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java 2018-01-30 20:18:07.000000000 -0500
+++ /dev/null 2018-01-30 20:18:07.000000000 -0500
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import com.sun.corba.se.pept.transport.Connection;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
-
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryContactInfoImpl
- extends
- SocketOrChannelContactInfoImpl
-{
- protected ORBUtilSystemException wrapper;
- protected SocketInfo socketInfo;
-
- // XREVISIT
- // See SocketOrChannelAcceptorImpl.createMessageMediator
- // See SocketFactoryContactInfoImpl.constructor()
- // See SocketOrChannelContactInfoImpl.constructor()
- public SocketFactoryContactInfoImpl()
- {
- }
-
- public SocketFactoryContactInfoImpl(
- ORB orb,
- CorbaContactInfoList contactInfoList,
- IOR effectiveTargetIOR,
- short addressingDisposition,
- SocketInfo cookie)
- {
- super(orb, contactInfoList);
- this.effectiveTargetIOR = effectiveTargetIOR;
- this.addressingDisposition = addressingDisposition;
-
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_TRANSPORT ) ;
-
- socketInfo =
- orb.getORBData().getLegacySocketFactory()
- .getEndPointInfo(orb, effectiveTargetIOR, cookie);
-
- socketType = socketInfo.getType();
- hostname = socketInfo.getHost();
- port = socketInfo.getPort();
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.transport.ContactInfo
- //
-
- public Connection createConnection()
- {
- Connection connection =
- new SocketFactoryConnectionImpl(
- orb, this,
- orb.getORBData().connectionSocketUseSelectThreadToWait(),
- orb.getORBData().connectionSocketUseWorkerThreadForEvent());
- return connection;
- }
-
- ////////////////////////////////////////////////////
- //
- // java.lang.Object
- //
-
- public String toString()
- {
- return
- "SocketFactoryContactInfoImpl["
- + socketType + " "
- + hostname + " "
- + port
- + "]";
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java 2018-01-30 20:18:08.000000000 -0500
+++ /dev/null 2018-01-30 20:18:08.000000000 -0500
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import java.util.Iterator;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl;
-import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
-
-/**
- * @author Harold Carr
- */
-public class SocketFactoryContactInfoListImpl
- extends
- CorbaContactInfoListImpl
-{
- // XREVISIT - is this used?
- public SocketFactoryContactInfoListImpl(ORB orb)
- {
- super(orb);
- }
-
- public SocketFactoryContactInfoListImpl(ORB orb, IOR targetIOR)
- {
- super(orb, targetIOR);
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.transport.ContactInfoList
- //
-
- public Iterator iterator()
- {
- return new SocketFactoryContactInfoListIteratorImpl(orb, this);
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java 2018-01-30 20:18:09.000000000 -0500
+++ /dev/null 2018-01-30 20:18:09.000000000 -0500
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.pept.transport.ContactInfo;
-
-import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.SocketInfo;
-
-import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
-import com.sun.corba.se.impl.transport.SharedCDRContactInfoImpl;
-
-public class SocketFactoryContactInfoListIteratorImpl
- extends CorbaContactInfoListIteratorImpl
-{
- private SocketInfo socketInfoCookie;
-
- public SocketFactoryContactInfoListIteratorImpl(
- ORB orb,
- CorbaContactInfoList corbaContactInfoList)
- {
- super(orb, corbaContactInfoList, null, null);
- }
-
- ////////////////////////////////////////////////////
- //
- // java.util.Iterator
- //
-
- public boolean hasNext()
- {
- return true;
- }
-
- public Object next()
- {
- if (contactInfoList.getEffectiveTargetIOR().getProfile().isLocal()){
- return new SharedCDRContactInfoImpl(
- orb, contactInfoList,
- contactInfoList.getEffectiveTargetIOR(),
- orb.getORBData().getGIOPAddressDisposition());
- } else {
- // REVISIT:
- // on comm_failure maybe need to give IOR instead of located.
- return new SocketFactoryContactInfoImpl(
- orb, contactInfoList,
- contactInfoList.getEffectiveTargetIOR(),
- orb.getORBData().getGIOPAddressDisposition(),
- socketInfoCookie);
- }
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.ContactInfoListIterator
- //
-
- public boolean reportException(ContactInfo contactInfo,
- RuntimeException ex)
- {
- this.failureContactInfo = (CorbaContactInfo)contactInfo;
- this.failureException = ex;
- if (ex instanceof org.omg.CORBA.COMM_FAILURE) {
-
- if (ex.getCause() instanceof GetEndPointInfoAgainException) {
- socketInfoCookie =
- ((GetEndPointInfoAgainException) ex.getCause())
- .getEndPointInfo();
- return true;
- }
-
- SystemException se = (SystemException) ex;
- if (se.completed == CompletionStatus.COMPLETED_NO) {
- if (contactInfoList.getEffectiveTargetIOR() !=
- contactInfoList.getTargetIOR())
- {
- // retry from root ior
- contactInfoList.setEffectiveTargetIOR(
- contactInfoList.getTargetIOR());
- return true;
- }
- }
- }
- return false;
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java 2018-01-30 20:18:09.000000000 -0500
+++ /dev/null 2018-01-30 20:18:09.000000000 -0500
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.legacy.connection;
-
-public class USLPort
-{
- private String type;
- private int port;
-
- public USLPort (String type, int port)
- {
- this.type = type;
- this.port = port;
- }
-
- public String getType () { return type; }
- public int getPort () { return port; }
- public String toString () { return type + ":" + port; }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java 2018-01-30 20:18:10.000000000 -0500
+++ /dev/null 2018-01-30 20:18:10.000000000 -0500
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfoFactory;
-import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
-
-public class MonitoredAttributeInfoFactoryImpl
- implements MonitoredAttributeInfoFactory
-{
- public MonitoredAttributeInfo createMonitoredAttributeInfo(
- String description, Class type, boolean isWritable,
- boolean isStatistic )
- {
- return new MonitoredAttributeInfoImpl( description, type,
- isWritable, isStatistic );
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java 2018-01-30 20:18:11.000000000 -0500
+++ /dev/null 2018-01-30 20:18:11.000000000 -0500
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
-
-public class MonitoredAttributeInfoImpl implements MonitoredAttributeInfo {
- private final String description;
- private final Class type;
- private final boolean writableFlag, statisticFlag;
-
- MonitoredAttributeInfoImpl( String description, Class type,
- boolean isWritable, boolean isStatistic )
- {
- this.description = description;
- this.type = type;
- this.writableFlag = isWritable;
- this.statisticFlag = isStatistic;
- }
-
- public String getDescription( ) {
- return this.description;
- }
-
- public Class type( ) {
- return this.type;
- }
-
- public boolean isWritable( ) {
- return this.writableFlag;
- }
-
- public boolean isStatistic( ) {
- return this.statisticFlag;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java 2018-01-30 20:18:11.000000000 -0500
+++ /dev/null 2018-01-30 20:18:11.000000000 -0500
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
-import com.sun.corba.se.spi.monitoring.MonitoredObject;
-
-public class MonitoredObjectFactoryImpl implements MonitoredObjectFactory {
-
- public MonitoredObject createMonitoredObject( String name,
- String description )
- {
- return new MonitoredObjectImpl( name, description );
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java 2018-01-30 20:18:12.000000000 -0500
+++ /dev/null 2018-01-30 20:18:12.000000000 -0500
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.Iterator;
-
-import com.sun.corba.se.spi.monitoring.MonitoredObject;
-import com.sun.corba.se.spi.monitoring.MonitoredAttribute;
-
-public class MonitoredObjectImpl implements MonitoredObject {
- private final String name;
- private final String description;
-
- // List of all child Monitored Objects
- private Map children = new HashMap();
-
- // All the Attributes of this Monitored Object instance
- private Map monitoredAttributes = new HashMap();
-
- private MonitoredObject parent = null;
-
-
- // Constructor
- MonitoredObjectImpl( String name, String description ) {
- this.name = name;
- this.description = description;
- }
-
- public MonitoredObject getChild( String name ) {
- synchronized( this ) {
- return (MonitoredObject) children.get( name );
- }
- }
-
- public Collection getChildren( ) {
- synchronized( this ) {
- return children.values();
- }
- }
-
- public void addChild( MonitoredObject m ) {
- if (m != null){
- synchronized( this ) {
- children.put( m.getName(), m);
- m.setParent( this );
- }
- }
- }
-
- public void removeChild( String name ) {
- if (name != null){
- synchronized( this ) {
- children.remove( name );
- }
- }
- }
-
- public synchronized MonitoredObject getParent( ) {
- return parent;
- }
-
- public synchronized void setParent( MonitoredObject p ) {
- parent = p;
- }
-
- public MonitoredAttribute getAttribute( String name ) {
- synchronized( this ) {
- return (MonitoredAttribute) monitoredAttributes.get( name );
- }
- }
-
- public Collection getAttributes( ) {
- synchronized( this ) {
- return monitoredAttributes.values();
- }
- }
-
- public void addAttribute( MonitoredAttribute value ) {
- if (value != null) {
- synchronized( this ) {
- monitoredAttributes.put( value.getName(), value );
- }
- }
- }
-
- public void removeAttribute( String name ) {
- if (name != null) {
- synchronized( this ) {
- monitoredAttributes.remove( name );
- }
- }
- }
-
- /**
- * calls clearState() on all the registered children MonitoredObjects and
- * MonitoredAttributes.
- */
- public void clearState( ) {
- synchronized( this ) {
- Iterator i = monitoredAttributes.values().iterator();
- // First call clearState on all the local attributes
- while( i.hasNext( ) ) {
- ((MonitoredAttribute)i.next()).clearState();
- }
- i = children.values().iterator();
- // next call clearState on all the children MonitoredObjects
- while( i.hasNext() ) {
- ((MonitoredObject)i.next()).clearState();
- }
- }
- }
-
- public String getName( ) {
- return name;
- }
-
- public String getDescription( ) {
- return description;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java 2018-01-30 20:18:13.000000000 -0500
+++ /dev/null 2018-01-30 20:18:13.000000000 -0500
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import java.util.HashMap;
-import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
-import com.sun.corba.se.spi.monitoring.MonitoringManager;
-
-public class MonitoringManagerFactoryImpl implements MonitoringManagerFactory {
-
- private HashMap monitoringManagerTable = new HashMap();
-
- public synchronized MonitoringManager createMonitoringManager(
- String nameOfTheRoot, String description)
- {
- MonitoringManagerImpl m = null;
- m = (MonitoringManagerImpl)monitoringManagerTable.get(nameOfTheRoot);
- if (m == null) {
- m = new MonitoringManagerImpl(nameOfTheRoot, description);
- monitoringManagerTable.put(nameOfTheRoot, m);
- }
- return m;
- }
-
- public synchronized void remove(String nameOfTheRoot) {
- monitoringManagerTable.remove(nameOfTheRoot);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java 2018-01-30 20:18:13.000000000 -0500
+++ /dev/null 2018-01-30 20:18:13.000000000 -0500
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.monitoring;
-
-import com.sun.corba.se.spi.monitoring.MonitoringManager;
-import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
-import com.sun.corba.se.spi.monitoring.MonitoredObject;
-import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
-import com.sun.corba.se.spi.monitoring.MonitoringFactories;
-
-public class MonitoringManagerImpl implements MonitoringManager {
- private final MonitoredObject rootMonitoredObject;
-
- MonitoringManagerImpl(String nameOfTheRoot, String description) {
- MonitoredObjectFactory f =
- MonitoringFactories.getMonitoredObjectFactory();
- rootMonitoredObject =
- f.createMonitoredObject(nameOfTheRoot, description);
- }
-
- public void clearState() {
- rootMonitoredObject.clearState();
- }
-
- public MonitoredObject getRootMonitoredObject() {
- return rootMonitoredObject;
- }
-
- public void close() {
- MonitoringManagerFactory f =
- MonitoringFactories.getMonitoringManagerFactory();
- f.remove(rootMonitoredObject.getName());
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java 2018-01-30 20:18:14.000000000 -0500
+++ /dev/null 2018-01-30 20:18:14.000000000 -0500
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Object;
-
-// Import org.omg.CosNaming classes
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.BindingIteratorPOA;
-import org.omg.CORBA.BAD_PARAM;
-
-/**
- * Class BindingIteratorImpl implements the org.omg.CosNaming::BindingIterator
- * interface, but does not implement the method to retrieve the next
- * binding in the NamingContext for which it was created. This is left
- * to a subclass, which is why this class is abstract; BindingIteratorImpl
- * provides an implementation of the interface operations on top of two
- * subclass methods, allowing multiple implementations of iterators that
- * differ in storage and access to the contents of a NamingContext
- * implementation.
- *
- * The operation next_one() is implemented by the subclass, whereas
- * next_n() is implemented on top of the next_one() implementation.
- * Destroy must also be implemented by the subclass.
- *
- * A subclass must implement NextOne() and Destroy(); these
- * methods are invoked from synchronized methods and need therefore
- * not be synchronized themselves.
- */
-public abstract class BindingIteratorImpl extends BindingIteratorPOA
-{
- protected ORB orb ;
-
- /**
- * Create a binding iterator servant.
- * runs the super constructor.
- * @param orb an ORB object.
- * @exception java.lang.Exception a Java exception.
- */
- public BindingIteratorImpl(ORB orb)
- throws java.lang.Exception
- {
- super();
- this.orb = orb ;
- }
-
- /**
- * Return the next binding. It also returns true or false, indicating
- * whether there were more bindings.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see NextOne
- */
- public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b)
- {
- // NextOne actually returns the next one
- return NextOne(b);
- }
-
- /**
- * Return the next n bindings. It also returns true or false, indicating
- * whether there were more bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param blh The BindingList as an out parameter.
- * @return true if there were more bindings.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see NextOne
- */
- public synchronized boolean next_n(int how_many,
- org.omg.CosNaming.BindingListHolder blh)
- {
- if( how_many == 0 ) {
- throw new BAD_PARAM( " 'how_many' parameter is set to 0 which is" +
- " invalid" );
- }
- return list( how_many, blh );
- }
-
- /**
- * lists next n bindings. It returns true or false, indicating
- * whether there were more bindings. This method has the package private
- * scope, It will be called from NamingContext.list() operation or
- * this.next_n().
- * @param how_many The number of requested bindings in the BindingList.
- * @param blh The BindingList as an out parameter.
- * @return true if there were more bindings.
- */
- public boolean list( int how_many, org.omg.CosNaming.BindingListHolder blh)
- {
- // Take the smallest of what's left and what's being asked for
- int numberToGet = Math.min(RemainingElements(),how_many);
-
- // Create a resulting BindingList
- Binding[] bl = new Binding[numberToGet];
- BindingHolder bh = new BindingHolder();
- int i = 0;
- // Keep iterating as long as there are entries
- while (i < numberToGet && this.NextOne(bh) == true) {
- bl[i] = bh.value;
- i++;
- }
- // Found any at all?
- if (i == 0) {
- // No
- blh.value = new Binding[0];
- return false;
- }
-
- // Set into holder
- blh.value = bl;
-
- return true;
- }
-
-
-
-
- /**
- * Destroy this BindingIterator object. The object corresponding to this
- * object reference is destroyed.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see Destroy
- */
- public synchronized void destroy()
- {
- // Destroy actually destroys
- this.Destroy();
- }
-
- /**
- * Abstract method for returning the next binding in the NamingContext
- * for which this BindingIterator was created.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- protected abstract boolean NextOne(org.omg.CosNaming.BindingHolder b);
-
- /**
- * Abstract method for destroying this BindingIterator.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- protected abstract void Destroy();
-
- /**
- * Abstract method for returning the remaining number of elements.
- * @return the remaining number of elements in the iterator.
- */
- protected abstract int RemainingElements();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java 2018-01-30 20:18:15.000000000 -0500
+++ /dev/null 2018-01-30 20:18:15.000000000 -0500
@@ -1,413 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import org.omg.CosNaming.NamingContextExtPackage.*;
-import java.io.StringWriter;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-
-// Import org.omg.CosNaming types
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-
-
-/**
- * Class InteroperableNamingImpl implements the methods defined
- * for NamingContextExt which is part of Interoperable Naming
- * Service specifications. This class is added for doing more
- * of Parsing and Building of Stringified names according to INS
- * Spec.
- */
-public class InterOperableNamingImpl
-{
- /**
- * Method which stringifies the Name Components given as the input
- * parameter.
- *
- * @param n Array of Name Components (Simple or Compound Names)
- * @return string which is the stringified reference.
- */
- public String convertToString( org.omg.CosNaming.NameComponent[]
- theNameComponents )
- {
- String theConvertedString =
- convertNameComponentToString( theNameComponents[0] );
- String temp;
- for( int i = 1; i < theNameComponents.length; i++ ) {
- temp = convertNameComponentToString( theNameComponents[i] );
- if( temp != null ) {
- theConvertedString =
- theConvertedString + "/" + convertNameComponentToString(
- theNameComponents[i] );
- }
- }
- return theConvertedString;
- }
-
- /** This method converts a single Namecomponent to String, By adding Escapes
- * If neccessary.
- */
- private String convertNameComponentToString(
- org.omg.CosNaming.NameComponent theNameComponent )
- {
- if( ( ( theNameComponent.id == null )
- ||( theNameComponent.id.length() == 0 ) )
- &&( ( theNameComponent.kind == null )
- ||( theNameComponent.kind.length() == 0 ) ) )
- {
- return ".";
- }
- else if( ( theNameComponent.id == null )
- ||( theNameComponent.id.length() == 0 ) )
- {
- String kind = addEscape( theNameComponent.kind );
- return "." + kind;
- }
- else if( ( theNameComponent.kind == null )
- ||( theNameComponent.kind.length() == 0 ) )
- {
- String id = addEscape( theNameComponent.id );
- return id;
- }
- else {
- String id = addEscape( theNameComponent.id );
- String kind = addEscape( theNameComponent.kind );
- return (id + "." + kind);
- }
- }
-
-
- /** This method adds escape '\' for the Namecomponent if neccessary
- */
- private String addEscape( String value )
- {
- StringBuffer theNewValue;
- if( (value != null) && ( (value.indexOf('.') != -1 ) ||
- (value.indexOf('/') != -1)))
- {
- char c;
- theNewValue = new StringBuffer( );
- for( int i = 0; i < value.length( ); i++ ) {
- c = value.charAt( i );
- if( ( c != '.' ) && (c != '/' ) )
- {
- theNewValue.append( c );
- }
- else {
- // Adding escape for the "."
- theNewValue.append( '\\' );
- theNewValue.append( c );
- }
- }
- }
- else {
- return value;
- }
- return new String( theNewValue );
- }
-
- /**
- * Method which converts the Stringified name into Array of Name Components.
- *
- * @param string which is the stringified name.
- * @return Array of Name Components (Simple or Compound Names)
- */
- public org.omg.CosNaming.NameComponent[] convertToNameComponent(
- String theStringifiedName )
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- String[] theStringifiedNameComponents =
- breakStringToNameComponents( theStringifiedName );
- if( ( theStringifiedNameComponents == null )
- || (theStringifiedNameComponents.length == 0 ) )
- {
- return null;
- }
- NameComponent[] theNameComponents =
- new NameComponent[theStringifiedNameComponents.length];
- for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
- theNameComponents[i] = createNameComponentFromString(
- theStringifiedNameComponents[i] );
- }
- return theNameComponents;
- }
-
- /** Step1 in converting Stringified name into array of Name Component
- * is breaking the String into multiple name components
- */
- private String[] breakStringToNameComponents( String theStringifiedName ) {
- int[] theIndices = new int[100];
- int theIndicesIndex = 0;
-
- for(int index = 0; index <= theStringifiedName.length(); ) {
- theIndices[theIndicesIndex] = theStringifiedName.indexOf( '/',
- index );
- if( theIndices[theIndicesIndex] == -1 ) {
- // This is the end of all the occurence of '/' and hence come
- // out of the loop
- index = theStringifiedName.length()+1;
- }
- else {
- // If the '/' is found, first check whether it is
- // preceded by escape '\'
- // If not then set theIndices and increment theIndicesIndex
- // and also set the index else just ignore the '/'
- if( (theIndices[theIndicesIndex] > 0 )
- && (theStringifiedName.charAt(
- theIndices[theIndicesIndex]-1) == '\\') )
- {
- index = theIndices[theIndicesIndex] + 1;
- theIndices[theIndicesIndex] = -1;
- }
- else {
- index = theIndices[theIndicesIndex] + 1;
- theIndicesIndex++;
- }
- }
- }
- if( theIndicesIndex == 0 ) {
- String[] tempString = new String[1];
- tempString[0] = theStringifiedName;
- return tempString;
- }
- if( theIndicesIndex != 0 ) {
- theIndicesIndex++;
- }
- return StringComponentsFromIndices( theIndices, theIndicesIndex,
- theStringifiedName );
- }
-
- /** This method breaks one big String into multiple substrings based
- * on the array of index passed in.
- */
- private String[] StringComponentsFromIndices( int[] theIndices,
- int indicesCount, String theStringifiedName )
- {
- String[] theStringComponents = new String[indicesCount];
- int firstIndex = 0;
- int lastIndex = theIndices[0];
- for( int i = 0; i < indicesCount; i++ ) {
- theStringComponents[i] = theStringifiedName.substring( firstIndex,
- lastIndex );
- if( ( theIndices[i] < theStringifiedName.length() - 1 )
- &&( theIndices[i] != -1 ) )
- {
- firstIndex = theIndices[i]+1;
- }
- else {
- firstIndex = 0;
- i = indicesCount;
- }
- if( (i+1 < theIndices.length)
- && (theIndices[i+1] < (theStringifiedName.length() - 1))
- && (theIndices[i+1] != -1) )
- {
- lastIndex = theIndices[i+1];
- }
- else {
- i = indicesCount;
- }
- // This is done for the last component
- if( firstIndex != 0 && i == indicesCount ) {
- theStringComponents[indicesCount-1] =
- theStringifiedName.substring( firstIndex );
- }
- }
- return theStringComponents;
- }
-
- /** Step 2: After Breaking the Stringified name into set of NameComponent
- * Strings, The next step is to create Namecomponents from the substring
- * by removing the escapes if there are any.
- */
- private NameComponent createNameComponentFromString(
- String theStringifiedNameComponent )
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
-
- {
- String id = null;
- String kind = null;
- if( ( theStringifiedNameComponent == null )
- || ( theStringifiedNameComponent.length( ) == 0)
- || ( theStringifiedNameComponent.endsWith(".") ) )
- {
- // If any of the above is true, then we create an invalid Name
- // Component to indicate that it is an invalid name.
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName( );
- }
-
- int index = theStringifiedNameComponent.indexOf( '.', 0 );
- // The format could be XYZ (Without kind)
- if( index == -1 ) {
- id = theStringifiedNameComponent;
- }
- // The format is .XYZ (Without ID)
- else if( index == 0 ) {
- // This check is for the Namecomponent which is just "." meaning Id
- // and Kinds are null
- if( theStringifiedNameComponent.length( ) != 1 ) {
- kind = theStringifiedNameComponent.substring(1);
- }
- }
- else
- {
- if( theStringifiedNameComponent.charAt(index-1) != '\\' ) {
- id = theStringifiedNameComponent.substring( 0, index);
- kind = theStringifiedNameComponent.substring( index + 1 );
- }
- else {
- boolean kindfound = false;
- while( (index < theStringifiedNameComponent.length() )
- &&( kindfound != true ) )
- {
- index = theStringifiedNameComponent.indexOf( '.',index + 1);
- if( index > 0 ) {
- if( theStringifiedNameComponent.charAt(
- index - 1 ) != '\\' )
- {
- kindfound = true;
- }
- }
- else
- {
- // No more '.', which means there is no Kind
- index = theStringifiedNameComponent.length();
- }
- }
- if( kindfound == true ) {
- id = theStringifiedNameComponent.substring( 0, index);
- kind = theStringifiedNameComponent.substring(index + 1 );
- }
- else {
- id = theStringifiedNameComponent;
- }
- }
- }
- id = cleanEscapeCharacter( id );
- kind = cleanEscapeCharacter( kind );
- if( id == null ) {
- id = "";
- }
- if( kind == null ) {
- kind = "";
- }
- return new NameComponent( id, kind );
- }
-
-
- /** This method cleans the escapes in the Stringified name and returns the
- * correct String
- */
- private String cleanEscapeCharacter( String theString )
- {
- if( ( theString == null ) || (theString.length() == 0 ) ) {
- return theString;
- }
- int index = theString.indexOf( '\\' );
- if( index == 0 ) {
- return theString;
- }
- else {
- StringBuffer src = new StringBuffer( theString );
- StringBuffer dest = new StringBuffer( );
- char c;
- for( int i = 0; i < theString.length( ); i++ ) {
- c = src.charAt( i );
- if( c != '\\' ) {
- dest.append( c );
- } else {
- if( i+1 < theString.length() ) {
- char d = src.charAt( i + 1 );
- // If there is a AlphaNumeric character after a \
- // then include slash, as it is not intended as an
- // escape character.
- if( Character.isLetterOrDigit(d) ) {
- dest.append( c );
- }
- }
- }
- }
- return new String(dest);
- }
- }
-
- /**
- * Method which converts the Stringified name and Host Name Address into
- * a URL based Name
- *
- * @param address which is ip based host name
- * @param name which is the stringified name.
- * @return url based Name.
- */
- public String createURLBasedAddress( String address, String name )
- throws InvalidAddress
- {
- String theurl = null;
- if( ( address == null )
- ||( address.length() == 0 ) ) {
- throw new InvalidAddress();
- }
- else {
- theurl = "corbaname:" + address + "#" + encode( name );
- }
- return theurl;
- }
-
- /** Encodes the string according to RFC 2396 IETF spec required by INS.
- */
- private String encode( String stringToEncode ) {
- StringWriter theStringAfterEscape = new StringWriter();
- int byteCount = 0;
- for( int i = 0; i < stringToEncode.length(); i++ )
- {
- char c = stringToEncode.charAt( i ) ;
- if( Character.isLetterOrDigit( c ) ) {
- theStringAfterEscape.write( c );
- }
- // Do no Escape for characters in this list
- // RFC 2396
- else if((c == ';') || (c == '/') || (c == '?')
- || (c == ':') || (c == '@') || (c == '&') || (c == '=')
- || (c == '+') || (c == '$') || (c == ';') || (c == '-')
- || (c == '_') || (c == '.') || (c == '!') || (c == '~')
- || (c == '*') || (c == ' ') || (c == '(') || (c == ')') )
- {
- theStringAfterEscape.write( c );
- }
- else {
- // Add escape
- theStringAfterEscape.write( '%' );
- String hexString = Integer.toHexString( (int) c );
- theStringAfterEscape.write( hexString );
- }
- }
- return theStringAfterEscape.toString();
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java 2018-01-30 20:18:15.000000000 -0500
+++ /dev/null 2018-01-30 20:18:15.000000000 -0500
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import org.omg.CosNaming.NameComponent;
-
-/**
- * Class InternalBindingKey implements the necessary wrapper code
- * around the org.omg.CosNaming::NameComponent class to implement the proper
- * equals() method and the hashCode() method for use in a hash table.
- * It computes the hashCode once and stores it, and also precomputes
- * the lengths of the id and kind strings for faster comparison.
- */
-public class InternalBindingKey
-{
- // A key contains a name
- public NameComponent name;
- private int idLen;
- private int kindLen;
- private int hashVal;
-
- // Default Constructor
- public InternalBindingKey() {}
-
- // Normal constructor
- public InternalBindingKey(NameComponent n)
- {
- idLen = 0;
- kindLen = 0;
- setup(n);
- }
-
- // Setup the object
- protected void setup(NameComponent n) {
- this.name = n;
- // Precompute lengths and values since they will not change
- if( this.name.id != null ) {
- idLen = this.name.id.length();
- }
- if( this.name.kind != null ) {
- kindLen = this.name.kind.length();
- }
- hashVal = 0;
- if (idLen > 0)
- hashVal += this.name.id.hashCode();
- if (kindLen > 0)
- hashVal += this.name.kind.hashCode();
- }
-
- // Compare the keys by comparing name's id and kind
- public boolean equals(java.lang.Object o) {
- if (o == null)
- return false;
- if (o instanceof InternalBindingKey) {
- InternalBindingKey that = (InternalBindingKey)o;
- // Both lengths must match
- if (this.idLen != that.idLen || this.kindLen != that.kindLen) {
- return false;
- }
- // If id is set is must be equal
- if (this.idLen > 0 && this.name.id.equals(that.name.id) == false) {
- return false;
- }
- // If kind is set it must be equal
- if (this.kindLen > 0 && this.name.kind.equals(that.name.kind) == false) {
- return false;
- }
- // Must be the same
- return true;
- } else {
- return false;
- }
- }
- // Return precomputed value
- public int hashCode() {
- return this.hashVal;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java 2018-01-30 20:18:16.000000000 -0500
+++ /dev/null 2018-01-30 20:18:16.000000000 -0500
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.NameComponent;
-
-/**
- * Class InternalBindingKey acts as a container for two objects, namely
- * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two
- * components associated with the binding.
- */
-public class InternalBindingValue
-{
- public Binding theBinding;
- public String strObjectRef;
- public org.omg.CORBA.Object theObjectRef;
-
- // Default constructor
- public InternalBindingValue() {}
-
- // Normal constructor
- public InternalBindingValue(Binding b, String o) {
- theBinding = b;
- strObjectRef = o;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java 2018-01-30 20:18:17.000000000 -0500
+++ /dev/null 2018-01-30 20:18:17.000000000 -0500
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.Object;
-
-// Import org.omg.CosNaming classes
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.PortableServer.POA;
-
-/**
- * This interface defines a set of methods that must be implemented by the
- * "data store" associated with a NamingContext implementation.
- * It allows for different implementations of naming contexts that
- * support the same API but differ in storage mechanism.
- */
-public interface NamingContextDataStore {
- /**
- * Method which implements binding a name to an object as
- * the specified binding type.
- * @param n a NameComponent which is the name under which the object
- * will be bound.
- * @param obj the object reference to be bound.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements resolving the specified name,
- * returning the type of the binding and the bound object reference.
- * If the id and kind of the NameComponent are both empty, the initial
- * naming context (i.e., the local root) must be returned.
- * @param n a NameComponent which is the name to be resolved.
- * @param bth the BindingType as an out parameter.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- org.omg.CORBA.Object Resolve(NameComponent n,BindingTypeHolder bth)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements unbinding a name.
- * @return the object reference bound to the name, or null if not found.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- org.omg.CORBA.Object Unbind(NameComponent n)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements listing the contents of this
- * NamingContext and return a binding list and a binding iterator.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- void List(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements creating a new NamingContext.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- NamingContext NewContext()
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which implements destroying this NamingContext.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- void Destroy()
- throws org.omg.CORBA.SystemException;
-
- /**
- * Method which returns whether this NamingContext is empty
- * or not.
- * @return true if this NamingContext contains no bindings.
- */
- boolean IsEmpty();
-
- POA getNSPOA( );
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java 2018-01-30 20:18:17.000000000 -0500
+++ /dev/null 2018-01-30 20:18:17.000000000 -0500
@@ -1,1025 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Imports for Logging
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import com.sun.corba.se.impl.orbutil.LogKeywords;
-
-// Import general CORBA classes
-import org.omg.CORBA.Object;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-
-// Import org.omg.CosNaming classes
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextPackage.*;
-import org.omg.CosNaming._NamingContextImplBase;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextExt;
-import org.omg.CosNaming.NamingContextExtPOA;
-import org.omg.CosNaming.NamingContextExtPackage.*;
-import org.omg.CosNaming.NamingContextPackage.NotFound;
-
-import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
-
-import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.impl.logging.NamingSystemException ;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext
- * interface, but does not implement the methods associated with
- * maintaining the "table" of current bindings in a NamingContext.
- * Instead, this implementation assumes that the derived implementation
- * implements the NamingContextDataStore interface, which has the necessary
- * methods. This allows multiple
- * NamingContext implementations that differ in storage of the bindings,
- * as well as implementations of interfaces derived from
- * CosNaming::NamingContext that still reuses the implementation.
- *
- * The operations bind(), rebind(), bind_context() and rebind_context()
- * are all really implemented by doBind(). resolve() is really implemented
- * by doResolve(), unbind() by doUnbind(). list(), new_context() and
- * destroy() uses the NamingContextDataStore interface directly. All the
- * doX() methods are public static.
- * They synchronize on the NamingContextDataStore object.
- *
- * An implementation a NamingContext must extend this class and implement
- * the NamingContextDataStore interface with the operations:
- * Bind(), Resolve(),
- * Unbind(), List(), NewContext() and Destroy(). Calls
- * to these methods are synchronized; these methods should
- * therefore not be synchronized.
- */
-public abstract class NamingContextImpl
- extends NamingContextExtPOA
- implements NamingContextDataStore
-{
-
- protected POA nsPOA;
- private Logger readLogger, updateLogger, lifecycleLogger;
- private NamingSystemException wrapper ;
- private static NamingSystemException staticWrapper =
- NamingSystemException.get( CORBALogDomains.NAMING_UPDATE ) ;
-
- // The grammer for Parsing and Building Interoperable Stringified Names
- // are implemented in this class
- private InterOperableNamingImpl insImpl;
- /**
- * Create a naming context servant.
- * Runs the super constructor.
- * @param orb an ORB object.
- * @exception java.lang.Exception a Java exception.
- */
- public NamingContextImpl(ORB orb, POA poa) throws java.lang.Exception {
- super();
- this.orb = orb;
- wrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING_UPDATE ) ;
-
- insImpl = new InterOperableNamingImpl( );
- this.nsPOA = poa;
- readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
- updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
- lifecycleLogger = orb.getLogger(
- CORBALogDomains.NAMING_LIFECYCLE);
- }
-
- public POA getNSPOA( ) {
- return nsPOA;
- }
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could
- * not proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void bind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( obj == null )
- {
- updateLogger.warning( LogKeywords.NAMING_BIND +
- " unsuccessful because NULL Object cannot be Bound " );
- throw wrapper.objectIsNull() ;
- }
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,false,BindingType.nobject);
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. The NamingContext will participate in recursive resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param nc the NamingContext object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could
- * not proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void bind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( nc == null ) {
- updateLogger.warning( LogKeywords.NAMING_BIND_FAILURE +
- " NULL Context cannot be Bound " );
- throw new BAD_PARAM( "Naming Context should not be null " );
- }
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,false,BindingType.ncontext);
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * If a binding under the supplied name already exists it will be
- * unbound first. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void rebind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if( obj == null )
- {
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- " NULL Object cannot be Bound " );
- throw wrapper.objectIsNull() ;
- }
- try {
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,true,BindingType.nobject);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- NamingUtils.getDirectoryStructuredName( n ) +
- " is already bound to a Naming Context" );
- // This should not happen
- throw wrapper.namingCtxRebindAlreadyBound( ex ) ;
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, the first n-1 components will be
- * resolved in this NamingContext and the object bound in resulting
- * NamingContext. If a binding under the supplied name already exists it
- * will be unbound first. The NamingContext will participate in recursive
- * resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param nc the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doBind
- */
- public void rebind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if( nc == null )
- {
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- " NULL Context cannot be Bound " );
- throw wrapper.objectIsNull() ;
- }
- try {
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,true,BindingType.ncontext);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- // This should not happen
- updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
- NamingUtils.getDirectoryStructuredName( n ) +
- " is already bound to a CORBA Object" );
- throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * Resolve a name in this NamingContext and return the object reference
- * bound to the name. If the name contains multiple (n) components,
- * the first component will be resolved in this NamingContext and the
- * remaining components resolved in the resulting NamingContext, provided
- * that the NamingContext bound to the first component of the name was
- * bound with bind_context().
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doResolve
- */
- public org.omg.CORBA.Object resolve(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // doResolve actually resolves
- NamingContextDataStore impl = (NamingContextDataStore)this;
- org.omg.CORBA.Object obj = doResolve(impl,n);
- if( obj != null ) {
- if( readLogger.isLoggable( Level.FINE ) ) {
- readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS +
- " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
- }
- } else {
- readLogger.warning( LogKeywords.NAMING_RESOLVE_FAILURE +
- " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
- }
- return obj;
- }
-
-
- /**
- * Remove a binding from this NamingContext. If the name contains
- * multiple (n) components, the first n-1 components will be resolved
- * from this NamingContext and the final component unbound in
- * the resulting NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see doUnbind
- */
- public void unbind(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // doUnbind actually unbinds
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doUnbind(impl,n);
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
- " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
- }
- }
-
- /**
- * List the contents of this NamingContest. A sequence of bindings
- * is returned (a BindingList) containing up to the number of requested
- * bindings, and a BindingIterator object reference is returned for
- * iterating over the remaining bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see BindingListHolder
- * @see BindingIteratorImpl
- */
- public void list(int how_many, BindingListHolder bl,
- BindingIteratorHolder bi)
- {
- // List actually generates the list
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- impl.List(how_many,bl,bi);
- }
- if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
- "list(" + how_many + ") -> bindings[" + bl.value.length +
- "] + iterator: " + bi.value);
- }
- }
-
- /**
- * Create a NamingContext object and return its object reference.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public synchronized NamingContext new_context()
- {
- // Create actually creates a new naming context
- lifecycleLogger.fine( "Creating New Naming Context " );
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- NamingContext nctx = impl.NewContext();
- if( nctx != null ) {
- lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
- } else {
- // If naming context is null, then that must be a serious
- // error.
- lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
- }
- return nctx;
- }
- }
-
- /**
- * Create a new NamingContext, bind it in this Naming Context and return
- * its object reference. This is equivalent to using new_context() followed
- * by bind_context() with the supplied name and the object reference for
- * the newly created NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server, bound to the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see new_context
- * @see bind_context
- */
- public NamingContext bind_new_context(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- NamingContext nc = null;
- NamingContext rnc = null;
- try {
- if (debug)
- dprint("bind_new_context " + nameToString(n));
- // The obvious solution:
- nc = this.new_context();
- this.bind_context(n,nc);
- rnc = nc;
- nc = null;
- } finally {
- try {
- if(nc != null)
- nc.destroy();
- } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
- }
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- // isLoggable call to make sure that we save some precious
- // processor cycles, if there is no need to log.
- updateLogger.fine ( LogKeywords.NAMING_BIND +
- "New Context Bound To " +
- NamingUtils.getDirectoryStructuredName( n ) );
- }
- return rnc;
- }
-
- /**
- * Destroy this NamingContext object. If this NamingContext contains
- * no bindings, the NamingContext is deleted.
- * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This
- * NamingContext is not empty (i.e., contains bindings).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public void destroy()
- throws org.omg.CosNaming.NamingContextPackage.NotEmpty
- {
- lifecycleLogger.fine( "Destroying Naming Context " );
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- if (impl.IsEmpty() == true) {
- // The context is empty so it can be destroyed
- impl.Destroy();
- lifecycleLogger.fine ( LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
- }
- else {
- // This context is not empty!
- // Not a fatal error, warning should do.
- lifecycleLogger.warning( LogKeywords.LIFECYCLE_DESTROY_FAILURE +
- " NamingContext children are not destroyed still.." );
- throw new NotEmpty();
- }
- }
- }
-
- /**
- * Implements all four flavors of binding. It uses Resolve() to
- * check if a binding already exists (for bind and bind_context), and
- * unbind() to ensure that a binding does not already exist.
- * If the length of the name is 1, then Bind() is called with
- * the name and the object to bind. Otherwise, the first component
- * of the name is resolved in this NamingContext and the appropriate
- * form of bind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @param rebind Replace an existing binding or not.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not * proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
- * supplied name is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- * @see resolve
- * @see unbind
- * @see bind
- * @see bind_context
- * @see rebind
- * @see rebind_context
- */
- public static void doBind(NamingContextDataStore impl,
- NameComponent[] n,
- org.omg.CORBA.Object obj,
- boolean rebind,
- org.omg.CosNaming.BindingType bt)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- // Valid name?
- if (n.length < 1)
- throw new InvalidName();
-
- // At bottom level?
- if (n.length == 1) {
- // The identifier must be set
- if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) {
- throw new InvalidName();
- }
-
- // Ensure synchronization of backend
- synchronized (impl) {
- // Yes: bind object in this context under the name
- BindingTypeHolder bth = new BindingTypeHolder();
- if (rebind) {
- org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth );
- if( objRef != null ) {
- // Refer Naming Service Doc:00-11-01 section 2.2.3.4
- // If there is an object already bound with the name
- // and the binding type is not ncontext a NotFound
- // Exception with a reason of not a context has to be
- // raised.
- // Fix for bug Id: 4384628
- if ( bth.value.value() == BindingType.nobject.value() ){
- if ( bt.value() == BindingType.ncontext.value() ) {
- throw new NotFound(
- NotFoundReason.not_context, n);
- }
- } else {
- // Previously a Context was bound and now trying to
- // bind Object. It is invalid.
- if ( bt.value() == BindingType.nobject.value() ) {
- throw new NotFound(
- NotFoundReason.not_object, n);
- }
- }
- impl.Unbind(n[0]);
- }
-
- } else {
- if (impl.Resolve(n[0],bth) != null)
- // "Resistence is futile." [Borg pickup line]
- throw new AlreadyBound();
- }
-
- // Now there are no other bindings under this name
- impl.Bind(n[0],obj,bt);
- }
- } else {
- // No: bind in a different context
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // How should we propagate the bind
- switch (bt.value()) {
- case BindingType._nobject:
- {
- // Bind as object
- if (rebind)
- context.rebind(tail,obj);
- else
- context.bind(tail,obj);
- }
- break;
- case BindingType._ncontext:
- {
- // Narrow to a naming context using Java casts. It must
- // work.
- NamingContext objContext = (NamingContext)obj;
- // Bind as context
- if (rebind)
- context.rebind_context(tail,objContext);
- else
- context.bind_context(tail,objContext);
- }
- break;
- default:
- // This should not happen
- throw staticWrapper.namingCtxBadBindingtype() ;
- }
- }
- }
-
- /**
- * Implements resolving names in this NamingContext. The first component
- * of the supplied name is resolved in this NamingContext by calling
- * Resolve(). If there are no more components in the name, the
- * resulting object reference is returned. Otherwise, the resulting object
- * reference must have been bound as a context and be narrowable to
- * a NamingContext. If this is the case, the remaining
- * components of the name is resolved in the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
- * multiple components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
- * proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied
- * name is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system
- * exceptions.
- * @see resolve
- */
- public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object obj = null;
- BindingTypeHolder bth = new BindingTypeHolder();
-
-
- // Length must be greater than 0
- if (n.length < 1)
- throw new InvalidName();
-
- // The identifier must be set
- if (n.length == 1) {
- synchronized (impl) {
- // Resolve first level in this context
- obj = impl.Resolve(n[0],bth);
- }
- if (obj == null) {
- // Object was not found
- throw new NotFound(NotFoundReason.missing_node,n);
- }
- return obj;
- } else {
- // n.length > 1
- if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) {
- throw new InvalidName();
- }
-
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute restOfName = name[1..length]
- NameComponent[] tail = new NameComponent[n.length -1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Resolve rest of name in context
- try {
- // First try to resolve using the local call, this should work
- // most of the time unless there are federated naming contexts.
- Servant servant = impl.getNSPOA().reference_to_servant(
- context );
- return doResolve(((NamingContextDataStore)servant), tail) ;
- } catch( Exception e ) {
- return context.resolve(tail);
- }
- }
- }
-
- /**
- * Implements unbinding bound names in this NamingContext. If the
- * name contains only one component, the name is unbound in this
- * NamingContext using Unbind(). Otherwise, the first component
- * of the name is resolved in this NamingContext and
- * unbind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- public static void doUnbind(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if (n.length < 1)
- throw new InvalidName();
-
- // Unbind here?
- if (n.length == 1) {
- // The identifier must be set
- if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) {
- throw new InvalidName();
- }
-
- org.omg.CORBA.Object objRef = null;
- synchronized (impl) {
- // Yes: unbind in this context
- objRef = impl.Unbind(n[0]);
- }
-
- if (objRef == null)
- // It was not bound
- throw new NotFound(NotFoundReason.missing_node,n);
- // Done
- return;
- } else {
- // No: unbind in a different context
-
- // Resolve first - must be resolveable
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Propagate unbind to this context
- context.unbind(tail);
- }
- }
-
- /**
- * Implements resolving a NameComponent in this context and
- * narrowing it to CosNaming::NamingContext. It will throw appropriate
- * exceptions if not found or not narrowable.
- * @param impl an implementation of NamingContextDataStore
- * @param n a NameComponents which is the name to be found.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound The
- * first component could not be resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound {
- org.omg.CORBA.Object topRef = null;
- BindingTypeHolder bth = new BindingTypeHolder();
- NamingContext context = null;
-
- synchronized (impl) {
- // Resolve first - must be resolveable
- topRef = impl.Resolve(n[0],bth);
- if (topRef == null) {
- // It was not bound
- throw new NotFound(NotFoundReason.missing_node,n);
- }
- }
-
- // Was it bound as a context?
- if (bth.value != BindingType.ncontext) {
- // It was not a context
- throw new NotFound(NotFoundReason.not_context,n);
- }
-
- // Narrow to a naming context
- try {
- context = NamingContextHelper.narrow(topRef);
- } catch (org.omg.CORBA.BAD_PARAM ex) {
- // It was not a context
- throw new NotFound(NotFoundReason.not_context,n);
- }
-
- // Hmm. must be ok
- return context;
- }
-
-
- /**
- * This operation creates a stringified name from the array of Name
- * components.
- * @param n Name of the object
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- */
- public String to_string(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (n == null ) || (n.length == 0) )
- {
- throw new InvalidName();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
-
- String theStringifiedName = insImpl.convertToString( n );
-
- if( theStringifiedName == null )
- {
- throw new InvalidName();
- }
-
- return theStringifiedName;
- }
-
-
- /**
- * This operation converts a Stringified Name into an equivalent array
- * of Name Components.
- * @param sn Stringified Name of the object
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- */
- public org.omg.CosNaming.NameComponent[] to_name(String sn)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new InvalidName();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
- org.omg.CosNaming.NameComponent[] theNameComponents =
- insImpl.convertToNameComponent( sn );
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new InvalidName();
- }
- for( int i = 0; i < theNameComponents.length; i++ ) {
- // If there is a name component whose id and kind null or
- // zero length string, then an invalid name exception needs to be
- // raised.
- if ( ( ( theNameComponents[i].id == null )
- ||( theNameComponents[i].id.length() == 0 ) )
- &&( ( theNameComponents[i].kind == null )
- ||( theNameComponents[i].kind.length() == 0 ) ) ) {
- throw new InvalidName();
- }
- }
- return theNameComponents;
- }
-
- /**
- * This operation creates a URL based "iiopname://" format name
- * from the Stringified Name of the object.
- * @param addr internet based address of the host machine where
- * Name Service is running
- * @param sn Stringified Name of the object
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
- * Indicates the internet based address of the host machine is
- * incorrect
- */
-
- public String to_url(String addr, String sn)
- throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new InvalidName();
- }
- if( addr == null )
- {
- throw new
- org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
- String urlBasedAddress = null;
- urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
- // Extra check to see that corba name url created is valid as per
- // INS spec grammer.
- try {
- INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
- } catch( BAD_PARAM e ) {
- throw new
- org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- return urlBasedAddress;
- }
-
- /**
- * This operation resolves the Stringified name into the object
- * reference.
- * @param sn Stringified Name of the object
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * Indicates there is no object reference for the given name.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Indicates that the given compound name is incorrect
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- * Indicates the name is already bound.
- *
- */
- public org.omg.CORBA.Object resolve_str(String sn)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object theObject = null;
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new InvalidName();
- }
- NamingContextDataStore impl = (NamingContextDataStore)this;
- org.omg.CosNaming.NameComponent[] theNameComponents =
- insImpl.convertToNameComponent( sn );
-
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new InvalidName();
- }
- theObject = resolve( theNameComponents );
- return theObject;
- }
-
-
- transient protected ORB orb;
-
- public static String nameToString(NameComponent[] name)
- {
- StringBuffer s = new StringBuffer("{");
- if (name != null || name.length > 0) {
- for (int i=0;i0)
- s.append(",");
- s.append("[").
- append(name[i].id).
- append(",").
- append(name[i].kind).
- append("]");
- }
- }
- s.append("}");
- return s.toString();
- }
-
- // Debugging aids.
- public static final boolean debug = false;
-
- private static void dprint(String msg) {
- NamingUtils.dprint("NamingContextImpl(" +
- Thread.currentThread().getName() + " at " +
- System.currentTimeMillis() +
- " ems): " + msg);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java 2018-01-30 20:18:18.000000000 -0500
+++ /dev/null 2018-01-30 20:18:18.000000000 -0500
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import java.io.*;
-import org.omg.CosNaming.NameComponent;
-
-
-public class NamingUtils {
- // Do not instantiate this class
- private NamingUtils() {};
-
- /**
- * Debug flag which must be true for debug streams to be created and
- * dprint output to be generated.
- */
- public static boolean debug = false;
-
- /**
- * Prints the message to the debug stream if debugging is enabled.
- * @param msg the debug message to print.
- */
- public static void dprint(String msg) {
- if (debug && debugStream != null)
- debugStream.println(msg);
- }
-
- /**
- * Prints the message to the error stream (System.err is default).
- * @param msg the error message to print.
- */
- public static void errprint(String msg) {
- if (errStream != null)
- errStream.println(msg);
- else
- System.err.println(msg);
- }
-
- /**
- * Prints the stacktrace of the supplied exception to the error stream.
- * @param e any Java exception.
- */
- public static void printException(java.lang.Exception e) {
- if (errStream != null)
- e.printStackTrace(errStream);
- else
- e.printStackTrace();
- }
-
- /**
- * Create a debug print stream to the supplied log file.
- * @param logFile the file to which debug output will go.
- * @exception IOException thrown if the file cannot be opened for output.
- */
- public static void makeDebugStream(File logFile)
- throws java.io.IOException {
- // Create an outputstream for debugging
- java.io.OutputStream logOStream =
- new java.io.FileOutputStream(logFile);
- java.io.DataOutputStream logDStream =
- new java.io.DataOutputStream(logOStream);
- debugStream = new java.io.PrintStream(logDStream);
-
- // Emit first message
- debugStream.println("Debug Stream Enabled.");
- }
-
- /**
- * Create a error print stream to the supplied file.
- * @param errFile the file to which error messages will go.
- * @exception IOException thrown if the file cannot be opened for output.
- */
- public static void makeErrStream(File errFile)
- throws java.io.IOException {
- if (debug) {
- // Create an outputstream for errors
- java.io.OutputStream errOStream =
- new java.io.FileOutputStream(errFile);
- java.io.DataOutputStream errDStream =
- new java.io.DataOutputStream(errOStream);
- errStream = new java.io.PrintStream(errDStream);
- dprint("Error stream setup completed.");
- }
- }
-
-
- /**
- * A utility method that takes Array of NameComponent and converts
- * into a directory structured name in the format of /id1.kind1/id2.kind2..
- * This is used mainly for Logging.
- */
- static String getDirectoryStructuredName( NameComponent[] name ) {
- StringBuffer directoryStructuredName = new StringBuffer("/");
- for( int i = 0; i < name.length; i++ ) {
- directoryStructuredName.append( name[i].id + "." + name[i].kind );
- }
- return directoryStructuredName.toString( );
- }
-
- /**
- * The debug printstream.
- */
- public static java.io.PrintStream debugStream;
-
- /**
- * The error printstream.
- */
- public static java.io.PrintStream errStream;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java 2018-01-30 20:18:19.000000000 -0500
+++ /dev/null 2018-01-30 20:18:19.000000000 -0500
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.ORB;
-import org.omg.PortableServer.POA;
-
-// Get org.omg.CosNaming Types
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.NameComponent;
-
-// Get base implementation
-import com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl;
-import com.sun.corba.se.impl.naming.cosnaming.InternalBindingValue;
-
-// Get a hash table
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-/**
- * Class TransientBindingIterator implements the abstract methods
- * defined by BindingIteratorImpl, to use with the TransientNamingContext
- * implementation of the NamingContextImpl. The TransientBindingIterator
- * implementation receives a hash table of InternalBindingValues, and uses
- * an Enumeration to iterate over the contents of the hash table.
- * @see BindingIteratorImpl
- * @see TransientNamingContext
- */
-public class TransientBindingIterator extends BindingIteratorImpl
-{
- // There is only one POA used for both TransientNamingContext and
- // TransientBindingIteraor servants.
- private POA nsPOA;
- /**
- * Constructs a new TransientBindingIterator object.
- * @param orb a org.omg.CORBA.ORB object.
- * @param aTable A hashtable containing InternalBindingValues which is
- * the content of the TransientNamingContext.
- * @exception Exception a Java exception thrown of the base class cannot
- * initialize.
- */
- public TransientBindingIterator(ORB orb, Hashtable aTable,
- POA thePOA )
- throws java.lang.Exception
- {
- super(orb);
- theHashtable = aTable;
- theEnumeration = this.theHashtable.elements();
- currentSize = this.theHashtable.size();
- this.nsPOA = thePOA;
- }
-
- /**
- * Returns the next binding in the NamingContext. Uses the enumeration
- * object to determine if there are more bindings and if so, returns
- * the next binding from the InternalBindingValue.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- */
- final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
- {
- // If there are more elements get the next element
- boolean hasMore = theEnumeration.hasMoreElements();
- if (hasMore) {
- b.value =
- ((InternalBindingValue)theEnumeration.nextElement()).theBinding;
- currentSize--;
- } else {
- // Return empty but marshalable binding
- b.value = new Binding(new NameComponent[0],BindingType.nobject);
- }
- return hasMore;
- }
-
- /**
- * Destroys this BindingIterator by disconnecting from the ORB
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- final public void Destroy()
- {
- // Remove the object from the Active Object Map.
- try {
- byte[] objectId = nsPOA.servant_to_id( this );
- if( objectId != null ) {
- nsPOA.deactivate_object( objectId );
- }
- }
- catch( Exception e ) {
- NamingUtils.errprint("BindingIterator.Destroy():caught exception:");
- NamingUtils.printException(e);
- }
- }
-
- /**
- * Returns the remaining number of elements in the iterator.
- * @return the remaining number of elements in the iterator.
- */
- public final int RemainingElements() {
- return currentSize;
- }
-
- private int currentSize;
- private Hashtable theHashtable;
- private Enumeration theEnumeration;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java 2018-01-30 20:18:19.000000000 -0500
+++ /dev/null 2018-01-30 20:18:19.000000000 -0500
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-import java.util.Properties;
-import java.net.InetAddress;
-
-import org.omg.CORBA.ORB;
-
-import org.omg.CosNaming.NamingContext;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.naming.cosnaming.TransientNameService;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.impl.logging.NamingSystemException;
-
-/**
- * Class TransientNameServer is a standalone application which
- * implements a transient name service. It uses the TransientNameService
- * class for the name service implementation, and the BootstrapServer
- * for implementing bootstrapping, i.e., to get the initial NamingContext.
- *
- * The BootstrapServer uses a Properties object specify the initial service
- * object references supported; such as Properties object is created containing
- * only a "NameService" entry together with the stringified object reference
- * for the initial NamingContext. The BootstrapServer's listening port
- * is set by first checking the supplied arguments to the name server
- * (-ORBInitialPort), and if not set, defaults to the standard port number.
- * The BootstrapServer is created supplying the Properties object, using no
- * external File object for storage, and the derived initial port number.
- * @see TransientNameService
- * @see BootstrapServer
- */
-public class TransientNameServer
-{
- static private boolean debug = false ;
- static NamingSystemException wrapper = NamingSystemException.get(
- CORBALogDomains.NAMING ) ;
-
- static public void trace( String msg ) {
- if (debug)
- System.out.println( msg ) ;
- }
-
- static public void initDebug( String[] args ) {
- // If debug was compiled to be true for testing purposes,
- // don't change it.
- if (debug)
- return ;
-
- for (int ctr=0; ctr 0 ) {
- initialPort = java.lang.Integer.parseInt(ips);
- // -Dorg.omg.CORBA.ORBInitialPort=0 is invalid
- if( initialPort == 0 ) {
- orbInitialPort0 = true;
- throw wrapper.transientNameServerBadPort() ;
- }
- }
- String hostName =
- System.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
- if( hostName != null ) {
- invalidHostOption = true;
- throw wrapper.transientNameServerBadHost() ;
- }
- } catch (java.lang.NumberFormatException e) {
- // do nothing
- }
-
- // Let arguments override
- for (int i=0;i
- * The TransientNameService creates the initial NamingContext object.
- * @see NamingContextImpl
- * @see BindingIteratorImpl
- * @see TransientNamingContext
- * @see TransientBindingIterator
- */
-public class TransientNameService
-{
- /**
- * Constructs a new TransientNameService, and creates an initial
- * NamingContext, whose object
- * reference can be obtained by the initialNamingContext method.
- * @param orb The ORB object
- * @exception org.omg.CORBA.INITIALIZE Thrown if
- * the TransientNameService cannot initialize.
- */
- public TransientNameService(com.sun.corba.se.spi.orb.ORB orb )
- throws org.omg.CORBA.INITIALIZE
- {
- // Default constructor uses "NameService" as the key for the Root Naming
- // Context. If default constructor is used then INS's object key for
- // Transient Name Service is "NameService"
- initialize( orb, "NameService" );
- }
-
- /**
- * Constructs a new TransientNameService, and creates an initial
- * NamingContext, whose object
- * reference can be obtained by the initialNamingContext method.
- * @param orb The ORB object
- * @param serviceName Stringified key used for INS Service registry
- * @exception org.omg.CORBA.INITIALIZE Thrown if
- * the TransientNameService cannot initialize.
- */
- public TransientNameService(com.sun.corba.se.spi.orb.ORB orb,
- String serviceName ) throws org.omg.CORBA.INITIALIZE
- {
- // This constructor gives the flexibility of providing the Object Key
- // for the Root Naming Context that is registered with INS.
- initialize( orb, serviceName );
- }
-
-
- /**
- * This method initializes Transient Name Service by associating Root
- * context with POA and registering the root context with INS Object Keymap.
- */
- private void initialize( com.sun.corba.se.spi.orb.ORB orb,
- String nameServiceName )
- throws org.omg.CORBA.INITIALIZE
- {
- NamingSystemException wrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING ) ;
-
- try {
- POA rootPOA = (POA) orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME );
- rootPOA.the_POAManager().activate();
-
- int i = 0;
- Policy[] poaPolicy = new Policy[3];
- poaPolicy[i++] = rootPOA.create_lifespan_policy(
- LifespanPolicyValue.TRANSIENT);
- poaPolicy[i++] = rootPOA.create_id_assignment_policy(
- IdAssignmentPolicyValue.SYSTEM_ID);
- poaPolicy[i++] = rootPOA.create_servant_retention_policy(
- ServantRetentionPolicyValue.RETAIN);
-
- POA nsPOA = rootPOA.create_POA( "TNameService", null, poaPolicy );
- nsPOA.the_POAManager().activate();
-
- // Create an initial context
- TransientNamingContext initialContext =
- new TransientNamingContext(orb, null, nsPOA);
- byte[] rootContextId = nsPOA.activate_object( initialContext );
- initialContext.localRoot =
- nsPOA.id_to_reference( rootContextId );
- theInitialNamingContext = initialContext.localRoot;
- orb.register_initial_reference( nameServiceName,
- theInitialNamingContext );
- } catch (org.omg.CORBA.SystemException e) {
- throw wrapper.transNsCannotCreateInitialNcSys( e ) ;
- } catch (Exception e) {
- throw wrapper.transNsCannotCreateInitialNc( e ) ;
- }
- }
-
-
- /**
- * Return the initial NamingContext.
- * @return the object reference for the initial NamingContext.
- */
- public org.omg.CORBA.Object initialNamingContext()
- {
- return theInitialNamingContext;
- }
-
-
- // The initial naming context for this name service
- private org.omg.CORBA.Object theInitialNamingContext;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java 2018-01-30 20:18:20.000000000 -0500
+++ /dev/null 2018-01-30 20:18:21.000000000 -0500
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.cosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.ORB;
-import org.omg.PortableServer.POA;
-
-// Import org.omg.CosNaming types
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.BindingListHolder;
-import org.omg.CosNaming.BindingIteratorHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-import java.util.Hashtable;
-import com.sun.corba.se.impl.orbutil.LogKeywords;
-import com.sun.corba.se.impl.logging.NamingSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * Class TransientNamingContext implements the methods defined
- * by NamingContextDataStore, and extends the NamingContextImpl class to
- * provide a servant implementation of CosNaming::NamingContext.
- * The TransientNamingContext uses a hash table
- * to store the mappings between bindings and object references and the
- * hash table is not persistent; thereby the name "transient".
- * This class should not be used directly; instead, the class
- * TransientNameService should be instantiated.
- *
- * The keys in the hash table are InternalBindingKey objects, containing
- * a single NameComponent and implementing the proper functions, i.e.,
- * equals() and hashCode() in an efficient manner. The values in the hash
- * table are InternalBindingValues and store a org.omg.CosNaming::Binding and
- * the object reference associated with the binding. For iteration,
- * TransientBindingIterator objects are created, which are passed a cloned
- * copy of the hashtable. Since elements are inserted and deleted and
- * never modified, this provides stable iterators at the cost of cloning
- * the hash table.
- *
- * To create and destroy object references, the TransientNamingContext
- * uses the orb.connect() and orb.disconnect() methods.
- *
- * @see NamingContextImpl
- * @see NamingContextDataStore
- * @see TransientBindingIterator
- * @see TransientNameService
- */
-public class TransientNamingContext extends NamingContextImpl implements NamingContextDataStore
-{
- private Logger readLogger, updateLogger, lifecycleLogger;
-
- // XXX: the wrapper calls are all preceded by logger updates.
- // These can be combined, and then we simply use 3 NamingSystemException wrappers,
- // for read, update, and lifecycl.
- private NamingSystemException wrapper ;
-
- /**
- * Constructs a new TransientNamingContext object.
- * @param orb an orb object.
- * @param initial the initial naming context.
- * @exception Exception a Java exception thrown of the base class cannot
- * initialize.
- */
- public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb,
- org.omg.CORBA.Object initial,
- POA nsPOA )
- throws java.lang.Exception
- {
- super(orb, nsPOA );
- wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ;
-
- this.localRoot = initial;
- readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
- updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
- lifecycleLogger = orb.getLogger(
- CORBALogDomains.NAMING_LIFECYCLE);
- lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" );
- }
-
- /**
- * Binds the object to the name component as the specified binding type.
- * It creates a InternalBindingKey object and a InternalBindingValue
- * object and inserts them in the hash table.
- * @param n A single org.omg.CosNaming::NameComponent under which the
- * object will be bound.
- * @param obj An object reference to be bound under the supplied name.
- * @param bt The type of the binding (i.e., as object or as context).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
- BindingType bt)
- throws org.omg.CORBA.SystemException
- {
- // Create a key and a value
- InternalBindingKey key = new InternalBindingKey(n);
- NameComponent[] name = new NameComponent[1];
- name[0] = n;
- Binding b = new Binding(name,bt);
- InternalBindingValue value = new InternalBindingValue(b,null);
- value.theObjectRef = obj;
- // insert it
- InternalBindingValue oldValue =
- (InternalBindingValue)this.theHashtable.put(key,value);
-
- if (oldValue != null) {
- updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
- getName( n ) + " Was Already Bound" );
- throw wrapper.transNcBindAlreadyBound() ;
- }
- if( updateLogger.isLoggable( Level.FINE ) ) {
- updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
- "Name Component: " + n.id + "." + n.kind );
- }
- }
-
- /**
- * Resolves the supplied name to an object reference and returns
- * the type of the resolved binding. It creates a InternalBindingKey
- * and uses the key for looking up in the hash table. If nothing
- * is found an exception is thrown, otherwise the object reference
- * is returned and the binding type set.
- * @param n a NameComponent which is the name to be resolved.
- * @param bth the BindingType as an out parameter.
- * @return the object reference bound under the supplied name, null if not
- * found.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final org.omg.CORBA.Object Resolve(NameComponent n,
- BindingTypeHolder bth)
- throws org.omg.CORBA.SystemException
- {
- // Is the initial naming context requested?
- if ( (n.id.length() == 0)
- &&(n.kind.length() == 0 ) )
- {
- bth.value = BindingType.ncontext;
- return localRoot;
- }
-
- // Create a key and lookup the value
- InternalBindingKey key = new InternalBindingKey(n);
-
- InternalBindingValue value =
- (InternalBindingValue) this.theHashtable.get(key);
- if (value == null) return null;
- if( readLogger.isLoggable( Level.FINE ) ) {
- readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS
- + "Namecomponent :" + getName( n ) );
- }
-
- // Copy out binding type and object reference
- bth.value = value.theBinding.binding_type;
- return value.theObjectRef;
- }
-
- /**
- * Deletes the binding with the supplied name. It creates a
- * InternalBindingKey and uses it to remove the value associated
- * with the key. If nothing is found an exception is thrown, otherwise
- * the element is removed from the hash table.
- * @param n a NameComponent which is the name to unbind
- * @return the object reference bound to the name, or null if not found.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final org.omg.CORBA.Object Unbind(NameComponent n)
- throws org.omg.CORBA.SystemException
- {
- // Create a key and remove it from the hashtable
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value =
- (InternalBindingValue)this.theHashtable.remove(key);
-
- // Return what was found
- if (value == null) {
- if( updateLogger.isLoggable( Level.FINE ) ) {
- updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
- " There was no binding with the name " + getName( n ) +
- " to Unbind " );
- }
- return null;
- } else {
- if( updateLogger.isLoggable( Level.FINE ) ) {
- updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
- " NameComponent: " + getName( n ) );
- }
- return value.theObjectRef;
- }
- }
-
- /**
- * List the contents of this NamingContext. It creates a new
- * TransientBindingIterator object and passes it a clone of the
- * hash table and an orb object. It then uses the
- * newly created object to return the required number of bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final void List(int how_many, BindingListHolder bl,
- BindingIteratorHolder bi)
- throws org.omg.CORBA.SystemException
- {
- try {
- // Create a new binding iterator servant with a copy of this
- // hashtable. nsPOA is passed to the object so that it can
- // de-activate itself from the Active Object Map when
- // Binding Iterator.destroy is called.
- TransientBindingIterator bindingIterator =
- new TransientBindingIterator(this.orb,
- (Hashtable)this.theHashtable.clone(), nsPOA);
- // Have it set the binding list
- bindingIterator.list(how_many,bl);
-
- byte[] objectId = nsPOA.activate_object( bindingIterator );
- org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId );
-
- // Get the object reference for the binding iterator servant
- org.omg.CosNaming.BindingIterator bindingRef =
- org.omg.CosNaming.BindingIteratorHelper.narrow( obj );
-
- bi.value = bindingRef;
- } catch (org.omg.CORBA.SystemException e) {
- readLogger.warning( LogKeywords.NAMING_LIST_FAILURE + e );
- throw e;
- } catch (Exception e) {
- // Convert to a CORBA system exception
- readLogger.severe( LogKeywords.NAMING_LIST_FAILURE + e );
- throw wrapper.transNcListGotExc( e ) ;
- }
- }
-
- /**
- * Create a new NamingContext. It creates a new TransientNamingContext
- * object, passing it the orb object.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final org.omg.CosNaming.NamingContext NewContext()
- throws org.omg.CORBA.SystemException
- {
- try {
- // Create a new servant
- TransientNamingContext transContext =
- new TransientNamingContext(
- (com.sun.corba.se.spi.orb.ORB) orb,localRoot, nsPOA);
-
- byte[] objectId = nsPOA.activate_object( transContext );
- org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId );
- lifecycleLogger.fine( "TransientNamingContext " +
- "LIFECYCLE.CREATE SUCCESSFUL" );
- return org.omg.CosNaming.NamingContextHelper.narrow( obj );
-
- } catch (org.omg.CORBA.SystemException e) {
- lifecycleLogger.log(
- Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e );
- throw e;
- } catch (Exception e) {
- lifecycleLogger.log(
- Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e );
- throw wrapper.transNcNewctxGotExc( e ) ;
- }
- }
-
- /**
- * Destroys this NamingContext by disconnecting from the ORB.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions.
- */
- public final void Destroy()
- throws org.omg.CORBA.SystemException
- {
- // Destroy the object reference by disconnecting from the ORB
- try {
- byte[] objectId = nsPOA.servant_to_id( this );
- if( objectId != null ) {
- nsPOA.deactivate_object( objectId );
- }
- if( lifecycleLogger.isLoggable( Level.FINE ) ) {
- lifecycleLogger.fine(
- LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
- }
- } catch (org.omg.CORBA.SystemException e) {
- lifecycleLogger.log( Level.WARNING,
- LogKeywords.LIFECYCLE_DESTROY_FAILURE, e );
- throw e;
- } catch (Exception e) {
- lifecycleLogger.log( Level.WARNING,
- LogKeywords.LIFECYCLE_DESTROY_FAILURE, e );
- throw wrapper.transNcDestroyGotExc( e ) ;
- }
- }
-
- /**
- * A Utility Method For Logging..
- */
- private String getName( NameComponent n ) {
- return n.id + "." + n.kind;
- }
-
- /**
- * Return whether this NamingContext contains any bindings. It forwards
- * this request to the hash table.
- * @return true if this NamingContext contains no bindings.
- */
- public final boolean IsEmpty()
- {
- return this.theHashtable.isEmpty();
- }
-
- // A hashtable to store the bindings
- private final Hashtable theHashtable = new Hashtable();
-
- /**
- * The local root naming context.
- */
- public org.omg.CORBA.Object localRoot;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java 2018-01-30 20:18:21.000000000 -0500
+++ /dev/null 2018-01-30 20:18:21.000000000 -0500
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import java.util.*;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.NamingSystemException ;
-
-/**
- * The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's
- * will be parsed and converted to this object. This object is capable of
- * storing multiple Host profiles as defined in the CorbaLoc grammer.
- *
- * @author Hemanth
- */
-public class CorbalocURL extends INSURLBase
-{
- static NamingSystemException wrapper = NamingSystemException.get(
- CORBALogDomains.NAMING_READ ) ;
-
- /**
- * This constructor parses the URL and initializes all the variables. Once
- * the URL Object is constructed it is immutable. URL parameter is a
- * corbaloc: URL string with 'corbaloc:' prefix stripped.
- */
- public CorbalocURL( String aURL ) {
- String url = aURL;
-
- if( url != null ) {
- try {
- // First Clean the URL Escapes if there are any
- url = Utility.cleanEscapes( url );
- } catch( Exception e ) {
- // There is something wrong with the URL escapes used
- // so throw an exception
- badAddress( e );
- }
- int endIndex = url.indexOf( '/' );
- if( endIndex == -1 ) {
- // If there is no '/' then the endIndex is at the end of the URL
- endIndex = url.length();
- }
- // _REVISIT_: Add a testcase to check 'corbaloc:/'
- if( endIndex == 0 ) {
- // The url starts with a '/', it's an error
- badAddress( null );
- }
- // Anything between corbaloc: and / is the host,port information
- // of the server where the Service Object is located
- StringTokenizer endpoints = new StringTokenizer(
- url.substring( 0, endIndex ), "," );
- // NOTE:
- // There should be atleast one token, because there are checks
- // to make sure that there is host information before the
- // delimiter '/'. So no need to explicitly check for number of
- // tokens != 0
- while( endpoints.hasMoreTokens( ) ) {
- String endpointInfo = endpoints.nextToken();
- IIOPEndpointInfo iiopEndpointInfo = null;
- if( endpointInfo.startsWith( "iiop:" ) ) {
- iiopEndpointInfo = handleIIOPColon( endpointInfo );
- } else if( endpointInfo.startsWith( "rir:" ) ) {
- handleRIRColon( endpointInfo );
- rirFlag = true;
- } else if( endpointInfo.startsWith( ":" ) ) {
- iiopEndpointInfo = handleColon( endpointInfo );
- } else {
- // Right now we are not allowing any other protocol
- // other than iiop:, rir: so raise exception indicating
- // that the URL is malformed
- badAddress( null );
- }
- if ( rirFlag == false ) {
- // Add the Host information if RIR flag is set,
- // If RIR is set then it means use the internal Boot
- // Strap protocol for Key String resolution
- if( theEndpointInfo == null ) {
- theEndpointInfo = new java.util.ArrayList( );
- }
- theEndpointInfo.add( iiopEndpointInfo );
- }
- }
- // If there is something after corbaloc:endpointInfo/
- // then that is the keyString
- if( url.length() > (endIndex + 1) ) {
- theKeyString = url.substring( endIndex + 1 );
- }
- }
- }
-
-
- /**
- * A Utility method to throw BAD_PARAM exception to signal malformed
- * INS URL.
- */
- private void badAddress( java.lang.Throwable e )
- {
- throw wrapper.insBadAddress( e ) ;
- }
-
- /**
- * If there is 'iiop:' token in the URL, this method will parses
- * and validates that host and port information.
- */
- private IIOPEndpointInfo handleIIOPColon( String iiopInfo )
- {
- // Check the iiop syntax
- iiopInfo = iiopInfo.substring( NamingConstants.IIOP_LENGTH );
- return handleColon( iiopInfo );
- }
-
-
- /**
- * This is to handle the case of host information with no 'iiop:' prefix.
- * instead if ':' is specified then iiop is assumed.
- */
- private IIOPEndpointInfo handleColon( String iiopInfo ) {
- // String after ":"
- iiopInfo = iiopInfo.substring( 1 );
- String hostandport = iiopInfo;
- // The format can be 1.2@:
- StringTokenizer tokenizer = new StringTokenizer( iiopInfo, "@" );
- IIOPEndpointInfo iiopEndpointInfo = new IIOPEndpointInfo( );
- int tokenCount = tokenizer.countTokens( );
- // There can be 1 or 2 tokens with '@' as the delimiter
- // - if there is only 1 token then there is no GIOP version
- // information. A Default GIOP version of 1.2 is used.
- // - if there are 2 tokens then there is GIOP version is specified
- // - if there are no tokens or more than 2 tokens, then that's an
- // error
- if( ( tokenCount == 0 )
- ||( tokenCount > 2 ))
- {
- badAddress( null );
- }
- if( tokenCount == 2 ) {
- // There is VersionInformation after iiop:
- String version = tokenizer.nextToken( );
- int dot = version.indexOf('.');
- // There is a version without ., which means
- // Malformed list
- if (dot == -1) {
- badAddress( null );
- }
- try {
- iiopEndpointInfo.setVersion(
- Integer.parseInt( version.substring( 0, dot )),
- Integer.parseInt( version.substring(dot+1)) );
- hostandport = tokenizer.nextToken( );
- } catch( Throwable e ) {
- badAddress( e );
- }
- }
- try {
- // A Hack to differentiate IPV6 address
- // from IPV4 address, Current Resolution
- // is to use [ ] to differentiate ipv6 host
- int squareBracketBeginIndex = hostandport.indexOf ( '[' );
- if( squareBracketBeginIndex != -1 ) {
- // ipv6Host should be enclosed in
- // [ ], if not it will result in a
- // BAD_PARAM exception
- String ipv6Port = getIPV6Port( hostandport );
- if( ipv6Port != null ) {
- iiopEndpointInfo.setPort( Integer.parseInt( ipv6Port ));
- }
- iiopEndpointInfo.setHost( getIPV6Host( hostandport ));
- return iiopEndpointInfo;
- }
- tokenizer = new StringTokenizer( hostandport, ":" );
- // There are three possible cases here
- // 1. Host and Port is explicitly specified by using ":" as a
- // a separator
- // 2. Only Host is specified without the port
- // 3. HostAndPort info is null
- if( tokenizer.countTokens( ) == 2 ) {
- // Case 1: There is Host and Port Info
- iiopEndpointInfo.setHost( tokenizer.nextToken( ) );
- iiopEndpointInfo.setPort( Integer.parseInt(
- tokenizer.nextToken( )));
- } else {
- if( ( hostandport != null )
- &&( hostandport.length() != 0 ) )
- {
- // Case 2: Only Host is specified. iiopEndpointInfo is
- // initialized to use the default INS port, if no port is
- // specified
- iiopEndpointInfo.setHost( hostandport );
- }
- // Case 3: If no Host and Port info is provided then we use the
- // the default LocalHost and INSPort. iiopEndpointInfo is
- // already initialized with this info.
- }
- } catch( Throwable e ) {
- // Any kind of Exception is bad here.
- // Possible causes: A Number Format exception because port info is
- // malformed
- badAddress( e );
- }
- Utility.validateGIOPVersion( iiopEndpointInfo );
- return iiopEndpointInfo;
- }
-
- /**
- * Validate 'rir:' case.
- */
- private void handleRIRColon( String rirInfo )
- {
- if( rirInfo.length() != NamingConstants.RIRCOLON_LENGTH ) {
- badAddress( null );
- }
- }
-
- /**
- * Returns an IPV6 Port that is after []:. There is no validation
- * done here, if it is an incorrect port then the request through
- * this URL results in a COMM_FAILURE, otherwise malformed list will
- * result in BAD_PARAM exception thrown in checkcorbalocGrammer.
- */
- private String getIPV6Port( String endpointInfo )
- {
- int squareBracketEndIndex = endpointInfo.indexOf ( ']' );
- // If there is port information, then it has to be after ] bracket
- // indexOf returns the count from the index of zero as the base, so
- // equality check requires squareBracketEndIndex + 1.
- if( (squareBracketEndIndex + 1) != (endpointInfo.length( )) ) {
- if( endpointInfo.charAt( squareBracketEndIndex + 1 ) != ':' ) {
- throw new RuntimeException(
- "Host and Port is not separated by ':'" );
- }
- // PortInformation should be after ']:' delimiter
- // If there is an exception then it will be caught in
- // checkcorbaGrammer method and rethrown as BAD_PARAM
- return endpointInfo.substring( squareBracketEndIndex + 2 );
- }
- return null;
- }
-
-
- /**
- * Returns an IPV6 Host that is inside [ ] tokens. There is no validation
- * done here, if it is an incorrect IPV6 address then the request through
- * this URL results in a COMM_FAILURE, otherwise malformed list will
- * result in BAD_PARAM exception thrown in checkcorbalocGrammer.
- */
- private String getIPV6Host( String endpointInfo ) {
- // ipv6Host should be enclosed in
- // [ ], if not it will result in a
- // BAD_PARAM exception
- int squareBracketEndIndex = endpointInfo.indexOf ( ']' );
- // get the host between [ ]
- String ipv6Host = endpointInfo.substring( 1, squareBracketEndIndex );
- return ipv6Host;
- }
-
- /**
- * Will be true only in CorbanameURL class.
- */
- public boolean isCorbanameURL( ) {
- return false;
- }
-
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java 2018-01-30 20:18:22.000000000 -0500
+++ /dev/null 2018-01-30 20:18:22.000000000 -0500
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import com.sun.corba.se.impl.logging.NamingSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * The corbaname: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's
- * will be stored in this object. This object is capable of storing CorbaLoc
- * profiles as defined in the CorbaName grammer.
- *
- * @author Hemanth
- */
-public class CorbanameURL extends INSURLBase
-{
- private static NamingSystemException wrapper =
- NamingSystemException.get( CORBALogDomains.NAMING ) ;
-
- /**
- * This constructor takes a corbaname: url with 'corbaname:' prefix stripped
- * and initializes all the variables accordingly. If there are any parsing
- * errors then BAD_PARAM exception is raised.
- */
- public CorbanameURL( String aURL ) {
- String url = aURL;
-
- // First Clean the URL Escapes if there are any
- try {
- url = Utility.cleanEscapes( url );
- } catch( Exception e ) {
- badAddress( e );
- }
-
- int delimiterIndex = url.indexOf( '#' );
- String corbalocString = null;
- if( delimiterIndex != -1 ) {
- // Append corbaloc: for Grammar check, Get the string between
- // corbaname: and # which forms the corbaloc string
- corbalocString = "corbaloc:" +
- url.substring( 0, delimiterIndex ) + "/";
- } else {
- // Build a corbaloc string to check the grammar.
- // 10 is the length of corbaname:
- corbalocString = "corbaloc:" + url.substring( 0, url.length() );
- // If the string doesnot end with a / then add one to end the
- // URL correctly
- if( corbalocString.endsWith( "/" ) != true ) {
- corbalocString = corbalocString + "/";
- }
- }
- try {
- // Check the corbaloc grammar and set the returned corbaloc
- // object to the CorbaName Object
- INSURL insURL =
- INSURLHandler.getINSURLHandler().parseURL( corbalocString );
- copyINSURL( insURL );
- // String after '#' is the Stringified name used to resolve
- // the Object reference from the rootnaming context. If
- // the String is null then the Root Naming context is passed
- // back
- if((delimiterIndex > -1) &&
- (delimiterIndex < (aURL.length() - 1)))
- {
- int start = delimiterIndex + 1 ;
- String result = url.substring(start) ;
- theStringifiedName = result ;
- }
- } catch( Exception e ) {
- badAddress( e );
- }
- }
-
- /**
- * A Utility method to throw BAD_PARAM exception.
- */
- private void badAddress( java.lang.Throwable e )
- throws org.omg.CORBA.BAD_PARAM
- {
- throw wrapper.insBadAddress( e ) ;
- }
-
- /**
- * A Utility method to copy all the variables from CorbalocURL object to
- * this instance.
- */
- private void copyINSURL( INSURL url ) {
- rirFlag = url.getRIRFlag( );
- theEndpointInfo = (java.util.ArrayList) url.getEndpointInfo( );
- theKeyString = url.getKeyString( );
- theStringifiedName = url.getStringifiedName( );
- }
-
- public boolean isCorbanameURL( ) {
- return true;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java 2018-01-30 20:18:22.000000000 -0500
+++ /dev/null 2018-01-30 20:18:22.000000000 -0500
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-
-/**
- * EndpointInfo is used internally by CorbaLoc object to store the
- * host information used in creating the Service Object reference
- * from the -ORBInitDef and -ORBDefaultInitDef definitions.
- *
- * @author Hemanth
- */
-public class IIOPEndpointInfo
-{
- // Version information
- private int major, minor;
-
- // Host Name and Port Number
- private String host;
- private int port;
-
- IIOPEndpointInfo( ) {
- // Default IIOP Version
- major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION;
- minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION;
- // Default host is localhost
- host = ORBConstants.DEFAULT_INS_HOST;
- // Default INS Port
- port = ORBConstants.DEFAULT_INS_PORT;
- }
-
- public void setHost( String theHost ) {
- host = theHost;
- }
-
- public String getHost( ) {
- return host;
- }
-
- public void setPort( int thePort ) {
- port = thePort;
- }
-
- public int getPort( ) {
- return port;
- }
-
- public void setVersion( int theMajor, int theMinor ) {
- major = theMajor;
- minor = theMinor;
- }
-
- public int getMajor( ) {
- return major;
- }
-
- public int getMinor( ) {
- return minor;
- }
-
- /** Internal Debug Method.
- */
- public void dump( ) {
- System.out.println( " Major -> " + major + " Minor -> " + minor );
- System.out.println( "host -> " + host );
- System.out.println( "port -> " + port );
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java 2018-01-30 20:18:23.000000000 -0500
+++ /dev/null 2018-01-30 20:18:23.000000000 -0500
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-/**
- * INS URL is a generic interface for two different types of URL's specified
- * in INS spec.
- *
- * @author Hemanth
- */
-public interface INSURL {
- public boolean getRIRFlag( );
-
- // There can be one or more Endpoint's in the URL, so the return value is
- // a List
- public java.util.List getEndpointInfo( );
-
- public String getKeyString( );
-
- public String getStringifiedName( );
-
- // This method will return true only in CorbanameURL, It is provided because
- // corbaname: URL needs special handling.
- public boolean isCorbanameURL( );
-
- // A debug method, which is not required for normal operation
- public void dPrint( );
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java 2018-01-30 20:18:24.000000000 -0500
+++ /dev/null 2018-01-30 20:18:24.000000000 -0500
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-/** The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's
- * will be stored in this object. This object is capable of storing multiple
- * Host profiles as defined in the CorbaLoc grammer.
- *
- * @author Hemanth
- */
-public abstract class INSURLBase implements INSURL {
-
- // If rirFlag is set to true that means internal
- // boot strapping technique will be used. If set to
- // false then the EndpointInfo will be used to create the
- // Service Object reference.
- protected boolean rirFlag = false ;
- protected java.util.ArrayList theEndpointInfo = null ;
- protected String theKeyString = "NameService" ;
- protected String theStringifiedName = null ;
-
- public boolean getRIRFlag( ) {
- return rirFlag;
- }
-
- public java.util.List getEndpointInfo( ) {
- return theEndpointInfo;
- }
-
- public String getKeyString( ) {
- return theKeyString;
- }
-
- public String getStringifiedName( ) {
- return theStringifiedName;
- }
-
- public abstract boolean isCorbanameURL( );
-
- public void dPrint( ) {
- System.out.println( "URL Dump..." );
- System.out.println( "Key String = " + getKeyString( ) );
- System.out.println( "RIR Flag = " + getRIRFlag( ) );
- System.out.println( "isCorbanameURL = " + isCorbanameURL() );
- for( int i = 0; i < theEndpointInfo.size( ); i++ ) {
- ((IIOPEndpointInfo) theEndpointInfo.get( i )).dump( );
- }
- if( isCorbanameURL( ) ) {
- System.out.println( "Stringified Name = " + getStringifiedName() );
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java 2018-01-30 20:18:24.000000000 -0500
+++ /dev/null 2018-01-30 20:18:24.000000000 -0500
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.naming.namingutil;
-
-import org.omg.CORBA.CompletionStatus;
-import java.util.StringTokenizer;
-
-/**
- * This class is the entry point to parse different types of INS URL's.
- *
- * @author Hemanth
- */
-
-public class INSURLHandler {
-
- private static INSURLHandler insURLHandler = null;
-
- // Length of corbaloc:
- private static final int CORBALOC_PREFIX_LENGTH = 9;
-
- // Length of corbaname:
- private static final int CORBANAME_PREFIX_LENGTH = 10;
-
- private INSURLHandler( ) {
- }
-
- public synchronized static INSURLHandler getINSURLHandler( ) {
- if( insURLHandler == null ) {
- insURLHandler = new INSURLHandler( );
- }
- return insURLHandler;
- }
-
- public INSURL parseURL( String aUrl ) {
- String url = aUrl;
- if ( url.startsWith( "corbaloc:" ) == true ) {
- return new CorbalocURL( url.substring( CORBALOC_PREFIX_LENGTH ) );
- } else if ( url.startsWith ( "corbaname:" ) == true ) {
- return new CorbanameURL( url.substring( CORBANAME_PREFIX_LENGTH ) );
- }
- return null;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java 2018-01-30 20:18:25.000000000 -0500
+++ /dev/null 2018-01-30 20:18:25.000000000 -0500
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.naming.namingutil;
-
-/**
- * Constants specific to INS parsing and validation.
- */
-public class NamingConstants {
-
- // iiop length
- public static final int IIOP_LENGTH = 4;
-
- // rir: length
- public static final int RIRCOLON_LENGTH = 4;
-
- public static final int MAJORNUMBER_SUPPORTED = 1;
-
- public static final int MINORNUMBERMAX = 2;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java 2018-01-30 20:18:26.000000000 -0500
+++ /dev/null 2018-01-30 20:18:26.000000000 -0500
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.namingutil;
-
-import java.io.StringWriter;
-
-import org.omg.CORBA.DATA_CONVERSION;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.impl.logging.NamingSystemException;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-/**
- * Utility methods for Naming.
- *
- * @author Hemanth
- */
-class Utility {
- private static NamingSystemException wrapper =
- NamingSystemException.get( CORBALogDomains.NAMING ) ;
-
- /**
- * cleanEscapes removes URL escapes as per IETF 2386 RFP.
- */
- static String cleanEscapes( String stringToDecode ) {
- StringWriter theStringWithoutEscape = new StringWriter();
- for( int i = 0; i < stringToDecode.length(); i++ ) {
- char c = stringToDecode.charAt( i ) ;
- if( c != '%' ) {
- theStringWithoutEscape.write( c );
- } else {
- // Get the two hexadecimal digits and convert that into int
- i++;
- int Hex1 = hexOf( stringToDecode.charAt(i) );
- i++;
- int Hex2 = hexOf( stringToDecode.charAt(i) );
- int value = (Hex1 * 16) + Hex2;
- // Convert the integer to ASCII
- theStringWithoutEscape.write( (char) value );
- }
- }
- return theStringWithoutEscape.toString();
- }
-
- /**
- * Converts an Ascii Character into Hexadecimal digit
- * NOTE: THIS METHOD IS DUPLICATED TO DELIVER NAMING AS A SEPARATE
- * COMPONENT TO RI.
- **/
- static int hexOf( char x )
- {
- int val;
-
- val = x - '0';
- if (val >=0 && val <= 9)
- return val;
-
- val = (x - 'a') + 10;
- if (val >= 10 && val <= 15)
- return val;
-
- val = (x - 'A') + 10;
- if (val >= 10 && val <= 15)
- return val;
-
- throw new DATA_CONVERSION( );
- }
-
- /**
- * If GIOP Version is not correct, This method throws a BAD_PARAM
- * Exception.
- **/
- static void validateGIOPVersion( IIOPEndpointInfo endpointInfo ) {
- if ((endpointInfo.getMajor() > NamingConstants.MAJORNUMBER_SUPPORTED) ||
- (endpointInfo.getMinor() > NamingConstants.MINORNUMBERMAX ) )
- {
- throw wrapper.insBadAddress() ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java 2018-01-30 20:18:26.000000000 -0500
+++ /dev/null 2018-01-30 20:18:26.000000000 -0500
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.Serializable;
-import org.omg.CosNaming.NameComponent;
-
-
-/**
- * Class InternalBindingKey implements the necessary wrapper code
- * around the org.omg.CosNaming::NameComponent class to implement the proper
- * equals() method and the hashCode() method for use in a hash table.
- * It computes the hashCode once and stores it, and also precomputes
- * the lengths of the id and kind strings for faster comparison.
- */
-public class InternalBindingKey
- implements Serializable
-{
-
- // computed by serialver tool
- private static final long serialVersionUID = -5410796631793704055L;
-
- public String id;
- public String kind;
-
- // Default Constructor
- public InternalBindingKey() {}
-
- // Normal constructor
- public InternalBindingKey(NameComponent n)
- {
- setup(n);
- }
-
- // Setup the object
- protected void setup(NameComponent n) {
- this.id = n.id;
- this.kind = n.kind;
- }
-
- // Compare the keys by comparing name's id and kind
- public boolean equals(java.lang.Object o) {
- if (o == null)
- return false;
- if (o instanceof InternalBindingKey) {
- InternalBindingKey that = (InternalBindingKey)o;
- if( this.id != null && that.id != null )
- {
- if (this.id.length() != that.id.length() )
- {
- return false;
- }
- // If id is set is must be equal
- if (this.id.length() > 0 && this.id.equals(that.id) == false)
- {
- return false;
- }
- }
- else
- {
- // If One is Null and the other is not then it's a mismatch
- // So, return false
- if( ( this.id == null && that.id != null )
- || ( this.id !=null && that.id == null ) )
- {
- return false;
- }
- }
- if( this.kind != null && that.kind != null )
- {
- if (this.kind.length() != that.kind.length() )
- {
- return false;
- }
- // If kind is set it must be equal
- if (this.kind.length() > 0 && this.kind.equals(that.kind) == false)
- {
- return false;
- }
- }
- else
- {
- // If One is Null and the other is not then it's a mismatch
- // So, return false
- if( ( this.kind == null && that.kind != null )
- || ( this.kind !=null && that.kind == null ) )
- {
- return false;
- }
- }
- // We have checked all the possibilities, so return true
- return true;
- } else {
- return false;
- }
- }
-
-
- // Return precomputed value
- public int hashCode() {
- int hashVal = 0;
- if (this.id.length() > 0)
- {
- hashVal += this.id.hashCode();
- }
- if (this.kind.length() > 0)
- {
- hashVal += this.kind.hashCode();
- }
- return hashVal;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java 2018-01-30 20:18:27.000000000 -0500
+++ /dev/null 2018-01-30 20:18:27.000000000 -0500
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.BindingType;
-import java.io.Serializable;
-
-/**
- * Class InternalBindingKey acts as a container for two objects, namely
- * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two
- * components associated with the binding.
- */
-public class InternalBindingValue
- implements Serializable
-{
- public BindingType theBindingType;
- // The value stores both Stringified Object Reference and
- // Non-Stringified Object Reference. This is done to avoid
- // calling orb.string_to_object( ) everytime. Instead it
- // will be set once and then the result will be used everytime.
- public String strObjectRef;
- transient private org.omg.CORBA.Object theObjectRef;
-
- // Default constructor
- public InternalBindingValue() {
- }
-
- // Normal constructor
- public InternalBindingValue(BindingType b, String o) {
- // Objectreference or Context
- theBindingType = b;
- strObjectRef = o;
- }
-
- public org.omg.CORBA.Object getObjectRef( )
- {
- return theObjectRef;
- }
-
- public void setObjectRef( org.omg.CORBA.Object ObjectRef )
- {
- theObjectRef = ObjectRef;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java 2018-01-30 20:18:28.000000000 -0500
+++ /dev/null 2018-01-30 20:18:28.000000000 -0500
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.File;
-import java.util.Properties;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.activation.InitialNameService;
-import com.sun.corba.se.spi.activation.InitialNameServiceHelper;
-import org.omg.CosNaming.NamingContext;
-/**
- * Class NameServer is a standalone application which
- * implements a persistent and a transient name service.
- * It uses the PersistentNameService and TransientNameService
- * classes for the name service implementation.
- *
- * @author Hemanth Puttaswamy
- * @since JDK1.2
- */
-
-public class NameServer
-{
- private ORB orb;
-
- private File dbDir; // name server database directory
-
- private final static String dbName = "names.db";
-
- public static void main(String args[])
- {
- NameServer ns = new NameServer(args);
- ns.run();
- }
-
- protected NameServer(String args[])
- {
- // create the ORB Object
- java.util.Properties props = System.getProperties();
- props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
- props.put("org.omg.CORBA.ORBClass",
- "com.sun.corba.se.impl.orb.ORBImpl");
- orb = (ORB) org.omg.CORBA.ORB.init(args,props);
-
- // set up the database directory
- String dbDirName = props.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
- props.getProperty("file.separator") + dbName +
- props.getProperty("file.separator");
-
- dbDir = new File(dbDirName);
- if (!dbDir.exists()) dbDir.mkdir();
- }
-
- protected void run()
- {
- try {
-
- // create the persistent name service
- NameService ns = new NameService(orb, dbDir);
-
- // add root naming context to initial naming
- NamingContext rootContext = ns.initialNamingContext();
- InitialNameService ins = InitialNameServiceHelper.narrow(
- orb.resolve_initial_references(
- ORBConstants.INITIAL_NAME_SERVICE_NAME ));
- ins.bind( "NameService", rootContext, true);
- System.out.println(CorbaResourceUtil.getText("pnameserv.success"));
-
- // wait for invocations
- orb.run();
-
- } catch (Exception ex) {
-
- ex.printStackTrace(System.err);
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java 2018-01-30 20:18:28.000000000 -0500
+++ /dev/null 2018-01-30 20:18:28.000000000 -0500
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.omg.CORBA.Policy;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.PortableServer.*;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/**
- * @author Hemanth Puttaswamy
- * @since JDK1.2
- */
-
-public class NameService
-{
- private NamingContext rootContext = null;
- private POA nsPOA = null;
- private ServantManagerImpl contextMgr;
- private ORB theorb;
-
- /**
- * Create NameService which starts the Root Naming Context in Persistent CosNaming
- * @param orb an ORB object.
- * @param logDir a File
- * @exception java.lang.Exception a Java exception.
- */
- public NameService(ORB orb, File logDir)
- throws Exception
- {
- theorb = orb;
-
- // Moved this to the creation of the ORB that is passed into this
- // constructor.
- //
- // This is required for creating Persistent Servants under this ORB
- // Right now the Persistent NameService and ORBD are launched together
- // Find out a better way of doing this, Since ORBD is an important
- // process which should not be killed because of some external process
- // orb.setPersistentServerId( (int) 1000 );
-
- // get and activate the root naming POA
- POA rootPOA = (POA)orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME ) ;
- rootPOA.the_POAManager().activate();
-
- // create a new POA for persistent Naming Contexts
- // With Non-Retain policy, So that every time Servant Manager
- // will be contacted when the reference is made for the context
- // The id assignment is made by the NameServer, The Naming Context
- // id's will be in the format NC
- int i=0;
- Policy[] poaPolicy = new Policy[4];
- poaPolicy[i++] = rootPOA.create_lifespan_policy(
- LifespanPolicyValue.PERSISTENT);
- poaPolicy[i++] = rootPOA.create_request_processing_policy(
- RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
- poaPolicy[i++] = rootPOA.create_id_assignment_policy(
- IdAssignmentPolicyValue.USER_ID);
- poaPolicy[i++] = rootPOA.create_servant_retention_policy(
- ServantRetentionPolicyValue.NON_RETAIN);
-
-
- nsPOA = rootPOA.create_POA("NameService", null, poaPolicy);
- nsPOA.the_POAManager().activate( );
-
- // create and set the servant manager
- contextMgr = new
- ServantManagerImpl(orb, logDir, this );
-
- // The RootObject key will be NC0
- String rootKey = contextMgr.getRootObjectKey( );
- // initialize the root Naming Context
- NamingContextImpl nc =
- new NamingContextImpl( orb, rootKey, this, contextMgr );
- nc = contextMgr.addContext( rootKey, nc );
- nc.setServantManagerImpl( contextMgr );
- nc.setORB( orb );
- nc.setRootNameService( this );
-
- nsPOA.set_servant_manager(contextMgr);
- rootContext = NamingContextHelper.narrow(
- nsPOA.create_reference_with_id( rootKey.getBytes( ),
- NamingContextHelper.id( ) ) );
- }
-
- /**
- * This method returns the Root Naming Context
- */
- public NamingContext initialNamingContext()
- {
- return rootContext;
- }
-
- /**
- * This method returns nsPOA which is the only POA that we use for
- * Persistent Naming Contexts.
- */
- POA getNSPOA( ) {
- return nsPOA;
- }
-
-
- /**
- * This method creates a NewContext, This will internally invoked from
- * NamingContextImpl. It is not a public API. NewContext is in this class
- * because a Persiten reference has to be created with Persistent NameService
- * POA.
- */
- public NamingContext NewContext( ) throws org.omg.CORBA.SystemException
- {
- try
- {
- // Get the new Naming Context Key from
- // the ServantManager
- String newKey =
- contextMgr.getNewObjectKey( );
- // Create the new Naming context and create the Persistent
- // reference
- NamingContextImpl theContext =
- new NamingContextImpl( theorb, newKey,
- this, contextMgr );
- NamingContextImpl tempContext = contextMgr.addContext( newKey,
- theContext );
- if( tempContext != null )
- {
- theContext = tempContext;
- }
- // If the context is read from the File, The following three entries
- // will be null. So a fresh setup may be required.
- theContext.setServantManagerImpl( contextMgr );
- theContext.setORB( theorb );
- theContext.setRootNameService( this );
- NamingContext theNewContext =
- NamingContextHelper.narrow(
- nsPOA.create_reference_with_id( newKey.getBytes( ),
- NamingContextHelper.id( )) );
- return theNewContext;
- }
- catch( org.omg.CORBA.SystemException e )
- {
- throw e;
- }
- catch( java.lang.Exception e )
- {
- //throw e;
- }
- return null;
- }
-
- /**
- * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
- * @param Object Key as String
- * @return a CORBA.Object reference.
- */
- org.omg.CORBA.Object getObjectReferenceFromKey( String key )
- {
- org.omg.CORBA.Object theObject = null;
- try
- {
- theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
- }
- catch (Exception e )
- {
- theObject = null;
- }
- return theObject;
- }
-
- /**
- * getObjectKey gets the Object Key from the reference using POA.reference_to_id method
- * @param reference an CORBA.Object.
- * @return Object Key as String
- */
- String getObjectKey( org.omg.CORBA.Object reference )
- {
- byte theId[];
- try
- {
- theId = nsPOA.reference_to_id( reference );
- }
- catch( org.omg.PortableServer.POAPackage.WrongAdapter e )
- {
- return null;
- }
- catch( org.omg.PortableServer.POAPackage.WrongPolicy e )
- {
- return null;
- }
- catch( Exception e )
- {
- return null;
- }
- String theKey = new String( theId );
- return theKey;
- }
-
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java 2018-01-30 20:18:29.000000000 -0500
+++ /dev/null 2018-01-30 20:18:29.000000000 -0500
@@ -1,1302 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-
-import org.omg.CORBA.Object;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.Policy;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-
-import org.omg.CosNaming.*;
-import org.omg.CosNaming.NamingContextPackage.*;
-import org.omg.CosNaming.NamingContextExtPackage.*;
-
-import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
-import com.sun.corba.se.impl.naming.cosnaming.NamingUtils;
-
-import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.NamingSystemException;
-
-import java.io.Serializable;
-import java.util.Hashtable;
-
-/**
- * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and
- * NamingContextExt interface.
- *
- * The operations bind(), rebind(), bind_context() and rebind_context()
- * are all really implemented by doBind(). resolve() is really implemented
- * by doResolve(), unbind() by doUnbind(). list(), new_context() and
- * destroy() uses the NamingContextDataStore interface directly. All the
- * doX() methods are public static.
- * They synchronize on the NamingContextDataStore object.
- *
- * None of the methods here are Synchronized because These methods will be
- * invoked from Super class's doBind( ), doResolve( ) which are already
- * Synchronized.
- */
-
-
-public class NamingContextImpl
- extends NamingContextExtPOA
- implements NamingContextDataStore, Serializable
-{
-
- // The ORB is required to do string_to_object() operations
- // All the references are stored in the files in the form of IOR strings
- private transient ORB orb;
-
- // The ObjectKey will be in the format NC which uniquely identifies
- // The NamingContext internaly
- private final String objKey;
-
- // Hash table contains all the entries in the NamingContexts. The
- // CORBA.Object references will be stored in the form of IOR strings
- // and the Child Naming Contexts will have it's key as the entry in the
- // table. This table is written into File everytime an update is made
- // on this context.
- private final Hashtable theHashtable = new Hashtable( );
-
- // The NameServiceHandle is required to get the ObjectId from the
- // NamingContext's references. These references are created using
- // POA in the NameService.
- private transient NameService theNameServiceHandle;
-
- // ServantManager is the single point of contact to Read, Write and
- // Update the NamingContextFile
- private transient ServantManagerImpl theServantManagerImplHandle;
-
- // All the INS (Interoperable Naming Service) methods are defined in this class
- // All the calls to INS will be delegated to this class.
- private transient com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl insImpl;
-
- private transient NamingSystemException readWrapper ;
-
- private transient NamingSystemException updateWrapper ;
-
- private static POA biPOA = null;
-
- /**
- * Create a naming context servant.
- * Runs the super constructor.
- * @param orb an ORB object.
- * @param objKey as String
- * @param theNameService as NameService
- * @param theServantManagerImpl as ServantManagerImpl
- * @exception java.lang.Exception a Java exception.
- */
-
- public NamingContextImpl(ORB orb, String objKey,
- NameService theNameService, ServantManagerImpl theServantManagerImpl )
- throws Exception
- {
- super();
-
- this.orb = orb;
- readWrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING_READ ) ;
- updateWrapper = NamingSystemException.get( orb,
- CORBALogDomains.NAMING_UPDATE ) ;
-
- debug = true ; // orb.namingDebugFlag ;
- this.objKey = objKey;
- theNameServiceHandle = theNameService;
- theServantManagerImplHandle = theServantManagerImpl;
- insImpl =
- new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
- }
-
- com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl getINSImpl( )
- {
- if( insImpl == null )
- {
- // insImpl will be null if the NamingContext graph is rebuilt from
- // the persistence store.
- insImpl =
- new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
- }
- return insImpl;
- }
-
-
- public void setRootNameService( NameService theNameService ) {
- theNameServiceHandle = theNameService;
- }
-
- public void setORB( ORB theOrb ) {
- orb = theOrb;
- }
-
- public void setServantManagerImpl(
- ServantManagerImpl theServantManagerImpl )
- {
- theServantManagerImplHandle = theServantManagerImpl;
- }
-
- public POA getNSPOA( ) {
- return theNameServiceHandle.getNSPOA( );
- }
-
-
-
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound The supplied name
- * is already bound.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void bind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( obj == null ) {
- throw updateWrapper.objectIsNull() ;
- }
-
- if (debug)
- dprint("bind " + nameToString(n) + " to " + obj);
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,false,BindingType.nobject);
- }
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * An exception is thrown if a binding with the supplied name already
- * exists. The NamingContext will participate in recursive resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param nc the NamingContect object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
- * already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void bind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- if( nc == null ) {
- throw updateWrapper.objectIsNull() ;
- }
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,false,BindingType.ncontext);
- }
-
- /**
- * Bind an object under a name in this NamingContext. If the name
- * contains multiple (n) components, n-1 will be resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * If a binding under the supplied name already exists it will be
- * unbound first. If the
- * object to be bound is a NamingContext it will not participate in
- * a recursive resolve.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void rebind(NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if( obj == null )
- {
- throw updateWrapper.objectIsNull() ;
- }
- try {
- if (debug)
- dprint("rebind " + nameToString(n) + " to " + obj);
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,obj,true,BindingType.nobject);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- // This should not happen
- throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;
- }
- }
-
- /**
- * Bind a NamingContext under a name in this NamingContext. If the name
- * contains multiple (n) components, the first n-1 components will be
- * resolved in this
- * NamingContext and the object bound in resulting NamingContext.
- * If a binding under the supplied name already exists it will be
- * unbound first. The NamingContext will participate in recursive resolving.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param nc the object reference to be bound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doBind
- */
- public void rebind_context(NameComponent[] n, NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- try {
- if (debug)
- dprint("rebind_context " + nameToString(n) + " to " + nc);
- // doBind implements all four flavors of binding
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doBind(impl,n,nc,true,BindingType.ncontext);
- } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
- // This should not happen
- throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;
- }
- }
-
- /**
- * Resolve a name in this NamingContext and return the object reference
- * bound to the name. If the name contains multiple (n) components,
- * the first component will be resolved in this NamingContext and the
- * remaining components resolved in the resulting NamingContext, provided
- * that the NamingContext bound to the first component of the name was
- * bound with bind_context().
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doResolve
- */
- public org.omg.CORBA.Object resolve(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if (debug)
- dprint("resolve " + nameToString(n));
- // doResolve actually resolves
- NamingContextDataStore impl = (NamingContextDataStore)this;
- return doResolve(impl,n);
- }
-
- /**
- * Remove a binding from this NamingContext. If the name contains
- * multiple (n) components, the first n-1 components will be resolved
- * from this NamingContext and the final component unbound in
- * the resulting NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see doUnbind
- */
- public void unbind(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- if (debug)
- dprint("unbind " + nameToString(n));
- // doUnbind actually unbinds
- NamingContextDataStore impl = (NamingContextDataStore)this;
- doUnbind(impl,n);
- }
-
- /**
- * List the contents of this NamingContest. A sequence of bindings
- * is returned (a BindingList) containing up to the number of requested
- * bindings, and a BindingIterator object reference is returned for
- * iterating over the remaining bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see BindingListHolder
- * @see BindingIteratorImpl
- */
- public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
- {
- if (debug)
- dprint("list(" + how_many + ")");
- // List actually generates the list
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- impl.List(how_many,bl,bi);
- }
- if (debug && bl.value != null)
- dprint("list(" + how_many + ") -> bindings[" + bl.value.length +
- "] + iterator: " + bi.value);
- }
-
-
- /**
- * Create a NamingContext object and return its object reference.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- public synchronized NamingContext new_context()
- {
- // Create actually creates a new naming context
- if (debug)
- dprint("new_context()");
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- return impl.NewContext();
- }
- }
-
-
- /**
- * Create a new NamingContext, bind it in this Naming Context and return
- * its object reference. This is equivalent to using new_context() followed
- * by bind_context() with the supplied name and the object reference for
- * the newly created NamingContext.
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server, bound to the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
- * already bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see new_context
- * @see bind_context
- */
- public NamingContext bind_new_context(NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- NamingContext nc = null;
- NamingContext rnc = null;
- try {
- if (debug)
- dprint("bind_new_context " + nameToString(n));
- // The obvious solution:
- nc = this.new_context();
- this.bind_context(n,nc);
- rnc = nc;
- nc = null;
- } finally {
- try {
- if(nc != null)
- nc.destroy();
- } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
- }
- }
- return rnc;
- }
-
- /**
- * Destroy this NamingContext object. If this NamingContext contains
- * no bindings, the NamingContext is deleted.
- * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
- * is not empty (i.e., contains bindings).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- public void destroy()
- throws org.omg.CosNaming.NamingContextPackage.NotEmpty
- {
- if (debug)
- dprint("destroy ");
- NamingContextDataStore impl = (NamingContextDataStore)this;
- synchronized (impl) {
- if (impl.IsEmpty() == true)
- // The context is empty so it can be destroyed
- impl.Destroy();
- else
- // This context is not empty!
- throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
- }
- }
-
- /**
- * Implements all four flavors of binding. It uses Resolve() to
- * check if a binding already exists (for bind and bind_context), and
- * unbind() to ensure that a binding does not already exist.
- * If the length of the name is 1, then Bind() is called with
- * the name and the object to bind. Otherwise, the first component
- * of the name is resolved in this NamingContext and the appropriate
- * form of bind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @param rebind Replace an existing binding or not.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
- * already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- * @see unbind
- * @see bind
- * @see bind_context
- * @see rebind
- * @see rebind_context
- */
- private void doBind(NamingContextDataStore impl,
- NameComponent[] n,
- org.omg.CORBA.Object obj,
- boolean rebind,
- org.omg.CosNaming.BindingType bt)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName,
- org.omg.CosNaming.NamingContextPackage.AlreadyBound
- {
- // Valid name?
- if (n.length < 1)
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // At bottom level?
- if (n.length == 1) {
- // The identifier must be set
- if( (n[0].id.length() == 0) && (n[0].kind.length() == 0) )
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // Ensure synchronization of backend
- synchronized (impl) {
- // Yes: bind object in this context under the name
- BindingTypeHolder bth = new BindingTypeHolder();
- if (rebind) {
- org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth );
- if( objRef != null ) {
- // Refer Naming Service Doc:00-11-01 section 2.2.3.4
- // If there is an object already bound with the name
- // and the binding type is not ncontext a NotFound
- // Exception with a reason of not a context has to be
- // raised.
- // Fix for bug Id: 4384628
- if ( bth.value.value() == BindingType.nobject.value() ) {
- if ( bt.value() == BindingType.ncontext.value() ) {
- throw new NotFound(NotFoundReason.not_context, n);
- }
- } else {
- // Previously a Context was bound and now trying to
- // bind Object. It is invalid.
- if ( bt.value() == BindingType.nobject.value() ) {
- throw new NotFound(NotFoundReason.not_object, n);
- }
- }
- impl.Unbind(n[0]);
- }
- } else {
- if (impl.Resolve(n[0],bth) != null)
- throw new org.omg.CosNaming.NamingContextPackage.AlreadyBound();
- }
-
- // Now there are no other bindings under this name
- impl.Bind(n[0],obj,bt);
- }
- } else {
- // No: bind in a different context
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // How should we propagate the bind
- switch (bt.value()) {
- case BindingType._nobject:
- {
- // Bind as object
- if (rebind)
- context.rebind(tail,obj);
- else
- context.bind(tail,obj);
- }
- break;
- case BindingType._ncontext:
- {
- // Narrow to a naming context using Java casts. It must work.
- NamingContext objContext = (NamingContext)obj;
- // Bind as context
- if (rebind)
- context.rebind_context(tail,objContext);
- else
- context.bind_context(tail,objContext);
- }
- break;
- default:
- // This should not happen
- throw updateWrapper.namingCtxBadBindingtype() ;
- }
- }
- }
-
-
- /**
- * Implements resolving names in this NamingContext. The first component
- * of the supplied name is resolved in this NamingContext by calling
- * Resolve(). If there are no more components in the name, the
- * resulting object reference is returned. Otherwise, the resulting object
- * reference must have been bound as a context and be narrowable to
- * a NamingContext. If this is the case, the remaining
- * components of the name is resolved in the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object obj = null;
- BindingTypeHolder bth = new BindingTypeHolder();
-
- // Length must be greater than 0
- if (n.length < 1)
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // The identifier must be set
- if (n.length == 1) {
- synchronized (impl) {
- // Resolve first level in this context
- obj = impl.Resolve(n[0],bth);
- }
- if (obj == null) {
- // Object was not found
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
- }
- return obj;
- } else {
- // n.length > 1
- if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute restOfName = name[1..length]
- NameComponent[] tail = new NameComponent[n.length -1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Resolve rest of name in context
- return context.resolve(tail);
- }
- }
-
- /**
- * Implements unbinding bound names in this NamingContext. If the
- * name contains only one component, the name is unbound in this
- * NamingContext using Unbind(). Otherwise, the first component
- * of the name is resolved in this NamingContext and
- * unbind passed to the resulting NamingContext.
- * This method is static for maximal reuse - even for extended naming
- * context implementations where the recursive semantics still apply.
- * @param impl an implementation of NamingContextDataStore
- * @param n a sequence of NameComponents which is the name to be unbound.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
- * components was supplied, but the first component could not be
- * resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the n-1 components of the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- public static void doUnbind(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if (n.length < 1)
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- // Unbind here?
- if (n.length == 1) {
- // The identifier must be set
- if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) )
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
-
- org.omg.CORBA.Object objRef = null;
- synchronized (impl) {
- // Yes: unbind in this context
- objRef = impl.Unbind(n[0]);
- }
-
- if (objRef == null)
- // It was not bound
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
- // Done
- return;
- } else {
- // No: unbind in a different context
-
- // Resolve first - must be resolveable
- NamingContext context = resolveFirstAsContext(impl,n);
-
- // Compute tail
- NameComponent[] tail = new NameComponent[n.length - 1];
- System.arraycopy(n,1,tail,0,n.length-1);
-
- // Propagate unbind to this context
- context.unbind(tail);
- }
- }
-
- /**
- * Implements resolving a NameComponent in this context and
- * narrowing it to CosNaming::NamingContext. It will throw appropriate
- * exceptions if not found or not narrowable.
- * @param impl an implementation of NamingContextDataStore
- * @param n a NameComponents which is the name to be found.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound The
- * first component could not be resolved.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the first component of the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see resolve
- */
- protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
- NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound {
- org.omg.CORBA.Object topRef = null;
- BindingTypeHolder bth = new BindingTypeHolder();
- NamingContext context = null;
-
- synchronized (impl) {
- // Resolve first - must be resolveable
- topRef = impl.Resolve(n[0],bth);
- if (topRef == null) {
- // It was not bound
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
- }
- }
-
- // Was it bound as a context?
- if (bth.value != BindingType.ncontext) {
- // It was not a context
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
- }
-
- // Narrow to a naming context
- try {
- context = NamingContextHelper.narrow(topRef);
- } catch (org.omg.CORBA.BAD_PARAM ex) {
- // It was not a context
- throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
- }
-
- // Hmm. must be ok
- return context;
- }
-
- public static String nameToString(NameComponent[] name)
- {
- StringBuffer s = new StringBuffer("{");
- if (name != null || name.length > 0) {
- for (int i=0;i0)
- s.append(",");
- s.append("[").
- append(name[i].id).
- append(",").
- append(name[i].kind).
- append("]");
- }
- }
- s.append("}");
- return s.toString();
- }
-
- // Debugging aids.
- private static boolean debug ;
-
- private static void dprint(String msg) {
- NamingUtils.dprint("NamingContextImpl(" +
- Thread.currentThread().getName() + " at " +
- System.currentTimeMillis() +
- " ems): " + msg);
- }
-
-
- /**
- * Implements all flavors of binding( bind and bindcontext)
- * This method will be called from the superclass's doBind( ) method
- * which takes care of all the conditions before calling this method.
- * i.e., It checks whether the Name is already Bounded, Then in the
- * case of rebind it calls Unbind first.
- * This method does one level binding only, To have n-level binding
- * with compound names, doBind( ) calls this method recursively.
- * @param n a sequence of NameComponents which is the name under which
- * the object will be bound.
- * @param obj the object reference to be bound.
- * @param bt Type of binding (as object or as context).
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound raised
- * if the NameComoponent list is invalid
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Could not proceed in resolving the Name from the given NameComponent
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
- * is already bound under the supplied name.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
- * system exceptions
- * @see Resolve
- * @see Unbind
- */
- public void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt)
- {
- if( obj == null ) {
- // Raise a Valid Exception and Return
- return;
- }
-
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value;
-
- try {
- if( bt.value() == BindingType._nobject ) {
- // If the BindingType is an ObjectRef then Stringify this ref and
- // Store it in InternalBindingValue instance. This is required
- // because the Object References has to be stored in file
- value = new InternalBindingValue(bt, orb.object_to_string(obj) );
- value.setObjectRef( obj );
- } else {
- // If the BindingType is a NamingContext then get it's object key
- // from the NameService and store it in the Internal Binding Value instance
- String theNCKey = theNameServiceHandle.getObjectKey( obj );
- value = new InternalBindingValue( bt, theNCKey );
- value.setObjectRef( obj );
- }
-
- InternalBindingValue oldValue =
- (InternalBindingValue)this.theHashtable.put(key,value);
-
- if( oldValue != null) {
- // There was an entry with this name in the Hashtable and hence throw CTX_ALREADY_BOUND
- // exception
- throw updateWrapper.namingCtxRebindAlreadyBound() ;
- } else {
- try {
- // Everything went smooth so update the NamingContext file with the
- // latest Hashtable image
- theServantManagerImplHandle.updateContext( objKey, this );
- } catch( Exception e ) {
- // Something went wrong while updating the context
- // so speak the error
- throw updateWrapper.bindUpdateContextFailed( e ) ;
- }
- }
- } catch( Exception e ) {
- // Something went wrong while Binding the Object Reference
- // Speak the error again.
- throw updateWrapper.bindFailure( e ) ;
- }
- }
-
- /**
- * This method resolves the NamingContext or Object Reference for one level
- * The doResolve( ) method calls Resolve( ) recursively to resolve n level
- * Names.
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @param bth Type of binding (as object or as context).
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
- * or a Corba Object reference not found under this Name
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see Bind
- */
- public Object Resolve(NameComponent n, BindingTypeHolder bth)
- throws SystemException
- {
- if( ( n.id.length() == 0 ) &&( n.kind.length() == 0 ) ) {
- // If the NameComponent list has no entry then it means the current
- // context was requested
- bth.value = BindingType.ncontext;
- return theNameServiceHandle.getObjectReferenceFromKey(
- this.objKey );
- }
-
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value =
- (InternalBindingValue) this.theHashtable.get(key);
-
- if( value == null ) {
- // No entry was found for the given name and hence return NULL
- // NamingContextDataStore throws appropriate exception if
- // required.
- return null;
- }
-
- Object theObjectFromStringifiedReference = null;
- bth.value = value.theBindingType;
-
- try {
- // Check whether the entry found in the Hashtable starts with NC
- // Which means it's a name context. So get the NamingContext reference
- // from ServantManager, which would either return from the cache or
- // read it from the File.
- if( value.strObjectRef.startsWith( "NC" ) ) {
- bth.value = BindingType.ncontext;
- return theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
- } else {
- // Else, It is a Object Reference. Check whether Object Reference
- // can be obtained directly, If not then convert the stringified
- // reference to object and return.
- theObjectFromStringifiedReference = value.getObjectRef( );
-
- if (theObjectFromStringifiedReference == null ) {
- try {
- theObjectFromStringifiedReference =
- orb.string_to_object( value.strObjectRef );
- value.setObjectRef( theObjectFromStringifiedReference );
- } catch( Exception e ) {
- throw readWrapper.resolveConversionFailure(
- CompletionStatus.COMPLETED_MAYBE, e );
- }
- }
- }
- } catch ( Exception e ) {
- throw readWrapper.resolveFailure(
- CompletionStatus.COMPLETED_MAYBE, e );
- }
-
- return theObjectFromStringifiedReference;
- }
-
- /**
- * This method Unbinds the NamingContext or Object Reference for one level
- * The doUnbind( ) method from superclass calls Unbind() to recursively
- * Unbind using compound Names.
- * @param n a sequence of NameComponents which is the name to be resolved.
- * @return the object reference bound under the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
- * or a Corba Object reference not found under this Name
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
- * in resolving the the supplied name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
- * is invalid (i.e., has length less than 1).
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- * @see Bind
- */
-
- public Object Unbind(NameComponent n) throws SystemException
- {
- try {
- InternalBindingKey key = new InternalBindingKey(n);
- InternalBindingValue value = null;
-
- try {
- value = (InternalBindingValue) this.theHashtable.remove(key);
- } catch( Exception e ) {
- // Ignore the exception in Hashtable.remove
- }
-
- theServantManagerImplHandle.updateContext( objKey, this );
-
- if( value == null ) {
- return null;
- }
-
- if( value.strObjectRef.startsWith( "NC" ) ) {
- theServantManagerImplHandle.readInContext( value.strObjectRef );
- Object theObjectFromStringfiedReference =
- theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
- return theObjectFromStringfiedReference;
- } else {
- Object theObjectFromStringifiedReference = value.getObjectRef( );
-
- if( theObjectFromStringifiedReference == null ) {
- theObjectFromStringifiedReference =
- orb.string_to_object( value.strObjectRef );
- }
-
- return theObjectFromStringifiedReference;
- }
- } catch( Exception e ) {
- throw updateWrapper.unbindFailure( CompletionStatus.COMPLETED_MAYBE, e );
- }
- }
-
- /**
- * List the contents of this NamingContext. It creates a new
- * PersistentBindingIterator object and passes it a clone of the
- * hash table and an orb object. It then uses the
- * newly created object to return the required number of bindings.
- * @param how_many The number of requested bindings in the BindingList.
- * @param bl The BindingList as an out parameter.
- * @param bi The BindingIterator as an out parameter.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
-
- public void List(int how_many, BindingListHolder bl,
- BindingIteratorHolder bi) throws SystemException
- {
- if( biPOA == null ) {
- createbiPOA( );
- }
- try {
- PersistentBindingIterator bindingIterator =
- new PersistentBindingIterator(this.orb,
- (Hashtable)this.theHashtable.clone(), biPOA);
- // Have it set the binding list
- bindingIterator.list(how_many,bl);
-
- byte[] objectId = biPOA.activate_object( bindingIterator );
- org.omg.CORBA.Object obj = biPOA.id_to_reference( objectId );
-
- // Get the object reference for the binding iterator servant
- org.omg.CosNaming.BindingIterator bindingRef =
- org.omg.CosNaming.BindingIteratorHelper.narrow( obj );
-
- bi.value = bindingRef;
- } catch (org.omg.CORBA.SystemException e) {
- throw e;
- } catch( Exception e ) {
- throw readWrapper.transNcListGotExc( e ) ;
- }
- }
-
- private synchronized void createbiPOA( ) {
- if( biPOA != null ) {
- return;
- }
- try {
- POA rootPOA = (POA) orb.resolve_initial_references(
- ORBConstants.ROOT_POA_NAME );
- rootPOA.the_POAManager().activate( );
-
- int i = 0;
- Policy[] poaPolicy = new Policy[3];
- poaPolicy[i++] = rootPOA.create_lifespan_policy(
- LifespanPolicyValue.TRANSIENT);
- poaPolicy[i++] = rootPOA.create_id_assignment_policy(
- IdAssignmentPolicyValue.SYSTEM_ID);
- poaPolicy[i++] = rootPOA.create_servant_retention_policy(
- ServantRetentionPolicyValue.RETAIN);
- biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
- biPOA.the_POAManager().activate( );
- } catch( Exception e ) {
- throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
- }
- }
-
-
- /**
- * Create a NamingContext object and return its object reference.
- * @return an object reference for a new NamingContext object implemented
- * by this Name Server.
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- public NamingContext NewContext() throws SystemException
- {
- try {
- return theNameServiceHandle.NewContext( );
- } catch( org.omg.CORBA.SystemException e ) {
- throw e;
- } catch( Exception e ) {
- throw updateWrapper.transNcNewctxGotExc( e ) ;
- }
- }
-
-
- /**
- * Destroys the NamingContext.
- */
- public void Destroy() throws SystemException
- {
- // XXX note that orb.disconnect is illegal here, since the
- // POA is used. However, there may be some associated state
- // that needs to be cleaned up in ServerManagerImpl which we will
- // look into further at another time.
- /*
- // XXX This needs to be replaced by cleaning up the
- // file that backs up the naming context. No explicit
- // action is necessary at the POA level, since this is
- // created with the non-retain policy.
- /*
- try { orb.disconnect(
- theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) );
- } catch( org.omg.CORBA.SystemException e ) {
- throw e;
- } catch( Exception e ) {
- throw updateWrapper.transNcDestroyGotEx( e ) ;
- }
- */
- }
-
- /**
- * This operation creates a stringified name from the array of Name
- * components.
- * @param n Name of the object
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- */
- public String to_string(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (n == null ) || (n.length == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
-
- String theStringifiedName = getINSImpl().convertToString( n );
-
- if( theStringifiedName == null )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
-
- return theStringifiedName;
- }
-
- /**
- * This operation converts a Stringified Name into an equivalent array
- * of Name Components.
- * @param sn Stringified Name of the object
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- */
- public org.omg.CosNaming.NameComponent[] to_name(String sn)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- org.omg.CosNaming.NameComponent[] theNameComponents =
- getINSImpl().convertToNameComponent( sn );
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- for( int i = 0; i < theNameComponents.length; i++ ) {
- // If there is a name component whose id and kind null or
- // zero length string, then an invalid name exception needs to be
- // raised.
- if ( ( ( theNameComponents[i].id == null )
- ||( theNameComponents[i].id.length() == 0 ) )
- &&( ( theNameComponents[i].kind == null )
- ||( theNameComponents[i].kind.length() == 0 ) ) ) {
- throw new InvalidName();
- }
- }
- return theNameComponents;
- }
-
- /**
- * This operation creates a URL based "iiopname://" format name
- * from the Stringified Name of the object.
- * @param addr internet based address of the host machine where
- * Name Service is running
- * @param sn Stringified Name of the object
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
- * Indicates the internet based address of the host machine is
- * incorrect
- */
-
- public String to_url(String addr, String sn)
- throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- if( addr == null )
- {
- throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- String urlBasedAddress = null;
- try {
- urlBasedAddress = getINSImpl().createURLBasedAddress( addr, sn );
- } catch (Exception e ) {
- urlBasedAddress = null;
- }
- // Extra check to see that corba name url created is valid as per
- // INS spec grammer.
- try {
- INSURLHandler.getINSURLHandler().parseURL( urlBasedAddress );
- } catch( BAD_PARAM e ) {
- throw new
- org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
- }
- return urlBasedAddress;
- }
-
- /**
- * This operation resolves the Stringified name into the object
- * reference.
- * @param sn Stringified Name of the object
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * Indicates there is no object reference for the given name.
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * Indicates that the given compound name is incorrect
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
- * Indicates the name does not identify a binding.
- */
- public org.omg.CORBA.Object resolve_str(String sn)
- throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName
- {
- org.omg.CORBA.Object theObject = null;
- // Name valid?
- if ( (sn == null ) || (sn.length() == 0) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- org.omg.CosNaming.NameComponent[] theNameComponents =
- getINSImpl().convertToNameComponent( sn );
- if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
- {
- throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
- }
- theObject = resolve( theNameComponents );
- return theObject;
- }
-
- /**
- * This is a Debugging Method
- */
- public boolean IsEmpty()
- {
- return this.theHashtable.isEmpty();
- }
-
- /**
- * This is a Debugging Method
- */
- public void printSize( )
- {
- System.out.println( "Hashtable Size = " + theHashtable.size( ) );
- java.util.Enumeration e = theHashtable.keys( );
- for( ; e.hasMoreElements(); )
- {
- InternalBindingValue thevalue =
- (InternalBindingValue) this.theHashtable.get(e.nextElement());
- if( thevalue != null )
- {
- System.out.println( "value = " + thevalue.strObjectRef);
- }
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java 2018-01-30 20:18:30.000000000 -0500
+++ /dev/null 2018-01-30 20:18:30.000000000 -0500
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-// Import general CORBA classes
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.INTERNAL;
-
-// Get org.omg.CosNaming Types
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.PortableServer.POA;
-
-// Get base implementation
-import com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl;
-import com.sun.corba.se.impl.naming.pcosnaming.InternalBindingValue;
-
-import com.sun.corba.se.impl.naming.cosnaming.BindingIteratorImpl;
-
-// Get a hash table
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-/**
- * Class TransientBindingIterator implements the abstract methods
- * defined by BindingIteratorImpl, to use with the TransientNamingContext
- * implementation of the NamingContextImpl. The TransientBindingIterator
- * implementation receives a hash table of InternalBindingValues, and uses
- * an Enumeration to iterate over the contents of the hash table.
- * @see BindingIteratorImpl
- * @see TransientNamingContext
- */
-public class PersistentBindingIterator extends BindingIteratorImpl
-{
- private POA biPOA;
- /**
- * Constructs a new PersistentBindingIterator object.
- * @param orb a org.omg.CORBA.ORB object.
- * @param aTable A hashtable containing InternalBindingValues which is
- * the content of the PersistentNamingContext.
- * @exception Exception a Java exception thrown of the base class cannot
- * initialize.
- */
- public PersistentBindingIterator(org.omg.CORBA.ORB orb, Hashtable aTable,
- POA thePOA ) throws java.lang.Exception
- {
- super(orb);
- this.orb = orb;
- theHashtable = aTable;
- theEnumeration = this.theHashtable.keys();
- currentSize = this.theHashtable.size();
- biPOA = thePOA;
- }
-
- /**
- * Returns the next binding in the NamingContext. Uses the enumeration
- * object to determine if there are more bindings and if so, returns
- * the next binding from the InternalBindingValue.
- * @param b The Binding as an out parameter.
- * @return true if there were more bindings.
- */
- final public boolean NextOne(org.omg.CosNaming.BindingHolder b)
- {
- // If there are more elements get the next element
- boolean hasMore = theEnumeration.hasMoreElements();
- if (hasMore) {
- InternalBindingKey theBindingKey =
- ((InternalBindingKey)theEnumeration.nextElement());
- InternalBindingValue theElement =
- (InternalBindingValue)theHashtable.get( theBindingKey );
- NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
- NameComponent[] nlist = new NameComponent[1];
- nlist[0] = n;
- BindingType theType = theElement.theBindingType;
-
- b.value =
- new Binding( nlist, theType );
- } else {
- // Return empty but marshalable binding
- b.value = new Binding(new NameComponent[0],BindingType.nobject);
- }
- return hasMore;
- }
-
- /**
- * Destroys this BindingIterator by disconnecting from the ORB
- * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
- */
- final public void Destroy()
- {
- // Remove the object from the Active Object Map.
- try {
- byte[] objectId = biPOA.servant_to_id( this );
- if( objectId != null ) {
- biPOA.deactivate_object( objectId );
- }
- }
- catch( Exception e ) {
- throw new INTERNAL( "Exception in BindingIterator.Destroy " + e );
- }
- }
-
- /**
- * Returns the remaining number of elements in the iterator.
- * @return the remaining number of elements in the iterator.
- */
- public final int RemainingElements() {
- return currentSize;
- }
-
- private int currentSize;
- private Hashtable theHashtable;
- private Enumeration theEnumeration;
- private org.omg.CORBA.ORB orb;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java 2018-01-30 20:18:30.000000000 -0500
+++ /dev/null 2018-01-30 20:18:30.000000000 -0500
@@ -1,261 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.naming.pcosnaming;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Hashtable;
-
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.LocalObject;
-
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-import org.omg.PortableServer.ForwardRequest;
-import org.omg.PortableServer.ServantLocator;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.RequestProcessingPolicyValue;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
-
-import com.sun.corba.se.spi.orb.ORB;
-
-/**
- * @author Rohit Garg
- * @since JDK1.2
- */
-
-public class ServantManagerImpl extends org.omg.CORBA.LocalObject implements ServantLocator
-{
-
- // computed using serialver tool
-
- private static final long serialVersionUID = 4028710359865748280L;
- private ORB orb;
-
- private NameService theNameService;
-
- private File logDir;
-
- private Hashtable contexts;
-
- private CounterDB counterDb;
-
- private int counter;
-
- private final static String objKeyPrefix = "NC";
-
- ServantManagerImpl(ORB orb, File logDir, NameService aNameService)
- {
- this.logDir = logDir;
- this.orb = orb;
- // initialize the counter database
- counterDb = new CounterDB(logDir);
- contexts = new Hashtable();
- theNameService = aNameService;
- }
-
-
- public Servant preinvoke(byte[] oid, POA adapter, String operation,
- CookieHolder cookie) throws ForwardRequest
- {
-
- String objKey = new String(oid);
-
- Servant servant = (Servant) contexts.get(objKey);
-
- if (servant == null)
- {
- servant = readInContext(objKey);
- }
-
- return servant;
- }
-
- public void postinvoke(byte[] oid, POA adapter, String operation,
- java.lang.Object cookie, Servant servant)
- {
- // nada
- }
-
- public NamingContextImpl readInContext(String objKey)
- {
- NamingContextImpl context = (NamingContextImpl) contexts.get(objKey);
- if( context != null )
- {
- // Returning Context from Cache
- return context;
- }
-
- File contextFile = new File(logDir, objKey);
- if (contextFile.exists()) {
- try {
- FileInputStream fis = new FileInputStream(contextFile);
- ObjectInputStream ois = new ObjectInputStream(fis);
- context = (NamingContextImpl) ois.readObject();
- context.setORB( orb );
- context.setServantManagerImpl( this );
- context.setRootNameService( theNameService );
- ois.close();
- } catch (Exception ex) {
- }
- }
-
- if (context != null)
- {
- contexts.put(objKey, context);
- }
- return context;
- }
-
- public NamingContextImpl addContext(String objKey,
- NamingContextImpl context)
- {
- File contextFile = new File(logDir, objKey);
-
- if (contextFile.exists())
- {
- context = readInContext(objKey);
- }
- else {
- try {
- FileOutputStream fos = new FileOutputStream(contextFile);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(context);
- oos.close();
- } catch (Exception ex) {
- }
- }
- try
- {
- contexts.remove( objKey );
- }
- catch( Exception e)
- {
- }
- contexts.put(objKey, context);
-
- return context;
- }
-
- public void updateContext( String objKey,
- NamingContextImpl context )
- {
- File contextFile = new File(logDir, objKey);
- if (contextFile.exists())
- {
- contextFile.delete( );
- contextFile = new File(logDir, objKey);
- }
-
- try {
- FileOutputStream fos = new FileOutputStream(contextFile);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(context);
- oos.close();
- } catch (Exception ex) {
- ex.printStackTrace( );
- }
- }
-
- public static String getRootObjectKey()
- {
- return objKeyPrefix + CounterDB.rootCounter;
- }
-
- public String getNewObjectKey()
- {
- return objKeyPrefix + counterDb.getNextCounter();
- }
-
-
-
-}
-
-class CounterDB implements Serializable
-{
-
- CounterDB (File logDir)
- {
- counterFileName = "counter";
- counterFile = new File(logDir, counterFileName);
- if (!counterFile.exists()) {
- counter = new Integer(rootCounter);
- writeCounter();
- } else {
- readCounter();
- }
- }
-
- private void readCounter()
- {
- try {
- FileInputStream fis = new FileInputStream(counterFile);
- ObjectInputStream ois = new ObjectInputStream(fis);
- counter = (Integer) ois.readObject();
- ois.close();
- } catch (Exception ex) {
- }
- }
-
- private void writeCounter()
- {
- try {
- counterFile.delete();
- FileOutputStream fos = new FileOutputStream(counterFile);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(counter);
- oos.flush();
- oos.close();
-
- } catch (Exception ex) {
- }
- }
-
- public synchronized int getNextCounter()
- {
- int counterVal = counter.intValue();
- counter = new Integer(++counterVal);
- writeCounter();
-
- return counterVal;
- }
-
-
-
- private Integer counter;
-
- private static String counterFileName = "counter";
-
- private transient File counterFile;
-
- public final static int rootCounter = 0;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java 2018-01-30 20:18:31.000000000 -0500
+++ /dev/null 2018-01-30 20:18:31.000000000 -0500
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa ;
-
-import org.omg.CORBA.SystemException ;
-
-import com.sun.corba.se.spi.oa.NullServant ;
-
-public class NullServantImpl implements NullServant
-{
- private SystemException sysex ;
-
- public NullServantImpl( SystemException ex )
- {
- this.sysex = ex ;
- }
-
- public SystemException getException()
- {
- return sysex ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java 2018-01-30 20:18:32.000000000 -0500
+++ /dev/null 2018-01-30 20:18:32.000000000 -0500
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.CORBA.INTERNAL ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.orbutil.fsm.Action ;
-import com.sun.corba.se.spi.orbutil.fsm.ActionBase ;
-import com.sun.corba.se.spi.orbutil.fsm.Guard ;
-import com.sun.corba.se.spi.orbutil.fsm.GuardBase ;
-import com.sun.corba.se.spi.orbutil.fsm.State ;
-import com.sun.corba.se.spi.orbutil.fsm.StateImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.Input ;
-import com.sun.corba.se.spi.orbutil.fsm.InputImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.FSM ;
-import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
-import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.Mutex ;
-import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
-
-import org.omg.CORBA.SystemException ;
-
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-
-/** AOMEntry represents a Servant or potential Servant in the ActiveObjectMap.
-* It may be in several states to allow for long incarnate or etherealize operations.
-* The methods on this class mostly represent input symbols to the state machine
-* that controls the lifecycle of the entry. A library is used to build the state
-* machine rather than the more usual state pattern so that the state machine
-* transitions are explicitly visible.
-*/
-public class AOMEntry extends FSMImpl {
- private final Thread[] etherealizer ; // The actual etherealize operation
- // for this entry. It is
- // represented as a Thread because
- // the POA.deactivate_object never
- // waits for the completion.
- private final int[] counter ; // single element holder for counter
- // accessed in actions
- private final CondVar wait ; // accessed in actions
-
- final POAImpl poa ;
-
- public static final State INVALID = new StateImpl( "Invalid" ) ;
- public static final State INCARN = new StateImpl( "Incarnating" ) {
- public void postAction( FSM fsm ) {
- AOMEntry entry = (AOMEntry)fsm ;
- entry.wait.broadcast() ;
- }
- };
- public static final State VALID = new StateImpl( "Valid" ) ;
- public static final State ETHP = new StateImpl( "EtherealizePending" ) ;
- public static final State ETH = new StateImpl( "Etherealizing" ) {
- public void preAction( FSM fsm ) {
- AOMEntry entry = (AOMEntry)fsm ;
- Thread etherealizer = entry.etherealizer[0] ;
- if (etherealizer != null)
- etherealizer.start() ;
- }
-
- public void postAction( FSM fsm ) {
- AOMEntry entry = (AOMEntry)fsm ;
- entry.wait.broadcast() ;
- }
- };
- public static final State DESTROYED = new StateImpl( "Destroyed" ) ;
-
- static final Input START_ETH = new InputImpl( "startEtherealize" ) ;
- static final Input ETH_DONE = new InputImpl( "etherealizeDone" ) ;
- static final Input INC_DONE = new InputImpl( "incarnateDone" ) ;
- static final Input INC_FAIL = new InputImpl( "incarnateFailure" ) ;
- static final Input ACTIVATE = new InputImpl( "activateObject" ) ;
- static final Input ENTER = new InputImpl( "enter" ) ;
- static final Input EXIT = new InputImpl( "exit" ) ;
-
- private static Action incrementAction = new ActionBase( "increment" ) {
- public void doIt( FSM fsm, Input in ) {
- AOMEntry entry = (AOMEntry)fsm ;
- entry.counter[0]++ ;
- }
- } ;
-
- private static Action decrementAction = new ActionBase( "decrement" ) {
- public void doIt( FSM fsm, Input in ) {
- AOMEntry entry = (AOMEntry)fsm ;
- if (entry.counter[0] > 0)
- entry.counter[0]-- ;
- else
- throw entry.poa.lifecycleWrapper().aomEntryDecZero() ;
- }
- } ;
-
- private static Action throwIllegalStateExceptionAction = new ActionBase(
- "throwIllegalStateException" ) {
- public void doIt( FSM fsm, Input in ) {
- throw new IllegalStateException(
- "No transitions allowed from the DESTROYED state" ) ;
- }
- } ;
-
- private static Action oaaAction = new ActionBase( "throwObjectAlreadyActive" ) {
- public void doIt( FSM fsm, Input in ) {
- throw new RuntimeException( new ObjectAlreadyActive() ) ;
- }
- } ;
-
- private static Guard waitGuard = new GuardBase( "wait" ) {
- public Guard.Result evaluate( FSM fsm, Input in ) {
- AOMEntry entry = (AOMEntry)fsm ;
- try {
- entry.wait.await() ;
- } catch (InterruptedException exc) {
- // XXX Log this
- // NO-OP
- }
-
- return Guard.Result.DEFERED ;
- }
- } ;
-
-
- private static class CounterGuard extends GuardBase {
- private int value ;
-
- public CounterGuard( int value )
- {
- super( "counter>" + value ) ;
- this.value = value ;
- }
-
- public Guard.Result evaluate( FSM fsm, Input in )
- {
- AOMEntry entry = (AOMEntry)fsm ;
- return Guard.Result.convert( entry.counter[0] > value ) ;
- }
- } ;
-
- private static GuardBase greaterZeroGuard = new CounterGuard( 0 ) ;
- private static Guard zeroGuard = new Guard.Complement( greaterZeroGuard ) ;
- private static GuardBase greaterOneGuard = new CounterGuard( 1 ) ;
- private static Guard oneGuard = new Guard.Complement( greaterOneGuard ) ;
-
- private static StateEngine engine ;
-
- static {
- engine = StateEngineFactory.create() ;
-
- // State, Input, Guard, Action, new State
-
- engine.add( INVALID, ENTER, incrementAction, INCARN ) ;
- engine.add( INVALID, ACTIVATE, null, VALID ) ;
- engine.setDefault( INVALID ) ;
-
- engine.add( INCARN, ENTER, waitGuard, null, INCARN ) ;
- engine.add( INCARN, EXIT, null, INCARN ) ;
- engine.add( INCARN, START_ETH, waitGuard, null, INCARN ) ;
- engine.add( INCARN, INC_DONE, null, VALID ) ;
- engine.add( INCARN, INC_FAIL, decrementAction, INVALID ) ;
- engine.add( INCARN, ACTIVATE, oaaAction, INCARN ) ;
-
- engine.add( VALID, ENTER, incrementAction, VALID ) ;
- engine.add( VALID, EXIT, decrementAction, VALID ) ;
- engine.add( VALID, START_ETH, greaterZeroGuard, null, ETHP ) ;
- engine.add( VALID, START_ETH, zeroGuard, null, ETH ) ;
- engine.add( VALID, ACTIVATE, oaaAction, VALID ) ;
-
- engine.add( ETHP, ENTER, waitGuard, null, ETHP ) ;
- engine.add( ETHP, START_ETH, null, ETHP ) ;
- engine.add( ETHP, EXIT, greaterOneGuard, decrementAction, ETHP ) ;
- engine.add( ETHP, EXIT, oneGuard, decrementAction, ETH ) ;
- engine.add( ETHP, ACTIVATE, oaaAction, ETHP ) ;
-
- engine.add( ETH, START_ETH, null, ETH ) ;
- engine.add( ETH, ETH_DONE, null, DESTROYED ) ;
- engine.add( ETH, ACTIVATE, oaaAction, ETH ) ;
- engine.add( ETH, ENTER, waitGuard, null, ETH ) ;
-
- engine.setDefault( DESTROYED, throwIllegalStateExceptionAction, DESTROYED ) ;
-
- engine.done() ;
- }
-
- public AOMEntry( POAImpl poa )
- {
- super( engine, INVALID, ((ORB)poa.getORB()).poaFSMDebugFlag ) ;
- this.poa = poa ;
- etherealizer = new Thread[1] ;
- etherealizer[0] = null ;
- counter = new int[1] ;
- counter[0] = 0 ;
- wait = new CondVar( poa.poaMutex,
- ((ORB)poa.getORB()).poaConcurrencyDebugFlag ) ;
- }
-
- // Methods that drive the FSM: the real interface to this class
- // Most just call the doIt method, but startEtherealize needs
- // the etherealizer.
- public void startEtherealize( Thread etherealizer )
- {
- this.etherealizer[0] = etherealizer ;
- doIt( START_ETH ) ;
- }
-
- public void etherealizeComplete() { doIt( ETH_DONE ) ; }
- public void incarnateComplete() { doIt( INC_DONE ) ; }
- public void incarnateFailure() { doIt( INC_FAIL ) ; }
- public void activateObject() throws ObjectAlreadyActive {
- try {
- doIt( ACTIVATE ) ;
- } catch (RuntimeException exc) {
- Throwable thr = exc.getCause() ;
- if (thr instanceof ObjectAlreadyActive)
- throw (ObjectAlreadyActive)thr ;
- else
- throw exc ;
- }
- }
- public void enter() { doIt( ENTER ) ; }
- public void exit() { doIt( EXIT ) ; }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java 2018-01-30 20:18:32.000000000 -0500
+++ /dev/null 2018-01-30 20:18:32.000000000 -0500
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.Set ;
-import java.util.HashSet ;
-import java.util.Map ;
-import java.util.HashMap ;
-import java.util.Iterator ;
-import java.util.Vector ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.CORBA.INTERNAL ;
-
-/** The ActiveObjectMap maintains associations between servants and
- * their keys. There are two variants, to support whether or not
- * multiple IDs per servant are allowed. This class suppots bidirectional
- * traversal of the key-servant association. Access to an instance of this
- * class is serialized by the POA mutex.
- */
-public abstract class ActiveObjectMap
-{
- public static class Key {
- public byte[] id;
-
- Key(byte[] id) {
- this.id = id;
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- for(int i = 0; i < id.length; i++) {
- buffer.append(Integer.toString((int) id[i], 16));
- if (i != id.length-1)
- buffer.append(":");
- }
- return buffer.toString();
- }
-
- public boolean equals(java.lang.Object key) {
- if (!(key instanceof Key))
- return false;
- Key k = (Key) key;
- if (k.id.length != this.id.length)
- return false;
- for(int i = 0; i < this.id.length; i++)
- if (this.id[i] != k.id[i])
- return false;
- return true;
- }
-
- // Use the same hash function as for String
- public int hashCode() {
- int h = 0;
- for (int i = 0; i < id.length; i++)
- h = 31*h + id[i];
- return h;
- }
- }
-
- protected POAImpl poa ;
-
- protected ActiveObjectMap( POAImpl poa )
- {
- this.poa = poa ;
- }
-
- public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed )
- {
- if (multipleIDsAllowed)
- return new MultipleObjectMap( poa ) ;
- else
- return new SingleObjectMap(poa ) ;
- }
-
- private Map keyToEntry = new HashMap() ; // Map< Key, AOMEntry >
- private Map entryToServant = new HashMap() ; // Map< AOMEntry, Servant >
- private Map servantToEntry = new HashMap() ; // Map< Servant, AOMEntry >
-
- public final boolean contains(Servant value)
- {
- return servantToEntry.containsKey( value ) ;
- }
-
- public final boolean containsKey(Key key)
- {
- return keyToEntry.containsKey(key);
- }
-
- /** get Returbs the entry assigned to the key, or creates a new
- * entry in state INVALID if none is present.
- */
- public final AOMEntry get(Key key)
- {
- AOMEntry result = (AOMEntry)keyToEntry.get(key);
- if (result == null) {
- result = new AOMEntry( poa ) ;
- putEntry( key, result ) ;
- }
-
- return result ;
- }
-
- public final Servant getServant( AOMEntry entry )
- {
- return (Servant)entryToServant.get( entry ) ;
- }
-
- public abstract Key getKey(AOMEntry value) throws WrongPolicy ;
-
- public Key getKey(Servant value) throws WrongPolicy
- {
- AOMEntry entry = (AOMEntry)servantToEntry.get( value ) ;
- return getKey( entry ) ;
- }
-
- protected void putEntry( Key key, AOMEntry value )
- {
- keyToEntry.put( key, value ) ;
- }
-
- public final void putServant( Servant servant, AOMEntry value )
- {
- entryToServant.put( value, servant ) ;
- servantToEntry.put( servant, value ) ;
- }
-
- protected abstract void removeEntry( AOMEntry entry, Key key ) ;
-
- public final void remove( Key key )
- {
- AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ;
- Servant servant = (Servant)entryToServant.remove( entry ) ;
- if (servant != null)
- servantToEntry.remove( servant ) ;
-
- removeEntry( entry, key ) ;
- }
-
- public abstract boolean hasMultipleIDs(AOMEntry value) ;
-
- protected void clear()
- {
- keyToEntry.clear();
- }
-
- public final Set keySet()
- {
- return keyToEntry.keySet() ;
- }
-}
-
-class SingleObjectMap extends ActiveObjectMap
-{
- private Map entryToKey = new HashMap() ; // Map< AOMEntry, Key >
-
- public SingleObjectMap( POAImpl poa )
- {
- super( poa ) ;
- }
-
- public Key getKey(AOMEntry value) throws WrongPolicy
- {
- return (Key)entryToKey.get( value ) ;
- }
-
- protected void putEntry(Key key, AOMEntry value)
- {
- super.putEntry( key, value);
-
- entryToKey.put( value, key ) ;
- }
-
- public boolean hasMultipleIDs(AOMEntry value)
- {
- return false;
- }
-
- // This case does not need the key.
- protected void removeEntry(AOMEntry entry, Key key)
- {
- entryToKey.remove( entry ) ;
- }
-
- public void clear()
- {
- super.clear() ;
- entryToKey.clear() ;
- }
-}
-
-class MultipleObjectMap extends ActiveObjectMap
-{
- private Map entryToKeys = new HashMap() ; // Map< AOMEntry, Set< Key > >
-
- public MultipleObjectMap( POAImpl poa )
- {
- super( poa ) ;
- }
-
- public Key getKey(AOMEntry value) throws WrongPolicy
- {
- throw new WrongPolicy() ;
- }
-
- protected void putEntry(Key key, AOMEntry value)
- {
- super.putEntry( key, value);
-
- Set set = (Set)entryToKeys.get( value ) ;
- if (set == null) {
- set = new HashSet() ;
- entryToKeys.put( value, set ) ;
- }
- set.add( key ) ;
- }
-
- public boolean hasMultipleIDs(AOMEntry value)
- {
- Set set = (Set)entryToKeys.get( value ) ;
- if (set == null)
- return false ;
- return set.size() > 1 ;
- }
-
- protected void removeEntry(AOMEntry entry, Key key)
- {
- Set keys = (Set)entryToKeys.get( entry ) ;
- if (keys != null) {
- keys.remove( key ) ;
- if (keys.isEmpty())
- entryToKeys.remove( entry ) ;
- }
- }
-
- public void clear()
- {
- super.clear() ;
- entryToKeys.clear() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java 2018-01-30 20:18:33.000000000 -0500
+++ /dev/null 2018-01-30 20:18:33.000000000 -0500
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import com.sun.corba.se.spi.ior.ObjectKey;
-
-/**
- * The bad server id handler is used to locate persistent objects.
- * The Locator object registers the BadServerIdHandler with the ORB
- * and when requests for persistent objects for servers (other than
- * itself) comes, it throws a ForwardException with the IOR pointing
- * to the active server.
- */
-public interface BadServerIdHandler
-{
- void handle(ObjectKey objectKey) ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java 2018-01-30 20:18:34.000000000 -0500
+++ /dev/null 2018-01-30 20:18:34.000000000 -0500
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.EmptyStackException;
-
-import org.omg.PortableServer.*;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.logging.POASystemException ;
-
-public class DelegateImpl implements org.omg.PortableServer.portable.Delegate
-{
- private ORB orb ;
- private POASystemException wrapper ;
- private POAFactory factory;
-
- public DelegateImpl(ORB orb, POAFactory factory){
- this.orb = orb ;
- this.wrapper = POASystemException.get( orb,
- CORBALogDomains.OA ) ;
- this.factory = factory;
- }
-
- public org.omg.CORBA.ORB orb(Servant self)
- {
- return orb;
- }
-
- public org.omg.CORBA.Object this_object(Servant self)
- {
- byte[] oid;
- POA poa;
- try {
- oid = orb.peekInvocationInfo().id();
- poa = (POA)orb.peekInvocationInfo().oa();
- String repId = self._all_interfaces(poa,oid)[0] ;
- return poa.create_reference_with_id(oid, repId);
- } catch (EmptyStackException notInInvocationE) {
- //Not within an invocation context
- POAImpl defaultPOA = null;
- try {
- defaultPOA = (POAImpl)self._default_POA();
- } catch (ClassCastException exception){
- throw wrapper.defaultPoaNotPoaimpl( exception ) ;
- }
-
- try {
- if (defaultPOA.getPolicies().isImplicitlyActivated() ||
- (defaultPOA.getPolicies().isUniqueIds() &&
- defaultPOA.getPolicies().retainServants())) {
- return defaultPOA.servant_to_reference(self);
- } else {
- throw wrapper.wrongPoliciesForThisObject() ;
- }
- } catch ( org.omg.PortableServer.POAPackage.ServantNotActive e) {
- throw wrapper.thisObjectServantNotActive( e ) ;
- } catch ( org.omg.PortableServer.POAPackage.WrongPolicy e) {
- throw wrapper.thisObjectWrongPolicy( e ) ;
- }
- } catch (ClassCastException e) {
- throw wrapper.defaultPoaNotPoaimpl( e ) ;
- }
- }
-
- public POA poa(Servant self)
- {
- try {
- return (POA)orb.peekInvocationInfo().oa();
- } catch (EmptyStackException exception){
- POA returnValue = factory.lookupPOA(self);
- if (returnValue != null) {
- return returnValue;
- }
-
- throw wrapper.noContext( exception ) ;
- }
- }
-
- public byte[] object_id(Servant self)
- {
- try{
- return orb.peekInvocationInfo().id();
- } catch (EmptyStackException exception){
- throw wrapper.noContext(exception) ;
- }
- }
-
- public POA default_POA(Servant self)
- {
- return factory.getRootPOA();
- }
-
- public boolean is_a(Servant self, String repId)
- {
- String[] repositoryIds = self._all_interfaces(poa(self),object_id(self));
- for ( int i=0; icreate_POA
- * Section 3.3.8.2
- */
- public POA create_POA(String name, POAManager
- theManager, Policy[] policies) throws AdapterAlreadyExists,
- InvalidPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling create_POA(name=" + name +
- " theManager=" + theManager + " policies=" + policies +
- ") on poa " + this ) ;
- }
-
- // We cannot create children of a POA that is (being) destroyed.
- // This has been added to the CORBA 3.0 spec.
- if (state > STATE_RUN)
- throw omgLifecycleWrapper().createPoaDestroy() ;
-
- POAImpl poa = (POAImpl)(children.get(name)) ;
-
- if (poa == null) {
- poa = new POAImpl( name, this, getORB(), STATE_START ) ;
- }
-
- try {
- poa.lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling create_POA: new poa is " + poa ) ;
- }
-
- if ((poa.state != STATE_START) && (poa.state != STATE_INIT))
- throw new AdapterAlreadyExists();
-
- POAManagerImpl newManager = (POAManagerImpl)theManager ;
- if (newManager == null)
- newManager = new POAManagerImpl( manager.getFactory(),
- manager.getPIHandler() );
-
- int defaultCopierId =
- getORB().getCopierManager().getDefaultId() ;
- Policies POAPolicies =
- new Policies( policies, defaultCopierId ) ;
-
- poa.initialize( newManager, POAPolicies ) ;
-
- return poa;
- } finally {
- poa.unlock() ;
- }
- } finally {
- unlock() ;
- }
- }
-
- /**
- * find_POA
- * Section 3.3.8.3
- */
- public POA find_POA(String name, boolean activate)
- throws AdapterNonExistent
- {
- POAImpl found = null ;
- AdapterActivator act = null ;
-
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling find_POA(name=" + name +
- " activate=" + activate + ") on poa " + this ) ;
- }
-
- found = (POAImpl) children.get(name);
-
- if (found != null) {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: found poa " + found ) ;
- }
-
- try {
- found.lock() ;
-
- // Do not hold the parent POA lock while
- // waiting for child to complete initialization.
- unlock() ;
-
- // Make sure that the child has completed its initialization,
- // if it was created by an AdapterActivator, otherwise throw
- // a standard TRANSIENT exception with minor code 4 (see
- // CORBA 3.0 11.3.9.3, in reference to unknown_adapter)
- if (!found.waitUntilRunning())
- throw omgLifecycleWrapper().poaDestroyed() ;
-
- // Note that found may be in state DESTROYING or DESTROYED at
- // this point. That's OK, since destruction could start at
- // any time.
- } finally {
- found.unlock() ;
- }
- } else {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: no poa found" ) ;
- }
-
- if (activate && (activator != null)) {
- // Create a child, but don't initialize it. The newly
- // created POA will be in state STATE_START, which will
- // cause other calls to find_POA that are creating the same
- // POA to block on the waitUntilRunning call above.
- // Initialization must be completed by a call to create_POA
- // inside the unknown_adapter upcall. Note that
- // this.poaMutex must be held here so that this.children
- // can be safely updated. The state is set to STATE_INIT
- // so that initialize can make the correct state transition
- // when create_POA is called inside the AdapterActivator.
- // This avoids activating the new POA too soon
- // by transitioning to STATE_RUN after unknown_adapter
- // returns.
- found = new POAImpl( name, this, getORB(), STATE_INIT ) ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: created poa " + found ) ;
- }
-
- act = activator ;
- } else {
- throw new AdapterNonExistent();
- }
- } finally {
- unlock() ;
- }
- }
-
- // assert (found != null)
- // assert not holding this.poaMutex OR found.poaMutex
-
- // We must not hold either this.poaMutex or found.poaMutex here while
- // waiting for intialization of found to complete to prevent possible
- // deadlocks.
-
- if (act != null) {
- boolean status = false ;
- boolean adapterResult = false ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: calling AdapterActivator" ) ;
- }
-
- try {
- // Prevent more than one thread at a time from executing in act
- // in case act is shared between multiple POAs.
- synchronized (act) {
- status = act.unknown_adapter(this, name);
- }
- } catch (SystemException exc) {
- throw omgLifecycleWrapper().adapterActivatorException( exc,
- name, poaId.toString() ) ;
- } catch (Throwable thr) {
- // ignore most non-system exceptions, but log them for
- // diagnostic purposes.
- lifecycleWrapper().unexpectedException( thr, this.toString() ) ;
-
- if (thr instanceof ThreadDeath)
- throw (ThreadDeath)thr ;
- } finally {
- // At this point, we have completed adapter activation.
- // Whether this was successful or not, we must call
- // destroyIfNotInitDone so that calls to enter() and create_POA()
- // that are waiting can execute again. Failing to do this
- // will cause the system to hang in complex tests.
- adapterResult = found.destroyIfNotInitDone() ;
- }
-
- if (status) {
- if (!adapterResult)
- throw omgLifecycleWrapper().adapterActivatorException( name,
- poaId.toString() ) ;
- } else {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling find_POA: AdapterActivator returned false" ) ;
- }
-
- // OMG Issue 3740 is resolved to throw AdapterNonExistent if
- // unknown_adapter() returns false.
- throw new AdapterNonExistent();
- }
- }
-
- return found;
- }
-
- /**
- * destroy
- * Section 3.3.8.4
- */
- public void destroy(boolean etherealize, boolean wait_for_completion)
- {
- // This is to avoid deadlock
- if (wait_for_completion && getORB().isDuringDispatch()) {
- throw lifecycleWrapper().destroyDeadlock() ;
- }
-
- DestroyThread destroyer = new DestroyThread( etherealize, debug );
- destroyer.doIt( this, wait_for_completion ) ;
- }
-
- /**
- * create_thread_policy
- * Section 3.3.8.5
- */
- public ThreadPolicy create_thread_policy(
- ThreadPolicyValue value)
- {
- return new ThreadPolicyImpl(value);
- }
-
- /**
- * create_lifespan_policy
- * Section 3.3.8.5
- */
- public LifespanPolicy create_lifespan_policy(
- LifespanPolicyValue value)
- {
- return new LifespanPolicyImpl(value);
- }
-
- /**
- * create_id_uniqueness_policy
- * Section 3.3.8.5
- */
- public IdUniquenessPolicy create_id_uniqueness_policy(
- IdUniquenessPolicyValue value)
- {
- return new IdUniquenessPolicyImpl(value);
- }
-
- /**
- * create_id_assignment_policy
- * Section 3.3.8.5
- */
- public IdAssignmentPolicy create_id_assignment_policy(
- IdAssignmentPolicyValue value)
- {
- return new IdAssignmentPolicyImpl(value);
- }
-
- /**
- * create_implicit_activation_policy
- * Section 3.3.8.5
- */
- public ImplicitActivationPolicy create_implicit_activation_policy(
- ImplicitActivationPolicyValue value)
- {
- return new ImplicitActivationPolicyImpl(value);
- }
-
- /**
- * create_servant_retention_policy
- * Section 3.3.8.5
- */
- public ServantRetentionPolicy create_servant_retention_policy(
- ServantRetentionPolicyValue value)
- {
- return new ServantRetentionPolicyImpl(value);
- }
-
- /**
- * create_request_processing_policy
- * Section 3.3.8.5
- */
- public RequestProcessingPolicy create_request_processing_policy(
- RequestProcessingPolicyValue value)
- {
- return new RequestProcessingPolicyImpl(value);
- }
-
- /**
- * the_name
- * Section 3.3.8.6
- */
- public String the_name()
- {
- try {
- lock() ;
-
- return name;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * the_parent
- * Section 3.3.8.7
- */
- public POA the_parent()
- {
- try {
- lock() ;
-
- return parent;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * the_children
- */
- public org.omg.PortableServer.POA[] the_children()
- {
- try {
- lock() ;
-
- Collection coll = children.values() ;
- int size = coll.size() ;
- POA[] result = new POA[ size ] ;
- int index = 0 ;
- Iterator iter = coll.iterator() ;
- while (iter.hasNext()) {
- POA poa = (POA)(iter.next()) ;
- result[ index++ ] = poa ;
- }
-
- return result ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * the_POAManager
- * Section 3.3.8.8
- */
- public POAManager the_POAManager()
- {
- try {
- lock() ;
-
- return manager;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * the_activator
- * Section 3.3.8.9
- */
- public AdapterActivator the_activator()
- {
- try {
- lock() ;
-
- return activator;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * the_activator
- * Section 3.3.8.9
- */
- public void the_activator(AdapterActivator activator)
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling the_activator on poa " +
- this + " activator=" + activator ) ;
- }
-
- this.activator = activator;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * get_servant_manager
- * Section 3.3.8.10
- */
- public ServantManager get_servant_manager() throws WrongPolicy
- {
- try {
- lock() ;
-
- return mediator.getServantManager() ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * set_servant_manager
- * Section 3.3.8.10
- */
- public void set_servant_manager(ServantManager servantManager)
- throws WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling set_servant_manager on poa " +
- this + " servantManager=" + servantManager ) ;
- }
-
- mediator.setServantManager( servantManager ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * get_servant
- * Section 3.3.8.12
- */
- public Servant get_servant() throws NoServant, WrongPolicy
- {
- try {
- lock() ;
-
- return mediator.getDefaultServant() ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * set_servant
- * Section 3.3.8.13
- */
- public void set_servant(Servant defaultServant)
- throws WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling set_servant on poa " +
- this + " defaultServant=" + defaultServant ) ;
- }
-
- mediator.setDefaultServant( defaultServant ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * activate_object
- * Section 3.3.8.14
- */
- public byte[] activate_object(Servant servant)
- throws ServantAlreadyActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling activate_object on poa " + this +
- " (servant=" + servant + ")" ) ;
- }
-
- // Allocate a new system-generated object-id.
- // This will throw WrongPolicy if not SYSTEM_ID
- // policy.
- byte[] id = mediator.newSystemId();
-
- try {
- mediator.activateObject( id, servant ) ;
- } catch (ObjectAlreadyActive oaa) {
- // This exception can not occur in this case,
- // since id is always brand new.
- //
- }
-
- return id ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting activate_object on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- /**
- * activate_object_with_id
- * Section 3.3.8.15
- */
- public void activate_object_with_id(byte[] id,
- Servant servant)
- throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling activate_object_with_id on poa " + this +
- " (servant=" + servant + " id=" + id + ")" ) ;
- }
-
- // Clone the id to avoid possible errors due to aliasing
- // (e.g. the client passes the id in and then changes it later).
- byte[] idClone = (byte[])(id.clone()) ;
-
- mediator.activateObject( idClone, servant ) ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting activate_object_with_id on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- /**
- * deactivate_object
- * 3.3.8.16
- */
- public void deactivate_object(byte[] id)
- throws ObjectNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling deactivate_object on poa " + this +
- " (id=" + id + ")" ) ;
- }
-
- mediator.deactivateObject( id ) ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting deactivate_object on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- /**
- * create_reference
- * 3.3.8.17
- */
- public org.omg.CORBA.Object create_reference(String repId)
- throws WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling create_reference(repId=" +
- repId + ") on poa " + this ) ;
- }
-
- return makeObject( repId, mediator.newSystemId()) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * create_reference_with_id
- * 3.3.8.18
- */
- public org.omg.CORBA.Object
- create_reference_with_id(byte[] oid, String repId)
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling create_reference_with_id(oid=" +
- oid + " repId=" + repId + ") on poa " + this ) ;
- }
-
- // Clone the id to avoid possible errors due to aliasing
- // (e.g. the client passes the id in and then changes it later).
- byte[] idClone = (byte[])(oid.clone()) ;
-
- return makeObject( repId, idClone ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * servant_to_id
- * 3.3.8.19
- */
- public byte[] servant_to_id(Servant servant)
- throws ServantNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling servant_to_id(servant=" +
- servant + ") on poa " + this ) ;
- }
-
- return mediator.servantToId( servant ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * servant_to_reference
- * 3.3.8.20
- */
- public org.omg.CORBA.Object servant_to_reference(Servant servant)
- throws ServantNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling servant_to_reference(servant=" +
- servant + ") on poa " + this ) ;
- }
-
- byte[] oid = mediator.servantToId(servant);
- String repId = servant._all_interfaces( this, oid )[0] ;
- return create_reference_with_id(oid, repId);
- } finally {
- unlock() ;
- }
- }
-
- /**
- * reference_to_servant
- * 3.3.8.21
- */
- public Servant reference_to_servant(org.omg.CORBA.Object reference)
- throws ObjectNotActive, WrongPolicy, WrongAdapter
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling reference_to_servant(reference=" +
- reference + ") on poa " + this ) ;
- }
-
- if ( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
-
- // reference_to_id should throw WrongAdapter
- // if the objref was not created by this POA
- byte [] id = internalReferenceToId(reference);
-
- return mediator.idToServant( id ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * reference_to_id
- * 3.3.8.22
- */
- public byte[] reference_to_id(org.omg.CORBA.Object reference)
- throws WrongAdapter, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling reference_to_id(reference=" +
- reference + ") on poa " + this ) ;
- }
-
- if( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
-
- return internalReferenceToId( reference ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * id_to_servant
- * 3.3.8.23
- */
- public Servant id_to_servant(byte[] id)
- throws ObjectNotActive, WrongPolicy
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling id_to_servant(id=" +
- id + ") on poa " + this ) ;
- }
-
- if( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
- return mediator.idToServant( id ) ;
- } finally {
- unlock() ;
- }
- }
-
- /**
- * id_to_reference
- * 3.3.8.24
- */
- public org.omg.CORBA.Object id_to_reference(byte[] id)
- throws ObjectNotActive, WrongPolicy
-
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling id_to_reference(id=" +
- id + ") on poa " + this ) ;
- }
-
- if( state >= STATE_DESTROYING ) {
- throw lifecycleWrapper().adapterDestroyed() ;
- }
-
- Servant s = mediator.idToServant( id ) ;
- String repId = s._all_interfaces( this, id )[0] ;
- return makeObject(repId, id );
- } finally {
- unlock() ;
- }
- }
-
- /**
- * id
- * 11.3.8.26 in ptc/00-08-06
- */
- public byte[] id()
- {
- try {
- lock() ;
-
- return getAdapterId() ;
- } finally {
- unlock() ;
- }
- }
-
- //***************************************************************
- //Implementation of ObjectAdapter interface
- //***************************************************************
-
- public Policy getEffectivePolicy( int type )
- {
- return mediator.getPolicies().get_effective_policy( type ) ;
- }
-
- public int getManagerId()
- {
- return manager.getManagerId() ;
- }
-
- public short getState()
- {
- return manager.getORTState() ;
- }
-
- public String[] getInterfaces( java.lang.Object servant, byte[] objectId )
- {
- Servant serv = (Servant)servant ;
- return serv._all_interfaces( this, objectId ) ;
- }
-
- protected ObjectCopierFactory getObjectCopierFactory()
- {
- int copierId = mediator.getPolicies().getCopierId() ;
- CopierManager cm = getORB().getCopierManager() ;
- return cm.getObjectCopierFactory( copierId ) ;
- }
-
- public void enter() throws OADestroyed
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling enter on poa " + this ) ;
- }
-
- // Avoid deadlock if this is the thread that is processing the
- // POA.destroy because this is the only thread that can notify
- // waiters on beingDestroyedCV. This can happen if an
- // etherealize upcall invokes a method on a colocated object
- // served by this POA.
- while ((state == STATE_DESTROYING) &&
- (isDestroying.get() == Boolean.FALSE)) {
- try {
- beingDestroyedCV.await();
- } catch (InterruptedException ex) {
- // NO-OP
- }
- }
-
- if (!waitUntilRunning())
- throw new OADestroyed() ;
-
- invocationCount++;
- } finally {
- if (debug) {
- ORBUtility.dprint( this, "Exiting enter on poa " + this ) ;
- }
-
- unlock() ;
- }
-
- manager.enter();
- }
-
- public void exit()
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this, "Calling exit on poa " + this ) ;
- }
-
- invocationCount--;
-
- if ((invocationCount == 0) && (state == STATE_DESTROYING)) {
- invokeCV.broadcast();
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this, "Exiting exit on poa " + this ) ;
- }
-
- unlock() ;
- }
-
- manager.exit();
- }
-
- public void getInvocationServant( OAInvocationInfo info )
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling getInvocationServant on poa " + this ) ;
- }
-
- java.lang.Object servant = null ;
-
- try {
- servant = mediator.getInvocationServant( info.id(),
- info.getOperation() );
- } catch (ForwardRequest freq) {
- throw new ForwardException( getORB(), freq.forward_reference ) ;
- }
-
- info.setServant( servant ) ;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting getInvocationServant on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-
- public org.omg.CORBA.Object getLocalServant( byte[] objectId )
- {
- return null ;
- }
-
- /** Called from the subcontract to let this POA cleanup after an
- * invocation. Note: If getServant was called, then returnServant
- * MUST be called, even in the case of exceptions. This may be
- * called multiple times for a single request.
- */
- public void returnServant()
- {
- try {
- lock() ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling returnServant on poa " + this ) ;
- }
-
- mediator.returnServant();
- } catch (Throwable thr) {
- if (debug) {
- ORBUtility.dprint( this,
- "Exception " + thr + " in returnServant on poa " + this ) ;
- }
-
- if (thr instanceof Error)
- throw (Error)thr ;
- else if (thr instanceof RuntimeException)
- throw (RuntimeException)thr ;
-
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting returnServant on poa " + this ) ;
- }
-
- unlock() ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java 2018-01-30 20:18:39.000000000 -0500
+++ /dev/null 2018-01-30 20:18:39.000000000 -0500
@@ -1,547 +0,0 @@
-/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import java.util.Iterator;
-import java.util.Collections;
-import java.util.Set;
-import java.util.HashSet;
-
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.CompletionStatus ;
-
-import org.omg.PortableServer.POAManager;
-import org.omg.PortableServer.POAManagerPackage.State;
-import org.omg.PortableServer.POA;
-
-import org.omg.PortableInterceptor.DISCARDING ;
-import org.omg.PortableInterceptor.ACTIVE ;
-import org.omg.PortableInterceptor.HOLDING ;
-import org.omg.PortableInterceptor.INACTIVE ;
-import org.omg.PortableInterceptor.NON_EXISTENT ;
-
-import com.sun.corba.se.spi.protocol.PIHandler ;
-
-import com.sun.corba.se.impl.logging.POASystemException ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-/** POAManagerImpl is the implementation of the POAManager interface.
- * Its public methods are activate(), hold_requests(), discard_requests()
- * and deactivate().
- */
-
-public class POAManagerImpl extends org.omg.CORBA.LocalObject implements
- POAManager
-{
- private final POAFactory factory ; // factory which contains global state
- // for all POAManagers
- private PIHandler pihandler ; // for adapterManagerStateChanged
- private State state; // current state of this POAManager
- private Set poas = new HashSet(4) ; // all poas controlled by this POAManager
- private int nInvocations=0; // Number of invocations in progress
- private int nWaiters=0; // Number of threads waiting for
- // invocations to complete
- private int myId = 0 ; // This POAManager's ID
- private boolean debug ;
- private boolean explicitStateChange ; // initially false, set true as soon as
- // one of activate, hold_request,
- // discard_request, or deactivate is called.
-
- private String stateToString( State state )
- {
- switch (state.value()) {
- case State._HOLDING : return "State[HOLDING]" ;
- case State._ACTIVE : return "State[ACTIVE]" ;
- case State._DISCARDING : return "State[DISCARDING]" ;
- case State._INACTIVE : return "State[INACTIVE]" ;
- }
-
- return "State[UNKNOWN]" ;
- }
-
- public String toString()
- {
- return "POAManagerImpl[myId=" + myId +
- " state=" + stateToString(state) +
- " nInvocations=" + nInvocations +
- " nWaiters=" + nWaiters + "]" ;
- }
-
- POAFactory getFactory()
- {
- return factory ;
- }
-
- PIHandler getPIHandler()
- {
- return pihandler ;
- }
-
- private void countedWait()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this, "Calling countedWait on POAManager " +
- this + " nWaiters=" + nWaiters ) ;
- }
-
- nWaiters++ ;
- wait();
- } catch ( java.lang.InterruptedException ex ) {
- // NOP
- } finally {
- nWaiters-- ;
-
- if (debug) {
- ORBUtility.dprint( this, "Exiting countedWait on POAManager " +
- this + " nWaiters=" + nWaiters ) ;
- }
- }
- }
-
- private void notifyWaiters()
- {
- if (debug) {
- ORBUtility.dprint( this, "Calling notifyWaiters on POAManager " +
- this + " nWaiters=" + nWaiters ) ;
- }
-
- if (nWaiters >0)
- notifyAll() ;
- }
-
- public int getManagerId()
- {
- return myId ;
- }
-
- POAManagerImpl( POAFactory factory, PIHandler pihandler )
- {
- this.factory = factory ;
- factory.addPoaManager(this);
- this.pihandler = pihandler ;
- myId = factory.newPOAManagerId() ;
- state = State.HOLDING;
- debug = factory.getORB().poaDebugFlag ;
- explicitStateChange = false ;
-
- if (debug) {
- ORBUtility.dprint( this, "Creating POAManagerImpl " + this ) ;
- }
- }
-
- synchronized void addPOA(POA poa)
- {
- // XXX This is probably not the correct error
- if (state.value() == State._INACTIVE) {
- POASystemException wrapper = factory.getWrapper();
- throw wrapper.addPoaInactive( CompletionStatus.COMPLETED_NO ) ;
- }
-
- poas.add(poa);
- }
-
- synchronized void removePOA(POA poa)
- {
- poas.remove(poa);
- if ( poas.isEmpty() ) {
- factory.removePoaManager(this);
- }
- }
-
- public short getORTState()
- {
- switch (state.value()) {
- case State._HOLDING : return HOLDING.value ;
- case State._ACTIVE : return ACTIVE.value ;
- case State._INACTIVE : return INACTIVE.value ;
- case State._DISCARDING : return DISCARDING.value ;
- default : return NON_EXISTENT.value ;
- }
- }
-
-/****************************************************************************
- * The following four public methods are used to change the POAManager's state.
- *
- * A note on the design of synchronization code:
- * There are 4 places where a thread would need to wait for a condition:
- * - in hold_requests, discard_requests, deactivate, enter
- * There are 5 places where a thread notifies a condition:
- * - in activate, hold_requests, discard_requests, deactivate, exit
- *
- * Since each notify needs to awaken waiters in several of the 4 places,
- * and since wait() in Java has the nice property of releasing the lock
- * on its monitor before sleeping, it seemed simplest to have just one
- * monitor object: "this". Thus all notifies will awaken all waiters.
- * On waking up, each waiter verifies that the condition it was waiting
- * for is satisfied, otherwise it goes back into a wait().
- *
- ****************************************************************************/
-
- /**
- * activate
- * Spec: pages 3-14 thru 3-18
- */
- public synchronized void activate()
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling activate on POAManager " + this ) ;
- }
-
- try {
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
-
- // set the state to ACTIVE
- state = State.ACTIVE;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any invocations that were waiting because the previous
- // state was HOLDING, as well as notify any threads that were waiting
- // inside hold_requests() or discard_requests().
- notifyWaiters();
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting activate on POAManager " + this ) ;
- }
- }
- }
-
- /**
- * hold_requests
- * Spec: pages 3-14 thru 3-18
- */
- public synchronized void hold_requests(boolean wait_for_completion)
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling hold_requests on POAManager " + this ) ;
- }
-
- try {
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
- // set the state to HOLDING
- state = State.HOLDING;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any threads that were waiting in the wait() inside
- // discard_requests. This will cause discard_requests to return
- // (which is in conformance with the spec).
- notifyWaiters();
-
- if ( wait_for_completion ) {
- while ( state.value() == State._HOLDING && nInvocations > 0 ) {
- countedWait() ;
- }
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting hold_requests on POAManager " + this ) ;
- }
- }
- }
-
- /**
- * discard_requests
- * Spec: pages 3-14 thru 3-18
- */
- public synchronized void discard_requests(boolean wait_for_completion)
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- if (debug) {
- ORBUtility.dprint( this,
- "Calling hold_requests on POAManager " + this ) ;
- }
-
- try {
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
-
- // set the state to DISCARDING
- state = State.DISCARDING;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any invocations that were waiting because the previous
- // state was HOLDING. Those invocations will henceforth be rejected with
- // a TRANSIENT exception. Also notify any threads that were waiting
- // inside hold_requests().
- notifyWaiters();
-
- if ( wait_for_completion ) {
- while ( state.value() == State._DISCARDING && nInvocations > 0 ) {
- countedWait() ;
- }
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting hold_requests on POAManager " + this ) ;
- }
- }
- }
-
- /**
- * deactivate
- * Spec: pages 3-14 thru 3-18
- * Note: INACTIVE is a permanent state.
- */
-
- public void deactivate(boolean etherealize_objects, boolean wait_for_completion)
- throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
- {
- explicitStateChange = true ;
-
- try {
- synchronized( this ) {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling deactivate on POAManager " + this ) ;
- }
-
- if ( state.value() == State._INACTIVE )
- throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
-
- state = State.INACTIVE;
-
- pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
-
- // Notify any invocations that were waiting because the previous
- // state was HOLDING. Those invocations will then be rejected with
- // an OBJ_ADAPTER exception. Also notify any threads that were waiting
- // inside hold_requests() or discard_requests().
- notifyWaiters();
- }
-
- POAManagerDeactivator deactivator = new POAManagerDeactivator( this,
- etherealize_objects, debug ) ;
-
- if (wait_for_completion)
- deactivator.run() ;
- else {
- Thread thr = new Thread(null, deactivator, "POA-Deactivator-Thread", 0, false) ;
- thr.start() ;
- }
- } finally {
- synchronized(this) {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting deactivate on POAManager " + this ) ;
- }
- }
- }
- }
-
- private class POAManagerDeactivator implements Runnable
- {
- private boolean etherealize_objects ;
- private POAManagerImpl pmi ;
- private boolean debug ;
-
- POAManagerDeactivator( POAManagerImpl pmi, boolean etherealize_objects,
- boolean debug )
- {
- this.etherealize_objects = etherealize_objects ;
- this.pmi = pmi ;
- this.debug = debug ;
- }
-
- public void run()
- {
- try {
- synchronized (pmi) {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling run with etherealize_objects=" +
- etherealize_objects + " pmi=" + pmi ) ;
- }
-
- while ( pmi.nInvocations > 0 ) {
- countedWait() ;
- }
- }
-
- if (etherealize_objects) {
- Iterator iterator = null ;
-
- // Make sure that poas cannot change while we copy it!
- synchronized (pmi) {
- if (debug) {
- ORBUtility.dprint( this,
- "run: Preparing to etherealize with pmi=" +
- pmi ) ;
- }
-
- iterator = (new HashSet(pmi.poas)).iterator();
- }
-
- while (iterator.hasNext()) {
- // Each RETAIN+USE_SERVANT_MGR poa
- // must call etherealize for all its objects
- ((POAImpl)iterator.next()).etherealizeAll();
- }
-
- synchronized (pmi) {
- if (debug) {
- ORBUtility.dprint( this,
- "run: removing POAManager and clearing poas " +
- "with pmi=" + pmi ) ;
- }
-
- factory.removePoaManager(pmi);
- poas.clear();
- }
- }
- } finally {
- if (debug) {
- synchronized (pmi) {
- ORBUtility.dprint( this, "Exiting run" ) ;
- }
- }
- }
- }
- }
-
- /**
- * Added according to the spec CORBA V2.3; this returns the
- * state of the POAManager
- */
-
- public org.omg.PortableServer.POAManagerPackage.State get_state () {
- return state;
- }
-
-/****************************************************************************
- * The following methods are used on the invocation path.
- ****************************************************************************/
-
- // called from POA.find_POA before calling
- // AdapterActivator.unknown_adapter.
- synchronized void checkIfActive()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling checkIfActive for POAManagerImpl " + this ) ;
- }
-
- checkState();
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting checkIfActive for POAManagerImpl " + this ) ;
- }
- }
- }
-
- private void checkState()
- {
- while ( state.value() != State._ACTIVE ) {
- switch ( state.value() ) {
- case State._HOLDING:
- while ( state.value() == State._HOLDING ) {
- countedWait() ;
- }
- break;
-
- case State._DISCARDING:
- throw factory.getWrapper().poaDiscarding() ;
-
- case State._INACTIVE:
- throw factory.getWrapper().poaInactive() ;
- }
- }
- }
-
- synchronized void enter()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling enter for POAManagerImpl " + this ) ;
- }
-
- checkState();
- nInvocations++;
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting enter for POAManagerImpl " + this ) ;
- }
- }
- }
-
- synchronized void exit()
- {
- try {
- if (debug) {
- ORBUtility.dprint( this,
- "Calling exit for POAManagerImpl " + this ) ;
- }
-
- nInvocations--;
-
- if ( nInvocations == 0 ) {
- // This notifies any threads that were in the
- // wait_for_completion loop in hold/discard/deactivate().
- notifyWaiters();
- }
- } finally {
- if (debug) {
- ORBUtility.dprint( this,
- "Exiting exit for POAManagerImpl " + this ) ;
- }
- }
- }
-
- /** Activate the POAManager if no explicit state change has ever been
- * previously invoked.
- */
- public synchronized void implicitActivation()
- {
- if (!explicitStateChange)
- try {
- activate() ;
- } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ai) {
- // ignore the exception.
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java 2018-01-30 20:18:40.000000000 -0500
+++ /dev/null 2018-01-30 20:18:40.000000000 -0500
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-
-/** POAPolicyMediator defines an interface to which the POA delegates all
- * policy specific operations. This permits code paths for different
- * policies to be optimized by creating the correct code at POA creation
- * time. Also note that as much as possible, this interface does not
- * do any concurrency control, except as noted. The POA is responsible
- * for concurrency control.
- */
-public interface POAPolicyMediator {
- /** Return the policies object that was used to create this
- * POAPolicyMediator.
- */
- Policies getPolicies() ;
-
- /** Return the subcontract ID to use in the IIOP profile in IORs
- * created by this POAPolicyMediator's POA. This is initialized
- * according to the policies and the POA used to construct this
- * POAPolicyMediator in the POAPolicyMediatorFactory.
- */
- int getScid() ;
-
- /** Return the server ID to use in the IIOP profile in IORs
- * created by this POAPolicyMediator's POA. This is initialized
- * according to the policies and the POA used to construct this
- * POAPolicyMediator in the POAPolicyMediatorFactory.
- */
- int getServerId() ;
-
- /** Get the servant to use for an invocation with the
- * given id and operation.
- * @param id the object ID for which we are requesting a servant
- * @param operation the name of the operation to be performed on
- * the servant
- * @return the resulting Servant.
- */
- java.lang.Object getInvocationServant( byte[] id,
- String operation ) throws ForwardRequest ;
-
- /** Release a servant that was obtained from getInvocationServant.
- */
- void returnServant() ;
-
- /** Etherealize all servants associated with this POAPolicyMediator.
- * Does nothing if the retention policy is non-retain.
- */
- void etherealizeAll() ;
-
- /** Delete everything in the active object map.
- */
- void clearAOM() ;
-
- /** Return the servant manager. Will throw WrongPolicy
- * if the request processing policy is not USE_SERVANT_MANAGER.
- */
- ServantManager getServantManager() throws WrongPolicy ;
-
- /** Set the servant manager. Will throw WrongPolicy
- * if the request processing policy is not USE_SERVANT_MANAGER.
- */
- void setServantManager( ServantManager servantManager ) throws WrongPolicy ;
-
- /** Return the default servant. Will throw WrongPolicy
- * if the request processing policy is not USE_DEFAULT_SERVANT.
- */
- Servant getDefaultServant() throws NoServant, WrongPolicy ;
-
- /** Set the default servant. Will throw WrongPolicy
- * if the request processing policy is not USE_DEFAULT_SERVANT.
- */
- void setDefaultServant( Servant servant ) throws WrongPolicy ;
-
- void activateObject( byte[] id, Servant servant )
- throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ;
-
- /** Deactivate the object that is associated with the given id.
- * Returns the servant for id.
- */
- Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ;
-
- /** Allocate a new, unique system ID. Requires the ID assignment policy
- * to be SYSTEM.
- */
- byte[] newSystemId() throws WrongPolicy ;
-
- byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ;
-
- Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java 2018-01-30 20:18:40.000000000 -0500
+++ /dev/null 2018-01-30 20:18:40.000000000 -0500
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Collection;
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-
-import com.sun.corba.se.spi.extension.ServantCachingPolicy ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public abstract class POAPolicyMediatorBase implements POAPolicyMediator {
- protected POAImpl poa ;
- protected ORB orb ;
-
- private int sysIdCounter ;
- private Policies policies ;
- private DelegateImpl delegateImpl ;
-
- private int serverid ;
- private int scid ;
-
- protected boolean isImplicit ;
- protected boolean isUnique ;
- protected boolean isSystemId ;
-
- public final Policies getPolicies()
- {
- return policies ;
- }
-
- public final int getScid()
- {
- return scid ;
- }
-
- public final int getServerId()
- {
- return serverid ;
- }
-
- POAPolicyMediatorBase( Policies policies, POAImpl poa )
- {
- if (policies.isSingleThreaded())
- throw poa.invocationWrapper().singleThreadNotSupported() ;
-
- POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ;
- POAFactory poaf = poam.getFactory() ;
- delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ;
- this.policies = policies ;
- this.poa = poa ;
- orb = (ORB)poa.getORB() ;
-
- switch (policies.servantCachingLevel()) {
- case ServantCachingPolicy.NO_SERVANT_CACHING :
- scid = ORBConstants.TRANSIENT_SCID ;
- break ;
- case ServantCachingPolicy.FULL_SEMANTICS :
- scid = ORBConstants.SC_TRANSIENT_SCID ;
- break ;
- case ServantCachingPolicy.INFO_ONLY_SEMANTICS :
- scid = ORBConstants.IISC_TRANSIENT_SCID ;
- break ;
- case ServantCachingPolicy.MINIMAL_SEMANTICS :
- scid = ORBConstants.MINSC_TRANSIENT_SCID ;
- break ;
- }
-
- if ( policies.isTransient() ) {
- serverid = orb.getTransientServerId();
- } else {
- serverid = orb.getORBData().getPersistentServerId();
- scid = ORBConstants.makePersistent( scid ) ;
- }
-
- isImplicit = policies.isImplicitlyActivated() ;
- isUnique = policies.isUniqueIds() ;
- isSystemId = policies.isSystemAssignedIds() ;
-
- sysIdCounter = 0 ;
- }
-
- public final java.lang.Object getInvocationServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- java.lang.Object result = internalGetServant( id, operation ) ;
-
- return result ;
- }
-
- // Create a delegate and stick it in the servant.
- // This delegate is needed during dispatch for the ObjectImpl._orb()
- // method to work.
- protected final void setDelegate(Servant servant, byte[] id)
- {
- //This new servant delegate no longer needs the id for
- // its initialization.
- servant._set_delegate(delegateImpl);
- }
-
- public synchronized byte[] newSystemId() throws WrongPolicy
- {
- if (!isSystemId)
- throw new WrongPolicy() ;
-
- byte[] array = new byte[8];
- ORBUtility.intToBytes(++sysIdCounter, array, 0);
- ORBUtility.intToBytes( poa.getPOAId(), array, 4);
- return array;
- }
-
- protected abstract java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java 2018-01-30 20:18:41.000000000 -0500
+++ /dev/null 2018-01-30 20:18:41.000000000 -0500
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.PortableServer.Servant ;
-
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
-
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase {
- protected ActiveObjectMap activeObjectMap ;
-
- POAPolicyMediatorBase_R( Policies policies, POAImpl poa )
- {
- super( policies, poa ) ;
-
- // assert policies.retainServants() && policies.useActiveObjectMapOnly()
- if (!policies.retainServants())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- activeObjectMap = ActiveObjectMap.create(poa, !isUnique);
- }
-
- public void returnServant()
- {
- // NO-OP
- }
-
- public void clearAOM()
- {
- activeObjectMap.clear() ;
- activeObjectMap = null ;
- }
-
- protected Servant internalKeyToServant( ActiveObjectMap.Key key )
- {
- AOMEntry entry = activeObjectMap.get(key);
- if (entry == null)
- return null ;
-
- return activeObjectMap.getServant( entry ) ;
- }
-
- protected Servant internalIdToServant( byte[] id )
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- return internalKeyToServant( key ) ;
- }
-
- protected void activateServant( ActiveObjectMap.Key key, AOMEntry entry, Servant servant )
- {
- setDelegate(servant, key.id );
-
- if (orb.shutdownDebugFlag) {
- System.out.println("Activating object " + servant +
- " with POA " + poa);
- }
-
- activeObjectMap.putServant( servant, entry ) ;
-
- if (Util.isInstanceDefined()) {
- POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
- POAFactory factory = pm.getFactory() ;
- factory.registerPOAForServant(poa, servant);
- }
- }
-
- public final void activateObject(byte[] id, Servant servant)
- throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
- {
- if (isUnique && activeObjectMap.contains(servant))
- throw new ServantAlreadyActive();
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
-
- AOMEntry entry = activeObjectMap.get( key ) ;
-
- // Check for an ObjectAlreadyActive error
- entry.activateObject() ;
- activateServant( key, entry, servant ) ;
- }
-
- public Servant deactivateObject( byte[] id )
- throws ObjectNotActive, WrongPolicy
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- return deactivateObject( key ) ;
- }
-
- protected void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry,
- Servant s ) throws ObjectNotActive, WrongPolicy
- {
- // Default does nothing, but the USE_SERVANT_MANAGER case
- // must handle etherealization
-
- activeObjectMap.remove(key);
-
- if (Util.isInstanceDefined()) {
- POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
- POAFactory factory = pm.getFactory() ;
- factory.unregisterPOAForServant(poa, s);
- }
- }
-
- public Servant deactivateObject( ActiveObjectMap.Key key )
- throws ObjectNotActive, WrongPolicy
- {
- if (orb.poaDebugFlag) {
- ORBUtility.dprint( this,
- "Calling deactivateObject for key " + key ) ;
- }
-
- try {
- AOMEntry entry = activeObjectMap.get(key);
- if (entry == null)
- throw new ObjectNotActive();
-
- Servant s = activeObjectMap.getServant( entry ) ;
- if (s == null)
- throw new ObjectNotActive();
-
- if (orb.poaDebugFlag) {
- System.out.println("Deactivating object " + s + " with POA " + poa);
- }
-
- deactivateHelper( key, entry, s ) ;
-
- return s ;
- } finally {
- if (orb.poaDebugFlag) {
- ORBUtility.dprint( this,
- "Exiting deactivateObject" ) ;
- }
- }
- }
-
- public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
- {
- // XXX needs to handle call from an invocation on this POA
-
- if (!isUnique && !isImplicit)
- throw new WrongPolicy();
-
- if (isUnique) {
- ActiveObjectMap.Key key = activeObjectMap.getKey(servant);
- if (key != null)
- return key.id ;
- }
-
- // assert !isUnique || (servant not in activateObjectMap)
-
- if (isImplicit)
- try {
- byte[] id = newSystemId() ;
- activateObject( id, servant ) ;
- return id ;
- } catch (ObjectAlreadyActive oaa) {
- // This can't occur here, since id is always brand new.
- throw poa.invocationWrapper().servantToIdOaa( oaa ) ;
- } catch (ServantAlreadyActive s) {
- throw poa.invocationWrapper().servantToIdSaa( s ) ;
- } catch (WrongPolicy w) {
- throw poa.invocationWrapper().servantToIdWp( w ) ;
- }
-
- throw new ServantNotActive();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java 2018-01-30 20:18:42.000000000 -0500
+++ /dev/null 2018-01-30 20:18:42.000000000 -0500
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-abstract class POAPolicyMediatorFactory {
- // create an appropriate policy mediator based on the policies.
- // Note that the policies object has already been validated before
- // this call, so it can only contain valid combinations of POA policies.
- static POAPolicyMediator create( Policies policies, POAImpl poa )
- {
- if (policies.retainServants()) {
- if (policies.useActiveMapOnly())
- return new POAPolicyMediatorImpl_R_AOM( policies, poa ) ;
- else if (policies.useDefaultServant())
- return new POAPolicyMediatorImpl_R_UDS( policies, poa ) ;
- else if (policies.useServantManager())
- return new POAPolicyMediatorImpl_R_USM( policies, poa ) ;
- else
- throw poa.invocationWrapper().pmfCreateRetain() ;
- } else {
- if (policies.useDefaultServant())
- return new POAPolicyMediatorImpl_NR_UDS( policies, poa ) ;
- else if (policies.useServantManager())
- return new POAPolicyMediatorImpl_NR_USM( policies, poa ) ;
- else
- throw poa.invocationWrapper().pmfCreateNonRetain() ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java 2018-01-30 20:18:42.000000000 -0500
+++ /dev/null 2018-01-30 20:18:42.000000000 -0500
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/** Implementation of POAPolicyMediator that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_NR_UDS extends POAPolicyMediatorBase {
- private Servant defaultServant ;
-
- POAPolicyMediatorImpl_NR_UDS( Policies policies, POAImpl poa )
- {
- super( policies, poa ) ;
-
- // assert !policies.retainServants() && policies.useDefaultServant()
- if (policies.retainServants())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- if (!policies.useDefaultServant())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- defaultServant = null ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- if (defaultServant == null)
- throw poa.invocationWrapper().poaNoDefaultServant() ;
-
- return defaultServant;
- }
-
- public void returnServant()
- {
- // NO-OP
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public void clearAOM()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setServantManager( ServantManager servantManager ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- if (defaultServant == null)
- throw new NoServant();
- return defaultServant;
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- this.defaultServant = servant;
- setDelegate(defaultServant, "DefaultServant".getBytes());
- }
-
- public final void activateObject(byte[] id, Servant servant)
- throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
- {
- throw new WrongPolicy();
- }
-
- public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- if (defaultServant != null)
- return defaultServant;
-
- throw new ObjectNotActive() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java 2018-01-30 20:18:43.000000000 -0500
+++ /dev/null 2018-01-30 20:18:43.000000000 -0500
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.POA ;
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ServantLocator ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase {
- private ServantLocator locator ;
-
- POAPolicyMediatorImpl_NR_USM( Policies policies, POAImpl poa )
- {
- super( policies, poa ) ;
-
- // assert !policies.retainServants() && policies.useServantManager()
- if (policies.retainServants())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- if (!policies.useServantManager())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
-
- locator = null ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- if (locator == null)
- throw poa.invocationWrapper().poaNoServantManager() ;
-
- CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder() ;
-
- // Try - finally is J2EE requirement.
- java.lang.Object servant;
- try{
- poa.unlock() ;
-
- servant = locator.preinvoke(id, poa, operation, cookieHolder);
- if (servant == null)
- servant = new NullServantImpl( poa.omgInvocationWrapper().nullServantReturned() ) ;
- else
- setDelegate( (Servant)servant, id);
- } finally {
- poa.lock() ;
- }
-
- return servant;
- }
-
- public void returnServant()
- {
- OAInvocationInfo info = orb.peekInvocationInfo();
- if (locator == null)
- return;
-
- try {
- poa.unlock() ;
- locator.postinvoke(info.id(), (POA)(info.oa()),
- info.getOperation(), info.getCookieHolder().value,
- (Servant)(info.getServantContainer()) );
- } finally {
- poa.lock() ;
- }
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public void clearAOM()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- return locator ;
- }
-
- public void setServantManager( ServantManager servantManager ) throws WrongPolicy
- {
- if (locator != null)
- throw poa.invocationWrapper().servantManagerAlreadySet() ;
-
- if (servantManager instanceof ServantLocator)
- locator = (ServantLocator)servantManager;
- else
- throw poa.invocationWrapper().servantManagerBadType() ;
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public final void activateObject(byte[] id, Servant servant)
- throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
- {
- throw new WrongPolicy();
- }
-
- public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- throw new WrongPolicy();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java 2018-01-30 20:18:44.000000000 -0500
+++ /dev/null 2018-01-30 20:18:44.000000000 -0500
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA in the case:
- *
- * - retain
- * - useActiveObjectMapOnly
- *
- */
-public class POAPolicyMediatorImpl_R_AOM extends POAPolicyMediatorBase_R {
- POAPolicyMediatorImpl_R_AOM( Policies policies, POAImpl poa )
- {
- // assert policies.retainServants()
- super( policies, poa ) ;
-
- // policies.useActiveObjectMapOnly()
- if (!policies.useActiveMapOnly())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- java.lang.Object servant = internalIdToServant( id ) ;
- if (servant == null)
- servant = new NullServantImpl(
- poa.invocationWrapper().nullServant() ) ;
- return servant ;
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setServantManager( ServantManager servantManager )
- throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- Servant s = internalIdToServant( id ) ;
-
- if (s == null)
- throw new ObjectNotActive() ;
- else
- return s;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java 2018-01-30 20:18:44.000000000 -0500
+++ /dev/null 2018-01-30 20:18:44.000000000 -0500
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Enumeration ;
-
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_R_UDS extends POAPolicyMediatorBase_R {
- private Servant defaultServant ;
-
- POAPolicyMediatorImpl_R_UDS( Policies policies, POAImpl poa )
- {
- // assert policies.retainServants()
- super( policies, poa ) ;
- defaultServant = null ;
-
- // policies.useDefaultServant()
- if (!policies.useDefaultServant())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- Servant servant = internalIdToServant( id ) ;
- if (servant == null)
- servant = defaultServant ;
-
- if (servant == null)
- throw poa.invocationWrapper().poaNoDefaultServant() ;
-
- return servant ;
- }
-
- public void etherealizeAll()
- {
- // NO-OP
- }
-
- public ServantManager getServantManager() throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public void setServantManager( ServantManager servantManager ) throws WrongPolicy
- {
- throw new WrongPolicy();
- }
-
- public Servant getDefaultServant() throws NoServant, WrongPolicy
- {
- if (defaultServant == null)
- throw new NoServant();
- else
- return defaultServant;
- }
-
- public void setDefaultServant( Servant servant ) throws WrongPolicy
- {
- defaultServant = servant;
- setDelegate(defaultServant, "DefaultServant".getBytes());
- }
-
- public Servant idToServant( byte[] id )
- throws WrongPolicy, ObjectNotActive
- {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- Servant s = internalKeyToServant(key);
-
- if (s == null)
- if (defaultServant != null)
- s = defaultServant;
-
- if (s == null)
- throw new ObjectNotActive() ;
-
- return s;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java 2018-01-30 20:18:45.000000000 -0500
+++ /dev/null 2018-01-30 20:18:45.000000000 -0500
@@ -1,381 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa ;
-
-import java.util.Set ;
-import org.omg.CORBA.SystemException ;
-
-import org.omg.PortableServer.ServantActivator ;
-import org.omg.PortableServer.Servant ;
-import org.omg.PortableServer.ServantManager ;
-import org.omg.PortableServer.ForwardRequest ;
-import org.omg.PortableServer.POAPackage.WrongPolicy ;
-import org.omg.PortableServer.POAPackage.ObjectNotActive ;
-import org.omg.PortableServer.POAPackage.ServantNotActive ;
-import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
-import org.omg.PortableServer.POAPackage.NoServant ;
-
-import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-import com.sun.corba.se.impl.oa.NullServantImpl ;
-
-import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
-
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.spi.oa.NullServant ;
-
-/** Implementation of POARequesHandler that provides policy specific
- * operations on the POA.
- */
-public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
- protected ServantActivator activator ;
-
- POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa )
- {
- // assert policies.retainServants()
- super( policies, poa ) ;
- activator = null ;
-
- if (!policies.useServantManager())
- throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
- }
-
- /* This handles a rather subtle bug (4939892). The problem is that
- * enter will wait on the entry if it is being etherealized. When the
- * deferred state transition completes, the entry is no longer in the
- * AOM, and so we need to get a new entry, otherwise activator.incarnate
- * will be called twice, once for the old entry, and again when a new
- * entry is created. This fix also required extending the FSM StateEngine
- * to allow actions to throw exceptions, and adding a new state in the
- * AOMEntry FSM to detect this condition.
- */
- private AOMEntry enterEntry( ActiveObjectMap.Key key )
- {
- AOMEntry result = null ;
- boolean failed ;
- do {
- failed = false ;
- result = activeObjectMap.get(key) ;
-
- try {
- result.enter() ;
- } catch (Exception exc) {
- failed = true ;
- }
- } while (failed) ;
-
- return result ;
- }
-
- protected java.lang.Object internalGetServant( byte[] id,
- String operation ) throws ForwardRequest
- {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "Calling POAPolicyMediatorImpl_R_USM.internalGetServant " +
- "for poa " + poa + " operation=" + operation ) ;
- }
-
- try {
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- AOMEntry entry = enterEntry(key) ;
- java.lang.Object servant = activeObjectMap.getServant( entry ) ;
- if (servant != null) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: servant already activated" ) ;
- }
-
- return servant ;
- }
-
- if (activator == null) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: no servant activator in POA" ) ;
- }
-
- entry.incarnateFailure() ;
- throw poa.invocationWrapper().poaNoServantManager() ;
- }
-
- // Drop the POA lock during the incarnate call and
- // re-acquire it afterwards. The entry state machine
- // prevents more than one thread from executing the
- // incarnate method at a time within the same POA.
- try {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: upcall to incarnate" ) ;
- }
-
- poa.unlock() ;
-
- servant = activator.incarnate(id, poa);
-
- if (servant == null)
- servant = new NullServantImpl(
- poa.omgInvocationWrapper().nullServantReturned() ) ;
- } catch (ForwardRequest freq) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate threw ForwardRequest" ) ;
- }
-
- throw freq ;
- } catch (SystemException exc) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate threw SystemException " + exc ) ;
- }
-
- throw exc ;
- } catch (Throwable exc) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate threw Throwable " + exc ) ;
- }
-
- throw poa.invocationWrapper().poaServantActivatorLookupFailed(
- exc ) ;
- } finally {
- poa.lock() ;
-
- // servant == null means incarnate threw an exception,
- // while servant instanceof NullServant means incarnate returned a
- // null servant. Either case is an incarnate failure to the
- // entry state machine.
- if ((servant == null) || (servant instanceof NullServant)) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate failed" ) ;
- }
-
- // XXX Does the AOM leak in this case? Yes,
- // but the problem is hard to fix. There may be
- // a number of threads waiting for the state to change
- // from INCARN to something else, which is VALID or
- // INVALID, depending on the incarnate result.
- // The activeObjectMap.get() call above creates an
- // ActiveObjectMap.Entry if one does not already exist,
- // and stores it in the keyToEntry map in the AOM.
- entry.incarnateFailure() ;
- } else {
- // here check for unique_id policy, and if the servant
- // is already registered for a different ID, then throw
- // OBJ_ADAPTER exception, else activate it. Section 11.3.5.1
- // 99-10-07.pdf
- if (isUnique) {
- // check if the servant already is associated with some id
- if (activeObjectMap.contains((Servant)servant)) {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: servant already assigned to ID" ) ;
- }
-
- entry.incarnateFailure() ;
- throw poa.invocationWrapper().poaServantNotUnique() ;
- }
- }
-
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "internalGetServant: incarnate complete" ) ;
- }
-
- entry.incarnateComplete() ;
- activateServant(key, entry, (Servant)servant);
- }
- }
-
- return servant ;
- } finally {
- if (poa.getDebug()) {
- ORBUtility.dprint( this,
- "Exiting POAPolicyMediatorImpl_R_USM.internalGetServant " +
- "for poa " + poa ) ;
- }
- }
- }
-
- public void returnServant()
- {
- OAInvocationInfo info = orb.peekInvocationInfo();
- byte[] id = info.id() ;
- ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- AOMEntry entry = activeObjectMap.get( key ) ;
- entry.exit() ;
- }
-
- public void etherealizeAll()
- {
- if (activator != null) {
- Set keySet = activeObjectMap.keySet() ;
-
- // Copy the elements in the set to an array to avoid
- // changes in the set due to concurrent modification
- ActiveObjectMap.Key[] keys =
- (ActiveObjectMap.Key[])keySet.toArray(
- new ActiveObjectMap.Key[ keySet.size() ] ) ;
-
- for (int ctr=0; ctr= 0) {
- setPolicyValue( key.intValue(), POAPolicyValue ) ;
-
- // if the value of this POA policy was previously set to a
- // different value than the current value given in
- // POAPolicyValue, record an error.
- if ((prev != null) &&
- (getPOAPolicyValue( prev ) != POAPolicyValue))
- errorSet.set( i ) ;
- }
- }
-
- // Check for bad policy combinations
-
- // NON_RETAIN requires USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER
- if (!retainServants() && useActiveMapOnly() ) {
- addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value,
- errorSet ) ;
- addToErrorSet( policies, REQUEST_PROCESSING_POLICY_ID.value,
- errorSet ) ;
- }
-
- // IMPLICIT_ACTIVATION requires SYSTEM_ID and RETAIN
- if (isImplicitlyActivated()) {
- if (!retainServants()) {
- addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value,
- errorSet ) ;
- addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value,
- errorSet ) ;
- }
-
- if (!isSystemAssignedIds()) {
- addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value,
- errorSet ) ;
- addToErrorSet( policies, ID_ASSIGNMENT_POLICY_ID.value,
- errorSet ) ;
- }
- }
-
- checkForPolicyError( errorSet ) ;
- }
-
- public Policy get_effective_policy( int type )
- {
- Integer key = new Integer( type ) ;
- Policy result = (Policy)(policyMap.get(key)) ;
- return result ;
- }
-
- /* Thread Policies */
- public final boolean isOrbControlledThreads() {
- return getPolicyValue( THREAD_POLICY_ID.value ) ==
- ThreadPolicyValue._ORB_CTRL_MODEL;
- }
- public final boolean isSingleThreaded() {
- return getPolicyValue( THREAD_POLICY_ID.value ) ==
- ThreadPolicyValue._SINGLE_THREAD_MODEL;
- }
-
- /* Lifespan */
- public final boolean isTransient() {
- return getPolicyValue( LIFESPAN_POLICY_ID.value ) ==
- LifespanPolicyValue._TRANSIENT;
- }
- public final boolean isPersistent() {
- return getPolicyValue( LIFESPAN_POLICY_ID.value ) ==
- LifespanPolicyValue._PERSISTENT;
- }
-
- /* ID Uniqueness */
- public final boolean isUniqueIds() {
- return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) ==
- IdUniquenessPolicyValue._UNIQUE_ID;
- }
- public final boolean isMultipleIds() {
- return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) ==
- IdUniquenessPolicyValue._MULTIPLE_ID;
- }
-
- /* ID Assignment */
- public final boolean isUserAssignedIds() {
- return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) ==
- IdAssignmentPolicyValue._USER_ID;
- }
- public final boolean isSystemAssignedIds() {
- return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) ==
- IdAssignmentPolicyValue._SYSTEM_ID;
- }
-
- /* Servant Rentention */
- public final boolean retainServants() {
- return getPolicyValue( SERVANT_RETENTION_POLICY_ID.value ) ==
- ServantRetentionPolicyValue._RETAIN;
- }
-
- /* Request Processing */
- public final boolean useActiveMapOnly() {
- return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) ==
- RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY;
- }
- public final boolean useDefaultServant() {
- return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) ==
- RequestProcessingPolicyValue._USE_DEFAULT_SERVANT;
- }
- public final boolean useServantManager() {
- return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) ==
- RequestProcessingPolicyValue._USE_SERVANT_MANAGER;
- }
-
- /* Implicit Activation */
- public final boolean isImplicitlyActivated() {
- return getPolicyValue( IMPLICIT_ACTIVATION_POLICY_ID.value ) ==
- ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION;
- }
-
- /* proprietary servant caching policy */
- public final int servantCachingLevel()
- {
- Integer key = new Integer( ORBConstants.SERVANT_CACHING_POLICY ) ;
- ServantCachingPolicy policy = (ServantCachingPolicy)policyMap.get( key ) ;
- if (policy == null)
- return ServantCachingPolicy.NO_SERVANT_CACHING ;
- else
- return policy.getType() ;
- }
-
- public final boolean forceZeroPort()
- {
- Integer key = new Integer( ORBConstants.ZERO_PORT_POLICY ) ;
- ZeroPortPolicy policy = (ZeroPortPolicy)policyMap.get( key ) ;
- if (policy == null)
- return false ;
- else
- return policy.forceZeroPort() ;
- }
-
- public final int getCopierId()
- {
- Integer key = new Integer( ORBConstants.COPY_OBJECT_POLICY ) ;
- CopyObjectPolicy policy = (CopyObjectPolicy)policyMap.get( key ) ;
- if (policy != null)
- return policy.getValue() ;
- else
- return defaultObjectCopierFactoryId ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java 2018-01-30 20:18:46.000000000 -0500
+++ /dev/null 2018-01-30 20:18:46.000000000 -0500
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-public class RequestProcessingPolicyImpl
- extends org.omg.CORBA.LocalObject implements RequestProcessingPolicy {
-
- public RequestProcessingPolicyImpl(RequestProcessingPolicyValue
- value) {
- this.value = value;
- }
-
- public RequestProcessingPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return REQUEST_PROCESSING_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new RequestProcessingPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private RequestProcessingPolicyValue value;
-
- public String toString()
- {
- String type = null ;
- switch (value.value()) {
- case RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY :
- type = "USE_ACTIVE_OBJECT_MAP_ONLY" ;
- break ;
- case RequestProcessingPolicyValue._USE_DEFAULT_SERVANT :
- type = "USE_DEFAULT_SERVANT" ;
- break ;
- case RequestProcessingPolicyValue._USE_SERVANT_MANAGER :
- type = "USE_SERVANT_MANAGER" ;
- break ;
- }
-
- return "RequestProcessingPolicy[" + type + "]" ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java 2018-01-30 20:18:47.000000000 -0500
+++ /dev/null 2018-01-30 20:18:47.000000000 -0500
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class ServantRetentionPolicyImpl
- extends org.omg.CORBA.LocalObject implements ServantRetentionPolicy {
-
- public ServantRetentionPolicyImpl(ServantRetentionPolicyValue value) {
- this.value = value;
- }
-
- public ServantRetentionPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return SERVANT_RETENTION_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new ServantRetentionPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private ServantRetentionPolicyValue value;
-
- public String toString()
- {
- return "ServantRetentionPolicy[" +
- ((value.value() == ServantRetentionPolicyValue._RETAIN) ?
- "RETAIN" : "NON_RETAIN" + "]") ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java 2018-01-30 20:18:47.000000000 -0500
+++ /dev/null 2018-01-30 20:18:47.000000000 -0500
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.poa;
-
-import org.omg.CORBA.*;
-import org.omg.PortableServer.*;
-
-final class ThreadPolicyImpl
- extends org.omg.CORBA.LocalObject implements ThreadPolicy {
-
- public ThreadPolicyImpl(ThreadPolicyValue value) {
- this.value = value;
- }
-
- public ThreadPolicyValue value() {
- return value;
- }
-
- public int policy_type()
- {
- return THREAD_POLICY_ID.value ;
- }
-
- public Policy copy() {
- return new ThreadPolicyImpl(value);
- }
-
- public void destroy() {
- value = null;
- }
-
- private ThreadPolicyValue value;
-
- public String toString()
- {
- return "ThreadPolicy[" +
- ((value.value() == ThreadPolicyValue._SINGLE_THREAD_MODEL) ?
- "SINGLE_THREAD_MODEL" : "ORB_CTRL_MODEL" + "]") ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt 2018-01-30 20:18:48.000000000 -0500
+++ /dev/null 2018-01-30 20:18:48.000000000 -0500
@@ -1,61 +0,0 @@
-package @PKGNAME@ ;
-
-import org.omg.CORBA.OMGVMCID ;
-import org.omg.CORBA.CompletionStatus ;
-
-import org.omg.CORBA.@SYSEX@ ;
-
-public abstract class StandardException {
- // @SYSEX@ BAD_CONTEXT
-
- public void IdlContextNotFound( CompletionStatus completed )
- {
- throw new BAD_CONTEXT( "IDL context not found",
- OMGVMCID.value + 1, completed ) ;
- }
-
- public void IdlContextNotFound( )
- {
- IdlContextNotFound( CompletionStatus.COMPLETED_NO ) ;
- }
-
-Data structures: list[ ... ] vector[ ... ] ( record )
-
-list[ ( string{exception name} list[ ( string{code name} int{value} string{description} ] ) ]
-
-Processing:
-
-
- open file (fname)
- fr = new FileReader( fname )
- br = new BufferedReader( fr )
- br.readLine() returns null at EOF
-
- want a BufferedReader
-
- while not eol read line
- if (line start with spaces)
- add to current index
- else
- new exception
-
- create StandardException class
-
- foreach ( excname vec ) in data
- add import statement for execname to output
-
- foreach ( codename value descr ) in vec
- generate full method
- generate short method
-
-
-(define (read-file fname)
- (begin
- (let port (open-input-port fname))
- (let obj (read port))
- obj
- )
-)
-
-
-
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt 2018-01-30 20:18:49.000000000 -0500
+++ /dev/null 2018-01-30 20:18:49.000000000 -0500
@@ -1,160 +0,0 @@
-(
-(BAD_CONTEXT
- (IDL_CONTEXT_NOT_FOUND 1 "IDL context not found")
- (NO_MATCHING_IDL_CONTEXT 2 "No matching IDL context property")
-)
-(BAD_INV_ORDER
- (DEP_PREVENT_DESTRUCTION 1 "Dependency exists in IFR preventing destruction of this object")
- (DESTROY_INDESTRUCTIBLE 2 "Attempt to destroy indestructible objects in IFR")
- (OPERATION_DEADLOCK 3 "Operation would deadlock")
- (ORB_SHUTDOWN 4 "ORB has shutdown")
- (BAD_INVOKE 5 "Attempt to invoke send or invoke operation of the same Request object more than once ")
- (BAD_SET_SERVANT_MANAGER 6 "Attempt to set a servent manager after one has already been set")
- (BAD_ARGUMENTS_CALL 7 "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception")
- (BAD_CTX_CALL 8 "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception")
- (BAD_RESULT_CALL 9 "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception")
- (BAD_SEND 10 "Attempt to send a DII request after it was sent previously")
- (BAD_POLL_BEFORE 11 "Attempt to poll a DII request or to retrieve its result before the request was sent")
- (BAD_POLL_AFTER 12 "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously")
- (BAD_POLL_SYNC 13 "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request")
- (BAD_PI_CALL 14 "Invalid portable interceptor call")
- (BAD_PI_ADD_SERVICE_CONTEXT 15 "Service context add failed in portable interceptor because a service context with the given id already exists")
- (DUPLICATE_POLICY_FACTORY 16 "Registration of PolicyFactory failed because a factory already exists for the given PolicyType")
- (CREATE_POA_DESTROY 17 "POA cannot create POAs while undergoing destruction")
- (PRIORITY_REASSIGN 18 "Attempt to reassign priority")
- (XA_START_OUTSIZE 19 "An OTS/XA integration xa_start() call returned XAER_OUTSIDE")
- (XA_START_PROTO 20 "An OTS/XA integration xa_ call returned XAER_PROTO")
-)
-(BAD_OPERATION
- (BAD_SERVANT_MANAGER_TYPE 1 "ServantManager returned wrong servant type")
- (OPERATION_UNKNOWN_TO_TARGET 2 "Operation or attribute not known to target object ")
-)
-(BAD_PARAM
- (VALUE_FACTORY_REG_ERROR 1 "Failure to register, unregister or lookup value factory")
- (RID_ALREADY_DEFINED 2 "RID already defined in IFR")
- (NAME_USED_IFR 3 "Name already used in the context in IFR ")
- (TARGET_NOT_CONTAINER 4 "Target is not a valid container")
- (NAME_CLASH 5 "Name clash in inherited context")
- (BAD_ABSTRACT_INTERFACE_TYPE 6 "Incorrect type for abstract interface")
- (SO_BAD_SCHEME_NAME 7 "string_to_object conversion failed due to bad scheme name")
- (SO_BAD_ADDRESS 8 "string_to_object conversion failed due to bad address")
- (SO_BAD_SCHEMA_SPECIFIC 9 "string_to_object conversion failed due to bad bad schema specific part")
- (SO_NON_SPECIFIC 10 "string_to_object conversion failed due to non specific reason")
- (IR_DERIVE_ABS_INT_BASE 11 "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository")
- (IR_VALUE_SUPPORT 12 "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository")
- (INCOMPLETE_TYPECODE 13 "Attempt to use an incomplete TypeCode as a parameter")
- (INVALID_OBJECT_ID 14 "Invalid object id passed to POA::create_reference_by_id ")
- (TYPECODE_BAD_NAME 15 "Bad name argument in TypeCode operation")
- (TYPECODE_BAD_REPID 16 "Bad RepositoryId argument in TypeCode operation")
- (TYPECODE_INV_MEMBER 17 "Invalid member name in TypeCode operation ")
- (TC_UNION_DUP_LABEL 18 "Duplicate label value in create_union_tc ")
- (TC_UNION_INCOMPATIBLE 19 "Incompatible TypeCode of label and discriminator in create_union_tc ")
- (TC_UNION_BAD_DISC 20 "Supplied discriminator type illegitimate in create_union_tc ")
- (SET_EXCEPTION_BAD_ANY 21 "Any passed to ServerRequest::set_exception does not contain an exception ")
- (SET_EXCEPTION_UNLISTED 22 "Unlisted user exception passed to ServerRequest::set_exception ")
- (NO_WCHAR_CODE_SET 23 "wchar transmission code set not in service context")
- (ILLEGAL_SERVICE_CONTEXT 24 "Service context is not in OMG-defined range")
- (ENUM_OUT_OF_RANGE 25 "Enum value out of range")
- (PI_BAD_SERVICE_CONTEXT 26 "Invalid service context Id in portable interceptor")
- (REG_INITIAL_NULL 27 "Attempt to call register_initial_reference with a null Object")
- (PI_INV_COMPONENT_ID 28 "Invalid component Id in portable interceptor")
- (PI_INV_PROFILE_ID 29 "Invalid profile Id in portable interceptor")
- (POLICY_TYPE_DUPLICATE 30 "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides")
- (BAD_ONEWAY_DEFINITION 31 "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions")
- (DII_FOR_IMPLICIT_OPERATION 32 "DII asked to create request for an implicit operation")
- (XA_CALL_INVAL 33 "An OTS/XA integration xa_ call returned XAER_INVAL")
- (UNION_BAD_DISCRIMINATOR 34 "Union branch modifier method called with bad case label discriminator")
- (CTX_ILLEGAL_PROPERTY_NAME 35 "Illegal IDL context property name")
- (CTX_ILLEGAL_SEARCH_STRING 36 "Illegal IDL property search string")
- (CTX_ILLEGAL_NAME 37 "Illegal IDL context name")
- (CTX_NON_EMPTY 38 "Non-empty IDL context")
- (RMI_STREAM_FORMAT 39 "Unsupported RMI/IDL custom value type stream format")
- (OUTPUT_STREAM_NOT_VALUE 40 "ORB output stream does not support ValueOutputStream interface")
- (INPUT_STREAM_NOT_VALUE 41 "ORB input stream does not support ValueInputStream interface")
-)
-(BAD_TYPECODE
- (MARSHALL_INCOMPLETE_TYPECODE 1 "Attempt to marshal incomplete TypeCode")
- (BAD_MEMBER_TYPECODE 2 "Member type code illegitimate in TypeCode operation")
- (ILLEGAL_PARAMETER 3 "Illegal parameter type")
-)
-(DATA_CONVERSION
- (CHAR_NOT_MAP_TCS 1 "Character does not map to negotiated transmission code set")
- (PRIORITY_MAP_FAILRE 2 "Failure of PriorityMapping object")
-)
-(IMP_LIMIT
- (NO_USABLE_PROFILE 1 "Unable to use any profile in IOR")
-)
-(INITIALIZE
- (PRIORITY_RANGE_RESTRICT 1 "Priority range too restricted for ORB")
-)
-(INV_OBJREF
- (NO_WCHAR_CODE_SET 1 "wchar Code Set support not specified")
- (CODESET_COMPONENT_REQUIRED 2 "Codeset component required for type using wchar or wstring data")
-)
-(INV_POLICY
- (IOR_POLICY_RECONCILE_ERROR 1 "Unable to reconcile IOR specified policy with effective policy override")
- (INVALID_POLICY_TYPE 2 "Invalid PolicyType")
- (NO_POLICY_FACTORY 3 "No PolicyFactory has been registered for the given PolicyType")
-)
-(INTERNAL
- (XA_RMERR 1 "An OTS/XA integration xa_ call returned XAER_RMERR")
- (XA_RMFAIL 2 "An OTS/XA integration xa_ call returned XAER_RMFAIL")
-)
-(INTF_REPOS
- (NO_IR 1 "Interface Repository not available")
- (NO_INTERFACE_IN_IR 2 "No entry for requested interface in Interface Repository")
-)
-(MARSHAL
- (NO_VALUE_FACTORY 1 "Unable to locate value factory")
- (SET_RESULT_BEFORE_CTX 2 "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause ")
- (BAD_NVLIST 3 "NVList passed to ServerRequest::arguments does not describe all parameters passed by client")
- (MARSHAL_LOCAL_OBJECT 4 "Attempt to marshal Local object")
- (WCHAR_BAD_GIOP_VERSION_SENT 5 "wchar or wstring data erroneosly sent by client over GIOP 1.0 connection ")
- (WCHAR_BAD_GIOP_VERSION_RETURNED 6 "wchar or wstring data erroneously returned by server over GIOP 1.0 connection ")
- (RMI_STREAM_FORMAT_2 7 "Unsupported RMI/IDL custom value type stream "format
-)
-(NO_IMPLEMENT
- (NO_LOCAL_VALUE_IMPLEMENTATION 1 "Missing local value implementation")
- (INCOMPAT_VALUE_IMPLEMENTATION 2 "Incompatible value implementation version")
- (NO_USABLE_PROFILE_2 3 "Unable to use any profile in IOR")
- (DII_LOCAL_OBJECT 4 "Attempt to use DII on Local object")
- (BIO_RESET 5 "Biomolecular Sequence Analysis iterator cannot be reset")
- (BIO_NOT_AVAILABLE 6 "Biomolecular Sequence Analysis metadata is not available as XML")
- (BIO_GENOMIC_NO_ITERATOR 7 "Genomic Maps iterator cannot be reset")
-)
-(NO_RESOURCES
- (PI_OPERATION_NOT_SUPPORTED 1 "Portable Interceptor operation not supported in this binding")
- (NO_CONNECTION_PRIORITY 2 "No connection for request's priority")
-)
-(TRANSACTION_ROLLEDBACK
- (XA_RB 1 "An OTS/XA integration xa_ call returned XAER_RB")
- (XA_NOTA 2 "An OTS/XA integration xa_ call returned XAER_NOTA")
- (XA_END_TRUE_ROLLBACK_DEFERRED 3 "OTS/XA integration end() was called with success set to TRUE while transaction rollback was deferred")
-)
-(TRANSIENT
- (POA_REQUEST_DISCARD 1 "Request discarded because of resource exhaustion in POA or because POA is in DISCARDING state")
- (NO_USABLE_PROFILE_3 2 "No usable profile in IOR")
- (REQUEST_CANCELLED 3 "Request cancelled")
- (POA_DESTROYED 4 "POA destroyed")
-)
-(OBJECT_NOT_EXIST
- "(UNREGISTERED_VALUE_AS_OBJREF 1 Attempt to pass an unactivated (unregistered) value as an object reference")
- (NO_OBJECT_ADAPTOR 2 "Failed to create or locate Object Adaptor")
- (BIO_NOT_AVAILABLE 3 "Biomolecular Sequence Analysis Service is no longer available")
- (OBJECT_ADAPTER_INACTIVE 4 "Object Adapter Inactive")
-)
-(OBJ_ADAPTER
- (UNKNOWN_ADAPTER_SYS_EXCEPTION 1 "System exception in POA::unknown_adapter")
- (BAD_SERVANT_TYPE 2 "Incorrect servant type returned by servant manager ")
- (NO_DEFAULT_SERVANT 3 "No default servant available [POA policy"])
- (NO_SERVANT_MANAGER 4 "No servant manager available [POA Policy"])
- (BAD_POLICY_INCARNATE 5 "Violation of POA policy by ServantActivator::incarnate")
- (PI_EXC_COMP_ESTABLISHED 6 "Exception in PortableInterceptor::IORInterceptor.components_established")
- (NULL_SERVANT_RETURNED 7 "Null servant returned by servant manager")
-)
-(UNKNOWN
- (UNLISTED_EXCEPTION_RECEIVED 1 "Unlisted user exception received by client ")
- (UNSUPPORTED_SYSTEM_EXCEPTION 2 "Non-standard System Exception not supported")
- (PI_UNKNOWN_USER_EXCEPTION 3 "An unknown user exception received by a portable interceptor")
-)
-)
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java 2018-01-30 20:18:49.000000000 -0500
+++ /dev/null 2018-01-30 20:18:49.000000000 -0500
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.toa ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-/** The Transient Object Adapter is used for standard RMI-IIOP and Java-IDL
- * (legacy JDK 1.2) object implementations. Its protocol for managing objects is very
- * simple: just connect and disconnect. There is only a single TOA instance per ORB,
- * and its lifetime is the same as the ORB. The TOA instance is always ready to receive
- * messages except when the ORB is shutting down.
- */
-public interface TOA extends ObjectAdapter {
- /** Connect the given servant to the ORB by allocating a transient object key
- * and creating an IOR and object reference using the current factory.
- */
- void connect( org.omg.CORBA.Object servant ) ;
-
- /** Disconnect the object from this ORB.
- */
- void disconnect( org.omg.CORBA.Object obj ) ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java 2018-01-30 20:18:50.000000000 -0500
+++ /dev/null 2018-01-30 20:18:50.000000000 -0500
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.toa ;
-
-import java.util.Map ;
-import java.util.HashMap ;
-
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.CompletionStatus ;
-
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.ior.ObjectAdapterId ;
-
-import com.sun.corba.se.impl.oa.toa.TOAImpl ;
-import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
-
-import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
-
-import com.sun.corba.se.impl.ior.ObjectKeyTemplateBase ;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class TOAFactory implements ObjectAdapterFactory
-{
- private ORB orb ;
- private ORBUtilSystemException wrapper ;
-
- private TOAImpl toa ;
- private Map codebaseToTOA ;
- private TransientObjectManager tom ;
-
- public ObjectAdapter find ( ObjectAdapterId oaid )
- {
- if (oaid.equals( ObjectKeyTemplateBase.JIDL_OAID ) )
- // Return the dispatch-only TOA, which can dispatch
- // request for objects created by any TOA.
- return getTOA() ;
- else
- throw wrapper.badToaOaid() ;
- }
-
- public void init( ORB orb )
- {
- this.orb = orb ;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.OA_LIFECYCLE ) ;
- tom = new TransientObjectManager( orb ) ;
- codebaseToTOA = new HashMap() ;
- }
-
- public void shutdown( boolean waitForCompletion )
- {
- if (Util.isInstanceDefined()) {
- Util.getInstance().unregisterTargetsForORB(orb);
- }
- }
-
- public synchronized TOA getTOA( String codebase )
- {
- TOA toa = (TOA)(codebaseToTOA.get( codebase )) ;
- if (toa == null) {
- toa = new TOAImpl( orb, tom, codebase ) ;
-
- codebaseToTOA.put( codebase, toa ) ;
- }
-
- return toa ;
- }
-
- public synchronized TOA getTOA()
- {
- if (toa == null)
- // The dispatch-only TOA is not used for creating
- // objrefs, so its codebase can be null (and must
- // be, since we do not have a servant at this point)
- toa = new TOAImpl( orb, tom, null ) ;
-
- return toa ;
- }
-
- public ORB getORB()
- {
- return orb ;
- }
-} ;
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java 2018-01-30 20:18:51.000000000 -0500
+++ /dev/null 2018-01-30 20:18:51.000000000 -0500
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.oa.toa ;
-
-import org.omg.CORBA.Policy ;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
-import org.omg.PortableInterceptor.ObjectReferenceFactory ;
-import org.omg.PortableInterceptor.ACTIVE;
-import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ;
-
-import com.sun.corba.se.pept.protocol.ClientDelegate ;
-
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-import com.sun.corba.se.spi.copyobject.ObjectCopier ;
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-import com.sun.corba.se.spi.oa.OAInvocationInfo ;
-import com.sun.corba.se.spi.oa.OADestroyed ;
-import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
-import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
-
-import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
-import com.sun.corba.se.impl.oa.NullServantImpl;
-import com.sun.corba.se.impl.oa.poa.Policies;
-import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ;
-
-/** The Transient Object Adapter (TOA) represents the OA for purely transient
-* objects. It is used for standard RMI-IIOP as well as backwards compatible
-* server support (i.e. the ORB.connect() method)
-* Its characteristics include:
-*
-* - There is only one OA instance of the TOA. Its OAId is { "TOA" }
-* - There is not adapter manager. The TOA manager ID is fixed.
-* - State is the same as ORB state (TBD)
-*
-* Other requirements:
-*
-* - All object adapters must invoke ORB.adapterCreated when they are created.
-*
-* - All adapter managers must invoke ORB.adapterManagerStateChanged when
-* their state changes, mapping the internal state to an ORT state.
-* - AdapterStateChanged must be invoked (from somewhere) whenever
-* an adapter state changes that is not due to an adapter manager state change.
-*
-*/
-public class TOAImpl extends ObjectAdapterBase implements TOA
-{
- private TransientObjectManager servants ;
-
- public TOAImpl( ORB orb, TransientObjectManager tom, String codebase )
- {
- super( orb ) ;
- servants = tom ;
-
- // Make the object key template
- int serverid = ((ORB)getORB()).getTransientServerId();
- int scid = ORBConstants.TOA_SCID ;
-
- ObjectKeyTemplate oktemp = new JIDLObjectKeyTemplate( orb, scid, serverid ) ;
-
- // REVISIT - POA specific
- Policies policies = Policies.defaultPolicies;
-
- // REVISIT - absorb codebase into a policy
- initializeTemplate( oktemp, true,
- policies,
- codebase,
- null, // manager id
- oktemp.getObjectAdapterId()
- ) ;
- }
-
- // Methods required for dispatching requests
-
- public ObjectCopierFactory getObjectCopierFactory()
- {
- CopierManager cm = getORB().getCopierManager() ;
- return cm.getDefaultObjectCopierFactory() ;
- }
-
- public org.omg.CORBA.Object getLocalServant( byte[] objectId )
- {
- return (org.omg.CORBA.Object)(servants.lookupServant( objectId ) ) ;
- }
-
- /** Get the servant for the request given by the parameters.
- * This will update thread Current, so that subsequent calls to
- * returnServant and removeCurrent from the same thread are for the
- * same request.
- * @param info is the request containing the rest of the request
- */
- public void getInvocationServant( OAInvocationInfo info )
- {
- java.lang.Object servant = servants.lookupServant( info.id() ) ;
- if (servant == null)
- // This is expected to result in an RMI-IIOP NoSuchObjectException.
- // See bug 4973160.
- servant = new NullServantImpl( lifecycleWrapper().nullServant() ) ;
- info.setServant( servant ) ;
- }
-
- public void returnServant()
- {
- // NO-OP
- }
-
- /** Return the most derived interface for the given servant and objectId.
- */
- public String[] getInterfaces( Object servant, byte[] objectId )
- {
- return StubAdapter.getTypeIds( servant ) ;
- }
-
- // XXX For now, this does nothing.
- // This will need fixing once we support ORB and thread level policies,
- // but for now, there is no way to associate policies with the TOA, so
- // getEffectivePolicy must always return null.
- public Policy getEffectivePolicy( int type )
- {
- return null ;
- }
-
- public int getManagerId()
- {
- return -1 ;
- }
-
- public short getState()
- {
- return ACTIVE.value ;
- }
-
- public void enter() throws OADestroyed
- {
- }
-
- public void exit()
- {
- }
-
- // Methods unique to the TOA
-
- public void connect( org.omg.CORBA.Object objref)
- {
- // Store the objref and get a userkey allocated by the transient
- // object manager.
- byte[] key = servants.storeServant(objref, null);
-
- // Find out the repository ID for this objref.
- String id = StubAdapter.getTypeIds( objref )[0] ;
-
- // Create the new objref
- ObjectReferenceFactory orf = getCurrentFactory() ;
- org.omg.CORBA.Object obj = orf.make_object( id, key ) ;
-
- // Copy the delegate from the new objref to the argument
- // XXX handle the case of an attempt to connect a local object.
-
- org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(
- obj ) ;
- CorbaContactInfoList ccil = (CorbaContactInfoList)
- ((ClientDelegate)delegate).getContactInfoList() ;
- LocalClientRequestDispatcher lcs =
- ccil.getLocalClientRequestDispatcher() ;
-
- if (lcs instanceof JIDLLocalCRDImpl) {
- JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ;
- jlcs.setServant( objref ) ;
- } else {
- throw new RuntimeException(
- "TOAImpl.connect can not be called on " + lcs ) ;
- }
-
- StubAdapter.setDelegate( objref, delegate ) ;
- }
-
- public void disconnect( org.omg.CORBA.Object objref )
- {
- // Get the delegate, then ior, then transientKey, then delete servant
- org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
- objref ) ;
- CorbaContactInfoList ccil = (CorbaContactInfoList)
- ((ClientDelegate)del).getContactInfoList() ;
- LocalClientRequestDispatcher lcs =
- ccil.getLocalClientRequestDispatcher() ;
-
- if (lcs instanceof JIDLLocalCRDImpl) {
- JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ;
- byte[] oid = jlcs.getObjectId() ;
- servants.deleteServant(oid);
- jlcs.unexport() ;
- } else {
- throw new RuntimeException(
- "TOAImpl.disconnect can not be called on " + lcs ) ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java 2018-01-30 20:18:51.000000000 -0500
+++ /dev/null 2018-01-30 20:18:51.000000000 -0500
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.oa.toa;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-import com.sun.corba.se.spi.orb.ORB ;
-
-public final class TransientObjectManager {
- private ORB orb ;
- private int maxSize = 128;
- private Element[] elementArray;
- private Element freeList;
-
- void dprint( String msg ) {
- ORBUtility.dprint( this, msg ) ;
- }
-
- public TransientObjectManager( ORB orb )
- {
- this.orb = orb ;
-
- elementArray = new Element[maxSize];
- elementArray[maxSize-1] = new Element(maxSize-1,null);
- for ( int i=maxSize-2; i>=0; i-- )
- elementArray[i] = new Element(i,elementArray[i+1]);
- freeList = elementArray[0];
- }
-
- public synchronized byte[] storeServant(java.lang.Object servant, java.lang.Object servantData)
- {
- if ( freeList == null )
- doubleSize();
-
- Element elem = freeList;
- freeList = (Element)freeList.servant;
-
- byte[] result = elem.getKey(servant, servantData);
- if (orb.transientObjectManagerDebugFlag)
- dprint( "storeServant returns key for element " + elem ) ;
- return result ;
- }
-
- public synchronized java.lang.Object lookupServant(byte transientKey[])
- {
- int index = ORBUtility.bytesToInt(transientKey,0);
- int counter = ORBUtility.bytesToInt(transientKey,4);
-
- if (orb.transientObjectManagerDebugFlag)
- dprint( "lookupServant called with index=" + index + ", counter=" + counter ) ;
-
- if (elementArray[index].counter == counter &&
- elementArray[index].valid ) {
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is valid" ) ;
- return elementArray[index].servant;
- }
-
- // servant not found
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is invalid" ) ;
- return null;
- }
-
- public synchronized java.lang.Object lookupServantData(byte transientKey[])
- {
- int index = ORBUtility.bytesToInt(transientKey,0);
- int counter = ORBUtility.bytesToInt(transientKey,4);
-
- if (orb.transientObjectManagerDebugFlag)
- dprint( "lookupServantData called with index=" + index + ", counter=" + counter ) ;
-
- if (elementArray[index].counter == counter &&
- elementArray[index].valid ) {
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is valid" ) ;
- return elementArray[index].servantData;
- }
-
- // servant not found
- if (orb.transientObjectManagerDebugFlag)
- dprint( "\tcounter is invalid" ) ;
- return null;
- }
-
- public synchronized void deleteServant(byte transientKey[])
- {
- int index = ORBUtility.bytesToInt(transientKey,0);
- if (orb.transientObjectManagerDebugFlag)
- dprint( "deleting servant at index=" + index ) ;
-
- elementArray[index].delete(freeList);
- freeList = elementArray[index];
- }
-
- public synchronized byte[] getKey(java.lang.Object servant)
- {
- for ( int i=0; i=oldSize; i-- )
- elementArray[i] = new Element(i,elementArray[i+1]);
- freeList = elementArray[oldSize];
- }
-}
-
-
-final class Element {
- java.lang.Object servant=null; // also stores "next pointer" in free list
- java.lang.Object servantData=null;
- int index=-1;
- int counter=0;
- boolean valid=false; // valid=true if this Element contains
- // a valid servant
-
- Element(int i, java.lang.Object next)
- {
- servant = next;
- index = i;
- }
-
- byte[] getKey(java.lang.Object servant, java.lang.Object servantData)
- {
- this.servant = servant;
- this.servantData = servantData;
- this.valid = true;
-
- return toBytes();
- }
-
- byte[] toBytes()
- {
- // Convert the index+counter into an 8-byte (big-endian) key.
-
- byte key[] = new byte[8];
- ORBUtility.intToBytes(index, key, 0);
- ORBUtility.intToBytes(counter, key, 4);
-
- return key;
- }
-
- void delete(Element freeList)
- {
- if ( !valid ) // prevent double deletion
- return;
- counter++;
- servantData = null;
- valid = false;
-
- // add this to freeList
- servant = freeList;
- }
-
- public String toString()
- {
- return "Element[" + index + ", " + counter + "]" ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java 2018-01-30 20:18:52.000000000 -0500
+++ /dev/null 2018-01-30 20:18:52.000000000 -0500
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.applet.Applet ;
-import java.util.Properties ;
-
-public class AppletDataCollector extends DataCollectorBase {
- private Applet applet ;
-
- AppletDataCollector( Applet app, Properties props, String localHostName,
- String configurationHostName )
- {
- super( props, localHostName, configurationHostName ) ;
- this.applet = app ;
- }
-
- public boolean isApplet()
- {
- return true ;
- }
-
- protected void collect( )
- {
- checkPropertyDefaults() ;
-
- findPropertiesFromFile() ;
-
- // We do not use system properties for applets in order to
- // avoid security exceptions.
-
- findPropertiesFromProperties() ;
- findPropertiesFromApplet( applet ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java 2018-01-30 20:18:53.000000000 -0500
+++ /dev/null 2018-01-30 20:18:53.000000000 -0500
@@ -1,473 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import com.sun.corba.se.impl.orbutil.GetPropertyAction ;
-
-import java.security.PrivilegedAction ;
-import java.security.AccessController ;
-
-import java.applet.Applet ;
-
-import java.util.Properties ;
-import java.util.Vector ;
-import java.util.Set ;
-import java.util.HashSet ;
-import java.util.Enumeration ;
-import java.util.Iterator ;
-import java.util.StringTokenizer ;
-
-import java.net.URL ;
-
-import java.security.AccessController ;
-
-import java.io.File ;
-import java.io.FileInputStream ;
-
-import com.sun.corba.se.spi.orb.DataCollector ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-
-public abstract class DataCollectorBase implements DataCollector {
- private PropertyParser parser ;
- private Set propertyNames ;
- private Set propertyPrefixes ;
- private Set URLPropertyNames ;
- protected String localHostName ;
- protected String configurationHostName ;
- private boolean setParserCalled ;
- private Properties originalProps ;
- private Properties resultProps ;
-
- public DataCollectorBase( Properties props, String localHostName,
- String configurationHostName )
- {
- // XXX This is fully initialized here. So do we ever want to
- // generalize this (or perhaps this is the wrong place for this?)
- URLPropertyNames = new HashSet() ;
- URLPropertyNames.add( ORBConstants.INITIAL_SERVICES_PROPERTY ) ;
-
- propertyNames = new HashSet() ;
-
- // Make sure that we are ready to handle -ORBInitRef. This is special
- // due to the need to handle multiple -ORBInitRef args as prefix
- // parsing.
- propertyNames.add( ORBConstants.ORB_INIT_REF_PROPERTY ) ;
-
- propertyPrefixes = new HashSet() ;
-
- this.originalProps = props ;
- this.localHostName = localHostName ;
- this.configurationHostName = configurationHostName ;
- setParserCalled = false ;
- resultProps = new Properties() ;
- }
-
-//////////////////////////////////////////////////////////
-// Public interface defined in DataCollector
-//////////////////////////////////////////////////////////
-
- public boolean initialHostIsLocal()
- {
- checkSetParserCalled() ;
- return localHostName.equals( resultProps.getProperty(
- ORBConstants.INITIAL_HOST_PROPERTY ) ) ;
- }
-
- public void setParser( PropertyParser parser )
- {
- Iterator iter = parser.iterator() ;
- while (iter.hasNext()) {
- ParserAction pa = (ParserAction)(iter.next()) ;
- if (pa.isPrefix())
- propertyPrefixes.add( pa.getPropertyName() ) ;
- else
- propertyNames.add( pa.getPropertyName() ) ;
- }
-
- collect() ;
- setParserCalled = true ;
- }
-
- public Properties getProperties()
- {
- checkSetParserCalled() ;
- return resultProps ;
- }
-
-//////////////////////////////////////////////////////////
-// public interface from DataCollector that must be defined
-// in subclasses
-//////////////////////////////////////////////////////////
-
- public abstract boolean isApplet() ;
-
-//////////////////////////////////////////////////////////
-// Implementation methods needed in subclasses
-//////////////////////////////////////////////////////////
-
- protected abstract void collect() ;
-
-//////////////////////////////////////////////////////////
-// methods for use by subclasses
-//////////////////////////////////////////////////////////
-
- protected void checkPropertyDefaults()
- {
- String host =
- resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
-
- if ((host == null) || (host.equals("")))
- setProperty( ORBConstants.INITIAL_HOST_PROPERTY,
- configurationHostName );
-
- String serverHost =
- resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ;
-
- if (serverHost == null ||
- serverHost.equals("") ||
- serverHost.equals("0.0.0.0") ||
- serverHost.equals("::") ||
- serverHost.toLowerCase().equals("::ffff:0.0.0.0"))
- {
- setProperty(ORBConstants.SERVER_HOST_PROPERTY,
- localHostName);
- setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES,
- ORBConstants.LISTEN_ON_ALL_INTERFACES);
- }
- }
-
- protected void findPropertiesFromArgs( String[] params )
- {
- if (params == null)
- return;
-
- // All command-line args are of the form "-ORBkey value".
- // The key is mapped to .ORBkey.
-
- String name ;
- String value ;
-
- for ( int i=0; i=
- StringTokenizer st = new StringTokenizer( value, "=" ) ;
- if (st.countTokens() != 2)
- throw new IllegalArgumentException() ;
-
- String refName = st.nextToken() ;
- String refValue = st.nextToken() ;
-
- resultProps.setProperty( name + "." + refName, refValue ) ;
- } else {
- resultProps.setProperty( name, value ) ;
- }
- }
-
- private void checkSetParserCalled()
- {
- if (!setParserCalled)
- throw new IllegalStateException( "setParser not called." ) ;
- }
-
- // For each prefix in prefixes, For each name in propertyNames,
- // if (prefix is a prefix of name) get value from getProperties and
- // setProperty (name, value).
- private void findPropertiesByPrefix( Set prefixes,
- Iterator propertyNames, PropertyCallback getProperty )
- {
- while (propertyNames.hasNext()) {
- String name = (String)(propertyNames.next()) ;
- Iterator iter = prefixes.iterator() ;
- while (iter.hasNext()) {
- String prefix = (String)(iter.next()) ;
- if (name.startsWith( prefix )) {
- String value = getProperty.get( name ) ;
-
- // Note: do a put even if value is null since just
- // the presence of the property may be significant.
- setProperty( name, value ) ;
- }
- }
- }
- }
-
- // For each prefix in names, get the corresponding property
- // value from the callback, and store the name/value pair in
- // the result.
- private void findPropertiesByName( Iterator names,
- PropertyCallback getProperty )
- {
- while (names.hasNext()) {
- String name = (String)(names.next()) ;
- String value = getProperty.get( name ) ;
- if (value != null)
- setProperty( name, value ) ;
- }
- }
-
- private static String getSystemProperty(final String name)
- {
- return (String)AccessController.doPrivileged(
- new GetPropertyAction(name));
- }
-
- // Map command-line arguments to ORB properties.
- //
- private String findMatchingPropertyName( Set names,
- String suffix )
- {
- Iterator iter = names.iterator() ;
- while (iter.hasNext()) {
- String name = (String)(iter.next()) ;
- if (name.endsWith( suffix ))
- return name ;
- }
-
- return null ;
- }
-
- private static Iterator makeIterator( final Enumeration enumeration )
- {
- return new Iterator() {
- public boolean hasNext() { return enumeration.hasMoreElements() ; }
- public Object next() { return enumeration.nextElement() ; }
- public void remove() { throw new UnsupportedOperationException() ; }
- } ;
- }
-
- private static Iterator getSystemPropertyNames()
- {
- // This will not throw a SecurityException because this
- // class was loaded from rt.jar using the bootstrap classloader.
- Enumeration enumeration = (Enumeration)
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public java.lang.Object run() {
- return System.getProperties().propertyNames();
- }
- }
- );
-
- return makeIterator( enumeration ) ;
- }
-
- private void getPropertiesFromFile( Properties props, String fileName )
- {
- try {
- File file = new File( fileName ) ;
- if (!file.exists())
- return ;
-
- FileInputStream in = new FileInputStream( file ) ;
-
- try {
- props.load( in ) ;
- } finally {
- in.close() ;
- }
- } catch (Exception exc) {
- // if (ORBInitDebug)
- // dprint( "ORB properties file " + fileName + " not found: " +
- // exc) ;
- }
- }
-
- private Properties getFileProperties()
- {
- Properties defaults = new Properties() ;
-
- String javaHome = getSystemProperty( "java.home" ) ;
- String fileName = javaHome + File.separator + "lib" + File.separator +
- "orb.properties" ;
-
- getPropertiesFromFile( defaults, fileName ) ;
-
- Properties results = new Properties( defaults ) ;
-
- String userHome = getSystemProperty( "user.home" ) ;
- fileName = userHome + File.separator + "orb.properties" ;
-
- getPropertiesFromFile( results, fileName ) ;
- return results ;
- }
-
- private boolean hasCORBAPrefix( String prefix )
- {
- return prefix.startsWith( ORBConstants.ORG_OMG_PREFIX ) ||
- prefix.startsWith( ORBConstants.SUN_PREFIX ) ||
- prefix.startsWith( ORBConstants.SUN_LC_PREFIX ) ||
- prefix.startsWith( ORBConstants.SUN_LC_VERSION_PREFIX ) ;
- }
-
- // Return only those element of prefixes for which hasCORBAPrefix
- // is true.
- private Set getCORBAPrefixes( final Set prefixes )
- {
- Set result = new HashSet() ;
- Iterator iter = prefixes.iterator() ;
- while (iter.hasNext()) {
- String element = (String)(iter.next()) ;
- if (hasCORBAPrefix( element ))
- result.add( element ) ;
- }
-
- return result ;
- }
-}
-
-// Used to collect properties from various sources.
-abstract class PropertyCallback
-{
- abstract public String get(String name);
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java 2018-01-30 20:18:53.000000000 -0500
+++ /dev/null 2018-01-30 20:18:53.000000000 -0500
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.applet.Applet ;
-import java.util.Properties ;
-import java.net.URL ;
-
-import com.sun.corba.se.spi.orb.DataCollector ;
-
-public abstract class DataCollectorFactory {
- private DataCollectorFactory() {}
-
- public static DataCollector create( Applet app, Properties props,
- String localHostName )
- {
- String appletHost = localHostName ;
-
- if (app != null) {
- URL appletCodeBase = app.getCodeBase() ;
-
- if (appletCodeBase != null)
- appletHost = appletCodeBase.getHost() ;
- }
-
- return new AppletDataCollector( app, props, localHostName,
- appletHost ) ;
- }
-
- public static DataCollector create( String[] args, Properties props,
- String localHostName )
- {
- return new NormalDataCollector( args, props, localHostName,
- localHostName ) ;
- }
-
- public static DataCollector create( Properties props,
- String localHostName )
- {
- return new PropertyOnlyDataCollector( props, localHostName,
- localHostName ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java 2018-01-30 20:18:54.000000000 -0500
+++ /dev/null 2018-01-30 20:18:54.000000000 -0500
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.net.InetAddress ;
-
-import java.util.Properties ;
-
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.CompletionStatus ;
-
-public class NormalDataCollector extends DataCollectorBase {
- private String[] args ;
-
- public NormalDataCollector( String[] args, Properties props,
- String localHostName, String configurationHostName )
- {
- super( props, localHostName, configurationHostName ) ;
- this.args = args ;
- }
-
- public boolean isApplet()
- {
- return false ;
- }
-
- protected void collect()
- {
- checkPropertyDefaults() ;
-
- findPropertiesFromFile() ;
- findPropertiesFromSystem() ;
- findPropertiesFromProperties() ;
- findPropertiesFromArgs( args ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java 2018-01-30 20:18:55.000000000 -0500
+++ /dev/null 2018-01-30 20:18:55.000000000 -0500
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-
-public class NormalParserAction extends ParserActionBase {
- public NormalParserAction( String propertyName,
- Operation operation, String fieldName )
- {
- super( propertyName, false, operation, fieldName ) ;
- }
-
- /** Create a String[] of all suffixes of property names that
- * match the propertyName prefix, pass this to op, and return the
- * result.
- */
- public Object apply( Properties props )
- {
- Object value = props.getProperty( getPropertyName() ) ;
- if (value != null)
- return getOperation().operate( value ) ;
- else
- return null ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java 2018-01-30 20:18:55.000000000 -0500
+++ /dev/null 2018-01-30 20:18:55.000000000 -0500
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-
-public class NormalParserData extends ParserDataBase {
- private String testData ;
-
- public NormalParserData( String propertyName,
- Operation operation, String fieldName, Object defaultValue,
- Object testValue, String testData )
- {
- super( propertyName, operation, fieldName, defaultValue, testValue ) ;
- this.testData = testData ;
- }
- public void addToParser( PropertyParser parser )
- {
- parser.add( getPropertyName(), getOperation(), getFieldName() ) ;
- }
-
- public void addToProperties( Properties props )
- {
- props.setProperty( getPropertyName(), testData ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java 2018-01-30 20:18:56.000000000 -0500
+++ /dev/null 2018-01-30 20:18:56.000000000 -0500
@@ -1,628 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.InetAddress ;
-import java.security.PrivilegedAction ;
-import java.security.PrivilegedExceptionAction ;
-import java.security.AccessController ;
-import java.util.Collection ;
-import java.util.Iterator ;
-
-import org.omg.CORBA.CompletionStatus ;
-import org.omg.CORBA.portable.ValueFactory ;
-
-import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ;
-import com.sun.corba.se.pept.transport.Acceptor;
-
-import com.sun.corba.se.spi.activation.Locator ;
-import com.sun.corba.se.spi.activation.Activator ;
-import com.sun.corba.se.spi.activation.LocatorHelper ;
-import com.sun.corba.se.spi.activation.ActivatorHelper ;
-import com.sun.corba.se.spi.activation.EndPointInfo ;
-
-import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
-import com.sun.corba.se.spi.copyobject.CopyobjectDefaults ;
-import com.sun.corba.se.spi.copyobject.CopierManager ;
-
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IORFactories ;
-
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
-
-import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.spi.oa.OADefault ;
-import com.sun.corba.se.spi.oa.ObjectAdapter ;
-import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.OperationFactory ;
-import com.sun.corba.se.spi.orb.ORBData ;
-import com.sun.corba.se.spi.orb.DataCollector ;
-import com.sun.corba.se.spi.orb.ORBConfigurator ;
-import com.sun.corba.se.spi.orb.ParserImplBase ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-import com.sun.corba.se.spi.orb.ORB ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ;
-
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-import com.sun.corba.se.spi.protocol.RequestDispatcherDefault ;
-import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
-
-import com.sun.corba.se.spi.resolver.LocalResolver ;
-import com.sun.corba.se.spi.resolver.Resolver ;
-import com.sun.corba.se.spi.resolver.ResolverDefault ;
-
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
-import com.sun.corba.se.spi.transport.SocketInfo;
-import com.sun.corba.se.spi.transport.TransportDefault ;
-
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContext ;
-import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
-import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext ;
-import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext ;
-import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext ;
-import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext ;
-import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
-
-// XXX This should go away once we get rid of the port exchange for ORBD
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
-import com.sun.corba.se.impl.legacy.connection.SocketFactoryContactInfoListImpl;
-import com.sun.corba.se.impl.legacy.connection.USLPort;
-
-// XXX These should move to SPI
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-
-// XXX This needs an SPI
-import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl ;
-
-public class ORBConfiguratorImpl implements ORBConfigurator {
- private ORBUtilSystemException wrapper ;
-
- public static class ConfigParser extends ParserImplBase {
- public Class[] userConfigurators = null ;
-
- public PropertyParser makeParser()
- {
- PropertyParser parser = new PropertyParser() ;
- Operation action = OperationFactory.compose(
- OperationFactory.suffixAction(),
- OperationFactory.classAction()
- ) ;
- parser.addPrefix( ORBConstants.SUN_PREFIX + "ORBUserConfigurators",
- action, "userConfigurators", Class.class ) ;
- return parser ;
- }
- }
-
- public void configure( DataCollector collector, ORB orb )
- {
- ORB theOrb = orb ;
- wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ;
-
- initObjectCopiers( theOrb ) ;
- initIORFinders( theOrb ) ;
-
- theOrb.setClientDelegateFactory(
- // REVISIT: this should be ProtocolDefault.
- TransportDefault.makeClientDelegateFactory( theOrb )) ;
-
- initializeTransport(theOrb) ;
-
- initializeNaming( theOrb ) ;
- initServiceContextRegistry( theOrb ) ;
- initRequestDispatcherRegistry( theOrb ) ;
- registerInitialReferences( theOrb ) ;
-
- persistentServerInitialization( theOrb ) ;
-
- runUserConfigurators( collector, theOrb ) ;
- }
-
- private void runUserConfigurators( DataCollector collector, ORB orb )
- {
- // Run any pluggable configurators. This is a lot like
- // ORBInitializers, only it uses the internal ORB and has
- // access to all data for parsing.
- ConfigParser parser = new ConfigParser() ;
- parser.init( collector ) ;
- if (parser.userConfigurators != null) {
- for (int ctr=0; ctr() {
- public String run() {
- String props = System
- .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
- if (props == null) {
- props = Security
- .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
- }
- return props;
- }
- });
- if (filterProps != null) {
- try {
- iorTypeCheckRegistry = new IORTypeCheckRegistryImpl(filterProps, this);
- } catch (Exception ex) {
- throw wrapper.bootstrapException(ex);
- }
-
- if (this.orbInitDebugFlag) {
- dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl created for properties == "
- + filterProps);
- }
- } else {
- if (this.orbInitDebugFlag) {
- dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl NOT created for properties == ");
- }
- }
- }
-
- protected void setDebugFlags( String[] args )
- {
- for (int ctr=0; ctr"Y", and an
- * object, YY
, then a subsequent call to
- * ORB.resolve_initial_references( "Y" )
will
- * return object YY
.
- *
- * @param id The ID by which the initial reference will be known.
- * @param obj The initial reference itself.
- * @throws InvalidName if this operation is called with an empty string id
- * or this operation is called with an id that is already registered,
- * including the default names defined by OMG.
- * @throws BAD_PARAM if the obj parameter is null.
- */
- public void register_initial_reference(
- String id, org.omg.CORBA.Object obj ) throws InvalidName
- {
- CorbaServerRequestDispatcher insnd ;
-
- synchronized (this) {
- checkShutdownState();
- }
-
- if ((id == null) || (id.length() == 0))
- throw new InvalidName() ;
-
- synchronized (this) {
- checkShutdownState();
- }
-
- synchronized (resolverLock) {
- insnd = insNamingDelegate ;
-
- java.lang.Object obj2 = localResolver.resolve( id ) ;
- if (obj2 != null)
- throw new InvalidName(id + " already registered") ;
-
- localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
- }
-
- synchronized (this) {
- if (StubAdapter.isStub(obj))
- // Make all remote object references available for INS.
- requestDispatcherRegistry.registerServerRequestDispatcher(
- insnd, id ) ;
- }
- }
-
-/****************************************************************************
- * The following methods (introduced in POA / CORBA2.1) deal with
- * shutdown / single threading.
- ****************************************************************************/
-
- public void run()
- {
- synchronized (this) {
- checkShutdownState();
- }
-
- synchronized (runObj) {
- try {
- runObj.wait();
- } catch ( InterruptedException ex ) {}
- }
- }
-
- public void shutdown(boolean wait_for_completion) {
- boolean wait = false;
-
- synchronized (this) {
- checkShutdownState();
-
- // This is to avoid deadlock: don't allow a thread that is
- // processing a request to call shutdown( true ), because
- // the shutdown would block waiting for the request to complete,
- // while the request would block waiting for shutdown to complete.
- if (wait_for_completion &&
- isProcessingInvocation.get() == Boolean.TRUE) {
- throw omgWrapper.shutdownWaitForCompletionDeadlock();
- }
-
- if (status == STATUS_SHUTTING_DOWN) {
- if (wait_for_completion) {
- wait = true;
- } else {
- return;
- }
- }
-
- status = STATUS_SHUTTING_DOWN;
- }
-
- // Avoid more than one thread performing shutdown at a time.
- synchronized (shutdownObj) {
- // At this point, the ORB status is certainly STATUS_SHUTTING_DOWN.
- // If wait is true, another thread already called shutdown( true ),
- // and so we wait for completion
- if (wait) {
- while (true) {
- synchronized (this) {
- if (status == STATUS_SHUTDOWN)
- break;
- }
-
- try {
- shutdownObj.wait();
- } catch (InterruptedException exc) {
- // NOP: just loop and wait until state is changed
- }
- }
- } else {
- // perform the actual shutdown
- shutdownServants(wait_for_completion);
-
- if (wait_for_completion) {
- synchronized ( waitForCompletionObj ) {
- while (numInvocations > 0) {
- try {
- waitForCompletionObj.wait();
- } catch (InterruptedException ex) {}
- }
- }
- }
-
- synchronized (runObj) {
- runObj.notifyAll();
- }
-
- status = STATUS_SHUTDOWN;
-
- shutdownObj.notifyAll();
- }
- }
- }
-
- // Cause all ObjectAdapaterFactories to clean up all of their internal state, which
- // may include activated objects that have associated state and callbacks that must
- // complete in order to shutdown. This will cause new request to be rejected.
- protected void shutdownServants(boolean wait_for_completion) {
- Set oaset;
- synchronized (this) {
- oaset = new HashSet<>(requestDispatcherRegistry.getObjectAdapterFactories());
- }
-
- for (ObjectAdapterFactory oaf : oaset)
- oaf.shutdown(wait_for_completion);
- }
-
- // Note that the caller must hold the ORBImpl lock.
- public void checkShutdownState()
- {
- if (status == STATUS_DESTROYED) {
- throw wrapper.orbDestroyed() ;
- }
-
- if (status == STATUS_SHUTDOWN) {
- throw omgWrapper.badOperationAfterShutdown() ;
- }
- }
-
- public boolean isDuringDispatch()
- {
- synchronized (this) {
- checkShutdownState();
- }
- Boolean value = (Boolean)(isProcessingInvocation.get()) ;
- return value.booleanValue() ;
- }
-
- public void startingDispatch()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (invocationObj) {
- isProcessingInvocation.set(Boolean.TRUE);
- numInvocations++;
- }
- }
-
- public void finishedDispatch()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (invocationObj) {
- numInvocations--;
- isProcessingInvocation.set(false);
- if (numInvocations == 0) {
- synchronized (waitForCompletionObj) {
- waitForCompletionObj.notifyAll();
- }
- } else if (numInvocations < 0) {
- throw wrapper.numInvocationsAlreadyZero(
- CompletionStatus.COMPLETED_YES);
- }
- }
- }
-
- /**
- * formal/99-10-07 p 159: "If destroy is called on an ORB that has
- * not been shut down, it will start the shutdown process and block until
- * the ORB has shut down before it destroys the ORB."
- */
- public void destroy()
- {
- boolean shutdownFirst = false;
-
- synchronized (this) {
- shutdownFirst = (status == STATUS_OPERATING);
- }
-
- if (shutdownFirst) {
- shutdown(true);
- }
-
- synchronized (this) {
- if (status < STATUS_DESTROYED) {
- getCorbaTransportManager().close();
- getPIHandler().destroyInterceptors();
- status = STATUS_DESTROYED;
- }
- }
- synchronized (threadPoolManagerAccessLock) {
- if (orbOwnsThreadPoolManager) {
- try {
- threadpoolMgr.close();
- threadpoolMgr = null;
- } catch (IOException exc) {
- wrapper.ioExceptionOnClose(exc);
- }
- }
- }
-
- try {
- monitoringManager.close();
- monitoringManager = null;
- } catch (IOException exc) {
- wrapper.ioExceptionOnClose(exc);
- }
-
- CachedCodeBase.cleanCache(this);
- try {
- pihandler.close();
- } catch (IOException exc) {
- wrapper.ioExceptionOnClose(exc);
- }
-
- super.destroy();
-
- badServerIdHandlerAccessLock = null;
- clientDelegateFactoryAccessorLock = null;
- corbaContactInfoListFactoryAccessLock = null;
-
- objectKeyFactoryAccessLock = null;
- legacyServerSocketManagerAccessLock = null;
- threadPoolManagerAccessLock = null;
- transportManager = null;
- legacyServerSocketManager = null;
- OAInvocationInfoStack = null;
- clientInvocationInfoStack = null;
- codeBaseIOR = null;
- dynamicRequests = null;
- svResponseReceived = null;
- runObj = null;
- shutdownObj = null;
- waitForCompletionObj = null;
- invocationObj = null;
- isProcessingInvocation = null;
- typeCodeForClassMap = null;
- valueFactoryCache = null;
- orbVersionThreadLocal = null;
- requestDispatcherRegistry = null;
- copierManager = null;
- toaFactory = null;
- poaFactory = null;
- pihandler = null;
- configData = null;
- badServerIdHandler = null;
- clientDelegateFactory = null;
- corbaContactInfoListFactory = null;
- resolver = null;
- localResolver = null;
- insNamingDelegate = null;
- urlOperation = null;
- taggedComponentFactoryFinder = null;
- taggedProfileFactoryFinder = null;
- taggedProfileTemplateFactoryFinder = null;
- objectKeyFactory = null;
- }
-
- /**
- * Registers a value factory for a particular repository ID.
- *
- * @param repositoryID the repository ID.
- * @param factory the factory.
- * @return the previously registered factory for the given repository ID,
- * or null if no such factory was previously registered.
- * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
- **/
- public synchronized ValueFactory register_value_factory(String repositoryID,
- ValueFactory factory)
- {
- checkShutdownState();
-
- if ((repositoryID == null) || (factory == null))
- throw omgWrapper.unableRegisterValueFactory() ;
-
- return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
- }
-
- /**
- * Unregisters a value factory for a particular repository ID.
- *
- * @param repositoryID the repository ID.
- **/
- public synchronized void unregister_value_factory(String repositoryID)
- {
- checkShutdownState();
-
- if (valueFactoryCache.remove(repositoryID) == null)
- throw wrapper.nullParam() ;
- }
-
- /**
- * Finds and returns a value factory for the given repository ID.
- * The value factory returned was previously registered by a call to
- * {@link #register_value_factory} or is the default factory.
- *
- * @param repositoryID the repository ID.
- * @return the value factory.
- * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
- **/
- public synchronized ValueFactory lookup_value_factory(String repositoryID)
- {
- checkShutdownState();
-
- ValueFactory factory =
- (ValueFactory)valueFactoryCache.get(repositoryID);
-
- if (factory == null) {
- try {
- factory = Utility.getFactory(null, null, null, repositoryID);
- } catch(org.omg.CORBA.MARSHAL ex) {
- throw wrapper.unableFindValueFactory( ex ) ;
- }
- }
-
- return factory ;
- }
-
- public OAInvocationInfo peekInvocationInfo()
- {
- synchronized (this) {
- checkShutdownState();
- }
- StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
- return (OAInvocationInfo)(stack.peek()) ;
- }
-
- public void pushInvocationInfo( OAInvocationInfo info )
- {
- synchronized (this) {
- checkShutdownState();
- }
- StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
- stack.push( info ) ;
- }
-
- public OAInvocationInfo popInvocationInfo()
- {
- synchronized (this) {
- checkShutdownState();
- }
- StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
- return (OAInvocationInfo)(stack.pop()) ;
- }
-
- /**
- * The bad server id handler is used by the Locator to
- * send back the location of a persistant server to the client.
- */
-
- private Object badServerIdHandlerAccessLock = new Object();
-
- public void initBadServerIdHandler()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (badServerIdHandlerAccessLock) {
- Class cls = configData.getBadServerIdHandler() ;
- if (cls != null) {
- try {
- Class[] params = new Class[] { org.omg.CORBA.ORB.class };
- java.lang.Object[] args = new java.lang.Object[]{this};
- Constructor cons = cls.getConstructor(params);
- badServerIdHandler =
- (BadServerIdHandler) cons.newInstance(args);
- } catch (Exception e) {
- throw wrapper.errorInitBadserveridhandler( e ) ;
- }
- }
- }
- }
-
- public void setBadServerIdHandler( BadServerIdHandler handler )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (badServerIdHandlerAccessLock) {
- badServerIdHandler = handler;
- }
- }
-
- public void handleBadServerId( ObjectKey okey )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (badServerIdHandlerAccessLock) {
- if (badServerIdHandler == null)
- throw wrapper.badServerId() ;
- else
- badServerIdHandler.handle( okey ) ;
- }
- }
-
- public synchronized org.omg.CORBA.Policy create_policy( int type,
- org.omg.CORBA.Any val ) throws org.omg.CORBA.PolicyError
- {
- checkShutdownState() ;
-
- return pihandler.create_policy( type, val ) ;
- }
-
- /** This is the implementation of the public API used to connect
- * a servant-skeleton to the ORB.
- */
- public synchronized void connect(org.omg.CORBA.Object servant)
- {
- checkShutdownState();
- if (getTOAFactory() == null)
- throw wrapper.noToa() ;
-
- try {
- String codebase = javax.rmi.CORBA.Util.getCodebase( servant.getClass() ) ;
- getTOAFactory().getTOA( codebase ).connect( servant ) ;
- } catch ( Exception ex ) {
- throw wrapper.orbConnectError( ex ) ;
- }
- }
-
- public synchronized void disconnect(org.omg.CORBA.Object obj)
- {
- checkShutdownState();
- if (getTOAFactory() == null)
- throw wrapper.noToa() ;
-
- try {
- getTOAFactory().getTOA().disconnect( obj ) ;
- } catch ( Exception ex ) {
- throw wrapper.orbConnectError( ex ) ;
- }
- }
-
- public int getTransientServerId()
- {
- synchronized (this) {
- checkShutdownState();
- }
- if( configData.getORBServerIdPropertySpecified( ) ) {
- // ORBServerId is specified then use that value
- return configData.getPersistentServerId( );
- }
- return transientServerId;
- }
-
- public RequestDispatcherRegistry getRequestDispatcherRegistry()
- {
- synchronized (this) {
- checkShutdownState();
- }
- return requestDispatcherRegistry;
- }
-
- public ServiceContextRegistry getServiceContextRegistry()
- {
- synchronized (this) {
- checkShutdownState();
- }
- return serviceContextRegistry ;
- }
-
- // XXX All of the isLocalXXX checking needs to be revisited.
- // First of all, all three of these methods are called from
- // only one place in impl.ior.IORImpl. Second, we have problems
- // both with multi-homed hosts and with multi-profile IORs.
- // A possible strategy: like the LocalClientRequestDispatcher, we need
- // to determine this more abstractly at the ContactInfo level.
- // This level should probably just get the CorbaContactInfoList from
- // the IOR, then iterator over ContactInfo. If any ContactInfo is
- // local, the IOR is local, and we can pick one to create the
- // LocalClientRequestDispatcher as well. Bottom line: this code needs to move.
-
- // XXX What about multi-homed host?
- public boolean isLocalHost( String hostName )
- {
- synchronized (this) {
- checkShutdownState();
- }
- return hostName.equals( configData.getORBServerHost() ) ||
- hostName.equals( getLocalHostName() ) ;
- }
-
- public boolean isLocalServerId( int subcontractId, int serverId )
- {
- synchronized (this) {
- checkShutdownState();
- }
- if ((subcontractId < ORBConstants.FIRST_POA_SCID) ||
- (subcontractId > ORBConstants.MAX_POA_SCID))
- return serverId == getTransientServerId( ) ;
-
- // XXX isTransient info should be stored in subcontract registry
- if (ORBConstants.isTransient( subcontractId ))
- return (serverId == getTransientServerId()) ;
- else if (configData.getPersistentServerIdInitialized())
- return (serverId == configData.getPersistentServerId()) ;
- else
- return false ;
- }
-
- /*************************************************************************
- * The following public methods are for ORB shutdown.
- *************************************************************************/
-
- private String getHostName(String host)
- throws java.net.UnknownHostException
- {
- return InetAddress.getByName( host ).getHostAddress();
- }
-
- /* keeping a copy of the getLocalHostName so that it can only be called
- * internally and the unauthorized clients cannot have access to the
- * localHost information, originally, the above code was calling
- * getLocalHostName from Connection.java. If the hostname is cached in
- * Connection.java, then
- * it is a security hole, since any unauthorized client has access to
- * the host information. With this change it is used internally so the
- * security problem is resolved. Also in Connection.java, the
- * getLocalHost() implementation has changed to always call the
- * InetAddress.getLocalHost().getHostAddress()
- * The above mentioned method has been removed from the connection class
- */
-
- private static String localHostString = null;
-
- private synchronized String getLocalHostName()
- {
- if (localHostString == null) {
- try {
- localHostString = InetAddress.getLocalHost().getHostAddress();
- } catch (Exception ex) {
- throw wrapper.getLocalHostFailed( ex ) ;
- }
- }
- return localHostString ;
- }
-
- /******************************************************************************
- * The following public methods are for ORB shutdown.
- *
- ******************************************************************************/
-
- /** This method always returns false because the ORB never needs the
- * main thread to do work.
- */
- public synchronized boolean work_pending()
- {
- checkShutdownState();
- throw wrapper.genericNoImpl() ;
- }
-
- /** This method does nothing. It is not required by the spec to do anything!
- */
- public synchronized void perform_work()
- {
- checkShutdownState();
- throw wrapper.genericNoImpl() ;
- }
-
- public synchronized void set_delegate(java.lang.Object servant){
- checkShutdownState();
-
- POAFactory poaFactory = getPOAFactory() ;
- if (poaFactory != null)
- ((org.omg.PortableServer.Servant)servant)
- ._set_delegate( poaFactory.getDelegateImpl() ) ;
- else
- throw wrapper.noPoa() ;
- }
-
- ////////////////////////////////////////////////////
- //
- // pept.broker.Broker
- //
-
- public ClientInvocationInfo createOrIncrementInvocationInfo()
- {
- synchronized (this) {
- checkShutdownState();
- }
- StackImpl invocationInfoStack =
- (StackImpl) clientInvocationInfoStack.get();
- ClientInvocationInfo clientInvocationInfo = null;
- if (!invocationInfoStack.empty()) {
- clientInvocationInfo =
- (ClientInvocationInfo) invocationInfoStack.peek();
- }
- if ((clientInvocationInfo == null) ||
- (!clientInvocationInfo.isRetryInvocation()))
- {
- // This is a new call - not a retry.
- clientInvocationInfo = new CorbaInvocationInfo(this);
- startingDispatch();
- invocationInfoStack.push(clientInvocationInfo);
- }
- // Reset retry so recursive calls will get a new info object.
- clientInvocationInfo.setIsRetryInvocation(false);
- clientInvocationInfo.incrementEntryCount();
- return clientInvocationInfo;
- }
-
- public void releaseOrDecrementInvocationInfo()
- {
- synchronized (this) {
- checkShutdownState();
- }
- int entryCount = -1;
- ClientInvocationInfo clientInvocationInfo = null;
- StackImpl invocationInfoStack =
- (StackImpl)clientInvocationInfoStack.get();
- if (!invocationInfoStack.empty()) {
- clientInvocationInfo =
- (ClientInvocationInfo)invocationInfoStack.peek();
- } else {
- throw wrapper.invocationInfoStackEmpty() ;
- }
- clientInvocationInfo.decrementEntryCount();
- entryCount = clientInvocationInfo.getEntryCount();
- if (clientInvocationInfo.getEntryCount() == 0) {
- // 6763340: don't pop if this is a retry!
- if (!clientInvocationInfo.isRetryInvocation()) {
- invocationInfoStack.pop();
- }
- finishedDispatch();
- }
- }
-
- public ClientInvocationInfo getInvocationInfo()
- {
- synchronized (this) {
- checkShutdownState();
- }
- StackImpl invocationInfoStack =
- (StackImpl) clientInvocationInfoStack.get();
- return (ClientInvocationInfo) invocationInfoStack.peek();
- }
-
- ////////////////////////////////////////////////////
- //
- //
- //
-
- private Object clientDelegateFactoryAccessorLock = new Object();
-
- public void setClientDelegateFactory( ClientDelegateFactory factory )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (clientDelegateFactoryAccessorLock) {
- clientDelegateFactory = factory ;
- }
- }
-
- public ClientDelegateFactory getClientDelegateFactory()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (clientDelegateFactoryAccessorLock) {
- return clientDelegateFactory ;
- }
- }
-
- private Object corbaContactInfoListFactoryAccessLock = new Object();
-
- public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (corbaContactInfoListFactoryAccessLock) {
- corbaContactInfoListFactory = factory ;
- }
- }
-
- public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory()
- {
- checkShutdownState();
- return corbaContactInfoListFactory ;
- }
-
- /** Set the resolver used in this ORB. This resolver will be used for list_initial_services
- * and resolve_initial_references.
- */
- public void setResolver( Resolver resolver )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (resolverLock) {
- this.resolver = resolver ;
- }
- }
-
- /** Get the resolver used in this ORB. This resolver will be used for list_initial_services
- * and resolve_initial_references.
- */
- public Resolver getResolver()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (resolverLock) {
- return resolver ;
- }
- }
-
- /** Set the LocalResolver used in this ORB. This LocalResolver is used for
- * register_initial_reference only.
- */
- public void setLocalResolver( LocalResolver resolver )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (resolverLock) {
- this.localResolver = resolver ;
- }
- }
-
- /** Get the LocalResolver used in this ORB. This LocalResolver is used for
- * register_initial_reference only.
- */
- public LocalResolver getLocalResolver()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (resolverLock) {
- return localResolver ;
- }
- }
-
- /** Set the operation used in string_to_object calls. The Operation must expect a
- * String and return an org.omg.CORBA.Object.
- */
- public void setURLOperation( Operation stringToObject )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (urlOperationLock) {
- urlOperation = stringToObject ;
- }
- }
-
- /** Get the operation used in string_to_object calls. The Operation must expect a
- * String and return an org.omg.CORBA.Object.
- */
- public Operation getURLOperation()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (urlOperationLock) {
- return urlOperation ;
- }
- }
-
- public void setINSDelegate( CorbaServerRequestDispatcher sdel )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (resolverLock) {
- insNamingDelegate = sdel ;
- }
- }
-
- public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder()
- {
- synchronized (this) {
- checkShutdownState();
- }
- return taggedComponentFactoryFinder ;
- }
-
- public IdentifiableFactoryFinder getTaggedProfileFactoryFinder()
- {
- synchronized (this) {
- checkShutdownState();
- }
- return taggedProfileFactoryFinder ;
- }
-
- public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder()
- {
- synchronized (this) {
- checkShutdownState();
- }
- return taggedProfileTemplateFactoryFinder ;
- }
-
- private Object objectKeyFactoryAccessLock = new Object();
-
- public ObjectKeyFactory getObjectKeyFactory()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (objectKeyFactoryAccessLock) {
- return objectKeyFactory ;
- }
- }
-
- public void setObjectKeyFactory( ObjectKeyFactory factory )
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (objectKeyFactoryAccessLock) {
- objectKeyFactory = factory ;
- }
- }
-
- private Object transportManagerAccessorLock = new Object();
-
- public TransportManager getTransportManager()
- {
- synchronized (transportManagerAccessorLock) {
- if (transportManager == null) {
- transportManager = new CorbaTransportManagerImpl(this);
- }
- return transportManager;
- }
- }
-
- public CorbaTransportManager getCorbaTransportManager()
- {
- return (CorbaTransportManager) getTransportManager();
- }
-
- private Object legacyServerSocketManagerAccessLock = new Object();
-
- public LegacyServerSocketManager getLegacyServerSocketManager()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (legacyServerSocketManagerAccessLock) {
- if (legacyServerSocketManager == null) {
- legacyServerSocketManager = new LegacyServerSocketManagerImpl(this);
- }
- return legacyServerSocketManager;
- }
- }
-
- private Object threadPoolManagerAccessLock = new Object();
-
- public void setThreadPoolManager(ThreadPoolManager mgr)
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (threadPoolManagerAccessLock) {
- threadpoolMgr = mgr;
- }
- }
-
- public ThreadPoolManager getThreadPoolManager()
- {
- synchronized (this) {
- checkShutdownState();
- }
- synchronized (threadPoolManagerAccessLock) {
- if (threadpoolMgr == null) {
- threadpoolMgr = new ThreadPoolManagerImpl();
- orbOwnsThreadPoolManager = true;
- }
- return threadpoolMgr;
- }
- }
-
- public CopierManager getCopierManager()
- {
- synchronized (this) {
- checkShutdownState();
- }
- return copierManager ;
- }
-
- @Override
- public void validateIORClass(String iorClassName) {
- if (iorTypeCheckRegistry != null) {
- if (!iorTypeCheckRegistry.isValidIORType(iorClassName)) {
- throw ORBUtilSystemException.get( this,
- CORBALogDomains.OA_IOR ).badStringifiedIor();
- }
- }
- }
-
-} // Class ORBImpl
-
-////////////////////////////////////////////////////////////////////////
-/// Helper class for a Synchronization Variable
-////////////////////////////////////////////////////////////////////////
-
-class SynchVariable
-{
- // Synchronization Variable
- public boolean _flag;
-
- // Constructor
- SynchVariable()
- {
- _flag = false;
- }
-
- // set Flag to true
- public void set()
- {
- _flag = true;
- }
-
- // get value
- public boolean value()
- {
- return _flag;
- }
-
- // reset Flag to true
- public void reset()
- {
- _flag = false;
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java 2018-01-30 20:18:58.000000000 -0500
+++ /dev/null 2018-01-30 20:18:58.000000000 -0500
@@ -1,780 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.orb;
-
-import java.util.Collection;
-import java.util.Properties;
-import java.util.Hashtable;
-
-import java.applet.Applet;
-
-import java.net.URL;
-
-import java.io.IOException ;
-
-import java.util.logging.Logger ;
-
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.ORBPackage.InvalidName;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Request;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.StructMember;
-import org.omg.CORBA.UnionMember;
-import org.omg.CORBA.ValueMember;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.PolicyError;
-
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.RemarshalException;
-
-import com.sun.corba.se.pept.protocol.ClientInvocationInfo ;
-import com.sun.corba.se.pept.transport.ContactInfo;
-import com.sun.corba.se.pept.transport.ConnectionCache;
-import com.sun.corba.se.pept.transport.Selector ;
-import com.sun.corba.se.pept.transport.TransportManager;
-
-import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
-import com.sun.corba.se.spi.orb.ORBData;
-import com.sun.corba.se.spi.orb.Operation;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.ORBVersion;
-import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.oa.OAInvocationInfo;
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.protocol.ClientDelegateFactory;
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
-import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
-import com.sun.corba.se.spi.protocol.PIHandler;
-import com.sun.corba.se.spi.resolver.Resolver;
-import com.sun.corba.se.spi.resolver.LocalResolver;
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder;
-import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder;
-import com.sun.corba.se.spi.ior.ObjectKey;
-import com.sun.corba.se.spi.ior.ObjectKeyFactory;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.pept.transport.ByteBufferPool ;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
-import com.sun.corba.se.spi.transport.CorbaTransportManager;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
-import com.sun.corba.se.spi.orbutil.closure.Closure;
-import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
-import com.sun.corba.se.spi.logging.LogWrapperFactory;
-import com.sun.corba.se.spi.logging.LogWrapperBase;
-import com.sun.corba.se.spi.copyobject.CopierManager;
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
-
-import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
-
-import com.sun.corba.se.impl.corba.TypeCodeFactory;
-import com.sun.corba.se.impl.corba.TypeCodeImpl;
-import com.sun.corba.se.impl.corba.NVListImpl;
-import com.sun.corba.se.impl.corba.NamedValueImpl;
-import com.sun.corba.se.impl.corba.ExceptionListImpl;
-import com.sun.corba.se.impl.corba.ContextListImpl;
-import com.sun.corba.se.impl.corba.EnvironmentImpl;
-import com.sun.corba.se.impl.corba.AnyImpl;
-import com.sun.corba.se.impl.encoding.BufferManagerFactory;
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.encoding.MarshalOutputStream;
-import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
-
-/*
- * The restricted singleton ORB implementation.
- *
- * For now, this class must implement just enough functionality to be
- * used as a factory for immutable TypeCode instances.
- *
- * See ORBImpl.java for the real ORB implementation.
- */
-public class ORBSingleton extends ORB
-{
- // This is used to support read_Object.
- private ORB fullORB;
- private static PresentationManager.StubFactoryFactory staticStubFactoryFactory =
- PresentationDefaults.getStaticStubFactoryFactory() ;
-
- public void set_parameters( Properties props ) {
- }
-
- protected void set_parameters(Applet app, Properties props) {
- }
-
- protected void set_parameters (String params[], Properties props) {
- }
-
- public OutputStream create_output_stream() {
- return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
- }
-
- public TypeCode create_struct_tc(String id,
- String name,
- StructMember[] members)
- {
- return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members);
- }
-
- public TypeCode create_union_tc(String id,
- String name,
- TypeCode discriminator_type,
- UnionMember[] members)
- {
- return new TypeCodeImpl(this,
- TCKind._tk_union,
- id,
- name,
- discriminator_type,
- members);
- }
-
- public TypeCode create_enum_tc(String id,
- String name,
- String[] members)
- {
- return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members);
- }
-
- public TypeCode create_alias_tc(String id,
- String name,
- TypeCode original_type)
- {
- return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type);
- }
-
- public TypeCode create_exception_tc(String id,
- String name,
- StructMember[] members)
- {
- return new TypeCodeImpl(this, TCKind._tk_except, id, name, members);
- }
-
- public TypeCode create_interface_tc(String id,
- String name)
- {
- return new TypeCodeImpl(this, TCKind._tk_objref, id, name);
- }
-
- public TypeCode create_string_tc(int bound) {
- return new TypeCodeImpl(this, TCKind._tk_string, bound);
- }
-
- public TypeCode create_wstring_tc(int bound) {
- return new TypeCodeImpl(this, TCKind._tk_wstring, bound);
- }
-
- public TypeCode create_sequence_tc(int bound,
- TypeCode element_type)
- {
- return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type);
- }
-
- public TypeCode create_recursive_sequence_tc(int bound,
- int offset)
- {
- return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset);
- }
-
- public TypeCode create_array_tc(int length,
- TypeCode element_type)
- {
- return new TypeCodeImpl(this, TCKind._tk_array, length, element_type);
- }
-
- public org.omg.CORBA.TypeCode create_native_tc(String id,
- String name)
- {
- return new TypeCodeImpl(this, TCKind._tk_native, id, name);
- }
-
- public org.omg.CORBA.TypeCode create_abstract_interface_tc(
- String id,
- String name)
- {
- return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name);
- }
-
- public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale)
- {
- return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale);
- }
-
- // orbos 98-01-18: Objects By Value -- begin
-
- public org.omg.CORBA.TypeCode create_value_tc(String id,
- String name,
- short type_modifier,
- TypeCode concrete_base,
- ValueMember[] members)
- {
- return new TypeCodeImpl(this, TCKind._tk_value, id, name,
- type_modifier, concrete_base, members);
- }
-
- public org.omg.CORBA.TypeCode create_recursive_tc(String id) {
- return new TypeCodeImpl(this, id);
- }
-
- public org.omg.CORBA.TypeCode create_value_box_tc(String id,
- String name,
- TypeCode boxed_type)
- {
- return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, boxed_type);
- }
-
- public TypeCode get_primitive_tc( TCKind tckind )
- {
- return get_primitive_tc( tckind.value() ) ;
- }
-
- public Any create_any() {
- return new AnyImpl(this);
- }
-
- // TypeCodeFactory interface methods.
- // Keeping track of type codes by repository id.
- /*
- * Not strictly needed for TypeCode factory duty but these seem
- * harmless enough.
- */
-
- public NVList create_list(int count) {
- return new NVListImpl(this, count);
- }
-
- public org.omg.CORBA.NVList
- create_operation_list(org.omg.CORBA.Object oper) {
- throw wrapper.genericNoImpl() ;
- }
-
- public org.omg.CORBA.NamedValue
- create_named_value(String s, Any any, int flags) {
- return new NamedValueImpl(this, s, any, flags);
- }
-
- public org.omg.CORBA.ExceptionList create_exception_list() {
- return new ExceptionListImpl();
- }
-
- public org.omg.CORBA.ContextList create_context_list() {
- return new ContextListImpl(this);
- }
-
- public org.omg.CORBA.Context get_default_context()
- {
- throw wrapper.genericNoImpl() ;
- }
-
- public org.omg.CORBA.Environment create_environment()
- {
- return new EnvironmentImpl();
- }
-
- public org.omg.CORBA.Current get_current()
- {
- throw wrapper.genericNoImpl() ;
- }
-
- /*
- * Things that aren't allowed.
- */
-
- public String[] list_initial_services ()
- {
- throw wrapper.genericNoImpl() ;
- }
-
- public org.omg.CORBA.Object resolve_initial_references(String identifier)
- throws InvalidName
- {
- throw wrapper.genericNoImpl() ;
- }
-
- public void register_initial_reference(
- String id, org.omg.CORBA.Object obj ) throws InvalidName
- {
- throw wrapper.genericNoImpl() ;
- }
-
- public void send_multiple_requests_oneway(Request[] req) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void send_multiple_requests_deferred(Request[] req) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public boolean poll_next_response() {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public org.omg.CORBA.Request get_next_response() {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public String object_to_string(org.omg.CORBA.Object obj) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public org.omg.CORBA.Object string_to_object(String s) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public java.rmi.Remote string_to_remote(String s)
- throws java.rmi.RemoteException
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void connect(org.omg.CORBA.Object servant) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void disconnect(org.omg.CORBA.Object obj) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void run()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void shutdown(boolean wait_for_completion)
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- protected void shutdownServants(boolean wait_for_completion) {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- protected void destroyConnections() {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void destroy() {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public boolean work_pending()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void perform_work()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public org.omg.CORBA.portable.ValueFactory register_value_factory(String repositoryID,
- org.omg.CORBA.portable.ValueFactory factory)
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void unregister_value_factory(String repositoryID)
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String repositoryID)
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public TransportManager getTransportManager()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public CorbaTransportManager getCorbaTransportManager()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public LegacyServerSocketManager getLegacyServerSocketManager()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
-/*************************************************************************
- These are methods from com.sun.corba.se.impl.se.core.ORB
- ************************************************************************/
-
- private synchronized ORB getFullORB()
- {
- if (fullORB == null) {
- Properties props = new Properties() ;
- fullORB = new ORBImpl() ;
- fullORB.set_parameters( props ) ;
- }
-
- return fullORB ;
- }
-
- public RequestDispatcherRegistry getRequestDispatcherRegistry()
- {
- // To enable read_Object.
-
- return getFullORB().getRequestDispatcherRegistry();
- }
-
- /**
- * Return the service context registry
- */
- public ServiceContextRegistry getServiceContextRegistry()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- /**
- * Get the transient server ID
- */
- public int getTransientServerId()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- /**
- * Return the bootstrap naming port specified in the ORBInitialPort param.
- */
- public int getORBInitialPort()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- /**
- * Return the bootstrap naming host specified in the ORBInitialHost param.
- */
- public String getORBInitialHost()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public String getORBServerHost()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public int getORBServerPort()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public CodeSetComponentInfo getCodeSetComponentInfo()
- {
- return new CodeSetComponentInfo();
- }
-
- public boolean isLocalHost( String host )
- {
- // To enable read_Object.
- return false;
- }
-
- public boolean isLocalServerId( int subcontractId, int serverId )
- {
- // To enable read_Object.
- return false;
- }
-
- /*
- * Things from corba.ORB.
- */
-
- public ORBVersion getORBVersion()
- {
- // Always use our latest ORB version (latest fixes, etc)
- return ORBVersionFactory.getORBVersion();
- }
-
- public void setORBVersion(ORBVersion verObj)
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public String getAppletHost()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public URL getAppletCodeBase()
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public int getHighWaterMark(){
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public int getLowWaterMark(){
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public int getNumberToReclaim(){
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public int getGIOPFragmentSize() {
- return ORBConstants.GIOP_DEFAULT_BUFFER_SIZE;
- }
-
- public int getGIOPBuffMgrStrategy(GIOPVersion gv) {
- return BufferManagerFactory.GROW;
- }
-
- public IOR getFVDCodeBaseIOR(){
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public Policy create_policy( int type, Any val ) throws PolicyError
- {
- throw new NO_IMPLEMENT();
- }
-
- public LegacyServerSocketEndPointInfo getServerEndpoint()
- {
- return null ;
- }
-
- public void setPersistentServerId( int id )
- {
- }
-
- public TypeCodeImpl getTypeCodeForClass( Class c )
- {
- return null ;
- }
-
- public void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl )
- {
- }
-
- public boolean alwaysSendCodeSetServiceContext()
- {
- return true ;
- }
-
- public boolean isDuringDispatch()
- {
- return false ;
- }
-
- public void notifyORB() { }
-
- public PIHandler getPIHandler()
- {
- return null ;
- }
-
- public void checkShutdownState()
- {
- }
-
- public void startingDispatch()
- {
- }
-
- public void finishedDispatch()
- {
- }
-
- public void registerInitialReference( String id, Closure closure )
- {
- }
-
- public ORBData getORBData()
- {
- return getFullORB().getORBData() ;
- }
-
- public void setClientDelegateFactory( ClientDelegateFactory factory )
- {
- }
-
- public ClientDelegateFactory getClientDelegateFactory()
- {
- return getFullORB().getClientDelegateFactory() ;
- }
-
- public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory )
- {
- }
-
- public CorbaContactInfoListFactory getCorbaContactInfoListFactory()
- {
- return getFullORB().getCorbaContactInfoListFactory() ;
- }
-
- public Operation getURLOperation()
- {
- return null ;
- }
-
- public void setINSDelegate( CorbaServerRequestDispatcher sdel )
- {
- }
-
- public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder()
- {
- return getFullORB().getTaggedComponentFactoryFinder() ;
- }
-
- public IdentifiableFactoryFinder getTaggedProfileFactoryFinder()
- {
- return getFullORB().getTaggedProfileFactoryFinder() ;
- }
-
- public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder()
- {
- return getFullORB().getTaggedProfileTemplateFactoryFinder() ;
- }
-
- public ObjectKeyFactory getObjectKeyFactory()
- {
- return getFullORB().getObjectKeyFactory() ;
- }
-
- public void setObjectKeyFactory( ObjectKeyFactory factory )
- {
- throw new SecurityException("ORBSingleton: access denied");
- }
-
- public void handleBadServerId( ObjectKey okey )
- {
- }
-
- public OAInvocationInfo peekInvocationInfo()
- {
- return null ;
- }
-
- public void pushInvocationInfo( OAInvocationInfo info )
- {
- }
-
- public OAInvocationInfo popInvocationInfo()
- {
- return null ;
- }
-
- public ClientInvocationInfo createOrIncrementInvocationInfo()
- {
- return null ;
- }
-
- public void releaseOrDecrementInvocationInfo()
- {
- }
-
- public ClientInvocationInfo getInvocationInfo()
- {
- return null ;
- }
-
- public ConnectionCache getConnectionCache(ContactInfo contactInfo)
- {
- return null;
- }
-
- public void setResolver( Resolver resolver )
- {
- }
-
- public Resolver getResolver()
- {
- return null ;
- }
-
- public void setLocalResolver( LocalResolver resolver )
- {
- }
-
- public LocalResolver getLocalResolver()
- {
- return null ;
- }
-
- public void setURLOperation( Operation stringToObject )
- {
- }
-
- // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD
- public void setBadServerIdHandler( BadServerIdHandler handler )
- {
- }
-
- // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD
- public void initBadServerIdHandler()
- {
- }
-
- public Selector getSelector(int x)
- {
- return null;
- }
-
- public void setThreadPoolManager(ThreadPoolManager mgr) {
- }
-
- public ThreadPoolManager getThreadPoolManager() {
- return null;
- }
-
- public CopierManager getCopierManager() {
- return null ;
- }
-
- @Override
- public void validateIORClass(String iorClassName) {
- getFullORB().validateIORClass(iorClassName);
-
- }
-
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBVersionImpl.java 2018-01-30 20:18:59.000000000 -0500
+++ /dev/null 2018-01-30 20:18:59.000000000 -0500
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import org.omg.CORBA.portable.OutputStream ;
-
-import com.sun.corba.se.spi.orb.ORBVersion ;
-
-public class ORBVersionImpl implements ORBVersion {
- private byte orbType ;
-
- public ORBVersionImpl( byte orbType )
- {
- this.orbType = orbType ;
- }
-
- public static final ORBVersion FOREIGN = new ORBVersionImpl(
- ORBVersion.FOREIGN ) ;
-
- public static final ORBVersion OLD = new ORBVersionImpl(
- ORBVersion.OLD ) ;
-
- public static final ORBVersion NEW = new ORBVersionImpl(
- ORBVersion.NEW ) ;
-
- public static final ORBVersion JDK1_3_1_01 = new ORBVersionImpl(
- ORBVersion.JDK1_3_1_01 ) ;
-
- public static final ORBVersion NEWER = new ORBVersionImpl(
- ORBVersion.NEWER ) ;
-
- public static final ORBVersion PEORB = new ORBVersionImpl(
- ORBVersion.PEORB ) ;
-
- public byte getORBType()
- {
- return orbType ;
- }
-
- public void write( OutputStream os )
- {
- os.write_octet( (byte)orbType ) ;
- }
-
- public String toString()
- {
- return "ORBVersionImpl[" + Byte.toString( orbType ) + "]" ;
- }
-
- public boolean equals( Object obj )
- {
- if (!(obj instanceof ORBVersion))
- return false ;
-
- ORBVersion version = (ORBVersion)obj ;
- return version.getORBType() == orbType ;
- }
-
- public int hashCode()
- {
- return orbType ;
- }
-
- public boolean lessThan(ORBVersion version) {
- return orbType < version.getORBType();
- }
-
- public int compareTo(Object obj) {
- // The Comparable interface says that this
- // method throws a ClassCastException if the
- // given object's type prevents it from being
- // compared.
- return getORBType() - ((ORBVersion)obj).getORBType();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserAction.java 2018-01-30 20:18:59.000000000 -0500
+++ /dev/null 2018-01-30 20:18:59.000000000 -0500
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-public interface ParserAction {
- /** Return the property name or prefix for which this action
- * is applied.
- */
- String getPropertyName() ;
-
- /** Return whether this action is for an exact match or a prefix
- * match (true).
- */
- boolean isPrefix() ;
-
- /** Return the field name in an object that is set with the result
- */
- String getFieldName() ;
-
- /** Apply this action to props and return the result.
- */
- Object apply( Properties props ) ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionBase.java 2018-01-30 20:19:00.000000000 -0500
+++ /dev/null 2018-01-30 20:19:00.000000000 -0500
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-
-public abstract class ParserActionBase implements ParserAction {
- private String propertyName ;
- private boolean prefix ;
- private Operation operation ;
- private String fieldName ;
-
- public int hashCode()
- {
- return propertyName.hashCode() ^ operation.hashCode() ^
- fieldName.hashCode() ^ (prefix ? 0 : 1) ;
- }
-
- public boolean equals( Object obj )
- {
- if (obj == this)
- return true ;
-
- if (!(obj instanceof ParserActionBase))
- return false ;
-
- ParserActionBase other = (ParserActionBase)obj ;
-
- return propertyName.equals( other.propertyName ) &&
- prefix == other.prefix &&
- operation.equals( other.operation ) &&
- fieldName.equals( other.fieldName ) ;
- }
-
- public ParserActionBase( String propertyName, boolean prefix,
- Operation operation, String fieldName )
- {
- this.propertyName = propertyName ;
- this.prefix = prefix ;
- this.operation = operation ;
- this.fieldName = fieldName ;
- }
-
- public String getPropertyName()
- {
- return propertyName ;
- }
-
- public boolean isPrefix()
- {
- return prefix ;
- }
-
- public String getFieldName()
- {
- return fieldName ;
- }
-
- public abstract Object apply( Properties props ) ;
-
- protected Operation getOperation()
- {
- return operation ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionFactory.java 2018-01-30 20:19:01.000000000 -0500
+++ /dev/null 2018-01-30 20:19:01.000000000 -0500
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-
-public class ParserActionFactory{
- private ParserActionFactory() {}
-
- public static ParserAction makeNormalAction( String propertyName,
- Operation operation, String fieldName )
- {
- return new NormalParserAction( propertyName, operation, fieldName ) ;
- }
-
- public static ParserAction makePrefixAction( String propertyName,
- Operation operation, String fieldName, Class componentType )
- {
- return new PrefixParserAction( propertyName, operation, fieldName, componentType ) ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserDataBase.java 2018-01-30 20:19:01.000000000 -0500
+++ /dev/null 2018-01-30 20:19:01.000000000 -0500
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import com.sun.corba.se.spi.orb.ParserData ;
-import com.sun.corba.se.spi.orb.Operation ;
-
-public abstract class ParserDataBase implements ParserData {
- private String propertyName ;
- private Operation operation ;
- private String fieldName ;
- private Object defaultValue ;
- private Object testValue ;
-
- protected ParserDataBase( String propertyName,
- Operation operation, String fieldName, Object defaultValue,
- Object testValue )
- {
- this.propertyName = propertyName ;
- this.operation = operation ;
- this.fieldName = fieldName ;
- this.defaultValue = defaultValue ;
- this.testValue = testValue ;
- }
-
- public String getPropertyName() { return propertyName ; }
- public Operation getOperation() { return operation ; }
- public String getFieldName() { return fieldName ; }
- public Object getDefaultValue() { return defaultValue ; }
- public Object getTestValue() { return testValue ; }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserTable.java 2018-01-30 20:19:02.000000000 -0500
+++ /dev/null 2018-01-30 20:19:02.000000000 -0500
@@ -1,1110 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.net.URL ;
-import java.net.InetSocketAddress;
-import java.net.Socket ;
-import java.net.ServerSocket ;
-
-import java.io.IOException ;
-
-import java.util.HashMap ;
-import java.util.List;
-import java.util.Map ;
-
-import java.security.AccessController ;
-import java.security.PrivilegedExceptionAction ;
-import java.security.PrivilegedActionException ;
-
-import org.omg.PortableInterceptor.ORBInitializer ;
-import org.omg.PortableInterceptor.ORBInitInfo ;
-
-import com.sun.corba.se.pept.broker.Broker;
-import com.sun.corba.se.pept.encoding.InputObject;
-import com.sun.corba.se.pept.encoding.OutputObject;
-import com.sun.corba.se.pept.protocol.MessageMediator;
-import com.sun.corba.se.pept.transport.Acceptor;
-import com.sun.corba.se.pept.transport.Connection;
-import com.sun.corba.se.pept.transport.ContactInfo;
-import com.sun.corba.se.pept.transport.ContactInfoList;
-import com.sun.corba.se.pept.transport.EventHandler;
-import com.sun.corba.se.pept.transport.InboundConnectionCache;
-
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.ior.ObjectKey ;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.OperationFactory ;
-import com.sun.corba.se.spi.orb.ParserData ;
-import com.sun.corba.se.spi.orb.ParserDataFactory ;
-import com.sun.corba.se.spi.orb.StringPair ;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList;
-import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
-import com.sun.corba.se.spi.transport.CorbaTransportManager;
-import com.sun.corba.se.spi.transport.IORToSocketInfo;
-import com.sun.corba.se.spi.transport.ReadTimeouts;
-import com.sun.corba.se.spi.transport.SocketInfo;
-import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
-import com.sun.corba.se.spi.transport.TransportDefault;
-
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry ;
-import com.sun.corba.se.impl.legacy.connection.USLPort ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
-import com.sun.corba.se.impl.orbutil.ORBConstants ;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr ;
-import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl;
-import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl;
-
-import sun.corba.SharedSecrets;
-
-/** Initialize the parser data for the standard ORB parser. This is used both
- * to implement ORBDataParserImpl and to provide the basic testing framework
- * for ORBDataParserImpl.
- */
-public class ParserTable {
- private static String MY_CLASS_NAME = ParserTable.class.getName() ;
-
- private static ParserTable myInstance = new ParserTable() ;
-
- private ORBUtilSystemException wrapper ;
-
- public static ParserTable get()
- {
- return myInstance ;
- }
-
- private ParserData[] parserData ;
-
- public ParserData[] getParserData()
- {
- ParserData[] parserArray = new ParserData[parserData.length];
- System.arraycopy(parserData, 0, parserArray, 0, parserData.length);
- return parserArray;
- }
-
- private ParserTable() {
- wrapper = ORBUtilSystemException.get( CORBALogDomains.ORB_LIFECYCLE ) ;
-
- String codeSetTestString =
- OSFCodeSetRegistry.ISO_8859_1_VALUE + "," +
- OSFCodeSetRegistry.UTF_16_VALUE + "," +
- OSFCodeSetRegistry.ISO_646_VALUE ;
-
- String[] debugTestData = { "subcontract", "poa", "transport" } ;
-
- USLPort[] USLPorts = { new USLPort( "FOO", 2701 ), new USLPort( "BAR", 3333 ) } ;
-
- ReadTimeouts readTimeouts =
- TransportDefault.makeReadTimeoutsFactory().create(
- ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
- ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
- ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
- ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR);
-
- ORBInitializer[] TestORBInitializers =
- { null,
- new TestORBInitializer1(),
- new TestORBInitializer2() } ;
- StringPair[] TestORBInitData = {
- new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
- new StringPair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ),
- new StringPair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ;
-
- Acceptor[] TestAcceptors =
- { new TestAcceptor2(),
- new TestAcceptor1(),
- null } ;
- // REVISIT: The test data gets put into a Properties object where
- // order is not guaranteed. Thus the above array is in reverse.
- StringPair[] TestAcceptorData = {
- new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
- new StringPair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ),
- new StringPair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ;
-
- StringPair[] TestORBInitRefData =
- { new StringPair( "Foo", "ior:930492049394" ),
- new StringPair( "Bar", "ior:3453465785633576" ) } ;
-
- URL testServicesURL = null ;
- String testServicesString = "corbaloc::camelot/NameService" ;
-
- try {
- testServicesURL = new URL( testServicesString ) ;
- } catch (Exception exc) {
- }
-
- // propertyName,
- // operation,
- // fieldName, defaultValue,
- // testValue, testData (string or Pair[])
- ParserData[] pd = {
- ParserDataFactory.make( ORBConstants.DEBUG_PROPERTY,
- OperationFactory.listAction( ",", OperationFactory.stringAction()),
- "debugFlags", new String[0],
- debugTestData, "subcontract,poa,transport" ),
- ParserDataFactory.make( ORBConstants.INITIAL_HOST_PROPERTY,
- OperationFactory.stringAction(),
- "ORBInitialHost", "",
- "Foo", "Foo" ),
- ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY,
- OperationFactory.integerAction(),
- "ORBInitialPort", new Integer( ORBConstants.DEFAULT_INITIAL_PORT ),
- new Integer( 27314 ), "27314" ),
- // Where did this come from?
- //ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY,
- //OperationFactory.booleanAction(),
- //"ORBInitialPortInitialized", Boolean.FALSE,
- //Boolean.TRUE, "27314" ),
- ParserDataFactory.make( ORBConstants.SERVER_HOST_PROPERTY,
- OperationFactory.stringAction(),
- "ORBServerHost", "",
- "camelot", "camelot" ),
- ParserDataFactory.make( ORBConstants.SERVER_PORT_PROPERTY,
- OperationFactory.integerAction(),
- "ORBServerPort", new Integer( 0 ),
- new Integer( 38143 ), "38143" ),
- // NOTE: We are putting SERVER_HOST_NAME configuration info into
- // DataCollectorBase to avoid a security hole. However, that forces
- // us to also set LISTEN_ON_ALL_INTERFACES at the same time.
- // This all needs to be cleaned up for two reasons: to get configuration
- // out of DataCollectorBase and to correctly support multihoming.
- ParserDataFactory.make( ORBConstants.LISTEN_ON_ALL_INTERFACES,
- OperationFactory.stringAction(),
- "listenOnAllInterfaces", ORBConstants.LISTEN_ON_ALL_INTERFACES,
- "foo", "foo" ),
- ParserDataFactory.make( ORBConstants.ORB_ID_PROPERTY,
- OperationFactory.stringAction(),
- "orbId", "",
- "foo", "foo" ),
- ParserDataFactory.make( ORBConstants.OLD_ORB_ID_PROPERTY,
- OperationFactory.stringAction(),
- "orbId", "",
- "foo", "foo" ),
- ParserDataFactory.make( ORBConstants.ORB_SERVER_ID_PROPERTY,
- OperationFactory.integerAction(),
- "persistentServerId", new Integer(-1),
- new Integer( 1234), "1234" ),
- ParserDataFactory.make(
- ORBConstants.ORB_SERVER_ID_PROPERTY,
- OperationFactory.setFlagAction(),
- "persistentServerIdInitialized", Boolean.FALSE,
- Boolean.TRUE, "1234" ),
- ParserDataFactory.make(
- ORBConstants.ORB_SERVER_ID_PROPERTY,
- OperationFactory.setFlagAction(),
- "orbServerIdPropertySpecified", Boolean.FALSE,
- Boolean.TRUE, "1234" ),
- // REVISIT after switch
- // ParserDataFactory.make( ORBConstants.INITIAL_SERVICES_PROPERTY,
- // OperationFactory.URLAction(),
- // "servicesURL", null,
- // testServicesURL, testServicesString ),
- // ParserDataFactory.make( ORBConstants.DEFAULT_INIT_REF_PROPERTY,
- // OperationFactory.stringAction(),
- // "defaultInitRef", null,
- // "Fooref", "Fooref" ),
- ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY,
- OperationFactory.integerAction(),
- "highWaterMark", new Integer( 240 ),
- new Integer( 3745 ), "3745" ),
- ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY,
- OperationFactory.integerAction(),
- "lowWaterMark", new Integer( 100 ),
- new Integer( 12 ), "12" ),
- ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY,
- OperationFactory.integerAction(),
- "numberToReclaim", new Integer( 5 ),
- new Integer( 231 ), "231" ),
- ParserDataFactory.make( ORBConstants.GIOP_VERSION,
- makeGVOperation(),
- "giopVersion", GIOPVersion.DEFAULT_VERSION,
- new GIOPVersion( 2, 3 ), "2.3" ),
- ParserDataFactory.make( ORBConstants.GIOP_FRAGMENT_SIZE,
- makeFSOperation(), "giopFragmentSize",
- new Integer( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ),
- new Integer( 65536 ), "65536" ),
- ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE,
- OperationFactory.integerAction(),
- "giopBufferSize", new Integer( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ),
- new Integer( 234000 ), "234000" ),
- ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR,
- makeBMGROperation(),
- "giop11BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ),
- new Integer( 1 ), "CLCT" ),
- ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR,
- makeBMGROperation(),
- "giop12BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ),
- new Integer( 0 ), "GROW" ),
-
- // Note that the same property is used to set two different
- // fields here. This requires that both entries use the same test
- // data, or the test will fail.
- ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
- OperationFactory.compose( OperationFactory.integerRangeAction( 0, 3 ),
- OperationFactory.convertIntegerToShort() ),
- "giopTargetAddressPreference",
- new Short( ORBConstants.ADDR_DISP_HANDLE_ALL ),
- new Short( (short)2 ), "2" ),
- ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
- makeADOperation(),
- "giopAddressDisposition", new Short( KeyAddr.value ),
- new Short( (short)2 ), "2" ),
- ParserDataFactory.make( ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY,
- OperationFactory.booleanAction(),
- "alwaysSendCodeSetCtx", Boolean.TRUE,
- Boolean.FALSE, "false"),
- ParserDataFactory.make( ORBConstants.USE_BOMS,
- OperationFactory.booleanAction(),
- "useByteOrderMarkers",
- Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS ),
- Boolean.FALSE, "false" ),
- ParserDataFactory.make( ORBConstants.USE_BOMS_IN_ENCAPS,
- OperationFactory.booleanAction(),
- "useByteOrderMarkersInEncaps",
- Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS ),
- Boolean.FALSE, "false" ),
- ParserDataFactory.make( ORBConstants.CHAR_CODESETS,
- makeCSOperation(),
- "charData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(),
- CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ),
- ParserDataFactory.make( ORBConstants.WCHAR_CODESETS,
- makeCSOperation(),
- "wcharData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(),
- CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ),
- ParserDataFactory.make( ORBConstants.ALLOW_LOCAL_OPTIMIZATION,
- OperationFactory.booleanAction(),
- "allowLocalOptimization", Boolean.FALSE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make( ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY,
- makeLegacySocketFactoryOperation(),
- // No default - must be set by user if they are using
- // legacy socket factory.
- "legacySocketFactory", null,
- new TestLegacyORBSocketFactory(),
- MY_CLASS_NAME + "$TestLegacyORBSocketFactory" ),
- ParserDataFactory.make( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY,
- makeSocketFactoryOperation(),
- "socketFactory", new DefaultSocketFactoryImpl(),
- new TestORBSocketFactory(),
- MY_CLASS_NAME + "$TestORBSocketFactory" ),
- ParserDataFactory.make( ORBConstants.LISTEN_SOCKET_PROPERTY,
- makeUSLOperation() ,
- "userSpecifiedListenPorts", new USLPort[0],
- USLPorts, "FOO:2701,BAR:3333" ),
- ParserDataFactory.make( ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY,
- makeIORToSocketInfoOperation(),
- "iorToSocketInfo", new DefaultIORToSocketInfoImpl(),
- new TestIORToSocketInfo(),
- MY_CLASS_NAME + "$TestIORToSocketInfo" ),
- ParserDataFactory.make( ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY,
- makeIIOPPrimaryToContactInfoOperation(),
- "iiopPrimaryToContactInfo", null,
- new TestIIOPPrimaryToContactInfo(),
- MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo" ),
- ParserDataFactory.make( ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY,
- makeContactInfoListFactoryOperation(),
- "corbaContactInfoListFactory", null,
- new TestContactInfoListFactory(),
- MY_CLASS_NAME + "$TestContactInfoListFactory" ),
- ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
- OperationFactory.integerAction(),
- "persistentServerPort", new Integer( 0 ),
- new Integer( 2743 ), "2743" ),
- ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
- OperationFactory.setFlagAction(),
- "persistentPortInitialized", Boolean.FALSE,
- Boolean.TRUE, "2743" ),
- ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
- OperationFactory.integerAction(),
- "persistentServerId", new Integer( 0 ),
- new Integer( 294 ), "294" ),
- ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
- OperationFactory.setFlagAction(),
- "persistentServerIdInitialized", Boolean.FALSE,
- Boolean.TRUE, "294" ),
- ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
- OperationFactory.setFlagAction(),
- "orbServerIdPropertySpecified", Boolean.FALSE,
- Boolean.TRUE, "294" ),
- ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY,
- OperationFactory.booleanAction(),
- "serverIsORBActivated", Boolean.FALSE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY,
- OperationFactory.classAction(),
- "badServerIdHandlerClass", null,
- TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler" ),
- ParserDataFactory.make( ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX,
- makeROIOperation(),
- "orbInitializers", new ORBInitializer[0],
- TestORBInitializers, TestORBInitData, ORBInitializer.class ),
- ParserDataFactory.make( ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY,
- makeAcceptorInstantiationOperation(),
- "acceptors", new Acceptor[0],
- TestAcceptors, TestAcceptorData, Acceptor.class ),
-
- //
- // Socket/Channel control
- //
-
- // Acceptor:
- // useNIOSelector == true
- // useSelectThreadToWait = true
- // useWorkerThreadForEvent = false
- // else
- // useSelectThreadToWait = false
- // useWorkerThreadForEvent = true
-
- // Connection:
- // useNIOSelector == true
- // useSelectThreadToWait = true
- // useWorkerThreadForEvent = true
- // else
- // useSelectThreadToWait = false
- // useWorkerThreadForEvent = true
-
- ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY,
- OperationFactory.stringAction(),
- "acceptorSocketType", ORBConstants.SOCKETCHANNEL,
- "foo", "foo" ),
-
- ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY,
- OperationFactory.booleanAction(),
- "acceptorSocketUseSelectThreadToWait", Boolean.TRUE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY,
- OperationFactory.booleanAction(),
- "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY,
- OperationFactory.stringAction(),
- "connectionSocketType", ORBConstants.SOCKETCHANNEL,
- "foo", "foo" ),
- ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY,
- OperationFactory.booleanAction(),
- "connectionSocketUseSelectThreadToWait", Boolean.TRUE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY,
- OperationFactory.booleanAction(),
- "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make( ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY,
- OperationFactory.booleanAction(),
- "disableDirectByteBufferUse", Boolean.FALSE,
- Boolean.TRUE, "true" ),
- ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY,
- makeTTCPRTOperation(),
- "readTimeouts", TransportDefault.makeReadTimeoutsFactory().create(
- ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
- ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
- ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
- ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR),
- readTimeouts, "100:3000:300:20" ),
- ParserDataFactory.make(
- ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY,
- OperationFactory.booleanAction(),
- "enableJavaSerialization", Boolean.FALSE,
- Boolean.FALSE, "false"),
- ParserDataFactory.make(
- ORBConstants.USE_REP_ID,
- OperationFactory.booleanAction(),
- "useRepId", Boolean.TRUE,
- Boolean.TRUE, "true"),
- ParserDataFactory.make( ORBConstants.ORB_INIT_REF_PROPERTY,
- OperationFactory.identityAction(),
- "orbInitialReferences", new StringPair[0],
- TestORBInitRefData, TestORBInitRefData, StringPair.class )
- } ;
-
- parserData = pd ;
- }
-
- public final class TestBadServerIdHandler implements BadServerIdHandler
- {
- public boolean equals( Object other )
- {
- return other instanceof TestBadServerIdHandler ;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public void handle( ObjectKey objectKey )
- {
- }
- }
-
- private Operation makeTTCPRTOperation()
- {
- Operation[] fourIop = { OperationFactory.integerAction(),
- OperationFactory.integerAction(),
- OperationFactory.integerAction(),
- OperationFactory.integerAction() } ;
-
- Operation op2 = OperationFactory.sequenceAction( ":", fourIop ) ;
-
- Operation rtOp = new Operation() {
- public Object operate(Object value)
- {
- Object[] values = (Object[])value ;
- Integer initialTime = (Integer)(values[0]) ;
- Integer maxGIOPHdrTime = (Integer)(values[1]) ;
- Integer maxGIOPBodyTime = (Integer)(values[2]) ;
- Integer backoffPercent = (Integer)(values[3]) ;
- return TransportDefault.makeReadTimeoutsFactory().create(
- initialTime.intValue(),
- maxGIOPHdrTime.intValue(),
- maxGIOPBodyTime.intValue(),
- backoffPercent.intValue());
- }
- } ;
-
- Operation ttcprtOp = OperationFactory.compose(op2, rtOp);
- return ttcprtOp;
- }
-
- private Operation makeUSLOperation()
- {
- Operation[] siop = { OperationFactory.stringAction(),
- OperationFactory.integerAction() } ;
- Operation op2 = OperationFactory.sequenceAction( ":", siop ) ;
-
- Operation uslop = new Operation() {
- public Object operate( Object value )
- {
- Object[] values = (Object[])value ;
- String type = (String)(values[0]) ;
- Integer port = (Integer)(values[1]) ;
- return new USLPort( type, port.intValue() ) ;
- }
- } ;
-
- Operation op3 = OperationFactory.compose( op2, uslop ) ;
- Operation listenop = OperationFactory.listAction( ",", op3 ) ;
- return listenop ;
- }
-
- public static final class TestLegacyORBSocketFactory
- implements com.sun.corba.se.spi.legacy.connection.ORBSocketFactory
- {
- public boolean equals( Object other )
- {
- return other instanceof TestLegacyORBSocketFactory ;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public ServerSocket createServerSocket( String type, int port )
- {
- return null ;
- }
-
- public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb,
- IOR ior, SocketInfo socketInfo )
- {
- return null ;
- }
-
- public Socket createSocket( SocketInfo socketInfo )
- {
- return null ;
- }
- }
-
- public static final class TestORBSocketFactory
- implements com.sun.corba.se.spi.transport.ORBSocketFactory
- {
- public boolean equals( Object other )
- {
- return other instanceof TestORBSocketFactory ;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public void setORB(ORB orb)
- {
- }
-
- public ServerSocket createServerSocket( String type, InetSocketAddress a )
- {
- return null ;
- }
-
- public Socket createSocket( String type, InetSocketAddress a )
- {
- return null ;
- }
-
- public void setAcceptedSocketOptions(Acceptor acceptor,
- ServerSocket serverSocket,
- Socket socket)
- {
- }
- }
-
- public static final class TestIORToSocketInfo
- implements IORToSocketInfo
- {
- public boolean equals( Object other )
- {
- return other instanceof TestIORToSocketInfo;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public List getSocketInfo(IOR ior)
- {
- return null;
- }
- }
-
- public static final class TestIIOPPrimaryToContactInfo
- implements IIOPPrimaryToContactInfo
- {
- public void reset(ContactInfo primary)
- {
- }
-
- public boolean hasNext(ContactInfo primary,
- ContactInfo previous,
- List contactInfos)
- {
- return true;
- }
-
- public ContactInfo next(ContactInfo primary,
- ContactInfo previous,
- List contactInfos)
- {
- return null;
- }
- }
-
- public static final class TestContactInfoListFactory
- implements CorbaContactInfoListFactory
- {
- public boolean equals( Object other )
- {
- return other instanceof TestContactInfoListFactory;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public void setORB(ORB orb) { }
-
- public CorbaContactInfoList create( IOR ior ) { return null; }
- }
-
- private Operation makeMapOperation( final Map map )
- {
- return new Operation() {
- public Object operate( Object value )
- {
- return map.get( value ) ;
- }
- } ;
- }
-
- private Operation makeBMGROperation()
- {
- Map map = new HashMap() ;
- map.put( "GROW", new Integer(0) ) ;
- map.put( "CLCT", new Integer(1) ) ;
- map.put( "STRM", new Integer(2) ) ;
- return makeMapOperation( map ) ;
- }
-
- private Operation makeLegacySocketFactoryOperation()
- {
- Operation sfop = new Operation() {
- public Object operate( Object value )
- {
- String param = (String)value ;
-
- try {
- Class> legacySocketFactoryClass =
- SharedSecrets.getJavaCorbaAccess().loadClass(param);
- // For security reasons avoid creating an instance if
- // this socket factory class is not one that would fail
- // the class cast anyway.
- if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
- return legacySocketFactoryClass.newInstance();
- } else {
- throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
- }
- } catch (Exception ex) {
- // ClassNotFoundException, IllegalAccessException,
- // InstantiationException, SecurityException or
- // ClassCastException
- throw wrapper.badCustomSocketFactory( ex, param ) ;
- }
- }
- } ;
-
- return sfop ;
- }
-
- private Operation makeSocketFactoryOperation()
- {
- Operation sfop = new Operation() {
- public Object operate( Object value )
- {
- String param = (String)value ;
-
- try {
- Class> socketFactoryClass =
- SharedSecrets.getJavaCorbaAccess().loadClass(param);
- // For security reasons avoid creating an instance if
- // this socket factory class is not one that would fail
- // the class cast anyway.
- if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
- return socketFactoryClass.newInstance();
- } else {
- throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
- }
- } catch (Exception ex) {
- // ClassNotFoundException, IllegalAccessException,
- // InstantiationException, SecurityException or
- // ClassCastException
- throw wrapper.badCustomSocketFactory( ex, param ) ;
- }
- }
- } ;
-
- return sfop ;
- }
-
- private Operation makeIORToSocketInfoOperation()
- {
- Operation op = new Operation() {
- public Object operate( Object value )
- {
- String param = (String)value ;
-
- try {
- Class> iorToSocketInfoClass =
- SharedSecrets.getJavaCorbaAccess().loadClass(param);
- // For security reasons avoid creating an instance if
- // this socket factory class is not one that would fail
- // the class cast anyway.
- if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
- return iorToSocketInfoClass.newInstance();
- } else {
- throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
- }
- } catch (Exception ex) {
- // ClassNotFoundException, IllegalAccessException,
- // InstantiationException, SecurityException or
- // ClassCastException
- throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
- }
- }
- } ;
-
- return op ;
- }
-
- private Operation makeIIOPPrimaryToContactInfoOperation()
- {
- Operation op = new Operation() {
- public Object operate( Object value )
- {
- String param = (String)value ;
-
- try {
- Class> iiopPrimaryToContactInfoClass =
- SharedSecrets.getJavaCorbaAccess().loadClass(param);
- // For security reasons avoid creating an instance if
- // this socket factory class is not one that would fail
- // the class cast anyway.
- if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
- return iiopPrimaryToContactInfoClass.newInstance();
- } else {
- throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
- }
- } catch (Exception ex) {
- // ClassNotFoundException, IllegalAccessException,
- // InstantiationException, SecurityException or
- // ClassCastException
- throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
- }
- }
- } ;
-
- return op ;
- }
-
- private Operation makeContactInfoListFactoryOperation()
- {
- Operation op = new Operation() {
- public Object operate( Object value )
- {
- String param = (String)value ;
-
- try {
- Class> contactInfoListFactoryClass =
- SharedSecrets.getJavaCorbaAccess().loadClass(param);
- // For security reasons avoid creating an instance if
- // this socket factory class is not one that would fail
- // the class cast anyway.
- if (CorbaContactInfoListFactory.class.isAssignableFrom(
- contactInfoListFactoryClass)) {
- return contactInfoListFactoryClass.newInstance();
- } else {
- throw wrapper.illegalContactInfoListFactoryType(
- contactInfoListFactoryClass.toString() ) ;
- }
- } catch (Exception ex) {
- // ClassNotFoundException, IllegalAccessException,
- // InstantiationException, SecurityException or
- // ClassCastException
- throw wrapper.badContactInfoListFactory( ex, param ) ;
- }
- }
- } ;
-
- return op ;
- }
-
- private Operation makeCSOperation()
- {
- Operation csop = new Operation() {
- public Object operate( Object value )
- {
- String val = (String)value ;
- return CodeSetComponentInfo.createFromString( val ) ;
- }
- } ;
-
- return csop ;
- }
-
- private Operation makeADOperation()
- {
- Operation admap = new Operation() {
- private Integer[] map = {
- new Integer( KeyAddr.value ),
- new Integer( ProfileAddr.value ),
- new Integer( ReferenceAddr.value ),
- new Integer( KeyAddr.value ) } ;
-
- public Object operate( Object value )
- {
- int val = ((Integer)value).intValue() ;
- return map[val] ;
- }
- } ;
-
- Operation rangeop = OperationFactory.integerRangeAction( 0, 3 ) ;
- Operation op1 = OperationFactory.compose( rangeop, admap ) ;
- Operation result = OperationFactory.compose( op1, OperationFactory.convertIntegerToShort() ) ;
- return result ;
- }
-
- private Operation makeFSOperation() {
- Operation fschecker = new Operation() {
- public Object operate( Object value )
- {
- int giopFragmentSize = ((Integer)value).intValue() ;
- if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){
- throw wrapper.fragmentSizeMinimum( new Integer( giopFragmentSize ),
- new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ;
- }
-
- if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0)
- throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ),
- new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ;
-
- return value ;
- }
- } ;
-
- Operation result = OperationFactory.compose( OperationFactory.integerAction(),
- fschecker ) ;
- return result ;
- }
-
- private Operation makeGVOperation() {
- Operation gvHelper = OperationFactory.listAction( ".",
- OperationFactory.integerAction() ) ;
- Operation gvMain = new Operation() {
- public Object operate( Object value )
- {
- Object[] nums = (Object[])value ;
- int major = ((Integer)(nums[0])).intValue() ;
- int minor = ((Integer)(nums[1])).intValue() ;
-
- return new GIOPVersion( major, minor ) ;
- }
- } ;
-
- Operation result = OperationFactory.compose( gvHelper, gvMain );
- return result ;
- }
-
- public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject
- implements ORBInitializer
- {
- public boolean equals( Object other )
- {
- return other instanceof TestORBInitializer1 ;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public void pre_init( ORBInitInfo info )
- {
- }
-
- public void post_init( ORBInitInfo info )
- {
- }
- }
-
- public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject
- implements ORBInitializer
- {
- public boolean equals( Object other )
- {
- return other instanceof TestORBInitializer2 ;
- }
-
- public int hashCode() {
- return 1;
- }
-
- public void pre_init( ORBInitInfo info )
- {
- }
-
- public void post_init( ORBInitInfo info )
- {
- }
- }
-
- private Operation makeROIOperation() {
- Operation clsop = OperationFactory.classAction() ;
- Operation indexOp = OperationFactory.suffixAction() ;
- Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
- Operation mop = OperationFactory.maskErrorAction( op1 ) ;
-
- Operation mkinst = new Operation() {
- public Object operate( Object value )
- {
- final Class initClass = (Class)value ;
- if (initClass == null)
- return null ;
-
- // For security reasons avoid creating an instance
- // if this class is one that would fail the class cast
- // to ORBInitializer anyway.
- if( org.omg.PortableInterceptor.ORBInitializer.class.isAssignableFrom(
- initClass ) ) {
- // Now that we have a class object, instantiate one and
- // remember it:
- ORBInitializer initializer = null ;
-
- try {
- initializer = (ORBInitializer)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run()
- throws InstantiationException, IllegalAccessException
- {
- return initClass.newInstance() ;
- }
- }
- ) ;
- } catch (PrivilegedActionException exc) {
- // Unwrap the exception, as we don't care exc here
- throw wrapper.orbInitializerFailure( exc.getException(),
- initClass.getName() ) ;
- } catch (Exception exc) {
- throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ;
- }
-
- return initializer ;
- } else {
- throw wrapper.orbInitializerType( initClass.getName() ) ;
- }
- }
- } ;
-
- Operation result = OperationFactory.compose( mop, mkinst ) ;
-
- return result ;
- }
-
- public static final class TestAcceptor1
- implements Acceptor
- {
- public boolean equals( Object other )
- {
- return other instanceof TestAcceptor1 ;
- }
-
- public int hashCode() { return 1; }
- public boolean initialize() { return true; }
- public boolean initialized() { return true; }
- public String getConnectionCacheType() { return "FOO"; }
- public void setConnectionCache(InboundConnectionCache connectionCache){}
- public InboundConnectionCache getConnectionCache() { return null; }
- public boolean shouldRegisterAcceptEvent() { return true; }
- public void setUseSelectThreadForConnections(boolean x) { }
- public boolean shouldUseSelectThreadForConnections() { return true; }
- public void setUseWorkerThreadForConnections(boolean x) { }
- public boolean shouldUseWorkerThreadForConnections() { return true; }
- public void accept() { }
- public void close() { }
- public EventHandler getEventHandler() { return null; }
- public MessageMediator createMessageMediator(
- Broker xbroker, Connection xconnection) { return null; }
- public MessageMediator finishCreatingMessageMediator(
- Broker xbroker, Connection xconnection,
- MessageMediator messageMediator) { return null; }
- public InputObject createInputObject(
- Broker broker, MessageMediator messageMediator) { return null; }
- public OutputObject createOutputObject(
- Broker broker, MessageMediator messageMediator) { return null; }
- }
-
- public static final class TestAcceptor2
- implements Acceptor
- {
- public boolean equals( Object other )
- {
- return other instanceof TestAcceptor2 ;
- }
- public int hashCode() { return 1; }
- public boolean initialize() { return true; }
- public boolean initialized() { return true; }
- public String getConnectionCacheType() { return "FOO"; }
- public void setConnectionCache(InboundConnectionCache connectionCache){}
- public InboundConnectionCache getConnectionCache() { return null; }
- public boolean shouldRegisterAcceptEvent() { return true; }
- public void setUseSelectThreadForConnections(boolean x) { }
- public boolean shouldUseSelectThreadForConnections() { return true; }
- public void setUseWorkerThreadForConnections(boolean x) { }
- public boolean shouldUseWorkerThreadForConnections() { return true; }
- public void accept() { }
- public void close() { }
- public EventHandler getEventHandler() { return null; }
- public MessageMediator createMessageMediator(
- Broker xbroker, Connection xconnection) { return null; }
- public MessageMediator finishCreatingMessageMediator(
- Broker xbroker, Connection xconnection,
- MessageMediator messageMediator) { return null; }
- public InputObject createInputObject(
- Broker broker, MessageMediator messageMediator) { return null; }
- public OutputObject createOutputObject(
- Broker broker, MessageMediator messageMediator) { return null; }
- }
-
- // REVISIT - this is a cut and paste modification of makeROIOperation.
- private Operation makeAcceptorInstantiationOperation() {
- Operation clsop = OperationFactory.classAction() ;
- Operation indexOp = OperationFactory.suffixAction() ;
- Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
- Operation mop = OperationFactory.maskErrorAction( op1 ) ;
-
- Operation mkinst = new Operation() {
- public Object operate( Object value )
- {
- final Class initClass = (Class)value ;
- if (initClass == null)
- return null ;
-
- // For security reasons avoid creating an instance
- // if this class is one that would fail the class cast
- // to ORBInitializer anyway.
- if( Acceptor.class.isAssignableFrom( initClass ) ) {
- // Now that we have a class object, instantiate one and
- // remember it:
- Acceptor acceptor = null ;
-
- try {
- acceptor = (Acceptor)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run()
- throws InstantiationException, IllegalAccessException
- {
- return initClass.newInstance() ;
- }
- }
- ) ;
- } catch (PrivilegedActionException exc) {
- // Unwrap the exception, as we don't care exc here
- throw wrapper.acceptorInstantiationFailure( exc.getException(),
- initClass.getName() ) ;
- } catch (Exception exc) {
- throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ;
- }
-
- return acceptor ;
- } else {
- throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ;
- }
- }
- } ;
-
- Operation result = OperationFactory.compose( mop, mkinst ) ;
-
- return result ;
- }
-
- private Operation makeInitRefOperation() {
- return new Operation() {
- public Object operate( Object value )
- {
- // Object is String[] of length 2.
- String[] values = (String[])value ;
- if (values.length != 2)
- throw wrapper.orbInitialreferenceSyntax() ;
-
- return values[0] + "=" + values[1] ;
- }
- } ;
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserAction.java 2018-01-30 20:19:03.000000000 -0500
+++ /dev/null 2018-01-30 20:19:03.000000000 -0500
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import org.omg.CORBA.INITIALIZE ;
-
-import java.util.Properties ;
-import java.util.List ;
-import java.util.LinkedList ;
-import java.util.Iterator ;
-
-import java.lang.reflect.Array ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.StringPair ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-
-import com.sun.corba.se.impl.orbutil.ObjectUtility ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-
-public class PrefixParserAction extends ParserActionBase {
- private Class componentType ;
- private ORBUtilSystemException wrapper ;
-
- public PrefixParserAction( String propertyName,
- Operation operation, String fieldName, Class componentType )
- {
- super( propertyName, true, operation, fieldName ) ;
- this.componentType = componentType ;
- this.wrapper = ORBUtilSystemException.get(
- CORBALogDomains.ORB_LIFECYCLE ) ;
- }
-
- /** For each String s that matches the prefix given by getPropertyName(),
- * apply getOperation() to { suffix( s ), value }
- * and add the result to an Object[]
- * which forms the result of apply. Returns null if there are no
- * matches.
- */
- public Object apply( Properties props )
- {
- String prefix = getPropertyName() ;
- int prefixLength = prefix.length() ;
- if (prefix.charAt( prefixLength - 1 ) != '.') {
- prefix += '.' ;
- prefixLength++ ;
- }
-
- List matches = new LinkedList() ;
-
- // Find all keys in props that start with propertyName
- Iterator iter = props.keySet().iterator() ;
- while (iter.hasNext()) {
- String key = (String)(iter.next()) ;
- if (key.startsWith( prefix )) {
- String suffix = key.substring( prefixLength ) ;
- String value = props.getProperty( key ) ;
- StringPair data = new StringPair( suffix, value ) ;
- Object result = getOperation().operate( data ) ;
- matches.add( result ) ;
- }
- }
-
- int size = matches.size() ;
- if (size > 0) {
- // Convert the list into an array of the proper type.
- // An Object[] as a result does NOT work. Also report
- // any errors carefully, as errors here or in parsers that
- // use this Operation often show up at ORB.init().
- Object result = null ;
- try {
- result = Array.newInstance( componentType, size ) ;
- } catch (Throwable thr) {
- throw wrapper.couldNotCreateArray( thr,
- getPropertyName(), componentType,
- new Integer( size ) ) ;
- }
-
- Iterator iter2 = matches.iterator() ;
- int ctr = 0 ;
- while (iter2.hasNext()) {
- Object obj = iter2.next() ;
-
- try {
- Array.set( result, ctr, obj ) ;
- } catch (Throwable thr) {
- throw wrapper.couldNotSetArray( thr,
- getPropertyName(), new Integer(ctr),
- componentType, new Integer(size),
- obj.toString() ) ;
- }
- ctr++ ;
- }
-
- return result ;
- } else
- return null ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserData.java 2018-01-30 20:19:03.000000000 -0500
+++ /dev/null 2018-01-30 20:19:03.000000000 -0500
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orb ;
-
-import java.util.Properties ;
-
-import com.sun.corba.se.spi.orb.StringPair ;
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.PropertyParser ;
-
-public class PrefixParserData extends ParserDataBase {
-
- private StringPair[] testData ;
- private Class componentType ;
-
- public PrefixParserData( String propertyName,
- Operation operation, String fieldName, Object defaultValue,
- Object testValue, StringPair[] testData, Class componentType )
- {
- super( propertyName, operation, fieldName, defaultValue, testValue ) ;
- this.testData = testData ;
- this.componentType = componentType ;
- }
-
- public void addToParser( PropertyParser parser )
- {
- parser.addPrefix( getPropertyName(), getOperation(), getFieldName(),
- componentType ) ;
- }
-
- public void addToProperties( Properties props )
- {
- for (int ctr=0; ctr
- class combine
- init : X
- add( X, Y ) : X
- op1( String ) : X
- op2( String ) : Y
-
- reduce( sep, op1, op2, comb ) ( String ) : X
-
- operate(data)
- if (sep in data) // either first from left orfirst from right
- split data into prefix, rest
- return comb.add( op2.operate( rest ), op1.operate( prefix ) )
- else
- return comb.add( comb.init(), op1.operate( data ) )
-
- example
-
- op = reduce( ":", op1, null, comb )
- op.setop2( op )
-
- op.operate( "A:B:C" ) =
- comb.add( op.operate( "B:C" ), op1.operate( "A" ) ) =
- comb.add( comb.add( op.operate("C"), op1.operate("B") ), op1.operate( "A" ) =
- comb.add( comb.add( comb.add( comb.init(), op1.operate("C") ), op1.operate("B") ),
- op1.operate("A") )
-
-
-Splitter interface
-
-interface Splitter {
- List split( String str )
-}
-
-variations:
- - separated list SL
- - first sep rest FSR
- - fail if not present one arg
- - default value two args
- - rest sep last RSL
- - fail if not present one arg
- - default value two args
-
-Have we just pushed the real problem off a level?
-
-How do we combine:
- op1 = FSR("@",v12)
- op2 = LSR(":",9090)
-
- str = 1.2@myhost:2345
-
- op1(str) = ( "1.2" "myhost:2345" )
-
- define splice( int index, Operator op ) on a list of strings, with op( String ) : (String)
- to replace the indexth element of a list of strings with the list returned
- from op( element ).
-
- compose( op1, splice( 1, op2 )) is the correct parser.
-
-
-A grammar for parsers?
-
-parser : simple_parser
- | parser ":" simple_parser ;
-
-simple_parser : ident
- | ident "(" param_list ")" ;
-
-param_list : param
- | param_list "," param ;
-
-param : constant
- | parser ;
-
-constant is a Java constant
-ident x is interpreted as either a public static method on OperationFactory
-named xAction which takes as arguments the types of the param list, or as
-the fully qualified class name of a class that implements Operation and has
-a constructor which takes as arguments the types of the param list.
-
-From parser table:
-
-debugFlags string
-ORBInitialHost string
-ORBInitialPort integer
-ORBServerHost string
-ORBServerPort integer
-orbId string
-highWaterMark integer
-lowWaterMark integer
-etc.
-
-giopVersion construct(GIOPVersion.class):map(integer):list('.')
-giopFragmentSize mod(ORBConstants.GIOP_FRAGMENT_DIVISOR):min(ORBConstants.GIOP_FRAGMENT_SIZE):integer
-
-Lisp notation:
- parse((mod ORBConstants.GIOP_FRAGMENT_DIVISOR) (min ...) (integer))
-
-giop11BuffMgr makeMap(map) where map is constructed in java with
- map.get("GROW") = Integer(0)
- map.get("CLCT") = Integer(1)
- map.get("STRM") = Integer(2)
-
-giopTargetAddressPreference intToShort:integerRange(0,3)
-giopAddressDisposition another map variant
-
-charData construct(CodeSetComponentInfo.class):string
-
-
-What about corbaloc:?
-
-v12 = GIOPVersion.v12 ;
-
-giopVersion = construct( GIOPVersion.class ):mapSequence( [integer,integer] ):FSR(".")
-
-iiopAddress = mapSequence( [giopVersion,identity,integer] ):
- splice( 1, LSR( ":" 9090 )):
- FSR( "@", v12 )
-
-addressHandler = choice(
- "iiop:", iiopAddress
- ":", iiopAddress
-)
-
-addressList = map(addressHandler):SL(",")
-
-choice(
- "corbaloc:", mapSequence( [addressList,string] ):RSL("/", "NameService"),
- "corbaname:", ...
-)
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CacheTable.java 2018-01-30 20:19:05.000000000 -0500
+++ /dev/null 2018-01-30 20:19:05.000000000 -0500
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.orb.ORB;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-public class CacheTable {
- class Entry {
- java.lang.Object key;
- int val;
- Entry next; // this chains the collision list of table "map"
- Entry rnext; // this chains the collision list of table "rmap"
- public Entry(java.lang.Object k, int v) {
- key = k;
- val = v;
- next = null;
- rnext = null;
- }
- }
- private boolean noReverseMap;
- // size must be power of 2
- static final int INITIAL_SIZE = 16;
- static final int MAX_SIZE = 1 << 30;
- int size;
- int entryCount;
- private Entry [] map;
- private Entry [] rmap;
-
- private ORB orb;
- private ORBUtilSystemException wrapper;
-
- private CacheTable() {}
- public CacheTable(ORB orb, boolean u) {
- //System.out.println("using new cache table");
- this.orb = orb;
- wrapper = ORBUtilSystemException.get(orb,
- CORBALogDomains.RPC_ENCODING);
- noReverseMap = u;
- size = INITIAL_SIZE;
- entryCount = 0;
- initTables();
- }
- private void initTables() {
- map = new Entry[size];
- rmap = noReverseMap ? null : new Entry[size];
- }
- private void grow() {
- if (size == MAX_SIZE)
- return;
- Entry [] oldMap = map;
- int oldSize = size;
- size <<= 1;
- initTables();
- // now rehash the entries into the new table
- for (int i = 0; i < oldSize; i++) {
- for (Entry e = oldMap[i]; e != null; e = e.next)
- put_table(e.key, e.val);
- }
- }
- private int moduloTableSize(int h) {
- // these are the "supplemental hash function" copied from
- // java.util.HashMap, supposed to be "critical"
- h += ~(h << 9);
- h ^= (h >>> 14);
- h += (h << 4);
- h ^= (h >>> 10);
- return h & (size - 1);
- }
- private int hash(java.lang.Object key) {
- return moduloTableSize(System.identityHashCode(key));
- }
- private int hash(int val) {
- return moduloTableSize(val);
- }
- public final void put(java.lang.Object key, int val) {
- if (put_table(key, val)) {
- entryCount++;
- if (entryCount > size * 3 / 4)
- grow();
- }
- }
- private boolean put_table(java.lang.Object key, int val) {
- int index = hash(key);
- for (Entry e = map[index]; e != null; e = e.next) {
- if (e.key == key) {
- if (e.val != val) {
- throw wrapper.duplicateIndirectionOffset();
- }
- // if we get here we are trying to put in the same key/val pair
- // this is a no-op, so we just return
- return false;
- }
- }
- // this means the key is not present in our table
- // then it shouldnt be present in our reverse table either
- Entry newEntry = new Entry(key, val);
- newEntry.next = map[index];
- map[index] = newEntry;
- if (!noReverseMap) {
- int rindex = hash(val);
- newEntry.rnext = rmap[rindex];
- rmap[rindex] = newEntry;
- }
- return true;
- }
- public final boolean containsKey(java.lang.Object key) {
- return (getVal(key) != -1);
- }
- public final int getVal(java.lang.Object key) {
- int index = hash(key);
- for (Entry e = map[index]; e != null; e = e.next) {
- if (e.key == key)
- return e.val;
- }
- return -1;
- }
- public final boolean containsVal(int val) {
- return (getKey(val) != null);
- }
- public final boolean containsOrderedVal(int val) {
- return containsVal(val);
- }
- public final java.lang.Object getKey(int val) {
- int index = hash(val);
- for (Entry e = rmap[index]; e != null; e = e.rnext) {
- if (e.val == val)
- return e.key;
- }
- return null;
- }
- public void done() {
- map = null;
- rmap = null;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java 2018-01-30 20:19:06.000000000 -0500
+++ /dev/null 2018-01-30 20:19:06.000000000 -0500
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-
-public class CorbaResourceUtil {
- public static String getString(String key) {
- if (!resourcesInitialized) {
- initResources();
- }
-
- try {
- return resources.getString(key);
- } catch (MissingResourceException ignore) {
- }
- return null;
- }
-
- public static String getText(String key) {
- String message = getString(key);
- if (message == null) {
- message = "no text found: \"" + key + "\"";
- }
- return message;
- }
-
- public static String getText(String key, int num) {
- return getText(key, Integer.toString(num), null, null);
- }
-
- public static String getText(String key, String arg0) {
- return getText(key, arg0, null, null);
- }
-
- public static String getText(String key, String arg0, String arg1) {
- return getText(key, arg0, arg1, null);
- }
-
- public static String getText(String key,
- String arg0, String arg1, String arg2)
- {
- String format = getString(key);
- if (format == null) {
- format = "no text found: key = \"" + key + "\", " +
- "arguments = \"{0}\", \"{1}\", \"{2}\"";
- }
-
- String[] args = new String[3];
- args[0] = (arg0 != null ? arg0.toString() : "null");
- args[1] = (arg1 != null ? arg1.toString() : "null");
- args[2] = (arg2 != null ? arg2.toString() : "null");
-
- return java.text.MessageFormat.format(format, (Object[]) args);
- }
-
- private static boolean resourcesInitialized = false;
- private static ResourceBundle resources;
-
- private static void initResources() {
- try {
- resources =
- ResourceBundle.getBundle("com.sun.corba.se.impl.orbutil.resources.sunorb");
- resourcesInitialized = true;
- } catch (MissingResourceException e) {
- throw new Error("fatal: missing resource bundle: " +
- e.getClassName());
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java 2018-01-30 20:19:06.000000000 -0500
+++ /dev/null 2018-01-30 20:19:06.000000000 -0500
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil ;
-
-import java.util.ArrayList ;
-
-/** Utility for managing mappings from densely allocated integer
- * keys to arbitrary objects. This should only be used for
- * keys in the range 0..max such that "most" of the key space is actually
- * used.
- */
-public class DenseIntMapImpl
-{
- private ArrayList list = new ArrayList() ;
-
- private void checkKey( int key )
- {
- if (key < 0)
- throw new IllegalArgumentException( "Key must be >= 0." ) ;
- }
-
- /**
- * If {@code key >= 0}, return the value bound to key, or null if none.
- * Throws IllegalArgumentException if {@code key < 0}.
- */
- public Object get( int key )
- {
- checkKey( key ) ;
-
- Object result = null ;
- if (key < list.size())
- result = list.get( key ) ;
-
- return result ;
- }
-
- /**
- * If {@code key >= 0}, bind value to the key.
- * Throws IllegalArgumentException if {@code key < 0}.
- */
- public void set( int key, Object value )
- {
- checkKey( key ) ;
- extend( key ) ;
- list.set( key, value ) ;
- }
-
- private void extend( int index )
- {
- if (index >= list.size()) {
- list.ensureCapacity( index + 1 ) ;
- int max = list.size() ;
- while (max++ <= index)
- list.add( null ) ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/GetPropertyAction.java 2018-01-30 20:19:07.000000000 -0500
+++ /dev/null 2018-01-30 20:19:07.000000000 -0500
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil ;
-
-/**
- * A convenience class for retrieving the string value of a system
- * property as a privileged action. This class is directly copied
- * from sun.security.action.GetPropertyAction in order to avoid
- * depending on the sun.security.action package.
- *
- * An instance of this class can be used as the argument of
- * AccessController.doPrivileged
.
- *
- *
The following code retrieves the value of the system
- * property named "prop"
as a privileged action:
- *
- *
- * String s = (String) java.security.AccessController.doPrivileged(
- * new GetPropertyAction("prop"));
- *
- *
- * @author Roland Schemers
- * @author Ken Cavanaugh
- * @see java.security.PrivilegedAction
- * @see java.security.AccessController
- */
-
-public class GetPropertyAction implements java.security.PrivilegedAction {
- private String theProp;
- private String defaultVal;
-
- /**
- * Constructor that takes the name of the system property whose
- * string value needs to be determined.
- *
- * @param theProp the name of the system property.
- */
- public GetPropertyAction(String theProp) {
- this.theProp = theProp;
- }
-
- /**
- * Constructor that takes the name of the system property and the default
- * value of that property.
- *
- * @param theProp the name of the system property.
- * @param defaultVal the default value.
- */
- public GetPropertyAction(String theProp, String defaultVal) {
- this.theProp = theProp;
- this.defaultVal = defaultVal;
- }
-
- /**
- * Determines the string value of the system property whose
- * name was specified in the constructor.
- *
- * @return the string value of the system property,
- * or the default value if there is no property with that key.
- */
- public Object run() {
- String value = System.getProperty(theProp);
- return (value == null) ? defaultVal : value;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/HexOutputStream.java 2018-01-30 20:19:08.000000000 -0500
+++ /dev/null 2018-01-30 20:19:08.000000000 -0500
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.io.StringWriter;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * Writes each input byte as a 2 byte hexidecimal output pair making it
- * possible to turn arbitrary binary data into an ASCII format.
- * The high 4 bits of the byte is translated into the first byte.
- *
- * @author Jeff Nisewanger
- */
-public class HexOutputStream extends OutputStream
-{
- static private final char hex[] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
- };
-
- private StringWriter writer;
-
- /**
- * Creates a new HexOutputStream.
- * @param w The underlying StringWriter.
- */
- public
- HexOutputStream(StringWriter w) {
- writer = w;
- }
-
-
- /**
- * Writes a byte. Will block until the byte is actually
- * written.
- * param b The byte to write out.
- * @exception java.io.IOException I/O error occurred.
- */
- public synchronized void write(int b) throws IOException {
- writer.write(hex[((b >> 4) & 0xF)]);
- writer.write(hex[((b >> 0) & 0xF)]);
- }
-
- public synchronized void write(byte[] b) throws IOException {
- write(b, 0, b.length);
- }
-
- public synchronized void write(byte[] b, int off, int len)
- throws IOException
- {
- for(int i=0; i < len; i++) {
- write(b[off + i]);
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java 2018-01-30 20:19:08.000000000 -0500
+++ /dev/null 2018-01-30 20:19:09.000000000 -0500
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-package com.sun.corba.se.impl.orbutil;
-
-import java.io.*;
-import java.util.Hashtable;
-
-class LegacyHookGetFields extends ObjectInputStream.GetField {
- private Hashtable fields = null;
-
- LegacyHookGetFields(Hashtable fields){
- this.fields = fields;
- }
-
- /**
- * Get the ObjectStreamClass that describes the fields in the stream.
- */
- public java.io.ObjectStreamClass getObjectStreamClass() {
- return null;
- }
-
- /**
- * Return true if the named field is defaulted and has no value
- * in this stream.
- */
- public boolean defaulted(String name)
- throws IOException, IllegalArgumentException {
- return (!fields.containsKey(name));
- }
-
- /**
- * Get the value of the named boolean field from the persistent field.
- */
- public boolean get(String name, boolean defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Boolean)fields.get(name)).booleanValue();
- }
-
- /**
- * Get the value of the named char field from the persistent fields.
- */
- public char get(String name, char defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Character)fields.get(name)).charValue();
-
- }
-
- /**
- * Get the value of the named byte field from the persistent fields.
- */
- public byte get(String name, byte defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Byte)fields.get(name)).byteValue();
-
- }
-
- /**
- * Get the value of the named short field from the persistent fields.
- */
- public short get(String name, short defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Short)fields.get(name)).shortValue();
-
- }
-
- /**
- * Get the value of the named int field from the persistent fields.
- */
- public int get(String name, int defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Integer)fields.get(name)).intValue();
-
- }
-
- /**
- * Get the value of the named long field from the persistent fields.
- */
- public long get(String name, long defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Long)fields.get(name)).longValue();
-
- }
-
- /**
- * Get the value of the named float field from the persistent fields.
- */
- public float get(String name, float defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Float)fields.get(name)).floatValue();
-
- }
-
- /**
- * Get the value of the named double field from the persistent field.
- */
- public double get(String name, double defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return ((Double)fields.get(name)).doubleValue();
-
- }
-
- /**
- * Get the value of the named Object field from the persistent field.
- */
- public Object get(String name, Object defvalue)
- throws IOException, IllegalArgumentException {
- if (defaulted(name))
- return defvalue;
- else return fields.get(name);
-
- }
-
- public String toString(){
- return fields.toString();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java 2018-01-30 20:19:09.000000000 -0500
+++ /dev/null 2018-01-30 20:19:09.000000000 -0500
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-package com.sun.corba.se.impl.orbutil;
-
-import java.io.*;
-import java.util.Hashtable;
-
-/**
- * Since ObjectOutputStream.PutField methods specify no exceptions,
- * we are not checking for null parameters on put methods.
- */
-class LegacyHookPutFields extends ObjectOutputStream.PutField
-{
- private Hashtable fields = new Hashtable();
-
- /**
- * Put the value of the named boolean field into the persistent field.
- */
- public void put(String name, boolean value){
- fields.put(name, new Boolean(value));
- }
-
- /**
- * Put the value of the named char field into the persistent fields.
- */
- public void put(String name, char value){
- fields.put(name, new Character(value));
- }
-
- /**
- * Put the value of the named byte field into the persistent fields.
- */
- public void put(String name, byte value){
- fields.put(name, new Byte(value));
- }
-
- /**
- * Put the value of the named short field into the persistent fields.
- */
- public void put(String name, short value){
- fields.put(name, new Short(value));
- }
-
- /**
- * Put the value of the named int field into the persistent fields.
- */
- public void put(String name, int value){
- fields.put(name, new Integer(value));
- }
-
- /**
- * Put the value of the named long field into the persistent fields.
- */
- public void put(String name, long value){
- fields.put(name, new Long(value));
- }
-
- /**
- * Put the value of the named float field into the persistent fields.
- *
- */
- public void put(String name, float value){
- fields.put(name, new Float(value));
- }
-
- /**
- * Put the value of the named double field into the persistent field.
- */
- public void put(String name, double value){
- fields.put(name, new Double(value));
- }
-
- /**
- * Put the value of the named Object field into the persistent field.
- */
- public void put(String name, Object value){
- fields.put(name, value);
- }
-
- /**
- * Write the data and fields to the specified ObjectOutput stream.
- */
- public void write(ObjectOutput out) throws IOException {
- out.writeObject(fields);
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LogKeywords.java 2018-01-30 20:19:10.000000000 -0500
+++ /dev/null 2018-01-30 20:19:10.000000000 -0500
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-/**
- * All the Keywords that will be used in Logging Messages for CORBA need to
- * be defined here. The LogKeywords will be useful for searching log messages
- * based on the standard keywords, it is also useful to work with LogAnalyzing
- * tools.
- * We will try to standardize these keywords in JSR 117 Logging
- */
-public class LogKeywords {
-
- /**
- ** Keywords for Lifecycle Loggers.
- ** _REVISIT_ After it is clearly defined in JSR 117
- **/
- public final static String LIFECYCLE_CREATE = "<>";
- public final static String LIFECYCLE_INITIALIZE = "<>";
- public final static String LIFECYCLE_SHUTDOWN = "<>";
- public final static String LIFECYCLE_DESTROY = "<>";
-
-
- public final static String LIFECYCLE_CREATE_SUCCESS =
- LIFECYCLE_CREATE + "<>";
- public final static String LIFECYCLE_CREATE_FAILURE =
- LIFECYCLE_CREATE + "<>";
- public final static String LIFECYCLE_INITIALIZE_SUCCESS =
- LIFECYCLE_INITIALIZE + "<>";
- public final static String LIFECYCLE_INITIALIZE_FAILURE =
- LIFECYCLE_INITIALIZE + "<>";
- public final static String LIFECYCLE_SHUTDOWN_SUCCESS =
- LIFECYCLE_SHUTDOWN + "<>";
- public final static String LIFECYCLE_SHUTDOWN_FAILURE =
- LIFECYCLE_SHUTDOWN + "<>";
- public final static String LIFECYCLE_DESTROY_SUCCESS =
- LIFECYCLE_DESTROY + "<>";
- public final static String LIFECYCLE_DESTROY_FAILURE =
- LIFECYCLE_DESTROY + "<>";
-
- /**
- ** Keywords for Naming Read Loggers.
- **/
- public final static String NAMING_RESOLVE = "<>";
- public final static String NAMING_LIST = "<>";
-
- public final static String NAMING_RESOLVE_SUCCESS =
- NAMING_RESOLVE + "<>";
- public final static String NAMING_RESOLVE_FAILURE =
- NAMING_RESOLVE + "<>";
- public final static String NAMING_LIST_SUCCESS =
- NAMING_LIST + "<>";
- public final static String NAMING_LIST_FAILURE =
- NAMING_LIST + "<>";
-
- /**
- ** Keywords for Naming Update Loggers.
- **/
- public final static String NAMING_BIND = "<>";
- public final static String NAMING_UNBIND = "<>";
- public final static String NAMING_REBIND = "<>";
-
- public final static String NAMING_BIND_SUCCESS =
- NAMING_BIND + "<>";
- public final static String NAMING_BIND_FAILURE =
- NAMING_BIND + "<>";
- public final static String NAMING_UNBIND_SUCCESS =
- NAMING_UNBIND + "<>";
- public final static String NAMING_UNBIND_FAILURE =
- NAMING_UNBIND + "<>";
- public final static String NAMING_REBIND_SUCCESS =
- NAMING_REBIND + "<>";
- public final static String NAMING_REBIND_FAILURE =
- NAMING_REBIND + "<>";
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBConstants.java 2018-01-30 20:19:11.000000000 -0500
+++ /dev/null 2018-01-30 20:19:11.000000000 -0500
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import com.sun.corba.se.impl.util.SUNVMCID ;
-
-public class ORBConstants {
- private ORBConstants() {}
-
- public static final String STRINGIFY_PREFIX = "IOR:" ;
-
- /* TAGS
- tag-request@omg.org
- FAQ on tags and tag allocation: http://doc.omg.org/ptc/99-02-01.
- http://doc.omg.org/standard-tags
- http://doc.omg.org/vendor-tags
-
- Last update: 19th August 2003 (ptc/03-08-14)
-
- // Legacy
- 1 profile tag 0x4f4e4300 ("ONC\x00")
- 1 profile tag 0x4e454f00 ("NEO\x00")
- 1 profile tag 0x434f4f4c ("COOL")
- 16 service tags 0x4e454f00 - 0x4e454f0f ("NEO\x00" - "NEO\x0f")
-
- // Current
- 16 VMCID 0x5355xxxx ("SU\x00\x00" - "SU\xff\xff")
- 16 profile tags 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f")
- 16 ORB Type IDs 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f")
- 64 service tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f")
- 64 component tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f")
- */
-
- // All NEO service contexts must be in the range
- // NEO_FIRST_SERVICE_CONTEXT to
- // NEO_FIRST_SERVICE_CONTEXT + NUM_NEO_SERVICE_CONTEXTS - 1
- public static final int NEO_FIRST_SERVICE_CONTEXT = 0x4e454f00 ;
- public static final int NUM_NEO_SERVICE_CONTEXTS = 15 ;
- public static final int TAG_ORB_VERSION = NEO_FIRST_SERVICE_CONTEXT ;
-
- public static final int SUN_TAGGED_COMPONENT_ID_BASE = 0x53554e00;
- public static final int SUN_SERVICE_CONTEXT_ID_BASE = 0x53554e00;
-
- //
- // Tagged Components Ids
- //
-
- // Used by AS 7 for IIOP failover.
- public static final int TAG_CONTAINER_ID =
- SUN_TAGGED_COMPONENT_ID_BASE + 0;
- // Used by AS 8.1 for Request Partioning
- public static final int TAG_REQUEST_PARTITIONING_ID =
- SUN_TAGGED_COMPONENT_ID_BASE + 1;
- // TaggedComponentId for Java serialization tagged component.
- public static final int TAG_JAVA_SERIALIZATION_ID =
- SUN_TAGGED_COMPONENT_ID_BASE + 2;
-
- //
- // Service Context Ids
- //
-
- // Used by AS 7 for IIOP failover.
- public static final int CONTAINER_ID_SERVICE_CONTEXT =
- SUN_SERVICE_CONTEXT_ID_BASE + 0;
-
- // All Sun policies are allocated using the SUNVMCID, which is also
- // used for minor codes. This allows 12 bits of offset, so
- // the largest legal Sun policy is SUNVMCID.value + 4095.
- public static final int SERVANT_CACHING_POLICY = SUNVMCID.value + 0 ;
- public static final int ZERO_PORT_POLICY = SUNVMCID.value + 1 ;
- public static final int COPY_OBJECT_POLICY = SUNVMCID.value + 2 ;
- public static final int REQUEST_PARTITIONING_POLICY = SUNVMCID.value + 3 ;
-
- // These are the subcontract IDs for various qualities of
- // service/implementation.
- // Persistent SCIDs have the second bit as 1.
- // SCIDs less than FIRST_POA_SCID are JavaIDL SCIDs.
- public static final int TOA_SCID = 2 ;
-
- public static final int DEFAULT_SCID = TOA_SCID ;
-
- public static final int FIRST_POA_SCID = 32;
- public static final int MAX_POA_SCID = 63;
- public static final int TRANSIENT_SCID = FIRST_POA_SCID ;
- public static final int PERSISTENT_SCID = makePersistent( TRANSIENT_SCID ) ;
- public static final int SC_TRANSIENT_SCID = FIRST_POA_SCID + 4 ;
- public static final int SC_PERSISTENT_SCID = makePersistent( SC_TRANSIENT_SCID ) ;
- public static final int IISC_TRANSIENT_SCID = FIRST_POA_SCID + 8 ;
- public static final int IISC_PERSISTENT_SCID = makePersistent( IISC_TRANSIENT_SCID ) ;
- public static final int MINSC_TRANSIENT_SCID = FIRST_POA_SCID + 12 ;
- public static final int MINSC_PERSISTENT_SCID = makePersistent( MINSC_TRANSIENT_SCID ) ;
-
- public static boolean isTransient( int scid )
- {
- return (scid & 2) == 0 ;
- }
-
- public static int makePersistent( int scid )
- {
- return scid | 2 ;
- }
-
- // Constants for ORB properties **************************************************************
-
- // All ORB properties must follow the following rules:
- // 1. Property names must start with either
- // ORG_OMG_CORBA_PREFIX or SUN_PREFIX.
- // 2. Property names must have unique suffixes after the last ".".
- // 3. Property names must have "ORB" as the first 3 letters
- // in their suffix.
- // 4. proprietary property names should have a subsystem
- // where appropriate after the prefix.
-
- // org.omg.CORBA properties must be defined by OMG standards
- // The well known org.omg.CORBA.ORBClass and
- // org.omg.CORBA.ORBSingletonClass are not included here
- // since they occur in org.omg.CORBA.ORB.
-
- public static final String ORG_OMG_PREFIX = "org.omg." ;
- public static final String ORG_OMG_CORBA_PREFIX = "org.omg.CORBA." ;
-
- public static final String INITIAL_HOST_PROPERTY =
- ORG_OMG_CORBA_PREFIX + "ORBInitialHost" ;
- public static final String INITIAL_PORT_PROPERTY =
- ORG_OMG_CORBA_PREFIX + "ORBInitialPort" ;
- public static final String INITIAL_SERVICES_PROPERTY =
- ORG_OMG_CORBA_PREFIX + "ORBInitialServices" ;
- public static final String DEFAULT_INIT_REF_PROPERTY =
- ORG_OMG_CORBA_PREFIX + "ORBDefaultInitRef" ;
- public static final String ORB_INIT_REF_PROPERTY =
- ORG_OMG_CORBA_PREFIX + "ORBInitRef" ;
-
- // All of our proprietary properties must start with com.sun.CORBA
- public static final String SUN_PREFIX = "com.sun.CORBA." ;
-
- // general properties
- public static final String ALLOW_LOCAL_OPTIMIZATION = SUN_PREFIX + "ORBAllowLocalOptimization" ;
- public static final String SERVER_PORT_PROPERTY = SUN_PREFIX + "ORBServerPort" ;
- public static final String SERVER_HOST_PROPERTY = SUN_PREFIX + "ORBServerHost" ;
- public static final String ORB_ID_PROPERTY = ORG_OMG_CORBA_PREFIX + "ORBId" ;
- // This property is provided for backward compatibility reasons
- public static final String OLD_ORB_ID_PROPERTY = SUN_PREFIX + "ORBid" ;
- public static final String ORB_SERVER_ID_PROPERTY = ORG_OMG_CORBA_PREFIX + "ORBServerId" ;
- public static final String DEBUG_PROPERTY = SUN_PREFIX + "ORBDebug" ;
- // Property for setting use of repository Ids during serialization.
- public static final String USE_REP_ID = SUN_PREFIX + "ORBUseRepId";
-
- // NOTE: This is an internal property. It should never be set by
- // a user. That is the reason it has spaces in its name - to make it
- // harder to use.
- public static final String LISTEN_ON_ALL_INTERFACES = SUN_PREFIX + "INTERNAL USE ONLY: listen on all interfaces";
-
- // giop related properties - default settings in decimal form
- public static final String GIOP_VERSION = SUN_PREFIX + "giop.ORBGIOPVersion" ;
- public static final String GIOP_FRAGMENT_SIZE = SUN_PREFIX + "giop.ORBFragmentSize" ;
- public static final String GIOP_BUFFER_SIZE = SUN_PREFIX + "giop.ORBBufferSize" ;
- public static final String GIOP_11_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP11BuffMgr";
- public static final String GIOP_12_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP12BuffMgr";
- public static final String GIOP_TARGET_ADDRESSING = SUN_PREFIX + "giop.ORBTargetAddressing";
- public static final int GIOP_DEFAULT_FRAGMENT_SIZE = 1024;
- public static final int GIOP_DEFAULT_BUFFER_SIZE = 1024;
- public static final int DEFAULT_GIOP_11_BUFFMGR = 0; //Growing
- public static final int DEFAULT_GIOP_12_BUFFMGR = 2; //Streaming
- public static final short ADDR_DISP_OBJKEY = 0; // object key used for target addressing
- public static final short ADDR_DISP_PROFILE = 1; // iop profile used for target addressing
- public static final short ADDR_DISP_IOR = 2; // ior used for target addressing
- public static final short ADDR_DISP_HANDLE_ALL = 3; // accept all target addressing dispositions (default)
-
- // CORBA formal 00-11-03 sections 15.4.2.2, 15.4.3.2, 15.4.6.2
- // state that the GIOP 1.2 RequestMessage, ReplyMessage, and
- // LocateReply message bodies must begin on 8 byte boundaries.
- public static final int GIOP_12_MSG_BODY_ALIGNMENT = 8;
-
- // The GIOP 1.2 fragments must be divisible by 8. We generalize this
- // to GIOP 1.1 fragments, as well.
- public static final int GIOP_FRAGMENT_DIVISOR = 8;
- public static final int GIOP_FRAGMENT_MINIMUM_SIZE = 32;
-
- // connection management properties
- public static final String HIGH_WATER_MARK_PROPERTY =
- SUN_PREFIX + "connection.ORBHighWaterMark" ;
- public static final String LOW_WATER_MARK_PROPERTY =
- SUN_PREFIX + "connection.ORBLowWaterMark" ;
- public static final String NUMBER_TO_RECLAIM_PROPERTY =
- SUN_PREFIX + "connection.ORBNumberToReclaim" ;
-
- public static final String ACCEPTOR_CLASS_PREFIX_PROPERTY =
- SUN_PREFIX + "transport.ORBAcceptor";
-
- public static final String CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY =
- SUN_PREFIX + "transport.ORBContactInfoList";
-
- // Legacy:
- public static final String LEGACY_SOCKET_FACTORY_CLASS_PROPERTY =
- SUN_PREFIX + "legacy.connection.ORBSocketFactoryClass" ;
-
-
- public static final String SOCKET_FACTORY_CLASS_PROPERTY =
- SUN_PREFIX + "transport.ORBSocketFactoryClass" ;
- public static final String LISTEN_SOCKET_PROPERTY =
- SUN_PREFIX + "transport.ORBListenSocket";
- public static final String IOR_TO_SOCKET_INFO_CLASS_PROPERTY =
- SUN_PREFIX + "transport.ORBIORToSocketInfoClass";
- public static final String IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY =
- SUN_PREFIX + "transport.ORBIIOPPrimaryToContactInfoClass";
-
- // Request partitioning maximum and minimum thread pool id constants.
- public static final int REQUEST_PARTITIONING_MIN_THREAD_POOL_ID = 0;
- public static final int REQUEST_PARTITIONING_MAX_THREAD_POOL_ID = 63;
-
- // transport read tcp timeout property, colon separated property
- // with syntax
- public static final String TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY =
- SUN_PREFIX + "transport.ORBTCPReadTimeouts";
-
- // initial time to wait in milliseconds if a transport
- // tcp read returns 0 bytes
- public static final int TRANSPORT_TCP_INITIAL_TIME_TO_WAIT = 100;
-
- // max time to spend in cumulative waits in milliseconds
- // if a transport tcp read returns 0 bytes
- public static final int TRANSPORT_TCP_MAX_TIME_TO_WAIT = 3000;
-
- // max time to spend in cumulative waits in milliseconds
- // if a transport tcp read of GIOP header returns 0 bytes
- public static final int TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT = 300;
-
- // A backoff percentage used to compute the next amount of time to
- // wait on a subsequent transport tcp read of 0 bytes
- public static final int TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR = 20;
-
- public static final String USE_NIO_SELECT_TO_WAIT_PROPERTY =
- SUN_PREFIX + "transport.ORBUseNIOSelectToWait";
-
- // "Socket" | "SocketChannel"
- // Note: Connections accepted by SocketChannel will be SocketChannel.
- public static final String ACCEPTOR_SOCKET_TYPE_PROPERTY =
- SUN_PREFIX + "transport.ORBAcceptorSocketType";
-
- // Applicable if using SocketChannel and using select thread.
- public static final String ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY =
- SUN_PREFIX + "transport.ORBAcceptorSocketUseWorkerThreadForEvent";
-
- // Applicable on client-side. "Socket" | "SocketChannel"
- public static final String CONNECTION_SOCKET_TYPE_PROPERTY =
- SUN_PREFIX + "transport.ORBConnectionSocketType";
-
- // Applicable if using SocketChannel and using select thread
- public static final String CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY =
- SUN_PREFIX + "transport.ORBConnectionSocketUseWorkerThreadForEvent";
-
- // Used to disable the use of direct byte buffers. This enables much easier
- // debugging, because the contents of a direct byte buffer cannot be
- // viewed in most (all?) debuggers.
- public static final String DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY =
- SUN_PREFIX + "transport.ORBDisableDirectByteBufferUse" ;
-
- public static final String SOCKET = "Socket";
- public static final String SOCKETCHANNEL = "SocketChannel";
-
- // POA related policies
- public static final String PERSISTENT_SERVER_PORT_PROPERTY = SUN_PREFIX + "POA.ORBPersistentServerPort" ;
- public static final String SERVER_ID_PROPERTY = SUN_PREFIX + "POA.ORBServerId" ;
- public static final String BAD_SERVER_ID_HANDLER_CLASS_PROPERTY
- = SUN_PREFIX + "POA.ORBBadServerIdHandlerClass" ;
- public static final String ACTIVATED_PROPERTY = SUN_PREFIX + "POA.ORBActivated" ;
- public static final String SERVER_NAME_PROPERTY = SUN_PREFIX + "POA.ORBServerName" ;
-
- // Server Properties; e.g. when properties passed to ORB activated
- // servers
-
- public static final String SERVER_DEF_VERIFY_PROPERTY = SUN_PREFIX + "activation.ORBServerVerify" ;
-
- // This one is an exception, but it may be externally visible
- public static final String SUN_LC_PREFIX = "com.sun.corba." ;
-
- // Necessary for package renaming to work correctly
- public static final String SUN_LC_VERSION_PREFIX = "com.sun.corba.se.";
-
- public static final String JTS_CLASS_PROPERTY = SUN_LC_VERSION_PREFIX + "CosTransactions.ORBJTSClass" ;
-
- // Property for enabling ORB's use of Java serialization.
- public static final String ENABLE_JAVA_SERIALIZATION_PROPERTY =
- SUN_PREFIX + "encoding.ORBEnableJavaSerialization";
-
- // Constants for ORB prefixes **************************************************************
-
- public static final String PI_ORB_INITIALIZER_CLASS_PREFIX =
- "org.omg.PortableInterceptor.ORBInitializerClass.";
-
- public static final String USE_DYNAMIC_STUB_PROPERTY = SUN_PREFIX + "ORBUseDynamicStub" ;
-
- public static final String DYNAMIC_STUB_FACTORY_FACTORY_CLASS =
- SUN_PREFIX + "ORBDynamicStubFactoryFactoryClass" ;
-
- // Constants for NameService properties ************************************
-
- public static final int DEFAULT_INITIAL_PORT = 900;
-
- public static final String DEFAULT_INS_HOST = "localhost";
-
- public static final int DEFAULT_INS_PORT = 2089;
-
- public static final int DEFAULT_INS_GIOP_MAJOR_VERSION = 1;
-
- // http://www.omg.org/cgi-bin/doc?ptc/00-08-07 [ Section 13.6.7.3 ]
- // defines the default GIOP minor version to be 0.
- public static final int DEFAULT_INS_GIOP_MINOR_VERSION = 0;
-
-
- // Constants for INS properties ********************************************
-
- // GIOP Version number for validation of INS URL format addresses
- public static final int MAJORNUMBER_SUPPORTED = 1;
- public static final int MINORNUMBERMAX = 2;
-
- // Subcontract's differentiation using the TRANSIENT and PERSISTENT
- // Name Service Property.
- public static final int TRANSIENT = 1;
- public static final int PERSISTENT = 2;
-
- // Constants for ORBD properties ****************************************************************
-
- // These properties are never passed on ORB init: they are only passed to ORBD.
-
- public static final String DB_DIR_PROPERTY = SUN_PREFIX + "activation.DbDir" ;
- public static final String DB_PROPERTY = SUN_PREFIX + "activation.db" ;
- public static final String ORBD_PORT_PROPERTY = SUN_PREFIX + "activation.Port" ;
- public static final String SERVER_POLLING_TIME = SUN_PREFIX + "activation.ServerPollingTime";
- public static final String SERVER_STARTUP_DELAY = SUN_PREFIX + "activation.ServerStartupDelay";
-
- public static final int DEFAULT_ACTIVATION_PORT = 1049 ;
-
- // If RI is starting the NameService then they would indicate that by
- // passing the RI flag. That would start a Persistent Port to listen to
- // INS request.
- public static final int RI_NAMESERVICE_PORT = 1050;
-
- public static final int DEFAULT_SERVER_POLLING_TIME = 1000;
-
- public static final int DEFAULT_SERVER_STARTUP_DELAY = 1000;
-
-
- //***************** Constants for Logging ****************
-
- public static final String LOG_LEVEL_PROPERTY = SUN_PREFIX + "ORBLogLevel";
-
- public static final String LOG_RESOURCE_FILE =
- "com.sun.corba.se.impl.logging.LogStrings";
-
- // Constants for initial references *************************************************************
-
- public static final String TRANSIENT_NAME_SERVICE_NAME = "TNameService" ;
- public static final String PERSISTENT_NAME_SERVICE_NAME = "NameService" ;
-
- // A large Number to make sure that other ServerIds doesn't collide
- // with NameServer Persistent Server Id
- public static final String NAME_SERVICE_SERVER_ID = "1000000" ;
-
- public static final String ROOT_POA_NAME = "RootPOA" ;
- public static final String POA_CURRENT_NAME = "POACurrent" ;
- public static final String SERVER_ACTIVATOR_NAME = "ServerActivator" ;
- public static final String SERVER_LOCATOR_NAME = "ServerLocator" ;
- public static final String SERVER_REPOSITORY_NAME = "ServerRepository" ;
- public static final String INITIAL_NAME_SERVICE_NAME= "InitialNameService" ;
- public static final String TRANSACTION_CURRENT_NAME = "TransactionCurrent" ;
- public static final String DYN_ANY_FACTORY_NAME = "DynAnyFactory" ;
-
- // New for Portable Interceptors
- public static final String PI_CURRENT_NAME = "PICurrent" ;
- public static final String CODEC_FACTORY_NAME = "CodecFactory" ;
-
- // Constants for ORBD DB ***********************************************************************
-
- public static final String DEFAULT_DB_DIR = "orb.db" ;
- public static final String DEFAULT_DB_NAME = "db" ;
- public static final String INITIAL_ORB_DB = "initial.db" ;
- public static final String SERVER_LOG_DIR = "logs" ;
- public static final String ORBID_DIR_BASE = "orbids" ;
- public static final String ORBID_DB_FILE_NAME = "orbids.db" ;
-
- // Constants for ThreadPool ********************************************************************
-
- // Default value for when inactive threads in the pool can stop running (ms)
- public static final int DEFAULT_INACTIVITY_TIMEOUT = 120000;
- // Default name of the threadpool
- public static final String THREADPOOL_DEFAULT_NAME = "default-threadpool";
- // Default name of the workqueue
- public static final String WORKQUEUE_DEFAULT_NAME = "default-workqueue";
-
- // Constants for minor code bases **************************************************************
- // This is the value that pre-Merlin Sun ORBs incorrectly used. We preserve this
- // here for backwards compatibility, but note that the current ORB must never
- // create a BAD_PARAM system exception with this minor code.
- public static final int LEGACY_SUN_NOT_SERIALIZABLE = SUNVMCID.value + 1 ;
-
- // Code Set related *******************************************************
-
- // If we don't always send the code set context, there's a possibility
- // of failure when fragments of a smaller request are interleved with
- // those of a first request with other large service contexts.
- //
- public static final boolean DEFAULT_ALWAYS_SEND_CODESET_CTX = true;
- public static final String ALWAYS_SEND_CODESET_CTX_PROPERTY
- = SUN_PREFIX + "codeset.AlwaysSendCodeSetCtx";
-
- // Use byte order markers in streams when applicable? This won't apply to
- // GIOP 1.1 due to limitations in the CDR encoding.
- public static final boolean DEFAULT_USE_BYTE_ORDER_MARKERS = true;
- public static final String USE_BOMS = SUN_PREFIX + "codeset.UseByteOrderMarkers";
-
- // Use byte order markers in encapsulations when applicable?
- public static final boolean DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS = false;
- public static final String USE_BOMS_IN_ENCAPS = SUN_PREFIX + "codeset.UseByteOrderMarkersInEncaps";
-
- // The CHAR_CODESETS and WCHAR_CODESETS allow the user to override the default
- // connection code sets. The value should be a comma separated list of OSF
- // registry numbers. The first number in the list will be the native code
- // set.
- //
- // Number can be specified as hex if preceded by 0x, otherwise they are
- // interpreted as decimal.
- //
- // Code sets that we accept currently (see core/OSFCodeSetRegistry):
- //
- // char/string:
- //
- // ISO8859-1 (Latin-1) 0x00010001
- // ISO646 (ASCII) 0x00010020
- // UTF-8 0x05010001
- //
- // wchar/string:
- //
- // UTF-16 0x00010109
- // UCS-2 0x00010100
- // UTF-8 0x05010001
- //
- // Note: The ORB will let you assign any of the above values to
- // either of the following properties, but the above assignments
- // are the only ones that won't get you into trouble.
- public static final String CHAR_CODESETS = SUN_PREFIX + "codeset.charsets";
- public static final String WCHAR_CODESETS = SUN_PREFIX + "codeset.wcharsets";
-
- // Constants to make stream format version code easier to read
- public static final byte STREAM_FORMAT_VERSION_1 = (byte)1;
- public static final byte STREAM_FORMAT_VERSION_2 = (byte)2;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java 2018-01-30 20:19:11.000000000 -0500
+++ /dev/null 2018-01-30 20:19:11.000000000 -0500
@@ -1,846 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.lang.Character;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.rmi.NoSuchObjectException;
-import java.security.AccessController;
-import java.security.PermissionCollection;
-import java.security.Policy;
-import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.NoSuchElementException;
-
-import javax.rmi.CORBA.ValueHandler;
-import javax.rmi.CORBA.ValueHandlerMultiFormat;
-import javax.rmi.CORBA.Util;
-
-import org.omg.CORBA.StructMember ;
-import org.omg.CORBA.TypeCode ;
-import org.omg.CORBA.Any ;
-import org.omg.CORBA.TCKind ;
-import org.omg.CORBA.SystemException ;
-import org.omg.CORBA.CompletionStatus ;
-import org.omg.CORBA.DATA_CONVERSION ;
-import org.omg.CORBA.BAD_PARAM ;
-import org.omg.CORBA.BAD_OPERATION ;
-import org.omg.CORBA.INTERNAL ;
-import org.omg.CORBA.TypeCodePackage.BadKind ;
-import org.omg.CORBA.portable.OutputStream ;
-import org.omg.CORBA.portable.InputStream ;
-
-import com.sun.corba.se.pept.transport.ContactInfoList ;
-
-import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
-import com.sun.corba.se.spi.orb.ORBVersionFactory ;
-import com.sun.corba.se.spi.protocol.CorbaClientDelegate ;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
-import com.sun.corba.se.spi.logging.CORBALogDomains ;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
-import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
-
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.corba.CORBAObjectImpl ;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.logging.OMGSystemException ;
-import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent;
-
-import sun.corba.SharedSecrets;
-
-/**
- * Handy class full of static functions that don't belong in util.Utility for pure ORB reasons.
- */
-public final class ORBUtility {
- private ORBUtility() {}
-
- private static ORBUtilSystemException wrapper = ORBUtilSystemException.get(
- CORBALogDomains.UTIL ) ;
- private static OMGSystemException omgWrapper = OMGSystemException.get(
- CORBALogDomains.UTIL ) ;
-
- private static StructMember[] members = null;
-
- private static StructMember[] systemExceptionMembers (ORB orb) {
- if (members == null) {
- members = new StructMember[3];
- members[0] = new StructMember("id", orb.create_string_tc(0), null);
- members[1] = new StructMember("minor", orb.get_primitive_tc(TCKind.tk_long), null);
- members[2] = new StructMember("completed", orb.get_primitive_tc(TCKind.tk_long), null);
- }
- return members;
- }
-
- private static TypeCode getSystemExceptionTypeCode(ORB orb, String repID, String name) {
- synchronized (TypeCode.class) {
- return orb.create_exception_tc(repID, name, systemExceptionMembers(orb));
- }
- }
-
- private static boolean isSystemExceptionTypeCode(TypeCode type, ORB orb) {
- StructMember[] systemExceptionMembers = systemExceptionMembers(orb);
- try {
- return (type.kind().value() == TCKind._tk_except &&
- type.member_count() == 3 &&
- type.member_type(0).equal(systemExceptionMembers[0].type) &&
- type.member_type(1).equal(systemExceptionMembers[1].type) &&
- type.member_type(2).equal(systemExceptionMembers[2].type));
- } catch (BadKind ex) {
- return false;
- } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
- return false;
- }
- }
-
- /**
- * Static method for writing a CORBA standard exception to an Any.
- * @param any The Any to write the SystemException into.
- */
- public static void insertSystemException(SystemException ex, Any any) {
- OutputStream out = any.create_output_stream();
- ORB orb = (ORB)(out.orb());
- String name = ex.getClass().getName();
- String repID = ORBUtility.repositoryIdOf(name);
- out.write_string(repID);
- out.write_long(ex.minor);
- out.write_long(ex.completed.value());
- any.read_value(out.create_input_stream(),
- getSystemExceptionTypeCode(orb, repID, name));
- }
-
- public static SystemException extractSystemException(Any any) {
- InputStream in = any.create_input_stream();
- ORB orb = (ORB)(in.orb());
- if ( ! isSystemExceptionTypeCode(any.type(), orb)) {
- throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
- }
- return ORBUtility.readSystemException(in);
- }
-
- /**
- * Return default ValueHandler
- */
- public static ValueHandler createValueHandler() {
- ValueHandler vh;
- try {
- vh = AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public ValueHandler run() throws Exception {
- return Util.createValueHandler();
- }
- });
- } catch (PrivilegedActionException e) {
- throw new InternalError(e.getCause());
- }
- return vh;
- }
-
- /**
- * Returns true if it was accurately determined that the remote ORB is
- * a foreign (non-JavaSoft) ORB. Note: If passed the ORBSingleton, this
- * will return false.
- */
- public static boolean isForeignORB(ORB orb)
- {
- if (orb == null)
- return false;
-
- try {
- return orb.getORBVersion().equals(ORBVersionFactory.getFOREIGN());
- } catch (SecurityException se) {
- return false;
- }
- }
-
- /** Unmarshal a byte array to an integer.
- Assume the bytes are in BIGENDIAN order.
- i.e. array[offset] is the most-significant-byte
- and array[offset+3] is the least-significant-byte.
- @param array The array of bytes.
- @param offset The offset from which to start unmarshalling.
- */
- public static int bytesToInt(byte[] array, int offset)
- {
- int b1, b2, b3, b4;
-
- b1 = (array[offset++] << 24) & 0xFF000000;
- b2 = (array[offset++] << 16) & 0x00FF0000;
- b3 = (array[offset++] << 8) & 0x0000FF00;
- b4 = (array[offset++] << 0) & 0x000000FF;
-
- return (b1 | b2 | b3 | b4);
- }
-
- /** Marshal an integer to a byte array.
- The bytes are in BIGENDIAN order.
- i.e. array[offset] is the most-significant-byte
- and array[offset+3] is the least-significant-byte.
- @param array The array of bytes.
- @param offset The offset from which to start marshalling.
- */
- public static void intToBytes(int value, byte[] array, int offset)
- {
- array[offset++] = (byte)((value >>> 24) & 0xFF);
- array[offset++] = (byte)((value >>> 16) & 0xFF);
- array[offset++] = (byte)((value >>> 8) & 0xFF);
- array[offset++] = (byte)((value >>> 0) & 0xFF);
- }
-
- /** Converts an Ascii Character into Hexadecimal digit
- */
- public static int hexOf( char x )
- {
- int val;
-
- val = x - '0';
- if (val >=0 && val <= 9)
- return val;
-
- val = (x - 'a') + 10;
- if (val >= 10 && val <= 15)
- return val;
-
- val = (x - 'A') + 10;
- if (val >= 10 && val <= 15)
- return val;
-
- throw wrapper.badHexDigit() ;
- }
-
- // method moved from util.Utility
-
- /**
- * Static method for writing a CORBA standard exception to a stream.
- * @param strm The OutputStream to use for marshaling.
- */
- public static void writeSystemException(SystemException ex, OutputStream strm)
- {
- String s;
-
- s = repositoryIdOf(ex.getClass().getName());
- strm.write_string(s);
- strm.write_long(ex.minor);
- strm.write_long(ex.completed.value());
- }
-
- /**
- * Static method for reading a CORBA standard exception from a stream.
- * @param strm The InputStream to use for unmarshaling.
- */
- public static SystemException readSystemException(InputStream strm)
- {
- try {
- String name = classNameOf(strm.read_string());
- SystemException ex = (SystemException)SharedSecrets.
- getJavaCorbaAccess().loadClass(name).newInstance();
- ex.minor = strm.read_long();
- ex.completed = CompletionStatus.from_int(strm.read_long());
- return ex;
- } catch ( Exception ex ) {
- throw wrapper.unknownSysex( CompletionStatus.COMPLETED_MAYBE, ex );
- }
- }
-
- /**
- * Get the class name corresponding to a particular repository Id.
- * This is used by the system to unmarshal (instantiate) the
- * appropriate exception class for an marshaled as the value of
- * its repository Id.
- * @param repositoryId The repository Id for which we want a class name.
- */
- public static String classNameOf(String repositoryId)
- {
- String className=null;
-
- className = (String) exceptionClassNames.get(repositoryId);
- if (className == null)
- className = "org.omg.CORBA.UNKNOWN";
-
- return className;
- }
-
- /**
- * Return true if this repositoryId is a SystemException.
- * @param repositoryId The repository Id to check.
- */
- public static boolean isSystemException(String repositoryId)
- {
- String className=null;
-
- className = (String) exceptionClassNames.get(repositoryId);
- if (className == null)
- return false;
- else
- return true;
- }
-
- /**
- * @return the Java serialization encoding version.
- */
- public static byte getEncodingVersion(ORB orb, IOR ior) {
-
- // Is Java serialization enabled?
- // Check the JavaSerializationComponent (tagged component)
- // in the IIOPProfile. If present, the peer ORB's GIOP is capable
- // of using Java serialization instead of CDR serialization.
- // In such a case, use Java serialization, iff the java serialization
- // versions match.
-
- if (orb.getORBData().isJavaSerializationEnabled()) {
- IIOPProfile prof = ior.getProfile();
- IIOPProfileTemplate profTemp =
- (IIOPProfileTemplate) prof.getTaggedProfileTemplate();
- java.util.Iterator iter = profTemp.iteratorById(
- ORBConstants.TAG_JAVA_SERIALIZATION_ID);
- if (iter.hasNext()) {
- JavaSerializationComponent jc =
- (JavaSerializationComponent) iter.next();
- byte jcVersion = jc.javaSerializationVersion();
- if (jcVersion >= Message.JAVA_ENC_VERSION) {
- return Message.JAVA_ENC_VERSION;
- } else if (jcVersion > Message.CDR_ENC_VERSION) {
- return jc.javaSerializationVersion();
- } else {
- // throw error?
- // Since encodingVersion is <= 0 (CDR_ENC_VERSION).
- }
- }
- }
- return Message.CDR_ENC_VERSION; // default
- }
-
- /**
- * Get the repository id corresponding to a particular class.
- * This is used by the system to write the
- * appropriate repository id for a system exception.
- * @param name The class name of the system exception.
- */
- public static String repositoryIdOf(String name)
- {
- String id;
-
- id = (String) exceptionRepositoryIds.get(name);
- if (id == null)
- id = "IDL:omg.org/CORBA/UNKNOWN:1.0";
-
- return id;
- }
-
- private static final Hashtable exceptionClassNames = new Hashtable();
- private static final Hashtable exceptionRepositoryIds = new Hashtable();
-
- static {
-
- //
- // construct repositoryId -> className hashtable
- //
- exceptionClassNames.put("IDL:omg.org/CORBA/BAD_CONTEXT:1.0",
- "org.omg.CORBA.BAD_CONTEXT");
- exceptionClassNames.put("IDL:omg.org/CORBA/BAD_INV_ORDER:1.0",
- "org.omg.CORBA.BAD_INV_ORDER");
- exceptionClassNames.put("IDL:omg.org/CORBA/BAD_OPERATION:1.0",
- "org.omg.CORBA.BAD_OPERATION");
- exceptionClassNames.put("IDL:omg.org/CORBA/BAD_PARAM:1.0",
- "org.omg.CORBA.BAD_PARAM");
- exceptionClassNames.put("IDL:omg.org/CORBA/BAD_TYPECODE:1.0",
- "org.omg.CORBA.BAD_TYPECODE");
- exceptionClassNames.put("IDL:omg.org/CORBA/COMM_FAILURE:1.0",
- "org.omg.CORBA.COMM_FAILURE");
- exceptionClassNames.put("IDL:omg.org/CORBA/DATA_CONVERSION:1.0",
- "org.omg.CORBA.DATA_CONVERSION");
- exceptionClassNames.put("IDL:omg.org/CORBA/IMP_LIMIT:1.0",
- "org.omg.CORBA.IMP_LIMIT");
- exceptionClassNames.put("IDL:omg.org/CORBA/INTF_REPOS:1.0",
- "org.omg.CORBA.INTF_REPOS");
- exceptionClassNames.put("IDL:omg.org/CORBA/INTERNAL:1.0",
- "org.omg.CORBA.INTERNAL");
- exceptionClassNames.put("IDL:omg.org/CORBA/INV_FLAG:1.0",
- "org.omg.CORBA.INV_FLAG");
- exceptionClassNames.put("IDL:omg.org/CORBA/INV_IDENT:1.0",
- "org.omg.CORBA.INV_IDENT");
- exceptionClassNames.put("IDL:omg.org/CORBA/INV_OBJREF:1.0",
- "org.omg.CORBA.INV_OBJREF");
- exceptionClassNames.put("IDL:omg.org/CORBA/MARSHAL:1.0",
- "org.omg.CORBA.MARSHAL");
- exceptionClassNames.put("IDL:omg.org/CORBA/NO_MEMORY:1.0",
- "org.omg.CORBA.NO_MEMORY");
- exceptionClassNames.put("IDL:omg.org/CORBA/FREE_MEM:1.0",
- "org.omg.CORBA.FREE_MEM");
- exceptionClassNames.put("IDL:omg.org/CORBA/NO_IMPLEMENT:1.0",
- "org.omg.CORBA.NO_IMPLEMENT");
- exceptionClassNames.put("IDL:omg.org/CORBA/NO_PERMISSION:1.0",
- "org.omg.CORBA.NO_PERMISSION");
- exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESOURCES:1.0",
- "org.omg.CORBA.NO_RESOURCES");
- exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESPONSE:1.0",
- "org.omg.CORBA.NO_RESPONSE");
- exceptionClassNames.put("IDL:omg.org/CORBA/OBJ_ADAPTER:1.0",
- "org.omg.CORBA.OBJ_ADAPTER");
- exceptionClassNames.put("IDL:omg.org/CORBA/INITIALIZE:1.0",
- "org.omg.CORBA.INITIALIZE");
- exceptionClassNames.put("IDL:omg.org/CORBA/PERSIST_STORE:1.0",
- "org.omg.CORBA.PERSIST_STORE");
- exceptionClassNames.put("IDL:omg.org/CORBA/TRANSIENT:1.0",
- "org.omg.CORBA.TRANSIENT");
- exceptionClassNames.put("IDL:omg.org/CORBA/UNKNOWN:1.0",
- "org.omg.CORBA.UNKNOWN");
- exceptionClassNames.put("IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0",
- "org.omg.CORBA.OBJECT_NOT_EXIST");
-
- // SystemExceptions from OMG Transactions Service Spec
- exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_TRANSACTION:1.0",
- "org.omg.CORBA.INVALID_TRANSACTION");
- exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_REQUIRED:1.0",
- "org.omg.CORBA.TRANSACTION_REQUIRED");
- exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_ROLLEDBACK:1.0",
- "org.omg.CORBA.TRANSACTION_ROLLEDBACK");
-
- // from portability RTF 98-07-01.txt
- exceptionClassNames.put("IDL:omg.org/CORBA/INV_POLICY:1.0",
- "org.omg.CORBA.INV_POLICY");
-
- // from orbrev/00-09-01 (CORBA 2.4 Draft Specification)
- exceptionClassNames.
- put("IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0",
- "org.omg.CORBA.TRANSACTION_UNAVAILABLE");
- exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_MODE:1.0",
- "org.omg.CORBA.TRANSACTION_MODE");
-
- // Exception types introduced between CORBA 2.4 and 3.0
- exceptionClassNames.put("IDL:omg.org/CORBA/CODESET_INCOMPATIBLE:1.0",
- "org.omg.CORBA.CODESET_INCOMPATIBLE");
- exceptionClassNames.put("IDL:omg.org/CORBA/REBIND:1.0",
- "org.omg.CORBA.REBIND");
- exceptionClassNames.put("IDL:omg.org/CORBA/TIMEOUT:1.0",
- "org.omg.CORBA.TIMEOUT");
- exceptionClassNames.put("IDL:omg.org/CORBA/BAD_QOS:1.0",
- "org.omg.CORBA.BAD_QOS");
-
- // Exception types introduced in CORBA 3.0
- exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_ACTIVITY:1.0",
- "org.omg.CORBA.INVALID_ACTIVITY");
- exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_COMPLETED:1.0",
- "org.omg.CORBA.ACTIVITY_COMPLETED");
- exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_REQUIRED:1.0",
- "org.omg.CORBA.ACTIVITY_REQUIRED");
-
- //
- // construct className -> repositoryId hashtable
- //
- Enumeration keys = exceptionClassNames.keys();
- java.lang.Object s;
- String rId;
- String cName;
-
- try{
- while (keys.hasMoreElements()) {
- s = keys.nextElement();
- rId = (String) s;
- cName = (String) exceptionClassNames.get(rId);
- exceptionRepositoryIds.put (cName, rId);
- }
- } catch (NoSuchElementException e) { }
- }
-
- /** Parse a version string such as "1.1.6" or "jdk1.2fcs" into
- a version array of integers {1, 1, 6} or {1, 2}.
- A string of "n." or "n..m" is equivalent to "n.0" or "n.0.m" respectively.
- */
- public static int[] parseVersion(String version) {
- if (version == null)
- return new int[0];
- char[] s = version.toCharArray();
- //find the maximum span of the string "n.n.n..." where n is an integer
- int start = 0;
- for (; start < s.length && (s[start] < '0' || s[start] > '9'); ++start)
- if (start == s.length) //no digit found
- return new int[0];
- int end = start + 1;
- int size = 1;
- for (; end < s.length; ++end)
- if (s[end] == '.')
- ++size;
- else if (s[end] < '0' || s[end] > '9')
- break;
- int[] val = new int[size];
- for (int i = 0; i < size; ++i) {
- int dot = version.indexOf('.', start);
- if (dot == -1 || dot > end)
- dot = end;
- if (start >= dot) //cases like "n." or "n..m"
- val[i] = 0; //convert equivalent to "n.0" or "n.0.m"
- else
- val[i] = Integer.parseInt(version.substring(start, dot));
- start = dot + 1;
- }
- return val;
- }
-
- /** Compare two version arrays.
- Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2.
- */
- public static int compareVersion(int[] v1, int[] v2) {
- if (v1 == null)
- v1 = new int[0];
- if (v2 == null)
- v2 = new int[0];
- for (int i = 0; i < v1.length; ++i) {
- if (i >= v2.length || v1[i] > v2[i]) //v1 is longer or greater than v2
- return 1;
- if (v1[i] < v2[i])
- return -1;
- }
- return v1.length == v2.length ? 0 : -1;
- }
-
- /** Compare two version strings.
- Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2.
- */
- public static synchronized int compareVersion(String v1, String v2) {
- return compareVersion(parseVersion(v1), parseVersion(v2));
- }
-
- private static String compressClassName( String name )
- {
- // Note that this must end in . in order to be renamed correctly.
- String prefix = "com.sun.corba.se." ;
- if (name.startsWith( prefix ) ) {
- return "(ORB)." + name.substring( prefix.length() ) ;
- } else
- return name ;
- }
-
- // Return a compressed representation of the thread name. This is particularly
- // useful on the server side, where there are many SelectReaderThreads, and
- // we need a short unambiguous name for such threads.
- public static String getThreadName( Thread thr )
- {
- if (thr == null)
- return "null" ;
-
- // This depends on the formatting in SelectReaderThread and CorbaConnectionImpl.
- // Pattern for SelectReaderThreads:
- // SelectReaderThread CorbaConnectionImpl[ ]
- // Any other pattern in the Thread's name is just returned.
- String name = thr.getName() ;
- StringTokenizer st = new StringTokenizer( name ) ;
- int numTokens = st.countTokens() ;
- if (numTokens != 5)
- return name ;
-
- String[] tokens = new String[numTokens] ;
- for (int ctr=0; ctr= 0 ?
- "(" + ste.getFileName() + ":" + ste.getLineNumber() + ")" :
- (ste.getFileName() != null ? "("+ste.getFileName()+")" : "(Unknown Source)")));
- }
-
- private static void printStackTrace( StackTraceElement[] trace )
- {
- System.out.println( " Stack Trace:" ) ;
- // print the stack trace, ommitting the zeroth element, which is
- // always this method.
- for ( int ctr = 1; ctr < trace.length; ctr++ ) {
- System.out.print( " >" ) ;
- System.out.println( formatStackTraceElement( trace[ctr] ) ) ;
- }
- }
-
- //
- // Implements all dprint calls in this package.
- //
- public static synchronized void dprint(java.lang.Object obj, String msg) {
- System.out.println(
- compressClassName( obj.getClass().getName() ) + "(" +
- getThreadName( Thread.currentThread() ) + "): " + msg);
- }
-
- public static synchronized void dprint(String className, String msg) {
- System.out.println(
- compressClassName( className ) + "(" +
- getThreadName( Thread.currentThread() ) + "): " + msg);
- }
-
- public synchronized void dprint(String msg) {
- ORBUtility.dprint(this, msg);
- }
-
- public static synchronized void dprintTrace(Object obj, String msg) {
- ORBUtility.dprint(obj, msg);
-
- Throwable thr = new Throwable() ;
- printStackTrace( thr.getStackTrace() ) ;
- }
-
- public static synchronized void dprint(java.lang.Object caller,
- String msg, Throwable t)
- {
- System.out.println(
- compressClassName( caller.getClass().getName() ) +
- '(' + Thread.currentThread() + "): " + msg);
-
- if (t != null)
- printStackTrace( t.getStackTrace() ) ;
- }
-
- public static String[] concatenateStringArrays( String[] arr1, String[] arr2 )
- {
- String[] result = new String[
- arr1.length + arr2.length ] ;
-
- for (int ctr = 0; ctr() {
- public ValueHandler run() throws Exception {
- return Util.createValueHandler();
- }
- });
- } catch (PrivilegedActionException e) {
- throw new InternalError(e.getCause());
- }
-
- if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
- return ORBConstants.STREAM_FORMAT_VERSION_1;
- else
- return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
- }
-
- public static CorbaClientDelegate makeClientDelegate( IOR ior )
- {
- ORB orb = ior.getORB() ;
- CorbaContactInfoList ccil = orb.getCorbaContactInfoListFactory().create( ior ) ;
- CorbaClientDelegate del = orb.getClientDelegateFactory().create(ccil);
- return del ;
- }
-
- /** This method is used to create untyped object references.
- */
- public static org.omg.CORBA.Object makeObjectReference( IOR ior )
- {
- CorbaClientDelegate del = makeClientDelegate( ior ) ;
- org.omg.CORBA.Object objectImpl = new CORBAObjectImpl() ;
- StubAdapter.setDelegate( objectImpl, del ) ;
- return objectImpl ;
- }
-
- /** This method obtains an IOR from a CORBA object reference.
- * It will return null if obj is a local object, a null object,
- * or an object implemented by a different ORB. It will
- * throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
- * @return IOR the IOR that represents this objref. This will
- * never be null.
- * @exception BAD_OPERATION (from oi._get_delegate) if obj is a
- * normal objref, but does not have a delegate set.
- * @exception BAD_PARAM if obj is a local object, or else was
- * created by a foreign ORB.
- */
- public static IOR getIOR( org.omg.CORBA.Object obj )
- {
- if (obj == null)
- throw wrapper.nullObjectReference() ;
-
- IOR ior = null ;
- if (StubAdapter.isStub(obj)) {
- org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
- obj ) ;
-
- if (del instanceof CorbaClientDelegate) {
- CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
- ContactInfoList cil = cdel.getContactInfoList() ;
-
- if (cil instanceof CorbaContactInfoList) {
- CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
- ior = ccil.getTargetIOR() ;
- if (ior == null)
- throw wrapper.nullIor() ;
-
- return ior ;
- } else {
- // This is our code, but the ContactInfoList is not a
- // CorbaContactInfoList. This should not happen, because
- // we are in the CORBA application of the DCSA framework.
- // This is a coding error, and thus an INTERNAL exception
- // should be thrown.
- // XXX needs minor code
- throw new INTERNAL() ;
- }
- }
-
- // obj is implemented by a foreign ORB, because the Delegate is not a
- // ClientDelegate.
- // XXX this case could be handled by marshalling and
- // unmarshalling. However, object_to_string cannot be used
- // here, as it is implemented with getIOR. Note that this
- // will require access to an ORB, so that we can create streams
- // as needed. The ORB is available simply as io._orb().
- throw wrapper.objrefFromForeignOrb() ;
- } else
- throw wrapper.localObjectNotAllowed() ;
- }
-
- /** Obtains an IOR for the object reference obj, first connecting it to
- * the ORB if necessary.
- * @return IOR the IOR that represents this objref. This will
- * never be null.
- * @exception BAD_OPERATION if the object could not be connected,
- * if a connection attempt was needed.
- * @exception BAD_PARAM if obj is a local object, or else was
- * created by a foreign ORB.
- */
- public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
- {
- IOR result ;
- try {
- result = getIOR( obj ) ;
- } catch (BAD_OPERATION bop) {
- if (StubAdapter.isStub(obj)) {
- try {
- StubAdapter.connect( obj, orb ) ;
- } catch (java.rmi.RemoteException exc) {
- throw wrapper.connectingServant( exc ) ;
- }
- } else {
- orb.connect( obj ) ;
- }
-
- result = getIOR( obj ) ;
- }
-
- return result ;
- }
-
- public static String operationNameAndRequestId(CorbaMessageMediator m)
- {
- return "op/" + m.getOperationName() + " id/" + m.getRequestId();
- }
-
- public static boolean isPrintable(char c)
- {
- if (Character.isJavaIdentifierStart(c)) {
- // Letters and $ _
- return true;
- }
- if (Character.isDigit(c)) {
- return true;
- }
- switch (Character.getType(c)) {
- case Character.MODIFIER_SYMBOL : return true; // ` ^
- case Character.DASH_PUNCTUATION : return true; // -
- case Character.MATH_SYMBOL : return true; // = ~ + | < >
- case Character.OTHER_PUNCTUATION : return true; // !@#%&*;':",./?
- case Character.START_PUNCTUATION : return true; // ( [ {
- case Character.END_PUNCTUATION : return true; // ) ] }
- }
- return false;
- }
-
- public static String getClassSecurityInfo(final Class cl)
- {
- // Returns a String which looks similar to:
- // PermissionCollection java.security.Permissions@1053693 ...
- // (java.io.FilePermission <> ....)
- // (java.io.FilePermission /export0/sunwappserv/lib/- ...)
- // ... other permissions ...
- // Domain ProtectionDomain (file:/export0/sunwappserv/lib-)
- // java.security.Permissions@141fedb (
- // (java.io.FilePermission <> ...)
- // (java.io.FilePermission /var/tmp//- ...)
-
- String result =
- (String)AccessController.doPrivileged(new PrivilegedAction() {
- public java.lang.Object run() {
- StringBuffer sb = new StringBuffer(500);
- ProtectionDomain pd = cl.getProtectionDomain();
- Policy policy = Policy.getPolicy();
- PermissionCollection pc = policy.getPermissions(pd);
- sb.append("\nPermissionCollection ");
- sb.append(pc.toString());
- // Don't need to add 'Protection Domain' string, it's
- // in ProtectionDomain.toString() already.
- sb.append(pd.toString());
- return sb.toString();
- }
- });
- return result;
- }
-}
-
-// End of file.
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java 2018-01-30 20:19:12.000000000 -0500
+++ /dev/null 2018-01-30 20:19:12.000000000 -0500
@@ -1,558 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-// for computing the structural UID
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.DigestOutputStream;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedAction;
-import java.io.DataOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Array;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
-
-
-import com.sun.corba.se.impl.io.ObjectStreamClass;
-
-public final class ObjectStreamClassUtil_1_3 {
-
- // maintained here for backward compatability with JDK 1.3, where
- // writeObject method was not being checked at all, so there is
- // no need to lookup the ObjectStreamClass
-
- public static long computeSerialVersionUID(final Class cl) {
-
- long csuid = ObjectStreamClass.getSerialVersionUID(cl);
- if (csuid == 0)
- return csuid; // for non-serializable/proxy classes
-
- csuid = (ObjectStreamClassUtil_1_3.getSerialVersion(csuid, cl).longValue());
- return csuid;
- }
-
-
- // to maintain same suid as the JDK 1.3, we pick
- // up suid only for classes with private,static,final
- // declarations, and compute it for all others
-
- private static Long getSerialVersion(final long csuid, final Class cl)
- {
- return (Long) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- long suid;
- try {
- final Field f = cl.getDeclaredField("serialVersionUID");
- int mods = f.getModifiers();
- if (Modifier.isStatic(mods) &&
- Modifier.isFinal(mods) && Modifier.isPrivate(mods)) {
- suid = csuid;
- } else {
- suid = _computeSerialVersionUID(cl);
- }
- } catch (NoSuchFieldException ex) {
- suid = _computeSerialVersionUID(cl);
- //} catch (IllegalAccessException ex) {
- // suid = _computeSerialVersionUID(cl);
- }
- return new Long(suid);
- }
- });
- }
-
- public static long computeStructuralUID(boolean hasWriteObject, Class> cl) {
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
-
- if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
- (cl.isInterface())){
- return 0;
- }
-
- if (java.io.Externalizable.class.isAssignableFrom(cl)) {
- return 1;
- }
-
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
- //In the old case, for the caller class, the write Method wasn't considered
- // for rep-id calculations correctly, but for parent classes it was taken
- // into account. That is the reason there is the klude of getting the write
- // Object method in there
-
- // Get SUID of parent
- Class> parent = cl.getSuperclass();
- if ((parent != null) && (parent != java.lang.Object.class)) {
- boolean hasWriteObjectFlag = false;
- Class [] args = {java.io.ObjectOutputStream.class};
- Method hasWriteObjectMethod = ObjectStreamClassUtil_1_3.getDeclaredMethod(parent, "writeObject", args,
- Modifier.PRIVATE, Modifier.STATIC);
- if (hasWriteObjectMethod != null)
- hasWriteObjectFlag = true;
- data.writeLong(ObjectStreamClassUtil_1_3.computeStructuralUID(hasWriteObjectFlag, parent));
- }
-
- if (hasWriteObject)
- data.writeInt(2);
- else
- data.writeInt(1);
-
- /* Sort the field names to get a deterministic order */
- Field[] field = ObjectStreamClassUtil_1_3.getDeclaredFields(cl);
- Arrays.sort(field, compareMemberByName);
-
- for (int i = 0; i < field.length; i++) {
- Field f = field[i];
-
- /* Include in the hash all fields except those that are
- * transient or static.
- */
- int m = f.getModifiers();
- if (Modifier.isTransient(m) || Modifier.isStatic(m))
- continue;
-
- data.writeUTF(f.getName());
- data.writeUTF(getSignature(f.getType()));
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- int minimum = Math.min(8, hasharray.length);
- for (int i = minimum; i > 0; i--) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- throw new SecurityException(complain.getMessage());
- }
- return h;
- }
-
- /*
- * Compute a hash for the specified class. Incrementally add
- * items to the hash accumulating in the digest stream.
- * Fold the hash into a long. Use the SHA secure hash function.
- */
- private static long _computeSerialVersionUID(Class cl) {
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
-
- data.writeUTF(cl.getName());
-
- int classaccess = cl.getModifiers();
- classaccess &= (Modifier.PUBLIC | Modifier.FINAL |
- Modifier.INTERFACE | Modifier.ABSTRACT);
-
- /* Workaround for javac bug that only set ABSTRACT for
- * interfaces if the interface had some methods.
- * The ABSTRACT bit reflects that the number of methods > 0.
- * This is required so correct hashes can be computed
- * for existing class files.
- * Previously this hack was previously present in the VM.
- */
- Method[] method = cl.getDeclaredMethods();
- if ((classaccess & Modifier.INTERFACE) != 0) {
- classaccess &= (~Modifier.ABSTRACT);
- if (method.length > 0) {
- classaccess |= Modifier.ABSTRACT;
- }
- }
-
- data.writeInt(classaccess);
-
- /*
- * Get the list of interfaces supported,
- * Accumulate their names their names in Lexical order
- * and add them to the hash
- */
- if (!cl.isArray()) {
- /* In 1.2fcs, getInterfaces() was modified to return
- * {java.lang.Cloneable, java.io.Serializable} when
- * called on array classes. These values would upset
- * the computation of the hash, so we explicitly omit
- * them from its computation.
- */
-
- Class interfaces[] = cl.getInterfaces();
- Arrays.sort(interfaces, compareClassByName);
-
- for (int i = 0; i < interfaces.length; i++) {
- data.writeUTF(interfaces[i].getName());
- }
- }
-
- /* Sort the field names to get a deterministic order */
- Field[] field = cl.getDeclaredFields();
- Arrays.sort(field, compareMemberByName);
-
- for (int i = 0; i < field.length; i++) {
- Field f = field[i];
-
- /* Include in the hash all fields except those that are
- * private transient and private static.
- */
- int m = f.getModifiers();
- if (Modifier.isPrivate(m) &&
- (Modifier.isTransient(m) || Modifier.isStatic(m)))
- continue;
-
- data.writeUTF(f.getName());
- data.writeInt(m);
- data.writeUTF(getSignature(f.getType()));
- }
-
- // need to find the java replacement for hasStaticInitializer
- if (hasStaticInitializer(cl)) {
- data.writeUTF("");
- data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have
- data.writeUTF("()V");
- }
-
- /*
- * Get the list of constructors including name and signature
- * Sort lexically, add all except the private constructors
- * to the hash with their access flags
- */
-
- MethodSignature[] constructors =
- MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors());
- for (int i = 0; i < constructors.length; i++) {
- MethodSignature c = constructors[i];
- String mname = "";
- String desc = c.signature;
- desc = desc.replace('/', '.');
- data.writeUTF(mname);
- data.writeInt(c.member.getModifiers());
- data.writeUTF(desc);
- }
-
- /* Include in the hash all methods except those that are
- * private transient and private static.
- */
- MethodSignature[] methods =
- MethodSignature.removePrivateAndSort(method);
- for (int i = 0; i < methods.length; i++ ) {
- MethodSignature m = methods[i];
- String desc = m.signature;
- desc = desc.replace('/', '.');
- data.writeUTF(m.member.getName());
- data.writeInt(m.member.getModifiers());
- data.writeUTF(desc);
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- for (int i = 0; i < Math.min(8, hasharray.length); i++) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- throw new SecurityException(complain.getMessage());
- }
- return h;
- }
-
- /*
- * Comparator object for Classes and Interfaces
- */
- private static Comparator compareClassByName =
- new CompareClassByName();
-
- private static class CompareClassByName implements Comparator {
- public int compare(Object o1, Object o2) {
- Class c1 = (Class)o1;
- Class c2 = (Class)o2;
- return (c1.getName()).compareTo(c2.getName());
- }
- }
-
- /*
- * Comparator object for Members, Fields, and Methods
- */
- private static Comparator compareMemberByName =
- new CompareMemberByName();
-
- private static class CompareMemberByName implements Comparator {
- public int compare(Object o1, Object o2) {
- String s1 = ((Member)o1).getName();
- String s2 = ((Member)o2).getName();
-
- if (o1 instanceof Method) {
- s1 += getSignature((Method)o1);
- s2 += getSignature((Method)o2);
- } else if (o1 instanceof Constructor) {
- s1 += getSignature((Constructor)o1);
- s2 += getSignature((Constructor)o2);
- }
- return s1.compareTo(s2);
- }
- }
-
- /**
- * Compute the JVM signature for the class.
- */
- private static String getSignature(Class clazz) {
- String type = null;
- if (clazz.isArray()) {
- Class cl = clazz;
- int dimensions = 0;
- while (cl.isArray()) {
- dimensions++;
- cl = cl.getComponentType();
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < dimensions; i++) {
- sb.append("[");
- }
- sb.append(getSignature(cl));
- type = sb.toString();
- } else if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = "I";
- } else if (clazz == Byte.TYPE) {
- type = "B";
- } else if (clazz == Long.TYPE) {
- type = "J";
- } else if (clazz == Float.TYPE) {
- type = "F";
- } else if (clazz == Double.TYPE) {
- type = "D";
- } else if (clazz == Short.TYPE) {
- type = "S";
- } else if (clazz == Character.TYPE) {
- type = "C";
- } else if (clazz == Boolean.TYPE) {
- type = "Z";
- } else if (clazz == Void.TYPE) {
- type = "V";
- }
- } else {
- type = "L" + clazz.getName().replace('.', '/') + ";";
- }
- return type;
- }
-
- /*
- * Compute the JVM method descriptor for the method.
- */
- private static String getSignature(Method meth) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class[] params = meth.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")");
- sb.append(getSignature(meth.getReturnType()));
- return sb.toString();
- }
-
- /*
- * Compute the JVM constructor descriptor for the constructor.
- */
- private static String getSignature(Constructor cons) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class[] params = cons.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")V");
- return sb.toString();
- }
-
- private static Field[] getDeclaredFields(final Class clz) {
- return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return clz.getDeclaredFields();
- }
- });
- }
-
- private static class MethodSignature implements Comparator {
- Member member;
- String signature; // cached parameter signature
-
- /* Given an array of Method or Constructor members,
- return a sorted array of the non-private members.*/
- /* A better implementation would be to implement the returned data
- structure as an insertion sorted link list.*/
- static MethodSignature[] removePrivateAndSort(Member[] m) {
- int numNonPrivate = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- numNonPrivate++;
- }
- }
- MethodSignature[] cm = new MethodSignature[numNonPrivate];
- int cmi = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- cm[cmi] = new MethodSignature(m[i]);
- cmi++;
- }
- }
- if (cmi > 0)
- Arrays.sort(cm, cm[0]);
- return cm;
- }
-
- /* Assumes that o1 and o2 are either both methods
- or both constructors.*/
- public int compare(Object o1, Object o2) {
- /* Arrays.sort calls compare when o1 and o2 are equal.*/
- if (o1 == o2)
- return 0;
-
- MethodSignature c1 = (MethodSignature)o1;
- MethodSignature c2 = (MethodSignature)o2;
-
- int result;
- if (isConstructor()) {
- result = c1.signature.compareTo(c2.signature);
- } else { // is a Method.
- result = c1.member.getName().compareTo(c2.member.getName());
- if (result == 0)
- result = c1.signature.compareTo(c2.signature);
- }
- return result;
- }
-
- final private boolean isConstructor() {
- return member instanceof Constructor;
- }
- private MethodSignature(Member m) {
- member = m;
- if (isConstructor()) {
- signature = ObjectStreamClassUtil_1_3.getSignature((Constructor)m);
- } else {
- signature = ObjectStreamClassUtil_1_3.getSignature((Method)m);
- }
- }
- }
-
- /* Find out if the class has a static class initializer */
- // use java.io.ObjectStream's hasStaticInitializer method
- // private static native boolean hasStaticInitializer(Class cl);
-
- private static Method hasStaticInitializerMethod = null;
- /**
- * Returns true if the given class defines a static initializer method,
- * false otherwise.
- */
- private static boolean hasStaticInitializer(Class cl) {
- if (hasStaticInitializerMethod == null) {
- Class classWithThisMethod = null;
-
- try {
- if (classWithThisMethod == null)
- classWithThisMethod = java.io.ObjectStreamClass.class;
-
- hasStaticInitializerMethod =
- classWithThisMethod.getDeclaredMethod("hasStaticInitializer",
- new Class[] { Class.class });
- } catch (NoSuchMethodException ex) {
- }
-
- if (hasStaticInitializerMethod == null) {
- throw new InternalError("Can't find hasStaticInitializer method on "
- + classWithThisMethod.getName());
- }
- hasStaticInitializerMethod.setAccessible(true);
- }
- try {
- Boolean retval = (Boolean)
- hasStaticInitializerMethod.invoke(null, new Object[] { cl });
- return retval.booleanValue();
- } catch (Exception ex) {
- throw new InternalError("Error invoking hasStaticInitializer: "
- + ex);
- }
- }
-
- private static Method getDeclaredMethod(final Class cl, final String methodName, final Class[] args,
- final int requiredModifierMask,
- final int disallowedModifierMask) {
- return (Method) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Method method = null;
- try {
- method =
- cl.getDeclaredMethod(methodName, args);
- int mods = method.getModifiers();
- if ((mods & disallowedModifierMask) != 0 ||
- (mods & requiredModifierMask) != requiredModifierMask) {
- method = null;
- }
- //if (!Modifier.isPrivate(mods) ||
- // Modifier.isStatic(mods)) {
- // method = null;
- //}
- } catch (NoSuchMethodException e) {
- // Since it is alright if methodName does not exist,
- // no need to do anything special here.
- }
- return method;
- }
- });
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java 2018-01-30 20:19:12.000000000 -0500
+++ /dev/null 2018-01-30 20:19:13.000000000 -0500
@@ -1,1262 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.DigestOutputStream;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedAction;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
-
-import java.io.IOException;
-import java.io.DataOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InvalidClassException;
-import java.io.Serializable;
-import java.io.Externalizable;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Hashtable;
-
-import org.omg.CORBA.ValueMember;
-
-import com.sun.corba.se.impl.io.ValueUtility;
-import com.sun.corba.se.impl.io.ObjectStreamClass;
-
-/**
- * This is duplicated here to preserve the JDK 1.3.1FCS behavior
- * of calculating the OMG hash code incorrectly when serialPersistentFields
- * is used, but some of the fields no longer exist in the class itself.
- *
- * We have to duplicate it since we aren't allowed to modify the
- * com.sun.corba.se.impl.io version further, and can't make it
- * public outside of its package for security reasons.
- */
-/**
- * A ObjectStreamClass_1_3_1 describes a class that can be serialized to a stream
- * or a class that was serialized to a stream. It contains the name
- * and the serialVersionUID of the class.
- *
- * The ObjectStreamClass_1_3_1 for a specific class loaded in this Java VM can
- * be found using the lookup method.
- *
- * @author Roger Riggs
- * @since JDK1.1
- */
-public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
-
- public static final long kDefaultUID = -1;
-
- private static Object noArgsList[] = {};
- private static Class> noTypesList[] = {};
-
- private static Hashtable translatedFields;
-
- /** Find the descriptor for a class that can be serialized. Null
- * is returned if the specified class does not implement
- * java.io.Serializable or java.io.Externalizable.
- */
- static final ObjectStreamClass_1_3_1 lookup(Class> cl)
- {
- ObjectStreamClass_1_3_1 desc = lookupInternal(cl);
- if (desc.isSerializable() || desc.isExternalizable())
- return desc;
- return null;
- }
-
- /*
- * Find the class descriptor for the specified class.
- * Package access only so it can be called from ObjectIn/OutStream.
- */
- static ObjectStreamClass_1_3_1 lookupInternal(Class> cl)
- {
- /* Synchronize on the hashtable so no two threads will do
- * this at the same time.
- */
- ObjectStreamClass_1_3_1 desc = null;
- synchronized (descriptorFor) {
- /* Find the matching descriptor if it already known */
- desc = findDescriptorFor(cl);
- if (desc != null) {
- return desc;
- }
-
- /* Check if it's serializable */
- boolean serializable = Serializable.class.isAssignableFrom(cl);
- /* If the class is only Serializable,
- * lookup the descriptor for the superclass.
- */
- ObjectStreamClass_1_3_1 superdesc = null;
- if (serializable) {
- Class> superclass = cl.getSuperclass();
- if (superclass != null)
- superdesc = lookup(superclass);
- }
-
- /* Check if its' externalizable.
- * If it's Externalizable, clear the serializable flag.
- * Only one or the other may be set in the protocol.
- */
- boolean externalizable = false;
- if (serializable) {
- externalizable =
- ((superdesc != null) && superdesc.isExternalizable()) ||
- Externalizable.class.isAssignableFrom(cl);
- if (externalizable) {
- serializable = false;
- }
- }
-
- /* Create a new version descriptor,
- * it put itself in the known table.
- */
- desc = new ObjectStreamClass_1_3_1(cl, superdesc,
- serializable, externalizable);
- }
- desc.init();
- return desc;
- }
-
- /**
- * The name of the class described by this descriptor.
- */
- public final String getName() {
- return name;
- }
-
- /**
- * Return the serialVersionUID for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public static final long getSerialVersionUID( java.lang.Class> clazz) {
- ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz );
- if( theosc != null )
- {
- return theosc.getSerialVersionUID( );
- }
- return 0;
- }
-
- /**
- * Return the serialVersionUID for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public final long getSerialVersionUID() {
- return suid;
- }
-
- /**
- * Return the serialVersionUID string for this class.
- * The serialVersionUID defines a set of classes all with the same name
- * that have evolved from a common root class and agree to be serialized
- * and deserialized using a common format.
- */
- public final String getSerialVersionUIDStr() {
- if (suidStr == null)
- suidStr = Long.toHexString(suid).toUpperCase();
- return suidStr;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public static final long getActualSerialVersionUID( java.lang.Class> clazz )
- {
- ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz );
- if( theosc != null )
- {
- return theosc.getActualSerialVersionUID( );
- }
- return 0;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public final long getActualSerialVersionUID() {
- return actualSuid;
- }
-
- /**
- * Return the actual (computed) serialVersionUID for this class.
- */
- public final String getActualSerialVersionUIDStr() {
- if (actualSuidStr == null)
- actualSuidStr = Long.toHexString(actualSuid).toUpperCase();
- return actualSuidStr;
- }
-
- /**
- * Return the class in the local VM that this version is mapped to.
- * Null is returned if there is no corresponding local class.
- */
- public final Class> forClass() {
- return ofClass;
- }
-
- /**
- * Return an array of the fields of this serializable class.
- * @return an array containing an element for each persistent
- * field of this class. Returns an array of length zero if
- * there are no fields.
- * @since JDK1.2
- */
- public ObjectStreamField[] getFields() {
- // Return a copy so the caller can't change the fields.
- if (fields.length > 0) {
- ObjectStreamField[] dup = new ObjectStreamField[fields.length];
- System.arraycopy(fields, 0, dup, 0, fields.length);
- return dup;
- } else {
- return fields;
- }
- }
-
- public boolean hasField(ValueMember field){
-
- for (int i = 0; i < fields.length; i++){
- try{
- if (fields[i].getName().equals(field.name)) {
-
- if (fields[i].getSignature().equals(ValueUtility.getSignature(field)))
- return true;
- }
- }
- catch(Throwable t){}
- }
- return false;
- }
-
- /* Avoid unnecessary allocations. */
- final ObjectStreamField[] getFieldsNoCopy() {
- return fields;
- }
-
- /**
- * Get the field of this class by name.
- * @return The ObjectStreamField object of the named field or null if there
- * is no such named field.
- */
- public final ObjectStreamField getField(String name) {
- /* Binary search of fields by name.
- */
- for (int i = fields.length-1; i >= 0; i--) {
- if (name.equals(fields[i].getName())) {
- return fields[i];
- }
- }
- return null;
- }
-
- public Serializable writeReplace(Serializable value) {
- if (writeReplaceObjectMethod != null) {
- try {
- return (Serializable) writeReplaceObjectMethod.invoke(value,noArgsList);
- }
- catch(Throwable t) {
- throw new RuntimeException(t.getMessage());
- }
- }
- else return value;
- }
-
- public Object readResolve(Object value) {
- if (readResolveObjectMethod != null) {
- try {
- return readResolveObjectMethod.invoke(value,noArgsList);
- }
- catch(Throwable t) {
- throw new RuntimeException(t.getMessage());
- }
- }
- else return value;
- }
-
- /**
- * Return a string describing this ObjectStreamClass_1_3_1.
- */
- public final String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append(name);
- sb.append(": static final long serialVersionUID = ");
- sb.append(Long.toString(suid));
- sb.append("L;");
- return sb.toString();
- }
-
- /*
- * Create a new ObjectStreamClass_1_3_1 from a loaded class.
- * Don't call this directly, call lookup instead.
- */
- private ObjectStreamClass_1_3_1(java.lang.Class> cl, ObjectStreamClass_1_3_1 superdesc,
- boolean serial, boolean extern)
- {
- ofClass = cl; /* created from this class */
-
- if (Proxy.isProxyClass(cl)) {
- forProxyClass = true;
- }
-
- name = cl.getName();
- superclass = superdesc;
- serializable = serial;
- if (!forProxyClass) {
- // proxy classes are never externalizable
- externalizable = extern;
- }
-
- /*
- * Enter this class in the table of known descriptors.
- * Otherwise, when the fields are read it may recurse
- * trying to find the descriptor for itself.
- */
- insertDescriptorFor(this);
-
- /*
- * The remainder of initialization occurs in init(), which is called
- * after the lock on the global class descriptor table has been
- * released.
- */
- }
-
- /*
- * Initialize class descriptor. This method is only invoked on class
- * descriptors created via calls to lookupInternal(). This method is kept
- * separate from the ObjectStreamClass_1_3_1 constructor so that lookupInternal
- * does not have to hold onto a global class descriptor table lock while the
- * class descriptor is being initialized (see bug 4165204).
- */
-
-
- private void init() {
- synchronized (lock) {
-
- final Class> cl = ofClass;
-
- if (fields != null) // already initialized
- return;
-
-
- if (!serializable ||
- externalizable ||
- forProxyClass ||
- name.equals("java.lang.String")) {
- fields = NO_FIELDS;
- } else if (serializable) {
-
- /* Ask for permission to override field access checks.
- */
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- /* Fill in the list of persistent fields.
- * If it is declared, use the declared serialPersistentFields.
- * Otherwise, extract the fields from the class itself.
- */
- try {
- Field pf = cl.getDeclaredField("serialPersistentFields");
- // serial bug 7; the serialPersistentFields were not
- // being read and stored as Accessible bit was not set
- pf.setAccessible(true);
- // serial bug 7; need to find if the field is of type
- // java.io.ObjectStreamField
- java.io.ObjectStreamField[] f =
- (java.io.ObjectStreamField[])pf.get(cl);
- int mods = pf.getModifiers();
- if ((Modifier.isPrivate(mods)) &&
- (Modifier.isStatic(mods)) &&
- (Modifier.isFinal(mods)))
- {
- fields = (ObjectStreamField[])translateFields((Object[])pf.get(cl));
- }
- } catch (NoSuchFieldException e) {
- fields = null;
- } catch (IllegalAccessException e) {
- fields = null;
- } catch (IllegalArgumentException e) {
- fields = null;
- } catch (ClassCastException e) {
- /* Thrown if a field serialPersistentField exists
- * but it is not of type ObjectStreamField.
- */
- fields = null;
- }
-
-
- if (fields == null) {
- /* Get all of the declared fields for this
- * Class. setAccessible on all fields so they
- * can be accessed later. Create a temporary
- * ObjectStreamField array to hold each
- * non-static, non-transient field. Then copy the
- * temporary array into an array of the correct
- * size once the number of fields is known.
- */
- Field[] actualfields = cl.getDeclaredFields();
-
- int numFields = 0;
- ObjectStreamField[] tempFields =
- new ObjectStreamField[actualfields.length];
- for (int i = 0; i < actualfields.length; i++) {
- int modifiers = actualfields[i].getModifiers();
- if (!Modifier.isStatic(modifiers) &&
- !Modifier.isTransient(modifiers)) {
- tempFields[numFields++] =
- new ObjectStreamField(actualfields[i]);
- }
- }
- fields = new ObjectStreamField[numFields];
- System.arraycopy(tempFields, 0, fields, 0, numFields);
-
- } else {
- // For each declared persistent field, look for an actual
- // reflected Field. If there is one, make sure it's the correct
- // type and cache it in the ObjectStreamClass_1_3_1 for that field.
- for (int j = fields.length-1; j >= 0; j--) {
- try {
- Field reflField = cl.getDeclaredField(fields[j].getName());
- if (fields[j].getType() == reflField.getType()) {
- // reflField.setAccessible(true);
- fields[j].setField(reflField);
- }
- } catch (NoSuchFieldException e) {
- // Nothing to do
- }
- }
- }
- return null;
- }
- });
-
- if (fields.length > 1)
- Arrays.sort(fields);
-
- /* Set up field data for use while writing using the API api. */
- computeFieldInfo();
- }
-
- /* Get the serialVersionUID from the class.
- * It uses the access override mechanism so make sure
- * the field objects is only used here.
- *
- * NonSerializable classes have a serialVerisonUID of 0L.
- */
- if (isNonSerializable()) {
- suid = 0L;
- } else {
- // Lookup special Serializable members using reflection.
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- if (forProxyClass) {
- // proxy classes always have serialVersionUID of 0L
- suid = 0L;
- } else {
- try {
- final Field f = cl.getDeclaredField("serialVersionUID");
- int mods = f.getModifiers();
- // SerialBug 5: static final SUID should be read
- if (Modifier.isStatic(mods) &&
- Modifier.isFinal(mods) ) {
- f.setAccessible(true);
- suid = f.getLong(cl);
- // get rid of native code
- // suid = getSerialVersionUIDField(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- } else {
- suid = ObjectStreamClass.getSerialVersionUID(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- }
- } catch (NoSuchFieldException ex) {
- suid = ObjectStreamClass.getSerialVersionUID(cl);
- // SerialBug 2: should be computed after writeObject
- // actualSuid = computeStructuralUID(cl);
- } catch (IllegalAccessException ex) {
- suid = ObjectStreamClass.getSerialVersionUID(cl);
- }
- }
-
-
- try {
- writeReplaceObjectMethod = cl.getDeclaredMethod("writeReplace", noTypesList);
- if (Modifier.isStatic(writeReplaceObjectMethod.getModifiers())) {
- writeReplaceObjectMethod = null;
- } else {
- writeReplaceObjectMethod.setAccessible(true);
- }
-
- } catch (NoSuchMethodException e2) {
-
- }
-
- try {
- readResolveObjectMethod = cl.getDeclaredMethod("readResolve", noTypesList);
- if (Modifier.isStatic(readResolveObjectMethod.getModifiers())) {
- readResolveObjectMethod = null;
- } else {
- readResolveObjectMethod.setAccessible(true);
- }
-
- } catch (NoSuchMethodException e2) {
-
- }
-
- /* Cache lookup of writeObject and readObject for
- * Serializable classes. (Do not lookup for
- * Externalizable)
- */
-
- if (serializable && !forProxyClass) {
-
- /* Look for the writeObject method
- * Set the accessible flag on it here. ObjectOutputStream
- * will call it as necessary.
- */
- try {
- Class>[] args = {java.io.ObjectOutputStream.class};
- writeObjectMethod = cl.getDeclaredMethod("writeObject", args);
- hasWriteObjectMethod = true;
- int mods = writeObjectMethod.getModifiers();
-
- // Method must be private and non-static
- if (!Modifier.isPrivate(mods) ||
- Modifier.isStatic(mods)) {
- writeObjectMethod = null;
- hasWriteObjectMethod = false;
- }
-
- } catch (NoSuchMethodException e) {
- }
-
- /* Look for the readObject method
- * set the access override and save the reference for
- * ObjectInputStream so it can all the method directly.
- */
- try {
- Class>[] args = {java.io.ObjectInputStream.class};
- readObjectMethod = cl.getDeclaredMethod("readObject", args);
- int mods = readObjectMethod.getModifiers();
-
- // Method must be private and non-static
- if (!Modifier.isPrivate(mods) ||
- Modifier.isStatic(mods)) {
- readObjectMethod = null;
- }
- } catch (NoSuchMethodException e) {
- }
- // Compute the structural UID. This must be done after the
- // calculation for writeObject. Fixed 4/20/2000, eea1
- // SerialBug 2: to have correct value in RepId
- }
- return null;
- }
- });
- }
-
- actualSuid = computeStructuralUID(this, cl);
- }
-
- }
-
- /*
- * Create an empty ObjectStreamClass_1_3_1 for a class about to be read.
- * This is separate from read so ObjectInputStream can assign the
- * wire handle early, before any nested ObjectStreamClass_1_3_1 might
- * be read.
- */
- ObjectStreamClass_1_3_1(String n, long s) {
- name = n;
- suid = s;
- superclass = null;
- }
-
- private static Object[] translateFields(Object objs[])
- throws NoSuchFieldException {
- try{
- java.io.ObjectStreamField fields[] = (java.io.ObjectStreamField[])objs;
- Object translation[] = null;
-
- if (translatedFields == null)
- translatedFields = new Hashtable();
-
- translation = (Object[])translatedFields.get(fields);
-
- if (translation != null)
- return translation;
- else {
- Class> osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class;
-
- translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length);
- Object arg[] = new Object[2];
- Class> types[] = {String.class, Class.class};
- Constructor constructor = osfClass.getDeclaredConstructor(types);
- for (int i = fields.length -1; i >= 0; i--){
- arg[0] = fields[i].getName();
- arg[1] = fields[i].getType();
-
- translation[i] = constructor.newInstance(arg);
- }
- translatedFields.put(fields, translation);
-
- }
-
- return (Object[])translation;
- }
- catch(Throwable t){
- throw new NoSuchFieldException();
- }
- }
-
- /* Compare the base class names of streamName and localName.
- *
- * @return Return true iff the base class name compare.
- * @param streamName Fully qualified class name.
- * @param localName Fully qualified class name.
- * @param pkgSeparator class names use either '.' or '/'.
- *
- * Only compare base class name to allow package renaming.
- */
- static boolean compareClassNames(String streamName,
- String localName,
- char pkgSeparator) {
- /* compare the class names, stripping off package names. */
- int streamNameIndex = streamName.lastIndexOf(pkgSeparator);
- if (streamNameIndex < 0)
- streamNameIndex = 0;
-
- int localNameIndex = localName.lastIndexOf(pkgSeparator);
- if (localNameIndex < 0)
- localNameIndex = 0;
-
- return streamName.regionMatches(false, streamNameIndex,
- localName, localNameIndex,
- streamName.length() - streamNameIndex);
- }
-
- /*
- * Compare the types of two class descriptors.
- * They match if they have the same class name and suid
- */
- final boolean typeEquals(ObjectStreamClass_1_3_1 other) {
- return (suid == other.suid) &&
- compareClassNames(name, other.name, '.');
- }
-
- /*
- * Return the superclass descriptor of this descriptor.
- */
- final void setSuperclass(ObjectStreamClass_1_3_1 s) {
- superclass = s;
- }
-
- /*
- * Return the superclass descriptor of this descriptor.
- */
- final ObjectStreamClass_1_3_1 getSuperclass() {
- return superclass;
- }
-
- /*
- * Return whether the class has a writeObject method
- */
- final boolean hasWriteObject() {
- return hasWriteObjectMethod;
- }
-
- final boolean isCustomMarshaled() {
- return (hasWriteObject() || isExternalizable());
- }
-
- /*
- * Return true if all instances of 'this' Externalizable class
- * are written in block-data mode from the stream that 'this' was read
- * from.
- *
- * In JDK 1.1, all Externalizable instances are not written
- * in block-data mode.
- * In JDK 1.2, all Externalizable instances, by default, are written
- * in block-data mode and the Externalizable instance is terminated with
- * tag TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable
- * instances.
- *
- * IMPLEMENTATION NOTE:
- * This should have been a mode maintained per stream; however,
- * for compatibility reasons, it was only possible to record
- * this change per class. All Externalizable classes within
- * a given stream should either have this mode enabled or
- * disabled. This is enforced by not allowing the PROTOCOL_VERSION
- * of a stream to he changed after any objects have been written.
- *
- * @see ObjectOutputStream#useProtocolVersion
- * @see ObjectStreamConstants#PROTOCOL_VERSION_1
- * @see ObjectStreamConstants#PROTOCOL_VERSION_2
- *
- * @since JDK 1.2
- */
- boolean hasExternalizableBlockDataMode() {
- return hasExternalizableBlockData;
- }
-
- /*
- * Return the ObjectStreamClass_1_3_1 of the local class this one is based on.
- */
- final ObjectStreamClass_1_3_1 localClassDescriptor() {
- return localClassDesc;
- }
-
- /*
- * Get the Serializability of the class.
- */
- boolean isSerializable() {
- return serializable;
- }
-
- /*
- * Get the externalizability of the class.
- */
- boolean isExternalizable() {
- return externalizable;
- }
-
- boolean isNonSerializable() {
- return ! (externalizable || serializable);
- }
-
- /*
- * Calculate the size of the array needed to store primitive data and the
- * number of object references to read when reading from the input
- * stream.
- */
- private void computeFieldInfo() {
- primBytes = 0;
- objFields = 0;
-
- for (int i = 0; i < fields.length; i++ ) {
- switch (fields[i].getTypeCode()) {
- case 'B':
- case 'Z':
- primBytes += 1;
- break;
- case 'C':
- case 'S':
- primBytes += 2;
- break;
-
- case 'I':
- case 'F':
- primBytes += 4;
- break;
- case 'J':
- case 'D' :
- primBytes += 8;
- break;
-
- case 'L':
- case '[':
- objFields += 1;
- break;
- }
- }
- }
-
- private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class> cl) {
- ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
-
- long h = 0;
- try {
-
- if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
- (cl.isInterface())){
- return 0;
- }
-
- if (java.io.Externalizable.class.isAssignableFrom(cl)) {
- return 1;
- }
-
- MessageDigest md = MessageDigest.getInstance("SHA");
- DigestOutputStream mdo = new DigestOutputStream(devnull, md);
- DataOutputStream data = new DataOutputStream(mdo);
-
- // Get SUID of parent
- Class> parent = cl.getSuperclass();
- if ((parent != null))
- // SerialBug 1; acc. to spec the one for
- // java.lang.object
- // should be computed and put
- // && (parent != java.lang.Object.class))
- {
- //data.writeLong(computeSerialVersionUID(null,parent));
- data.writeLong(computeStructuralUID(lookup(parent), parent));
- }
-
- if (osc.hasWriteObject())
- data.writeInt(2);
- else
- data.writeInt(1);
-
- /* Sort the field names to get a deterministic order */
- // Field[] field = ObjectStreamClass_1_3_1.getDeclaredFields(cl);
-
- ObjectStreamField[] fields = osc.getFields();
-
- // Must make sure that the Field array we allocate
- // below is exactly the right size. Bug fix for
- // 4397133.
- int numNonNullFields = 0;
- for (int i = 0; i < fields.length; i++)
- if (fields[i].getField() != null)
- numNonNullFields++;
-
- Field [] field = new java.lang.reflect.Field[numNonNullFields];
- for (int i = 0, fieldNum = 0; i < fields.length; i++) {
- if (fields[i].getField() != null) {
- field[fieldNum++] = fields[i].getField();
- }
- }
-
- if (field.length > 1)
- Arrays.sort(field, compareMemberByName);
-
- for (int i = 0; i < field.length; i++) {
- Field f = field[i];
-
- /* Include in the hash all fields except those that are
- * transient
- */
- int m = f.getModifiers();
- //Serial 6
- //if (Modifier.isTransient(m) || Modifier.isStatic(m))
- // spec reference 00-01-06.pdf, 1.3.5.6, states non-static
- // non-transient, public fields are mapped to Java IDL.
- //
- // Here's the quote from the first paragraph:
- // Java non-static non-transient public fields are mapped to
- // OMG IDL public data members, and other Java fields are
- // not mapped.
-
- // if (Modifier.isTransient(m) || Modifier.isStatic(m))
- // continue;
-
- data.writeUTF(f.getName());
- data.writeUTF(getSignature(f.getType()));
- }
-
- /* Compute the hash value for this class.
- * Use only the first 64 bits of the hash.
- */
- data.flush();
- byte hasharray[] = md.digest();
- // int minimum = Math.min(8, hasharray.length);
- // SerialBug 3: SHA computation is wrong; for loop reversed
- //for (int i = minimum; i > 0; i--)
- for (int i = 0; i < Math.min(8, hasharray.length); i++) {
- h += (long)(hasharray[i] & 255) << (i * 8);
- }
- } catch (IOException ignore) {
- /* can't happen, but be deterministic anyway. */
- h = -1;
- } catch (NoSuchAlgorithmException complain) {
- throw new SecurityException(complain.getMessage());
- }
- return h;
- }
-
- /**
- * Compute the JVM signature for the class.
- */
- static String getSignature(Class> clazz) {
- String type = null;
- if (clazz.isArray()) {
- Class> cl = clazz;
- int dimensions = 0;
- while (cl.isArray()) {
- dimensions++;
- cl = cl.getComponentType();
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < dimensions; i++) {
- sb.append("[");
- }
- sb.append(getSignature(cl));
- type = sb.toString();
- } else if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = "I";
- } else if (clazz == Byte.TYPE) {
- type = "B";
- } else if (clazz == Long.TYPE) {
- type = "J";
- } else if (clazz == Float.TYPE) {
- type = "F";
- } else if (clazz == Double.TYPE) {
- type = "D";
- } else if (clazz == Short.TYPE) {
- type = "S";
- } else if (clazz == Character.TYPE) {
- type = "C";
- } else if (clazz == Boolean.TYPE) {
- type = "Z";
- } else if (clazz == Void.TYPE) {
- type = "V";
- }
- } else {
- type = "L" + clazz.getName().replace('.', '/') + ";";
- }
- return type;
- }
-
- /*
- * Compute the JVM method descriptor for the method.
- */
- static String getSignature(Method meth) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class>[] params = meth.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")");
- sb.append(getSignature(meth.getReturnType()));
- return sb.toString();
- }
-
- /*
- * Compute the JVM constructor descriptor for the constructor.
- */
- static String getSignature(Constructor cons) {
- StringBuffer sb = new StringBuffer();
-
- sb.append("(");
-
- Class>[] params = cons.getParameterTypes(); // avoid clone
- for (int j = 0; j < params.length; j++) {
- sb.append(getSignature(params[j]));
- }
- sb.append(")V");
- return sb.toString();
- }
-
- /*
- * Cache of Class -> ClassDescriptor Mappings.
- */
- static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61];
-
- /*
- * findDescriptorFor a Class. This looks in the cache for a
- * mapping from Class -> ObjectStreamClass mappings. The hashCode
- * of the Class is used for the lookup since the Class is the key.
- * The entries are extended from java.lang.ref.SoftReference so the
- * gc will be able to free them if needed.
- */
- private static ObjectStreamClass_1_3_1 findDescriptorFor(Class> cl) {
-
- int hash = cl.hashCode();
- int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
- ObjectStreamClassEntry e;
- ObjectStreamClassEntry prev;
-
- /* Free any initial entries whose refs have been cleared */
- while ((e = descriptorFor[index]) != null && e.get() == null) {
- descriptorFor[index] = e.next;
- }
-
- /* Traverse the chain looking for a descriptor with ofClass == cl.
- * unlink entries that are unresolved.
- */
- prev = e;
- while (e != null ) {
- ObjectStreamClass_1_3_1 desc = (ObjectStreamClass_1_3_1)(e.get());
- if (desc == null) {
- // This entry has been cleared, unlink it
- prev.next = e.next;
- } else {
- if (desc.ofClass == cl)
- return desc;
- prev = e;
- }
- e = e.next;
- }
- return null;
- }
-
- /*
- * insertDescriptorFor a Class -> ObjectStreamClass_1_3_1 mapping.
- */
- private static void insertDescriptorFor(ObjectStreamClass_1_3_1 desc) {
- // Make sure not already present
- if (findDescriptorFor(desc.ofClass) != null) {
- return;
- }
-
- int hash = desc.ofClass.hashCode();
- int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
- ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc);
- e.next = descriptorFor[index];
- descriptorFor[index] = e;
- }
-
- private static Field[] getDeclaredFields(final Class clz) {
- return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return clz.getDeclaredFields();
- }
- });
- }
-
-
- /*
- * The name of this descriptor
- */
- private String name;
-
- /*
- * The descriptor of the supertype.
- */
- private ObjectStreamClass_1_3_1 superclass;
-
- /*
- * Flags for Serializable and Externalizable.
- */
- private boolean serializable;
- private boolean externalizable;
-
- /*
- * Array of persistent fields of this class, sorted by
- * type and name.
- */
- private ObjectStreamField[] fields;
-
- /*
- * Class that is a descriptor for in this virtual machine.
- */
- private Class> ofClass;
-
- /*
- * True if descriptor for a proxy class.
- */
- boolean forProxyClass;
-
-
- /*
- * SerialVersionUID for this class.
- */
- private long suid = kDefaultUID;
- private String suidStr = null;
-
- /*
- * Actual (computed) SerialVersionUID for this class.
- */
- private long actualSuid = kDefaultUID;
- private String actualSuidStr = null;
-
- /*
- * The total number of bytes of primitive fields.
- * The total number of object fields.
- */
- int primBytes;
- int objFields;
-
- /* Internal lock object. */
- private Object lock = new Object();
-
- /* True if this class has/had a writeObject method */
- private boolean hasWriteObjectMethod;
-
- /* In JDK 1.1, external data was not written in block mode.
- * As of JDK 1.2, external data is written in block data mode. This
- * flag enables JDK 1.2 to be able to read JDK 1.1 written external data.
- *
- * @since JDK 1.2
- */
- private boolean hasExternalizableBlockData;
- Method writeObjectMethod;
- Method readObjectMethod;
- private transient Method writeReplaceObjectMethod;
- private transient Method readResolveObjectMethod;
-
- /*
- * ObjectStreamClass_1_3_1 that this one was built from.
- */
- private ObjectStreamClass_1_3_1 localClassDesc;
-
- /* Get the private static final field for serial version UID */
- // private static native long getSerialVersionUIDField(Class cl);
-
- /** use serialVersionUID from JDK 1.1. for interoperability */
- private static final long serialVersionUID = -6120832682080437368L;
-
- /**
- * Set serialPersistentFields of a Serializable class to this value to
- * denote that the class has no Serializable fields.
- */
- public static final ObjectStreamField[] NO_FIELDS =
- new ObjectStreamField[0];
-
- /*
- * Entries held in the Cache of known ObjectStreamClass_1_3_1 objects.
- * Entries are chained together with the same hash value (modulo array size).
- */
- private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference
- {
- ObjectStreamClassEntry(ObjectStreamClass_1_3_1 c) {
- //super(c);
- this.c = c;
- }
- ObjectStreamClassEntry next;
-
- public Object get()
- {
- return c;
- }
- private ObjectStreamClass_1_3_1 c;
- }
-
- /*
- * Comparator object for Classes and Interfaces
- */
- private static Comparator compareClassByName =
- new CompareClassByName();
-
- private static class CompareClassByName implements Comparator {
- public int compare(Object o1, Object o2) {
- Class> c1 = (Class)o1;
- Class> c2 = (Class)o2;
- return (c1.getName()).compareTo(c2.getName());
- }
- }
-
- /*
- * Comparator object for Members, Fields, and Methods
- */
- private static Comparator compareMemberByName =
- new CompareMemberByName();
-
- private static class CompareMemberByName implements Comparator {
- public int compare(Object o1, Object o2) {
- String s1 = ((Member)o1).getName();
- String s2 = ((Member)o2).getName();
-
- if (o1 instanceof Method) {
- s1 += getSignature((Method)o1);
- s2 += getSignature((Method)o2);
- } else if (o1 instanceof Constructor) {
- s1 += getSignature((Constructor)o1);
- s2 += getSignature((Constructor)o2);
- }
- return s1.compareTo(s2);
- }
- }
-
- /* It is expensive to recompute a method or constructor signature
- many times, so compute it only once using this data structure. */
- private static class MethodSignature implements Comparator {
- Member member;
- String signature; // cached parameter signature
-
- /* Given an array of Method or Constructor members,
- return a sorted array of the non-private members.*/
- /* A better implementation would be to implement the returned data
- structure as an insertion sorted link list.*/
- static MethodSignature[] removePrivateAndSort(Member[] m) {
- int numNonPrivate = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- numNonPrivate++;
- }
- }
- MethodSignature[] cm = new MethodSignature[numNonPrivate];
- int cmi = 0;
- for (int i = 0; i < m.length; i++) {
- if (! Modifier.isPrivate(m[i].getModifiers())) {
- cm[cmi] = new MethodSignature(m[i]);
- cmi++;
- }
- }
- if (cmi > 0)
- Arrays.sort(cm, cm[0]);
- return cm;
- }
-
- /* Assumes that o1 and o2 are either both methods
- or both constructors.*/
- public int compare(Object o1, Object o2) {
- /* Arrays.sort calls compare when o1 and o2 are equal.*/
- if (o1 == o2)
- return 0;
-
- MethodSignature c1 = (MethodSignature)o1;
- MethodSignature c2 = (MethodSignature)o2;
-
- int result;
- if (isConstructor()) {
- result = c1.signature.compareTo(c2.signature);
- } else { // is a Method.
- result = c1.member.getName().compareTo(c2.member.getName());
- if (result == 0)
- result = c1.signature.compareTo(c2.signature);
- }
- return result;
- }
-
- final private boolean isConstructor() {
- return member instanceof Constructor;
- }
- private MethodSignature(Member m) {
- member = m;
- if (isConstructor()) {
- signature = ObjectStreamClass_1_3_1.getSignature((Constructor)m);
- } else {
- signature = ObjectStreamClass_1_3_1.getSignature((Method)m);
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamField.java 2018-01-30 20:19:13.000000000 -0500
+++ /dev/null 2018-01-30 20:19:13.000000000 -0500
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Licensed Materials - Property of IBM
- * RMI-IIOP v1.0
- * Copyright IBM Corp. 1998 1999 All Rights Reserved
- *
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.lang.reflect.Field;
-import java.lang.Comparable;
-import java.util.Hashtable;
-
-/**
- * This is duplicated here somewhat in haste since we can't
- * expose this class outside of the com.sun.corba.se.impl.io
- * package for security reasons.
- */
-/**
- * A description of a field in a serializable class.
- * A array of these is used to declare the persistent fields of
- * a class.
- *
- */
-class ObjectStreamField implements Comparable {
- /**
- * Create a named field with the specified type.
- */
- ObjectStreamField(String n, Class clazz) {
- name = n;
- this.clazz = clazz;
-
- // Compute the typecode for easy switching
- if (clazz.isPrimitive()) {
- if (clazz == Integer.TYPE) {
- type = 'I';
- } else if (clazz == Byte.TYPE) {
- type = 'B';
- } else if (clazz == Long.TYPE) {
- type = 'J';
- } else if (clazz == Float.TYPE) {
- type = 'F';
- } else if (clazz == Double.TYPE) {
- type = 'D';
- } else if (clazz == Short.TYPE) {
- type = 'S';
- } else if (clazz == Character.TYPE) {
- type = 'C';
- } else if (clazz == Boolean.TYPE) {
- type = 'Z';
- }
- } else if (clazz.isArray()) {
- type = '[';
- typeString = ObjectStreamClass_1_3_1.getSignature(clazz);
- } else {
- type = 'L';
- typeString = ObjectStreamClass_1_3_1.getSignature(clazz);
- }
-
- if (typeString != null)
- signature = typeString;
- else
- signature = String.valueOf(type);
-
- }
-
- ObjectStreamField(Field field) {
- this(field.getName(), field.getType());
- this.field = field;
- }
-
- /**
- * Create an ObjectStreamField containing a reflected Field.
- */
- ObjectStreamField(String n, char t, Field f, String ts)
- {
- name = n;
- type = t;
- field = f;
- typeString = ts;
-
- if (typeString != null)
- signature = typeString;
- else
- signature = String.valueOf(type);
-
- }
-
- /**
- * Get the name of this field.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the type of the field.
- */
- public Class getType() {
- if (clazz != null)
- return clazz;
- switch (type) {
- case 'B': clazz = Byte.TYPE;
- break;
- case 'C': clazz = Character.TYPE;
- break;
- case 'S': clazz = Short.TYPE;
- break;
- case 'I': clazz = Integer.TYPE;
- break;
- case 'J': clazz = Long.TYPE;
- break;
- case 'F': clazz = Float.TYPE;
- break;
- case 'D': clazz = Double.TYPE;
- break;
- case 'Z': clazz = Boolean.TYPE;
- break;
- case '[':
- case 'L':
- clazz = Object.class;
- break;
- }
-
- return clazz;
- }
-
- public char getTypeCode() {
- return type;
- }
-
- public String getTypeString() {
- return typeString;
- }
-
- Field getField() {
- return field;
- }
-
- void setField(Field field) {
- this.field = field;
- this.fieldID = -1;
- }
-
- /*
- * Default constructor creates an empty field.
- * Usually used just to get to the sort functions.
- */
- ObjectStreamField() {
- }
-
- /**
- * test if this field is a primitive or not.
- */
- public boolean isPrimitive() {
- return (type != '[' && type != 'L');
- }
-
- /**
- * Compare this with another ObjectStreamField.
- * return -1 if this is smaller, 0 if equal, 1 if greater
- * types that are primitives are "smaller" than objects.
- * if equal, the names are compared.
- */
- public int compareTo(Object o) {
- ObjectStreamField f2 = (ObjectStreamField)o;
- boolean thisprim = (this.typeString == null);
- boolean otherprim = (f2.typeString == null);
-
- if (thisprim != otherprim) {
- return (thisprim ? -1 : 1);
- }
- return this.name.compareTo(f2.name);
- }
-
- /**
- * Compare the types of two class descriptors.
- * The match if they have the same primitive types.
- * or if they are both objects and the object types match.
- */
- public boolean typeEquals(ObjectStreamField other) {
- if (other == null || type != other.type)
- return false;
-
- /* Return true if the primitive types matched */
- if (typeString == null && other.typeString == null)
- return true;
-
- return ObjectStreamClass_1_3_1.compareClassNames(typeString,
- other.typeString,
- '/');
- }
-
- /* Returns the signature of the Field.
- *
- */
- public String getSignature() {
-
- return signature;
-
- }
-
- /**
- * Return a string describing this field.
- */
- public String toString() {
- if (typeString != null)
- return typeString + " " + name;
- else
- return type + " " + name;
- }
-
- public Class getClazz() {
- return clazz;
- }
-
- /* Returns the Field ID
- * NOT USED, since this class is used only in ObjectStreamClass_1_3_1,
- * which is used only in RepositoryId_1_3_1.
- public long getFieldID( Class cl ) {
- if (fieldID == -1) {
- if (typeString != null)
- fieldID = getFieldIDNative( cl, getName(), typeString );
- else
- fieldID = getFieldIDNative( cl, getName(), getSignature() );
- }
- return fieldID;
- }
- */
-
- private String name; // the name of the field
- private char type; // type first byte of the type signature
- private Field field; // Reflected field
- private String typeString; // iff object, typename
- private Class clazz; // the type of this field, if has been resolved
-
- // the next 3 things are RMI-IIOP specific, it can be easily
- // removed, if we can figure out all place where there are dependencies
- // to this. Signature is esentially equal to typestring. Then
- // essentially we can use the java.io.ObjectStreamField as such.
-
- private String signature; // the signature of the field
- private long fieldID = -1;
- // private static native long getFieldIDNative(Class c, String fieldName, String fieldSig);
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java 2018-01-30 20:19:14.000000000 -0500
+++ /dev/null 2018-01-30 20:19:14.000000000 -0500
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.IdentityHashMap;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.math.BigInteger ;
-import java.math.BigDecimal ;
-
-public final class ObjectUtility {
- private ObjectUtility() {}
-
-
- /** If arr1 and arr2 are both arrays of the same component type,
- * return an array of that component type that consists of the
- * elements of arr1 followed by the elements of arr2.
- * Throws IllegalArgumentException otherwise.
- */
- public static Object concatenateArrays( Object arr1, Object arr2 )
- {
- Class comp1 = arr1.getClass().getComponentType() ;
- Class comp2 = arr2.getClass().getComponentType() ;
- int len1 = Array.getLength( arr1 ) ;
- int len2 = Array.getLength( arr2 ) ;
-
- if ((comp1 == null) || (comp2 == null))
- throw new IllegalStateException( "Arguments must be arrays" ) ;
- if (!comp1.equals( comp2 ))
- throw new IllegalStateException(
- "Arguments must be arrays with the same component type" ) ;
-
- Object result = Array.newInstance( comp1, len1 + len2 ) ;
-
- int index = 0 ;
-
- for (int ctr=0; ctr" ) ;
- Class compClass = obj.getClass().getComponentType() ;
-
- if (compClass != null) {
- result.append( "[" ) ;
- if (compClass == boolean.class) {
- boolean[] arr = (boolean[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == byte.class) {
- byte[] arr = (byte[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == short.class) {
- short[] arr = (short[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == int.class) {
- int[] arr = (int[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == long.class) {
- long[] arr = (long[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == char.class) {
- char[] arr = (char[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == float.class) {
- float[] arr = (float[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else if (compClass == double.class) {
- double[] arr = (double[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- } else { // array of object
- java.lang.Object[] arr = (java.lang.Object[])obj ;
- result.append( arr.length ) ;
- result.append( "]" ) ;
- }
- }
-
- result.append( "(" ) ;
- }
-
- /** Expected patterns:
- * startObject endObject( str )
- * header( elem )\n
- * startObject ( startElement append* endElement ) * endObject
- * header(\n
- * append*\n *
- * )\n
- */
- private static class IndentingObjectWriter extends ObjectWriter {
- private int level ;
- private int increment ;
-
- public IndentingObjectWriter( int initialLevel, int increment )
- {
- this.level = initialLevel ;
- this.increment = increment ;
- startLine() ;
- }
-
- private void startLine()
- {
- char[] fill = new char[ level * increment ] ;
- Arrays.fill( fill, ' ' ) ;
- result.append( fill ) ;
- }
-
- public void startObject( java.lang.Object obj )
- {
- appendObjectHeader( obj ) ;
- level++ ;
- }
-
- public void startElement()
- {
- result.append( "\n" ) ;
- startLine() ;
- }
-
- public void endElement()
- {
- }
-
- public void endObject( String str )
- {
- level-- ;
- result.append( str ) ;
- result.append( ")" ) ;
- }
-
- public void endObject( )
- {
- level-- ;
- result.append( "\n" ) ;
- startLine() ;
- result.append( ")" ) ;
- }
- }
-
- private static class SimpleObjectWriter extends ObjectWriter {
- public void startObject( java.lang.Object obj )
- {
- appendObjectHeader( obj ) ;
- result.append( " " ) ;
- }
-
- public void startElement()
- {
- result.append( " " ) ;
- }
-
- public void endObject( String str )
- {
- result.append( str ) ;
- result.append( ")" ) ;
- }
-
- public void endElement()
- {
- }
-
- public void endObject()
- {
- result.append( ")" ) ;
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java 2018-01-30 20:19:15.000000000 -0500
+++ /dev/null 2018-01-30 20:19:15.000000000 -0500
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import org.omg.CORBA.ORB;
-import java.io.Serializable;
-import java.util.Hashtable;
-import com.sun.corba.se.impl.io.TypeMismatchException;
-import java.net.MalformedURLException;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-/**
- * Delegates to the current RepositoryId implementation in
- * com.sun.corba.se.impl.util. This is necessary to
- * overcome the fact that many of RepositoryId's methods
- * are static.
- */
-public final class RepIdDelegator
- implements RepositoryIdStrings,
- RepositoryIdUtility,
- RepositoryIdInterface
-{
- // RepositoryIdFactory methods
-
- public String createForAnyType(Class type) {
- return RepositoryId.createForAnyType(type);
- }
-
- public String createForJavaType(Serializable ser)
- throws TypeMismatchException
- {
- return RepositoryId.createForJavaType(ser);
- }
-
- public String createForJavaType(Class clz)
- throws TypeMismatchException
- {
- return RepositoryId.createForJavaType(clz);
- }
-
- public String createSequenceRepID(java.lang.Object ser) {
- return RepositoryId.createSequenceRepID(ser);
- }
-
- public String createSequenceRepID(Class clazz) {
- return RepositoryId.createSequenceRepID(clazz);
- }
-
- public RepositoryIdInterface getFromString(String repIdString) {
- return new RepIdDelegator(RepositoryId.cache.getId(repIdString));
- }
-
- // RepositoryIdUtility methods
-
- public boolean isChunkedEncoding(int valueTag) {
- return RepositoryId.isChunkedEncoding(valueTag);
- }
-
- public boolean isCodeBasePresent(int valueTag) {
- return RepositoryId.isCodeBasePresent(valueTag);
- }
-
- public String getClassDescValueRepId() {
- return RepositoryId.kClassDescValueRepID;
- }
-
- public String getWStringValueRepId() {
- return RepositoryId.kWStringValueRepID;
- }
-
- public int getTypeInfo(int valueTag) {
- return RepositoryId.getTypeInfo(valueTag);
- }
-
- public int getStandardRMIChunkedNoRepStrId() {
- return RepositoryId.kPreComputed_StandardRMIChunked_NoRep;
- }
-
- public int getCodeBaseRMIChunkedNoRepStrId() {
- return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep;
- }
-
- public int getStandardRMIChunkedId() {
- return RepositoryId.kPreComputed_StandardRMIChunked;
- }
-
- public int getCodeBaseRMIChunkedId() {
- return RepositoryId.kPreComputed_CodeBaseRMIChunked;
- }
-
- public int getStandardRMIUnchunkedId() {
- return RepositoryId.kPreComputed_StandardRMIUnchunked;
- }
-
- public int getCodeBaseRMIUnchunkedId() {
- return RepositoryId.kPreComputed_CodeBaseRMIUnchunked;
- }
-
- public int getStandardRMIUnchunkedNoRepStrId() {
- return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep;
- }
-
- public int getCodeBaseRMIUnchunkedNoRepStrId() {
- return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep;
- }
-
- // RepositoryIdInterface methods
-
- public Class getClassFromType() throws ClassNotFoundException {
- return delegate.getClassFromType();
- }
-
- public Class getClassFromType(String codebaseURL)
- throws ClassNotFoundException, MalformedURLException
- {
- return delegate.getClassFromType(codebaseURL);
- }
-
- public Class getClassFromType(Class expectedType,
- String codebaseURL)
- throws ClassNotFoundException, MalformedURLException
- {
- return delegate.getClassFromType(expectedType, codebaseURL);
- }
-
- public String getClassName() {
- return delegate.getClassName();
- }
-
- // Constructor used for factory/utility cases
- public RepIdDelegator() {
- this(null);
- }
-
- // Constructor used by getIdFromString. All non-static
- // RepositoryId methods will use the provided delegate.
- private RepIdDelegator(RepositoryId _delegate) {
- this.delegate = _delegate;
- }
-
- private final RepositoryId delegate;
-
- public String toString() {
- if (delegate != null)
- return delegate.toString();
- else
- return this.getClass().getName();
- }
-
- public boolean equals(Object obj) {
- if (delegate != null)
- return delegate.equals(obj);
- else
- return super.equals(obj);
- }
-
- public int hashCode() {
- if (delegate != null) {
- return delegate.hashCode();
- } else {
- return super.hashCode();
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java 2018-01-30 20:19:16.000000000 -0500
+++ /dev/null 2018-01-30 20:19:16.000000000 -0500
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import com.sun.corba.se.spi.orb.ORBVersion;
-import com.sun.corba.se.spi.orb.ORB;
-
-public abstract class RepositoryIdFactory
-{
- private static final RepIdDelegator currentDelegator
- = new RepIdDelegator();
-
- /**
- * Returns the latest version RepositoryIdStrings instance
- */
- public static RepositoryIdStrings getRepIdStringsFactory()
- {
- return currentDelegator;
- }
-
- /**
- * Returns the latest version RepositoryIdUtility instance
- */
- public static RepositoryIdUtility getRepIdUtility()
- {
- return currentDelegator;
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java 2018-01-30 20:19:17.000000000 -0500
+++ /dev/null 2018-01-30 20:19:17.000000000 -0500
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import org.omg.CORBA.ORB;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-
-/**
- * Methods on specific instances of RepositoryId. Hides
- * versioning of our RepositoryId class.
- */
-public interface RepositoryIdInterface
-{
- Class getClassFromType() throws ClassNotFoundException;
-
- Class getClassFromType(String codebaseURL)
- throws ClassNotFoundException, MalformedURLException;
-
- Class getClassFromType(Class expectedType,
- String codebaseURL)
- throws ClassNotFoundException, MalformedURLException;
-
- String getClassName();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java 2018-01-30 20:19:17.000000000 -0500
+++ /dev/null 2018-01-30 20:19:17.000000000 -0500
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import java.io.Serializable;
-import com.sun.corba.se.impl.io.TypeMismatchException;
-
-/**
- * Factory methods for creating various repository ID strings
- * and instances.
- */
-public interface RepositoryIdStrings
-{
- String createForAnyType(Class type);
-
- String createForJavaType(Serializable ser)
- throws TypeMismatchException;
-
- String createForJavaType(Class clz)
- throws TypeMismatchException;
-
- String createSequenceRepID(java.lang.Object ser);
-
- String createSequenceRepID(java.lang.Class clazz);
-
- RepositoryIdInterface getFromString(String repIdString);
-
- String getClassDescValueRepId();
- String getWStringValueRepId();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java 2018-01-30 20:19:18.000000000 -0500
+++ /dev/null 2018-01-30 20:19:18.000000000 -0500
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil;
-
-import org.omg.CORBA.ORB;
-import com.sun.corba.se.impl.util.RepositoryId;
-
-/**
- * Utility methods for working with repository IDs.
- */
-public interface RepositoryIdUtility
-{
- boolean isChunkedEncoding(int valueTag);
- boolean isCodeBasePresent(int valueTag);
-
- // These are currently the same in both RepositoryId and
- // RepositoryId_1_3, but provide the constants again here
- // to eliminate awkardness when using this interface.
- int NO_TYPE_INFO = RepositoryId.kNoTypeInfo;
- int SINGLE_REP_TYPE_INFO = RepositoryId.kSingleRepTypeInfo;
- int PARTIAL_LIST_TYPE_INFO = RepositoryId.kPartialListTypeInfo;
-
- // Determine how many (if any) repository IDs follow the value
- // tag.
- int getTypeInfo(int valueTag);
-
- // Accessors for precomputed value tags
- int getStandardRMIChunkedNoRepStrId();
- int getCodeBaseRMIChunkedNoRepStrId();
- int getStandardRMIChunkedId();
- int getCodeBaseRMIChunkedId();
- int getStandardRMIUnchunkedId();
- int getCodeBaseRMIUnchunkedId();
- int getStandardRMIUnchunkedNoRepStrId();
- int getCodeBaseRMIUnchunkedNoRepStrId();
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/StackImpl.java 2018-01-30 20:19:18.000000000 -0500
+++ /dev/null 2018-01-30 20:19:19.000000000 -0500
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil ;
-
-import java.util.EmptyStackException ;
-
-// We implement a Stack here instead of using java.util.Stack because
-// java.util.Stack is thread-safe, negatively impacting performance.
-// We use an ArrayList instead since it is not thread-safe.
-// RequestInfoStack is used quite frequently.
-public class StackImpl {
- // The stack for RequestInfo objects.
- private Object[] data = new Object[3] ;
- private int top = -1 ;
-
- // Tests if this stack is empty.
- public final boolean empty() {
- return top == -1;
- }
-
- // Looks at the object at the top of this stack without removing it
- // from the stack.
- public final Object peek() {
- if (empty())
- throw new EmptyStackException();
-
- return data[ top ];
- }
-
- // Removes the object at the top of this stack and returns that
- // object as the value of this function.
- public final Object pop() {
- Object obj = peek() ;
- data[top] = null ;
- top-- ;
- return obj;
- }
-
- private void ensure()
- {
- if (top == (data.length-1)) {
- int newSize = 2*data.length ;
- Object[] newData = new Object[ newSize ] ;
- System.arraycopy( data, 0, newData, 0, data.length ) ;
- data = newData ;
- }
- }
-
- // Pushes an item onto the top of the stack
- public final Object push( Object item ) {
- ensure() ;
- top++ ;
- data[top] = item;
- return item;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Constant.java 2018-01-30 20:19:19.000000000 -0500
+++ /dev/null 2018-01-30 20:19:19.000000000 -0500
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.closure ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-
-public class Constant implements Closure {
- private Object value ;
-
- public Constant( Object value )
- {
- this.value = value ;
- }
-
- public Object evaluate()
- {
- return value ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Future.java 2018-01-30 20:19:20.000000000 -0500
+++ /dev/null 2018-01-30 20:19:20.000000000 -0500
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.closure ;
-
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-
-public class Future implements Closure {
- private boolean evaluated ;
- private Closure closure ;
- private Object value ;
-
- public Future( Closure value )
- {
- this.evaluated = false ;
- this.closure = (Closure)value ;
- this.value = null ;
- }
-
- public synchronized Object evaluate()
- {
- if (!evaluated) {
- evaluated = true ;
- value = closure.evaluate() ;
- }
-
- return value ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/CondVar.java 2018-01-30 20:19:21.000000000 -0500
+++ /dev/null 2018-01-30 20:19:21.000000000 -0500
@@ -1,340 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- File: ConditionVariable.java
-
- Originally written by Doug Lea and released into the public domain.
- This may be used for any purposes whatsoever without acknowledgment.
- Thanks for the assistance and support of Sun Microsystems Labs,
- and everyone contributing, testing, and using this code.
-
- History:
- Date Who What
- 11Jun1998 dl Create public version
- 08dec2001 kmc Added support for Reentrant Mutexes
-*/
-
-package com.sun.corba.se.impl.orbutil.concurrent;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-/**
- * This class is designed for fans of POSIX pthreads programming.
- * If you restrict yourself to Mutexes and CondVars, you can
- * use most of your favorite constructions. Don't randomly mix them
- * with synchronized methods or blocks though.
- *
- * Method names and behavior are as close as is reasonable to
- * those in POSIX.
- *
- * Sample Usage. Here is a full version of a bounded buffer
- * that implements the BoundedChannel interface, written in
- * a style reminscent of that in POSIX programming books.
- *
- * class CVBuffer implements BoundedChannel {
- * private final Mutex mutex;
- * private final CondVar notFull;
- * private final CondVar notEmpty;
- * private int count = 0;
- * private int takePtr = 0;
- * private int putPtr = 0;
- * private final Object[] array;
- *
- * public CVBuffer(int capacity) {
- * array = new Object[capacity];
- * mutex = new Mutex();
- * notFull = new CondVar(mutex);
- * notEmpty = new CondVar(mutex);
- * }
- *
- * public int capacity() { return array.length; }
- *
- * public void put(Object x) throws InterruptedException {
- * mutex.acquire();
- * try {
- * while (count == array.length) {
- * notFull.await();
- * }
- * array[putPtr] = x;
- * putPtr = (putPtr + 1) % array.length;
- * ++count;
- * notEmpty.signal();
- * }
- * finally {
- * mutex.release();
- * }
- * }
- *
- * public Object take() throws InterruptedException {
- * Object x = null;
- * mutex.acquire();
- * try {
- * while (count == 0) {
- * notEmpty.await();
- * }
- * x = array[takePtr];
- * array[takePtr] = null;
- * takePtr = (takePtr + 1) % array.length;
- * --count;
- * notFull.signal();
- * }
- * finally {
- * mutex.release();
- * }
- * return x;
- * }
- *
- * public boolean offer(Object x, long msecs) throws InterruptedException {
- * mutex.acquire();
- * try {
- * if (count == array.length) {
- * notFull.timedwait(msecs);
- * if (count == array.length)
- * return false;
- * }
- * array[putPtr] = x;
- * putPtr = (putPtr + 1) % array.length;
- * ++count;
- * notEmpty.signal();
- * return true;
- * }
- * finally {
- * mutex.release();
- * }
- * }
- *
- * public Object poll(long msecs) throws InterruptedException {
- * Object x = null;
- * mutex.acquire();
- * try {
- * if (count == 0) {
- * notEmpty.timedwait(msecs);
- * if (count == 0)
- * return null;
- * }
- * x = array[takePtr];
- * array[takePtr] = null;
- * takePtr = (takePtr + 1) % array.length;
- * --count;
- * notFull.signal();
- * }
- * finally {
- * mutex.release();
- * }
- * return x;
- * }
- * }
- *
- *
- * @see Mutex
- * [ Introduction to this package. ]
- **/
-
-public class CondVar {
-
- protected boolean debug_ ;
-
- /** The mutex **/
- protected final Sync mutex_;
- protected final ReentrantMutex remutex_;
-
- private int releaseMutex()
- {
- int count = 1 ;
-
- if (remutex_!=null)
- count = remutex_.releaseAll() ;
- else
- mutex_.release() ;
-
- return count ;
- }
-
- private void acquireMutex( int count ) throws InterruptedException
- {
- if (remutex_!=null)
- remutex_.acquireAll( count ) ;
- else
- mutex_.acquire() ;
- }
-
- /**
- * Create a new CondVar that relies on the given mutual
- * exclusion lock.
- * @param mutex A mutual exclusion lock which must either be non-reentrant,
- * or else be ReentrantMutex.
- * Standard usage is to supply an instance of Mutex
,
- * but, for example, a Semaphore initialized to 1 also works.
- * On the other hand, many other Sync implementations would not
- * work here, so some care is required to supply a sensible
- * synchronization object.
- * In normal use, the mutex should be one that is used for all
- * synchronization of the object using the CondVar. Generally,
- * to prevent nested monitor lockouts, this
- * object should not use any native Java synchronized blocks.
- **/
-
- public CondVar(Sync mutex, boolean debug) {
- debug_ = debug ;
- mutex_ = mutex;
- if (mutex instanceof ReentrantMutex)
- remutex_ = (ReentrantMutex)mutex;
- else
- remutex_ = null;
- }
-
- public CondVar( Sync mutex ) {
- this( mutex, false ) ;
- }
-
- /**
- * Wait for notification. This operation at least momentarily
- * releases the mutex. The mutex is always held upon return,
- * even if interrupted.
- * @exception InterruptedException if the thread was interrupted
- * before or during the wait. However, if the thread is interrupted
- * after the wait but during mutex re-acquisition, the interruption
- * is ignored, while still ensuring
- * that the currentThread's interruption state stays true, so can
- * be probed by callers.
- **/
- public void await() throws InterruptedException {
- int count = 0 ;
- if (Thread.interrupted())
- throw new InterruptedException();
-
- try {
- if (debug_)
- ORBUtility.dprintTrace( this, "await enter" ) ;
-
- synchronized(this) {
- count = releaseMutex() ;
- try {
- wait();
- } catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- } finally {
- // Must ignore interrupt on re-acquire
- boolean interrupted = false;
- for (;;) {
- try {
- acquireMutex( count );
- break;
- } catch (InterruptedException ex) {
- interrupted = true;
- }
- }
-
- if (interrupted) {
- Thread.currentThread().interrupt();
- }
-
- if (debug_)
- ORBUtility.dprintTrace( this, "await exit" ) ;
- }
- }
-
- /**
- * Wait for at most msecs for notification.
- * This operation at least momentarily
- * releases the mutex. The mutex is always held upon return,
- * even if interrupted.
- * @param msecs The time to wait. A value less than or equal to zero
- * causes a momentarily release
- * and re-acquire of the mutex, and always returns false.
- * @return false if at least msecs have elapsed
- * upon resumption; else true. A
- * false return does NOT necessarily imply that the thread was
- * not notified. For example, it might have been notified
- * after the time elapsed but just before resuming.
- * @exception InterruptedException if the thread was interrupted
- * before or during the wait.
- **/
-
- public boolean timedwait(long msecs) throws InterruptedException {
-
- if (Thread.interrupted())
- throw new InterruptedException();
-
- boolean success = false;
- int count = 0;
-
- try {
- if (debug_)
- ORBUtility.dprintTrace( this, "timedwait enter" ) ;
-
- synchronized(this) {
- count = releaseMutex() ;
- try {
- if (msecs > 0) {
- long start = System.currentTimeMillis();
- wait(msecs);
- success = System.currentTimeMillis() - start <= msecs;
- }
- } catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- } finally {
- // Must ignore interrupt on re-acquire
- boolean interrupted = false;
- for (;;) {
- try {
- acquireMutex( count ) ;
- break;
- } catch (InterruptedException ex) {
- interrupted = true;
- }
- }
-
- if (interrupted) {
- Thread.currentThread().interrupt();
- }
-
- if (debug_)
- ORBUtility.dprintTrace( this, "timedwait exit" ) ;
- }
- return success;
- }
-
- /**
- * Notify a waiting thread.
- * If one exists, a non-interrupted thread will return
- * normally (i.e., not via InterruptedException) from await or timedwait.
- **/
- public synchronized void signal() {
- notify();
- }
-
- /** Notify all waiting threads **/
- public synchronized void broadcast() {
- notifyAll();
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java 2018-01-30 20:19:21.000000000 -0500
+++ /dev/null 2018-01-30 20:19:21.000000000 -0500
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- File: Mutex.java
-
- Originally written by Doug Lea and released into the public domain.
- This may be used for any purposes whatsoever without acknowledgment.
- Thanks for the assistance and support of Sun Microsystems Labs,
- and everyone contributing, testing, and using this code.
-
- History:
- Date Who What
- 11Jun1998 dl Create public version
-*/
-
-package com.sun.corba.se.impl.orbutil.concurrent;
-
-/**
- * A simple non-reentrant mutual exclusion lock.
- * The lock is free upon construction. Each acquire gets the
- * lock, and each release frees it. Releasing a lock that
- * is already free has no effect.
- *
- * This implementation makes no attempt to provide any fairness
- * or ordering guarantees. If you need them, consider using one of
- * the Semaphore implementations as a locking mechanism.
- *
- * Sample usage
- *
- * Mutex can be useful in constructions that cannot be
- * expressed using java synchronized blocks because the
- * acquire/release pairs do not occur in the same method or
- * code block. For example, you can use them for hand-over-hand
- * locking across the nodes of a linked list. This allows
- * extremely fine-grained locking, and so increases
- * potential concurrency, at the cost of additional complexity and
- * overhead that would normally make this worthwhile only in cases of
- * extreme contention.
- *
- * class Node {
- * Object item;
- * Node next;
- * Mutex lock = new Mutex(); // each node keeps its own lock
- *
- * Node(Object x, Node n) { item = x; next = n; }
- * }
- *
- * class List {
- * protected Node head; // pointer to first node of list
- *
- * // Use plain java synchronization to protect head field.
- * // (We could instead use a Mutex here too but there is no
- * // reason to do so.)
- * protected synchronized Node getHead() { return head; }
- *
- * boolean search(Object x) throws InterruptedException {
- * Node p = getHead();
- * if (p == null) return false;
- *
- * // (This could be made more compact, but for clarity of illustration,
- * // all of the cases that can arise are handled separately.)
- *
- * p.lock.acquire(); // Prime loop by acquiring first lock.
- * // (If the acquire fails due to
- * // interrupt, the method will throw
- * // InterruptedException now,
- * // so there is no need for any
- * // further cleanup.)
- * for (;;) {
- * if (x.equals(p.item)) {
- * p.lock.release(); // release current before return
- * return true;
- * }
- * else {
- * Node nextp = p.next;
- * if (nextp == null) {
- * p.lock.release(); // release final lock that was held
- * return false;
- * }
- * else {
- * try {
- * nextp.lock.acquire(); // get next lock before releasing current
- * }
- * catch (InterruptedException ex) {
- * p.lock.release(); // also release current if acquire fails
- * throw ex;
- * }
- * p.lock.release(); // release old lock now that new one held
- * p = nextp;
- * }
- * }
- * }
- * }
- *
- * synchronized void add(Object x) { // simple prepend
- * // The use of `synchronized' here protects only head field.
- * // The method does not need to wait out other traversers
- * // who have already made it past head.
- *
- * head = new Node(x, head);
- * }
- *
- * // ... other similar traversal and update methods ...
- * }
- *
- *
- *
This version adds some debugging capability: it will detect an attempt by a thread
- * that holds the lock to acquire it for a second time, and also an attempt by a thread that
- * does not hold the mutex to release it.
- * @see Semaphore
- *
[ Introduction to this package. ]
-**/
-
-import org.omg.CORBA.INTERNAL ;
-
-public class DebugMutex implements Sync {
-
- /** The lock status **/
- protected boolean inuse_ = false;
- protected Thread holder_ = null;
-
- public void acquire() throws InterruptedException {
- if (Thread.interrupted()) throw new InterruptedException();
- synchronized(this) {
- Thread thr = Thread.currentThread();
- if (holder_ == thr)
- throw new INTERNAL(
- "Attempt to acquire Mutex by thread holding the Mutex" ) ;
-
- try {
- while (inuse_) wait();
- inuse_ = true;
- holder_ = Thread.currentThread();
- }
- catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- }
-
- public synchronized void release() {
- Thread thr = Thread.currentThread();
- if (thr != holder_)
- throw new INTERNAL(
- "Attempt to release Mutex by thread not holding the Mutex" ) ;
- holder_ = null;
- inuse_ = false;
- notify();
- }
-
-
- public boolean attempt(long msecs) throws InterruptedException {
- if (Thread.interrupted()) throw new InterruptedException();
- synchronized(this) {
- Thread thr = Thread.currentThread() ;
-
- if (!inuse_) {
- inuse_ = true;
- holder_ = thr;
- return true;
- } else if (msecs <= 0)
- return false;
- else {
- long waitTime = msecs;
- long start = System.currentTimeMillis();
- try {
- for (;;) {
- wait(waitTime);
- if (!inuse_) {
- inuse_ = true;
- holder_ = thr;
- return true;
- }
- else {
- waitTime = msecs - (System.currentTimeMillis() - start);
- if (waitTime <= 0)
- return false;
- }
- }
- }
- catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Mutex.java 2018-01-30 20:19:22.000000000 -0500
+++ /dev/null 2018-01-30 20:19:22.000000000 -0500
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- File: Mutex.java
-
- Originally written by Doug Lea and released into the public domain.
- This may be used for any purposes whatsoever without acknowledgment.
- Thanks for the assistance and support of Sun Microsystems Labs,
- and everyone contributing, testing, and using this code.
-
- History:
- Date Who What
- 11Jun1998 dl Create public version
-*/
-
-package com.sun.corba.se.impl.orbutil.concurrent;
-
-/**
- * A simple non-reentrant mutual exclusion lock.
- * The lock is free upon construction. Each acquire gets the
- * lock, and each release frees it. Releasing a lock that
- * is already free has no effect.
- *
- * This implementation makes no attempt to provide any fairness
- * or ordering guarantees. If you need them, consider using one of
- * the Semaphore implementations as a locking mechanism.
- *
- * Sample usage
- *
- * Mutex can be useful in constructions that cannot be
- * expressed using java synchronized blocks because the
- * acquire/release pairs do not occur in the same method or
- * code block. For example, you can use them for hand-over-hand
- * locking across the nodes of a linked list. This allows
- * extremely fine-grained locking, and so increases
- * potential concurrency, at the cost of additional complexity and
- * overhead that would normally make this worthwhile only in cases of
- * extreme contention.
- *
- * class Node {
- * Object item;
- * Node next;
- * Mutex lock = new Mutex(); // each node keeps its own lock
- *
- * Node(Object x, Node n) { item = x; next = n; }
- * }
- *
- * class List {
- * protected Node head; // pointer to first node of list
- *
- * // Use plain java synchronization to protect head field.
- * // (We could instead use a Mutex here too but there is no
- * // reason to do so.)
- * protected synchronized Node getHead() { return head; }
- *
- * boolean search(Object x) throws InterruptedException {
- * Node p = getHead();
- * if (p == null) return false;
- *
- * // (This could be made more compact, but for clarity of illustration,
- * // all of the cases that can arise are handled separately.)
- *
- * p.lock.acquire(); // Prime loop by acquiring first lock.
- * // (If the acquire fails due to
- * // interrupt, the method will throw
- * // InterruptedException now,
- * // so there is no need for any
- * // further cleanup.)
- * for (;;) {
- * if (x.equals(p.item)) {
- * p.lock.release(); // release current before return
- * return true;
- * }
- * else {
- * Node nextp = p.next;
- * if (nextp == null) {
- * p.lock.release(); // release final lock that was held
- * return false;
- * }
- * else {
- * try {
- * nextp.lock.acquire(); // get next lock before releasing current
- * }
- * catch (InterruptedException ex) {
- * p.lock.release(); // also release current if acquire fails
- * throw ex;
- * }
- * p.lock.release(); // release old lock now that new one held
- * p = nextp;
- * }
- * }
- * }
- * }
- *
- * synchronized void add(Object x) { // simple prepend
- * // The use of `synchronized' here protects only head field.
- * // The method does not need to wait out other traversers
- * // who have already made it past head.
- *
- * head = new Node(x, head);
- * }
- *
- * // ... other similar traversal and update methods ...
- * }
- *
- * @see Semaphore
- * [ Introduction to this package. ]
-**/
-
-public class Mutex implements Sync {
-
- /** The lock status **/
- protected boolean inuse_ = false;
-
- public void acquire() throws InterruptedException {
- if (Thread.interrupted()) throw new InterruptedException();
- synchronized(this) {
- try {
- while (inuse_) wait();
- inuse_ = true;
- }
- catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- }
-
- public synchronized void release() {
- inuse_ = false;
- notify();
- }
-
-
- public boolean attempt(long msecs) throws InterruptedException {
- if (Thread.interrupted()) throw new InterruptedException();
- synchronized(this) {
- if (!inuse_) {
- inuse_ = true;
- return true;
- }
- else if (msecs <= 0)
- return false;
- else {
- long waitTime = msecs;
- long start = System.currentTimeMillis();
- try {
- for (;;) {
- wait(waitTime);
- if (!inuse_) {
- inuse_ = true;
- return true;
- }
- else {
- waitTime = msecs - (System.currentTimeMillis() - start);
- if (waitTime <= 0)
- return false;
- }
- }
- }
- catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- }
- }
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java 2018-01-30 20:19:23.000000000 -0500
+++ /dev/null 2018-01-30 20:19:23.000000000 -0500
@@ -1,350 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- File: Mutex.java
-
- Originally written by Doug Lea and released into the public domain.
- This may be used for any purposes whatsoever without acknowledgment.
- Thanks for the assistance and support of Sun Microsystems Labs,
- and everyone contributing, testing, and using this code.
-
- History:
- Date Who What
- 11Jun1998 dl Create public version
-*/
-
-package com.sun.corba.se.impl.orbutil.concurrent;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-/**
- * A simple reentrant mutual exclusion lock.
- * The lock is free upon construction. Each acquire gets the
- * lock, and each release frees it. Releasing a lock that
- * is already free has no effect.
- *
- * This implementation makes no attempt to provide any fairness
- * or ordering guarantees. If you need them, consider using one of
- * the Semaphore implementations as a locking mechanism.
- *
- * Sample usage
- *
- * Mutex can be useful in constructions that cannot be
- * expressed using java synchronized blocks because the
- * acquire/release pairs do not occur in the same method or
- * code block. For example, you can use them for hand-over-hand
- * locking across the nodes of a linked list. This allows
- * extremely fine-grained locking, and so increases
- * potential concurrency, at the cost of additional complexity and
- * overhead that would normally make this worthwhile only in cases of
- * extreme contention.
- *
- * class Node {
- * Object item;
- * Node next;
- * Mutex lock = new Mutex(); // each node keeps its own lock
- *
- * Node(Object x, Node n) { item = x; next = n; }
- * }
- *
- * class List {
- * protected Node head; // pointer to first node of list
- *
- * // Use plain java synchronization to protect head field.
- * // (We could instead use a Mutex here too but there is no
- * // reason to do so.)
- * protected synchronized Node getHead() { return head; }
- *
- * boolean search(Object x) throws InterruptedException {
- * Node p = getHead();
- * if (p == null) return false;
- *
- * // (This could be made more compact, but for clarity of illustration,
- * // all of the cases that can arise are handled separately.)
- *
- * p.lock.acquire(); // Prime loop by acquiring first lock.
- * // (If the acquire fails due to
- * // interrupt, the method will throw
- * // InterruptedException now,
- * // so there is no need for any
- * // further cleanup.)
- * for (;;) {
- * if (x.equals(p.item)) {
- * p.lock.release(); // release current before return
- * return true;
- * }
- * else {
- * Node nextp = p.next;
- * if (nextp == null) {
- * p.lock.release(); // release final lock that was held
- * return false;
- * }
- * else {
- * try {
- * nextp.lock.acquire(); // get next lock before releasing current
- * }
- * catch (InterruptedException ex) {
- * p.lock.release(); // also release current if acquire fails
- * throw ex;
- * }
- * p.lock.release(); // release old lock now that new one held
- * p = nextp;
- * }
- * }
- * }
- * }
- *
- * synchronized void add(Object x) { // simple prepend
- * // The use of `synchronized' here protects only head field.
- * // The method does not need to wait out other traversers
- * // who have already made it past head.
- *
- * head = new Node(x, head);
- * }
- *
- * // ... other similar traversal and update methods ...
- * }
- *
- *
- *
This version adds some debugging capability: it will detect
- * an attempt by a thread that does not hold the mutex to release it.
- * This version is reentrant: the same thread may acquire a mutex multiple
- * times, in which case it must release the mutex the same number of times
- * as it was acquired before another thread can acquire the mutex.
- * @see Semaphore
- *
[ Introduction to this package. ]
-**/
-
-import org.omg.CORBA.INTERNAL ;
-
-public class ReentrantMutex implements Sync {
-
- /** The thread holding the lock **/
- protected Thread holder_ = null;
-
- /** number of times thread has acquired the lock **/
- protected int counter_ = 0 ;
-
- protected boolean debug = false ;
-
- public ReentrantMutex()
- {
- this( false ) ;
- }
-
- public ReentrantMutex( boolean debug )
- {
- this.debug = debug ;
- }
-
- public void acquire() throws InterruptedException {
- if (Thread.interrupted())
- throw new InterruptedException();
-
- synchronized(this) {
- try {
- if (debug)
- ORBUtility.dprintTrace( this,
- "acquire enter: holder_=" +
- ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
-
- Thread thr = Thread.currentThread();
- if (holder_ != thr) {
- try {
- while (counter_ > 0)
- wait();
-
- // This can't happen, but make sure anyway
- if (counter_ != 0)
- throw new INTERNAL(
- "counter not 0 when first acquiring mutex" ) ;
-
- holder_ = thr;
- } catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
-
- counter_ ++ ;
- } finally {
- if (debug)
- ORBUtility.dprintTrace( this, "acquire exit: holder_=" +
- ORBUtility.getThreadName(holder_) + " counter_=" +
- counter_ ) ;
- }
- }
- }
-
- void acquireAll( int count ) throws InterruptedException
- {
- if (Thread.interrupted())
- throw new InterruptedException();
-
- synchronized(this) {
- try {
- if (debug)
- ORBUtility.dprintTrace( this,
- "acquireAll enter: count=" + count + " holder_=" +
- ORBUtility.getThreadName(holder_) + " counter_=" +
- counter_ ) ;
- Thread thr = Thread.currentThread();
- if (holder_ == thr) {
- throw new INTERNAL(
- "Cannot acquireAll while holding the mutex" ) ;
- } else {
- try {
- while (counter_ > 0)
- wait();
-
- // This can't happen, but make sure anyway
- if (counter_ != 0)
- throw new INTERNAL(
- "counter not 0 when first acquiring mutex" ) ;
-
- holder_ = thr;
- } catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
-
- counter_ = count ;
- } finally {
- if (debug)
- ORBUtility.dprintTrace( this, "acquireAll exit: count=" +
- count + " holder_=" + ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
- }
- }
- }
-
- public synchronized void release()
- {
- try {
- if (debug)
- ORBUtility.dprintTrace( this, "release enter: " +
- " holder_=" + ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
-
- Thread thr = Thread.currentThread();
- if (thr != holder_)
- throw new INTERNAL(
- "Attempt to release Mutex by thread not holding the Mutex" ) ;
- else
- counter_ -- ;
-
- if (counter_ == 0) {
- holder_ = null;
- notify();
- }
- } finally {
- if (debug)
- ORBUtility.dprintTrace( this, "release exit: " +
- " holder_=" + ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
- }
- }
-
- synchronized int releaseAll()
- {
- try {
- if (debug)
- ORBUtility.dprintTrace( this, "releaseAll enter: " +
- " holder_=" + ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
-
- Thread thr = Thread.currentThread();
- if (thr != holder_)
- throw new INTERNAL(
- "Attempt to releaseAll Mutex by thread not holding the Mutex" ) ;
-
- int result = counter_ ;
- counter_ = 0 ;
- holder_ = null ;
- notify() ;
- return result ;
- } finally {
- if (debug)
- ORBUtility.dprintTrace( this, "releaseAll exit: " +
- " holder_=" + ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
- }
- }
-
- public boolean attempt(long msecs) throws InterruptedException {
- if (Thread.interrupted())
- throw new InterruptedException();
-
- synchronized(this) {
- try {
- if (debug)
- ORBUtility.dprintTrace( this, "attempt enter: msecs=" +
- msecs + " holder_=" +
- ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
-
- Thread thr = Thread.currentThread() ;
-
- if (counter_==0) {
- holder_ = thr;
- counter_ = 1 ;
- return true;
- } else if (msecs <= 0) {
- return false;
- } else {
- long waitTime = msecs;
- long start = System.currentTimeMillis();
- try {
- for (;;) {
- wait(waitTime);
- if (counter_==0) {
- holder_ = thr;
- counter_ = 1 ;
- return true;
- } else {
- waitTime = msecs -
- (System.currentTimeMillis() - start);
-
- if (waitTime <= 0)
- return false;
- }
- }
- } catch (InterruptedException ex) {
- notify();
- throw ex;
- }
- }
- } finally {
- if (debug)
- ORBUtility.dprintTrace( this, "attempt exit: " +
- " holder_=" + ORBUtility.getThreadName(holder_) +
- " counter_=" + counter_ ) ;
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Sync.java 2018-01-30 20:19:23.000000000 -0500
+++ /dev/null 2018-01-30 20:19:23.000000000 -0500
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- File: Sync.java
-
- Originally written by Doug Lea and released into the public domain.
- This may be used for any purposes whatsoever without acknowledgment.
- Thanks for the assistance and support of Sun Microsystems Labs,
- and everyone contributing, testing, and using this code.
-
- History:
- Date Who What
- 11Jun1998 dl Create public version
- 5Aug1998 dl Added some convenient time constants
-*/
-
-package com.sun.corba.se.impl.orbutil.concurrent;
-
-/**
- * Main interface for locks, gates, and conditions.
- *
- * Sync objects isolate waiting and notification for particular
- * logical states, resource availability, events, and the like that are
- * shared across multiple threads. Use of Syncs sometimes
- * (but by no means always) adds flexibility and efficiency
- * compared to the use of plain java monitor methods
- * and locking, and are sometimes (but by no means always)
- * simpler to program with.
- *
- *
- * Most Syncs are intended to be used primarily (although
- * not exclusively) in before/after constructions such as:
- *
- * class X {
- * Sync gate;
- * // ...
- *
- * public void m() {
- * try {
- * gate.acquire(); // block until condition holds
- * try {
- * // ... method body
- * }
- * finally {
- * gate.release()
- * }
- * }
- * catch (InterruptedException ex) {
- * // ... evasive action
- * }
- * }
- *
- * public void m2(Sync cond) { // use supplied condition
- * try {
- * if (cond.attempt(10)) { // try the condition for 10 ms
- * try {
- * // ... method body
- * }
- * finally {
- * cond.release()
- * }
- * }
- * }
- * catch (InterruptedException ex) {
- * // ... evasive action
- * }
- * }
- * }
- *
- * Syncs may be used in somewhat tedious but more flexible replacements
- * for built-in Java synchronized blocks. For example:
- *
- * class HandSynched {
- * private double state_ = 0.0;
- * private final Sync lock; // use lock type supplied in constructor
- * public HandSynched(Sync l) { lock = l; }
- *
- * public void changeState(double d) {
- * try {
- * lock.acquire();
- * try { state_ = updateFunction(d); }
- * finally { lock.release(); }
- * }
- * catch(InterruptedException ex) { }
- * }
- *
- * public double getState() {
- * double d = 0.0;
- * try {
- * lock.acquire();
- * try { d = accessFunction(state_); }
- * finally { lock.release(); }
- * }
- * catch(InterruptedException ex){}
- * return d;
- * }
- * private double updateFunction(double d) { ... }
- * private double accessFunction(double d) { ... }
- * }
- *
- * If you have a lot of such methods, and they take a common
- * form, you can standardize this using wrappers. Some of these
- * wrappers are standardized in LockedExecutor, but you can make others.
- * For example:
- *
- * class HandSynchedV2 {
- * private double state_ = 0.0;
- * private final Sync lock; // use lock type supplied in constructor
- * public HandSynchedV2(Sync l) { lock = l; }
- *
- * protected void runSafely(Runnable r) {
- * try {
- * lock.acquire();
- * try { r.run(); }
- * finally { lock.release(); }
- * }
- * catch (InterruptedException ex) { // propagate without throwing
- * Thread.currentThread().interrupt();
- * }
- * }
- *
- * public void changeState(double d) {
- * runSafely(new Runnable() {
- * public void run() { state_ = updateFunction(d); }
- * });
- * }
- * // ...
- * }
- *
- *
- * One reason to bother with such constructions is to use deadlock-
- * avoiding back-offs when dealing with locks involving multiple objects.
- * For example, here is a Cell class that uses attempt to back-off
- * and retry if two Cells are trying to swap values with each other
- * at the same time.
- *
- * class Cell {
- * long value;
- * Sync lock = ... // some sync implementation class
- * void swapValue(Cell other) {
- * for (;;) {
- * try {
- * lock.acquire();
- * try {
- * if (other.lock.attempt(100)) {
- * try {
- * long t = value;
- * value = other.value;
- * other.value = t;
- * return;
- * }
- * finally { other.lock.release(); }
- * }
- * }
- * finally { lock.release(); }
- * }
- * catch (InterruptedException ex) { return; }
- * }
- * }
- * }
- *
- *
- * Here is an even fancier version, that uses lock re-ordering
- * upon conflict:
- *
{@code
- * class Cell {
- * long value;
- * Sync lock = ...;
- * private static boolean trySwap(Cell a, Cell b) {
- * a.lock.acquire();
- * try {
- * if (!b.lock.attempt(0))
- * return false;
- * try {
- * long t = a.value;
- * a.value = b.value;
- * b.value = t;
- * return true;
- * }
- * finally { other.lock.release(); }
- * }
- * finally { lock.release(); }
- * return false;
- * }
- *
- * void swapValue(Cell other) {
- * try {
- * while (!trySwap(this, other) &&
- * !tryswap(other, this))
- * Thread.sleep(1);
- * }
- * catch (InterruptedException ex) { return; }
- * }
- * }
- * }
- *
- * Interruptions are in general handled as early as possible.
- * Normally, InterruptionExceptions are thrown
- * in acquire and attempt(msec) if interruption
- * is detected upon entry to the method, as well as in any
- * later context surrounding waits.
- * However, interruption status is ignored in release();
- *
- * Timed versions of attempt report failure via return value.
- * If so desired, you can transform such constructions to use exception
- * throws via
- *
- * if (!c.attempt(timeval)) throw new TimeoutException(timeval);
- *
- *
- * The TimoutSync wrapper class can be used to automate such usages.
- *
- * All time values are expressed in milliseconds as longs, which have a maximum
- * value of Long.MAX_VALUE, or almost 300,000 centuries. It is not
- * known whether JVMs actually deal correctly with such extreme values.
- * For convenience, some useful time values are defined as static constants.
- *
- * All implementations of the three Sync methods guarantee to
- * somehow employ Java synchronized
methods or blocks,
- * and so entail the memory operations described in JLS
- * chapter 17 which ensure that variables are loaded and flushed
- * within before/after constructions.
- *
- * Syncs may also be used in spinlock constructions. Although
- * it is normally best to just use acquire(), various forms
- * of busy waits can be implemented. For a simple example
- * (but one that would probably never be preferable to using acquire()):
- *
{@code
- * class X {
- * Sync lock = ...
- * void spinUntilAcquired() throws InterruptedException {
- * // Two phase.
- * // First spin without pausing.
- * int purespins = 10;
- * for (int i = 0; i < purespins; ++i) {
- * if (lock.attempt(0))
- * return true;
- * }
- * // Second phase - use timed waits
- * long waitTime = 1; // 1 millisecond
- * for (;;) {
- * if (lock.attempt(waitTime))
- * return true;
- * else
- * waitTime = waitTime * 3 / 2 + 1; // increase 50%
- * }
- * }
- * }
- * }
- *
- * In addition pure synchronization control, Syncs
- * may be useful in any context requiring before/after methods.
- * For example, you can use an ObservableSync
- * (perhaps as part of a LayeredSync) in order to obtain callbacks
- * before and after each method invocation for a given class.
- *
- * [ Introduction to this package. ]
- **/
-
-
-public interface Sync {
-
- /**
- * Wait (possibly forever) until successful passage.
- * Fail only upon interuption. Interruptions always result in
- * `clean' failures. On failure, you can be sure that it has not
- * been acquired, and that no
- * corresponding release should be performed. Conversely,
- * a normal return guarantees that the acquire was successful.
- **/
-
- public void acquire() throws InterruptedException;
-
- /**
- * Wait at most msecs to pass; report whether passed.
- *
- * The method has best-effort semantics:
- * The msecs bound cannot
- * be guaranteed to be a precise upper bound on wait time in Java.
- * Implementations generally can only attempt to return as soon as possible
- * after the specified bound. Also, timers in Java do not stop during garbage
- * collection, so timeouts can occur just because a GC intervened.
- * So, msecs arguments should be used in
- * a coarse-grained manner. Further,
- * implementations cannot always guarantee that this method
- * will return at all without blocking indefinitely when used in
- * unintended ways. For example, deadlocks may be encountered
- * when called in an unintended context.
- *
- * @param msecs the number of milleseconds to wait.
- * An argument less than or equal to zero means not to wait at all.
- * However, this may still require
- * access to a synchronization lock, which can impose unbounded
- * delay if there is a lot of contention among threads.
- * @return true if acquired
- **/
-
- public boolean attempt(long msecs) throws InterruptedException;
-
- /**
- * Potentially enable others to pass.
- *
- * Because release does not raise exceptions,
- * it can be used in `finally' clauses without requiring extra
- * embedded try/catch blocks. But keep in mind that
- * as with any java method, implementations may
- * still throw unchecked exceptions such as Error or NullPointerException
- * when faced with uncontinuable errors. However, these should normally
- * only be caught by higher-level error handlers.
- **/
-
- public void release();
-
- /** One second, in milliseconds; convenient as a time-out value **/
- public static final long ONE_SECOND = 1000;
-
- /** One minute, in milliseconds; convenient as a time-out value **/
- public static final long ONE_MINUTE = 60 * ONE_SECOND;
-
- /** One hour, in milliseconds; convenient as a time-out value **/
- public static final long ONE_HOUR = 60 * ONE_MINUTE;
-
- /** One day, in milliseconds; convenient as a time-out value **/
- public static final long ONE_DAY = 24 * ONE_HOUR;
-
- /** One week, in milliseconds; convenient as a time-out value **/
- public static final long ONE_WEEK = 7 * ONE_DAY;
-
- /** One year in milliseconds; convenient as a time-out value **/
- // Not that it matters, but there is some variation across
- // standard sources about value at msec precision.
- // The value used is the same as in java.util.GregorianCalendar
- public static final long ONE_YEAR = (long)(365.2425 * ONE_DAY);
-
- /** One century in milliseconds; convenient as a time-out value **/
- public static final long ONE_CENTURY = 100 * ONE_YEAR;
-
-
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java 2018-01-30 20:19:24.000000000 -0500
+++ /dev/null 2018-01-30 20:19:24.000000000 -0500
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.concurrent;
-
-import com.sun.corba.se.impl.orbutil.concurrent.Sync ;
-
-public class SyncUtil {
- private SyncUtil() {}
-
- /** Method to acquire a Sync without ever throwing an
- * InterruptedException. Useful when a mutex is being
- * used in place of Java synchronization.
- */
- public static void acquire( Sync sync )
- {
- boolean held = false ;
- while (!held) {
- try {
- sync.acquire() ;
- held = true ;
- } catch (InterruptedException exc) {
- held = false ;
- }
- }
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java 2018-01-30 20:19:25.000000000 -0500
+++ /dev/null 2018-01-30 20:19:25.000000000 -0500
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.fsm ;
-
-import com.sun.corba.se.spi.orbutil.fsm.Guard ;
-import com.sun.corba.se.spi.orbutil.fsm.GuardBase ;
-import com.sun.corba.se.spi.orbutil.fsm.Input ;
-import com.sun.corba.se.spi.orbutil.fsm.Action ;
-import com.sun.corba.se.spi.orbutil.fsm.State ;
-import com.sun.corba.se.spi.orbutil.fsm.FSM ;
-
-public class GuardedAction {
- private static Guard trueGuard = new GuardBase( "true" ) {
- public Guard.Result evaluate( FSM fsm, Input in )
- {
- return Guard.Result.ENABLED ;
- }
- } ;
-
- private Guard guard ;
- private Action action ;
- private State nextState ;
-
- public GuardedAction( Action action, State nextState )
- {
- this.guard = trueGuard ;
- this.action = action ;
- this.nextState = nextState ;
- }
-
- public GuardedAction( Guard guard, Action action, State nextState )
- {
- this.guard = guard ;
- this.action = action ;
- this.nextState = nextState ;
- }
-
- public String toString()
- {
- return "GuardedAction[action=" + action + " guard=" + guard +
- " nextState=" + nextState + "]" ;
- }
-
- public Action getAction() { return action ; }
- public Guard getGuard() { return guard ; }
- public State getNextState() { return nextState ; }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/NameBase.java 2018-01-30 20:19:25.000000000 -0500
+++ /dev/null 2018-01-30 20:19:25.000000000 -0500
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.fsm ;
-
-import com.sun.corba.se.spi.orbutil.fsm.Action ;
-import com.sun.corba.se.spi.orbutil.fsm.State ;
-import com.sun.corba.se.spi.orbutil.fsm.Guard ;
-import com.sun.corba.se.spi.orbutil.fsm.Input ;
-
-import java.util.StringTokenizer ;
-
-public class NameBase {
- private String name ;
- private String toStringName ;
-
- // Return just the name of the class, not the full qualified name.
- private String getClassName()
- {
- String fqn = this.getClass().getName() ;
- StringTokenizer st = new StringTokenizer( fqn, "." ) ;
- String token = st.nextToken() ;
- while (st.hasMoreTokens())
- token = st.nextToken() ;
- return token ;
- }
-
- private String getPreferredClassName()
- {
- if (this instanceof Action)
- return "Action" ;
- if (this instanceof State)
- return "State" ;
- if (this instanceof Guard)
- return "Guard" ;
- if (this instanceof Input)
- return "Input" ;
- return getClassName() ;
- }
-
- public NameBase( String name )
- {
- this.name = name ;
- toStringName = getPreferredClassName() + "[" + name + "]" ;
- }
-
- public String getName()
- {
- return name ;
- }
-
- public String toString() {
- return toStringName ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java 2018-01-30 20:19:26.000000000 -0500
+++ /dev/null 2018-01-30 20:19:26.000000000 -0500
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.fsm ;
-
-import java.util.HashMap ;
-import java.util.HashSet ;
-import java.util.Set ;
-import java.util.Iterator ;
-
-import org.omg.CORBA.INTERNAL ;
-
-import com.sun.corba.se.impl.orbutil.ORBUtility ;
-
-import com.sun.corba.se.spi.orbutil.fsm.Input ;
-import com.sun.corba.se.spi.orbutil.fsm.Guard ;
-import com.sun.corba.se.spi.orbutil.fsm.Action ;
-import com.sun.corba.se.spi.orbutil.fsm.ActionBase ;
-import com.sun.corba.se.spi.orbutil.fsm.State ;
-import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
-import com.sun.corba.se.spi.orbutil.fsm.StateImpl ;
-import com.sun.corba.se.spi.orbutil.fsm.FSM ;
-import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ;
-
-import com.sun.corba.se.impl.orbutil.fsm.GuardedAction ;
-
-/**
- * Encodes the state transition function for a finite state machine.
- *
- * @author Ken Cavanaugh
- */
-public class StateEngineImpl implements StateEngine
-{
- // An action that does nothing at all.
- private static Action emptyAction = new ActionBase( "Empty" )
- {
- public void doIt( FSM fsm, Input in )
- {
- }
- } ;
-
- private boolean initializing ;
- private Action defaultAction ;
-
- public StateEngineImpl()
- {
- initializing = true ;
- defaultAction = new ActionBase("Invalid Transition")
- {
- public void doIt( FSM fsm, Input in )
- {
- throw new INTERNAL(
- "Invalid transition attempted from " +
- fsm.getState() + " under " + in ) ;
- }
- } ;
- }
-
- public StateEngine add( State oldState, Input input, Guard guard, Action action,
- State newState ) throws IllegalArgumentException,
- IllegalStateException
- {
- mustBeInitializing() ;
-
- StateImpl oldStateImpl = (StateImpl)oldState ;
- GuardedAction ga = new GuardedAction( guard, action, newState ) ;
- oldStateImpl.addGuardedAction( input, ga ) ;
-
- return this ;
- }
-
- public StateEngine add( State oldState, Input input, Action action,
- State newState ) throws IllegalArgumentException,
- IllegalStateException
- {
- mustBeInitializing() ;
-
- StateImpl oldStateImpl = (StateImpl)oldState ;
- GuardedAction ta = new GuardedAction( action, newState ) ;
- oldStateImpl.addGuardedAction( input, ta ) ;
-
- return this ;
- }
-
- public StateEngine setDefault( State oldState, Action action, State newState )
- throws IllegalArgumentException, IllegalStateException
- {
- mustBeInitializing() ;
-
- StateImpl oldStateImpl = (StateImpl)oldState ;
- oldStateImpl.setDefaultAction( action ) ;
- oldStateImpl.setDefaultNextState( newState ) ;
-
- return this ;
- }
-
- public StateEngine setDefault( State oldState, State newState )
- throws IllegalArgumentException, IllegalStateException
- {
- return setDefault( oldState, emptyAction, newState ) ;
- }
-
- public StateEngine setDefault( State oldState )
- throws IllegalArgumentException, IllegalStateException
- {
- return setDefault( oldState, oldState ) ;
- }
-
- public void done() throws IllegalStateException
- {
- mustBeInitializing() ;
-
- // optimize FSM here if desired. For example,
- // we could choose different strategies for implementing
- // the state transition function based on the distribution
- // of values for states and input labels.
-
- initializing = false ;
- }
-
- public void setDefaultAction( Action act ) throws IllegalStateException
- {
- mustBeInitializing() ;
- defaultAction = act ;
- }
-
- public void doIt( FSM fsm, Input in, boolean debug )
- {
- // This method is present only for debugging.
- // innerDoIt does the actual transition.
-
- if (debug)
- ORBUtility.dprint( this, "doIt enter: currentState = " +
- fsm.getState() + " in = " + in ) ;
-
- try {
- innerDoIt( fsm, in, debug ) ;
- } finally {
- if (debug)
- ORBUtility.dprint( this, "doIt exit" ) ;
- }
- }
-
- private StateImpl getDefaultNextState( StateImpl currentState )
- {
- // Use the currentState defaults if
- // set, otherwise use the state engine default.
- StateImpl nextState = (StateImpl)currentState.getDefaultNextState() ;
- if (nextState == null)
- // The state engine default never changes the state
- nextState = currentState ;
-
- return nextState ;
- }
-
- private Action getDefaultAction( StateImpl currentState )
- {
- Action action = currentState.getDefaultAction() ;
- if (action == null)
- action = defaultAction ;
-
- return action ;
- }
-
- private void innerDoIt( FSM fsm, Input in, boolean debug )
- {
- if (debug) {
- ORBUtility.dprint( this, "Calling innerDoIt with input " + in ) ;
- }
-
- // Locals needed for performing the state transition, once we determine
- // the required transition.
- StateImpl currentState = null ;
- StateImpl nextState = null ;
- Action action = null ;
-
- // Do until no guard has deferred.
- boolean deferral = false ;
- do {
- deferral = false ; // clear this after each deferral!
- currentState = (StateImpl)fsm.getState() ;
- nextState = getDefaultNextState( currentState ) ;
- action = getDefaultAction( currentState ) ;
-
- if (debug) {
- ORBUtility.dprint( this, "currentState = " + currentState ) ;
- ORBUtility.dprint( this, "in = " + in ) ;
- ORBUtility.dprint( this, "default nextState = " + nextState ) ;
- ORBUtility.dprint( this, "default action = " + action ) ;
- }
-
- Set gas = currentState.getGuardedActions(in) ;
- if (gas != null) {
- Iterator iter = gas.iterator() ;
-
- // Search for a guard that is not DISABLED.
- // All DISABLED means use defaults.
- while (iter.hasNext()) {
- GuardedAction ga = (GuardedAction)iter.next() ;
- Guard.Result gr = ga.getGuard().evaluate( fsm, in ) ;
- if (debug)
- ORBUtility.dprint( this,
- "doIt: evaluated " + ga + " with result " + gr ) ;
-
- if (gr == Guard.Result.ENABLED) {
- // ga has the next state and action.
- nextState = (StateImpl)ga.getNextState() ;
- action = ga.getAction() ;
- if (debug) {
- ORBUtility.dprint( this, "nextState = " + nextState ) ;
- ORBUtility.dprint( this, "action = " + action ) ;
- }
- break ;
- } else if (gr == Guard.Result.DEFERED) {
- deferral = true ;
- break ;
- }
- }
- }
- } while (deferral) ;
-
- performStateTransition( fsm, in, nextState, action, debug ) ;
- }
-
- private void performStateTransition( FSM fsm, Input in,
- StateImpl nextState, Action action, boolean debug )
- {
- StateImpl currentState = (StateImpl)fsm.getState() ;
-
- // Perform the state transition. Pre and post actions are only
- // performed if the state changes (see UML hidden transitions).
-
- boolean different = !currentState.equals( nextState ) ;
-
- if (different) {
- if (debug)
- ORBUtility.dprint( this,
- "doIt: executing postAction for state " + currentState ) ;
- try {
- currentState.postAction( fsm ) ;
- } catch (Throwable thr) {
- if (debug)
- ORBUtility.dprint( this,
- "doIt: postAction threw " + thr ) ;
-
- if (thr instanceof ThreadDeath)
- throw (ThreadDeath)thr ;
- }
- }
-
- try {
- // Note that action may be null in a transition, which simply
- // means that no action is needed. Note that action.doIt may
- // throw an exception, in which case the exception is
- // propagated after making sure that the transition is properly
- // completed.
- if (action != null)
- action.doIt( fsm, in ) ;
- } finally {
- if (different) {
- if (debug)
- ORBUtility.dprint( this,
- "doIt: executing preAction for state " + nextState ) ;
-
- try {
- nextState.preAction( fsm ) ;
- } catch (Throwable thr) {
- if (debug)
- ORBUtility.dprint( this,
- "doIt: preAction threw " + thr ) ;
-
- if (thr instanceof ThreadDeath)
- throw (ThreadDeath)thr ;
- }
-
- ((FSMImpl)fsm).internalSetState( nextState ) ;
- }
-
- if (debug)
- ORBUtility.dprint( this, "doIt: state is now " + nextState ) ;
- }
- }
-
- public FSM makeFSM( State startState ) throws IllegalStateException
- {
- mustNotBeInitializing() ;
-
- return new FSMImpl( this, startState ) ;
- }
-
- private void mustBeInitializing() throws IllegalStateException
- {
- if (!initializing)
- throw new IllegalStateException(
- "Invalid method call after initialization completed" ) ;
- }
-
- private void mustNotBeInitializing() throws IllegalStateException
- {
- if (initializing)
- throw new IllegalStateException(
- "Invalid method call before initialization completed" ) ;
- }
-}
-
-// end of StateEngineImpl.java
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Graph.java 2018-01-30 20:19:27.000000000 -0500
+++ /dev/null 2018-01-30 20:19:27.000000000 -0500
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.graph ;
-
-import java.util.Set ;
-
-public interface Graph extends Set // Set
-{
- NodeData getNodeData( Node node ) ;
-
- Set /* Set */ getRoots() ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/GraphImpl.java 2018-01-30 20:19:27.000000000 -0500
+++ /dev/null 2018-01-30 20:19:27.000000000 -0500
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.graph ;
-
-import java.util.Collection ;
-import java.util.AbstractSet ;
-import java.util.Iterator ;
-import java.util.Map ;
-import java.util.HashMap ;
-import java.util.Set ;
-import java.util.HashSet ;
-
-public class GraphImpl extends AbstractSet implements Graph
-{
- private Map /* Map */ nodeToData ;
-
- public GraphImpl()
- {
- nodeToData = new HashMap() ;
- }
-
- public GraphImpl( Collection coll )
- {
- this() ;
- addAll( coll ) ;
- }
-
-/***********************************************************************************/
-/************ AbstractSet implementation *******************************************/
-/***********************************************************************************/
-
- // Required for AbstractSet
- public boolean add( Object obj ) // obj must be a Node
- {
- if (!(obj instanceof Node))
- throw new IllegalArgumentException( "Graphs must contain only Node instances" ) ;
-
- Node node = (Node)obj ;
- boolean found = nodeToData.keySet().contains( obj ) ;
-
- if (!found) {
- NodeData nd = new NodeData() ;
- nodeToData.put( node, nd ) ;
- }
-
- return !found ;
- }
-
- // Required for AbstractSet
- public Iterator iterator()
- {
- return nodeToData.keySet().iterator() ;
- }
-
- // Required for AbstractSet
- public int size()
- {
- return nodeToData.keySet().size() ;
- }
-
-/***********************************************************************************/
-
- public NodeData getNodeData( Node node )
- {
- return (NodeData)nodeToData.get( node ) ;
- }
-
- private void clearNodeData()
- {
- // Clear every node
- Iterator iter = nodeToData.entrySet().iterator() ;
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next() ;
- NodeData nd = (NodeData)(entry.getValue()) ;
- nd.clear( ) ;
- }
- }
-
- interface NodeVisitor
- {
- void visit( Graph graph, Node node, NodeData nd ) ;
- }
-
- // This visits every node in the graph exactly once. A
- // visitor is allowed to modify the graph during the
- // traversal.
- void visitAll( NodeVisitor nv )
- {
- boolean done = false ;
-
- // Repeat the traversal until every node has been visited. Since
- // it takes one pass to determine whether or not each node has
- // already been visited, this loop always runs at least once.
- do {
- done = true ;
-
- // Copy entries to array to avoid concurrent modification
- // problem with iterator if the visitor is updating the graph.
- Map.Entry[] entries =
- (Map.Entry[])nodeToData.entrySet().toArray( new Map.Entry[0] ) ;
-
- // Visit each node in the graph that has not already been visited.
- // If any node is visited in this pass, we must run at least one more
- // pass.
- for (int ctr=0; ctr
- while (iter.hasNext()) {
- Node child = (Node)iter.next() ;
-
- // Make sure the child is in the graph so it can be
- // visited later if necessary.
- graph.add( child ) ;
-
- // Mark the child as a non-root, since a child is never a root.
- NodeData cnd = graph.getNodeData( child ) ;
- cnd.notRoot() ;
- }
- }
- } ) ;
- }
-
- private Set collectRootSet()
- {
- final Set result = new HashSet() ;
-
- Iterator iter = nodeToData.entrySet().iterator() ;
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next() ;
- Node node = (Node)entry.getKey() ;
- NodeData nd = (NodeData)entry.getValue() ;
- if (nd.isRoot())
- result.add( node ) ;
- }
-
- return result ;
- }
-
- public Set /* Set */ getRoots()
- {
- clearNodeData() ;
- markNonRoots() ;
- return collectRootSet() ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Node.java 2018-01-30 20:19:28.000000000 -0500
+++ /dev/null 2018-01-30 20:19:28.000000000 -0500
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.graph ;
-
-import java.util.Set ;
-
-/** Node in a graph.
-*/
-public interface Node
-{
- /** Get all the children of this node.
- */
- Set /* Set */ getChildren() ;
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/NodeData.java 2018-01-30 20:19:29.000000000 -0500
+++ /dev/null 2018-01-30 20:19:29.000000000 -0500
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil.graph ;
-
-/** Data about a node in a graph.
- */
-public class NodeData
-{
- private boolean visited ;
- private boolean root ;
-
- public NodeData()
- {
- clear() ;
- }
-
- public void clear()
- {
- this.visited = false ;
- this.root = true ;
- }
-
- /** Return whether this node has been visited in a traversal.
- * Note that we only support a single traversal at a time.
- */
- boolean isVisited()
- {
- return visited ;
- }
-
- void visited()
- {
- visited = true ;
- }
-
- /** Return whether this node is a root.
- */
- boolean isRoot()
- {
- return root ;
- }
-
- void notRoot()
- {
- root = false ;
- }
-}
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb.properties 2018-01-30 20:19:29.000000000 -0500
+++ /dev/null 2018-01-30 20:19:29.000000000 -0500
@@ -1,193 +0,0 @@
-#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-orbd.usage=Usage: {0} \
-\n\
-\nwhere includes:\
-\n -port Activation Port where the ORBD should be started, default 1049 (optional)\
-\n -defaultdb Directory for ORBD files, default "./orb.db" (optional)\
-\n -serverid Server Id for ORBD, default 1 (optional)\
-\n -ORBInitialPort Initial Port (required)\
-\n -ORBInitialHost Initial HostName (required)\
-\n\
-
-
-servertool.usage=Usage: {0} \
-\n\
-\nwhere includes:\
-\n -ORBInitialPort Initial Port (required)\
-\n -ORBInitialHost Initial HostName (required)\
-\n\
-
-servertool.banner=\
-\n\
-\nWelcome to the Java IDL Server Tool \
-\nplease enter commands at the prompt \
-\n\
-
-servertool.shorthelp=\
-\n\
-\n\tAvailable Commands: \
-\n\t------------------- \
-\n\
-
-servertool.baddef=Bad server definition: {0}
-servertool.nosuchserver=\tno such server found.
-servertool.helddown=\tserver is held down.
-servertool.nosuchorb=\tinvalid ORB.
-servertool.serverup=\tserver is already up.
-servertool.appname=\tapplicationName - {0}
-servertool.name=\tname - {0}
-servertool.classpath=\tclasspath - {0}
-servertool.args=\targs - {0}
-servertool.vmargs=\tvmargs - {0}
-servertool.serverid=\tserver id - {0}
-servertool.servernotrunning=\tserver is not running.
-servertool.register=\
-\n\
-\n\tregister -server \
-\n\t -applicationName \
-\n\t -classpath \
-\n\t -args \
-\n\t -vmargs \
-\n\
-
-servertool.register1=register an activatable server
-servertool.register2=\tserver registered (serverid = {0}).
-servertool.register3=\tserver registerd but held down (serverid = {0}).
-servertool.register4=\tserver already registered (serverid = {0}).
-
-servertool.unregister=\
-\n\tunregister [ -serverid | -applicationName ] \
-\n\
-
-servertool.unregister1=unregister a registered server
-servertool.unregister2=\tserver unregistered.
-
-servertool.locate=\
-\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \
-\n\
-
-servertool.locate1=locate ports of specific type for a registered server
-servertool.locate2=\
-\n\
-\n\tHost Name {0} \
-\n\
-\n\t\tPort\t\tPort Type\t\tORB Id\
-\n\t\t----\t\t---------\t\t------\
-\n\
-
-servertool.locateorb=\
-\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\
-\n\
-
-servertool.locateorb1=locate ports for a specific orb of registered server
-servertool.locateorb2=\
-\n\
-\n\tHost Name {0} \
-\n\
-\n\t\tPort\t\tPortType\t\tORB Id\
-\n\t\t----\t\t--------\t\t------\
-\n\
-
-servertool.getserverid=\n\tgetserverid [ -applicationName ] \
-\n\
-
-servertool.getserverid1=return the server id for an applicationName
-servertool.getserverid2=\tServer ID for applicationName {0} is {1}
-
-servertool.list=\n\tlist\
-\n\
-
-servertool.list1=list all registered servers
-servertool.list2=\
-\n\tServer Id\tServer Class Name\t\tServer Application\
-\n\t---------\t-----------------\t\t------------------\
-\n\
-
-servertool.listactive=\n\tlistactive
-servertool.listactive1=list currently active servers
-servertool.listappnames=\tlistappnames\n
-servertool.listappnames1=list applicationNames currently defined
-servertool.listappnames2=Currently defined server applicationNames:
-
-servertool.shutdown=\
-\n\tshutdown [ -serverid | -applicationName ]\
-\n\
-
-servertool.shutdown1=shutdown a registered server
-servertool.shutdown2=\tserver sucessfully shutdown.
-servertool.startserver=\
-\n\tstartup [ -serverid | -applicationName ]\
-\n\
-
-servertool.startserver1=start a registered server
-servertool.startserver2=\tserver sucessfully started up.
-
-servertool.quit=\n\tquit\n
-servertool.quit1=quit this tool
-
-servertool.help=\thelp\
-\n\tOR\
-\n\thelp \
-\n\
-
-servertool.help1=get help
-
-servertool.orbidmap=\tUsage: orblist [ -serverid | -applicationName ]\
-\n\
-
-servertool.orbidmap1=list of orb names and their mapping
-servertool.orbidmap2=\
-\n\tORB Id\t\tORB Name\
-\n\t------\t\t--------\
-\n\
-
-pnameserv.success=Persistent NameServer Started Successfully
-
-
-bootstrap.usage=Usage: {0} \
-\n\
-\nwhere includes:\
-\n -ORBInitialPort Initial Port (required)\
-\n -InitialServicesFile File containing list of initial services (required)\
-\n\
-
-bootstrap.success=setting port to {0} and reading services from {1}
-bootstrap.filenotreadable=the file {0} is not readable
-bootstrap.filenotfound=the file {0} not found
-bootstrap.exception=caught exception while saving Properties to file {0}: Exception {1}
-
-tnameserv.exception=caught an exception while starting the bootstrap service on port {0}
-tnameserv.usage=try using a different port with commandline arguments -ORBInitialPort
-tnameserv.invalidhostoption=ORBInitialHost is not a valid option for NameService
-tnameserv.orbinitialport0=ORBInitialPort 0 is not valid option for NameService
-tnameserv.hs1=Initial Naming Context:\n{0}
-tnameserv.hs2=TransientNameServer: setting port for initial object references to: {0}
-tnameserv.hs3=Ready.
-
-orbd.commfailure=\nFailed to start ORBD because ORBinitialPort is already in use
-orbd.internalexception=\nFailed to start ORBD because of an Internal Exception. \nPossible Causes: \n1. Specified ORBInitialPort or ORBActivationPort is already in use \n2. No Write Permission to write orb.db
-
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties 2018-01-30 20:19:30.000000000 -0500
+++ /dev/null 2018-01-30 20:19:30.000000000 -0500
@@ -1,107 +0,0 @@
-#
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-orbd.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -port Aktivierungsport, an dem der ORBD gestartet werden sollte, Standardwert 1049 (optional)\n -defaultdb Verzeichnis f\u00FCr ORBD-Dateien, Standardwert "./orb.db" (optional)\n -serverid Server-ID f\u00FCr ORBD, Standardwert 1 (optional)\n -ORBInitialPort Anfangsport (erforderlich)\n -ORBInitialHost Anf\u00E4nglicher HostName (erforderlich)\n
-
-servertool.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -ORBInitialPort Anfangsport (erforderlich)\n -ORBInitialHost Anf\u00E4nglicher HostName (erforderlich)\n
-servertool.banner=\n\nWillkommen beim Java IDL-Servertool \nGeben Sie die entsprechenden Befehle im Prompt ein \n
-servertool.shorthelp=\n\n\tVerf\u00FCgbare Befehle: \n\t------------------- \n
-servertool.baddef=Ung\u00FCltige Serverdefinition: {0}
-servertool.nosuchserver=\tServer wurde nicht gefunden.
-servertool.helddown=\tServer ist au\u00DFer Betrieb.
-servertool.nosuchorb=\tUng\u00FCltiger ORB.
-servertool.serverup=\tServer ist bereits hochgefahren.
-servertool.appname=\tapplicationName - {0}
-servertool.name=\tName - {0}
-servertool.classpath=\tclasspath - {0}
-servertool.args=\targs - {0}
-servertool.vmargs=\tvmargs - {0}
-servertool.serverid=\tServer-ID - {0}
-servertool.servernotrunning=\tServer wird nicht ausgef\u00FChrt.
-servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n
-servertool.register1=aktivierbaren Server registrieren
-servertool.register2=\tServer registriert (serverid = {0}).
-servertool.register3=\tServer registriert, aber au\u00DFer Betrieb (serverid = {0}).
-servertool.register4=\tServer bereits registriert (serverid = {0}).
-
-servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n
-servertool.unregister1=Registrierung eines registrierten Servers aufheben
-servertool.unregister2=\tServerregistrierung aufgehoben.
-
-servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n
-servertool.locate1=Ports eines speziellen Typs f\u00FCr einen registrierten Server finden
-servertool.locate2=\n\n\tHostname {0} \n\n\t\tPort\t\tPorttyp\t\tORB-ID\n\t\t----\t\t-------\t\t------\n
-servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n
-servertool.locateorb1=Ports f\u00FCr einen speziellen ORB bei einem registrierten Server finden
-servertool.locateorb2=\n\n\tHostname {0} \n\n\t\tPort\t\tPortType\t\tORB-ID\n\t\t----\t\t-------\t\t------\n
-servertool.getserverid=\n\tgetserverid [ -applicationName ] \n
-servertool.getserverid1=Server-ID f\u00FCr applicationName zur\u00FCckgeben
-servertool.getserverid2=\tServer-ID f\u00FCr applicationName {0} ist {1}
-
-servertool.list=\n\tlist\n
-servertool.list1=alle registrierten Server auflisten
-servertool.list2=\n\tServer-ID\tServerklassenname\t\tServeranwendung\n\t---------\t-----------------\t\t------------------\n
-servertool.listactive=\n\tlistactive
-servertool.listactive1=derzeit aktive Server auflisten
-servertool.listappnames=\tlistappnames\n
-servertool.listappnames1=derzeit definierte applicationNames auflisten
-servertool.listappnames2=Derzeit definierte Server-applicationNames:
-
-servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n
-servertool.shutdown1=registrierten Server herunterfahren
-servertool.shutdown2=\tServer erfolgreich heruntergefahren.
-servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n
-servertool.startserver1=registrierten Server starten
-servertool.startserver2=\tServer erfolgreich hochgefahren.
-
-servertool.quit=\n\tquit\n
-servertool.quit1=dieses Tool beenden
-
-servertool.help=\thelp\n\tOR\n\thelp \n
-servertool.help1=Hilfe abrufen
-
-servertool.orbidmap=\\Verwendung: orblist [ -serverid | -applicationName ]\n
-servertool.orbidmap1=Liste von ORB-Namen und ihren Zuordnungen
-servertool.orbidmap2=\n\tORB-ID\t\tORB-Name\n\t------\t\t--------\n
-pnameserv.success=Persistenter NameServer erfolgreich gestartet
-
-
-bootstrap.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -ORBInitialPort Anf\u00E4nglicher Port (erforderlich)\n -InitialServicesFile Datei mit Liste von anf\u00E4nglichen Services (erforderlich)\n
-bootstrap.success=Port wird auf {0} gesetzt, Services werden aus {1} gelesen
-bootstrap.filenotreadable=Datei {0} kann nicht gelesen werden
-bootstrap.filenotfound=Datei {0} wurde nicht gefunden
-bootstrap.exception=Beim Speichern von Eigenschaften in Datei {0} wurde eine Ausnahme abgefangen: Ausnahme {1}
-
-tnameserv.exception=Beim Hochfahren des Bootstrap-Services auf Port {0} wurde eine Ausnahme abgefangen
-tnameserv.usage=Verwenden Sie einen anderen Port mit den Befehlszeilenargumenten -ORBInitialPort
-tnameserv.invalidhostoption=ORBInitialHost ist keine g\u00FCltige Option f\u00FCr NameService
-tnameserv.orbinitialport0=ORBInitialPort 0 ist keine g\u00FCltige Option f\u00FCr NameService
-tnameserv.hs1=Anf\u00E4nglicher Namenskontext:\n{0}
-tnameserv.hs2=TransientNameServer: Port f\u00FCr anf\u00E4ngliche Objektreferenzen wird auf {0} gesetzt
-tnameserv.hs3=Bereit.
-
-orbd.commfailure=\nStart von ORBD nicht erfolgreich, da ORBinitialPort bereits verwendet wird
-orbd.internalexception=\nStart von ORBD aufgrund einer internen Ausnahme nicht erfolgreich. \nM\u00F6gliche Ursachen: \n1. Der angegebene ORBInitialPort oder ORBActivationPort wird bereits verwendet \n2. Keine Berechtigung zum Schreiben von orb.db
-
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties 2018-01-30 20:19:31.000000000 -0500
+++ /dev/null 2018-01-30 20:19:31.000000000 -0500
@@ -1,107 +0,0 @@
-#
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-orbd.usage=Sintaxis: {0} \n\ndonde incluye:\n -port Puerto de activaci\u00F3n en el que se debe iniciar el ORBD, por defecto es el 1049 (opcional)\n -defaultdb Directorio para los archivos de ORBD, por defecto es "./orb.db" (opcional)\n -serverid Identificador de servidor para ORBD, por defecto es 1 (opcional)\n -ORBInitialPort Puerto inicial (necesario)\n -ORBInitialHost Nombre de host inicial (necesario)\n
-
-servertool.usage=Sintaxis: {0} \n\ndonde incluye:\n -ORBInitialPort Puerto inicial (necesario)\n -ORBInitialHost Nombre de host inicial (necesario)\n
-servertool.banner=\n\nBienvenido a Java IDL Server Tool \nescriba los comandos en la petici\u00F3n de datos \n
-servertool.shorthelp=\n\n\tComandos disponibles: \n\t------------------- \n
-servertool.baddef=Definici\u00F3n de servidor incorrecta: {0}
-servertool.nosuchserver=\tno se ha encontrado el servidor.
-servertool.helddown=\tel servidor se mantiene desconectado.
-servertool.nosuchorb=\tORB no v\u00E1lido.
-servertool.serverup=\tel servidor ya est\u00E1 conectado.
-servertool.appname=\tapplicationName - {0}
-servertool.name=\tname - {0}
-servertool.classpath=\tclasspath - {0}
-servertool.args=\targs - {0}
-servertool.vmargs=\tvmargs - {0}
-servertool.serverid=\tserver id - {0}
-servertool.servernotrunning=\tel servidor no se est\u00E1 ejecutando.
-servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n
-servertool.register1=registrar un servidor que se pueda activar
-servertool.register2=\tservidor registrado (identificador de servidor = {0}).
-servertool.register3=\tservidor registrado pero desconectado (identificador de servidor = {0}).
-servertool.register4=\tservidor ya registrado (identificador de servidor = {0}).
-
-servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n
-servertool.unregister1=anular el registro de un servidor registrado
-servertool.unregister2=\tanulado el registro del servidor.
-
-servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n
-servertool.locate1=localizar puertos de un tipo espec\u00EDfico para un servidor registrado
-servertool.locate2=\n\n\tNombre de host {0} \n\n\t\tPuerto\t\tTipo de puerto\t\tIdentificador ORB\n\t\t----\t\t---------\t\t------\n
-servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n
-servertool.locateorb1=localizar puertos para un ORB espec\u00EDfico del servidor registrado
-servertool.locateorb2=\n\n\tNombre de host {0} \n\n\t\tPuerto\t\tTipo de puerto\t\tIdentificador de ORB\n\t\t----\t\t--------\t\t------\n
-servertool.getserverid=\n\tgetserverid [ -applicationName ] \n
-servertool.getserverid1=devolver el identificador de servidor para un valor de applicationName
-servertool.getserverid2=\tEl identificador de servidor para applicationName {0} es {1}
-
-servertool.list=\n\tlist\n
-servertool.list1=enumerar todos los servidores registrados
-servertool.list2=\n\tIdentificador de servidor\tNombre de clase del servidor\t\tAplicaci\u00F3n de servidor\n\t-------------------------\t----------------------------\t\t----------------------\n
-servertool.listactive=\n\tlistactive
-servertool.listactive1=enumerar los servidores actualmente activos
-servertool.listappnames=\tlistappnames\n
-servertool.listappnames1=enumerar los nombres de aplicaci\u00F3n actualmente definidos
-servertool.listappnames2=Nombres de aplicaci\u00F3n de servidor actualmente definidos:
-
-servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n
-servertool.shutdown1=apagar un servidor registrado
-servertool.shutdown2=\tservidor apagado correctamente.
-servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n
-servertool.startserver1=iniciar un servidor registrado
-servertool.startserver2=\tservidor iniciado correctamente.
-
-servertool.quit=\n\tquit\n
-servertool.quit1=salir de esta herramienta
-
-servertool.help=\thelp\n\tO\n\thelp \n
-servertool.help1=obtener ayuda
-
-servertool.orbidmap=\tSintaxis: orblist [ -serverid | -applicationName ]\n
-servertool.orbidmap1=lista de nombres de ORB y su asignaci\u00F3n
-servertool.orbidmap2=\n\tIdentificador de ORB\t\tNombre de ORB\n\t------\t\t--------\n
-pnameserv.success=NameServer constante iniciado correctamente
-
-
-bootstrap.usage=Sintaxis: {0} \n\ndonde incluye:\n -ORBInitialPort Puerto inicial (necesario)\n -InitialServicesFile Archivo que contiene una lista de los servicios iniciales (necesario)\n
-bootstrap.success=definiendo puerto en {0} y leyendo servicios de {1}
-bootstrap.filenotreadable=el archivo {0} no se puede leer
-bootstrap.filenotfound=no se ha encontrado el archivo {0}
-bootstrap.exception=se ha obtenido una excepci\u00F3n al guardar las propiedades en el archivo {0}: Excepci\u00F3n {1}
-
-tnameserv.exception=se ha obtenido una excepci\u00F3n al iniciar el servicio de inicializaci\u00F3n de datos en el puerto {0}
-tnameserv.usage=intente utilizar un puerto distinto con argumentos de l\u00EDnea de comandos -ORBInitialPort
-tnameserv.invalidhostoption=ORBInitialHost no es una opci\u00F3n v\u00E1lida para NameService
-tnameserv.orbinitialport0=ORBInitialPort 0 no es una opci\u00F3n v\u00E1lida para NameService
-tnameserv.hs1=Contexto de Nomenclatura Inicial:\n{0}
-tnameserv.hs2=TransientNameServer: definiendo puerto para referencias a objeto iniciales en: {0}
-tnameserv.hs3=Listo.
-
-orbd.commfailure=\nORBD no puede iniciarse porque ORBinitialPort ya est\u00E1 en uso
-orbd.internalexception=\nORBD no puede iniciarse debido a una excepci\u00F3n interna. \nCausas posibles: \n1. El ORBInitialPort o el ORBActivationPort especificado ya est\u00E1 en uso \n2. No tiene permiso de escritura para orb.db
-
--- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties 2018-01-30 20:19:31.000000000 -0500
+++ /dev/null 2018-01-30 20:19:31.000000000 -0500
@@ -1,107 +0,0 @@
-#
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-orbd.usage=Syntaxe : {0} \n\no\u00F9 comprend :\n -port Port d''activation o\u00F9 l''ORBD doit \u00EAtre d\u00E9marr\u00E9, 1049 par d\u00E9faut (facultatif)\n -defaultdb R\u00E9pertoire des fichiers ORBD, par d\u00E9faut "./orb.db" (facultatif)\n -serverid ID de serveur pour ORBD, 1 par d\u00E9faut (facultatif)\n -ORBInitialPort Port initial (obligatoire)\n -ORBInitialHost Nom d''h\u00F4te initial (obligatoire)\n
-
-servertool.usage=Syntaxe : {0} \n\no\u00F9 comprend :\n -ORBInitialPort Port initial (obligatoire)\n -ORBInitialHost Nom d''h\u00F4te initial (obligatoire)\n
-servertool.banner=\n\nBienvenue dans l'outil Java IDL Server Tool \nSp\u00E9cifiez des commandes \u00E0 l'invite \n
-servertool.shorthelp=\n\n\tCommandes disponibles : \n\t------------------- \n
-servertool.baddef=D\u00E9finition de serveur incorrecte : {0}
-servertool.nosuchserver=\tce serveur est introuvable.
-servertool.helddown=\tserveur interrompu.
-servertool.nosuchorb=\tORB non valide.
-servertool.serverup=\tle serveur fonctionne d\u00E9j\u00E0.
-servertool.appname=\tapplicationName - {0}
-servertool.name=\tname - {0}
-servertool.classpath=\tclasspath - {0}
-servertool.args=\targs - {0}
-servertool.vmargs=\tvmargs - {0}
-servertool.serverid=\tID de serveur - {0}
-servertool.servernotrunning=\tle serveur ne fonctionne pas.
-servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n
-servertool.register1=inscrire un serveur activable
-servertool.register2=\tserveur inscrit (ID serveur = {0}).
-servertool.register3=\tserveur inscrit mais interrompu (ID serveur = {0}).
-servertool.register4=\tserveur d\u00E9j\u00E0 inscrit (ID serveur = {0}).
-
-servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n
-servertool.unregister1=d\u00E9sinscrire un serveur inscrit
-servertool.unregister2=\tserveur d\u00E9sinscrit.
-
-servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n
-servertool.locate1=rep\u00E9rer des ports de type sp\u00E9cifique d'un serveur inscrit
-servertool.locate2=\n\n\tNom d''h\u00F4te {0} \n\n\t\tPort\t\tType de port\t\tID ORB\n\t\t----\t\t---------\t\t------\n
-servertool.locateorb=\n\tlocateperorb [ -serverid