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);
}
});
// 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 beans = deployment.getBeans();
if (beans == null)
{
beans = new ArrayList();
deployment.setBeans(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 beans = deployment.getBeans();
if (beans == null)
{
beans = new ArrayList();
deployment.setBeans(beans);
}
beans.add(bean);
}
});
// bean binding
TypeBinding beanType = schemaBinding.getType(beanTypeQName);
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)
{
}