Examples of DependencyPolicy


Examples of org.jboss.ejb3.DependencyPolicy

         /*
          * Construct a DependencyPolicy for the MBean which will also
          * define a demand upon this container
          */
         DependencyPolicy containerPolicy = this.getDependencyPolicy();
         DependencyPolicy newPolicy = containerPolicy.clone();
         String cName = this.getObjectName().getCanonicalName();
         newPolicy.addDependency(cName);

         // Find MBean Server if not specified
         if (mbeanServer == null)
         {
            try
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

         // add BMD to parent, since this is a component DU. and BMDDeployer doesn't pick up BMD from components!
         unit.getParent().addAttachment(BeanMetaData.class + ":" + injectorMCBeanName, injectorBMD);
        
         // Add the Injector dependency on the deployment (so that the DU doesn't
         // get started till the Injector is available)
         DependencyPolicy dependsPolicy = container.getDependencyPolicy();
         dependsPolicy.addDependency(injectorMCBeanName);
         log.debug("Added Injector dependency: " + injectorMCBeanName + " for EJB: " + container.getEjbName() + " in unit " + unit);
      }
     
      // Now setup injectors for the interceptors of the bean
      InterceptorsMetaData interceptors = JBossMetaData.getInterceptors(beanMetaData.getEjbName(), beanMetaData.getJBossMetaData());
      if (interceptors == null || interceptors.isEmpty())
      {
         return;
      }
      for (InterceptorMetaData interceptor : interceptors)
      {
         if (interceptor == null)
         {
            continue;
         }
         JndiEnvironmentRefsGroup jndiEnvironmentForInterceptor = new JndiEnvironmentImpl(interceptor, container.getClassloader());
         // For optimization, we'll create an Injector only if there's atleast one InjectionTarget
         if (this.hasInjectionTargets(jndiEnvironmentForInterceptor))
         {
            // create the injector
            EEInjector eeInjector = new EEInjector(jndiEnvironmentForInterceptor);
            // add the injector the injection manager
            injectionManager.addInjector(eeInjector);
            // Deploy the Injector as a MC bean (so that the fully populated naming context (obtained via the SwitchBoard
            // Barrier) gets injected.
            String interceptorInjectorMCBeanName = this.getInjectorMCBeanNamePrefix(unit) + ",bean=" + container.getEjbName() + ",interceptor=" + interceptor.getName();
            BeanMetaData injectorBMD = this.createInjectorBMD(interceptorInjectorMCBeanName, eeInjector, switchBoard);
            // add BMD to parent, since this is a component DU. and BMDDeployer doesn't pick up BMD from components!
            unit.getParent().addAttachment(BeanMetaData.class + ":" + interceptorInjectorMCBeanName, injectorBMD);
           
            // Add the Injector dependency on the deployment (so that the DU doesn't
            // get started till the Injector is available)
            DependencyPolicy dependsPolicy = container.getDependencyPolicy();
            dependsPolicy.addDependency(interceptorInjectorMCBeanName);
            log.debug("Added Injector dependency: " + interceptorInjectorMCBeanName + " for interceptor "
                  + interceptor.getName() + " of EJB: " + container.getEjbName() + " in unit " + unit);
         }
        
      }
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

   {
      BeanMetaDataBuilder containerBMDBuilder = BeanMetaDataBuilder.createBuilder(containerMCBeanName, container
            .getClass().getName());
      containerBMDBuilder.setConstructorValue(container);

      DependencyPolicy containerDependencyPolicy = container.getDependencyPolicy();

      // Add dependency on switchboard
      Barrier switchBoard = unit.getAttachment(Barrier.class);
      // the container cannot function without an SwitchBoard Barrier
      if (switchBoard == null)
      {
         throw new RuntimeException("No SwitchBoard Barrier found for bean: " + container.getEjbName() + " in unit: " + unit);
      }
      // add dependency on START (and not INSTALLED) state of Switchboard, since the container only requires a fully populated ENC context,
      // but doesn't require a invokable context. An invokable context is only needed by Injector.
      containerBMDBuilder.addDemand(switchBoard.getId(), ControllerState.CREATE, ControllerState.START, null);
      logger.debug("Added dependency on switchboard " + switchBoard.getId() + " for container " + container.getName());
     
      InjectionManager injectionManager = unit.getAttachment(InjectionManager.class);
      // the container cannot function without an InjectionManager
      if (injectionManager == null)
      {
         throw new RuntimeException("No InjectionManager found for bean: " + container.getEjbName() + " in unit: " + unit);
      }
      // set the InjectionManager on the container
      container.setInjectionManager(injectionManager);
      // add EEInjector to InjectionManager
      this.setupInjectors(unit, container, injectionManager, switchBoard);
     
      // Process @DependsOn/depends-on
      // Add any dependencies based on @DependsOn/depends-on elements
      JBossSessionBean31MetaData sessionBeanMetaData = (JBossSessionBean31MetaData) container.getMetaData();
      String[] dependsOn = sessionBeanMetaData.getDependsOn();
      if (dependsOn != null)
      {
         AbstractListMetaData containerDependencies = new AbstractListMetaData();
         EjbLinkResolver ejbLinkResolver = new EjbLinkResolver();
         for (String dependency : dependsOn)
         {
            // resolve the EJB through the ejb link in depends-on
            JBossEnterpriseBeanMetaData dependencyBean = ejbLinkResolver.resolveEJB(dependency, unit);
            if (dependencyBean == null)
            {
               throw new RuntimeException("Could not resolve bean for @DependsOn/depends-on with ejb-name: "
                     + dependency + " while processing EJB named " + container.getEJBName());
            }
            if (isSingletonBean(dependencyBean) == false)
            {
               throw new RuntimeException("@DependsOn/depends-on can only refer to Singleton beans. "
                     + dependencyBean.getEjbClass() + " is not a singleton bean");
            }
            // when a singleton bean depends on the other singleton bean, we add:
            // 1) A dependency on the target EJB container. This we do by injecting the target EJB container
            // into this container being installed. The injected target containers will then be used
            // to instantiate the target @Depends bean (at the appropriate time)
            // 2) A dependency on each of the exposed JNDI names of the target EJB (so that the
            // target EJB can be accessed through JNDI within the dependent EJB)
           
            // get the exposed JNDI names
            List<String> jndiNames = this.getExposedJNDINames((JBossSessionBean31MetaData) dependencyBean);
            for (String jndiName : jndiNames)
            {
               // add each jndi name as a dependency
               // Note: The dependency resolution of a dependency with prefix JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX
               // is handled by JNDIKernelRegistryPlugin, which does a JNDI lookup to see if the dependency is resolved.
               // Effectively, none of the MC beans have to add the jndi name as an explicit supply. So when the
               // corresponding jndi binder binds this jndi name to JNDI tree, the dependency will be marked as resolved
               containerDependencyPolicy.addDependency(JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX + jndiName);
            }
            String dependencyBeanContainerName = dependencyBean.getContainerName();
            // create a @Inject
            AbstractInjectionValueMetaData containerDependencyInjection = new AbstractInjectionValueMetaData(dependencyBeanContainerName);
            // add the @Inject to a list which will then be set on the container
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

         /*
          * Construct a DependencyPolicy for the MBean which will also
          * define a demand upon this container
          */
         DependencyPolicy containerPolicy = this.getDependencyPolicy();
         DependencyPolicy newPolicy = containerPolicy.clone();
         String cName = this.getObjectName().getCanonicalName();
         newPolicy.addDependency(cName);

         // Find MBean Server if not specified
         if (mbeanServer == null)
         {
            try
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

        
         /*
          * Construct a DependencyPolicy for the MBean which will also
          * define a demand upon this container
          */
         DependencyPolicy containerPolicy = this.getDependencyPolicy();
         DependencyPolicy newPolicy = containerPolicy.clone();
         String cName = this.getObjectName().getCanonicalName();
         newPolicy.addDependency(cName);
        
         // Find MBean Server if not specified
         if (mbeanServer == null)
         {
            try
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

         /*
          * Construct a DependencyPolicy for the MBean which will also
          * define a demand upon this container
          */
         DependencyPolicy containerPolicy = this.getDependencyPolicy();
         DependencyPolicy newPolicy = containerPolicy.clone();
         String cName = this.getObjectName().getCanonicalName();
         newPolicy.addDependency(cName);

         // Find MBean Server if not specified
         if (mbeanServer == null)
         {
            try
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

         /*
          * Construct a DependencyPolicy for the MBean which will also
          * define a demand upon this container
          */
         DependencyPolicy containerPolicy = this.getDependencyPolicy();
         DependencyPolicy newPolicy = containerPolicy.clone();
         String cName = this.getObjectName().getCanonicalName();
         newPolicy.addDependency(cName);

         // Find MBean Server if not specified
         if (mbeanServer == null)
         {
            try
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

   {
      BeanMetaDataBuilder containerBMDBuilder = BeanMetaDataBuilder.createBuilder(containerMCBeanName, container
            .getClass().getName());
      containerBMDBuilder.setConstructorValue(container);

      DependencyPolicy containerDependencyPolicy = container.getDependencyPolicy();

      // Process @DependsOn/depends-on
      // Add any dependencies based on @DependsOn/depends-on elements
      JBossSessionBean31MetaData sessionBeanMetaData = (JBossSessionBean31MetaData) container.getMetaData();
      String[] dependsOn = sessionBeanMetaData.getDependsOn();
      if (dependsOn != null)
      {
         EjbLinkResolver ejbLinkResolver = new EjbLinkResolver();
         for (String dependency : dependsOn)
         {
            // resolve the EJB through the ejb link in depends-on
            JBossEnterpriseBeanMetaData dependencyBean = ejbLinkResolver.resolveEJB(dependency, unit);
            if (dependencyBean == null)
            {
               throw new RuntimeException("Could not resolve bean for @DependsOn/depends-on with ejb-name: "
                     + dependency + " while processing EJB named " + container.getEJBName());
            }
            if (isSingletonBean(dependencyBean) == false)
            {
               throw new RuntimeException("@DependsOn/depends-on can only refer to Singleton beans. "
                     + dependencyBean.getEjbClass() + " is not a singleton bean");
            }
            // when a singleton bean depends on the other singleton bean, we add:
            // 1) A dependency on the target EJB container
            // 2) A dependency on each of the exposed JNDI names of the target EJB (so that the
            // target EJB can be accessed through JNDI within the dependent EJB)
           
            // get the exposed JNDI names
            List<String> jndiNames = this.getExposedJNDINames((JBossSessionBean31MetaData) dependencyBean);
            for (String jndiName : jndiNames)
            {
               // add each jndi name as a dependency
               // Note: The dependency resolution of a dependency with prefix JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX
               // is handled by JNDIKernelRegistryPlugin, which does a JNDI lookup to see if the dependency is resolved.
               // Effectively, none of the MC beans have to add the jndi name as an explicit supply. So when the
               // corresponding jndi binder binds this jndi name to JNDI tree, the dependency will be marked as resolved
               containerDependencyPolicy.addDependency(JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX + jndiName);
            }
            String dependencyBeanContainerName = dependencyBean.getContainerName();
            containerDependencyPolicy.addDependency(dependencyBeanContainerName);

         }
      }

      logger.debug("Installing container for EJB " + container.getEJBName());
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

   {
      BeanMetaDataBuilder containerBMDBuilder = BeanMetaDataBuilder.createBuilder(containerMCBeanName, container
            .getClass().getName());
      containerBMDBuilder.setConstructorValue(container);

      DependencyPolicy containerDependencyPolicy = container.getDependencyPolicy();

      // Add dependency on switchboard
      Barrier switchBoard = unit.getAttachment(Barrier.class);
      // the container cannot function without an SwitchBoard Barrier
      if (switchBoard == null)
      {
         throw new RuntimeException("No SwitchBoard Barrier found for bean: " + container.getEjbName() + " in unit: " + unit);
      }
      // add dependency on START (and not INSTALLED) state of Switchboard, since the container only requires a fully populated ENC context,
      // but doesn't require a invokable context. An invokable context is only needed by Injector.
      containerBMDBuilder.addDemand(switchBoard.getId(), ControllerState.CREATE, ControllerState.START, null);
      logger.debug("Added dependency on switchboard " + switchBoard.getId() + " for container " + container.getName());
     
      InjectionManager injectionManager = unit.getAttachment(InjectionManager.class);
      // the container cannot function without an InjectionManager
      if (injectionManager == null)
      {
         throw new RuntimeException("No InjectionManager found for bean: " + container.getEjbName() + " in unit: " + unit);
      }
      // set the InjectionManager on the container
      container.setInjectionManager(injectionManager);
      // add EEInjector to InjectionManager
      this.setupInjectors(unit, container, injectionManager, switchBoard);
     
      // Process @DependsOn/depends-on
      // Add any dependencies based on @DependsOn/depends-on elements
      JBossSessionBean31MetaData sessionBeanMetaData = (JBossSessionBean31MetaData) container.getMetaData();
      String[] dependsOn = sessionBeanMetaData.getDependsOn();
      if (dependsOn != null)
      {
         AbstractListMetaData containerDependencies = new AbstractListMetaData();
         EjbLinkResolver ejbLinkResolver = new EjbLinkResolver();
         for (String dependency : dependsOn)
         {
            // resolve the EJB through the ejb link in depends-on
            JBossEnterpriseBeanMetaData dependencyBean = ejbLinkResolver.resolveEJB(dependency, unit);
            if (dependencyBean == null)
            {
               throw new RuntimeException("Could not resolve bean for @DependsOn/depends-on with ejb-name: "
                     + dependency + " while processing EJB named " + container.getEJBName());
            }
            if (isSingletonBean(dependencyBean) == false)
            {
               throw new RuntimeException("@DependsOn/depends-on can only refer to Singleton beans. "
                     + dependencyBean.getEjbClass() + " is not a singleton bean");
            }
            // when a singleton bean depends on the other singleton bean, we add:
            // 1) A dependency on the target EJB container. This we do by injecting the target EJB container
            // into this container being installed. The injected target containers will then be used
            // to instantiate the target @Depends bean (at the appropriate time)
            // 2) A dependency on each of the exposed JNDI names of the target EJB (so that the
            // target EJB can be accessed through JNDI within the dependent EJB)
           
            // get the exposed JNDI names
            List<String> jndiNames = this.getExposedJNDINames((JBossSessionBean31MetaData) dependencyBean);
            for (String jndiName : jndiNames)
            {
               // add each jndi name as a dependency
               // Note: The dependency resolution of a dependency with prefix JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX
               // is handled by JNDIKernelRegistryPlugin, which does a JNDI lookup to see if the dependency is resolved.
               // Effectively, none of the MC beans have to add the jndi name as an explicit supply. So when the
               // corresponding jndi binder binds this jndi name to JNDI tree, the dependency will be marked as resolved
               containerDependencyPolicy.addDependency(JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX + jndiName);
            }
            String dependencyBeanContainerName = dependencyBean.getContainerName();
            // create a @Inject
            AbstractInjectionValueMetaData containerDependencyInjection = new AbstractInjectionValueMetaData(dependencyBeanContainerName);
            // add the @Inject to a list which will then be set on the container
View Full Code Here

Examples of org.jboss.ejb3.DependencyPolicy

         // add BMD to parent, since this is a component DU. and BMDDeployer doesn't pick up BMD from components!
         unit.getParent().addAttachment(BeanMetaData.class + ":" + injectorMCBeanName, injectorBMD);
        
         // Add the Injector dependency on the deployment (so that the DU doesn't
         // get started till the Injector is available)
         DependencyPolicy dependsPolicy = container.getDependencyPolicy();
         dependsPolicy.addDependency(injectorMCBeanName);
         log.debug("Added Injector dependency: " + injectorMCBeanName + " for EJB: " + container.getEjbName() + " in unit " + unit);
      }
     
      // Now setup injectors for the interceptors of the bean
      InterceptorsMetaData interceptors = JBossMetaData.getInterceptors(beanMetaData.getEjbName(), beanMetaData.getJBossMetaData());
      if (interceptors == null || interceptors.isEmpty())
      {
         return;
      }
      for (InterceptorMetaData interceptor : interceptors)
      {
         if (interceptor == null)
         {
            continue;
         }
         JndiEnvironmentRefsGroup jndiEnvironmentForInterceptor = new JndiEnvironmentImpl(interceptor, container.getClassloader());
         // For optimization, we'll create an Injector only if there's atleast one InjectionTarget
         if (this.hasInjectionTargets(jndiEnvironmentForInterceptor))
         {
            // create the injector
            EEInjector eeInjector = new EEInjector(jndiEnvironmentForInterceptor);
            // add the injector the injection manager
            injectionManager.addInjector(eeInjector);
            // Deploy the Injector as a MC bean (so that the fully populated naming context (obtained via the SwitchBoard
            // Barrier) gets injected.
            String interceptorInjectorMCBeanName = this.getInjectorMCBeanNamePrefix(unit) + ",bean=" + container.getEjbName() + ",interceptor=" + interceptor.getName();
            BeanMetaData injectorBMD = this.createInjectorBMD(interceptorInjectorMCBeanName, eeInjector, switchBoard);
            // add BMD to parent, since this is a component DU. and BMDDeployer doesn't pick up BMD from components!
            unit.getParent().addAttachment(BeanMetaData.class + ":" + interceptorInjectorMCBeanName, injectorBMD);
           
            // Add the Injector dependency on the deployment (so that the DU doesn't
            // get started till the Injector is available)
            DependencyPolicy dependsPolicy = container.getDependencyPolicy();
            dependsPolicy.addDependency(interceptorInjectorMCBeanName);
            log.debug("Added Injector dependency: " + interceptorInjectorMCBeanName + " for interceptor "
                  + interceptor.getName() + " of EJB: " + container.getEjbName() + " in unit " + unit);
         }
        
      }
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.