Examples of DeploymentUnit


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

      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

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

   }

   private List<String> getEjbDeploymentPaths(DeploymentUnit unit)
   {
      ArrayList<String> paths = new ArrayList<String>();
      DeploymentUnit root = unit.getTopLevel();
      getEjbDeploymentPaths(root, paths);
      return paths;
   }
View Full Code Here

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

      return dSummary;
   }
  
   private void dump(DeploymentUnit unit)
   {
      DeploymentUnit top = unit.getTopLevel();
      StringBuffer tmp = new StringBuffer();
      dump(top, tmp, 0);
      log.debug("Processing unit="+unit.getSimpleName()+", structure:\n"+tmp);
   }
View Full Code Here

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

     
      // Create a merged view
      JBossMetaData mergedMetaData = new JBossMetaData();
      mergedMetaData.merge(metaData, specMetaData);
      // Incorporate any ear level overrides
      DeploymentUnit topUnit = unit.getTopLevel();
      if(topUnit != null && topUnit.getAttachment(JBossAppMetaData.class) != null)
      {
         JBossAppMetaData earMetaData = topUnit.getAttachment(JBossAppMetaData.class);
         // Security domain
         String securityDomain = earMetaData.getSecurityDomain();
         if(securityDomain != null && mergedMetaData.getSecurityDomain() == null)
            mergedMetaData.setSecurityDomain(securityDomain);
         //Security Roles
View Full Code Here

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

         }
      }
     
      // Enforce EAR rules from EE 6 EE.8.1.1
      JBossAppMetaData appMetaData = null;
      DeploymentUnit parent = unit.getParent();
      if (parent != null)
      {
         appMetaData = parent.getAttachment(JBossAppMetaData.class);
      }     
      if (appMetaData != null)
      {        
         moduleName = establishUniqueModuleName(unit, moduleName, appMetaData);
      }
View Full Code Here

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

      mainDeployer.addDeployment(deployment);
      mainDeployer.process();
      ControllerContext wbContext = null;
      try
      {
         DeploymentUnit earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
         String bootName = DeployersUtils.getBootstrapBeanName(earDU);
         bootstrap = getBean(bootName, null);
         assertInstanceOf(bootstrap, "org.jboss.test.deployers.support.CheckableBootstrap", earDU.getClassLoader());
         // waiting on ejb
         assertTrue(invoke(bootstrap, "Create"));
         assertFalse(invoke(bootstrap, "Boot")); // not yet booted
         assertFalse(invoke(bootstrap, "Shutdown"));
         // install ejb
         KernelControllerContext ejb = deploy(new AbstractBeanMetaData("EjbContainer#1", Object.class.getName()));
         try
         {
            assertTrue(ejb.getState().equals(ControllerState.INSTALLED));
            /// check boot
            assertTrue(invoke(bootstrap, "Create"));
            assertTrue(invoke(bootstrap, "Boot"));
            assertFalse(invoke(bootstrap, "Shutdown"));

            // test jndi binding
            duSimpleName = earDU.getSimpleName();
            Context context = assertInstanceOf(bmContext.lookup(duSimpleName), Context.class, false);
            assertSame("Bootstrap Dummy", context.lookup("bootstrap"));

            Class<?> wbClass = earDU.getClassLoader().loadClass("org.jboss.test.deployers.support.CheckableBootstrap");
            wbContext = controller.getContextByClass(wbClass);
            assertNotNull(wbContext);
            assertSame(bootstrap, wbContext.getTarget());
         }
         finally
View Full Code Here

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

         return resolveRelativeLink(di, link, searched, isLocal);
      }
      else
      {
         // <ejb-link> contains a Bean Name, scan the DeploymentUnit tree
         DeploymentUnit top = di.getTopLevel();
         return resolveAbsoluteLink(top, link, searched, isLocal);
      }
   }
View Full Code Here

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

      }
   }

   private static String resolveRelativeLink(DeploymentUnit unit, String link, ArrayList<String> searched, boolean isLocal)
   {
      DeploymentUnit top = unit.getTopLevel();
      String path = link.substring(0, link.indexOf('#'));
      String ejbName = link.substring(link.indexOf('#') + 1);

     
      if (log.isTraceEnabled())
      {
         log.trace("Resolving relative link: " + link);
      }
      DeploymentUnit targetUnit = findLinkPath(top, path);
      if (targetUnit == null)
      {
         log.warn("Can't locate DeploymentUnit for target: " + path);
         return null;
      }

      String linkTarget = null;
      if (targetUnit.getAttachment(JBossMetaData.class) != null)
      {
         JBossMetaData appMD = targetUnit.getAttachment(JBossMetaData.class);
         JBossEnterpriseBeanMetaData beanMD = appMD.getEnterpriseBean(ejbName);

         if (beanMD != null)
         {
            linkTarget = getJndiName(beanMD, isLocal);
            if (linkTarget == null)
            {
               if (isLocal)
                  log.warn("Unable to determine local jndi name for " + beanMD.getEjbName());
               else
                  log.warn("Unable to determine jndi name for " + beanMD.getEjbName());
               searched.add(beanMD.getEjbName());
            }
         }
         else
         {
            log.warn("No Bean named '" + ejbName + "' found in '" + path + "'!");
            for (JBossEnterpriseBeanMetaData md : appMD.getEnterpriseBeans())
               searched.add(md.getEjbName());
         }
      }
      else
      {
         log.warn("DeploymentUnit " + targetUnit + " is not an EJB .jar " + "file!");
         searched.add(targetUnit.getName());
      }

      return linkTarget;
   }
View Full Code Here

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

   }

   private static <T> List<T> getAllAttachments(DeploymentUnit unit, Class<T> type)
   {
      ArrayList<T> attachments = new ArrayList<T>();
      DeploymentUnit top = unit.getTopLevel();
      getAllAttachments(top, type, attachments);
      return attachments;
   }
View Full Code Here

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

         // link is specified in the form path/file.jar#Bean
         return resolveRelativeMessageDestination(di, link, searched);
      else
      {
         // link contains a Bean Name, scan the DeploymentUnit tree
         DeploymentUnit top = di.getTopLevel();
         return resolveAbsoluteMessageDestination(top, link, searched);
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.