Package org.jboss.beans.metadata.plugins

Examples of org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData


   public static final BeanClassLoaderInterceptor INTERCEPTOR = new BeanClassLoaderInterceptor();

   public void add(Object parent, Object child, QName name)
   {
      AbstractBeanMetaData bean = (AbstractBeanMetaData) parent;
      AbstractClassLoaderMetaData classloader = (AbstractClassLoaderMetaData) child;
      bean.setClassLoader(classloader);
   }
View Full Code Here


      deploymentType.pushInterceptor(classloaderQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractKernelDeployment deployment = (AbstractKernelDeployment) parent;
            AbstractClassLoaderMetaData classloader = (AbstractClassLoaderMetaData) child;
            deployment.setClassLoader(classloader);
            // add classloaders as value beans
            List<BeanMetaDataFactory> beans = deployment.getBeanFactories();
            if (beans == null)
            {
               beans = new ArrayList<BeanMetaDataFactory>();
               deployment.setBeanFactories(beans);
            }
            beans.add(classloader);
         }
      });

      // deployment has a list beans
      deploymentType.pushInterceptor(beanQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractKernelDeployment deployment = (AbstractKernelDeployment) parent;
            AbstractBeanMetaData bean = (AbstractBeanMetaData) child;
            List<BeanMetaDataFactory> beans = deployment.getBeanFactories();
            if (beans == null)
            {
               beans = new ArrayList<BeanMetaDataFactory>();
               deployment.setBeanFactories(beans);
            }
            beans.add(bean);
         }
      });

      // deployment has a list beanfactorys
      deploymentType.pushInterceptor(beanFactoryQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractKernelDeployment deployment = (AbstractKernelDeployment) parent;
            AbstractBeanMetaData bean = (AbstractBeanMetaData) child;
            List<BeanMetaDataFactory> beans = deployment.getBeanFactories();
            if (beans == null)
            {
               beans = new ArrayList<BeanMetaDataFactory>();
               deployment.setBeanFactories(beans);
            }
            beans.add(bean);
         }
      });

      // bean binding
      TypeBinding beanType = schemaBinding.getType(beanTypeQName);

      /*
      ClassMetaData classMetaData = new ClassMetaData();
      classMetaData.setImpl(AbstractBeanMetaData.class.getName());
      beanType.setClassMetaData(classMetaData);
     
      QName CLASS = new QName("class");
      AttributeBinding attribute = beanType.getAttribute(CLASS);
      PropertyMetaData propertyMetaData = new PropertyMetaData();
      propertyMetaData.setName("bean");
      attribute.setPropertyMetaData(propertyMetaData);

      QName MODE = new QName("mode");
      attribute = beanType.getAttribute(MODE);
      ValueAdapter modeAdapter = new ValueAdapter()
      {
         public Object cast(Object o, Class c)
         {
            String string = (String) o;
            return new ControllerMode(string);
         }
      };
      attribute.setValueAdapter(modeAdapter);
      */
      beanType.setHandler(new DefaultElementHandler()
      {
        
         public Object startElement(Object parent, QName name, ElementBinding element)
         {
            return new AbstractBeanMetaData();
         }

         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
         {
            AbstractBeanMetaData bean = (AbstractBeanMetaData) o;
            for (int i = 0; i < attrs.getLength(); ++i)
            {
               String localName = attrs.getLocalName(i);
               if ("name".equals(localName))
                  bean.setName(attrs.getValue(i));
               else if ("class".equals(localName))
                  bean.setBean(attrs.getValue(i));
               else if ("mode".equals(localName))
                  bean.setMode(new ControllerMode(attrs.getValue(i)));
            }
         }
      });

      // beanfactory binding
      TypeBinding beanFactoryType = schemaBinding.getType(beanFactoryTypeQName);
      beanFactoryType.setHandler(new DefaultElementHandler()
      {
         public Object startElement(Object parent, QName name, ElementBinding element)
         {
            return new GenericBeanFactoryMetaData();
         }

         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
         {
            GenericBeanFactoryMetaData bean = (GenericBeanFactoryMetaData) o;
            for (int i = 0; i < attrs.getLength(); ++i)
            {
               String localName = attrs.getLocalName(i);
               if ("name".equals(localName))
                  bean.setName(attrs.getValue(i));
               else if ("class".equals(localName))
                  bean.setBeanClass(attrs.getValue(i));
               else if ("mode".equals(localName))
                  bean.setMode(new ControllerMode(attrs.getValue(i)));
            }
         }
      });

      // bean has a classloader
      beanType.pushInterceptor(classloaderQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractBeanMetaData bean = (AbstractBeanMetaData) parent;
            AbstractClassLoaderMetaData classloader = (AbstractClassLoaderMetaData) child;
            bean.setClassLoader(classloader);
         }
      });

      // beanfactory has a classloader
      beanFactoryType.pushInterceptor(classloaderQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            GenericBeanFactoryMetaData bean = (GenericBeanFactoryMetaData) parent;
            AbstractClassLoaderMetaData classloader = (AbstractClassLoaderMetaData) child;
            bean.setClassLoader(classloader);
         }
      });

      // bean has a constructor
      beanType.pushInterceptor(constructorQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractBeanMetaData bean = (AbstractBeanMetaData) parent;
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) child;
            bean.setConstructor(constructor);
         }
      });

      // beanfactory has a constructor
      beanFactoryType.pushInterceptor(constructorQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            GenericBeanFactoryMetaData bean = (GenericBeanFactoryMetaData) parent;
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) child;
            bean.setBeanConstructor(constructor);
         }
      });

      // classloader binding
      TypeBinding classloaderType = schemaBinding.getType(classloaderTypeQName);
      configureValueBindings(classloaderType);
      classloaderType.setHandler(new DefaultElementHandler()
      {
         public Object startElement(Object parent, QName name, ElementBinding element)
         {
            return new AbstractClassLoaderMetaData();
         }

         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
         {
         }
View Full Code Here

         ValueMetaData value = (ValueMetaData) child;
         valueMetaData.setValue(value);
      }
      else if (parent instanceof AbstractClassLoaderMetaData)
      {
         AbstractClassLoaderMetaData valueMetaData = (AbstractClassLoaderMetaData) parent;
         ValueMetaData value = (ValueMetaData) child;
         valueMetaData.setClassLoader(value);
      }
      else if (parent instanceof AbstractConstructorMetaData)
      {
         AbstractConstructorMetaData valueMetaData = (AbstractConstructorMetaData) parent;
         ValueMetaData value = (ValueMetaData) child;
         valueMetaData.setValue(value);
      }
      else
      {
         AbstractValueMetaData valueMetaData = (AbstractValueMetaData) parent;
         ValueMetaData value = (ValueMetaData) child;
         valueMetaData.setValue(value);
      }
   }
