GNU Classpath (0.95) | |
Frames | No Frames |
1: /* _IDLTypeStub.java -- 2: Copyright (C) 2005, 2006 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.Minor; 42: import gnu.CORBA.TypeCodeHelper; 43: 44: import org.omg.CORBA.portable.ApplicationException; 45: import org.omg.CORBA.portable.Delegate; 46: import org.omg.CORBA.portable.InputStream; 47: import org.omg.CORBA.portable.ObjectImpl; 48: import org.omg.CORBA.portable.OutputStream; 49: import org.omg.CORBA.portable.RemarshalException; 50: 51: import java.io.Serializable; 52: 53: /** 54: * The stub for the IDL type. This stub can be used to access the 55: * remote IDL type object, if its IOR is known. To create the 56: * working instance with the known IOR, pass {@link gnu.CORBA.IorDelegate} 57: * to the constructor. 58: * 59: * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 60: */ 61: public class _IDLTypeStub 62: extends ObjectImpl 63: implements IDLType, Serializable 64: { 65: /** 66: * Use serialVersionUID (v1.4) for interoperability. 67: */ 68: private static final long serialVersionUID = 9150293942452453626L; 69: 70: /** 71: * Create the instance of the IDL type stub without 72: * the set delegate. The delegate must be set anyway before calling 73: * any remote method. 74: */ 75: public _IDLTypeStub() 76: { 77: } 78: 79: /** 80: * Create an instance with the given delegate. 81: * 82: * @see gnu.CORBA.IorDelegate 83: */ 84: public _IDLTypeStub(Delegate delegate) 85: { 86: _set_delegate(delegate); 87: } 88: 89: /** 90: * Get the typecode of the remote IDL type object. The method is 91: * written following OMG specification, treating the typecode 92: * as a read only attribute rather than a method. This means, 93: * the operation name is "_get_type". 94: * 95: * @return a typecode, returned by the remote IDL type object. 96: */ 97: public TypeCode type() 98: { 99: InputStream in = null; 100: try 101: { 102: OutputStream out = _request("_get_type", true); 103: in = _invoke(out); 104: return TypeCodeHelper.read(in); 105: } 106: catch (ApplicationException ex) 107: { 108: in = ex.getInputStream(); 109: throw new org.omg.CORBA.MARSHAL(ex.getId()); 110: } 111: catch (RemarshalException rex) 112: { 113: return type(); 114: } 115: catch (UserException ex) 116: { 117: MARSHAL m = new MARSHAL(); 118: m.minor = Minor.UserException; 119: m.initCause(ex); 120: throw m; 121: } 122: finally 123: { 124: _releaseReply(in); 125: } 126: } 127: 128: /** 129: * Get the definition kind of the remote IDL type object. The method is 130: * written following OMG specification, treating the typecode 131: * as a read only attribute rather than a method. This means, 132: * the operation name is "_get_def_kind". 133: * 134: * @return a definition kind, returned by remote IDL type object. 135: */ 136: public DefinitionKind def_kind() 137: { 138: InputStream in = null; 139: try 140: { 141: OutputStream out = _request("_get_def_kind", true); 142: in = _invoke(out); 143: return DefinitionKindHelper.read(in); 144: } 145: catch (ApplicationException ex) 146: { 147: in = ex.getInputStream(); 148: throw new org.omg.CORBA.MARSHAL(ex.getId()); 149: } 150: catch (RemarshalException rex) 151: { 152: return def_kind(); 153: } 154: finally 155: { 156: _releaseReply(in); 157: } 158: } 159: 160: /** 161: * Destroy the remote IDL type object. 162: */ 163: public void destroy() 164: { 165: InputStream in = null; 166: try 167: { 168: OutputStream out = _request("destroy", true); 169: in = _invoke(out); 170: } 171: catch (ApplicationException ex) 172: { 173: in = ex.getInputStream(); 174: throw new org.omg.CORBA.MARSHAL(ex.getId()); 175: } 176: catch (RemarshalException rex) 177: { 178: destroy(); 179: } 180: finally 181: { 182: _releaseReply(in); 183: } 184: } 185: 186: /** 187: * Return the array of repository ids of the IDL type. 188: * 189: * @return "IDL:omg.org/CORBA/IDLType:1.0" and 190: * "IDL:omg.org/CORBA/IRObject:1.0", always. 191: */ 192: public String[] _ids() 193: { 194: return new String[] 195: { 196: "IDL:omg.org/CORBA/IDLType:1.0", "IDL:omg.org/CORBA/IRObject:1.0" 197: }; 198: }
GNU Classpath (0.95) |