Package org.jboss.beans.metadata.spi

Examples of org.jboss.beans.metadata.spi.ClassLoaderMetaData


      if (requiredState != null)
         context.setRequiredState(requiredState);
      if (mode != null)
         context.setMode(mode);
      // Use any deployment classloader if present and the bean doesn't have one
      ClassLoaderMetaData beanClassLoader = bean.getClassLoader();
      if (beanClassLoader == null && deployment != null)
      {
         ClassLoaderMetaData deploymentClassLoader = deployment.getClassLoader();
         if (deploymentClassLoader != null)
            bean.setClassLoader(deploymentClassLoader);
      }
      controller.install(context);
      return context;
View Full Code Here


    * @return the classloader
    * @throws Throwable for any error
    */
   public static ClassLoader getClassLoader(BeanMetaData metaData) throws Throwable
   {
      ClassLoaderMetaData clmd = null;
      if (metaData != null)
         clmd = metaData.getClassLoader();
      return getClassLoader(clmd);
   }
View Full Code Here

         try
         {
            controller.uninstall(deployment.getName());
           
            // Remove any classloader metadata we added (not necessary if we clone above)
            ClassLoaderMetaData classLoader = deployment.getClassLoader();
            if (classLoader instanceof DeploymentClassLoaderMetaData)
               deployment.setClassLoader(null);
         }
         catch(Throwable t)
         {
View Full Code Here

   {
      ControllerContext context = controller.uninstall(deployment.getName());
      removeContext(context, unit.getParent());

      // Remove any classloader metadata we added (not necessary if we clone above)
      ClassLoaderMetaData classLoader = deployment.getClassLoader();
      if (classLoader instanceof DeploymentClassLoaderMetaData)
         deployment.setClassLoader(null);
   }
View Full Code Here

   public void undeploy(DeploymentUnit unit, BeanMetaData deployment)
   {
      controller.uninstall(deployment.getName());
     
      // Remove any classloader metadata we added (not necessary if we clone above)
      ClassLoaderMetaData classLoader = deployment.getClassLoader();
      if (classLoader instanceof DeploymentClassLoaderMetaData)
         deployment.setClassLoader(null);
   }
View Full Code Here

         ControllerContext context = controller.uninstall(deployment.getName());
         removeContext(context, unit.getParent());
      }
     
      // Remove any classloader metadata we added (not necessary if we clone above)
      ClassLoaderMetaData classLoader = deployment.getClassLoader();
      if (classLoader instanceof DeploymentClassLoaderMetaData)
         deployment.setClassLoader(null);
   }
View Full Code Here

         ControllerContext context = controller.uninstall(deployment.getName());
         removeContext(context, unit.getParent());
      }
     
      // Remove any classloader metadata we added (not necessary if we clone above)
      ClassLoaderMetaData classLoader = deployment.getClassLoader();
      if (classLoader instanceof DeploymentClassLoaderMetaData)
         deployment.setClassLoader(null);
   }
View Full Code Here

   public void undeploy(DeploymentUnit unit, BeanMetaData deployment)
   {
      controller.uninstall(deployment.getName());
     
      // Remove any classloader metadata we added (not necessary if we clone above)
      ClassLoaderMetaData classLoader = deployment.getClassLoader();
      if (classLoader instanceof DeploymentClassLoaderMetaData)
         deployment.setClassLoader(null);
   }
View Full Code Here

    * @return the classloader
    * @throws Throwable for any error
    */
   public static ClassLoader getClassLoader(BeanMetaData metaData) throws Throwable
   {
      ClassLoaderMetaData clmd = null;
      if (metaData != null)
         clmd = metaData.getClassLoader();
      return getClassLoader(clmd);
   }
View Full Code Here

   public List<BeanMetaData> getBeans()
   {
      List<BeanMetaData> result = new ArrayList<BeanMetaData>();
     
      // Include the classloader if it is a bean
      ClassLoaderMetaData classLoaderMetaData = getClassLoader();
      if (classLoaderMetaData != null)
      {
         ValueMetaData classLoader = classLoaderMetaData.getClassLoader();
         if (classLoader instanceof BeanMetaData)
         {
            // Hack, if it doesn't have a classloader use the "null" classloader
            // we don't want it to gain itself as the classloader
            BeanMetaData classLoaderBean = (BeanMetaData) classLoader;
            if (classLoaderBean.getClassLoader() == null)
               classLoaderBean.setClassLoader(new AbstractClassLoaderMetaData(new AbstractValueMetaData()));
            result.add((BeanMetaData) classLoader);
         }
      }

      List<BeanMetaDataFactory> factories = getBeanFactories();
      if (factories != null && factories.isEmpty() == false)
      {
         for (BeanMetaDataFactory factory : factories)
         {
            if (factory == null)
               throw new IllegalArgumentException("BeanMetaDataFactory cannot be null.");

            List<BeanMetaData> beans = factory.getBeans();
            if (beans != null && beans.isEmpty() == false)
            {
               for (BeanMetaData bmd : beans)
               {
                  if (bmd == null)
                     throw new IllegalArgumentException("Bean meta data cannot be null.");

                  // check annotations
                  if (annotations != null && annotations.isEmpty() == false)
                  {
                     Set<AnnotationMetaData> annotationsBMD = bmd.getAnnotations();
                     if (annotationsBMD == null)
                     {
                        annotationsBMD = new HashSet<AnnotationMetaData>();
                        bmd.setAnnotations(annotationsBMD);
                     }
                     annotationsBMD.addAll(annotations);
                  }

                  // impl specific
                  if (bmd instanceof AbstractBeanMetaData)
                  {
                     AbstractBeanMetaData bean = (AbstractBeanMetaData)bmd;
                     // set deployment defaults, if not already set per bean
                     if (bean.getCreate() == null && getCreate() != null)
                     {
                        bean.setCreate(getCreate());
                     }
                     if (bean.getStart() == null && getStart() != null)
                     {
                        bean.setStart(getStart());
                     }
                     if (bean.getStop() == null && getStop() != null)
                     {
                        bean.setStop(getStop());
                     }
                     if (bean.getDestroy() == null && getDestroy() != null)
                     {
                        bean.setDestroy(getDestroy());
                     }

                     // controller mode
                     if (bean.getMode() == null && getMode() != null)
                     {
                        bean.setMode(getMode());
                     }
                  }

                  // Use any deployment classloader if present and the bean doesn't have one
                  ClassLoaderMetaData beanClassLoader = bmd.getClassLoader();
                  if (beanClassLoader == null)
                  {
                     ClassLoaderMetaData deploymentClassLoader = getClassLoader();
                     if (deploymentClassLoader != null)
                     {
                        // If the deployment classloader is a bean, replace it with an injection
                        ValueMetaData classLoader = deploymentClassLoader.getClassLoader();
                        if (classLoader instanceof BeanMetaData)
                        {
                           classLoader = new AbstractDependencyValueMetaData(((BeanMetaData) classLoader).getName());
                           beanClassLoader = new AbstractClassLoaderMetaData(classLoader);
                        }
View Full Code Here

TOP

Related Classes of org.jboss.beans.metadata.spi.ClassLoaderMetaData

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.