📄 orb.java
字号:
/* ORB.java -- Copyright (C) 2005 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING. If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library. Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule. An independent module is a module which is not derived fromor based on this library. If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so. If you do not wish to do so, delete thisexception statement from your version. */package org.omg.CORBA;import gnu.CORBA.OrbFocused;import gnu.CORBA.ObjectCreator;import gnu.CORBA.OrbRestricted;import gnu.CORBA.gnuContext;import gnu.CORBA.typecodes.FixedTypeCode;import gnu.CORBA.typecodes.GeneralTypeCode;import gnu.CORBA.typecodes.PrimitiveTypeCode;import gnu.CORBA.typecodes.RecordTypeCode;import gnu.CORBA.typecodes.RecursiveTypeCode;import org.omg.CORBA.ORBPackage.InconsistentTypeCode;import org.omg.PortableInterceptor.ObjectReferenceTemplate;import java.applet.Applet;import java.io.BufferedInputStream;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.util.Properties;/** * A central class in CORBA implementation, responsible for sending and handling * remote invocations. ORB also works as a factory for creating instances of * certain CORBA classes. * * Despite the core library contains the fully working CORBA implementation, it * also provides a simple way to plug-in the alternative CORBA support. This is * done by replacing the ORB. The alternative ORB can be specified via * properties, passed to ORB.Init(...). * * When creating an ORB instance, the class name is searched in the following * locations: * <p> * 1. Applet parameter or application string array, if any.<br> * 2. The properties parameter, if any.<br> * 3. The System properties.<br> * 4. The orb.properties file located in the user.home directory (if any).<br> * 5. The orb.properties file located in the java.home/lib directory (if any). * </p> * * The supported properties are: <table border="1"> * <tr> * <td> org.omg.CORBA.ORBClass</td> * <td>The class, implementing the functional ORB, returned by * {@link #init(Applet, Properties)} or {@link #init(String[], Properties)} * </td> * </tr> * <tr> * <td>org.omg.CORBA.ORBSingletonClass</td> * <td>The class, implementing the restricted ORB, returned by {@link #init()}. * </td> * </tr> * <tr> * <td>org.omg.CORBA.ORBInitRef</td> * <td>Specifies the initial reference, accessible by name with the method * {@link #resolve_initial_references(String)}.</td> * </tr> * <tr> * <td>org.omg.CORBA.ORBid</td> * <td>Specifies the name (ORB Id) of this ORB. The ORB Id is later accessible * by {@link ObjectReferenceTemplate#orb_id}. The default value includes the * hashcode of the ORB instance that is normally different for each ORB. * </td> * </tr> * <tr> * <td>org.omg.CORBA.ServerId</td> * <td>Specifies the name (Server Id) of this server. This property assigns * value to the <i>static</i> field, ensuring that all ORB's on the same jre * have the same Server Id. It is normally set as the system property. The * server Id is later accessible as {@link ObjectReferenceTemplate#server_id}. * </td> * </tr> * <tr> * <td>gnu.CORBA.ListenerPort</td> * <td>Specifies that this ORB should serve all its objects on a single port * (for example, "1234") or on a specified port range (for example, * "1100-1108"). The property is used when working with firewals and serves as a * replacement for the proprietary properties like com.ibm.CORBA.ListenerPort * or com.sun.CORBA.POA.ORBPersistentServerPort. The specified port or range * should not overlap with the values, specified for other ORB's. * </td> * </tr> * <tr> * <td>gnu.Corba.SocketFactory</td> * <td>Sets the user-defined server and client socket factory for the ORB being * currently instantiated. Serves as a replacement of the proprietary * property com.sun.CORBA.connection.ORBSocketFactoryClass. To have multiple * types of sockets, instantiate several ORB's with this property each time * set to the different value. * The factory must implement gnu.CORBA.interfaces.SocketFactory. * </td> * </tr> * </table> * <p>The command line accepts the same properties as a keys. When * specifying in the command line, the prefix org.omg.CORBA can be omitted, for * instance<code> -ORBInitRef NameService=IOR:aabbccdd....</code> * </p> * * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */public abstract class ORB{ /** * By default, {@link #init(String[], Properties)} and * {@link #iinit(Applet, Properties)} return * the built-in fully functional ORB is returned. If the * <code>props</code> contains the property org.omg.CORBA.ORBClass, * the value of this property is used as a class name to instantiate * a user-defined ORB. */ private static final String FUNCTIONAL_ORB = "org.omg.CORBA.ORBClass"; /** * The name of the restricted ORB property. */ private static final String RESTRICTED_ORB = "org.omg.CORBA.ORBSingletonClass"; private static final String LISTENER_PORT = OrbFocused.LISTENER_PORT; /** * The class, implementing the default fully functional ORB. */ private static final String DEFAULT_FUNCTIONAL_ORB = gnu.CORBA.Poa.ORB_1_4.class.getName(); private static final String DEFAULT_FOCUSED_ORB = gnu.CORBA.OrbFocused.class.getName(); // There is no need for name of the default restricted ORB as it is // singleton and it is more effectively referred directly. /** * Connect the given CORBA object to this ORB. After the object is * connected, it starts receiving remote invocations via this ORB. * * The OMG group recommends to use Portable Object Adapter (POA) instead * of calling this method. * * This method is implemented in the derived Gnu Classpah classes, * returned by ORB.init(..). In this abstract class, the implementation * just throws {@link NO_IMPLEMENT}. * * @param object the org.omg.CORBA.Object to connect. */ public void connect(org.omg.CORBA.Object object) { throw new NO_IMPLEMENT(); } /** * Disconnect the given CORBA object from this ORB. The object will be * no longer receiving the remote invocations. In response to the * remote invocation on this object, the ORB will send the * exception {@link OBJECT_NOT_EXIST}. The object, however, is not * destroyed and can receive the local invocations. * * This method is implemented in the derived Gnu Classpah classes, * returned by ORB.init(..). In this abstract class, the implementation * just throws {@link NO_IMPLEMENT}. * * @param object the object to disconnect. */ public void disconnect(org.omg.CORBA.Object object) { throw new NO_IMPLEMENT(); } /** * Create alias typecode for the given typecode. */ public abstract TypeCode create_alias_tc(String id, String name, TypeCode typecode ); /** * Create an instance of the CORBA {@link Any} with the type, intialised * to {@link TCKind#tk_null} */ public abstract Any create_any(); /** * Create a typecode, defining an array of the given elements. * * @param length the size of array * @param element_type the array component type. * * @return the corresponding typecode. */ public abstract TypeCode create_array_tc(int length, TypeCode element_type); /** * Creates an empty CORBA <code>ContextList</code>. * * @return the newly created context list. */ public abstract ContextList create_context_list(); /** * The support for {@link DynAny} and derived interfaces * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode t) throws InconsistentTypeCode { throw new NO_IMPLEMENT(); } ; /** * The support for {@link DynAny} and derived interfaces * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynAny create_dyn_any(org.omg.CORBA.Any a) { throw new NO_IMPLEMENT(); } ; /** * The support for {@link DynArray} * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynArray create_dyn_array(org.omg.CORBA.TypeCode t) throws InconsistentTypeCode { throw new NO_IMPLEMENT(); } ; /** * The support for {@link DynEnum} * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynEnum create_dyn_enum(org.omg.CORBA.TypeCode t) throws InconsistentTypeCode { throw new NO_IMPLEMENT(); } ; /** * The support for {@link DynSequence} * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode t) throws InconsistentTypeCode { throw new NO_IMPLEMENT(); } ; /** * The support for {@link DynStruct} and derived interfaces * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynStruct create_dyn_struct(org.omg.CORBA.TypeCode t) throws InconsistentTypeCode { throw new NO_IMPLEMENT(); } ; /** * The support for {@link DynUnion} and derived interfaces * has never been implemented in Sun's java releases, * at least till v1.4 inclusive. * * Since v1.4 this stil missing implementation was replaced * by the new DynamicAny package. * * @throws NO_IMPLEMENT, always. */ public DynUnion create_dyn_union(org.omg.CORBA.TypeCode t) throws InconsistentTypeCode { throw new NO_IMPLEMENT(); } ; /** * Create a typecode, defining the given enumeration. * * @param id the id. * @param name the name. * @param members the memebers * @return the created enumeration. */ public abstract TypeCode create_enum_tc(String id, String name, String[] members ); /** * Create an environment (container for exceptions). * * @return the created container. */ public abstract Environment create_environment(); /** * Creates an empty exception list. * * @return the newly created list. */ public abstract ExceptionList create_exception_list(); /** * Create the exception typecode. * * @param id the id of exception. * @param name the name of exception. * @param members the members of exception. */ public abstract TypeCode create_exception_tc(String id, String name, StructMember[] members ); /** * Creates a TypeCode object for CORBA <code>fixed</code> that is * mapped to java {@link java.math.BigDecimal}. * * @param digits the number of digits in that <code>fixed</code>. * @param scale the number of digits after the decimal point. * * @return the corresponding TypeCode. */ public TypeCode create_fixed_tc(short digits, short scale) { FixedTypeCode r = new FixedTypeCode(); r.setDigits(digits); r.setScale(scale); return r; } /** * Creates a typecode, representing the IDL interface. * * @param id the interface repository id. * @param name the interface name.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -