Package com.sun.ejb

Examples of com.sun.ejb.Container


                // removes the unique id from the registry
                this.registry.removeUniqueId( nextDescriptor.getUniqueId() );

                try {
                    // removes the bean container from the application registry
                    Container container = (Container) this.registry.
                            removeDescriptor2Container(nextDescriptor);
                    if (container != null) {
                        container.undeploy();
                    }

                } catch (Exception beanEx) {
                    result = false;
                    _logger.log(Level.WARNING,
View Full Code Here


            try {
    EJBSecurityManager sm =
                    EJBSecurityManager.createManager(nextDescriptor,true);
                // create the bean container
                Container container = null;
                try {
        notifyEjbEvent(EjbContainerEvent.BEFORE_EJB_CONTAINER_LOAD,
      nextDescriptor);

                    container = cf.createContainer(nextDescriptor, loader,
          sm, dynamicConfigContext);

        notifyEjbEvent(EjbContainerEvent.AFTER_EJB_CONTAINER_LOAD,
      nextDescriptor);
                } catch (NameAlreadyBoundException jndiEx) {

                    // logs a message
                    _logger.log(Level.SEVERE, "loader.jndi_name_conflict",
                                new Object[] {
                                    this.id,
                                    nextDescriptor.getJndiName(),
                                    nextDescriptor.getName()
                                });

                    // logs the actual exception
                    _logger.log(Level.SEVERE,
                        "loader.naming_exception_in_createcontainer", jndiEx);

                    // remove all loaded ejbs
                    unloadEjbs(jsr77);

                    // abort loading
                    return false;
                }

                if (_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE,
                                "Created container with uinque id: "
                                + nextDescriptor.getUniqueId());
                }

                // adds the container to the repository
                this.registry.addDescriptor2Container(nextDescriptor,container);

                // adds the container to the temp local table
                myContainers.add(container);

            } catch (Exception beanEx) {
                _logger.log(Level.SEVERE,
                    "loader.unexpected_error_while_creating_ejb_container",
                    beanEx);

                // remove all loaded ejbs
                unloadEjbs(jsr77);

                return false;
            }

            if (jsr77) {
              try {
                createLeafMBean(nextDescriptor);
              } catch (MBeanException mbe) {
                _logger.log(Level.WARNING, "loader.create_ejb_mbean_exception", mbe);
              }
            }
        }

  try {
            Enumeration en = beanDescriptors.elements();
            // generate policy files for applications with ejbs not otherwise
            while (en.hasMoreElements()) {           
                EjbDescriptor nextDescriptor = (EjbDescriptor)en.nextElement();
                SecurityUtil.generatePolicyFile(
                    EJBSecurityManager.getContextID(nextDescriptor));
            }
  } catch (Exception ge) {
            _logger.log(Level.SEVERE,
      "code.could_not_generate/load_the_policy_files_for_system_app",
      ge);

      // remove all loaded ejbs
      unloadEjbs(jsr77);

      return false;
  }
         //START CR 6653050
        //initialize webservice enpoints
        Iterator ec = myContainers.iterator();
        while(ec.hasNext()) {
            try {
                BaseContainer c = (BaseContainer)ec.next();
                c.initializeWebService();
            } catch (Exception exce) {
                 _logger.log(Level.SEVERE,
                        "loader.unexpected_error_while_creating_ejb_container",                        exce);

            // remove all loaded ejbs
            unloadEjbs(jsr77);

            return false;
           }
        }
        //END CR 6653050
        // notify ejb containers that application deployment succeeded.
        Iterator iter = myContainers.iterator();
        while ( iter.hasNext() ) {
            Container c = (Container) iter.next();
            c.doAfterApplicationDeploy();
            //IASRI 4717059 BEGIN
            /*
            if (robFlag) {
                if ( c instanceof EntityContainer) {
                    ( (EntityContainer) c).setROBNotifier(robNotifier);
View Full Code Here

        return new QName[0];
    }

    public boolean handleRequest(MessageContext context) {
        Invocation inv = null;
        Container container = null;

        try {

            Switch theSwitch = Switch.getSwitch();
            InvocationManager invManager = theSwitch.getInvocationManager();
            inv = (Invocation) invManager.getCurrentInvocation();
            container = (Container) inv.container;

            inv.method = wsUtil.getInvMethod(inv.getWebServiceTie(), context);

            // Result can be null for some error cases.  This will be
            // handled by jaxrpc runtime so we don't treat it as an exception.
            if( inv.method != null ) {
                inv.setWebServiceMethod(inv.method);
              
                if ( !container.authorize(inv) ) {
                    inv.exception = new Exception
                        ("Client not authorized for invocation of "
                         + inv.method);
                }
            } else {
                inv.setWebServiceMethod(null);
            }
        } catch(Exception e) {
            String errorMsg = "Error unmarshalling method " +
                ( (container != null ) ?
                  "for ejb " + container.getEjbDescriptor().getName() :
                  "" );
      //issue 2422 -- UnmarshalException.initCause always
            //throws IllegalStateException.  Need to use 2-arg ctor.
            inv.exception = new UnmarshalException(errorMsg, e);
        }
View Full Code Here

        try {
            Switch theSwitch = Switch.getSwitch();
            InvocationManager invManager = theSwitch.getInvocationManager();
            inv = (Invocation) invManager.getCurrentInvocation();
            Container container = (Container) inv.container;

            Method webServiceMethodInPreHandler = inv.getWebServiceMethod();

            if( webServiceMethodInPreHandler != null ) {
                // Now that application handlers have run, do another method
View Full Code Here

                       "Expected " + expectedScheme + " . Received " + scheme);
            return;
        }

        Switch theSwitch = Switch.getSwitch();
        Container container = ejbEndpoint.getContainer();
       
        boolean authenticated = false;
        try {
            // Set context class loader to application class loader
            container.externalPreInvoke();

            // compute realmName
            String realmName = null;
            Application app = ejbEndpoint.getEndpoint().getBundleDescriptor().getApplication();
            if (app != null) {
                realmName = app.getRealm();
            }
            if (realmName == null) {
                realmName = ejbEndpoint.getEndpoint().getRealm();
            }

            if (realmName == null) {
                // use the same logic as BasicAuthenticator
                realmName = hreq.getServerName() + ":" + hreq.getServerPort();
            }
           
            try {
                authenticated = doSecurity(hreq, ejbEndpoint, realmName);
            } catch(Exception e) {
                sendAuthenticationEvents(false, hreq.getRequestURI(), null);
                logger.log(Level.WARNING, "authentication failed for " +
                           ejbEndpoint.getEndpoint().getEndpointName(),
                           e);
            }

             if (auditManager.isAuditOn()){

              auditManager.ejbAsWebServiceInvocation(
                    ejbEndpoint.getEndpoint().getEndpointName(),authenticated);
            }



            if (!authenticated) {
                hresp.setHeader("WWW-Authenticate",
                        "Basic realm=\"" + realmName + "\"");
                hresp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
                return;
            }
           
            // depending on the jaxrpc or jax-ws version, this will return the
            // right dispatcher.
            EjbMessageDispatcher msgDispatcher = ejbEndpoint.getMessageDispatcher();
            msgDispatcher.invoke(hreq, hresp, getServletContext(), ejbEndpoint);
           
        } catch(Throwable t) {
            logger.log(Level.WARNING, "", t);
        } finally {
            if( authenticated ) {
                // remove any security context from the thread before returning
                SecurityContext.setCurrent(null);
            }
           
            // Restore context class loader
            container.externalPostInvoke();
        }
        return;
    }
View Full Code Here

            // in this server instance
            if (containers != null) {
                Iterator iter = containers.iterator();

                while (iter.hasNext()) {
                    Container container = (Container) iter.next();

                    if (container != null) {
                        container.onReady();
                    }
                }
            }

            _logger.log(Level.FINE, "core.application_onReady_complete");
View Full Code Here

            // in this server instance
            if (containers != null) {
                Iterator iter = containers.iterator();

                while (iter.hasNext()) {
                    Container container = (Container) iter.next();

                    if (container != null) {
                        container.onShutdown();
                    }
                }
            }
           
            // After the applicationmanager shutdown, call stop method
View Full Code Here

            // final shut down call to all ejb containers
            if (containers != null) {
                Iterator iter = containers.iterator();

                while (iter.hasNext()) {
                    Container container = (Container) iter.next();

                    if (container != null) {
                        container.onTermination();
                    }
                }
            }
        } catch (Throwable th) {
            _logger.log(Level.SEVERE,
View Full Code Here

   
    private SOAPMessage processEJBRequest(SOAPMessage message,
            EjbRuntimeEndpointInfo endpointInfo) {
       
        if (message != null) {
            Container container = endpointInfo.getContainer();
            SOAPMessageContext msgContext = rpcFactory.createSOAPMessageContext();
            // Set context class loader to application class loader
            container.externalPreInvoke();
            msgContext.setMessage(message);
           
            try {
                // Do ejb container pre-invocation and pre-handler
                // logic
                Handler implementor = ((Ejb2RuntimeEndpointInfo) endpointInfo).getHandlerImplementor(msgContext);
               
                // Pass control back to jaxrpc runtime to invoke
                // any handlers and call the webservice method itself,
                // which will be flow back into the ejb container.
                implementor.handle(msgContext);
              
                SOAPMessage reply = msgContext.getMessage();
               
                if (reply.saveRequired()) {
                    reply.saveChanges();
                }
                return reply;
               
            } catch(Exception e) {
                logger.fine(e.getMessage());
            } finally {
               
                // Always call release, even if an error happened
                // during getImplementor(), since some of the
                // preInvoke steps might have occurred.  It's ok
                // if implementor is null.
                endpointInfo.releaseImplementor();
                // Restore context class loader
                container.externalPostInvoke();
            }
        } else {
            String errorMsg = "null message POSTed to ejb endpoint " +
                    endpointInfo.getEndpoint().getEndpointName() +
                    " at " + endpointInfo.getEndpointAddressUri();
View Full Code Here

            }
     
      if (m != null) {

    Container container = (Container) inv.container;

    try {
        inv.method = m;
        if ( !container.authorize(inv) ) {

      ie = new Exception
          (localStrings.getLocalString
           ("enterprise.webservice.methodNotAuth",
            "Client not authorized for invocation of {0}",
View Full Code Here

TOP

Related Classes of com.sun.ejb.Container

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.