public function registerEpbReference(EpbReferenceDescriptorInterface $epbReference)
    {

        try {
            // load the application instance and reference name
            $application = $this->getApplication();
            $name = $epbReference->getRefName();

            // initialize the bean's URI
            $uri = sprintf('php:global/%s/%s', $application->getUniqueName(), $name);

            // query whether the reference has already been bound to the application
            if ($application->getNamingDirectory()->isBound($uri)) {
                // log a message that the reference has already been bound
                $application->getInitialContext()->getSystemLogger()->debug(
                    sprintf('Enterprise bean reference %s has already been bound to naming directory', $uri)
                );

                // return immediately
                return;
            }

            // this has to be refactored, because it'll be quite faster to inject either
            // the remote/local proxy instance as injection a callback that creates the
            // proxy on-the-fly!

            // query whether or not we've a lookup name specified
            if ($lookup = $epbReference->getLookup()) {
                // create a reference to a bean in the global directory
                $application->getNamingDirectory()->bind($uri, array(&$this, 'lookup'), array($lookup));

            // try to load the bean name, if no lookup name has been specified
            } elseif ($beanName = $epbReference->getBeanName()) {
                // query whether we've a local business interface
                if ($epbReference->getBeanInterface() === sprintf('%sLocal', $beanName)) {
                    // bind the local business interface of the bean to the appliations naming directory
                    $application->getNamingDirectory()
                                ->bind(
                                    $uri,
                                    array(&$this, 'lookupProxy'),
                                    array(sprintf('%s/local', $beanName))
                                );

                // query whether we've a remote business interface
                } elseif ($epbReference->getBeanInterface() === (sprintf('%sRemote', $beanName))) {
                    // bind the remote business interface of the bean to the applications naming directory
                    $application->getNamingDirectory()
                                ->bind(
                                    $uri,
                                    array(&$this, 'lookupProxy'),
                                    array(sprintf('%s/remote', $beanName))
                                );

                // at least, we need a business interface
                } else {
                    // log a critical message that we can't bind the reference
                    $application->getInitialContext()->getSystemLogger()->critical(
                        sprintf('Can\'t bind bean reference %s to naming directory', $uri)
                    );
                }

            } else {
                $application->getInitialContext()->getSystemLogger()->critical(
                    sprintf('Can\'t bind enterprise bean reference %s to naming directory, because of missing lookup/bean name', $uri)
                );
            }

        // catch all other exceptions
        } catch (\Exception $e) {
            $application->getInitialContext()->getSystemLogger()->critical($e->__toString());
        }
    }
public function registerEpbReference(EpbReferenceDescriptorInterface $epbReference)
    {

        try {
            // load the application instance and reference name
            $application = $this->getApplication();
            $name = $epbReference->getRefName();

            // initialize the bean's URI
            $uri = sprintf('php:global/%s/%s', $application->getUniqueName(), $name);

            // query whether the reference has already been bound to the application
            if ($application->getNamingDirectory()->isBound($uri)) {
                // log a message that the reference has already been bound
                $application->getInitialContext()->getSystemLogger()->debug(
                    sprintf('Enterprise bean reference %s has already been bound to naming directory', $uri)
                );

                // return immediately
                return;
            }

            // this has to be refactored, because it'll be quite faster to inject either
            // the remote/local proxy instance as injection a callback that creates the
            // proxy on-the-fly!

            // query whether or not we've a lookup name specified
            if ($lookup = $epbReference->getLookup()) {
                // create a reference to a bean in the global directory
                $application->getNamingDirectory()->bind($uri, array(&$this, 'lookup'), array($lookup));

            // try to load the bean name, if no lookup name has been specified
            } elseif ($beanName = $epbReference->getBeanName()) {
                // query whether we've a local business interface
                if ($epbReference->getBeanInterface() === sprintf('%sLocal', $beanName)) {
                    // bind the local business interface of the bean to the appliations naming directory
                    $application->getNamingDirectory()
                                ->bind(
                                    $uri,
                                    array(&$this, 'lookupProxy'),
                                    array(sprintf('%s/local', $beanName))
                                );

                // query whether we've a remote business interface
                } elseif ($epbReference->getBeanInterface() === (sprintf('%sRemote', $beanName))) {
                    // bind the remote business interface of the bean to the applications naming directory
                    $application->getNamingDirectory()
                                ->bind(
                                    $uri,
                                    array(&$this, 'lookupProxy'),
                                    array(sprintf('%s/remote', $beanName))
                                );

                // at least, we need a business interface
                } else {
                    // log a critical message that we can't bind the reference
                    $application->getInitialContext()->getSystemLogger()->critical(
                        sprintf('Can\'t bind bean reference %s to naming directory', $uri)
                    );
                }

            } else {
                $application->getInitialContext()->getSystemLogger()->critical(
                    sprintf('Can\'t bind enterprise bean reference %s to naming directory, because of missing lookup/bean name', $uri)
                );
            }

        // catch all other exceptions
        } catch (\Exception $e) {
            $application->getInitialContext()->getSystemLogger()->critical($e->__toString());
        }
    }
