01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.xml.digester;
19:
20: import org.apache.commons.digester.Digester;
21: import org.apache.commons.digester.RuleSetBase;
22:
23: import de.finix.contelligent.xml.elements.AccessPropertyElement;
24: import de.finix.contelligent.xml.elements.BasicPublisherElement;
25: import de.finix.contelligent.xml.elements.ComponentMetainfoElement;
26: import de.finix.contelligent.xml.elements.ComponentSecurityElement;
27: import de.finix.contelligent.xml.elements.OwnerElement;
28:
29: public class ComponentMetainfoRuleSet extends RuleSetBase {
30: protected String prefix, setMethodName;
31:
32: public ComponentMetainfoRuleSet(String prefix, String setMethodName) {
33: this .prefix = prefix;
34: this .setMethodName = setMethodName;
35: }
36:
37: public ComponentMetainfoRuleSet(String prefix) {
38: this (prefix, "setMetainfoElement");
39: }
40:
41: public void addRuleInstances(Digester digester) {
42: digester.addObjectCreate(prefix + "meta-info",
43: ComponentMetainfoElement.class.getName());
44: digester.addSetProperties(prefix + "meta-info");
45:
46: if (setMethodName != null) {
47: digester.addSetNext(prefix + "meta-info", setMethodName,
48: ComponentMetainfoElement.class.getName());
49: }
50:
51: digester.addObjectCreate(prefix + "meta-info/security",
52: ComponentSecurityElement.class.getName());
53: digester.addSetProperties(prefix + "meta-info/security");
54: digester.addSetNext(prefix + "meta-info/security",
55: "setSecurityElement", ComponentSecurityElement.class
56: .getName());
57:
58: digester.addObjectCreate(prefix + "meta-info/security/owner",
59: OwnerElement.class.getName());
60: digester.addSetProperties(prefix + "meta-info/security/owner");
61: digester.addSetNext(prefix + "meta-info/security/owner",
62: "addOwnerElement", OwnerElement.class.getName());
63:
64: digester.addObjectCreate(prefix + "meta-info/security/access",
65: AccessPropertyElement.class.getName());
66: digester.addSetProperties(prefix + "meta-info/security/access");
67: digester.addSetNext(prefix + "meta-info/security/access",
68: "addAclEntry", AccessPropertyElement.class.getName());
69:
70: digester.addObjectCreate(prefix + "meta-info/publisher/basic",
71: BasicPublisherElement.class.getName());
72: digester.addSetProperties(prefix + "meta-info/publisher/basic");
73: // digester.addCallMethod(prefix + "meta-info/publisher/basic",
74: // "setValue", 0);
75: digester.addSetNext(prefix + "meta-info/publisher/basic",
76: "addBasicPublisherElement", BasicPublisherElement.class
77: .getName());
78: }
79: }
|