Package org.jboss.deployment.dependency

Examples of org.jboss.deployment.dependency.ContainerDependencyMetaData


            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)
View Full Code Here


         {
            log.debug("Message-destination: "+destName+" has no mappedName");
            continue;
         }
         String destPath = prefix + "#" + destName;
         ContainerDependencyMetaData destMD = new ContainerDependencyMetaData(mappedName, destName, vfsPath);
         endpointMap.put(destPath, destMD);
         if(trace)
            log.trace("mapMessageDestinations: "+destPath+", mappedName: "+mappedName);
        
         // Create global message-destination/destName alt-mappings
View Full Code Here

         {
            // The unique id for this ejb in the deployment
            String ejbCompID = prefix + "#" + bean.getEjbName();
            //LegacyEjb3JndiPolicy policy = new LegacyEjb3JndiPolicy();
            String jndiName = bean.determineJndiName();
            ContainerDependencyMetaData cdmd = new ContainerDependencyMetaData(jndiName, bean.getEjbName(), vfsPath);
            cdmd.setEjb3X(ejbMetaData.isEJB3x());
            // TODO, this is a mess that should be simply from the metadata
            //ClassLoader loader = unit.getClassLoader();
            EjbDeploymentSummary unitSummary = getEjbDeploymentSummary(unit, bean);
            cdmd.setUnitSummary(unitSummary);

            endpointMap.put(ejbCompID, cdmd);
            // debug info for the mappings each ejb has
            ArrayList<String> mappings = new ArrayList<String>();
            // Alternate mappings
            String ejbNameKey = "ejb/" + bean.getEjbName();
            if(endpointAlternateMap.containsKey(ejbNameKey) == false)
            {
               endpointAlternateMap.put(ejbNameKey, ejbCompID);
               mappings.add(ejbNameKey);
               if(trace)
                  log.trace("mapEjbs, added alternate root ejb-name: "+ejbNameKey);
            }
            else
            {
               log.debug("Duplicate root ejb-name: "+ejbNameKey+" from: "+ejbCompID);
            }
            // Create mappings based on the bean business interfaces
            if(bean instanceof JBossSessionBeanMetaData)
            {
               JBossSessionBeanMetaData sbean = (JBossSessionBeanMetaData) bean;
               String ejbName = sbean.getEjbName();
               // home
               if(sbean.getHome() != null && sbean.getHome().length() > 0)
               {
                  cdmd.addJndiName(sbean.determineResolvedJndiName(KnownInterfaces.HOME));
                  // Add ejb/vfsPath@iface
                  String home = sbean.getHome();
                  String ifacePath = prefix + "@" + home;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates home: "+home+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + home;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates home: "+home+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, home: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // remote
               if(sbean.getRemote() != null && sbean.getRemote().length() > 0)
               {
                  // Add ejb/vfsPath@iface
                  String remote = sbean.getRemote();
                  String remoteJndiName = sbean.determineJndiName();
                  cdmd.addJndiName(remoteJndiName);
                  String ifacePath = prefix + "@" + remote;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates remote: "+remote+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, remote: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + remote;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates remote: "+remote+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // local-home
               if(sbean.getLocalHome() != null && sbean.getLocalHome().length() > 0)
               {
                  cdmd.addJndiName(sbean.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME));
                  // Add ejb/vfsPath@iface
                  String local = sbean.getLocalHome();
                  String ifacePath = prefix + "@" + local;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates local-home: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + local;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates local-home: "+local+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // local
               if(sbean.getLocal() != null && sbean.getLocal().length() > 0)
               {
                  // Add ejb/vfsPath@iface
                  String local = sbean.getLocal();
                  String localJndiName = sbean.determineLocalJndiName();
                  cdmd.addJndiName(localJndiName);
                  String ifacePath = prefix + "@" + local;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates local: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + local;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates local: "+local+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
               }

               BusinessLocalsMetaData locals = sbean.getBusinessLocals();
               if(locals != null && locals.size() > 0)
               {
                  String localBaseJndiName = sbean.determineResolvedJndiName(KnownInterfaces.LOCAL);
                  cdmd.addJndiName(localBaseJndiName);
                  for(String local : locals)
                  {
                     // Add a targeted jndi name
                     String localJndiName = sbean.determineResolvedJndiName(local);
                     cdmd.addJndiName(localJndiName);
                     // Add ejb/vfsPath@iface
                     String ifacePath = prefix + "@" + local;
                     if(endpointAlternateMap.containsKey(ifacePath))
                        log.debug(ejbName+" duplicates business local: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
                     else
                     {
                        endpointAlternateMap.put(ifacePath, ejbCompID);
                        mappings.add(ifacePath);
                        if(trace)
                           log.trace("mapEjbs, business-local: "+ifacePath+", ejbName: "+ejbName);
                     }
                     // Add ejb/iface
                     ifacePath = "ejb@" + local;
                     if(endpointMap.containsKey(ifacePath))
                     {
                        // TODO: may need to track the duplicates to create an error
                        log.debug(ejbName+" duplicates business-local: "+local+", existing: "+endpointMap.get(ifacePath));
                     }
                     else
                     {
                        endpointAlternateMap.put(ifacePath, ejbCompID);
                        mappings.add(ifacePath);
                        if(trace)
                           log.trace("mapEjbs, business-local: "+ifacePath+", ejbName: "+ejbName);
                     }
                  }
               }
               BusinessRemotesMetaData remotes = sbean.getBusinessRemotes();
               if(remotes != null && remotes.size() > 0)
               {
                  String remoteBaseJndiName = sbean.determineResolvedJndiName(KnownInterfaces.REMOTE);
                  cdmd.addJndiName(remoteBaseJndiName);
                  for(String remote : remotes)
                  {
                     // Add a targeted jndi name
                     String remoteJndiName = sbean.determineResolvedJndiName(remote);
                     cdmd.addJndiName(remoteJndiName);
                     // Add ejb/vfsPath/iface
                     String ifacePath = prefix + "@" + remote;
                     if(endpointAlternateMap.containsKey(ifacePath))
                        log.debug(ejbName+" duplicates business remote: "+remote+", existing: "+endpointAlternateMap.get(ifacePath));
                     else
                     {
                        endpointAlternateMap.put(ifacePath, ejbCompID);
                        mappings.add(ifacePath);
                        if(trace)
                           log.trace("mapEjbs, business-remote: "+ifacePath+", ejbName: "+ejbName);
                     }
                     // Add ejb/iface
                     ifacePath = "ejb@" + remote;
                     if(endpointMap.containsKey(ifacePath))
                        log.debug(ejbName+" duplicates business-remote: "+remote+", existing: "+endpointMap.get(ifacePath));
                     else
                     {
                        endpointAlternateMap.put(ifacePath, ejbCompID);
                        mappings.add(ifacePath);
                        if(trace)
                           log.trace("mapEjbs, business-remote: "+ifacePath+", ejbName: "+ejbName);
                     }
                  }
               }
               if(trace)
                  log.trace("mapEjbs: "+ejbCompID+", mappings: "+mappings);
            }
            else if(bean instanceof JBossEntityBeanMetaData)
            {
               JBossEntityBeanMetaData ebean = (JBossEntityBeanMetaData) bean;
               String ejbName = ebean.getEjbName();
               // home
               if(ebean.getHome() != null && ebean.getHome().length() > 0)
               {
                  cdmd.addJndiName(ebean.determineResolvedJndiName(KnownInterfaces.HOME));
                  // Add ejb/vfsPath@iface
                  String home = ebean.getHome();
                  String ifacePath = prefix + "@" + home;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates home: "+home+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + home;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates home: "+home+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, home: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // remote
               if(ebean.getRemote() != null && ebean.getRemote().length() > 0)
               {
                  // Add ejb/vfsPath@iface
                  String remote = ebean.getRemote();
                  String ifacePath = prefix + "@" + remote;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates remote: "+remote+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, remote: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + remote;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates remote: "+remote+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // local-home
               if(ebean.getLocalHome() != null && ebean.getLocalHome().length() > 0)
               {
                  cdmd.addJndiName(ebean.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME));
                  // Add ejb/vfsPath@iface
                  String local = ebean.getLocalHome();
                  String ifacePath = prefix + "@" + local;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates local-home: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
View Full Code Here

      String vfsPath = unit.getRelativePath();
      for(JBossEnterpriseBeanMetaData bean : beans)
      {
         // Find the container dependency metadata
         String ejbCompID = "ejb/" + vfsPath + "#" + bean.getEjbName();
         ContainerDependencyMetaData cdmd = endpointMap.get(ejbCompID);
         if(cdmd == null)
            throw new IllegalStateException("Failed to find ContainerDependencyMetaData for: "+ejbCompID);
         Environment env = bean.getJndiEnvironmentRefsGroup();
         resolve(cdmd, unit, endpointMap, env, resolver,  unresolvedPaths);
      }
View Full Code Here

         if(info == null && iface != null)
            info = resolver.getEndpointInfo(iface, EndpointType.EJB, vfsContext);

         if(info != null)
         {
            ContainerDependencyMetaData target = endpointMap.get(info.getComponentKey());
            if(target != null)
            {
               cdmd.addDependency(target);
               // Determine the jndi name for the reference interface
               String ifaceName = iface != null ? iface.getName() : null;
              
               //LegacyEjb3JndiPolicy policy = new LegacyEjb3JndiPolicy();
               String containerJndiName = target.getBeanMetaData().determineResolvedJndiName(ifaceName);              
               if(containerJndiName != null)
                  ref.setResolvedJndiName(containerJndiName);
            }
            else
            {
View Full Code Here

         String link = ref.getLink();
         String mappedName = ref.getMappedName();
         // Use mapped name first
         if(mappedName == null || mappedName.length() == 0)
         {
            ContainerDependencyMetaData target = null;
            if(link != null)
            {
               EndpointInfo info = resolver.getEndpointInfo(link, EndpointType.EJB, vfsContext);
               if(info != null)
               {
                  target = endpointMap.get(info.getComponentKey());
               }
               else
               {
                  /* A non-local link without a # jar target. This is allowed
                     for java ee clients so we have to search all ejb deployments.
                     First get the vfspaths of the ejb deploymens.
                  */
                  List<String> ejbPaths = getEjbDeploymentPaths(unit);
                  for(String path : ejbPaths)
                  {
                     EndpointInfo altInfo = resolver.getEndpointInfo(link, EndpointType.EJB, path);
                     if(altInfo != null)
                        target = endpointMap.get(altInfo.getComponentKey());
                     if(target != null)
                        break;
                  }
               }
            }
            if(target == null && ref.getLocal() != null)
            {
               // Try the local interface type
               target = resolveEjbInterface(ref.getLocal(), unit,
                     endpointMap, resolver);
            }
            if(target == null)
               unresolvedRefs.add(cdmd.getComponentID()+":"+ref);
            else
            {
              
               // Need to look at the local jndi name
               String localInterface = ref.getLocal();
               JBossEnterpriseBeanMetaData md = target.getBeanMetaData();
              
               /*
                * If for a Session bean we've got a reference to an EJB2.x
                * Local Component interface, stop processing because these
                * are not bound in JNDI (only accessible via LocalHome.create()
View Full Code Here

         String link = ref.getLink();
         String mappedName = ref.getMappedName();
         // Use mapped name first
         if(mappedName == null || mappedName.length() == 0)
         {
            ContainerDependencyMetaData target = null;
            if(link != null)
            {
               EndpointInfo info = resolver.getEndpointInfo(link, EndpointType.EJB, vfsContext);
               if(info != null)
               {
                  target = endpointMap.get(info.getComponentKey());
               }
               else
               {
                  /* A non-local link without a # jar target. This is allowed
                     for java ee clients so we have to search all ejb deployments.
                     First get the vfspaths of the ejb deploymens.
                  */
                  List<String> ejbPaths = getEjbDeploymentPaths(unit);
                  for(String path : ejbPaths)
                  {
                     EndpointInfo altInfo = resolver.getEndpointInfo(link, EndpointType.EJB, path);
                     if(altInfo != null)
                        target = endpointMap.get(altInfo.getComponentKey());
                     if(target != null)
                        break;
                  }
               }
               if(target == null)
               {
                  unresolvedRefs.add(cdmd.getComponentID()+":"+ref);
                  continue;
               }
            }
            if(target == null && ref.getRemote() != null)
            {
               // Try the local interface type
               target = resolveEjbInterface(ref.getRemote(), unit,
                     endpointMap, resolver);
            }

            if(target == null)
               unresolvedRefs.add(cdmd.getComponentID()+":"+ref);
            else
            {
              
               // Obtain remote interface name
               String remoteInterface = ref.getRemote();
              
               // Get Metadata
               JBossEnterpriseBeanMetaData md = target.getBeanMetaData();
              
               /*
                * If for a Session bean we've got a reference to an EJB2.x
                * Remote Component interface, stop processing because these
                * are not bound in JNDI (only accessible via Home.create()
View Full Code Here

      {
         String mappedName = ref.getMappedName();
         if(mappedName == null || mappedName.length() == 0)
         {
            String link = ref.getLink();
            ContainerDependencyMetaData target = null;
            if(link != null)
            {
               EndpointInfo info = resolver.getEndpointInfo(link, EndpointType.MessageDestination, vfsContext);
               if(info != null)
               {
                  target = endpointMap.get(info.getComponentKey());
               }
            }
            if(target == null)
               unresolvedRefs.add(cdmd.getComponentID()+":"+ref);
            else
            {
               cdmd.addDependency(target);
               String containerJndiName = target.getContainerName();
               if(containerJndiName != null)
                  ref.setResolvedJndiName(containerJndiName);
            }
         }
         else
View Full Code Here

      Class<?> ifaceClass = loader.loadClass(iface);
      String vfsContext = unit.getRelativePath();
      EndpointInfo info = resolver.getEndpointInfo(ifaceClass, EndpointType.EJB, vfsContext);
      if(info == null)
         throw new IllegalStateException("Failed to find ContainerDependencyMetaData for interface: "+ iface);
      ContainerDependencyMetaData cdmd = endpointMap.get(info.getComponentKey());
      return cdmd;
   }
View Full Code Here

         // Create mc beans that declare the container ejb jndi name supplies
         if(endpoints != null)
         {
            String ejbKey = "ejb/" + vfsPath + "#" + bmd.getEjbName();
            ContainerDependencyMetaData cdmd = endpoints.get(ejbKey);
            if(cdmd != null)
            {
               // Create the metadata for the bean to install
               String mcname = ejbKey + ",uid"+System.identityHashCode(bmd);
               BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(mcname, Ejb2xMCContainer.class.getName());
               for(String jndiName : cdmd.getJndiNames())
               {
                  String supplyName = "jndi:" + jndiName;
                  builder.addSupply(supplyName);
               }
View Full Code Here

TOP

Related Classes of org.jboss.deployment.dependency.ContainerDependencyMetaData

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.