View Full Code Here

            AbstractPropertyMetaData valueMetaData = (AbstractPropertyMetaData) parent;
            valueMetaData.setValue(new AbstractValueMetaData());
         }
         else if (parent instanceof AbstractClassLoaderMetaData)
         {
            AbstractClassLoaderMetaData valueMetaData = (AbstractClassLoaderMetaData) parent;
            valueMetaData.setClassLoader(new AbstractValueMetaData());
         }
         else
         {
            AbstractValueMetaData valueMetaData = (AbstractValueMetaData) parent;
            valueMetaData.setValue(new AbstractValueMetaData());
         }
      }
View Full Code Here

            ValueMetaData value = (ValueMetaData) child;
            valueMetaData.setValue(value);
         }
         else if (parent instanceof AbstractClassLoaderMetaData)
         {
            AbstractClassLoaderMetaData valueMetaData = (AbstractClassLoaderMetaData) parent;
            ValueMetaData value = (ValueMetaData) child;
            valueMetaData.setClassLoader(value);
         }
         else
         {
            AbstractValueMetaData valueMetaData = (AbstractValueMetaData) parent;
            ValueMetaData value = (ValueMetaData) child;
            valueMetaData.setValue(value);
         }
      }
View Full Code Here

   /** The handler */
   public static final ClassLoaderHandler HANDLER = new ClassLoaderHandler();

   public Object startElement(Object parent, QName name, ElementBinding element)
   {
      return new AbstractClassLoaderMetaData();
   }
View Full Code Here

   {
   }

   public Object endElement(Object o, QName qName, ElementBinding element)
   {
      AbstractClassLoaderMetaData classLoader = (AbstractClassLoaderMetaData) o;
      if (classLoader.getClassLoader() == null)
         throw new IllegalArgumentException("ClassLoader should have a nested value.");
      return classLoader;
   }
View Full Code Here

TOP

Related Classes of org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData

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.