orbsingleton.java

来自「java jdk 1.4的源码」· Java 代码 · 共 588 行 · 第 1/2 页

JAVA
588
字号
/* * @(#)ORBSingleton.java	1.38 03/01/23 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. *//* * Licensed Materials - Property of IBM * RMI-IIOP v1.0 * Copyright IBM Corp. 1998 1999  All Rights Reserved * * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */package com.sun.corba.se.internal.corba;import java.util.Collection;import java.util.Properties;import java.util.Hashtable;import java.applet.Applet;import java.net.URL;import org.omg.CORBA.CompletionStatus;import org.omg.CORBA.Context;import org.omg.CORBA.ContextList;import org.omg.CORBA.Environment;import org.omg.CORBA.ExceptionList;import org.omg.CORBA.ORBPackage.InvalidName;import org.omg.CORBA.NVList;import org.omg.CORBA.TCKind;import org.omg.CORBA.NamedValue;import org.omg.CORBA.ORB;import org.omg.CORBA.Object;import org.omg.CORBA.Request;import org.omg.CORBA.TypeCode;import org.omg.CORBA.Any;import org.omg.CORBA.StructMember;import org.omg.CORBA.UnionMember;import org.omg.CORBA.ValueMember;import org.omg.CORBA.NO_IMPLEMENT;import org.omg.CORBA.portable.OutputStream;import com.sun.corba.se.connection.ORBSocketFactory;import com.sun.corba.se.internal.core.ClientGIOP;import com.sun.corba.se.internal.core.MarshalInputStream;import com.sun.corba.se.internal.core.MarshalOutputStream;import com.sun.corba.se.internal.core.ORBVersion;import com.sun.corba.se.internal.core.ORBVersionFactory;import com.sun.corba.se.internal.core.ServerGIOP;import com.sun.corba.se.internal.core.ServiceContextRegistry;import com.sun.corba.se.internal.core.SubcontractRegistry;import com.sun.corba.se.internal.core.CodeSetComponentInfo;import com.sun.corba.se.internal.core.IOR;import com.sun.corba.se.internal.core.EndPoint;import com.sun.corba.se.internal.core.GIOPVersion;import com.sun.corba.se.internal.iiop.BufferManagerFactory;import com.sun.corba.se.internal.orbutil.ORBConstants;import com.sun.corba.se.internal.POA.POAORB;/* * The restricted singleton ORB implementation. * * For now, this class must implement just enough functionality to be * used as a factory for immutable TypeCode instances. * * See ORB.java for the real ORB implementation. */public class ORBSingleton    // This was changed from extending core.ORB so that it can    // work for read_Object.    extends com.sun.corba.se.internal.corba.ORB    implements TypeCodeFactory{    // GIOP Version    // Default is 1.0.  We will change it to 1.2 later.    protected GIOPVersion giopVersion = GIOPVersion.DEFAULT_VERSION;    // This map is needed for resolving recursive type code placeholders    // based on the unique repository id.    // _REVISIT_ No garbage collection. For Java2 use WeakHashMap.    private Hashtable typeCodeMap = null;    // This is used to support read_Object.    private static POAORB fullORB;    protected void set_parameters(Applet app, Properties props) {    }    protected void set_parameters (String params[], Properties props) {    }    /*     * We must support these methods to act as a TypeCode factory.     */    public OutputStream create_output_stream() {        return new EncapsOutputStream(this);    }    public TypeCode get_primitive_tc(TCKind tcKind) {	// _REVISIT_ if this returns a null, throw an exception perhaps?        return TypeCodeImpl.get_primitive_tc(tcKind);    }    public TypeCode create_struct_tc(String id,				     String name,				     StructMember[] members)    {        return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members);    }      public TypeCode create_union_tc(String id,				    String name,				    TypeCode discriminator_type,				    UnionMember[] members)    {        return new TypeCodeImpl(this,				TCKind._tk_union, 				id, 				name, 				discriminator_type, 				members);    }      public TypeCode create_enum_tc(String id,				   String name,				   String[] members)    {        return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members);    }      public TypeCode create_alias_tc(String id,				    String name,				    TypeCode original_type)    {        return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type);    }      public TypeCode create_exception_tc(String id,					String name,					StructMember[] members)    {        return new TypeCodeImpl(this, TCKind._tk_except, id, name, members);    }      public TypeCode create_interface_tc(String id,					String name)    {        return new TypeCodeImpl(this, TCKind._tk_objref, id, name);    }      public TypeCode create_string_tc(int bound) {        return new TypeCodeImpl(this, TCKind._tk_string, bound);    }      public TypeCode create_wstring_tc(int bound) {        return new TypeCodeImpl(this, TCKind._tk_wstring, bound);    }      public TypeCode create_sequence_tc(int bound,				       TypeCode element_type)    {        return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type);    }      public TypeCode create_recursive_sequence_tc(int bound,						 int offset)    {        return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset);    }      public TypeCode create_array_tc(int length,				    TypeCode element_type)    {        return new TypeCodeImpl(this, TCKind._tk_array, length, element_type);    }    public org.omg.CORBA.TypeCode create_native_tc(String id,						   String name)    {        return new TypeCodeImpl(this, TCKind._tk_native, id, name);    }    public org.omg.CORBA.TypeCode create_abstract_interface_tc(							       String id,							       String name)    {        return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name);    }    public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale)    {        return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale);    }    // orbos 98-01-18: Objects By Value -- begin    public org.omg.CORBA.TypeCode create_value_tc(String id,                                                  String name,                                                  short type_modifier,                                                  TypeCode concrete_base,                                                  ValueMember[] members)    {        return new TypeCodeImpl(this, TCKind._tk_value, id, name,                                type_modifier, concrete_base, members);    }    public org.omg.CORBA.TypeCode create_recursive_tc(String id) {        return new TypeCodeImpl(this, id);    }    public org.omg.CORBA.TypeCode create_value_box_tc(String id,						      String name,						      TypeCode boxed_type)    {        return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, boxed_type);    }    public Any create_any() {        return new AnyImpl(this);    }    // TypeCodeFactory interface methods.    // Keeping track of type codes by repository id.    public void setTypeCode(String id, TypeCodeImpl code) {        if (typeCodeMap == null)            typeCodeMap = new Hashtable(64);        typeCodeMap.put(id, code);    }    public TypeCodeImpl getTypeCode(String id) {        if (typeCodeMap == null)            return null;        return (TypeCodeImpl)typeCodeMap.get(id);    }    /*     * Not strictly needed for TypeCode factory duty but these seem     * harmless enough.     */    public NVList create_list(int count) {        return new NVListImpl(this, count);    }    public org.omg.CORBA.NVList	create_operation_list(org.omg.CORBA.Object oper) {        throw new NO_IMPLEMENT();    }    public org.omg.CORBA.NamedValue	create_named_value(String s, Any any, int flags) {        return new NamedValueImpl(this, s, any, flags);    }    public org.omg.CORBA.ExceptionList create_exception_list() {	return new ExceptionListImpl();    }    public org.omg.CORBA.ContextList create_context_list() {        return new ContextListImpl(this);    }    public org.omg.CORBA.Context get_default_context() {        throw new NO_IMPLEMENT();    }    public org.omg.CORBA.Environment create_environment() {        return new EnvironmentImpl();    }    public org.omg.CORBA.Current get_current() {        throw new NO_IMPLEMENT();    }    /*     * Things that aren't allowed.     */    public String[] list_initial_services () {	throw new NO_IMPLEMENT();    }    public org.omg.CORBA.Object resolve_initial_references(String identifier)	throws InvalidName    {	throw new NO_IMPLEMENT();    }    public void register_initial_reference(         String id, org.omg.CORBA.Object obj ) throws InvalidName

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?