public org . omg . CORBA . Object referenceForLocator ( final EJBLocator < ? > locator ) { final EJBComponent ejbComponent = ejbComponentInjectedValue . getValue ( ) ; try { final String earApplicationName = ejbComponent . getEarApplicationName ( ) == null ? "" : ejbComponent . getEarApplicationName ( ) ; if ( locator . getBeanName ( ) . equals ( ejbComponent . getComponentName ( ) ) && locator . getAppName ( ) . equals ( earApplicationName ) && locator . getModuleName ( ) . equals ( ejbComponent . getModuleName ( ) ) && locator . getDistinctName ( ) . equals ( ejbComponent . getDistinctName ( ) ) ) { if ( locator instanceof EJBHomeLocator ) { return ( org . omg . CORBA . Object ) ejbHome ; } else if ( locator instanceof StatelessEJBLocator ) { return beanReferenceFactory . createReference ( beanRepositoryIds [ 0 ] ) ; } else if ( locator instanceof StatefulEJBLocator ) { final Marshaller marshaller = factory . createMarshaller ( configuration ) ; final ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; marshaller . start ( new OutputStreamByteOutput ( stream ) ) ; marshaller . writeObject ( ( ( StatefulEJBLocator < ? > ) locator ) . getSessionId ( ) ) ; marshaller . finish ( ) ; return beanReferenceFactory . createReferenceWithId ( stream . toByteArray ( ) , beanRepositoryIds [ 0 ] ) ; } else if ( locator instanceof EntityEJBLocator ) { final Marshaller marshaller = factory . createMarshaller ( configuration ) ; final ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; marshaller . start ( new OutputStreamByteOutput ( stream ) ) ; marshaller . writeObject ( ( ( EntityEJBLocator < ? > ) locator ) . getPrimaryKey ( ) ) ; marshaller . finish ( ) ; return beanReferenceFactory . createReferenceWithId ( stream . toByteArray ( ) , beanRepositoryIds [ 0 ] ) ; } throw EjbLogger . ROOT_LOGGER . unknownEJBLocatorType ( locator ) ; } else { throw EjbLogger . ROOT_LOGGER . incorrectEJBLocatorForBean ( locator , ejbComponent . getComponentName ( ) ) ; } } catch ( Exception e ) { throw EjbLogger . ROOT_LOGGER . couldNotCreateCorbaObject ( e , locator ) ; } }
Returns a corba reference for the given locator