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