GNU Classpath (0.18) | ||
Frames | No Frames |
1: /* LocalObject.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 org.omg.CORBA.BAD_PARAM; 42: import org.omg.CORBA.Context; 43: import org.omg.CORBA.ContextList; 44: import org.omg.CORBA.DomainManager; 45: import org.omg.CORBA.ExceptionList; 46: import org.omg.CORBA.NO_IMPLEMENT; 47: import org.omg.CORBA.NVList; 48: import org.omg.CORBA.NamedValue; 49: import org.omg.CORBA.Policy; 50: import org.omg.CORBA.Request; 51: import org.omg.CORBA.SetOverrideType; 52: 53: /** 54: * An object, formally implementing the CORBA {@link Object}, but actually 55: * handling all invocations locally. 56: * Various calls to the remote object specific methods throw the 57: * {@link NO_IMPLEMENT}. The explaining message for this exception is 58: * specified in java API as <code>"This is a locally constrained object."</code>. 59: * It is not possible to get a stringified reference of the local object, or 60: * invoke a method using DII (by name via {@link Request} class). 61: * 62: * However narrowing and widening methods will work with local objects. 63: * 64: * @since 1.4 65: * 66: * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 67: */ 68: public class LocalObject 69: implements org.omg.CORBA.Object 70: { 71: /** 72: * The explaining message for the exception, thrown in response to call 73: * the method, not appropriate for the local object. 74: */ 75: private static final String INAPPROPRIATE = 76: "This is a locally constrained object."; 77: 78: /** 79: * This method is not appropriate for the local objects and just 80: * throws an exception. 81: * 82: * @throws NO_IMPLEMENT, always. 83: */ 84: public Request _create_request(Context context, String operation, 85: NVList parameters, NamedValue returns 86: ) 87: { 88: throw new NO_IMPLEMENT(INAPPROPRIATE); 89: } 90: 91: /** 92: * This method is not appropriate for the local objects and just 93: * throws an exception. 94: * 95: * @throws NO_IMPLEMENT, always. 96: */ 97: public Request _create_request(Context context, String operation, 98: NVList parameters, NamedValue returns, 99: ExceptionList exceptions, ContextList ctx_list 100: ) 101: { 102: throw new NO_IMPLEMENT(INAPPROPRIATE); 103: } 104: 105: /** 106: * This method is not appropriate for the local objects and just 107: * throws an exception. 108: * 109: * @throws NO_IMPLEMENT, always. 110: */ 111: public org.omg.CORBA.Object _duplicate() 112: { 113: throw new NO_IMPLEMENT(INAPPROPRIATE); 114: } 115: 116: /** 117: * This method is not appropriate for the local objects and just 118: * throws an exception. 119: * 120: * @throws NO_IMPLEMENT, always. 121: */ 122: public DomainManager[] _get_domain_managers() 123: { 124: throw new NO_IMPLEMENT(INAPPROPRIATE); 125: } 126: 127: /** 128: * This method is not appropriate for the local objects and just 129: * throws an exception. 130: * 131: * @throws NO_IMPLEMENT, always. 132: */ 133: public org.omg.CORBA.Object _get_interface_def() 134: { 135: throw new NO_IMPLEMENT(INAPPROPRIATE); 136: } 137: 138: /** 139: * This method is not appropriate for the local objects and just 140: * throws an exception. 141: * 142: * @throws NO_IMPLEMENT, always. 143: */ 144: public Policy _get_policy(int a_policy_type) 145: throws BAD_PARAM 146: { 147: throw new NO_IMPLEMENT(INAPPROPRIATE); 148: } 149: 150: /** 151: * {@inheritDoc} 152: */ 153: public int _hash(int maximum) 154: { 155: return Math.abs(hashCode()) % maximum; 156: } 157: 158: /** 159: * This method is not appropriate for the local objects and just 160: * throws an exception. 161: * 162: * @throws NO_IMPLEMENT, always. 163: */ 164: public boolean _is_a(String repositoryIdentifer) 165: { 166: throw new NO_IMPLEMENT(INAPPROPRIATE); 167: } 168: 169: /** 170: * Determines if the object is equal to another object, so far as it is 171: * possible to determine easily. 172: * 173: * @param other the other object. 174: * 175: * @return true if the pased object is not null and 176: * java.lang.Object.equals(other) returns true. False otherwise. 177: */ 178: public boolean _is_equivalent(org.omg.CORBA.Object other) 179: { 180: if (other != null) 181: if (other.equals(this)) 182: return true; 183: 184: return false; 185: } 186: 187: /** 188: * Always returs false. 189: * 190: * @return false, always. 191: */ 192: public boolean _non_existent() 193: { 194: return false; 195: } 196: 197: /** 198: * This method is not appropriate for the local objects and just 199: * throws an exception. 200: * 201: * @throws NO_IMPLEMENT, always. 202: */ 203: public void _release() 204: { 205: throw new NO_IMPLEMENT(INAPPROPRIATE); 206: } 207: 208: /** 209: * This method is not appropriate for the local objects and just 210: * throws an exception. 211: * 212: * @specnote it is possible to implement a local handling of the _request(), 213: * but the API clearly states that NO_IMPLEMENT 214: * must be thrown instead. 215: * 216: * @throws NO_IMPLEMENT, always. 217: */ 218: public Request _request(String operation) 219: { 220: throw new NO_IMPLEMENT(INAPPROPRIATE); 221: } 222: 223: /** 224: * This method is not appropriate for the local objects and just 225: * throws an exception. 226: * 227: * @throws NO_IMPLEMENT, always. 228: */ 229: public org.omg.CORBA.Object _set_policy_override(Policy[] policies, 230: SetOverrideType how 231: ) 232: { 233: throw new NO_IMPLEMENT(INAPPROPRIATE); 234: }
GNU Classpath (0.18) |