cdrinputstream_1_0.java

来自「JAVA 所有包」· Java 代码 · 共 1,977 行 · 第 1/5 页

JAVA
1,977
字号
        } else if (StubAdapter.isStubClass( clz )) {	    stubFactory = PresentationDefaults.makeStaticStubFactory(		clz ) ;	} else {	    // clz is an interface class	    boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;	    stubFactory = sff.createStubFactory( clz.getName(), 		isIDL, codeBase, clz, clz.getClassLoader() ) ;	}	return internalIORToObject( ior, stubFactory, orb ) ;    }    /*     * This is used as a general utility (e.g., the PortableInterceptor     * implementation uses it.   If stubFactory is null, the ior's     * IIOPProfile must support getServant.     */    public static org.omg.CORBA.Object internalIORToObject(        IOR ior, PresentationManager.StubFactory stubFactory, ORB orb)    {	ORBUtilSystemException wrapper = ORBUtilSystemException.get( 	    (ORB)orb, CORBALogDomains.RPC_ENCODING ) ;	java.lang.Object servant = ior.getProfile().getServant() ;	if (servant != null ) {	    if (servant instanceof Tie) {		String codebase = ior.getProfile().getCodebase();		org.omg.CORBA.Object objref = (org.omg.CORBA.Object)		    Utility.loadStub( (Tie)servant, stubFactory, codebase, 			false);		    		// If we managed to load a stub, return it, otherwise we		// must fail...		if (objref != null) {		    return objref;   		} else {		    throw wrapper.readObjectException() ;		}	    } else if (servant instanceof org.omg.CORBA.Object) {		if (!(servant instanceof 			org.omg.CORBA.portable.InvokeHandler)) {		    return (org.omg.CORBA.Object) servant;		}	    } else		throw wrapper.badServantReadObject() ;	}	CorbaClientDelegate del = ORBUtility.makeClientDelegate( ior ) ;	org.omg.CORBA.Object objref = null ;	try {	    objref = stubFactory.makeStub() ;	} catch (Throwable e) {	    wrapper.stubCreateError( e ) ;	    if (e instanceof ThreadDeath) {		throw (ThreadDeath) e;	    }            // Return the "default" stub...            objref = new CORBAObjectImpl() ; 	    	}        	StubAdapter.setDelegate( objref, del ) ;	return objref;    }     public java.lang.Object read_abstract_interface()     {        return read_abstract_interface(null);    }    public java.lang.Object read_abstract_interface(java.lang.Class clz)     {    	boolean object = read_boolean();        if (object) {            return read_Object(clz);        } else {            return read_value();	}    }    public Serializable read_value()     {        return read_value((Class)null);    }    private Serializable handleIndirection() {        int indirection = read_long() + get_offset() - 4;        if (valueCache != null && valueCache.containsVal(indirection)) {            java.io.Serializable cachedValue                = (java.io.Serializable)valueCache.getKey(indirection);            return cachedValue;        } else {            // In RMI-IIOP the ValueHandler will recognize this            // exception and use the provided indirection value            // to lookup a possible indirection to an object            // currently on the deserialization stack.            throw new IndirectionException(indirection);        }    }    private String readRepositoryIds(int valueTag,                                     Class expectedType,                                     String expectedTypeRepId) {	return readRepositoryIds(valueTag, expectedType,				 expectedTypeRepId, null);    }    /**     * Examines the valuetag to see how many (if any) repository IDs     * are present on the wire.  If no repository ID information     * is on the wire but the expectedType or expectedTypeRepId     * is known, it will return one of those (favoring the     * expectedType's repId). Failing that, it uses the supplied      * BoxedValueHelper to obtain the repository ID, as a last resort.     */    private String readRepositoryIds(int valueTag,                                     Class expectedType,                                     String expectedTypeRepId,				     BoxedValueHelper factory) {        switch(repIdUtil.getTypeInfo(valueTag)) {            case RepositoryIdUtility.NO_TYPE_INFO :                // Throw an exception if we have no repository ID info and                // no expectedType to work with.  Otherwise, how would we                // know what to unmarshal?                if (expectedType == null) {                    if (expectedTypeRepId != null) {                        return expectedTypeRepId;                    } else if (factory != null) {			return factory.get_id();		    } else {			throw wrapper.expectedTypeNullAndNoRepId( 			    CompletionStatus.COMPLETED_MAYBE);		    }                }                return repIdStrs.createForAnyType(expectedType);            case RepositoryIdUtility.SINGLE_REP_TYPE_INFO :                return read_repositoryId();             case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO :                return read_repositoryIds();            default:		throw wrapper.badValueTag( CompletionStatus.COMPLETED_MAYBE,		    Integer.toHexString(valueTag) ) ;        }    }    public Serializable read_value(Class expectedType) {        // Read value tag        int vType = readValueTag();        // Is value null?        if (vType == 0)            return null;        // Is this an indirection to a previously        // read valuetype?        if (vType == 0xffffffff)            return handleIndirection();        // Save where this valuetype started so we        // can put it in the indirection valueCache        // later        int indirection = get_offset() - 4;        // Need to save this special marker variable        // to restore its value during recursion        boolean saveIsChunked = isChunked;        isChunked = repIdUtil.isChunkedEncoding(vType);			        java.lang.Object value = null;			        String codebase_URL = null;			        if (repIdUtil.isCodeBasePresent(vType)) {            codebase_URL = read_codebase_URL();        }			        // Read repository id(s)        String repositoryIDString            = readRepositoryIds(vType, expectedType, null);        // If isChunked was determined to be true based        // on the valuetag, this will read a chunk length        start_block();        // Remember that end_flag keeps track of all nested        // valuetypes and is used for older ORBs        end_flag--;        if (isChunked)            chunkedValueNestingLevel--;        if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) {            value = read_wstring();        } else               if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) {            // read in the class whether with the old ClassDesc or the            // new one            value = readClass();        } else {       				            Class valueClass = expectedType;            // By this point, either the expectedType or repositoryIDString            // is guaranteed to be non-null.            if (expectedType == null ||                 !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType))) {                valueClass = getClassFromString(repositoryIDString,                                                codebase_URL,                                                expectedType);            }            if (valueClass == null) {                // No point attempting to use value handler below, since the                // class information is not available.                throw wrapper.couldNotFindClass(                    CompletionStatus.COMPLETED_MAYBE,                    new ClassNotFoundException());            }                        if (valueClass != null &&                 org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) {					                value =  readIDLValue(indirection,                                      repositoryIDString,                                      valueClass,                                      codebase_URL);            } else {                // Must be some form of RMI-IIOP valuetype                try {                    if (valueHandler == null)                        valueHandler = ORBUtility.createValueHandler(orb);                    value = valueHandler.readValue(parent,                                                   indirection,                                                   valueClass,                                                    repositoryIDString,                                                   getCodeBase());                } catch(SystemException sysEx) {                    // Just rethrow any CORBA system exceptions                    // that come out of the ValueHandler                    throw sysEx;                } catch(Exception ex) {		    throw wrapper.valuehandlerReadException( 			CompletionStatus.COMPLETED_MAYBE, ex ) ;                } catch(Error e) {		    throw wrapper.valuehandlerReadError( 			CompletionStatus.COMPLETED_MAYBE, e ) ;                }            }        }                // Skip any remaining chunks until we get to        // an end tag or a valuetag.  If we see a valuetag,        // that means there was another valuetype in the sender's        // version of this class that we need to skip over.        handleEndOfValue();                // Read and process the end tag if we're chunking.        // Assumes that we're at the position of the end tag        // (handleEndOfValue should assure this)        readEndTag();                    // Cache the valuetype that we read        if (valueCache == null)            valueCache = new CacheTable(orb,false);        valueCache.put(value, indirection);                // Allow for possible continuation chunk.        // If we're a nested valuetype inside of a chunked        // valuetype, and that enclosing valuetype has        // more data to write, it will need to have this        // new chunk begin after we wrote our end tag.        isChunked = saveIsChunked;        start_block();                return (java.io.Serializable)value;    }    public Serializable read_value(BoxedValueHelper factory) {        // Read value tag        int vType = readValueTag();        if (vType == 0)            return null; // value is null        else if (vType == 0xffffffff) { // Indirection tag            int indirection = read_long() + get_offset() - 4;            if (valueCache != null && valueCache.containsVal(indirection))		{		    java.io.Serializable cachedValue =                            (java.io.Serializable)valueCache.getKey(indirection);		    return cachedValue;		}            else {		throw new IndirectionException(indirection);	    }	}        else {	    int indirection = get_offset() - 4;	    // end_block();	    boolean saveIsChunked = isChunked;	    isChunked = repIdUtil.isChunkedEncoding(vType);	    java.lang.Object value = null;	    String codebase_URL = null;				    if (repIdUtil.isCodeBasePresent(vType)){		codebase_URL = read_codebase_URL();	    }            // Read repository id            String repositoryIDString                = readRepositoryIds(vType, null, null, factory);            // Compare rep. ids to see if we should use passed helper            if (!repositoryIDString.equals(factory.get_id()))		factory = Utility.getHelper(null, codebase_URL, repositoryIDString);	    start_block();	    end_flag--;            if (isChunked)                chunkedValueNestingLevel--;	    	    if (factory instanceof ValueHelper) {		value = readIDLValueWithHelper((ValueHelper)factory, indirection);	    } else {		valueIndirection = indirection;  // for callback		value = factory.read_value(parent);	    }	    handleEndOfValue();	    readEndTag();	    // Put into valueCache	    if (valueCache == null)		valueCache = new CacheTable(orb,false);	    valueCache.put(value, indirection);		    // allow for possible continuation chunk	    isChunked = saveIsChunked;	    start_block();            return (java.io.Serializable)value;        }    }    private boolean isCustomType(ValueHelper helper) {	try{	    TypeCode tc = helper.get_type();	    int kind = tc.kind().value();	    if (kind == TCKind._tk_value) {		return (tc.type_modifier() == org.omg.CORBA.VM_CUSTOM.value);	    }	} catch(BadKind ex) {	    throw wrapper.badKind(ex) ;	}	return false;    }    // This method is actually called indirectly by     // read_value(String repositoryId).    // Therefore, it is not a truly independent read call that handles    // header information itself.    public java.io.Serializable read_value(java.io.Serializable value) {	// Put into valueCache using valueIndirection	if (valueCache == null)	    valueCache = new CacheTable(orb,false);	valueCache.put(value, valueIndirection);	if (value instanceof StreamableValue)	    ((StreamableValue)value)._read(parent);	else if (value instanceof CustomValue)	    ((CustomValue)value).unmarshal(parent);				return value;    }    public java.io.Serializable read_value(java.lang.String repositoryId) {	// if (inBlock)	//    end_block();

⌨️ 快捷键说明

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