Package org.jboss.deployers.structure.spi

Examples of org.jboss.deployers.structure.spi.DeploymentUnit


      conflict4.setUniqueName(SIMPLE_TRIMMED_PATH + "-1");
      modules.add(conflict4);
     
      String expected = "test-1";
     
      DeploymentUnit unit = getDeploymentUnitProxy(duih);
      testee.deploy(unit);
      assertEquals(expected, md.getModuleName());
      assertEquals(expected, duih.getModuleName(NamedModule.class));
     
      ModuleMetaData modmd = getModuleMetaData(duih);
View Full Code Here


      conflict4.setUniqueName(SIMPLE_TRIMMED_PATH + "-1");
      modules.add(conflict4);
     
      String expected = SIMPLE_TRIMMED_PATH + "-2";
     
      DeploymentUnit unit = getDeploymentUnitProxy(duih);
      testee.deploy(unit);
      assertEquals(expected, getSingleAttachment(duih).getModuleName());
      assertEquals(expected, duih.getModuleName(NamedModule.class));
     
      ModuleMetaData modmd = getModuleMetaData(duih);
View Full Code Here

   public void testConcurrentDeployments() throws InterruptedException
   {
      // Set up an ear with a war, jar, ear
     
      DUIH parentDUIH = getParentDUIH(true);
      DeploymentUnit parent = getDeploymentUnitProxy(parentDUIH);
      JBossAppMetaData appmd = (JBossAppMetaData) parentDUIH.attachments.get(JBossAppMetaData.class);
      ModulesMetaData modsmd = appmd.getModules();
     
      DUIH war = getSingleAttachmentDUIH(); // this does most setup for war
      war.parent = parent;
View Full Code Here

   // TODO: wire via SPI or deprecated this construct in favor of a generic JavaEE module informer
   private SimpleJavaEEModuleIdentifier identifier = new SimpleJavaEEModuleIdentifier();
  
   public String getApplicationName(DeploymentUnit unit)
   {
      DeploymentUnit topLevel = unit.getTopLevel();
      if(topLevel.isAttachmentPresent(JBossAppMetaData.class))
         return topLevel.getSimpleName();
      return null;
   }
View Full Code Here

   public String getModulePath(DeploymentUnit unit)
   {
      // first check if this a JavaEE Application (i.e. if it's a .ear).
      // If yes, then return the relative path (i.e. module name) of the unit
      // relative to the .ear
      DeploymentUnit topLevel = unit.getTopLevel();
      if(topLevel.isAttachmentPresent(JBossAppMetaData.class))
      {
         return unit.getRelativePath();
      }
      // if it's not a JavaEE application (i.e. not a .ear), then
      // return the simple name of the unit
View Full Code Here

                  + MessageDestinationReferenceResolver.class.getName());
         }
         else
         {
            // the DU which depends on this message-destination-ref
            DeploymentUnit dependentDU = unit;
            // the MessageDestinationReferenceResolver works on non-component deployment units.
            // So if we are currently processing component DUs (like we do for EJBs), then pass the
            // component DUs parent during resolution.
            if (unit.isComponent())
            {
View Full Code Here

    * @param di the module
    * @return .ear parent shortname, or null
    */
   public static String findEarParent(DeploymentUnit di)
   {
      DeploymentUnit parent = di.getParent();
      if (parent != null && parent.getSimpleName().endsWith(".ear"))
      {
         return parent.getSimpleName();
      }
      else
      {
         return null;
      }
View Full Code Here

    return datasourceDeployments;
  }
 
  private void attachManagedConnectionFactories(DeploymentUnit unit, Collection<DataSourceDeploymentMetaData> datasourceDeployments)
  {
     DeploymentUnit nonComponentDU =  unit.isComponent() ? unit.getParent() : unit;
     ManagedConnectionFactoryDeploymentGroup managedConnectionFactories = nonComponentDU.getAttachment(ManagedConnectionFactoryDeploymentGroup.class);
       if (managedConnectionFactories == null)
       {
          managedConnectionFactories = new ManagedConnectionFactoryDeploymentGroup();
       }
      
       for (DataSourceDeploymentMetaData dataSourceDeployment : datasourceDeployments)
       {
          managedConnectionFactories.addManagedConnectionFactoryDeployment(dataSourceDeployment);
       }
       nonComponentDU.addAttachment(ManagedConnectionFactoryDeploymentGroup.class, managedConnectionFactories);
  }
View Full Code Here

      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      metaData.setContextLoader(loader);

      StandardContext context = (StandardContext)Class.forName(config.getContextClassName()).newInstance();

      DeploymentUnit depUnit = webApp.getDeploymentUnit();

      // Find all TLDs that have been processed by deployers, and place them in a map keyed by location
      Map<String, TldMetaData> tldMetaDataMap = new HashMap<String, TldMetaData>();
      Map<String, Object> attachements = depUnit.getAttachments();
      Iterator<String> attachementNames = attachements.keySet().iterator();
      while (attachementNames.hasNext()) {
         String name = attachementNames.next();
         Object attachement = depUnit.getAttachment(name);
         if (attachement != null && attachement instanceof TldMetaData
               && name.startsWith(TldMetaData.class.getName() + ":"))
         {
            tldMetaDataMap.put(name, (TldMetaData) attachement);
         }
      }
      List<TldMetaData> sharedTldMetaData = (List<TldMetaData>)
         depUnit.getAttachment(SharedTldMetaDataDeployer.SHARED_TLDS_ATTACHMENT_NAME);
      if (sharedTldMetaData != null)
      {
         for (TldMetaData tldMetaData : sharedTldMetaData)
         {
            tldMetaDataMap.put("shared:" + tldMetaData.toString(), tldMetaData);
         }
      }
     
      this.component = createJavaEEComponent();

      TomcatInjectionContainer injectionContainer =
         new TomcatInjectionContainer(webApp, depUnit, context,
               getPersistenceUnitDependencyResolver(), config.getDynamicClassloaders(), component, this.getInjectionManager());

      Loader webLoader = depUnit.getAttachment(Loader.class);
      if (webLoader == null)
         webLoader = getWebLoader(depUnit, metaData, loader, warUrl, injectionContainer);

      webApp.setName(warUrl.getPath());
      webApp.setClassLoader(loader);
      webApp.setURL(warUrl);

      String objectNameS = config.getCatalinaDomain() + ":j2eeType=WebModule,name=//" + ((hostName == null) ? "localhost" : hostName) + ctxPath
            + ",J2EEApplication=none,J2EEServer=none";

      ObjectName objectName = new ObjectName(objectNameS);

      if (Registry.getRegistry(null, null).getMBeanServer().isRegistered(objectName))
         throw new DeploymentException("Web mapping already exists for deployment URL " + warUrlStr);

      Registry.getRegistry(null, null).registerComponent(context, objectName, config.getContextClassName());

      context.setInstanceManager(injectionContainer);
      context.setPublicId(metaData.getPublicID());

      String docBase = depUnit.getAttachment("org.jboss.web.explicitDocBase", String.class);
      if (docBase == null)
         docBase = VFS.getChild(warUrl).getPhysicalFile().getAbsolutePath();

      context.setDocBase(docBase);
View Full Code Here

      JBossClientMetaData clientMetaData = unit.getAttachment(JBossClientMetaData.class);
      if(ejbMetaData == null && webMetaData == null && clientMetaData == null)
         return;

      // Create a map of the reference endpoints if it does not exist in the top unit
      DeploymentUnit top = unit.getTopLevel();
      Map<String, ContainerDependencyMetaData> endpointMap = top.getAttachment(ENDPOINT_MAP_KEY, Map.class);
      Map<String, String> endpointAlternateMap = top.getAttachment(ALTERNATE_MAP_KEY, Map.class);
      if(endpointMap == null)
      {
         endpointMap = new ConcurrentHashMap<String, ContainerDependencyMetaData>();
         endpointAlternateMap = new ConcurrentHashMap<String, String>();
         mapEndpoints(top, endpointMap, endpointAlternateMap);
         top.addAttachment(ENDPOINT_MAP_KEY, endpointMap, Map.class);
         top.addAttachment(ALTERNATE_MAP_KEY, endpointAlternateMap);
         DeploymentEndpointResolver resolver = new MappedDeploymentEndpointResolver(endpointMap, endpointAlternateMap, unit.getRelativePath());
         top.addAttachment(DeploymentEndpointResolver.class, resolver);
      }

      DeploymentEndpointResolver resolver = new MappedDeploymentEndpointResolver(
            endpointMap, endpointAlternateMap, unit.getRelativePath());

      List<String> unresolvedPaths = new ArrayList<String>();
      if(ejbMetaData != null)
      {
         JBossEnterpriseBeansMetaData beans = ejbMetaData.getEnterpriseBeans();
         // Process ejb references
         try
         {
            resolve(unit, endpointMap, beans, resolver, unresolvedPaths);
         }
         catch (Exception e)
         {
            throw new DeploymentException(e);
         }
         if(unresolvedPaths.size() > 0)
            log.warn("Unresolved references exist in JBossMetaData:"+unresolvedPaths);
      }
      if(webMetaData != null)
      {
         // Process web app references
         ContainerDependencyMetaData webAppCDMD = new ContainerDependencyMetaData(unit.getSimpleName(), "web-app", unit.getRelativePath());
         try
         {
            resolve(webAppCDMD, unit, endpointMap, webMetaData.getJndiEnvironmentRefsGroup(), resolver, unresolvedPaths);
         }
         catch (Exception e)
         {
            throw new DeploymentException(e);
         }
         if(unresolvedPaths.size() > 0)
            log.warn("Unresolved references exist in JBossWebMetaData:"+unresolvedPaths);
      }
      if(clientMetaData != null)
      {
         // Process client app references
         ContainerDependencyMetaData clientCDMD = new ContainerDependencyMetaData(unit.getSimpleName(), "client", unit.getRelativePath());
         try
         {
            resolve(clientCDMD, unit, endpointMap, clientMetaData.getJndiEnvironmentRefsGroup(), resolver, unresolvedPaths);
         }
         catch (Exception e)
         {
            throw new DeploymentException(e);
         }
         if(unresolvedPaths.size() > 0)
            log.warn("Unresolved references exist in JBossClientMetaData: "+unresolvedPaths);
      }
      // Add the unique set of ContainerDependencyMetaData
      Set<ContainerDependencyMetaData> depends = new HashSet<ContainerDependencyMetaData>();
      for(ContainerDependencyMetaData cdmd : endpointMap.values())
      {
         depends.add(cdmd);
      }
      top.addAttachment(DEPENDS_SET_KEY, depends, Set.class);

      unit.addAttachment(DeploymentEndpointResolver.class, resolver);
      dump(unit);
   }
View Full Code Here

TOP

Related Classes of org.jboss.deployers.structure.spi.DeploymentUnit

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.