FileDocCategorySizeDatePackage
ServiceContextRegistry.javaAPI DocJava SE 5 API2250Fri Aug 26 14:54:40 BST 2005com.sun.corba.se.spi.servicecontext

ServiceContextRegistry

public class ServiceContextRegistry extends Object

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private Vector
scCollection
Constructors Summary
public ServiceContextRegistry(com.sun.corba.se.spi.orb.ORB orb)

	scCollection = new Vector() ;
	this.orb = orb ;
    
Methods Summary
private voiddprint(java.lang.String msg)

	ORBUtility.dprint( this, msg ) ;
    
public com.sun.corba.se.spi.servicecontext.ServiceContextDatafindServiceContextData(int scId)

	if (ORB.ORBInitDebug)
	    dprint( "Searching registry for service context id " + scId ) ;
	
	Enumeration enumeration = scCollection.elements() ;
	while (enumeration.hasMoreElements()) {
	    ServiceContextData scd = 
		(ServiceContextData)(enumeration.nextElement()) ;
	    if (scd.getId() == scId) {
		if (ORB.ORBInitDebug)
		    dprint( "Service context data found: " + scd ) ;

		return scd ;
	    }
	}

	if (ORB.ORBInitDebug)
	    dprint( "Service context data not found" ) ;

	return null ;
    
public voidregister(java.lang.Class cls)
Register the ServiceContext class so that it will be recognized by the read method. Class cls must have the following properties:
  • It must derive from com.sun.corba.se.spi.servicecontext.ServiceContext.
  • It must have a public static final int SERVICE_CONTEXT_ID member.
  • It must implement a constructor that takes a org.omg.CORBA_2_3.portable.InputStream argument.

	if (ORB.ORBInitDebug)
	    dprint( "Registering service context class " + cls ) ;
	
	ServiceContextData scd = new ServiceContextData( cls ) ;

	if (findServiceContextData(scd.getId()) == null)
	    scCollection.addElement( scd ) ;
	else
	    throw new BAD_PARAM( "Tried to register duplicate service context" ) ;