⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 namingcontextimpl.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/* * @(#)NamingContextImpl.java	1.18 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. *//* * @(#)NamingContextImpl.java 1.4 00/02/07 * * Copyright 1993-1997 Sun Microsystems, Inc. 901 San Antonio Road, * Palo Alto, California, 94303, U.S.A.  All Rights Reserved. * * This software is the confidential and proprietary information of Sun * Microsystems, Inc. ("Confidential Information").  You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Sun. * * CopyrightVersion 1.2 * */package com.sun.corba.se.impl.naming.pcosnaming;import org.omg.CORBA.Object;import org.omg.CORBA.SystemException;import org.omg.CORBA.BAD_PARAM;import org.omg.CORBA.CompletionStatus;import org.omg.CORBA.Policy;import org.omg.PortableServer.POA;import org.omg.PortableServer.LifespanPolicyValue;import org.omg.PortableServer.RequestProcessingPolicyValue;import org.omg.PortableServer.IdAssignmentPolicyValue;import org.omg.PortableServer.ServantRetentionPolicyValue;import org.omg.CosNaming.*;import org.omg.CosNaming.NamingContextPackage.*;import org.omg.CosNaming.NamingContextExtPackage.*;import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;import com.sun.corba.se.impl.naming.cosnaming.NamingUtils;import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;import com.sun.corba.se.spi.orb.ORB;import com.sun.corba.se.spi.logging.CORBALogDomains;import com.sun.corba.se.impl.orbutil.ORBConstants;import com.sun.corba.se.impl.logging.NamingSystemException;import java.io.Serializable;import java.util.Hashtable;/** * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and * NamingContextExt interface. * <p> * The operations bind(), rebind(), bind_context() and rebind_context() * are all really implemented by doBind(). resolve() is really implemented * by doResolve(), unbind() by doUnbind(). list(), new_context() and * destroy() uses the NamingContextDataStore interface directly. All the * doX() methods are public static. * They synchronize on the NamingContextDataStore object. * <p> * None of the methods here are Synchronized because These methods will be * invoked from Super class's doBind( ), doResolve( ) which are already * Synchronized. */public class NamingContextImpl     extends NamingContextExtPOA    implements NamingContextDataStore, Serializable {    // The ORB is required to do string_to_object() operations    // All the references are stored in the files in the form of IOR strings     private transient ORB orb;    // The ObjectKey will be in the format NC<Index> which uniquely identifies    // The NamingContext internaly    private final String objKey;    // Hash table contains all the entries in the NamingContexts. The    // CORBA.Object references will be stored in the form of IOR strings    // and the Child Naming Contexts will have it's key as the entry in the    // table. This table is written into File everytime an update is made     // on this context.    private final Hashtable theHashtable = new Hashtable( );    // The NameServiceHandle is required to get the ObjectId from the    // NamingContext's references. These references are created using    // POA in the NameService.    private transient NameService theNameServiceHandle;    // ServantManager is the single point of contact to Read, Write and    // Update the NamingContextFile    private transient ServantManagerImpl theServantManagerImplHandle;    // All the INS (Interoperable Naming Service) methods are defined in this class    // All the calls to INS will be delegated to this class.    private transient com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl insImpl;    private transient NamingSystemException readWrapper ;    private transient NamingSystemException updateWrapper ;    private static POA biPOA = null;    /**     * Create a naming context servant.     * Runs the super constructor.     * @param orb an ORB object.     * @param objKey as String     * @param TheNameService as NameService     * @param TheServantManagerImpl as ServantManagerImpl     * @exception java.lang.Exception a Java exception.     */    public NamingContextImpl(ORB orb, String objKey,         NameService theNameService, ServantManagerImpl theServantManagerImpl  )	throws Exception    {	super();	this.orb = orb;	readWrapper = NamingSystemException.get( orb, 	    CORBALogDomains.NAMING_READ ) ;	updateWrapper = NamingSystemException.get( orb, 	    CORBALogDomains.NAMING_UPDATE ) ;	debug = true ; // orb.namingDebugFlag ;	this.objKey = objKey;	theNameServiceHandle = theNameService;	theServantManagerImplHandle = theServantManagerImpl;	insImpl =             new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();     }    com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl getINSImpl( )    {	if( insImpl == null )	{            // insImpl will be null if the NamingContext graph is rebuilt from            // the persistence store.	    insImpl =                 new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();	}	return insImpl;    }    public void setRootNameService( NameService theNameService ) {	theNameServiceHandle = theNameService;    }    public void setORB( ORB theOrb ) {	orb = theOrb;    }    public void setServantManagerImpl( 		ServantManagerImpl theServantManagerImpl )    {	theServantManagerImplHandle = theServantManagerImpl;    }    public POA getNSPOA( ) {        return theNameServiceHandle.getNSPOA( );    }   /**   * Bind an object under a name in this NamingContext. If the name   * contains multiple (n) components, n-1 will be resolved in this   * NamingContext and the object bound in resulting NamingContext.   * An exception is thrown if a binding with the supplied name already   * exists. If the   * object to be bound is a NamingContext it will not participate in   * a recursive resolve.   * @param n a sequence of NameComponents which is the name under which   * the object will be bound.   * @param obj the object reference to be bound.   * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple   * components was supplied, but the first component could not be   * resolved.   * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed   * in resolving the n-1 components of the supplied name.   * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name   * is invalid (i.e., has length less than 1).   * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound The supplied name   * is already bound.   * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.   * @see doBind   */   public void bind(NameComponent[] n, org.omg.CORBA.Object obj)        throws org.omg.CosNaming.NamingContextPackage.NotFound,               org.omg.CosNaming.NamingContextPackage.CannotProceed,               org.omg.CosNaming.NamingContextPackage.InvalidName,               org.omg.CosNaming.NamingContextPackage.AlreadyBound    {        if( obj == null ) {	    throw updateWrapper.objectIsNull() ;        }        if (debug)            dprint("bind " + nameToString(n) + " to " + obj);        // doBind implements all four flavors of binding        NamingContextDataStore impl = (NamingContextDataStore)this;        doBind(impl,n,obj,false,BindingType.nobject);    }   /**   * Bind a NamingContext under a name in this NamingContext. If the name   * contains multiple (n) components, n-1 will be resolved in this   * NamingContext and the object bound in resulting NamingContext.   * An exception is thrown if a binding with the supplied name already   * exists. The NamingContext will participate in recursive resolving.   * @param n a sequence of NameComponents which is the name under which   * the object will be bound.   * @param obj the NamingContect object reference to be bound.   * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple   * components was supplied, but the first component could not be   * resolved.   * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed   * in resolving the n-1 components of the supplied name.   * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name   * is invalid (i.e., has length less than 1).   * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is   * already bound under the supplied name.   * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.   * @see doBind   */   public void bind_context(NameComponent[] n, NamingContext nc)        throws org.omg.CosNaming.NamingContextPackage.NotFound,               org.omg.CosNaming.NamingContextPackage.CannotProceed,               org.omg.CosNaming.NamingContextPackage.InvalidName,               org.omg.CosNaming.NamingContextPackage.AlreadyBound    {        if( nc == null ) {	    throw updateWrapper.objectIsNull() ;        }        // doBind implements all four flavors of binding        NamingContextDataStore impl = (NamingContextDataStore)this;        doBind(impl,n,nc,false,BindingType.ncontext);    } /**   * Bind an object under a name in this NamingContext. If the name   * contains multiple (n) components, n-1 will be resolved in this   * NamingContext and the object bound in resulting NamingContext.   * If a binding under the supplied name already exists it will be   * unbound first. If the   * object to be bound is a NamingContext it will not participate in   * a recursive resolve.   * @param n a sequence of NameComponents which is the name under which   * the object will be bound.   * @param obj the object reference to be bound.   * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple   * components was supplied, but the first component could not be   * resolved.   * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed   * in resolving the n-1 components of the supplied name.   * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name   * is invalid (i.e., has length less than 1).   * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.   * @see doBind   */   public  void rebind(NameComponent[] n, org.omg.CORBA.Object obj)        throws       org.omg.CosNaming.NamingContextPackage.NotFound,                     org.omg.CosNaming.NamingContextPackage.CannotProceed,                     org.omg.CosNaming.NamingContextPackage.InvalidName    {        if( obj == null )        {	    throw updateWrapper.objectIsNull() ;        }        try {            if (debug)                dprint("rebind " + nameToString(n) + " to " + obj);            // doBind implements all four flavors of binding            NamingContextDataStore impl = (NamingContextDataStore)this;            doBind(impl,n,obj,true,BindingType.nobject);        } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {            // This should not happen	    throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;        }    }   /**   * Bind a NamingContext under a name in this NamingContext. If the name   * contains multiple (n) components, the first n-1 components will be   * resolved in this   * NamingContext and the object bound in resulting NamingContext.   * If a binding under the supplied name already exists it will be   * unbound first. The NamingContext will participate in recursive resolving.   * @param n a sequence of NameComponents which is the name under which   * the object will be bound.   * @param obj the object reference to be bound.   * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple   * components was supplied, but the first component could not be   * resolved.   * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed   * in resolving the n-1 components of the supplied name.   * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name   * is invalid (i.e., has length less than 1).   * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.   * @see doBind   */   public  void rebind_context(NameComponent[] n, NamingContext nc)        throws org.omg.CosNaming.NamingContextPackage.NotFound,               org.omg.CosNaming.NamingContextPackage.CannotProceed,               org.omg.CosNaming.NamingContextPackage.InvalidName    {        try {            if (debug)                dprint("rebind_context " + nameToString(n) + " to " + nc);            // doBind implements all four flavors of binding            NamingContextDataStore impl = (NamingContextDataStore)this;            doBind(impl,n,nc,true,BindingType.ncontext);        } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {            // This should not happen	    throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;        }

⌨️ 快捷键说明

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