Package com.sun.ejb

Examples of com.sun.ejb.Invocation


        // Process application-specific method.

        Object returnValue = null;

        Invocation inv = new Invocation();
       
        inv.isLocal   = true;
        inv.isBusinessInterface = !isLocalHomeView();
        inv.isHome    = false;
        inv.ejbObject = this;
View Full Code Here


                logger.log(Level.SEVERE, "ejb.bean_class_method_not_found",
                           params);                                  
                throw new EJBException(errorMsg);
            }

            Invocation inv = new Invocation();

            inv.isLocal = true;
            inv.isHome  = true;
            inv.method  = method;
View Full Code Here

            return InvocationHandlerUtil.
                invokeJavaObjectMethod(this, method, args);   
        }

        Object returnValue = null;
        Invocation inv = null;

        try {
            // Invocation was created earlier in the web service dispatching
            inv = (Invocation) invManager_.getCurrentInvocation();

            inv.ejbObject = this;
           
            // things can become hairy here. This handler may have been created
            // with a dummy SEI to satisfy the EJB container. In such cases, we must
            // find the right method object on the SIB.
            if (endpoint_.getServiceEndpointInterface().equals(ejbClass_.getName())) {
                // we need to substiture the method object
                method = ejbClass_.getMethod(method.getName(), method.getParameterTypes());
            }
            inv.method = method;
            inv.clientInterface = serviceEndpointIntfClass_;

            inv.invocationInfo = (InvocationInfo)
                invocationInfoMap_.get(inv.method);

            if( inv.invocationInfo == null ) {
                throw new EJBException
                    ("Web service Invocation Info lookup failed for " +
                     "method " + inv.method);
            }

            inv.transactionAttribute = inv.invocationInfo.txAttr;

      // special handling of jaxrpc endpoints (identfied by mapping file)
            if(endpoint_.getWebService().hasMappingFile()) {
   
    if( hasHandlers_ ) {
        // Handler performed method authorization already
    } else {
        StatelessSessionContainer container =
      (StatelessSessionContainer) getContainer();               

        boolean authorized = container.authorize(inv);
        if( !authorized ) {
      throw new AccessLocalException
          ("Client not authorized to access " + inv.method);
        }
    }
      } else if ( hasHandlers_ ) {

    // jaxws enpoint
    // authorization was done in security pipe
                // Now that application handlers have run, do
                // another method lookup and compare the results
                // with the original one. This ensures that the
                // application handlers have not changed
                // which method is invoked.

                Method methodBefore = inv.getWebServiceMethod();

                if (methodBefore != null && !methodBefore.equals(inv.method)) {
                    inv.exception = new UnmarshalException
      (localStrings.getLocalString
       ("enterprise.webservice.postHandlerMethodMismatch",
View Full Code Here

           
            ComponentInvocation compInv = container.invocationManager.getCurrentInvocation();
            checkActivatePassivate(compInv);

            if (compInv instanceof Invocation) {
                Invocation inv = (Invocation) compInv;
                if (inv.invocationInfo != null) {
                    switch (inv.invocationInfo.txAttr) {
                        case Container.TX_NOT_SUPPORTED:
                        case Container.TX_SUPPORTS:
                        case Container.TX_NEVER:
View Full Code Here

            }
           
            ComponentInvocation compInv = container.invocationManager.getCurrentInvocation();
            checkActivatePassivate(compInv);
            if (compInv instanceof Invocation) {
                Invocation inv = (Invocation) compInv;
                if (inv.invocationInfo != null) {
                    switch (inv.invocationInfo.txAttr) {
                        case Container.TX_NOT_SUPPORTED:
                        case Container.TX_SUPPORTS:
                        case Container.TX_NEVER:
View Full Code Here

           
            // Process application-specific method.
           
            Object returnValue = null;
           
            Invocation inv = new Invocation();
           
            inv.isLocal   = false;
            inv.isHome    = false;
            inv.isBusinessInterface = !isRemoteHomeView();
            inv.ejbObject = this;
View Full Code Here

                if(adapter == null) {
                    try {
                        // Set webservice context here
                        // If the endpoint has a WebServiceContext with @Resource then
                        // that has to be used
                        Invocation tmpInv = new Invocation();
                        tmpInv.isWebService = true;
                        tmpInv.container = container;               
                        tmpInv.transactionAttribute = Container.TX_NOT_INITIALIZED;
                        invManager.preInvoke(tmpInv);
                        EjbDescriptor ejbDesc = endpoint.getEjbComponentImpl();
                        Iterator<ResourceReferenceDescriptor> it = ejbDesc.getResourceReferenceDescriptors().iterator();
                        while(it.hasNext()) {
                            ResourceReferenceDescriptor r = it.next();           
                            if(r.isWebServiceContext()) {
                                Iterator<InjectionTarget> iter = r.getInjectionTargets().iterator();
                                boolean matchingClassFound = false;
                                while(iter.hasNext()) {
                                    InjectionTarget target = iter.next();
                                    if(ejbDesc.getEjbClassName().equals(target.getClassName())) {
                                        matchingClassFound = true;
                                        break;
                                    }
                                }
                                if(!matchingClassFound) {
                                    continue;
                                }
                                try {
                                    javax.naming.InitialContext ic = new javax.naming.InitialContext();
                                    wsCtxt = (WebServiceContextImpl) ic.lookup("java:comp/env/" + r.getName());
                                } catch (Throwable t) {
                                    // Swallowed intentionally
                                }
                            }
                        }
                        if(wsCtxt == null) {
                            wsCtxt = new WebServiceContextImpl();
                        }
                    } catch (Throwable t) {
                        logger.severe("Cannot initialize endpoint " + endpoint.getName() + " : error is : " + t.getMessage());
                        return null;
                    } finally {
                        invManager.postInvoke(invManager.getCurrentInvocation());                        
                    }
                }
            }
        }
       
        if(doPreInvoke) {
                // 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.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;

                // AS per latest spec change, the MessageContext object in WebSvcCtxt
                // should be the same one as used in the ejb's interceptors'       
                inv.setContextData(wsCtxt);
               
                // In all cases, the WebServiceInvocationHandler will do the
                // remaining preInvoke tasks : getContext, preInvokeTx, etc.
                invManager.preInvoke(inv);
        }
View Full Code Here

     * getImplementor.  One important thing is to complete the invocation
     * manager preInvoke().
     */
    public void releaseImplementor() {
        try {
            Invocation inv = (Invocation) invManager.getCurrentInvocation();

            // Only use container version of postInvoke if we got past
            // assigning an ejb instance to this invocation.  This is
            // because the web service invocation does an InvocationManager
            // preInvoke *before* assigning an ejb instance.  So, we need
View Full Code Here

                    logger.log(Level.SEVERE, errorMsg);
                    throw new RemoteException(errorMsg);           
                   
                }
               
                Invocation inv = new Invocation();
               
                inv.isLocal = false;
                inv.method  = method;
                inv.isHome  = true;
               
View Full Code Here

        // 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;
    }
View Full Code Here

TOP

Related Classes of com.sun.ejb.Invocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.