News Admin problem
phillj Nov 28, 2004 1:56 PMI've written a simple XML deployer.
The implementation is in
org.jboss.kernel.plugins.deployment.xml.XMLKernelDeployer
It uses Alexey's new MappingObjectModel from JBossXB, very nice :-)
You can define your parser in just a few lines of code;
e.g. currently I have
objectModelFactory = new MappingObjectModelFactory(); objectModelFactory.mapElementToClass("deployment", AbstractKernelDeployment.class); objectModelFactory.mapElementToClass("beans", ArrayList.class); objectModelFactory.mapElementToClass("bean", AbstractBeanMetaData.class); objectModelFactory.mapElementToClass("constructorParams", ArrayList.class); objectModelFactory.mapElementToClass("dependency", AbstractDependencyValueMetaData.class); objectModelFactory.mapElementToField("dependentState", AbstractDependencyValueMetaData.class, "dependentState", StateConverter.instance); objectModelFactory.mapElementToClass("parameter", AbstractParameterMetaData.class); objectModelFactory.mapElementToField("dependency", AbstractParameterMetaData.class, "value", TypeConverter.STRING); objectModelFactory.mapElementToClass("value", StringValueMetaData.class); objectModelFactory.mapElementToClass("attributes", HashSet.class); objectModelFactory.mapElementToClass("attribute", AbstractAttributeMetaData.class); objectModelFactory.mapElementToField("dependency", AbstractAttributeMetaData.class, "value", TypeConverter.STRING); objectModelFactory.mapElementToClass("demands", HashSet.class); objectModelFactory.mapElementToClass("demand", AbstractDemandMetaData.class); objectModelFactory.mapElementToField("whenRequired", AbstractDemandMetaData.class, "whenRequired", StateConverter.instance); objectModelFactory.mapElementToClass("supplies", HashSet.class); objectModelFactory.mapElementToClass("supply", AbstractSupplyMetaData.class); objectModelFactory.mapElementToClass("interceptors", ArrayList.class); objectModelFactory.mapElementToClass("interceptor", AbstractInterceptorMetaData.class);
There are some examples used by the tests in
jboss-head/kernel/src/resources/test/org/jboss/test/kernel/xml/test