public void begin(String namespace,
String name,
Attributes attributes) throws Exception {
// --------------------------------------------------------- Public Methods
// Retrieve any current Catalog with the specified name
Catalog catalog = null;
CatalogFactory factory = CatalogFactory.getInstance();
String nameValue = attributes.getValue(nameAttribute);
if (nameValue == null) {
catalog = factory.getCatalog();
} else {
catalog = factory.getCatalog(nameValue);
}
// Create and register a new Catalog instance if necessary
if (catalog == null) {
Class clazz = digester.getClassLoader().loadClass(catalogClass);
catalog = (Catalog) clazz.newInstance();
if (nameValue == null) {
factory.setCatalog(catalog);
} else {
factory.addCatalog(nameValue, catalog);
}
}
// Push this Catalog onto the top of the stack
digester.push(catalog);
}
Retrieve or create a Catalog with the name specified by
the nameAttribute attribute, or the default Catalog
if there is no such attribute defined. Push it onto the top of the
stack.
|