FileDocCategorySizeDatePackage
BufferManagerFactory.javaAPI DocJava SE 5 API4685Fri Aug 26 14:54:20 BST 2005com.sun.corba.se.impl.encoding

BufferManagerFactory

public class BufferManagerFactory extends Object
Creates read/write buffer managers to handle over/under flow in CDR*putStream.

Fields Summary
public static final int
GROW
public static final int
COLLECT
public static final int
STREAM
Constructors Summary
Methods Summary
public static com.sun.corba.se.impl.encoding.BufferManagerReaddefaultBufferManagerRead(com.sun.corba.se.spi.orb.ORB orb)

        return new BufferManagerReadGrow(orb);
    
public static com.sun.corba.se.impl.encoding.BufferManagerReadnewBufferManagerRead(com.sun.corba.se.spi.ior.iiop.GIOPVersion version, byte encodingVersion, com.sun.corba.se.spi.orb.ORB orb)


    // The next two methods allow creation of BufferManagers based on GIOP version.
    // We may want more criteria to be involved in this decision.
    // These are only used for sending messages (so could be fragmenting)
       
                  

        // REVISIT - On the reading side, shouldn't we monitor the incoming
        // fragments on a given connection to determine what fragment size
        // they're using, then use that ourselves?

	if (encodingVersion != Message.CDR_ENC_VERSION) {
	    return new BufferManagerReadGrow(orb);
	}

        switch (version.intValue()) 
        {
            case GIOPVersion.VERSION_1_0:
                return new BufferManagerReadGrow(orb);
            case GIOPVersion.VERSION_1_1:
            case GIOPVersion.VERSION_1_2:
                // The stream reader can handle fragmented and
                // non fragmented messages
                return new BufferManagerReadStream(orb);
            default:
                // REVISIT - what is appropriate?
                throw new INTERNAL("Unknown GIOP version: "
                                   + version);
        }
    
public static com.sun.corba.se.impl.encoding.BufferManagerReadnewBufferManagerRead(int strategy, byte encodingVersion, com.sun.corba.se.spi.orb.ORB orb)


	if (encodingVersion != Message.CDR_ENC_VERSION) {
	    if (strategy != BufferManagerFactory.GROW) {
		ORBUtilSystemException wrapper =
		    ORBUtilSystemException.get((ORB)orb,
					       CORBALogDomains.RPC_ENCODING);
		throw wrapper.invalidBuffMgrStrategy("newBufferManagerRead");
	    }
	    return new BufferManagerReadGrow(orb);
	}
        switch (strategy) {
            case BufferManagerFactory.GROW:
                return new BufferManagerReadGrow(orb);
            case BufferManagerFactory.COLLECT:
                throw new INTERNAL("Collect strategy invalid for reading");
            case BufferManagerFactory.STREAM:
                return new BufferManagerReadStream(orb);
            default:
                throw new INTERNAL("Unknown buffer manager read strategy: "
                                   + strategy);
        }
    
public static com.sun.corba.se.impl.encoding.BufferManagerWritenewBufferManagerWrite(int strategy, byte encodingVersion, com.sun.corba.se.spi.orb.ORB orb)

	if (encodingVersion != Message.CDR_ENC_VERSION) {
	    if (strategy != BufferManagerFactory.GROW) {
		ORBUtilSystemException wrapper =
		    ORBUtilSystemException.get((ORB)orb,
					       CORBALogDomains.RPC_ENCODING);
		throw wrapper.invalidBuffMgrStrategy("newBufferManagerWrite");
	    }
	    return new BufferManagerWriteGrow(orb);
	}
        switch (strategy) {
            case BufferManagerFactory.GROW:
                return new BufferManagerWriteGrow(orb);
            case BufferManagerFactory.COLLECT:
                return new BufferManagerWriteCollect(orb);
            case BufferManagerFactory.STREAM:
                return new BufferManagerWriteStream(orb);
            default:
                throw new INTERNAL("Unknown buffer manager write strategy: "
                                   + strategy);
        }
    
public static com.sun.corba.se.impl.encoding.BufferManagerWritenewBufferManagerWrite(com.sun.corba.se.spi.ior.iiop.GIOPVersion version, byte encodingVersion, com.sun.corba.se.spi.orb.ORB orb)

	if (encodingVersion != Message.CDR_ENC_VERSION) {
	    return new BufferManagerWriteGrow(orb);
	}
        return BufferManagerFactory.newBufferManagerWrite(
	    orb.getORBData().getGIOPBuffMgrStrategy(version),
	    encodingVersion, orb);