Tue, 12 Nov 2013 18:04:13 +0000
8025767: Enhance IIOP Streams
Summary: modify org.omg.CORBA_2_3.portable.InputStream inheritance structure.
Reviewed-by: alanb, coffeys, skoivu
duke@1 | 1 | /* |
coffeys@478 | 2 | * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@158 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@158 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@158 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@158 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@158 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | /* |
duke@1 | 26 | * Licensed Materials - Property of IBM |
duke@1 | 27 | * RMI-IIOP v1.0 |
duke@1 | 28 | * Copyright IBM Corp. 1998 1999 All Rights Reserved |
duke@1 | 29 | * |
duke@1 | 30 | */ |
duke@1 | 31 | |
duke@1 | 32 | package org.omg.CORBA_2_3.portable; |
duke@1 | 33 | |
coffeys@478 | 34 | import java.io.SerializablePermission; |
coffeys@478 | 35 | import java.security.AccessController; |
coffeys@478 | 36 | import java.security.PrivilegedAction; |
coffeys@478 | 37 | |
duke@1 | 38 | /** |
duke@1 | 39 | * OutputStream provides interface for writing of all of the mapped IDL type |
duke@1 | 40 | * to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines |
duke@1 | 41 | * new methods defined by CORBA 2.3. |
duke@1 | 42 | * |
duke@1 | 43 | * @see org.omg.CORBA.portable.OutputStream |
duke@1 | 44 | * @author OMG |
duke@1 | 45 | * @since JDK1.2 |
duke@1 | 46 | */ |
duke@1 | 47 | |
duke@1 | 48 | public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream { |
duke@1 | 49 | |
coffeys@478 | 50 | private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowOutputStreamSubclass"; |
coffeys@478 | 51 | private static final boolean allowSubclass = AccessController.doPrivileged( |
coffeys@478 | 52 | new PrivilegedAction<Boolean>() { |
coffeys@478 | 53 | @Override |
coffeys@478 | 54 | public Boolean run() { |
coffeys@478 | 55 | String prop = System.getProperty(ALLOW_SUBCLASS_PROP); |
coffeys@478 | 56 | return prop == null ? false : |
coffeys@478 | 57 | (prop.equalsIgnoreCase("false") ? false : true); |
coffeys@478 | 58 | } |
coffeys@478 | 59 | }); |
coffeys@478 | 60 | |
coffeys@478 | 61 | private static Void checkPermission() { |
coffeys@478 | 62 | SecurityManager sm = System.getSecurityManager(); |
coffeys@478 | 63 | if (sm != null) { |
coffeys@478 | 64 | if (!allowSubclass) |
coffeys@478 | 65 | sm.checkPermission(new |
coffeys@478 | 66 | SerializablePermission("enableSubclassImplementation")); |
coffeys@478 | 67 | } |
coffeys@478 | 68 | return null; |
coffeys@478 | 69 | } |
coffeys@478 | 70 | private OutputStream(Void ignore) { } |
coffeys@478 | 71 | |
coffeys@478 | 72 | /** |
coffeys@478 | 73 | * Create a new instance of this class. |
coffeys@478 | 74 | * |
coffeys@478 | 75 | * throw SecurityException if SecurityManager is installed and |
coffeys@478 | 76 | * enableSubclassImplementation SerializablePermission |
coffeys@478 | 77 | * is not granted or jdk.corba.allowOutputStreamSubclass system |
coffeys@478 | 78 | * property is either not set or is set to 'false' |
coffeys@478 | 79 | */ |
coffeys@478 | 80 | public OutputStream() { |
coffeys@478 | 81 | this(checkPermission()); |
coffeys@478 | 82 | } |
coffeys@478 | 83 | |
duke@1 | 84 | /** |
duke@1 | 85 | * Marshals a value type to the output stream. |
duke@1 | 86 | * @param value is the acutal value to write |
duke@1 | 87 | */ |
duke@1 | 88 | public void write_value(java.io.Serializable value) { |
duke@1 | 89 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 90 | } |
duke@1 | 91 | |
duke@1 | 92 | /** |
duke@1 | 93 | * Marshals a value type to the output stream. |
duke@1 | 94 | * @param value is the acutal value to write |
duke@1 | 95 | * @param clz is the declared type of the value to be marshaled |
duke@1 | 96 | */ |
duke@1 | 97 | public void write_value(java.io.Serializable value, java.lang.Class clz) { |
duke@1 | 98 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 99 | } |
duke@1 | 100 | |
duke@1 | 101 | /** |
duke@1 | 102 | * Marshals a value type to the output stream. |
duke@1 | 103 | * @param value is the acutal value to write |
duke@1 | 104 | * @param repository_id identifies the type of the value type to |
duke@1 | 105 | * be marshaled |
duke@1 | 106 | */ |
duke@1 | 107 | public void write_value(java.io.Serializable value, String repository_id) { |
duke@1 | 108 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 109 | } |
duke@1 | 110 | |
duke@1 | 111 | /** |
duke@1 | 112 | * Marshals a value type to the output stream. |
duke@1 | 113 | * @param value is the acutal value to write |
duke@1 | 114 | * @param factory is the instance of the helper to be used for marshaling |
duke@1 | 115 | * the boxed value |
duke@1 | 116 | */ |
duke@1 | 117 | public void write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper factory) { |
duke@1 | 118 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 119 | } |
duke@1 | 120 | |
duke@1 | 121 | /** |
duke@1 | 122 | * Marshals a value object or a stub object. |
duke@1 | 123 | * @param obj the actual value object to marshal or the stub to be marshalled |
duke@1 | 124 | */ |
duke@1 | 125 | public void write_abstract_interface(java.lang.Object obj) { |
duke@1 | 126 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 127 | } |
duke@1 | 128 | |
duke@1 | 129 | } |