FileDocCategorySizeDatePackage
Ejb2RuntimeEndpointInfo.javaAPI DocGlassfish v2 API7333Fri May 04 22:36:10 BST 2007com.sun.enterprise.webservice

Ejb2RuntimeEndpointInfo

public class Ejb2RuntimeEndpointInfo extends EjbRuntimeEndpointInfo
Runtime dispatch information about one ejb web service endpoint. This class must support concurrent access, since a single instance will be used for all web service invocations through the same ejb endpoint.
author
Kenneth Saks

Fields Summary
private Class
tieClass
private com.sun.xml.rpc.spi.runtime.Tie
tieInstance
private com.sun.enterprise.security.jauth.ServerAuthConfig
serverAuthConfig
Constructors Summary
public Ejb2RuntimeEndpointInfo(com.sun.enterprise.deployment.WebServiceEndpoint webServiceEndpoint, com.sun.ejb.containers.StatelessSessionContainer ejbContainer, Object servant, Class tie)

                                  
        super(webServiceEndpoint, ejbContainer, servant);
        tieClass = tie;

	try {
	    // merge message security policy from domain.xml and sun-specific
	    // deployment descriptor
	    serverAuthConfig = ServerAuthConfig.getConfig
		(com.sun.enterprise.security.jauth.AuthConfig.SOAP,
		 endpoint.getMessageSecurityBinding(),
		 null);
	} catch (com.sun.enterprise.security.jauth.AuthException ae) {
            logger.log(Level.SEVERE, 
		       "EJB Webservice security configuration Failure", ae);
	}

    
Methods Summary
public com.sun.xml.rpc.spi.runtime.HandlergetHandlerImplementor(javax.xml.rpc.handler.MessageContext msgContext)


        // We need to split the preInvoke tasks into stages since handlers
        // need access to java:comp/env and method authorization must take
        // place before handlers are run.  Note that the application 
        // classloader was set much earlier when the invocation first arrived
        // so we don't need to set it here.
        Invocation inv = new Invocation();

        // Do the portions of preInvoke that don't need a Method object.
        inv.isWebService = true;
        inv.container = container;
        inv.messageContext = msgContext;
        inv.transactionAttribute = Container.TX_NOT_INITIALIZED;

        // If the endpoint has at least one handler, method
        // authorization will be performed by a container-provided handler
        // before any application handler handleRequest methods are called.
        // Otherwise, the ejb container will do the authorization.
	inv.securityPermissions =  Container.SEC_NOT_INITIALIZED;

        invManager.preInvoke(inv);

        // In all cases, the WebServiceInvocationHandler will do the
        // remaining preInvoke tasks : getContext, preInvokeTx, etc.

        // Create the tie and servant to pass to jaxrpc runtime system.
        // The servant is a dynamic proxy implementing the Service Endpoint
        // Interface.  Use endpoint address uri to disambiguate case where
        // an ejb implements more than one endpoint.
        //
        // NOTE : Tie instance MUST be created after InvManager.preInvoke,
        // since tie initialization could result in handler instance creation.
        // This also means ejb container handler cannot expect to access 
        // Invocation object from Handler.init()

        // Both tie and ejb container servant support concurrent access,
        // so lazily create tie and use the same instance for all invocations
        // through this ejb endpoint.  Tie instance is a heavyweight resource 
        // so it would be prohibitive to create one per thread.
        synchronized(this) {
            if( tieInstance == null ) {
                tieInstance = (Tie) tieClass.newInstance();
                tieInstance.setTarget((Remote) webServiceEndpointServant);
            }
        }

        inv.setWebServiceTie(tieInstance);

        return (Handler) tieInstance;
    
public EjbMessageDispatchergetMessageDispatcher()

        // message dispatcher is stateless, no need to synchronize, worse
        // case, we'll create too many.
        if (messageDispatcher==null) {
            messageDispatcher = new EjbWebServiceDispatcher();
        }
        return messageDispatcher;
    
public com.sun.enterprise.security.jauth.ServerAuthConfiggetServerAuthConfig()

        return serverAuthConfig;
    
public voidreleaseImplementor(com.sun.xml.rpc.spi.runtime.Handler handler)
Called after attempt to handle message. This is coded defensively so we attempt to clean up no matter how much progress we made in getImplementor. One important thing is to complete the invocation manager preInvoke().

        super.releaseImplementor();