GNU Classpath (0.17) | ||
Frames | No Frames |
1: /* _IDLTypeStub.java -- 2: Copyright (C) 2005 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package org.omg.CORBA; 40: 41: import gnu.CORBA.TypeCodeHelper; 42: 43: import org.omg.CORBA.portable.ApplicationException; 44: import org.omg.CORBA.portable.Delegate; 45: import org.omg.CORBA.portable.InputStream; 46: import org.omg.CORBA.portable.ObjectImpl; 47: import org.omg.CORBA.portable.OutputStream; 48: import org.omg.CORBA.portable.RemarshalException; 49: 50: import java.io.Serializable; 51: 52: /** 53: * The stub for the IDL type. This stub can be used to access the 54: * remote IDL type object, if its IOR is known. To create the 55: * working instance with the known IOR, pass {@link gnu.CORBA.IOR_Delegate} 56: * to the constructor. 57: * 58: * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 59: */ 60: public class _IDLTypeStub 61: extends ObjectImpl 62: implements IDLType, Serializable 63: { 64: /** 65: * Use serialVersionUID (v1.4) for interoperability. 66: */ 67: private static final long serialVersionUID = 9150293942452453626L; 68: 69: /** 70: * Create the instance of the IDL type stub without 71: * the set delegate. The delegate must be set anyway before calling 72: * any remote method. 73: */ 74: public _IDLTypeStub() 75: { 76: } 77: 78: /** 79: * Create an instance with the given delegate. 80: * 81: * @see gnu.CORBA.IOR_Delegate 82: */ 83: public _IDLTypeStub(Delegate delegate) 84: { 85: _set_delegate(delegate); 86: } 87: 88: /** 89: * Get the typecode of the remote IDL type object. The method is 90: * written following OMG specification, treating the typecode 91: * as a read only attribute rather than a method. This means, 92: * the operation name is "_get_type". 93: * 94: * @return a typecode, returned by the remote IDL type object. 95: */ 96: public TypeCode type() 97: { 98: InputStream in = null; 99: try 100: { 101: OutputStream out = _request("_get_type", true); 102: in = _invoke(out); 103: return TypeCodeHelper.read(in); 104: } 105: catch (ApplicationException ex) 106: { 107: in = ex.getInputStream(); 108: throw new org.omg.CORBA.MARSHAL(ex.getId()); 109: } 110: catch (RemarshalException rex) 111: { 112: return type(); 113: } 114: catch (UserException ex) 115: { 116: MARSHAL m = new MARSHAL(); 117: m.initCause(ex); 118: throw m; 119: } 120: finally 121: { 122: _releaseReply(in); 123: } 124: } 125: 126: /** 127: * Get the definition kind of the remote IDL type object. The method is 128: * written following OMG specification, treating the typecode 129: * as a read only attribute rather than a method. This means, 130: * the operation name is "_get_def_kind". 131: * 132: * @return a definition kind, returned by remote IDL type object. 133: */ 134: public DefinitionKind def_kind() 135: { 136: InputStream in = null; 137: try 138: { 139: OutputStream out = _request("_get_def_kind", true); 140: in = _invoke(out); 141: return DefinitionKindHelper.read(in); 142: } 143: catch (ApplicationException ex) 144: { 145: in = ex.getInputStream(); 146: throw new org.omg.CORBA.MARSHAL(ex.getId()); 147: } 148: catch (RemarshalException rex) 149: { 150: return def_kind(); 151: } 152: finally 153: { 154: _releaseReply(in); 155: } 156: } 157: 158: /** 159: * Destroy the remote IDL type object. 160: */ 161: public void destroy() 162: { 163: InputStream in = null; 164: try 165: { 166: OutputStream out = _request("destroy", true); 167: in = _invoke(out); 168: } 169: catch (ApplicationException ex) 170: { 171: in = ex.getInputStream(); 172: throw new org.omg.CORBA.MARSHAL(ex.getId()); 173: } 174: catch (RemarshalException rex) 175: { 176: destroy(); 177: } 178: finally 179: { 180: _releaseReply(in); 181: } 182: } 183: 184: /** 185: * Return the array of repository ids of the IDL type. 186: * 187: * @return "IDL:omg.org/CORBA/IDLType:1.0" and 188: * "IDL:omg.org/CORBA/IRObject:1.0", always. 189: */ 190: public String[] _ids() 191: { 192: return new String[] 193: { 194: "IDL:omg.org/CORBA/IDLType:1.0", "IDL:omg.org/CORBA/IRObject:1.0" 195: }; 196: }
GNU Classpath (0.17) |