public function registerEpbReference ( EpbReferenceDescriptorInterface $ epbReference ) { try { // load the application instance and reference name $ application = $ this -> getApplication ( ) ; $ name = $ epbReference -> getRefName ( ) ; // initialize the bean's URI $ uri = sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ name ) ; // query whether the reference has already been bound to the application if ( $ application -> getNamingDirectory ( ) -> isBound ( $ uri ) ) { // log a message that the reference has already been bound $ application -> getInitialContext ( ) -> getSystemLogger ( ) -> debug ( sprintf ( 'Enterprise bean reference %s has already been bound to naming directory' , $ uri ) ) ; // return immediately return ; } // this has to be refactored, because it'll be quite faster to inject either // the remote/local proxy instance as injection a callback that creates the // proxy on-the-fly! // query whether or not we've a lookup name specified if ( $ lookup = $ epbReference -> getLookup ( ) ) { // create a reference to a bean in the global directory $ application -> getNamingDirectory ( ) -> bind ( $ uri , array ( & $ this , 'lookup' ) , array ( $ lookup ) ) ; // try to load the bean name, if no lookup name has been specified } elseif ( $ beanName = $ epbReference -> getBeanName ( ) ) { // query whether we've a local business interface if ( $ epbReference -> getBeanInterface ( ) === sprintf ( '%sLocal' , $ beanName ) ) { // bind the local business interface of the bean to the appliations naming directory $ application -> getNamingDirectory ( ) -> bind ( $ uri , array ( & $ this , 'lookupProxy' ) , array ( sprintf ( '%s/local' , $ beanName ) ) ) ; // query whether we've a remote business interface } elseif ( $ epbReference -> getBeanInterface ( ) === ( sprintf ( '%sRemote' , $ beanName ) ) ) { // bind the remote business interface of the bean to the applications naming directory $ application -> getNamingDirectory ( ) -> bind ( $ uri , array ( & $ this , 'lookupProxy' ) , array ( sprintf ( '%s/remote' , $ beanName ) ) ) ; // at least, we need a business interface } else { // log a critical message that we can't bind the reference $ application -> getInitialContext ( ) -> getSystemLogger ( ) -> critical ( sprintf ( 'Can\'t bind bean reference %s to naming directory' , $ uri ) ) ; } } else { $ application -> getInitialContext ( ) -> getSystemLogger ( ) -> critical ( sprintf ( 'Can\'t bind enterprise bean reference %s to naming directory, because of missing lookup/bean name' , $ uri ) ) ; } // catch all other exceptions } catch ( \ Exception $ e ) { $ application -> getInitialContext ( ) -> getSystemLogger ( ) -> critical ( $ e -> __toString ( ) ) ; } }
Registers the passed EPB reference in the applications directory.

@param \AppserverIo\Psr\EnterpriseBeans\Description\EpbReferenceDescriptorInterface $epbReference The EPB reference to register

@return void
Registers the passed EPB reference in the applications directory .