コード例 #1
0
 protected void processEncReferences(WebApplication webApp, Context envCtx)
     throws ClassNotFoundException, NamingException {
   DeploymentUnit unit = webApp.getDeploymentUnit();
   JBossWebMetaData metaData = webApp.getMetaData();
   EnvironmentEntriesMetaData envEntries = metaData.getEnvironmentEntries();
   log.debug("addEnvEntries");
   addEnvEntries(envEntries, envCtx);
   ResourceEnvironmentReferencesMetaData resourceEnvRefs =
       metaData.getResourceEnvironmentReferences();
   log.debug("linkResourceEnvRefs");
   linkResourceEnvRefs(resourceEnvRefs, envCtx);
   ResourceReferencesMetaData resourceRefs = metaData.getResourceReferences();
   log.debug("linkResourceRefs");
   linkResourceRefs(resourceRefs, envCtx);
   log.debug("linkMessageDestinationRefs");
   MessageDestinationReferencesMetaData msgRefs = metaData.getMessageDestinationReferences();
   linkMessageDestinationRefs(unit, msgRefs, envCtx);
   EJBReferencesMetaData ejbRefs = metaData.getEjbReferences();
   log.debug("linkEjbRefs");
   linkEjbRefs(unit, ejbRefs, envCtx);
   EJBLocalReferencesMetaData ejbLocalRefs = metaData.getEjbLocalReferences();
   log.debug("linkEjbLocalRefs");
   linkEjbLocalRefs(unit, ejbLocalRefs, envCtx);
   log.debug("linkServiceRefs");
   ServiceReferencesMetaData serviceRefs = metaData.getServiceReferences();
   linkServiceRefs(unit, serviceRefs, envCtx);
 }
コード例 #2
0
 /*
     protected void setUpDistributableSessionManager(ClassLoader loader)
     {
         try
         {
             Manager sm=(Manager)getDistributableSessionManager();
             Store store=sm.getStore();
             if(store instanceof AbstractReplicatedStore)
                 ((AbstractReplicatedStore)store).setLoader(loader);
             if(_timeOutPresent)
                 sm.setMaxInactiveInterval(_timeOutMinutes*60);
             getSessionHandler().setSessionManager(sm);
         }
         catch(Exception e)
         {
             __log.error("could not set up Distributable HttpSession Manager - using local one",e);
         }
     }
 */
 protected void setUpENC(ClassLoader loader) throws Exception {
   _webApp.setClassLoader(loader);
   _webApp.setName(getDisplayName());
   _webApp.setAppData(this);
   __log.debug("setting up ENC...");
   _descriptorParser.parseWebAppDescriptors(loader, _webApp.getMetaData());
   __log.debug("setting up ENC succeeded");
 }
コード例 #3
0
  /**
   * This method is invoked from within subclass performDeploy() method implementations when they
   * invoke WebDescriptorParser.parseWebAppDescriptors().
   *
   * @param loader the ClassLoader for the web application. May not be null.
   * @param metaData the WebMetaData from the WebApplication object passed to the performDeploy
   *     method.
   */
  protected void processEnc(ClassLoader loader, WebApplication webApp) throws Exception {
    if (loader == null)
      throw new IllegalArgumentException("Classloader passed to process ENC refs is null");
    log.debug("AbstractWebContainer.parseWebAppDescriptors, Begin");
    InitialContext iniCtx = new InitialContext();
    Context envCtx = null;
    Thread currentThread = Thread.currentThread();
    ClassLoader currentLoader = currentThread.getContextClassLoader();
    JBossWebMetaData metaData = webApp.getMetaData();
    try {
      // Create a java:comp/env environment unique for the web application
      log.debug("Creating ENC using ClassLoader: " + loader);
      ClassLoader parent = loader.getParent();
      while (parent != null) {
        log.debug(".." + parent);
        parent = parent.getParent();
      }
      // TODO: The enc should be an input?
      currentThread.setContextClassLoader(loader);
      // webApp.setENCLoader(loader);
      envCtx = (Context) iniCtx.lookup("java:comp");

      // TODO: inject the ORB
      ORB orb = null;
      try {
        ObjectName ORB_NAME = new ObjectName("jboss:service=CorbaORB");
        orb = (ORB) server.getAttribute(ORB_NAME, "ORB");
        // Bind the orb
        if (orb != null) {
          NonSerializableFactory.rebind(envCtx, "ORB", orb);
          log.debug("Bound java:comp/ORB");
        }
      } catch (Throwable t) {
        log.debug("Unable to retrieve orb" + t.toString());
      }

      // TODO: injection, Add a link to the global transaction manager
      envCtx.bind("UserTransaction", new LinkRef("UserTransaction"));
      log.debug("Linked java:comp/UserTransaction to JNDI name: UserTransaction");
      envCtx = envCtx.createSubcontext("env");
      processEncReferences(webApp, envCtx);
    } finally {
      currentThread.setContextClassLoader(currentLoader);
    }

    String securityDomain = metaData.getSecurityDomain();
    log.debug("linkSecurityDomain");
    linkSecurityDomain(securityDomain, envCtx);
    log.debug("AbstractWebContainer.parseWebAppDescriptors, End");
  }