$Rev: 46019 $ $Date: 2004-09-14 04:56:06 -0500 (Tue, 14 Sep 2004) $
Configurator conf = new Configurator(); conf.typeDef("buildpath", "Sample$BuildPath"); conf.typeDef("xinterface", "Sample$XInterface"); Sample.MyFileSelector mfs = new Sample.MyFileSelector(); conf.setRoot(mfs); conf.startCreateChild("buildpath"); conf.setAttribute("path", "."); conf.setAttribute("url", "abc"); conf.startCreateChild("xinterface"); conf.setAttribute("count", "4"); conf.endCreateChild(); // xinterface conf.endCreateChild(); // buildpath
The Configurator is an idea borrowed by the Ant project. It is a SAX2 handler that reads a config file which is represented by a hierarchy of Java beans. For example:
<outerBean foo="true" bar="Quite right"> <innerBean whatever="57"> </innerBean </outerBean>The example would create an object outerBean and call its methods
setFoo(boolean)
and setBar(String)
to process the attributes. It would also create a bean innerBean by calling the outerBeans method createInnerBean()
. Finally the innerBean is configured by calling setWhatever(int)
.
@author Jochen Wiedmann
@version $Id: Configurator.java,v 1.1 2003/09/23 12:34:50 jochen Exp $
Future functionality will include the capability to dynamically modify the layering of the protocol stack and the properties of each layer. @author Bela Ban @version $Id: Configurator.java,v 1.59 2008/12/05 09:22:00 belaban Exp $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|