public Object getObjectInstance ( Object obj , Name name , Context nameCtx , Hashtable < ? , ? > environment ) throws Exception { AmbiguousEJBReferenceException ambiguousEx ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getObjectInstance : " + obj ) ; // ----------------------------------------------------------------------- // Is obj a Reference? // ----------------------------------------------------------------------- if ( ! ( obj instanceof Reference ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + "Reference object not provided : " + obj ) ; return null ; } Reference ref = ( Reference ) obj ; // ----------------------------------------------------------------------- // Is the right factory for this reference? // ----------------------------------------------------------------------- if ( ! ref . getFactoryClassName ( ) . equals ( CLASS_NAME ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + "Incorrect factory for Reference : " + obj ) ; return null ; } // ----------------------------------------------------------------------- // Is address null? // ----------------------------------------------------------------------- RefAddr addr = ref . get ( ADDR_TYPE ) ; if ( addr == null ) { NamingException nex = new NamingException ( "The address for this Reference is empty (null)" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + nex ) ; throw nex ; } // ----------------------------------------------------------------------- // Reference has the right factory and non empty address, so it is OK // to generate the AmbiguousEJBReferenceException object now. // ----------------------------------------------------------------------- String message = ( String ) addr . getContent ( ) ; ambiguousEx = new AmbiguousEJBReferenceException ( message ) ; // Note : A Tr.warning should NOT be logged here, as this may be // normal path for ejb-ref resolution. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectInstance : " + ambiguousEx . getMessage ( ) ) ; throw ambiguousEx ; }
The method is part of the java . naming . spi . ObjectFactory interface and is invoked by javax . naming . spi . NamingManager to process a Reference object .